This repository is for a minimal MVP of a code decoupling diagnosis agent.
The product is not a general autonomous coding agent. The product is a focused static analysis and diagnosis tool for Python repositories.
Its job is to:
- scan a local Python repository
- collect structural artifacts
- run rule-based diagnosis
- generate a markdown summary and json artifacts
This version only supports:
- local CLI usage
- Python repository analysis
.pyfile scanning- import relationship scanning
- class / function / method definition scanning
- approximate call graph scanning
- environment variable usage scanning
- database / ORM usage signal scanning
- shared utils/common/helper dependency scanning
- global state signal scanning
- rule-based findings generation
- markdown/json report generation
Do NOT implement any of the following in this version:
- automatic code rewriting
- patch generation for source code changes
- code execution agent loops
- external LLM API integration
- web frontend
- database persistence
- background jobs
- distributed architecture
- multi-language repository support
- highly advanced whole-program static analysis
- enterprise-scale plugin system
When making implementation choices, prefer:
- simplicity over cleverness
- runnable code over abstract architecture
- small modules over giant files
- explicit data flow over hidden coupling
- lightweight dependencies over heavy frameworks
- stable output formats over fancy presentation
Avoid over-engineering.
- Python 3.11+
- analyze only
.pyfiles - prefer Python standard library:
astpathlibargparsejsoncollectionsdataclassestyping
- if a dependency is needed, keep it lightweight
- do not introduce unnecessary frameworks
Target CLI shape:
python main.py --repo /path/to/repo --output ./outputThe implementation should generate:
summary.mdartifacts/import_graph.jsonartifacts/definitions.jsonartifacts/call_graph.jsonartifacts/env_usage.jsonartifacts/db_usage.jsonartifacts/utils_usage.jsonartifacts/global_state.jsonartifacts/findings.json
At minimum, implement these scanners:
- import scanner
- definitions scanner
- call scanner
- env usage scanner
- db usage scanner
- utils usage scanner
- global state scanner
At minimum, support findings for:
- handler/controller/router files directly using database access signals
- the same environment variable being directly read in multiple files
- utils/common/helper modules being overused
- suspected mutable global state
- simple cyclic import detection
Generate a readable summary.md that includes:
- scan overview
- top import-heavy files
- environment variable usage overview
- database access signal overview
- shared utils dependency overview
- global state risk overview
- findings list
- explanation and suggestion for each finding
- limitations section
Add basic tests. At minimum include tests for:
- import scanning
- env scanning
- at least one rule engine case
This repository is only Phase 1:
Phase 1 = diagnosis Phase 2 = planning Phase 3 = controlled execution
Do not jump into Phase 2 or Phase 3 yet.