sourcecode 1.30.6__py3-none-any.whl → 1.30.7__py3-none-any.whl
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/__init__.py +1 -1
- sourcecode/cli.py +6 -1
- sourcecode/prepare_context.py +90 -23
- {sourcecode-1.30.6.dist-info → sourcecode-1.30.7.dist-info}/METADATA +3 -3
- {sourcecode-1.30.6.dist-info → sourcecode-1.30.7.dist-info}/RECORD +8 -8
- {sourcecode-1.30.6.dist-info → sourcecode-1.30.7.dist-info}/WHEEL +0 -0
- {sourcecode-1.30.6.dist-info → sourcecode-1.30.7.dist-info}/entry_points.txt +0 -0
- {sourcecode-1.30.6.dist-info → sourcecode-1.30.7.dist-info}/licenses/LICENSE +0 -0
sourcecode/__init__.py
CHANGED
sourcecode/cli.py
CHANGED
|
@@ -1760,7 +1760,7 @@ def prepare_context_cmd(
|
|
|
1760
1760
|
out["architecture_summary"] = output.architecture_summary
|
|
1761
1761
|
if _task_include("confidence"):
|
|
1762
1762
|
out["confidence"] = output.confidence
|
|
1763
|
-
if _task_include("relevant_files"):
|
|
1763
|
+
if task != "review-pr" and _task_include("relevant_files"):
|
|
1764
1764
|
out["relevant_files"] = [
|
|
1765
1765
|
{k: v for k, v in asdict(f).items() if v != ""}
|
|
1766
1766
|
for f in output.relevant_files
|
|
@@ -1862,6 +1862,11 @@ def prepare_context_cmd(
|
|
|
1862
1862
|
out["configuration_impact"] = output.configuration_impact
|
|
1863
1863
|
if output.test_coverage_risk:
|
|
1864
1864
|
out["test_coverage_risk"] = output.test_coverage_risk
|
|
1865
|
+
# honest split: runtime files vs build artifacts — no mixed ranking
|
|
1866
|
+
if output.runtime_changes:
|
|
1867
|
+
out["runtime_changes"] = output.runtime_changes
|
|
1868
|
+
if output.build_changes:
|
|
1869
|
+
out["build_changes"] = output.build_changes
|
|
1865
1870
|
if output.review_hotspots:
|
|
1866
1871
|
out["review_hotspots"] = output.review_hotspots
|
|
1867
1872
|
if output.suggested_review_order:
|
sourcecode/prepare_context.py
CHANGED
|
@@ -357,6 +357,9 @@ class TaskOutput:
|
|
|
357
357
|
scope_source: Optional[str] = None # "git_diff" | "staged" | "untracked" | "full_scan_fallback"
|
|
358
358
|
scope_files: list[str] = field(default_factory=list)
|
|
359
359
|
repo_root: Optional[str] = None
|
|
360
|
+
# honest output schema (review-pr only): runtime vs build split
|
|
361
|
+
runtime_changes: list[dict] = field(default_factory=list)
|
|
362
|
+
build_changes: dict = field(default_factory=dict)
|
|
360
363
|
|
|
361
364
|
|
|
362
365
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
@@ -416,6 +419,26 @@ _ALL_EXTENSIONS: frozenset[str] = _SOURCE_EXTENSIONS | frozenset({
|
|
|
416
419
|
".md", ".toml", ".yaml", ".yml", ".json", ".xml",
|
|
417
420
|
})
|
|
418
421
|
|
|
422
|
+
_ARTIFACT_CHANGE_EFFECT: dict[str, str] = {
|
|
423
|
+
"entrypoint": "modifies application startup, CLI entry, or framework bootstrap — all request flows may be affected",
|
|
424
|
+
"controller": "alters HTTP routing, API contract, or response shape — API consumers are affected",
|
|
425
|
+
"service": "changes business rules, transaction scope, or orchestration logic — callers and dependents affected",
|
|
426
|
+
"repository": "modifies persistence queries or data access patterns — data consistency and service layer affected",
|
|
427
|
+
"mapper": "alters SQL-to-object binding or query templates — data shape and repositories affected",
|
|
428
|
+
"security": "changes authentication flow, access control rules, or session handling — all secured endpoints affected",
|
|
429
|
+
"spring_config": "modifies bean wiring, datasource, or framework-wide settings — all wired beans potentially affected",
|
|
430
|
+
"spring_profile": "changes environment-specific overrides — behavior differs per active profile",
|
|
431
|
+
"config": "adjusts configuration values — all modules reading this config are affected",
|
|
432
|
+
"build_manifest": "changes dependencies, plugins, or project structure — compile-time and runtime classpath affected",
|
|
433
|
+
"db_migration": "modifies database schema — existing queries, mappings, and constraints may break",
|
|
434
|
+
"domain_model": "alters entity structure — cascades to repositories, DTOs, serializers, and mappers",
|
|
435
|
+
"dto": "changes data transfer contract — serialization and API consumers may break",
|
|
436
|
+
"test": "modifies test coverage or test behavior — no production code affected",
|
|
437
|
+
"documentation": "updates documentation only — no runtime impact",
|
|
438
|
+
"ide_noise": "IDE/tooling artifact — no application impact",
|
|
439
|
+
"source": "modifies application source — artifact role derived from file path structure",
|
|
440
|
+
}
|
|
441
|
+
|
|
419
442
|
# Maps frontend symptom keywords → backend terms likely to contain the root cause.
|
|
420
443
|
# Used to boost service/interceptor files when the symptom is UI-only.
|
|
421
444
|
_FRONTEND_SYMPTOM_MAP: dict[str, list[str]] = {
|
|
@@ -830,6 +853,8 @@ class TaskContextBuilder:
|
|
|
830
853
|
_pr_review_hotspots: list[str] = []
|
|
831
854
|
_pr_suggested_review_order: list[str] = []
|
|
832
855
|
_pr_base_ref: Optional[str] = None
|
|
856
|
+
_pr_runtime_changes: list[dict] = []
|
|
857
|
+
_pr_build_changes: dict = {}
|
|
833
858
|
|
|
834
859
|
if task_name == "review-pr":
|
|
835
860
|
_pr_base_ref = since or "HEAD"
|
|
@@ -879,14 +904,21 @@ class TaskContextBuilder:
|
|
|
879
904
|
"risk_level": _test_risk_level,
|
|
880
905
|
}
|
|
881
906
|
|
|
882
|
-
#
|
|
907
|
+
# Pre-classify changed files once — reused for hotspots, order, and runtime/build split
|
|
908
|
+
_pr_changed_cls: dict[str, dict] = {
|
|
909
|
+
f: self._classify_changed_file(f) for f in (_delta_files or set())
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
# Review hotspots: top changed RUNTIME files ranked by impact score — no build artifacts
|
|
883
913
|
_pr_review_hotspots = sorted(
|
|
884
|
-
|
|
914
|
+
[f for f, cls in _pr_changed_cls.items()
|
|
915
|
+
if not cls["is_noise"] and cls["artifact_type"] != "build_manifest"],
|
|
885
916
|
key=lambda f: _delta_impact_score_per_file.get(f, 0.0),
|
|
886
917
|
reverse=True,
|
|
887
918
|
)[:8]
|
|
888
919
|
|
|
889
920
|
# Suggested review order: security first, then api → service → persistence → config
|
|
921
|
+
# build_manifest is intentionally absent from _ORDER_TYPES
|
|
890
922
|
_ORDER_TYPES = ["security", "controller", "service", "repository", "mapper",
|
|
891
923
|
"spring_config", "config", "domain_model", "dto"]
|
|
892
924
|
_seen_order: set[str] = set()
|
|
@@ -894,7 +926,7 @@ class TaskContextBuilder:
|
|
|
894
926
|
for _ra in _delta_risk_areas:
|
|
895
927
|
for _f in _ra.get("affected_files", []):
|
|
896
928
|
if _f not in _seen_order:
|
|
897
|
-
_cls = self._classify_changed_file(_f)
|
|
929
|
+
_cls = _pr_changed_cls.get(_f) or self._classify_changed_file(_f)
|
|
898
930
|
if _cls["artifact_type"] == _otype:
|
|
899
931
|
_pr_suggested_review_order.append(_f)
|
|
900
932
|
_seen_order.add(_f)
|
|
@@ -903,6 +935,56 @@ class TaskContextBuilder:
|
|
|
903
935
|
_pr_suggested_review_order.append(_f)
|
|
904
936
|
_seen_order.add(_f)
|
|
905
937
|
|
|
938
|
+
# Build runtime_changes and build_changes — honest split, no score numbers
|
|
939
|
+
_pr_runtime_changes: list[dict] = []
|
|
940
|
+
_pr_build_changes: dict = {}
|
|
941
|
+
_build_artifact_files: list[str] = []
|
|
942
|
+
|
|
943
|
+
_SCORE_TO_CONFIDENCE = {
|
|
944
|
+
"high": lambda s: s >= 0.60,
|
|
945
|
+
"medium": lambda s: 0.40 <= s < 0.60,
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
for _f in sorted(_delta_files or set()):
|
|
949
|
+
_f_cls = _pr_changed_cls.get(_f) or self._classify_changed_file(_f)
|
|
950
|
+
_f_atype = _f_cls["artifact_type"]
|
|
951
|
+
if _f_cls["is_noise"]:
|
|
952
|
+
continue
|
|
953
|
+
if _f_atype == "build_manifest":
|
|
954
|
+
_build_artifact_files.append(_f)
|
|
955
|
+
continue
|
|
956
|
+
# role: always "inferred" — no runtime evidence for role classification
|
|
957
|
+
_cls_conf = _f_cls["confidence"] # "high"|"medium"|"low" from _classify_changed_file
|
|
958
|
+
_role_basis = "naming" if _cls_conf == "high" else ("path" if _cls_conf == "medium" else "extension")
|
|
959
|
+
_role_obj = {
|
|
960
|
+
"type": "inferred",
|
|
961
|
+
"confidence": "medium" if _cls_conf == "high" else "low",
|
|
962
|
+
"basis": _role_basis,
|
|
963
|
+
}
|
|
964
|
+
# evidence: list what we actually know
|
|
965
|
+
_evidence: list[str] = ["changed in git diff"]
|
|
966
|
+
_f_module = _f_cls.get("module", "")
|
|
967
|
+
if _f_module:
|
|
968
|
+
_evidence.append(f"matched module path: {_f_module}")
|
|
969
|
+
_evidence.append("NO call graph evidence")
|
|
970
|
+
# file confidence: replaces numeric score
|
|
971
|
+
_impact_s = _delta_impact_score_per_file.get(_f, 0.45)
|
|
972
|
+
_f_conf = "high" if _impact_s >= 0.60 else ("medium" if _impact_s >= 0.40 else "low")
|
|
973
|
+
_pr_runtime_changes.append({
|
|
974
|
+
"path": _f,
|
|
975
|
+
"role": _role_obj,
|
|
976
|
+
"confidence": _f_conf,
|
|
977
|
+
"artifact_type": _f_atype,
|
|
978
|
+
"evidence": _evidence,
|
|
979
|
+
"change_effect": _ARTIFACT_CHANGE_EFFECT.get(_f_atype, "modifies application logic"),
|
|
980
|
+
})
|
|
981
|
+
|
|
982
|
+
if _build_artifact_files:
|
|
983
|
+
_pr_build_changes = {
|
|
984
|
+
"files": _build_artifact_files,
|
|
985
|
+
"impact": "dependency/configuration only",
|
|
986
|
+
}
|
|
987
|
+
|
|
906
988
|
# ── 6d. review-pr: execution paths + behavioral impact ──────────────
|
|
907
989
|
_execution_paths: list[dict] = []
|
|
908
990
|
_behavioral_impact: list[dict] = []
|
|
@@ -1158,6 +1240,9 @@ class TaskContextBuilder:
|
|
|
1158
1240
|
scope_source=_pr_scope_source if task_name == "review-pr" else None,
|
|
1159
1241
|
scope_files=list(_pr_scope_files) if task_name == "review-pr" and _pr_scope_files else [],
|
|
1160
1242
|
repo_root=str(_pr_git_root) if task_name == "review-pr" and _pr_git_root else None,
|
|
1243
|
+
# honest output schema: runtime vs build split (review-pr only)
|
|
1244
|
+
runtime_changes=_pr_runtime_changes,
|
|
1245
|
+
build_changes=_pr_build_changes,
|
|
1161
1246
|
)
|
|
1162
1247
|
|
|
1163
1248
|
def render_prompt(self, output: TaskOutput) -> str:
|
|
@@ -1990,26 +2075,8 @@ class TaskContextBuilder:
|
|
|
1990
2075
|
"build_manifest": frozenset(),
|
|
1991
2076
|
}
|
|
1992
2077
|
|
|
1993
|
-
#
|
|
1994
|
-
_CHANGE_EFFECT
|
|
1995
|
-
"entrypoint": "modifies application startup, CLI entry, or framework bootstrap — all request flows may be affected",
|
|
1996
|
-
"controller": "alters HTTP routing, API contract, or response shape — API consumers are affected",
|
|
1997
|
-
"service": "changes business rules, transaction scope, or orchestration logic — callers and dependents affected",
|
|
1998
|
-
"repository": "modifies persistence queries or data access patterns — data consistency and service layer affected",
|
|
1999
|
-
"mapper": "alters SQL-to-object binding or query templates — data shape and repositories affected",
|
|
2000
|
-
"security": "changes authentication flow, access control rules, or session handling — all secured endpoints affected",
|
|
2001
|
-
"spring_config": "modifies bean wiring, datasource, or framework-wide settings — all wired beans potentially affected",
|
|
2002
|
-
"spring_profile": "changes environment-specific overrides — behavior differs per active profile",
|
|
2003
|
-
"config": "adjusts configuration values — all modules reading this config are affected",
|
|
2004
|
-
"build_manifest": "changes dependencies, plugins, or project structure — compile-time and runtime classpath affected",
|
|
2005
|
-
"db_migration": "modifies database schema — existing queries, mappings, and constraints may break",
|
|
2006
|
-
"domain_model": "alters entity structure — cascades to repositories, DTOs, serializers, and mappers",
|
|
2007
|
-
"dto": "changes data transfer contract — serialization and API consumers may break",
|
|
2008
|
-
"test": "modifies test coverage or test behavior — no production code affected",
|
|
2009
|
-
"documentation": "updates documentation only — no runtime impact",
|
|
2010
|
-
"ide_noise": "IDE/tooling artifact — no application impact",
|
|
2011
|
-
"source": "modifies application source — artifact role derived from file path structure",
|
|
2012
|
-
}
|
|
2078
|
+
# use module-level constant (single source of truth)
|
|
2079
|
+
_CHANGE_EFFECT = _ARTIFACT_CHANGE_EFFECT
|
|
2013
2080
|
|
|
2014
2081
|
# change_type taxonomy — closed set, derived from artifact type
|
|
2015
2082
|
_ARTIFACT_CHANGE_TYPES: dict[str, list[str]] = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sourcecode
|
|
3
|
-
Version: 1.30.
|
|
3
|
+
Version: 1.30.7
|
|
4
4
|
Summary: Deterministic codebase context for AI coding agents
|
|
5
5
|
License: Apache License
|
|
6
6
|
Version 2.0, January 2004
|
|
@@ -221,7 +221,7 @@ Description-Content-Type: text/markdown
|
|
|
221
221
|
|
|
222
222
|
**Deterministic, behavior-aware codebase context for AI agents and PR review.**
|
|
223
223
|
|
|
224
|
-

|
|
225
225
|

|
|
226
226
|
|
|
227
227
|
---
|
|
@@ -257,7 +257,7 @@ pipx install sourcecode
|
|
|
257
257
|
|
|
258
258
|
```bash
|
|
259
259
|
sourcecode version
|
|
260
|
-
# sourcecode 1.30.
|
|
260
|
+
# sourcecode 1.30.7
|
|
261
261
|
```
|
|
262
262
|
|
|
263
263
|
---
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
sourcecode/__init__.py,sha256=
|
|
1
|
+
sourcecode/__init__.py,sha256=_36S-_MqGDmoL3m2QfY-6fG2RgOsO0Bw-a0ejwIaNW0,103
|
|
2
2
|
sourcecode/adaptive_scanner.py,sha256=RTNExwWPXzjgLaRueT7UuxkPj5ZEToWjGbx1j0LSZ9E,10250
|
|
3
3
|
sourcecode/architecture_analyzer.py,sha256=MyBa0Hf5HmkudZQDLKrjcWDKETXETXl0mQX1swtTwAA,39091
|
|
4
4
|
sourcecode/architecture_summary.py,sha256=z34_6v7cSwy98cof2UVciGho7SCrZ93tiqMmq5WNzRQ,20405
|
|
5
5
|
sourcecode/ast_extractor.py,sha256=XgrZg2DcWcUm9r87cRG3KGO7IK2TIL_N-CvhSbUmmh4,49901
|
|
6
6
|
sourcecode/classifier.py,sha256=pYve2J1LqtYssU3lYLMDz18PT-CjN5c18QYE7R_IG1Q,7507
|
|
7
|
-
sourcecode/cli.py,sha256=
|
|
7
|
+
sourcecode/cli.py,sha256=youcol8GuxebasBeta6ti50WZLZXIPH2W7JdxlZieLE,81392
|
|
8
8
|
sourcecode/code_notes_analyzer.py,sha256=y1MJBnPZHYp4i6cQCXUb9ATIyifS_qMQWjw_8lPkpsU,9215
|
|
9
9
|
sourcecode/confidence_analyzer.py,sha256=xw_Jv8pAd0wd8t2vvQlorw8Ih0rSF3YCoFS8K-_4aXg,15762
|
|
10
10
|
sourcecode/context_scorer.py,sha256=QpChSpsmaAYz91rXA4Ue5xzQmNz_ZboZN09YOHScq1U,14679
|
|
@@ -21,7 +21,7 @@ sourcecode/flow_analyzer.py,sha256=m29PJPdAwH4n3ZNqMidgi97csSUUtav5SM9lkDy_sr8,2
|
|
|
21
21
|
sourcecode/git_analyzer.py,sha256=_pCg2V4d2aa17k9hayTzpexAj8syvyk4y9NYNvvgOAI,12802
|
|
22
22
|
sourcecode/graph_analyzer.py,sha256=iUK-7pSV-cvGqqD2hENdYmhnm0wcXFEyK-xnu5ul8OU,62515
|
|
23
23
|
sourcecode/metrics_analyzer.py,sha256=m0ENgtqKeBL17kUIK3fmGkgo7UfXBNHxCMj0H_Y5K7c,22750
|
|
24
|
-
sourcecode/prepare_context.py,sha256=
|
|
24
|
+
sourcecode/prepare_context.py,sha256=d7Ba95KFB8qqj4-EZCZYA7YTWFkQhnYQCnWPq249-NY,139888
|
|
25
25
|
sourcecode/progress.py,sha256=qn30sWaHOkjTgXsSBmiPkz7Rsbwc5oSlIe6JNEMYp_k,3149
|
|
26
26
|
sourcecode/ranking_engine.py,sha256=virVglafZufioHpZpwktjMvUiL0TZELWQCQnQNV8dFo,9360
|
|
27
27
|
sourcecode/redactor.py,sha256=xuGcadGEHaPw4qZXlMDvzMCsr4VOkdp3oBQptHyJk8c,2884
|
|
@@ -62,8 +62,8 @@ sourcecode/telemetry/consent.py,sha256=wLMvGNJeSSyZoNkQXpoUioY6mMv4Qdvuw7S9jAEWn
|
|
|
62
62
|
sourcecode/telemetry/events.py,sha256=oEvvulfsv5GIDWG2174gSS6tNB95w38AIYiYeifGKlE,2294
|
|
63
63
|
sourcecode/telemetry/filters.py,sha256=Asa71oRl7q3Wt_FMwuufIZJFzSYdgRNKS8LHCIyFeYE,4805
|
|
64
64
|
sourcecode/telemetry/transport.py,sha256=KJeIPCPWMdmbCP3ySGs2iUlia34U6vWne2dZsUezesw,1560
|
|
65
|
-
sourcecode-1.30.
|
|
66
|
-
sourcecode-1.30.
|
|
67
|
-
sourcecode-1.30.
|
|
68
|
-
sourcecode-1.30.
|
|
69
|
-
sourcecode-1.30.
|
|
65
|
+
sourcecode-1.30.7.dist-info/METADATA,sha256=NYty06PpgrIYpT82Glyvhc9vkOxlI_wOYlV7_D6Nhy4,26770
|
|
66
|
+
sourcecode-1.30.7.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
67
|
+
sourcecode-1.30.7.dist-info/entry_points.txt,sha256=ex3F9rmbXeyDIoFQHtkEqTsKSaJow8F0LrVu8XfIktQ,57
|
|
68
|
+
sourcecode-1.30.7.dist-info/licenses/LICENSE,sha256=7DdHrU9Z_3e7dSvq4ISijZNjnuHo5NIHNiHDouMQ9JU,10491
|
|
69
|
+
sourcecode-1.30.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|