sourcecode 1.35.31__tar.gz → 1.35.33__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.35.31 → sourcecode-1.35.33}/PKG-INFO +3 -3
- {sourcecode-1.35.31 → sourcecode-1.35.33}/README.md +2 -2
- {sourcecode-1.35.31 → sourcecode-1.35.33}/pyproject.toml +1 -1
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/__init__.py +1 -1
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/architecture_analyzer.py +1 -1
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/classifier.py +4 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/cli.py +204 -187
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/dependency_analyzer.py +22 -1
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/file_chunker.py +54 -24
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/migrate_check.py +23 -8
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/path_filters.py +2 -1
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/repository_ir.py +73 -8
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/spring_impact.py +9 -3
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/spring_model.py +37 -3
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/spring_security_audit.py +3 -6
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/spring_semantic.py +34 -7
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/spring_tx_analyzer.py +1 -1
- {sourcecode-1.35.31 → sourcecode-1.35.33}/.github/workflows/build-windows.yml +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/.gitignore +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/.ruff.toml +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/CHANGELOG.md +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/CONTRIBUTING.md +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/LICENSE +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/SECURITY.md +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/raw +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/adaptive_scanner.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/architecture_summary.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/ast_extractor.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/cache.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/canonical_ir.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/cir_graphs.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/code_notes_analyzer.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/confidence_analyzer.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/context_scorer.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/context_summarizer.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/contract_model.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/contract_pipeline.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/coverage_parser.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/detectors/__init__.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/detectors/base.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/detectors/csproj_parser.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/detectors/dart.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/detectors/dotnet.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/detectors/elixir.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/detectors/go.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/detectors/heuristic.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/detectors/hybrid.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/detectors/java.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/detectors/jvm_ext.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/detectors/nodejs.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/detectors/parsers.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/detectors/php.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/detectors/project.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/detectors/python.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/detectors/ruby.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/detectors/rust.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/detectors/systems.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/detectors/terraform.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/detectors/tooling.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/doc_analyzer.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/entrypoint_classifier.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/env_analyzer.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/error_schema.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/explain.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/file_classifier.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/flow_analyzer.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/fqn_utils.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/git_analyzer.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/graph_analyzer.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/license.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/mcp/__init__.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/mcp/onboarding/__init__.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/mcp/onboarding/applier.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/mcp/onboarding/backup.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/mcp/onboarding/detector.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/mcp/onboarding/planner.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/mcp/orchestrator.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/mcp/registry.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/mcp/runner.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/mcp/server.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/mcp_nudge.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/metrics_analyzer.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/output_budget.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/pr_comment_renderer.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/pr_impact.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/prepare_context.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/progress.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/ranking_engine.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/redactor.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/relevance_scorer.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/rename_refactor.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/repo_classifier.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/ris.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/runtime_classifier.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/scanner.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/schema.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/semantic_analyzer.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/serializer.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/spring_event_topology.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/spring_findings.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/summarizer.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/telemetry/__init__.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/telemetry/config.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/telemetry/consent.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/telemetry/events.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/telemetry/filters.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/telemetry/transport.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/tree_utils.py +0 -0
- {sourcecode-1.35.31 → sourcecode-1.35.33}/src/sourcecode/workspace.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sourcecode
|
|
3
|
-
Version: 1.35.
|
|
3
|
+
Version: 1.35.33
|
|
4
4
|
Summary: Persistent structural context and ultra-fast repeated analysis for AI coding agents
|
|
5
5
|
License-File: LICENSE
|
|
6
6
|
Keywords: agents,ai,codebase,context,developer-tools,llm
|
|
@@ -40,7 +40,7 @@ Description-Content-Type: text/markdown
|
|
|
40
40
|
|
|
41
41
|
**Persistent structural context and ultra-fast repeated analysis for AI coding agents.**
|
|
42
42
|
|
|
43
|
-

|
|
44
44
|

