sourcecode 0.48.0__py3-none-any.whl → 0.49.0__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 +2 -0
- sourcecode/contract_pipeline.py +2 -2
- sourcecode/serializer.py +36 -32
- {sourcecode-0.48.0.dist-info → sourcecode-0.49.0.dist-info}/METADATA +1 -1
- {sourcecode-0.48.0.dist-info → sourcecode-0.49.0.dist-info}/RECORD +9 -9
- {sourcecode-0.48.0.dist-info → sourcecode-0.49.0.dist-info}/WHEEL +0 -0
- {sourcecode-0.48.0.dist-info → sourcecode-0.49.0.dist-info}/entry_points.txt +0 -0
- {sourcecode-0.48.0.dist-info → sourcecode-0.49.0.dist-info}/licenses/LICENSE +0 -0
sourcecode/__init__.py
CHANGED
sourcecode/cli.py
CHANGED
|
@@ -1445,8 +1445,10 @@ def main(
|
|
|
1445
1445
|
data = agent_view(sm)
|
|
1446
1446
|
# When contract pipeline ran (mode=contract, no legacy flags), include
|
|
1447
1447
|
# per-file contracts in agent output so agents get structural context.
|
|
1448
|
+
# Remove file_relevance — contracts cover this signal with more detail.
|
|
1448
1449
|
if _is_contract_mode and sm.file_contracts:
|
|
1449
1450
|
from sourcecode.serializer import _serialize_contract_minimal
|
|
1451
|
+
data.pop("file_relevance", None)
|
|
1450
1452
|
data["contracts"] = [_serialize_contract_minimal(c) for c in sm.file_contracts]
|
|
1451
1453
|
if sm.contract_summary is not None:
|
|
1452
1454
|
cs = sm.contract_summary
|
sourcecode/contract_pipeline.py
CHANGED
|
@@ -27,8 +27,8 @@ from sourcecode.schema import EntryPoint, MonorepoPackageInfo
|
|
|
27
27
|
# ---------------------------------------------------------------------------
|
|
28
28
|
|
|
29
29
|
_MAX_FILES = 500 # hard cap on files extracted per run
|
|
30
|
-
_MAX_CONTRACTS =
|
|
31
|
-
_MIN_CONTRACT_SCORE = 0.
|
|
30
|
+
_MAX_CONTRACTS = 15 # default top-N output cap — omit rather than flood
|
|
31
|
+
_MIN_CONTRACT_SCORE = 0.15 # drop contracts below this relevance threshold
|
|
32
32
|
_SRC_EXTENSIONS: frozenset[str] = frozenset(_LANGUAGE_MAP.keys())
|
|
33
33
|
|
|
34
34
|
|
sourcecode/serializer.py
CHANGED
|
@@ -1130,9 +1130,6 @@ def _contract_view_minimal(
|
|
|
1130
1130
|
"project": project,
|
|
1131
1131
|
}
|
|
1132
1132
|
|
|
1133
|
-
if sm.metadata.traversal_topology:
|
|
1134
|
-
result["traversal"] = sm.metadata.traversal_topology
|
|
1135
|
-
|
|
1136
1133
|
# Per-file contracts
|
|
1137
1134
|
if contracts:
|
|
1138
1135
|
serialized: list[dict[str, Any]] = []
|
|
@@ -1310,6 +1307,10 @@ def _compress_sig(name: str, sig: str, max_len: int = 100) -> str:
|
|
|
1310
1307
|
return full
|
|
1311
1308
|
|
|
1312
1309
|
|
|
1310
|
+
_MAX_FN_PER_CONTRACT = 5 # max function signatures per contract (token budget)
|
|
1311
|
+
_MAX_SIG_LEN = 60 # max chars per compressed signature
|
|
1312
|
+
|
|
1313
|
+
|
|
1313
1314
|
def _serialize_contract_minimal(c: Any) -> dict[str, Any]:
|
|
1314
1315
|
"""Serialize one FileContract to minimal format."""
|
|
1315
1316
|
item: dict[str, Any] = {"path": c.path, "role": c.role}
|
|
@@ -1317,38 +1318,47 @@ def _serialize_contract_minimal(c: Any) -> dict[str, Any]:
|
|
|
1317
1318
|
if c.is_changed:
|
|
1318
1319
|
item["changed"] = True
|
|
1319
1320
|
|
|
1320
|
-
#
|
|
1321
|
-
# When all exports are same non-function kind, group them
|
|
1322
|
-
if c.exports:
|
|
1323
|
-
exs: list[Any] = []
|
|
1324
|
-
kinds = {e.kind for e in c.exports}
|
|
1325
|
-
if len(kinds) == 1 and "function" not in kinds and "unknown" not in kinds:
|
|
1326
|
-
# All same non-function kind — compact: {"k": "class", "names": [...]}
|
|
1327
|
-
only_kind = next(iter(kinds))
|
|
1328
|
-
exs = [{"k": only_kind, "names": sorted(e.name for e in c.exports)}]
|
|
1329
|
-
else:
|
|
1330
|
-
for e in sorted(c.exports, key=lambda e: e.name):
|
|
1331
|
-
if e.kind in ("function", "unknown"):
|
|
1332
|
-
exs.append(e.name)
|
|
1333
|
-
else:
|
|
1334
|
-
exs.append({"name": e.name, "k": e.kind})
|
|
1335
|
-
item["exports"] = exs
|
|
1336
|
-
|
|
1337
|
-
# External deps (non-stdlib already filtered in extractor)
|
|
1338
|
-
if c.dependencies:
|
|
1339
|
-
item["deps"] = sorted(c.dependencies)
|
|
1340
|
-
|
|
1341
|
-
# Exported function signatures — compressed
|
|
1321
|
+
# Exported function signatures — compressed, capped
|
|
1342
1322
|
exported_names = {e.name for e in c.exports}
|
|
1323
|
+
fn_names_in_sigs: set[str] = set()
|
|
1343
1324
|
if c.functions:
|
|
1344
1325
|
fns = []
|
|
1345
1326
|
for f in sorted(c.functions, key=lambda f: f.name):
|
|
1346
1327
|
if not (f.exported or f.name in exported_names):
|
|
1347
1328
|
continue
|
|
1348
|
-
fns.append(_compress_sig(f.name, f.signature))
|
|
1329
|
+
fns.append(_compress_sig(f.name, f.signature, max_len=_MAX_SIG_LEN))
|
|
1330
|
+
fn_names_in_sigs.add(f.name)
|
|
1331
|
+
if len(fns) >= _MAX_FN_PER_CONTRACT:
|
|
1332
|
+
break
|
|
1349
1333
|
if fns:
|
|
1350
1334
|
item["fn"] = fns
|
|
1351
1335
|
|
|
1336
|
+
# Exports: omit function names already shown in fn; keep non-function exports
|
|
1337
|
+
if c.exports:
|
|
1338
|
+
exs: list[Any] = []
|
|
1339
|
+
non_fn_exports = [e for e in c.exports if e.kind not in ("function", "unknown")]
|
|
1340
|
+
fn_exports_not_in_sig = [
|
|
1341
|
+
e for e in c.exports
|
|
1342
|
+
if e.kind in ("function", "unknown") and e.name not in fn_names_in_sigs
|
|
1343
|
+
]
|
|
1344
|
+
remaining = non_fn_exports + fn_exports_not_in_sig
|
|
1345
|
+
if remaining:
|
|
1346
|
+
kinds = {e.kind for e in remaining}
|
|
1347
|
+
if len(kinds) == 1 and "function" not in kinds and "unknown" not in kinds:
|
|
1348
|
+
only_kind = next(iter(kinds))
|
|
1349
|
+
exs = [{"k": only_kind, "names": sorted(e.name for e in remaining)}]
|
|
1350
|
+
else:
|
|
1351
|
+
for e in sorted(remaining, key=lambda e: e.name):
|
|
1352
|
+
if e.kind in ("function", "unknown"):
|
|
1353
|
+
exs.append(e.name)
|
|
1354
|
+
else:
|
|
1355
|
+
exs.append({"name": e.name, "k": e.kind})
|
|
1356
|
+
item["exports"] = exs
|
|
1357
|
+
|
|
1358
|
+
# External deps (non-stdlib already filtered in extractor)
|
|
1359
|
+
if c.dependencies:
|
|
1360
|
+
item["deps"] = sorted(c.dependencies)
|
|
1361
|
+
|
|
1352
1362
|
# Types: skip if fully covered by exports (avoids duplication in model files)
|
|
1353
1363
|
if c.types:
|
|
1354
1364
|
export_names_set = {e.name for e in c.exports}
|
|
@@ -1363,12 +1373,6 @@ def _serialize_contract_minimal(c: Any) -> dict[str, Any]:
|
|
|
1363
1373
|
if c.hooks_used:
|
|
1364
1374
|
item["hooks"] = c.hooks_used
|
|
1365
1375
|
|
|
1366
|
-
# Ranking signals: why this file was ranked here
|
|
1367
|
-
if getattr(c, "ranking_reasons", None):
|
|
1368
|
-
non_trivial = [r for r in c.ranking_reasons if r not in ("source file", "noise")]
|
|
1369
|
-
if non_trivial:
|
|
1370
|
-
item["why"] = non_trivial
|
|
1371
|
-
|
|
1372
1376
|
return item
|
|
1373
1377
|
|
|
1374
1378
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
sourcecode/__init__.py,sha256=
|
|
1
|
+
sourcecode/__init__.py,sha256=W3DJGnBZMJZBnvn9pO7FSLfHppERKWNuRgtqy1X-umM,103
|
|
2
2
|
sourcecode/adaptive_scanner.py,sha256=6dh34C2qZXyRbw-8xBhbEwDdXanM6CRFRWayVoYITnA,10190
|
|
3
3
|
sourcecode/architecture_analyzer.py,sha256=O4AXc7l_WTzIXrcAzstqZy-TGKNaFa6p3MzpgVjaO8g,27749
|
|
4
4
|
sourcecode/architecture_summary.py,sha256=rSY5MRiaz4N1YdG0pqDTDuFjSN7PO_Zplx-dtNzv2Yo,19985
|
|
5
5
|
sourcecode/ast_extractor.py,sha256=0OHQwTUBBc9lmqPLryVeB1z8dGIC6NhLlar800CD9oI,41129
|
|
6
6
|
sourcecode/classifier.py,sha256=GKTMN8qKZX7ponSwDJfN08RrasI4CVpq1_gFBgEopps,7093
|
|
7
|
-
sourcecode/cli.py,sha256=
|
|
7
|
+
sourcecode/cli.py,sha256=YusMOF5OfihL3nBw66LcANRFSiVHugPrXE0vPIycjLQ,72016
|
|
8
8
|
sourcecode/code_notes_analyzer.py,sha256=rRd8bFYV0krjlxxQV0wenwE9K7pVpUQSR7KvSvUQKw4,9226
|
|
9
9
|
sourcecode/confidence_analyzer.py,sha256=HxJMPLI5ulqtkncnv98W4iVO6yMbpQo87VuxiuNbDmY,12167
|
|
10
10
|
sourcecode/context_scorer.py,sha256=QpChSpsmaAYz91rXA4Ue5xzQmNz_ZboZN09YOHScq1U,14679
|
|
11
11
|
sourcecode/context_summarizer.py,sha256=CiQrfBEzun949bWvmLabWoj2HhPn6Lw62ofqnsy0FlQ,6503
|
|
12
12
|
sourcecode/contract_model.py,sha256=gCf9-Kj0G7l0lvRTAcRfFAfMgs1Rpizv4mKovQLYUkw,3434
|
|
13
|
-
sourcecode/contract_pipeline.py,sha256=
|
|
13
|
+
sourcecode/contract_pipeline.py,sha256=eann6PZJ8Bg2zavaOhmfN_oy9rMWNSkKPDW68rRZV8E,25686
|
|
14
14
|
sourcecode/coverage_parser.py,sha256=q0LeZJaX1bnntLu-ImksdBsMlpsVmk_iUfSaB4eaJGo,19702
|
|
15
15
|
sourcecode/dependency_analyzer.py,sha256=Exq0BfInvfS5iAg9xAr6WI2uPNuotkIudTKcYJcRhB8,52757
|
|
16
16
|
sourcecode/doc_analyzer.py,sha256=TttdS7mndKQhyJCfJnnAsyGCJrf-TIL7oXxDlTLUFKE,21248
|
|
@@ -29,7 +29,7 @@ sourcecode/runtime_classifier.py,sha256=zWX3r3HCKHc-qtIobErOa8aKMmaoPYREtJKvPcBG
|
|
|
29
29
|
sourcecode/scanner.py,sha256=aM3h9-DCQ3xKpeHpHYdo2vX6T5P95HA_YwZbkAVNwmo,8288
|
|
30
30
|
sourcecode/schema.py,sha256=ofEge9hTWHOTjeWt7ceCDQWzP-uhhenrYX2usjW2KVU,22759
|
|
31
31
|
sourcecode/semantic_analyzer.py,sha256=16EFTgM7ooW0m5gNUKOlTSn7IEMLSzKmzQn-cWaSqjs,82604
|
|
32
|
-
sourcecode/serializer.py,sha256=
|
|
32
|
+
sourcecode/serializer.py,sha256=nh8DNGVPVszy60YnWGVH_sLyskgDN973glPIMzNeFWA,62843
|
|
33
33
|
sourcecode/summarizer.py,sha256=ZuzIdm3t8A-d5MuQL0TSNLrd-L0IQIuguIxeNXMNJf8,16070
|
|
34
34
|
sourcecode/tree_utils.py,sha256=Fj9OIuUksBvgibNd3feog0sMDjVypJzPexp5lvMoYWI,1424
|
|
35
35
|
sourcecode/workspace.py,sha256=X_6NmNnitvT3_38V-JDChydo_sR68s249hLFlrQskU0,8271
|
|
@@ -60,8 +60,8 @@ sourcecode/telemetry/consent.py,sha256=wLMvGNJeSSyZoNkQXpoUioY6mMv4Qdvuw7S9jAEWn
|
|
|
60
60
|
sourcecode/telemetry/events.py,sha256=oEvvulfsv5GIDWG2174gSS6tNB95w38AIYiYeifGKlE,2294
|
|
61
61
|
sourcecode/telemetry/filters.py,sha256=Asa71oRl7q3Wt_FMwuufIZJFzSYdgRNKS8LHCIyFeYE,4805
|
|
62
62
|
sourcecode/telemetry/transport.py,sha256=KJeIPCPWMdmbCP3ySGs2iUlia34U6vWne2dZsUezesw,1560
|
|
63
|
-
sourcecode-0.
|
|
64
|
-
sourcecode-0.
|
|
65
|
-
sourcecode-0.
|
|
66
|
-
sourcecode-0.
|
|
67
|
-
sourcecode-0.
|
|
63
|
+
sourcecode-0.49.0.dist-info/METADATA,sha256=5FVQYOuzhccMc8oiJ-tPJPr3XJqrdDzWRWf32W8HqWk,25209
|
|
64
|
+
sourcecode-0.49.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
65
|
+
sourcecode-0.49.0.dist-info/entry_points.txt,sha256=ex3F9rmbXeyDIoFQHtkEqTsKSaJow8F0LrVu8XfIktQ,57
|
|
66
|
+
sourcecode-0.49.0.dist-info/licenses/LICENSE,sha256=7DdHrU9Z_3e7dSvq4ISijZNjnuHo5NIHNiHDouMQ9JU,10491
|
|
67
|
+
sourcecode-0.49.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|