sourcecode 0.5.0__tar.gz → 0.7.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sourcecode-0.5.0 → sourcecode-0.7.0}/.gitignore +8 -2
- sourcecode-0.7.0/PKG-INFO +431 -0
- sourcecode-0.7.0/README.md +415 -0
- sourcecode-0.7.0/docs/schema.md +753 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/pyproject.toml +1 -1
- {sourcecode-0.5.0 → sourcecode-0.7.0}/src/sourcecode/__init__.py +1 -1
- {sourcecode-0.5.0 → sourcecode-0.7.0}/src/sourcecode/cli.py +434 -346
- sourcecode-0.7.0/src/sourcecode/doc_analyzer.py +531 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/src/sourcecode/schema.py +37 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/src/sourcecode/serializer.py +13 -7
- sourcecode-0.7.0/src/sourcecode/summarizer.py +68 -0
- sourcecode-0.7.0/tests/test_doc_analyzer_jsdom.py +216 -0
- sourcecode-0.7.0/tests/test_doc_analyzer_python.py +359 -0
- sourcecode-0.7.0/tests/test_integration_docs.py +283 -0
- sourcecode-0.7.0/tests/test_integration_lqn.py +178 -0
- sourcecode-0.7.0/tests/test_schema.py +314 -0
- sourcecode-0.7.0/tests/test_summarizer.py +145 -0
- sourcecode-0.5.0/.github/workflows/ci.yml +0 -42
- sourcecode-0.5.0/.github/workflows/release.yml +0 -101
- sourcecode-0.5.0/.planning/PROJECT.md +0 -79
- sourcecode-0.5.0/.planning/REQUIREMENTS.md +0 -111
- sourcecode-0.5.0/.planning/ROADMAP.md +0 -204
- sourcecode-0.5.0/.planning/STATE.md +0 -110
- sourcecode-0.5.0/.planning/config.json +0 -42
- sourcecode-0.5.0/.planning/phases/01-fundaciones/01-01-PLAN.md +0 -475
- sourcecode-0.5.0/.planning/phases/01-fundaciones/01-01-SUMMARY.md +0 -151
- sourcecode-0.5.0/.planning/phases/01-fundaciones/01-02-PLAN.md +0 -521
- sourcecode-0.5.0/.planning/phases/01-fundaciones/01-02-SUMMARY.md +0 -149
- sourcecode-0.5.0/.planning/phases/01-fundaciones/01-03-PLAN.md +0 -468
- sourcecode-0.5.0/.planning/phases/01-fundaciones/01-03-SUMMARY.md +0 -216
- sourcecode-0.5.0/.planning/phases/01-fundaciones/01-04-PLAN.md +0 -771
- sourcecode-0.5.0/.planning/phases/01-fundaciones/01-04-SUMMARY.md +0 -202
- sourcecode-0.5.0/.planning/phases/01-fundaciones/01-CONTEXT.md +0 -77
- sourcecode-0.5.0/.planning/phases/01-fundaciones/01-DISCUSSION-LOG.md +0 -29
- sourcecode-0.5.0/.planning/phases/01-fundaciones/01-RESEARCH.md +0 -652
- sourcecode-0.5.0/.planning/phases/01-fundaciones/01-REVIEW.md +0 -222
- sourcecode-0.5.0/.planning/phases/01-fundaciones/01-VERIFICATION.md +0 -134
- sourcecode-0.5.0/.planning/phases/02-deteccion-core/02-01-PLAN.md +0 -225
- sourcecode-0.5.0/.planning/phases/02-deteccion-core/02-01-SUMMARY.md +0 -88
- sourcecode-0.5.0/.planning/phases/02-deteccion-core/02-02-PLAN.md +0 -206
- sourcecode-0.5.0/.planning/phases/02-deteccion-core/02-02-SUMMARY.md +0 -84
- sourcecode-0.5.0/.planning/phases/02-deteccion-core/02-03-PLAN.md +0 -196
- sourcecode-0.5.0/.planning/phases/02-deteccion-core/02-03-SUMMARY.md +0 -84
- sourcecode-0.5.0/.planning/phases/02-deteccion-core/02-04-PLAN.md +0 -222
- sourcecode-0.5.0/.planning/phases/02-deteccion-core/02-04-SUMMARY.md +0 -110
- sourcecode-0.5.0/.planning/phases/02-deteccion-core/02-RESEARCH.md +0 -256
- sourcecode-0.5.0/.planning/phases/03-clasificacion-y-multi-stack/03-01-PLAN.md +0 -214
- sourcecode-0.5.0/.planning/phases/03-clasificacion-y-multi-stack/03-01-SUMMARY.md +0 -101
- sourcecode-0.5.0/.planning/phases/03-clasificacion-y-multi-stack/03-02-PLAN.md +0 -220
- sourcecode-0.5.0/.planning/phases/03-clasificacion-y-multi-stack/03-02-SUMMARY.md +0 -108
- sourcecode-0.5.0/.planning/phases/03-clasificacion-y-multi-stack/03-RESEARCH.md +0 -191
- sourcecode-0.5.0/.planning/phases/04-pulido-y-publicacion/04-01-PLAN.md +0 -186
- sourcecode-0.5.0/.planning/phases/04-pulido-y-publicacion/04-01-SUMMARY.md +0 -58
- sourcecode-0.5.0/.planning/phases/04-pulido-y-publicacion/04-02-PLAN.md +0 -138
- sourcecode-0.5.0/.planning/phases/04-pulido-y-publicacion/04-02-SUMMARY.md +0 -48
- sourcecode-0.5.0/.planning/phases/04-pulido-y-publicacion/04-03-PLAN.md +0 -141
- sourcecode-0.5.0/.planning/phases/04-pulido-y-publicacion/04-03-SUMMARY.md +0 -53
- sourcecode-0.5.0/.planning/phases/04-pulido-y-publicacion/04-RESEARCH.md +0 -153
- sourcecode-0.5.0/.planning/phases/05-scanner-universal-ampliar-stacks-ecosistemas-y-senales-de-de/.gitkeep +0 -0
- sourcecode-0.5.0/.planning/phases/05-scanner-universal-ampliar-stacks-ecosistemas-y-senales-de-de/05-01-PLAN.md +0 -146
- sourcecode-0.5.0/.planning/phases/05-scanner-universal-ampliar-stacks-ecosistemas-y-senales-de-de/05-01-SUMMARY.md +0 -53
- sourcecode-0.5.0/.planning/phases/05-scanner-universal-ampliar-stacks-ecosistemas-y-senales-de-de/05-02-PLAN.md +0 -169
- sourcecode-0.5.0/.planning/phases/05-scanner-universal-ampliar-stacks-ecosistemas-y-senales-de-de/05-02-SUMMARY.md +0 -53
- sourcecode-0.5.0/.planning/phases/05-scanner-universal-ampliar-stacks-ecosistemas-y-senales-de-de/05-03-PLAN.md +0 -164
- sourcecode-0.5.0/.planning/phases/05-scanner-universal-ampliar-stacks-ecosistemas-y-senales-de-de/05-03-SUMMARY.md +0 -51
- sourcecode-0.5.0/.planning/phases/05-scanner-universal-ampliar-stacks-ecosistemas-y-senales-de-de/05-04-PLAN.md +0 -183
- sourcecode-0.5.0/.planning/phases/05-scanner-universal-ampliar-stacks-ecosistemas-y-senales-de-de/05-04-SUMMARY.md +0 -57
- sourcecode-0.5.0/.planning/phases/05-scanner-universal-ampliar-stacks-ecosistemas-y-senales-de-de/05-RESEARCH.md +0 -165
- sourcecode-0.5.0/.planning/phases/06-dependencias-inteligentes/.gitkeep +0 -0
- sourcecode-0.5.0/.planning/phases/06-dependencias-inteligentes/06-01-PLAN.md +0 -140
- sourcecode-0.5.0/.planning/phases/06-dependencias-inteligentes/06-01-SUMMARY.md +0 -52
- sourcecode-0.5.0/.planning/phases/06-dependencias-inteligentes/06-02-PLAN.md +0 -135
- sourcecode-0.5.0/.planning/phases/06-dependencias-inteligentes/06-02-SUMMARY.md +0 -47
- sourcecode-0.5.0/.planning/phases/06-dependencias-inteligentes/06-03-PLAN.md +0 -132
- sourcecode-0.5.0/.planning/phases/06-dependencias-inteligentes/06-03-SUMMARY.md +0 -46
- sourcecode-0.5.0/.planning/phases/06-dependencias-inteligentes/06-04-PLAN.md +0 -143
- sourcecode-0.5.0/.planning/phases/06-dependencias-inteligentes/06-04-SUMMARY.md +0 -51
- sourcecode-0.5.0/.planning/phases/06-dependencias-inteligentes/06-RESEARCH.md +0 -171
- sourcecode-0.5.0/.planning/phases/07-grafos-de-codigo/.gitkeep +0 -0
- sourcecode-0.5.0/.planning/phases/07-grafos-de-codigo/07-01-PLAN.md +0 -141
- sourcecode-0.5.0/.planning/phases/07-grafos-de-codigo/07-01-SUMMARY.md +0 -52
- sourcecode-0.5.0/.planning/phases/07-grafos-de-codigo/07-02-PLAN.md +0 -134
- sourcecode-0.5.0/.planning/phases/07-grafos-de-codigo/07-02-SUMMARY.md +0 -48
- sourcecode-0.5.0/.planning/phases/07-grafos-de-codigo/07-03-PLAN.md +0 -131
- sourcecode-0.5.0/.planning/phases/07-grafos-de-codigo/07-03-SUMMARY.md +0 -46
- sourcecode-0.5.0/.planning/phases/07-grafos-de-codigo/07-04-PLAN.md +0 -143
- sourcecode-0.5.0/.planning/phases/07-grafos-de-codigo/07-04-SUMMARY.md +0 -50
- sourcecode-0.5.0/.planning/phases/07-grafos-de-codigo/07-RESEARCH.md +0 -165
- sourcecode-0.5.0/.planning/phases/08-documentacion-extraida/.gitkeep +0 -0
- sourcecode-0.5.0/.planning/phases/09-metricas-de-calidad/.gitkeep +0 -0
- sourcecode-0.5.0/.planning/phases/10-contexto-git-y-operativo/.gitkeep +0 -0
- sourcecode-0.5.0/.planning/research/ARCHITECTURE.md +0 -631
- sourcecode-0.5.0/.planning/research/FEATURES.md +0 -543
- sourcecode-0.5.0/.planning/research/PITFALLS.md +0 -341
- sourcecode-0.5.0/.planning/research/STACK.md +0 -436
- sourcecode-0.5.0/PKG-INFO +0 -298
- sourcecode-0.5.0/README.md +0 -282
- sourcecode-0.5.0/docs/schema.md +0 -427
- sourcecode-0.5.0/tests/test_schema.py +0 -133
- {sourcecode-0.5.0 → sourcecode-0.7.0}/.ruff.toml +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/src/sourcecode/classifier.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/src/sourcecode/dependency_analyzer.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/src/sourcecode/detectors/__init__.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/src/sourcecode/detectors/base.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/src/sourcecode/detectors/dart.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/src/sourcecode/detectors/dotnet.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/src/sourcecode/detectors/elixir.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/src/sourcecode/detectors/go.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/src/sourcecode/detectors/heuristic.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/src/sourcecode/detectors/java.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/src/sourcecode/detectors/jvm_ext.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/src/sourcecode/detectors/nodejs.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/src/sourcecode/detectors/parsers.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/src/sourcecode/detectors/php.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/src/sourcecode/detectors/project.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/src/sourcecode/detectors/python.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/src/sourcecode/detectors/ruby.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/src/sourcecode/detectors/rust.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/src/sourcecode/detectors/systems.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/src/sourcecode/detectors/terraform.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/src/sourcecode/detectors/tooling.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/src/sourcecode/graph_analyzer.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/src/sourcecode/redactor.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/src/sourcecode/scanner.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/src/sourcecode/tree_utils.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/src/sourcecode/workspace.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/tests/__init__.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/tests/conftest.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/tests/fixtures/fastapi_app/pyproject.toml +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/tests/fixtures/fastapi_app/src/main.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/tests/fixtures/go_service/cmd/api/main.go +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/tests/fixtures/go_service/go.mod +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/tests/fixtures/nextjs_app/app/page.tsx +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/tests/fixtures/nextjs_app/package.json +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/tests/fixtures/nextjs_app/pnpm-lock.yaml +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/tests/fixtures/pnpm_monorepo/apps/web/app/page.tsx +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/tests/fixtures/pnpm_monorepo/apps/web/package.json +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/tests/fixtures/pnpm_monorepo/packages/api/main.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/tests/fixtures/pnpm_monorepo/packages/api/pyproject.toml +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/tests/fixtures/pnpm_monorepo/pnpm-workspace.yaml +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/tests/test_classifier.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/tests/test_cli.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/tests/test_dependency_analyzer_node_python.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/tests/test_dependency_analyzer_polyglot.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/tests/test_dependency_schema.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/tests/test_detector_go_rust_java.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/tests/test_detector_nodejs.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/tests/test_detector_php_ruby_dart.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/tests/test_detector_python.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/tests/test_detector_universal_managed.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/tests/test_detector_universal_systems.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/tests/test_detectors_base.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/tests/test_graph_analyzer_polyglot.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/tests/test_graph_analyzer_python_node.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/tests/test_graph_schema.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/tests/test_integration.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/tests/test_integration_dependencies.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/tests/test_integration_detection.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/tests/test_integration_graph_modules.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/tests/test_integration_multistack.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/tests/test_integration_universal.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/tests/test_packaging.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/tests/test_real_projects.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/tests/test_redactor.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/tests/test_scanner.py +0 -0
- {sourcecode-0.5.0 → sourcecode-0.7.0}/tests/test_workspace_analyzer.py +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# Python cache and build artifacts
|
|
1
2
|
__pycache__/
|
|
2
3
|
*.pyc
|
|
3
4
|
*.pyo
|
|
@@ -11,8 +12,7 @@ build/
|
|
|
11
12
|
.mypy_cache/
|
|
12
13
|
.ruff_cache/
|
|
13
14
|
.pytest_cache/
|
|
14
|
-
|
|
15
|
-
/src/*.egg-info/
|
|
15
|
+
src/*.egg-info/
|
|
16
16
|
|
|
17
17
|
# Editor / IDE
|
|
18
18
|
.idea/
|
|
@@ -22,6 +22,12 @@ build/
|
|
|
22
22
|
.claude/
|
|
23
23
|
.codex/
|
|
24
24
|
|
|
25
|
+
# Environment / secrets
|
|
26
|
+
*.env
|
|
27
|
+
*.secret.json
|
|
28
|
+
|
|
25
29
|
# OS cruft
|
|
26
30
|
.DS_Store
|
|
27
31
|
Thumbs.db
|
|
32
|
+
|
|
33
|
+
.planning
|
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sourcecode
|
|
3
|
+
Version: 0.7.0
|
|
4
|
+
Summary: Genera un mapa de contexto estructurado de proyectos de software para agentes IA
|
|
5
|
+
License: MIT
|
|
6
|
+
Requires-Python: >=3.9
|
|
7
|
+
Requires-Dist: pathspec>=1.0
|
|
8
|
+
Requires-Dist: ruamel-yaml>=0.18
|
|
9
|
+
Requires-Dist: tomli>=2.0; python_version < '3.11'
|
|
10
|
+
Requires-Dist: typer>=0.24
|
|
11
|
+
Provides-Extra: dev
|
|
12
|
+
Requires-Dist: mypy>=1.10; extra == 'dev'
|
|
13
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
14
|
+
Requires-Dist: ruff>=0.15; extra == 'dev'
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
|
|
17
|
+
<!-- generated-by: gsd-doc-writer -->
|
|
18
|
+
# sourcecode
|
|
19
|
+
|
|
20
|
+
`sourcecode` generates a structured project context map so an agent can quickly understand a repository's stack, entry points, and overall shape. Designed for injection into AI development agents as initial session context.
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pip install sourcecode
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Requires Python `3.9+`.
|
|
29
|
+
|
|
30
|
+
## Quick Start
|
|
31
|
+
|
|
32
|
+
Analyze the current directory as JSON:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
sourcecode .
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Generate a compact view for prompts or handoff (~500-700 tokens):
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
sourcecode --compact .
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Analyze another directory and write YAML to a file:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
sourcecode --format yaml --output sourcecode.yaml /path/to/project
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Include direct dependencies, exact versions, and transitive dependencies when compatible lockfiles are available:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
sourcecode . --dependencies
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Include an internal module graph with imports and structural relations:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
sourcecode . --graph-modules
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Extract docstrings, signatures, and comments from Python and JS/TS modules:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
sourcecode . --docs
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Control how deep the documentation extraction goes:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
sourcecode . --docs --docs-depth module # module-level docs only
|
|
72
|
+
sourcecode . --docs --docs-depth symbols # modules + functions/classes (default)
|
|
73
|
+
sourcecode . --docs --docs-depth full # all symbols including methods
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Show the version:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
sourcecode --version
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## What It Detects
|
|
83
|
+
|
|
84
|
+
- Stacks: Node.js, Python, Go, Rust, Java, PHP, Ruby, and Dart.
|
|
85
|
+
- Frameworks associated with each stack when enough signals are present.
|
|
86
|
+
- `project_type`: `webapp`, `api`, `library`, `cli`, `fullstack`, `monorepo`, or `unknown`.
|
|
87
|
+
- Relevant `entry_points`, such as `main.py`, `cmd/api/main.go`, or `app/page.tsx`.
|
|
88
|
+
- Workspace roots in multi-stack or monorepo repositories.
|
|
89
|
+
|
|
90
|
+
## CLI Options
|
|
91
|
+
|
|
92
|
+
| Option | Default | Description |
|
|
93
|
+
|--------|---------|-------------|
|
|
94
|
+
| `PATH` | `.` | Directory to analyze. |
|
|
95
|
+
| `--format json\|yaml` | `json` | Output format. |
|
|
96
|
+
| `--output PATH` | stdout | Write to a file instead of stdout. |
|
|
97
|
+
| `--compact` | off | Reduced output (~500-700 tokens): `schema_version`, `project_type`, `project_summary`, `stacks`, `entry_points`, `file_paths`, `file_tree_depth1`, and `dependency_summary` when available. |
|
|
98
|
+
| `--dependencies` | off | Include direct dependencies, resolved versions, and transitive relationships when lockfiles make that possible. Also populates `key_dependencies`. |
|
|
99
|
+
| `--graph-modules` | off | Include a structural module graph with imports and simple relations. |
|
|
100
|
+
| `--graph-detail high\|medium\|full` | `high` | Graph detail level: summarized (high), balanced (medium), or full-fidelity (full). |
|
|
101
|
+
| `--max-nodes INTEGER` | none | Cap graph size in `high` and `medium` modes. Min: 1. |
|
|
102
|
+
| `--graph-edges imports,calls,contains,extends` | none | Override the default edge kinds for the selected detail level. |
|
|
103
|
+
| `--docs` | off | Include extracted documentation: docstrings, signatures, and comments from Python and JS/TS modules and symbols. |
|
|
104
|
+
| `--docs-depth module\|symbols\|full` | `symbols` | Documentation extraction depth: module-level only, modules and top-level symbols (functions/classes), or all symbols including methods. |
|
|
105
|
+
| `--depth INTEGER` | `4` | Maximum file tree depth. Range: 1–20. |
|
|
106
|
+
| `--no-redact` | off | Disable secret redaction (enabled by default). |
|
|
107
|
+
| `--version` | — | Show version and exit. |
|
|
108
|
+
|
|
109
|
+
## Output Fields
|
|
110
|
+
|
|
111
|
+
The full schema (`SourceMap`) includes the following fields:
|
|
112
|
+
|
|
113
|
+
### Always present
|
|
114
|
+
|
|
115
|
+
| Field | Type | Description |
|
|
116
|
+
|-------|------|-------------|
|
|
117
|
+
| `metadata` | object | Schema version, timestamp, `sourcecode` version, and analyzed path. |
|
|
118
|
+
| `file_tree` | object | Repository tree where `null` represents a file and `{}` represents a directory. |
|
|
119
|
+
| `file_paths` | array | Flat list of all project paths derived from `file_tree`, with forward-slash separators. Always present; respects `--depth`. |
|
|
120
|
+
| `project_summary` | string\|null | Deterministic natural-language description of the project generated from detected stacks, entry points, and dependencies. Present when stacks are detected. |
|
|
121
|
+
| `stacks` | array | Stack detections with confidence, frameworks, manifests, `primary`, `root`, `workspace`, and `signals`. |
|
|
122
|
+
| `project_type` | string\|null | Overall project classification. |
|
|
123
|
+
| `entry_points` | array | Detected entry points by stack. |
|
|
124
|
+
|
|
125
|
+
### With `--dependencies`
|
|
126
|
+
|
|
127
|
+
| Field | Type | Description |
|
|
128
|
+
|-------|------|-------------|
|
|
129
|
+
| `dependencies` | array | Dependency records with declared and resolved versions, scope, and manifest path. |
|
|
130
|
+
| `dependency_summary` | object | Summary with ecosystem coverage, counts (total, direct, transitive), sources, and known limitations. |
|
|
131
|
+
| `key_dependencies` | array | Top-15 direct dependencies from `manifest` or `lockfile` sources, sorted by primary ecosystem first then alphabetically. Only populated when `--dependencies` is active. |
|
|
132
|
+
|
|
133
|
+
### With `--graph-modules`
|
|
134
|
+
|
|
135
|
+
| Field | Type | Description |
|
|
136
|
+
|-------|------|-------------|
|
|
137
|
+
| `module_graph` | object | Structural graph with nodes, edges, and analysis summary. |
|
|
138
|
+
| `module_graph_summary` | object | Compact graph summary (node/edge counts, layers, main flows, truncation status). |
|
|
139
|
+
|
|
140
|
+
### With `--docs`
|
|
141
|
+
|
|
142
|
+
| Field | Type | Description |
|
|
143
|
+
|-------|------|-------------|
|
|
144
|
+
| `docs` | array | Extracted `DocRecord` objects for each documented symbol. |
|
|
145
|
+
| `doc_summary` | object | Summary with total count, languages, depth used, truncation status, and limitations. |
|
|
146
|
+
|
|
147
|
+
## Compact Mode
|
|
148
|
+
|
|
149
|
+
`--compact` returns a reduced JSON view optimized for LLM prompts (~500-700 tokens). It excludes the full `dependencies` list, `docs`, and `module_graph`, while retaining the fields most useful for project orientation.
|
|
150
|
+
|
|
151
|
+
Real output from a Python FastAPI project:
|
|
152
|
+
|
|
153
|
+
```json
|
|
154
|
+
{
|
|
155
|
+
"schema_version": "1.0",
|
|
156
|
+
"project_type": "api",
|
|
157
|
+
"project_summary": "API en Python (FastAPI). Entry points: src/main.py. 12 dependencias (python).",
|
|
158
|
+
"stacks": [
|
|
159
|
+
{
|
|
160
|
+
"stack": "python",
|
|
161
|
+
"detection_method": "manifest",
|
|
162
|
+
"confidence": "high",
|
|
163
|
+
"frameworks": [
|
|
164
|
+
{ "name": "FastAPI", "source": "package.json" }
|
|
165
|
+
],
|
|
166
|
+
"package_manager": null,
|
|
167
|
+
"manifests": ["pyproject.toml"],
|
|
168
|
+
"primary": true,
|
|
169
|
+
"root": ".",
|
|
170
|
+
"workspace": null,
|
|
171
|
+
"signals": ["manifest:pyproject.toml", "framework:FastAPI", "entry:src/main.py"]
|
|
172
|
+
}
|
|
173
|
+
],
|
|
174
|
+
"entry_points": [
|
|
175
|
+
{
|
|
176
|
+
"path": "src/main.py",
|
|
177
|
+
"stack": "python",
|
|
178
|
+
"kind": "cli",
|
|
179
|
+
"source": "manifest"
|
|
180
|
+
}
|
|
181
|
+
],
|
|
182
|
+
"file_paths": ["pyproject.toml", "src/main.py", "src/routes.py", "tests/test_main.py"],
|
|
183
|
+
"file_tree_depth1": {
|
|
184
|
+
"pyproject.toml": null,
|
|
185
|
+
"src": {},
|
|
186
|
+
"tests": {}
|
|
187
|
+
},
|
|
188
|
+
"dependency_summary": null
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
When `--compact --dependencies` is used, `dependency_summary` is populated instead of `null`.
|
|
193
|
+
|
|
194
|
+
## Docs Mode
|
|
195
|
+
|
|
196
|
+
`--docs` extracts docstrings, function signatures, and comments from Python and JS/TS source files. Each extracted record is a `DocRecord`:
|
|
197
|
+
|
|
198
|
+
```json
|
|
199
|
+
{
|
|
200
|
+
"symbol": "create_user",
|
|
201
|
+
"kind": "function",
|
|
202
|
+
"language": "python",
|
|
203
|
+
"path": "src/users.py",
|
|
204
|
+
"doc_text": "Create a new user in the database.\n\nReturns the created user ID.",
|
|
205
|
+
"signature": "def create_user(name: str, email: str) -> int",
|
|
206
|
+
"source": "docstring",
|
|
207
|
+
"importance": "high",
|
|
208
|
+
"workspace": null
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### DocRecord fields
|
|
213
|
+
|
|
214
|
+
| Field | Description |
|
|
215
|
+
|-------|-------------|
|
|
216
|
+
| `symbol` | Symbol name (module name, function name, class name, etc.). |
|
|
217
|
+
| `kind` | Kind of symbol: `module`, `function`, `class`, `method`, or similar. |
|
|
218
|
+
| `language` | Source language: `python`, `javascript`, `typescript`. |
|
|
219
|
+
| `path` | File path relative to the project root, forward-slash separated. |
|
|
220
|
+
| `doc_text` | Extracted docstring or comment text. `null` if unavailable. |
|
|
221
|
+
| `signature` | Function or class signature as found in source. `null` for modules. |
|
|
222
|
+
| `source` | How the doc was obtained: `docstring`, `comment`, or `unavailable`. Records with `source="unavailable"` are not emitted in `docs[]` — they appear only in `doc_summary.limitations`. |
|
|
223
|
+
| `importance` | Inferred priority: `high`, `medium`, or `low`. |
|
|
224
|
+
| `workspace` | Workspace path for monorepo packages, `null` for single-workspace projects. |
|
|
225
|
+
|
|
226
|
+
### Importance inference rules
|
|
227
|
+
|
|
228
|
+
- `high`: the file path matches a project entry point, or the module is at depth 1 in the file tree (e.g., `src/main.py`).
|
|
229
|
+
- `medium`: the file is at depth 2, or the symbol kind is `class` or `function` (not a method).
|
|
230
|
+
- `low`: methods and utilities in deeper subdirectories.
|
|
231
|
+
|
|
232
|
+
### `--docs-depth` levels
|
|
233
|
+
|
|
234
|
+
- `module`: extracts module-level docstrings only. One record per file.
|
|
235
|
+
- `symbols` (default): module-level plus top-level functions and classes.
|
|
236
|
+
- `full`: all of the above plus methods inside classes.
|
|
237
|
+
|
|
238
|
+
## Output — Full Schema Examples
|
|
239
|
+
|
|
240
|
+
### Dependencies
|
|
241
|
+
|
|
242
|
+
```json
|
|
243
|
+
{
|
|
244
|
+
"dependencies": [
|
|
245
|
+
{
|
|
246
|
+
"name": "fastapi",
|
|
247
|
+
"ecosystem": "python",
|
|
248
|
+
"scope": "direct",
|
|
249
|
+
"declared_version": ">=0.115",
|
|
250
|
+
"resolved_version": "0.115.2",
|
|
251
|
+
"source": "lockfile",
|
|
252
|
+
"parent": null,
|
|
253
|
+
"manifest_path": "poetry.lock",
|
|
254
|
+
"workspace": null
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
"name": "starlette",
|
|
258
|
+
"ecosystem": "python",
|
|
259
|
+
"scope": "transitive",
|
|
260
|
+
"declared_version": null,
|
|
261
|
+
"resolved_version": "0.38.6",
|
|
262
|
+
"source": "lockfile",
|
|
263
|
+
"parent": "fastapi",
|
|
264
|
+
"manifest_path": "poetry.lock",
|
|
265
|
+
"workspace": null
|
|
266
|
+
}
|
|
267
|
+
],
|
|
268
|
+
"dependency_summary": {
|
|
269
|
+
"requested": true,
|
|
270
|
+
"total_count": 2,
|
|
271
|
+
"direct_count": 1,
|
|
272
|
+
"transitive_count": 1,
|
|
273
|
+
"ecosystems": ["python"],
|
|
274
|
+
"sources": ["lockfile"],
|
|
275
|
+
"limitations": []
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
Dependency analysis is offline and conservative: if a lockfile does not expose a reliable transitive graph, `sourcecode` reports direct dependencies and records the limitation instead of guessing.
|
|
281
|
+
|
|
282
|
+
### Module Graph
|
|
283
|
+
|
|
284
|
+
```json
|
|
285
|
+
{
|
|
286
|
+
"module_graph": {
|
|
287
|
+
"nodes": [
|
|
288
|
+
{
|
|
289
|
+
"id": "module:app",
|
|
290
|
+
"kind": "module",
|
|
291
|
+
"language": "python",
|
|
292
|
+
"path": "app",
|
|
293
|
+
"symbol": null,
|
|
294
|
+
"display_name": "app",
|
|
295
|
+
"workspace": null,
|
|
296
|
+
"importance": "high"
|
|
297
|
+
}
|
|
298
|
+
],
|
|
299
|
+
"edges": [],
|
|
300
|
+
"summary": {
|
|
301
|
+
"requested": true,
|
|
302
|
+
"node_count": 1,
|
|
303
|
+
"edge_count": 0,
|
|
304
|
+
"languages": ["python"],
|
|
305
|
+
"methods": ["ast"],
|
|
306
|
+
"main_flows": [],
|
|
307
|
+
"layers": ["app"],
|
|
308
|
+
"entry_points_count": 1,
|
|
309
|
+
"truncated": false,
|
|
310
|
+
"detail": "high",
|
|
311
|
+
"max_nodes_applied": 80,
|
|
312
|
+
"edge_kinds": ["imports"],
|
|
313
|
+
"limitations": []
|
|
314
|
+
}
|
|
315
|
+
},
|
|
316
|
+
"module_graph_summary": {
|
|
317
|
+
"requested": true,
|
|
318
|
+
"node_count": 1,
|
|
319
|
+
"edge_count": 0,
|
|
320
|
+
"main_flows": [],
|
|
321
|
+
"layers": ["app"],
|
|
322
|
+
"entry_points_count": 1,
|
|
323
|
+
"truncated": false,
|
|
324
|
+
"limitations": []
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
`--graph-modules` is tiered for LLM workflows:
|
|
330
|
+
|
|
331
|
+
- `high`: summarized graph, modules only, imports only, directory collapsing when useful. Default.
|
|
332
|
+
- `medium`: balanced graph with key functions and selected call edges.
|
|
333
|
+
- `full`: full-fidelity graph, equivalent to exhaustive AST analysis.
|
|
334
|
+
|
|
335
|
+
Graph analysis is offline and conservative. `sourcecode` prefers partial but defensible edges over pretending to build a perfect semantic call graph, and records parse failures, unresolved imports, or analysis budgets in `module_graph.summary.limitations`.
|
|
336
|
+
|
|
337
|
+
## Monorepo Support
|
|
338
|
+
|
|
339
|
+
In a monorepo, each stack includes its own `root` and `workspace`, and one of them is marked as `primary`. Entry point and doc record paths are prefixed with the workspace path so they are relative to the repository root.
|
|
340
|
+
|
|
341
|
+
```json
|
|
342
|
+
{
|
|
343
|
+
"project_type": "monorepo",
|
|
344
|
+
"project_summary": "Monorepo con 2 workspaces en Node.js, Python.",
|
|
345
|
+
"stacks": [
|
|
346
|
+
{
|
|
347
|
+
"stack": "nodejs",
|
|
348
|
+
"primary": true,
|
|
349
|
+
"root": "apps/web",
|
|
350
|
+
"workspace": "apps/web"
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
"stack": "python",
|
|
354
|
+
"primary": false,
|
|
355
|
+
"root": "packages/api",
|
|
356
|
+
"workspace": "packages/api"
|
|
357
|
+
}
|
|
358
|
+
],
|
|
359
|
+
"entry_points": [
|
|
360
|
+
{ "path": "apps/web/app/page.tsx", "stack": "nodejs", "kind": "web", "source": "manifest" },
|
|
361
|
+
{ "path": "packages/api/main.py", "stack": "python", "kind": "cli", "source": "manifest" }
|
|
362
|
+
]
|
|
363
|
+
}
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
## LLM Usage Tips
|
|
367
|
+
|
|
368
|
+
Different modes optimize for different tradeoffs between context size and depth of information.
|
|
369
|
+
|
|
370
|
+
**`--compact` — minimal context (~500-700 tokens)**
|
|
371
|
+
|
|
372
|
+
Best for: initial orientation, deciding what to explore next, fast handoffs between agents.
|
|
373
|
+
|
|
374
|
+
Includes: `project_summary` (instant project description), `stacks`, `entry_points`, `file_paths` (flat path list for easy grep/reasoning), `file_tree_depth1`, and `dependency_summary` when `--dependencies` was also requested.
|
|
375
|
+
|
|
376
|
+
```bash
|
|
377
|
+
sourcecode --compact .
|
|
378
|
+
sourcecode --compact --dependencies .
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
**Full output — deep analysis**
|
|
382
|
+
|
|
383
|
+
Best for: thorough codebase understanding, architecture analysis, onboarding a new agent to an unfamiliar project.
|
|
384
|
+
|
|
385
|
+
```bash
|
|
386
|
+
sourcecode .
|
|
387
|
+
sourcecode --dependencies --graph-modules .
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
**`--docs --docs-depth symbols` — API contracts**
|
|
391
|
+
|
|
392
|
+
Best for: understanding what a module exports and how to call it, without reading source files. The default depth (`symbols`) covers top-level functions and classes — the most useful level for most agentic tasks.
|
|
393
|
+
|
|
394
|
+
```bash
|
|
395
|
+
sourcecode --docs .
|
|
396
|
+
sourcecode --docs --docs-depth full . # include methods
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
**`project_summary` field**
|
|
400
|
+
|
|
401
|
+
`project_summary` is always generated when stacks are detected. It provides instant project context without requiring the LLM to parse the full structure. Example values:
|
|
402
|
+
|
|
403
|
+
- `"API en Python (FastAPI). Entry points: src/main.py. 12 dependencias (python)."`
|
|
404
|
+
- `"Aplicacion web en Node.js (Next.js, React). Entry points: app/page.tsx."`
|
|
405
|
+
- `"Monorepo con 2 workspaces en Node.js, Python."`
|
|
406
|
+
|
|
407
|
+
**`file_paths` field**
|
|
408
|
+
|
|
409
|
+
`file_paths` is a flat list of all project paths (forward-slash separated). It is easier for LLMs to reason about than the nested `file_tree` dict — grep it, count by extension, or identify modules by path pattern without recursive traversal.
|
|
410
|
+
|
|
411
|
+
**`key_dependencies` field**
|
|
412
|
+
|
|
413
|
+
When `--dependencies` is active, `key_dependencies` contains the top-15 direct dependencies sorted by primary ecosystem first. Use it to understand core library choices without scanning hundreds of transitive records.
|
|
414
|
+
|
|
415
|
+
## Development
|
|
416
|
+
|
|
417
|
+
Editable install with development dependencies:
|
|
418
|
+
|
|
419
|
+
```bash
|
|
420
|
+
pip install -e ".[dev]"
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
Local validation:
|
|
424
|
+
|
|
425
|
+
```bash
|
|
426
|
+
ruff check src tests
|
|
427
|
+
mypy src
|
|
428
|
+
pytest -q
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
Detailed schema reference: [docs/schema.md](docs/schema.md).
|