sourcecode 1.32.7__tar.gz → 1.33.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-1.32.7 → sourcecode-1.33.0}/CHANGELOG.md +8 -0
- sourcecode-1.33.0/PKG-INFO +437 -0
- sourcecode-1.33.0/README.md +400 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/pyproject.toml +2 -2
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/__init__.py +1 -1
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/cli.py +11 -2
- sourcecode-1.32.7/PKG-INFO +0 -456
- sourcecode-1.32.7/README.md +0 -419
- {sourcecode-1.32.7 → sourcecode-1.33.0}/.github/workflows/build-windows.yml +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/.gitignore +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/.ruff.toml +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/CONTRIBUTING.md +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/LICENSE +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/SECURITY.md +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/raw +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/adaptive_scanner.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/architecture_analyzer.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/architecture_summary.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/ast_extractor.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/cache.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/cache.tmp_new +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/canonical_ir.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/classifier.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/code_notes_analyzer.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/confidence_analyzer.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/context_scorer.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/context_summarizer.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/contract_model.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/contract_pipeline.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/coverage_parser.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/dependency_analyzer.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/detectors/__init__.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/detectors/base.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/detectors/csproj_parser.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/detectors/dart.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/detectors/dotnet.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/detectors/elixir.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/detectors/go.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/detectors/heuristic.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/detectors/hybrid.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/detectors/java.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/detectors/jvm_ext.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/detectors/nodejs.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/detectors/parsers.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/detectors/php.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/detectors/project.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/detectors/python.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/detectors/ruby.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/detectors/rust.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/detectors/systems.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/detectors/terraform.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/detectors/tooling.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/doc_analyzer.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/entrypoint_classifier.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/env_analyzer.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/file_classifier.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/flow_analyzer.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/git_analyzer.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/graph_analyzer.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/license.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/mcp/__init__.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/mcp/onboarding/__init__.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/mcp/onboarding/applier.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/mcp/onboarding/backup.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/mcp/onboarding/detector.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/mcp/onboarding/planner.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/mcp/runner.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/mcp/server.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/mcp_nudge.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/metrics_analyzer.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/output_budget.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/path_filters.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/pr_comment_renderer.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/prepare_context.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/progress.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/ranking_engine.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/redactor.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/relevance_scorer.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/repo_classifier.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/repository_ir.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/ris.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/runtime_classifier.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/scanner.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/schema.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/semantic_analyzer.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/serializer.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/summarizer.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/telemetry/__init__.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/telemetry/config.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/telemetry/consent.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/telemetry/events.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/telemetry/filters.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/telemetry/transport.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/tree_utils.py +0 -0
- {sourcecode-1.32.7 → sourcecode-1.33.0}/src/sourcecode/workspace.py +0 -0
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.33.0] — 2026-05-29
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
- **Repositioned product identity** around persistent structural cache and ultra-fast repeated analysis for AI coding agents. Cache is now the central product story, not a performance feature.
|
|
7
|
+
- README rewritten: new intro emphasizing persistent context engine, cache performance benchmarks promoted above quickstart, agent workflow patterns section added, "Java/Spring analysis CLI" framing moved down.
|
|
8
|
+
- `pyproject.toml` description updated: "Persistent structural context and ultra-fast repeated analysis for AI coding agents".
|
|
9
|
+
- CLI `--help` updated: tagline, cold/warm latency numbers, cache commands section added prominently.
|
|
10
|
+
|
|
3
11
|
## [Unreleased]
|
|
4
12
|
|
|
5
13
|
### Added
|
|
@@ -0,0 +1,437 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sourcecode
|
|
3
|
+
Version: 1.33.0
|
|
4
|
+
Summary: Persistent structural context and ultra-fast repeated analysis for AI coding agents
|
|
5
|
+
License-File: LICENSE
|
|
6
|
+
Keywords: agents,ai,codebase,context,developer-tools,llm
|
|
7
|
+
Classifier: Development Status :: 4 - Beta
|
|
8
|
+
Classifier: Environment :: Console
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
18
|
+
Classifier: Topic :: Utilities
|
|
19
|
+
Requires-Python: >=3.9
|
|
20
|
+
Requires-Dist: mcp>=1.0.0
|
|
21
|
+
Requires-Dist: pathspec>=1.0
|
|
22
|
+
Requires-Dist: ruamel-yaml>=0.18
|
|
23
|
+
Requires-Dist: tomli>=2.0; python_version < '3.11'
|
|
24
|
+
Requires-Dist: typer>=0.24
|
|
25
|
+
Provides-Extra: ast
|
|
26
|
+
Requires-Dist: tree-sitter-javascript>=0.21; extra == 'ast'
|
|
27
|
+
Requires-Dist: tree-sitter-typescript>=0.21; extra == 'ast'
|
|
28
|
+
Requires-Dist: tree-sitter>=0.21; extra == 'ast'
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: mcp>=1.0.0; extra == 'dev'
|
|
31
|
+
Requires-Dist: mypy>=1.10; extra == 'dev'
|
|
32
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
33
|
+
Requires-Dist: ruff>=0.15; extra == 'dev'
|
|
34
|
+
Provides-Extra: mcp
|
|
35
|
+
Requires-Dist: mcp>=1.0.0; extra == 'mcp'
|
|
36
|
+
Description-Content-Type: text/markdown
|
|
37
|
+
|
|
38
|
+
# sourcecode
|
|
39
|
+
|
|
40
|
+
**Persistent structural context and ultra-fast repeated analysis for AI coding agents.**
|
|
41
|
+
|
|
42
|
+

