Problem Description
In insight/reporter.py, reports are named purely by os.path.basename:
filename = os.path.basename(file_info["file"]) + ".md"
filepath = os.path.join(output_dir, filename)
In almost every non-trivial project, multiple files share identical basenames across different directories:
pkg_a/__init__.py and pkg_b/__init__.py
models/user.py and routes/user.py
components/Button.tsx and legacy/Button.tsx
src/index.js and test/index.js
Impact
- Each subsequent file with the same basename silently overwrites the report generated for earlier files.
- In
summary.md, multiple entries point to the same overwritten file.
- Historical analysis of overwritten files is permanently lost.
Affected Files
Proposed Solution
Option A (Preserve Directory Tree):
Mirror the source directory structure under report/ (e.g. report/models/user.py.md and report/routes/user.py.md).
Option B (Path Sanitization):
Convert relative paths into unique flat filenames (e.g. report/models_user.py.md and report/routes_user.py.md).
Problem Description
In
insight/reporter.py, reports are named purely byos.path.basename:In almost every non-trivial project, multiple files share identical basenames across different directories:
pkg_a/__init__.pyandpkg_b/__init__.pymodels/user.pyandroutes/user.pycomponents/Button.tsxandlegacy/Button.tsxsrc/index.jsandtest/index.jsImpact
summary.md, multiple entries point to the same overwritten file.Affected Files
insight/reporter.py:3-35Proposed Solution
Option A (Preserve Directory Tree):
Mirror the source directory structure under
report/(e.g.report/models/user.py.mdandreport/routes/user.py.md).Option B (Path Sanitization):
Convert relative paths into unique flat filenames (e.g.
report/models_user.py.mdandreport/routes_user.py.md).