|
|
45
45
|
|
|
46
46
|
---
|
|
@@ -114,7 +114,7 @@ pipx install sourcecode
|
|
|
114
114
|
|
|
115
115
|
```bash
|
|
116
116
|
sourcecode version
|
|
117
|
-
# sourcecode 1.35.
|
|
117
|
+
# sourcecode 1.35.33
|
|
118
118
|
|
|
119
119
|
**v1.35.28** — 7 bug fixes: `rename-class` cross-package disambiguation (BUG-4), `rename-class` collision detection (BUG-2), `find_java_files` false positive on `com/test/` package paths (BUG-1), `cold-start --compact` correct key names (BUG-6), `@EnableMethodSecurity` no longer suppresses SEC-001 (BUG-3), `explain` @Entity stereotype detection (BUG-5), XML+annotation mixed security retagging (BUG-7).
|
|
120
120
|
```
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
**Persistent structural context and ultra-fast repeated analysis for AI coding agents.**
|
|
4
4
|
|
|
5
|
-

|
|
6
6
|

|
|
7
7
|
|
|
8
8
|
---
|
|
@@ -76,7 +76,7 @@ pipx install sourcecode
|
|
|
76
76
|
|
|
77
77
|
```bash
|
|
78
78
|
sourcecode version
|
|
79
|
-
# sourcecode 1.35.
|
|
79
|
+
# sourcecode 1.35.33
|
|
80
80
|
|
|
81
81
|
**v1.35.28** — 7 bug fixes: `rename-class` cross-package disambiguation (BUG-4), `rename-class` collision detection (BUG-2), `find_java_files` false positive on `com/test/` package paths (BUG-1), `cold-start --compact` correct key names (BUG-6), `@EnableMethodSecurity` no longer suppresses SEC-001 (BUG-3), `explain` @Entity stereotype detection (BUG-5), XML+annotation mixed security retagging (BUG-7).
|
|
82
82
|
```
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "sourcecode"
|
|
7
|
-
version = "1.35.
|
|
7
|
+
version = "1.35.33"
|
|
8
8
|
description = "Persistent structural context and ultra-fast repeated analysis for AI coding agents"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
@@ -237,7 +237,7 @@ class ArchitectureAnalyzer:
|
|
|
237
237
|
return ArchitectureAnalysis(
|
|
238
238
|
requested=True,
|
|
239
239
|
pattern="unknown",
|
|
240
|
-
limitations=["
|
|
240
|
+
limitations=["Architecture not inferred: insufficient source files in project"],
|
|
241
241
|
evidence=[{"type": "none", "paths": [], "reason": "insufficient source files", "confidence": "high"}],
|
|
242
242
|
tentative=False,
|
|
243
243
|
)
|
|
@@ -1227,159 +1227,164 @@ def main(
|
|
|
1227
1227
|
except Exception:
|
|
1228
1228
|
pass
|
|
1229
1229
|
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
)
|
|
1230
|
+
_excl_key = (
|
|
1231
|
+
",".join(sorted(e.strip() for e in exclude.split(",") if e.strip()))
|
|
1232
|
+
if exclude else ""
|
|
1233
|
+
)
|
|
1235
1234
|
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1235
|
+
# ── Core (analysis) flags: affect which analyzers run + scan config ──
|
|
1236
|
+
# Use effective_depth (not raw depth) so Java auto-adjustment is captured.
|
|
1237
|
+
# acv = ANALYZER_CACHE_VERSION — bumped only when analysis logic/schema
|
|
1238
|
+
# changes, NOT on every package release. Prevents patch-bump cache wipes.
|
|
1239
|
+
_core_flags_str = (
|
|
1240
|
+
f"acv={_cache_mod.ANALYZER_CACHE_VERSION},"
|
|
1241
|
+
f"dep={dependencies},gm={graph_modules},"
|
|
1242
|
+
f"docs={docs},fm={full_metrics},sem={semantics},"
|
|
1243
|
+
f"arch={architecture},gc={git_context},em={env_map},"
|
|
1244
|
+
f"cn={code_notes},"
|
|
1245
|
+
f"ex={_excl_key},depth={effective_depth}"
|
|
1246
|
+
)
|
|
1247
|
+
_core_h = _hashlib.sha256(_core_flags_str.encode()).hexdigest()[:8]
|
|
1248
|
+
if _git_sha and _git_root_str:
|
|
1249
1249
|
_core_key = f"{_git_sha}-{_core_h}"
|
|
1250
|
-
|
|
1251
|
-
#
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1250
|
+
else:
|
|
1251
|
+
# No git history (untracked/no-commit repo) — stable synthetic key
|
|
1252
|
+
# scoped per repo path via cache_dir(); invalidated by --no-cache or cache clear.
|
|
1253
|
+
_core_key = f"nogit-{_core_h}"
|
|
1254
|
+
|
|
1255
|
+
# ── View flags: output presentation only (no re-analysis needed) ──
|
|
1256
|
+
_view_flags_str = (
|
|
1257
|
+
f"c={compact},ag={agent},mode={mode},fmt={format},full={full},"
|
|
1258
|
+
f"co={changed_only},tree={tree},nt={no_tree},"
|
|
1259
|
+
f"rb={rank_by},sym={symbol},ep={entrypoints_only},"
|
|
1260
|
+
f"nr={no_redact},gd={graph_detail},dd={docs_depth},"
|
|
1261
|
+
f"mn={max_nodes},ge={graph_edges},mi={max_importers},"
|
|
1262
|
+
f"eg={emit_graph}"
|
|
1263
|
+
)
|
|
1264
|
+
_view_h = _hashlib.sha256(_view_flags_str.encode()).hexdigest()[:8]
|
|
1265
|
+
|
|
1266
|
+
# ── Lookup ──────────────────────────────────────────────────────
|
|
1267
|
+
# Step 1: try L1 to obtain the core_hash needed for L2 key
|
|
1268
|
+
_l1_result = _cache_mod.read_core(target, _core_key)
|
|
1269
|
+
|
|
1270
|
+
# P1-A: --env-map misses L1 when base (em=False) exists.
|
|
1271
|
+
# Try the base key so env analysis can be injected lazily (<1 s)
|
|
1272
|
+
# instead of triggering a 17 s full rescan.
|
|
1273
|
+
_l1_needs_env_inject = False
|
|
1274
|
+
if _l1_result is None and env_map:
|
|
1275
|
+
_base_flags = _core_flags_str.replace(",em=True,", ",em=False,")
|
|
1276
|
+
_base_h8 = _hashlib.sha256(_base_flags.encode()).hexdigest()[:8]
|
|
1277
|
+
_sha_prefix = _git_sha if _git_sha else "nogit"
|
|
1278
|
+
_base_key = f"{_sha_prefix}-{_base_h8}"
|
|
1279
|
+
_base_result = _cache_mod.read_core(target, _base_key)
|
|
1280
|
+
if _base_result is not None:
|
|
1281
|
+
_l1_result = _base_result
|
|
1282
|
+
_l1_needs_env_inject = True
|
|
1283
|
+
|
|
1284
|
+
if _l1_result is not None:
|
|
1285
|
+
_core_dict_l1, _core_hash = _l1_result
|
|
1286
|
+
_view_key = f"{_core_hash}-{_view_h}"
|
|
1287
|
+
|
|
1288
|
+
# Step 2: try L2 (exact view match).
|
|
1289
|
+
# Skip L2 for --changed-only: the stored view is a previous
|
|
1290
|
+
# diff snapshot that is stale for the current diff.
|
|
1291
|
+
if not changed_only:
|
|
1292
|
+
_cache_hit_content = _cache_mod.read_view(target, _view_key)
|
|
1293
|
+
|
|
1294
|
+
# Step 3: L1 hit but L2 miss → rebuild view from core dict
|
|
1295
|
+
if _cache_hit_content is None:
|
|
1296
|
+
try:
|
|
1297
|
+
from sourcecode.serializer import build_view_from_core as _bvfc
|
|
1298
|
+
_rebuilt = _bvfc(
|
|
1299
|
+
_core_dict_l1,
|
|
1300
|
+
compact=compact,
|
|
1301
|
+
agent=agent,
|
|
1302
|
+
full=full,
|
|
1303
|
+
no_tree=no_tree,
|
|
1304
|
+
tree=tree,
|
|
1305
|
+
)
|
|
1306
|
+
# P1-A: inject env analysis when base L1 (em=False) was used.
|
|
1307
|
+
# EnvAnalyzer walks only env/config files — typically <1 s.
|
|
1308
|
+
if _rebuilt is not None and _l1_needs_env_inject and compact:
|
|
1309
|
+
try:
|
|
1310
|
+
from sourcecode.env_analyzer import EnvAnalyzer as _EnvA_p1a
|
|
1311
|
+
_env_r_p1a, _env_s_p1a = _EnvA_p1a().analyze(target, {})
|
|
1312
|
+
if _env_s_p1a and (getattr(_env_s_p1a, "total", 0) or _env_r_p1a):
|
|
1313
|
+
_es_p1a: dict = {
|
|
1314
|
+
"total": getattr(_env_s_p1a, "total", 0),
|
|
1315
|
+
"required": getattr(_env_s_p1a, "required_count", 0),
|
|
1316
|
+
}
|
|
1317
|
+
_cats = getattr(_env_s_p1a, "categories", None)
|
|
1318
|
+
if _cats:
|
|
1319
|
+
_es_p1a["categories"] = _cats
|
|
1320
|
+
_rebuilt = dict(_rebuilt)
|
|
1321
|
+
_rebuilt["env_summary"] = _es_p1a
|
|
1322
|
+
if _env_r_p1a:
|
|
1323
|
+
_sorted_er = sorted(
|
|
1324
|
+
_env_r_p1a,
|
|
1325
|
+
key=lambda e: (
|
|
1326
|
+
not getattr(e, "required", False),
|
|
1327
|
+
getattr(e, "key", ""),
|
|
1328
|
+
),
|
|
1329
|
+
)
|
|
1330
|
+
_rebuilt["env_map"] = [
|
|
1331
|
+
{
|
|
1332
|
+
"key": getattr(e, "key", ""),
|
|
1333
|
+
**({"required": True} if getattr(e, "required", False) else {}),
|
|
1334
|
+
**({"category": getattr(e, "category", None)} if getattr(e, "category", None) else {}),
|
|
1335
|
+
}
|
|
1336
|
+
for e in _sorted_er[:15]
|
|
1337
|
+
]
|
|
1338
|
+
except Exception:
|
|
1339
|
+
pass # env inject failed — continue without env data
|
|
1340
|
+
if _rebuilt is not None:
|
|
1341
|
+
# Apply redaction
|
|
1342
|
+
if not no_redact:
|
|
1343
|
+
from sourcecode.redactor import redact_dict as _red_l1
|
|
1344
|
+
_rebuilt = _red_l1(_rebuilt)
|
|
1345
|
+
# Apply output budget
|
|
1346
|
+
if agent:
|
|
1347
|
+
from sourcecode.output_budget import (
|
|
1348
|
+
trim_to_budget as _trim_l1,
|
|
1349
|
+
BUDGET_AGENT,
|
|
1350
|
+
)
|
|
1351
|
+
_rebuilt = _trim_l1(_rebuilt, BUDGET_AGENT, label="agent")
|
|
1352
|
+
elif compact:
|
|
1353
|
+
from sourcecode.output_budget import (
|
|
1354
|
+
trim_to_budget as _trim_l1c,
|
|
1355
|
+
BUDGET_COMPACT,
|
|
1356
|
+
)
|
|
1357
|
+
_rebuilt = _trim_l1c(_rebuilt, BUDGET_COMPACT, label="compact")
|
|
1358
|
+
# Serialize
|
|
1359
|
+
if format == "yaml":
|
|
1360
|
+
from io import StringIO as _SIO_L1
|
|
1361
|
+
from ruamel.yaml import YAML as _YAML_L1
|
|
1362
|
+
_yl1 = _YAML_L1()
|
|
1363
|
+
_yl1.default_flow_style = False
|
|
1364
|
+
_yl1.representer.add_representer(
|
|
1365
|
+
type(None),
|
|
1366
|
+
lambda d, v: d.represent_scalar(
|
|
1367
|
+
"tag:yaml.org,2002:null", "null"
|
|
1368
|
+
),
|
|
1369
|
+
)
|
|
1370
|
+
_sl1 = _SIO_L1()
|
|
1371
|
+
_yl1.dump(_rebuilt, _sl1)
|
|
1372
|
+
_cache_hit_content = _sl1.getvalue()
|
|
1373
|
+
else:
|
|
1374
|
+
import json as _json_l1
|
|
1375
|
+
_cache_hit_content = _json_l1.dumps(
|
|
1376
|
+
_rebuilt, indent=2, ensure_ascii=False
|
|
1377
|
+
)
|
|
1378
|
+
# Cache rebuilt view in L2 (skip for --changed-only: stale diff)
|
|
1379
|
+
if _cache_hit_content and not changed_only:
|
|
1380
|
+
_cache_mod.write_view(
|
|
1381
|
+
target,
|
|
1382
|
+
_view_key,
|
|
1383
|
+
_cache_hit_content,
|
|
1384
|
+
fmt=format,
|
|
1385
|
+
)
|
|
1386
|
+
except Exception:
|
|
1387
|
+
_cache_hit_content = None # rebuild failed → full analysis
|
|
1383
1388
|
|
|
1384
1389
|
except Exception:
|
|
1385
1390
|
_core_key = ""
|
|
@@ -2290,6 +2295,11 @@ def main(
|
|
|
2290
2295
|
try:
|
|
2291
2296
|
from sourcecode.ris import _has_uncommitted_changes as _huc_fresh
|
|
2292
2297
|
_uncommitted_fresh = _huc_fresh(target)
|
|
2298
|
+
# _huc_fresh uses --untracked-files=no — it misses repos where all
|
|
2299
|
+
# files are untracked (no staged/unstaged changes to tracked files).
|
|
2300
|
+
# Promote to True when _allowed_changed_files contains untracked files.
|
|
2301
|
+
if not _uncommitted_fresh and _allowed_changed_files:
|
|
2302
|
+
_uncommitted_fresh = True
|
|
2293
2303
|
except Exception:
|
|
2294
2304
|
_uncommitted_fresh = False
|
|
2295
2305
|
import datetime as _dt
|
|
@@ -2335,44 +2345,51 @@ def main(
|
|
|
2335
2345
|
import atexit as _atexit
|
|
2336
2346
|
import threading as _threading
|
|
2337
2347
|
|
|
2338
|
-
#
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
_bg_target,
|
|
2363
|
-
_vk,
|
|
2364
|
-
_bg_content,
|
|
2365
|
-
fmt=_bg_format,
|
|
2366
|
-
layers=_compute_analyzer_fingerprints(),
|
|
2348
|
+
# Pre-compute core dict in the main thread — avoids the 5-second atexit
|
|
2349
|
+
# join race on large repos where core_view(sm) itself takes seconds.
|
|
2350
|
+
# Background thread only does gzip + disk I/O (fast, bounded latency).
|
|
2351
|
+
_bg_core_dict: dict | None = None
|
|
2352
|
+
try:
|
|
2353
|
+
from sourcecode.serializer import core_view as _core_view_fn
|
|
2354
|
+
_bg_core_dict = _core_view_fn(sm)
|
|
2355
|
+
except Exception:
|
|
2356
|
+
pass
|
|
2357
|
+
|
|
2358
|
+
if _bg_core_dict is not None:
|
|
2359
|
+
_bg_target = target
|
|
2360
|
+
_bg_core_key = _core_key
|
|
2361
|
+
_bg_view_key = _view_key
|
|
2362
|
+
_bg_view_flags_str = _view_flags_str
|
|
2363
|
+
_bg_content = content
|
|
2364
|
+
_bg_format = format
|
|
2365
|
+
_bg_hashlib = _hashlib
|
|
2366
|
+
_bg_cache_mod = _cache_mod
|
|
2367
|
+
|
|
2368
|
+
def _write_cache_async() -> None:
|
|
2369
|
+
try:
|
|
2370
|
+
_written_core_hash = _bg_cache_mod.write_core(
|
|
2371
|
+
_bg_target, _bg_core_key, _bg_core_dict
|
|
2367
2372
|
)
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2373
|
+
if _written_core_hash:
|
|
2374
|
+
_vk = _bg_view_key
|
|
2375
|
+
if not _vk:
|
|
2376
|
+
_wvh = _bg_hashlib.sha256(_bg_view_flags_str.encode()).hexdigest()[:8]
|
|
2377
|
+
_vk = f"{_written_core_hash}-{_wvh}"
|
|
2378
|
+
_bg_cache_mod.write_view(
|
|
2379
|
+
_bg_target,
|
|
2380
|
+
_vk,
|
|
2381
|
+
_bg_content,
|
|
2382
|
+
fmt=_bg_format,
|
|
2383
|
+
layers=_compute_analyzer_fingerprints(),
|
|
2384
|
+
)
|
|
2385
|
+
from sourcecode.cache import cache_dir as _cdir, _gc as _run_gc
|
|
2386
|
+
_run_gc(_cdir(_bg_target))
|
|
2387
|
+
except Exception:
|
|
2388
|
+
pass
|
|
2372
2389
|
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2390
|
+
_cache_write_thread = _threading.Thread(target=_write_cache_async, daemon=True)
|
|
2391
|
+
_cache_write_thread.start()
|
|
2392
|
+
_atexit.register(_cache_write_thread.join, 30.0)
|
|
2376
2393
|
|
|
2377
2394
|
# Update RIS with aggregated snapshot data (non-fatal side-effect).
|
|
2378
2395
|
# Update RIS whenever git is available, even when L1/L2 cache is skipped
|
|
@@ -1277,6 +1277,11 @@ class DependencyAnalyzer:
|
|
|
1277
1277
|
|
|
1278
1278
|
return records, limitations
|
|
1279
1279
|
|
|
1280
|
+
def _strip_gradle_comments(self, content: str) -> str:
|
|
1281
|
+
content = re.sub(r"/\*.*?\*/", "", content, flags=re.DOTALL)
|
|
1282
|
+
content = re.sub(r"//[^\n]*", "", content)
|
|
1283
|
+
return content
|
|
1284
|
+
|
|
1280
1285
|
def _analyze_gradle(self, root: Path) -> tuple[list[DependencyRecord], list[str]]:
|
|
1281
1286
|
for filename in ("build.gradle", "build.gradle.kts"):
|
|
1282
1287
|
gradle_file = root / filename
|
|
@@ -1287,7 +1292,22 @@ class DependencyAnalyzer:
|
|
|
1287
1292
|
return [], [f"gradle: error reading {filename}"]
|
|
1288
1293
|
props = self._parse_gradle_properties(root, content)
|
|
1289
1294
|
records = self._parse_gradle_dependencies(content, props, filename)
|
|
1290
|
-
|
|
1295
|
+
|
|
1296
|
+
# Follow apply from: 'other.gradle' directives (simple string literals only)
|
|
1297
|
+
apply_pat = re.compile(
|
|
1298
|
+
r"""apply\s+from\s*:\s*["']([^"'${}\s]+\.gradle(?:\.kts)?)["']"""
|
|
1299
|
+
)
|
|
1300
|
+
for m in apply_pat.finditer(self._strip_gradle_comments(content)):
|
|
1301
|
+
applied_path = root / m.group(1)
|
|
1302
|
+
if applied_path.exists() and applied_path.resolve() != gradle_file.resolve():
|
|
1303
|
+
try:
|
|
1304
|
+
applied_content = applied_path.read_text(encoding="utf-8", errors="replace")
|
|
1305
|
+
more = self._parse_gradle_dependencies(applied_content, props, m.group(1))
|
|
1306
|
+
records.extend(more)
|
|
1307
|
+
except OSError:
|
|
1308
|
+
pass
|
|
1309
|
+
|
|
1310
|
+
return self._dedupe(records), ["gradle: no compatible lockfile found; transitive dependencies unavailable"]
|
|
1291
1311
|
return [], []
|
|
1292
1312
|
|
|
1293
1313
|
def _parse_gradle_properties(self, root: Path, content: str) -> dict[str, str]:
|
|
@@ -1326,6 +1346,7 @@ class DependencyAnalyzer:
|
|
|
1326
1346
|
def _parse_gradle_dependencies(
|
|
1327
1347
|
self, content: str, props: dict[str, str], manifest_path: str
|
|
1328
1348
|
) -> list[DependencyRecord]:
|
|
1349
|
+
content = self._strip_gradle_comments(content)
|
|
1329
1350
|
_DIRECT = frozenset({
|
|
1330
1351
|
"implementation", "api", "compileOnly", "runtimeOnly", "compile", "provided",
|
|
1331
1352
|
"compileClasspath", "runtimeClasspath",
|