|
|
43
|
+

|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## The problem
|
|
48
|
+
|
|
49
|
+
Every time an AI coding agent starts a new session, it has to re-parse the repository from scratch. For a large Java or TypeScript monolith, that means 5–15 seconds per invocation. Multiply by dozens of agent turns per hour, and repo context acquisition becomes a real bottleneck — not just latency, but tokens, compute, and iteration velocity.
|
|
50
|
+
|
|
51
|
+
`sourcecode` solves this with a persistent structural cache keyed on file content hashes. After the first scan, every subsequent invocation returns pre-built context in milliseconds. The repo doesn't change? The cache doesn't expire.
|
|
52
|
+
|
|
53
|
+
**The cache is not a performance optimization. It is what makes sourcecode usable as infrastructure rather than a one-off tool.**
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Cache performance — measured on real repos
|
|
58
|
+
|
|
59
|
+
| Repo | Size | Cold scan | Cache hit | Speedup |
|
|
60
|
+
|------|------|-----------|-----------|---------|
|
|
61
|
+
| Keycloak | 7,885 Java files | 10.5s | 0.6s | **~17x** |
|
|
62
|
+
| BroadleafCommerce | 2,985 Java files | 2.7s | 0.3s | **~9x** |
|
|
63
|
+
|
|
64
|
+
Cache keyed on content hashes — invalidated only when source changes. On repeated agent sessions against the same codebase, nearly every invocation is a cache hit.
|
|
65
|
+
|
|
66
|
+
**Token output (measured):**
|
|
67
|
+
|
|
68
|
+
| Mode | BroadleafCommerce | Keycloak |
|
|
69
|
+
|------|------------------|---------|
|
|
70
|
+
| `--compact` | ~2,900 | ~4,000 |
|
|
71
|
+
| `--agent` | ~4,800 | ~5,500 |
|
|
72
|
+
| `onboard` | ~2,600 | n/a |
|
|
73
|
+
| `fix-bug` (trimmed) | ~27,000 | ~4,600 |
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## What changes at 0.3s vs 2.7s
|
|
78
|
+
|
|
79
|
+
At 2.7s per call, you use sourcecode to occasionally inspect a repo.
|
|
80
|
+
|
|
81
|
+
At 0.3s per call, you use sourcecode as **constant infrastructure** inside agent loops:
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
agent loop iteration:
|
|
85
|
+
1. sourcecode . --compact # 0.3s — instant structural context
|
|
86
|
+
2. sourcecode impact PaymentService . --depth 1 # 0.4s — blast radius check
|
|
87
|
+
3. agent makes targeted change
|
|
88
|
+
4. repeat
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Sub-second context retrieval changes the cost model for agent workflows. You can call sourcecode before every edit, before every PR review, before every test run — without batching or caching calls manually.
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Installation
|
|
96
|
+
|
|
97
|
+
### Homebrew (macOS / Linux)
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
brew tap haroundominique/sourcecode
|
|
101
|
+
brew install sourcecode
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### pip / pipx
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
pip install sourcecode
|
|
108
|
+
# or with isolation:
|
|
109
|
+
pipx install sourcecode
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Verify
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
sourcecode version
|
|
116
|
+
# sourcecode 1.33.0
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Quickstart
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
# High-signal summary — warm cache: ~0.3s, cold: 2–10s depending on repo size
|
|
125
|
+
sourcecode --compact
|
|
126
|
+
|
|
127
|
+
# Add git hotspots and uncommitted file count
|
|
128
|
+
sourcecode --compact --git-context
|
|
129
|
+
|
|
130
|
+
# Structured output for AI agents — bounded, noise-free, ready to inject
|
|
131
|
+
sourcecode --agent
|
|
132
|
+
|
|
133
|
+
# Blast radius: what breaks if this class changes?
|
|
134
|
+
sourcecode impact OrderService /path/to/repo
|
|
135
|
+
|
|
136
|
+
# REST endpoint surface
|
|
137
|
+
sourcecode endpoints /path/to/repo
|
|
138
|
+
|
|
139
|
+
# Onboard to an unfamiliar codebase
|
|
140
|
+
sourcecode onboard /path/to/repo
|
|
141
|
+
|
|
142
|
+
# PR review: risk, test gaps, changed modules
|
|
143
|
+
sourcecode review-pr /path/to/repo --since main
|
|
144
|
+
|
|
145
|
+
# Bug triage: risk-ranked files by symptom
|
|
146
|
+
sourcecode fix-bug /path/to/repo --symptom "NullPointerException in checkout"
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Cache system
|
|
152
|
+
|
|
153
|
+
sourcecode maintains a persistent cache at `.sourcecode-cache/` inside each repository. Two layers:
|
|
154
|
+
|
|
155
|
+
- **L1 (core):** analysis result keyed by `(git_sha, analysis_flags)`. Survives format changes — you can regenerate `--compact` vs `--agent` views from the same core.
|
|
156
|
+
- **L2 (view):** rendered output keyed by `(core_hash, view_flags)`. Exact output match — no recomputation.
|
|
157
|
+
|
|
158
|
+
**Lookup order:** L2 exact hit → L1 hit + view rebuild → full cold scan
|
|
159
|
+
|
|
160
|
+
**Cache invalidation:** Keyed on git commit SHA. Any commit invalidates the core cache for that repo. Uncommitted changes are not cached.
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
# Inspect cache state
|
|
164
|
+
sourcecode cache status
|
|
165
|
+
|
|
166
|
+
# Warm the cache ahead of an agent session
|
|
167
|
+
sourcecode cache warm
|
|
168
|
+
|
|
169
|
+
# Clear cache
|
|
170
|
+
sourcecode cache clear
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
**`--no-cache`** bypasses both layers and forces a fresh scan. Use in CI or when you need to verify a fresh result.
|
|
174
|
+
|
|
175
|
+
**Visibility:** Cache hits are silent. Use `sourcecode cache status` to see cache size, hit keys, and last-warmed timestamp.
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## Agent workflow patterns
|
|
180
|
+
|
|
181
|
+
### Start of session — structural grounding
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
# Inject as first message to agent (bounded, deterministic)
|
|
185
|
+
sourcecode /repo --compact # ~2,500–4,000 tokens
|
|
186
|
+
sourcecode /repo --agent # ~4,500–5,500 tokens — more detail
|
|
187
|
+
sourcecode onboard /repo # task-structured: entry points, key files, gaps
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Before every change — blast radius check
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
# Always target the INTERFACE in Spring projects, not the implementation:
|
|
194
|
+
sourcecode impact OrderService /repo # ✓ 30 callers, 11 endpoints
|
|
195
|
+
sourcecode impact OrderServiceImpl /repo # ✗ 0 callers (Spring DI blindness)
|
|
196
|
+
|
|
197
|
+
# Large hub interfaces — depth=1 is faster and still the most actionable signal:
|
|
198
|
+
sourcecode impact KeycloakSession /repo --depth 1
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### Continuous agent loop — delta context
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
# Only changed files + their transitive importers — minimal token cost:
|
|
205
|
+
sourcecode prepare-context delta /repo --since HEAD~1
|
|
206
|
+
sourcecode . --changed-only --git-context
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### PR review — structured risk signal
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
# JSON for programmatic use:
|
|
213
|
+
sourcecode review-pr /repo --since main --output review.json
|
|
214
|
+
jq '.ci_decision' review.json # "analysis_success" | "git_ref_error"
|
|
215
|
+
|
|
216
|
+
# Markdown for GitHub comment:
|
|
217
|
+
sourcecode review-pr /repo --since main --format github-comment
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### Bug triage — symptom-driven
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
# Specific symptoms produce the best signal:
|
|
224
|
+
sourcecode fix-bug /repo --symptom "OIDC token refresh fails after realm update"
|
|
225
|
+
sourcecode fix-bug /repo --symptom "NullPointerException in OrderService during checkout"
|
|
226
|
+
|
|
227
|
+
# Generic symptoms produce noisy output — be specific.
|
|
228
|
+
sourcecode fix-bug /repo --symptom "payment timeout" --output triage.json
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### In CI — cached, deterministic, fast
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
# Content-hash cached — safe to run on every commit; cold only when code changes
|
|
235
|
+
sourcecode /repo --compact --output context.json
|
|
236
|
+
|
|
237
|
+
# PR gate
|
|
238
|
+
sourcecode review-pr /repo --since $BASE_REF --output review.json
|
|
239
|
+
DECISION=$(jq -r '.ci_decision' review.json)
|
|
240
|
+
if [ "$DECISION" != "analysis_success" ]; then echo "Review failed: $DECISION"; fi
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## What sourcecode does (and doesn't)
|
|
246
|
+
|
|
247
|
+
**sourcecode reduces exploration cost.** It accelerates context acquisition and minimizes repeated repo parsing. It does not replace reading code — it reduces how often an agent needs to.
|
|
248
|
+
|
|
249
|
+
Specifically:
|
|
250
|
+
|
|
251
|
+
- Extracts structural signals: entry points, Spring roles, REST surfaces, dependency graphs, transactional boundaries
|
|
252
|
+
- Builds and caches these on first scan; serves from cache on subsequent calls
|
|
253
|
+
- Produces bounded, noise-free JSON designed for direct injection into agent context windows
|
|
254
|
+
- Computes blast radius (impact graph) from a class or interface, traversing reverse dependencies
|
|
255
|
+
|
|
256
|
+
**What it does NOT do:**
|
|
257
|
+
|
|
258
|
+
- No runtime analysis — all signals are static (annotation, import graph, file structure)
|
|
259
|
+
- No semantic code understanding — reads structure, not logic
|
|
260
|
+
- No replacement for reading code — reduces how often that's needed, not whether
|
|
261
|
+
- Architecture pattern detection best for Spring MVC layered apps; SPI/plugin architectures (e.g. Quarkus extension model) may be misclassified
|
|
262
|
+
- Endpoint recall for JAX-RS subresource locator pattern is ~65%
|
|
263
|
+
- `impact` on implementation classes (e.g. `OrderServiceImpl`) returns 0 callers in Spring Boot — callers inject the interface via `@Autowired`. Always target the interface. When `direct_callers: []` with `confidence_level: high` for a `@Service` class, re-query the interface.
|
|
264
|
+
- `no_security_signal` on endpoints means no method-level annotations found — does **not** mean the endpoint is unsecured. Projects using Spring Security filter chains show 100% `no_security_signal` even when fully secured.
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## Command reference
|
|
269
|
+
|
|
270
|
+
### `--compact` and `--agent`
|
|
271
|
+
|
|
272
|
+
Core flags. Feed directly to AI agents as first-message context.
|
|
273
|
+
|
|
274
|
+
| Flag | Output | Tokens |
|
|
275
|
+
|------|--------|--------|
|
|
276
|
+
| `--compact` | High-signal summary: stacks, entry points, dependencies, confidence, gaps | ~2,500–4,000 |
|
|
277
|
+
| `--agent` | Structured JSON: identity, entry points, architecture, event flows | ~4,500–5,500 |
|
|
278
|
+
|
|
279
|
+
### `impact` — blast-radius analysis
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
sourcecode impact ClassName /path/to/repo
|
|
283
|
+
sourcecode impact org.example.OrderService /path/to/repo # FQN also accepted
|
|
284
|
+
sourcecode impact OrderService . --depth 2 # limit BFS depth
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
| Field | Description |
|
|
288
|
+
|-------|-------------|
|
|
289
|
+
| `direct_callers` | Classes that directly import or inject the target |
|
|
290
|
+
| `indirect_callers` | Transitive callers up to `--depth` (default: 4) |
|
|
291
|
+
| `endpoints_affected` | HTTP endpoints whose call chain includes the target |
|
|
292
|
+
| `transactional_boundaries_touched` | `@Transactional` classes in the blast cone |
|
|
293
|
+
| `mappers_affected` | `@Repository` / `@Mapper` / DAO classes in the blast cone |
|
|
294
|
+
| `security_surface_affected` | Security policies on affected endpoints |
|
|
295
|
+
| `cross_module_impact` | Subsystems touched, ordered by affected symbol count |
|
|
296
|
+
| `risk_score` | 0–100 quantified change risk |
|
|
297
|
+
| `confidence_score` | 0–1 confidence in the analysis |
|
|
298
|
+
| `explanation` | Human-readable risk summary |
|
|
299
|
+
| `candidates` | On partial match: up to 10 FQNs ranked by relevance |
|
|
300
|
+
|
|
301
|
+
**Best practices:**
|
|
302
|
+
- Target **interfaces**, not implementations: `impact OrderService` > `impact OrderServiceImpl`
|
|
303
|
+
- Use `--depth 1` when target has 200+ callers — direct endpoints are already the most actionable signal
|
|
304
|
+
- Second `impact` run on the same repo is significantly faster (cache applies to underlying IR scan)
|
|
305
|
+
|
|
306
|
+
### `endpoints` — REST API surface
|
|
307
|
+
|
|
308
|
+
```bash
|
|
309
|
+
sourcecode endpoints /path/to/repo
|
|
310
|
+
sourcecode endpoints /path/to/repo --output endpoints.json
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
Extracts all Spring MVC (`@GetMapping`, `@PostMapping`, `@RequestMapping`, etc.) and JAX-RS (`@GET`, `@POST`, `@Path`) endpoint methods. Returns HTTP method, path, controller class, and handler method.
|
|
314
|
+
|
|
315
|
+
### `repo-ir` — symbol-level IR
|
|
316
|
+
|
|
317
|
+
```bash
|
|
318
|
+
sourcecode repo-ir /path/to/repo --summary-only # ~20K tokens
|
|
319
|
+
sourcecode repo-ir /path/to/repo --since HEAD~1 # symbol-level diff
|
|
320
|
+
sourcecode repo-ir /path/to/repo --files src/.../OrderService.java
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
Builds a deterministic symbol graph: classes, methods, import/injection edges, Spring roles, subsystems.
|
|
324
|
+
|
|
325
|
+
**Size warning:** Without `--summary-only`, output can exceed 1MB for mid-size repos. Always use `--summary-only` unless you need the full graph for downstream tooling.
|
|
326
|
+
|
|
327
|
+
### `onboard` — codebase orientation
|
|
328
|
+
|
|
329
|
+
```bash
|
|
330
|
+
sourcecode onboard /path/to/repo
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
Entry points, architecture summary, key files, confidence level, and gaps. Designed to be injected as agent context at the start of a session.
|
|
334
|
+
|
|
335
|
+
### `review-pr` — [Pro] PR review context
|
|
336
|
+
|
|
337
|
+
```bash
|
|
338
|
+
sourcecode review-pr /path/to/repo --since main
|
|
339
|
+
sourcecode review-pr /path/to/repo --since HEAD~3
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
Changed files, risk ranking, test coverage gaps, affected modules, and blast radius of changed classes. Returns a `ci_decision` field for CI/CD integration.
|
|
343
|
+
|
|
344
|
+
### `fix-bug` — [Pro] Bug triage context
|
|
345
|
+
|
|
346
|
+
```bash
|
|
347
|
+
sourcecode fix-bug /path/to/repo --symptom "NullPointerException in checkout"
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
Risk-ranked file list correlated to the symptom: keyword extraction, path matching, content matching, git commit correlation.
|
|
351
|
+
|
|
352
|
+
### `modernize` — [Pro] Modernization planning
|
|
353
|
+
|
|
354
|
+
```bash
|
|
355
|
+
sourcecode modernize /path/to/repo
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
High-coupling nodes (high fan-in = risky to change), dead zone candidates (isolated symbols), subsystem tangles.
|
|
359
|
+
|
|
360
|
+
### `prepare-context` — task-specific context
|
|
361
|
+
|
|
362
|
+
Low-level access to all tasks with full options:
|
|
363
|
+
|
|
364
|
+
```bash
|
|
365
|
+
sourcecode prepare-context TASK [PATH] [OPTIONS]
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
| Task | What it surfaces |
|
|
369
|
+
|------|-----------------|
|
|
370
|
+
| `explain` | Architecture, entry points, key dependencies |
|
|
371
|
+
| `onboard` | Full structural context for new agents/developers |
|
|
372
|
+
| `fix-bug` | Files ranked by symptom correlation, risk, annotations |
|
|
373
|
+
| `refactor` | Structural issues, improvement opportunities |
|
|
374
|
+
| `generate-tests` | Source files without test pairs, coverage gap analysis |
|
|
375
|
+
| `review-pr` | PR diff with risk ranking, test gaps, module impact |
|
|
376
|
+
| `delta` | Incremental context: git-changed files + transitive import graph |
|
|
377
|
+
|
|
378
|
+
---
|
|
379
|
+
|
|
380
|
+
## Flags reference
|
|
381
|
+
|
|
382
|
+
| Flag | Alias | Default | Description |
|
|
383
|
+
|------|-------|---------|-------------|
|
|
384
|
+
| `--compact` | | off | High-signal summary (typically 2,500–4,000 tokens for mid-to-large Java repos): stacks, entry points, dependencies, confidence, gaps. |
|
|
385
|
+
| `--agent` | | off | Structured JSON for AI agents: project identity, entry points, architecture, dependencies, confidence. ~4,500–5,500 tokens. |
|
|
386
|
+
| `--full` | | off | Remove truncation limits on `transactional_boundaries`, `mybatis.dto_mappers`, and other capped lists. |
|
|
387
|
+
| `--git-context` | `-g` | off | Include git activity: recent commits, change hotspots, and uncommitted file count. |
|
|
388
|
+
| `--changed-only` | | off | Limit output to git-modified files (staged, unstaged, untracked). |
|
|
389
|
+
| `--depth` | | `4` | File tree traversal depth (1–20). Java/Maven projects auto-adjust to 12. |
|
|
390
|
+
| `--format` | `-f` | `json` | Output format: `json` or `yaml`. |
|
|
391
|
+
| `--output` | `-o` | stdout | Write output to a file instead of stdout. |
|
|
392
|
+
| `--no-cache` | | off | Bypass scan cache and force a fresh analysis. |
|
|
393
|
+
| `--copy` | `-c` | off | Copy output to clipboard after a successful run. |
|
|
394
|
+
| `--no-redact` | | off | Disable automatic secret redaction. |
|
|
395
|
+
| `--version` | `-v` | — | Show version and exit. |
|
|
396
|
+
|
|
397
|
+
---
|
|
398
|
+
|
|
399
|
+
## Output schema
|
|
400
|
+
|
|
401
|
+
All outputs include:
|
|
402
|
+
- `schema_version`: output format version
|
|
403
|
+
- `confidence_summary`: `overall`, `stack`, `entry_points` confidence levels (`high`/`medium`/`low`)
|
|
404
|
+
- `analysis_gaps`: list of what could not be analyzed and why
|
|
405
|
+
|
|
406
|
+
### Java/Spring-specific fields (when detected)
|
|
407
|
+
|
|
408
|
+
| Field | Description |
|
|
409
|
+
|-------|-------------|
|
|
410
|
+
| `language_version` | Java version from `maven.compiler.source` or equivalent |
|
|
411
|
+
| `deployment.spring_boot_version` | Spring Boot version |
|
|
412
|
+
| `deployment.packaging` | `jar` or `war` |
|
|
413
|
+
| `mybatis` | Mapper interface / XML file pairing summary |
|
|
414
|
+
| `transactional_boundaries` | Classes annotated with `@Transactional` |
|
|
415
|
+
| `deployment_risks` | Static risk flags: `spring-boot-2.x-eol`, `legacy-java-runtime` |
|
|
416
|
+
|
|
417
|
+
---
|
|
418
|
+
|
|
419
|
+
## Telemetry
|
|
420
|
+
|
|
421
|
+
Anonymous, opt-in. Collects: version, OS, commands, flags, duration, repo size range, errors. No source code, paths, secrets, or output content.
|
|
422
|
+
|
|
423
|
+
```bash
|
|
424
|
+
sourcecode telemetry status
|
|
425
|
+
sourcecode telemetry enable
|
|
426
|
+
sourcecode telemetry disable
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
Or: `export SOURCECODE_TELEMETRY=0`
|
|
430
|
+
|
|
431
|
+
---
|
|
432
|
+
|
|
433
|
+
## Configuration
|
|
434
|
+
|
|
435
|
+
```bash
|
|
436
|
+
sourcecode config # show version, config file path, telemetry status
|
|
437
|
+
```
|