sourcecode 0.49.0__py3-none-any.whl → 1.0.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/serializer.py +77 -39
- {sourcecode-0.49.0.dist-info → sourcecode-1.0.0.dist-info}/METADATA +1 -1
- {sourcecode-0.49.0.dist-info → sourcecode-1.0.0.dist-info}/RECORD +7 -7
- {sourcecode-0.49.0.dist-info → sourcecode-1.0.0.dist-info}/WHEEL +0 -0
- {sourcecode-0.49.0.dist-info → sourcecode-1.0.0.dist-info}/entry_points.txt +0 -0
- {sourcecode-0.49.0.dist-info → sourcecode-1.0.0.dist-info}/licenses/LICENSE +0 -0
sourcecode/__init__.py
CHANGED
sourcecode/serializer.py
CHANGED
|
@@ -350,49 +350,72 @@ def _section_confidence(sm: SourceMap) -> dict[str, str]:
|
|
|
350
350
|
|
|
351
351
|
|
|
352
352
|
def compact_view(sm: SourceMap, *, no_tree: bool = False) -> dict[str, Any]:
|
|
353
|
-
"""Context package ready for prompt or handoff (~
|
|
353
|
+
"""Context package ready for prompt or handoff (~300-500 tokens).
|
|
354
354
|
|
|
355
355
|
Answers: what it is, where it enters, what depends on what,
|
|
356
356
|
what signals matter, and what uncertainty exists.
|
|
357
357
|
|
|
358
358
|
Includes: project_type, project_summary, architecture_summary,
|
|
359
|
-
stacks, entry_points
|
|
359
|
+
stacks (minimal), entry_points (path+kind only), key_dependencies (name+version+role),
|
|
360
360
|
env_summary (when analyzed), code_notes_summary (when analyzed),
|
|
361
|
-
|
|
361
|
+
confidence (overall only), analysis_gaps.
|
|
362
362
|
|
|
363
|
-
Excludes: file_tree, raw dependency lists, docs, module_graph.
|
|
364
|
-
Empty sections are explained when relevant.
|
|
363
|
+
Excludes: file_tree, raw dependency lists, docs, module_graph, verbose metadata.
|
|
365
364
|
"""
|
|
366
|
-
|
|
365
|
+
# Key dependencies — name + version + role only (no ecosystem, source, manifests)
|
|
367
366
|
key_deps: Any = None
|
|
368
367
|
if sm.dependency_summary is not None and sm.dependency_summary.requested:
|
|
369
|
-
dep_summary_dict = asdict(sm.dependency_summary)
|
|
370
|
-
dep_summary_dict.pop("dependencies", None)
|
|
371
368
|
key_deps = [
|
|
372
|
-
|
|
369
|
+
{
|
|
370
|
+
"name": d.name,
|
|
371
|
+
**({"version": d.declared_version} if d.declared_version else {}),
|
|
372
|
+
**({"role": d.role} if d.role and d.role != "runtime" else {}),
|
|
373
|
+
}
|
|
374
|
+
for d in sm.key_dependencies
|
|
373
375
|
if (d.role or "unknown") in _PRODUCTION_DEP_ROLES and d.scope not in {"dev"}
|
|
374
376
|
][:_KEY_DEPS_CAP]
|
|
375
|
-
elif sm.dependency_summary is None or not sm.dependency_summary.requested:
|
|
376
|
-
dep_summary_dict = None # "not analyzed" — agent should add --dependencies
|
|
377
377
|
|
|
378
|
+
# Dependency summary — requested flag + count + source only
|
|
379
|
+
dep_summary_dict: Any = None
|
|
380
|
+
if sm.dependency_summary is not None and sm.dependency_summary.requested:
|
|
381
|
+
ds = sm.dependency_summary
|
|
382
|
+
dep_summary_dict = {
|
|
383
|
+
"requested": True,
|
|
384
|
+
"total_count": ds.total_count,
|
|
385
|
+
"direct": ds.direct_count,
|
|
386
|
+
**({"sources": ds.sources} if ds.sources else {}),
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
# Env map — key + required + category only (drop type_hint, files list)
|
|
378
390
|
env_summary_dict: Any = None
|
|
379
391
|
env_map_items: Any = None
|
|
380
392
|
if sm.env_summary is not None and sm.env_summary.requested:
|
|
381
|
-
env_summary_dict =
|
|
393
|
+
env_summary_dict = {
|
|
394
|
+
"total": sm.env_summary.total,
|
|
395
|
+
"required": sm.env_summary.required_count,
|
|
396
|
+
**({"categories": sm.env_summary.categories} if sm.env_summary.categories else {}),
|
|
397
|
+
}
|
|
382
398
|
if sm.env_map:
|
|
383
399
|
_sorted_env = sorted(
|
|
384
400
|
sm.env_map,
|
|
385
401
|
key=lambda e: (not getattr(e, "required", False), getattr(e, "key", "")),
|
|
386
402
|
)
|
|
387
403
|
env_map_items = [
|
|
388
|
-
{
|
|
404
|
+
{
|
|
405
|
+
"key": getattr(e, "key", ""),
|
|
406
|
+
**({"required": True} if getattr(e, "required", False) else {}),
|
|
407
|
+
**({"category": getattr(e, "category", None)} if getattr(e, "category", None) else {}),
|
|
408
|
+
}
|
|
389
409
|
for e in _sorted_env[:_ENV_MAP_CAP]
|
|
390
410
|
]
|
|
391
411
|
|
|
412
|
+
# Code notes — kind + path + line + truncated text only
|
|
392
413
|
code_notes_summary_dict: Any = None
|
|
393
414
|
code_notes_items: Any = None
|
|
394
415
|
if sm.code_notes_summary is not None and sm.code_notes_summary.requested:
|
|
395
|
-
|
|
416
|
+
cn = sm.code_notes_summary
|
|
417
|
+
by_kind = {k: v for k, v in cn.by_kind.items() if v > 0}
|
|
418
|
+
code_notes_summary_dict = {"total": cn.total, **({"by_kind": by_kind} if by_kind else {})}
|
|
396
419
|
if sm.code_notes:
|
|
397
420
|
_SEVERITY_ORDER = {"BUG": 0, "FIXME": 1, "DEPRECATED": 2, "TODO": 3, "HACK": 4, "WARNING": 5}
|
|
398
421
|
_sorted_notes = sorted(
|
|
@@ -400,43 +423,62 @@ def compact_view(sm: SourceMap, *, no_tree: bool = False) -> dict[str, Any]:
|
|
|
400
423
|
key=lambda n: (_SEVERITY_ORDER.get(getattr(n, "kind", "").upper(), 9), getattr(n, "path", "")),
|
|
401
424
|
)
|
|
402
425
|
code_notes_items = [
|
|
403
|
-
{
|
|
426
|
+
{
|
|
427
|
+
"kind": getattr(n, "kind", ""),
|
|
428
|
+
"path": getattr(n, "path", ""),
|
|
429
|
+
"line": getattr(n, "line", None),
|
|
430
|
+
**({"text": getattr(n, "text", "")[:60]} if getattr(n, "text", "") else {}),
|
|
431
|
+
}
|
|
404
432
|
for n in _sorted_notes[:_CODE_NOTES_CAP]
|
|
405
433
|
]
|
|
406
434
|
|
|
407
|
-
# Entry points
|
|
408
|
-
# Development entries shown separately; auxiliary omitted from compact view.
|
|
435
|
+
# Entry points — path + kind + confidence only
|
|
409
436
|
ep_groups = _entry_point_groups(sm.entry_points)
|
|
410
|
-
entry_points_compact =
|
|
411
|
-
|
|
412
|
-
|
|
437
|
+
entry_points_compact = [
|
|
438
|
+
{
|
|
439
|
+
"path": ep["path"],
|
|
440
|
+
**({"kind": ep["kind"]} if ep.get("kind") else {}),
|
|
441
|
+
**({"confidence": ep["confidence"]} if ep.get("confidence") else {}),
|
|
442
|
+
}
|
|
443
|
+
for ep in ep_groups["production"][:_EP_PRODUCTION_CAP]
|
|
444
|
+
]
|
|
413
445
|
|
|
414
|
-
#
|
|
446
|
+
# Stacks — name + method + confidence + frameworks (names only)
|
|
447
|
+
stacks_compact = [
|
|
448
|
+
{
|
|
449
|
+
"stack": s.stack,
|
|
450
|
+
"detection_method": s.detection_method,
|
|
451
|
+
"confidence": s.confidence,
|
|
452
|
+
**({"primary": True} if s.primary else {}),
|
|
453
|
+
**({"frameworks": [f.name for f in s.frameworks]} if s.frameworks else {}),
|
|
454
|
+
**({"package_manager": s.package_manager} if s.package_manager else {}),
|
|
455
|
+
}
|
|
456
|
+
for s in sm.stacks
|
|
457
|
+
]
|
|
458
|
+
|
|
459
|
+
# Confidence — overall only + anomalies
|
|
415
460
|
conf_dict: Any = None
|
|
416
|
-
anomalies: Any = None
|
|
417
461
|
if sm.confidence_summary is not None:
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
462
|
+
cs = sm.confidence_summary
|
|
463
|
+
conf_dict = {"overall": cs.overall, "stack": cs.stack_confidence, "entry_points": cs.entry_point_confidence}
|
|
464
|
+
if cs.anomalies:
|
|
465
|
+
conf_dict["anomalies"] = cs.anomalies
|
|
421
466
|
|
|
422
467
|
# Analysis gaps
|
|
423
468
|
gaps_list: Any = None
|
|
424
469
|
if sm.analysis_gaps:
|
|
425
|
-
gaps_list = [
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
context_summary_dict = asdict(sm.context_summary)
|
|
470
|
+
gaps_list = [
|
|
471
|
+
{"area": g.area, "reason": g.reason, "impact": g.impact}
|
|
472
|
+
for g in sm.analysis_gaps
|
|
473
|
+
]
|
|
430
474
|
|
|
431
475
|
result: dict[str, Any] = {
|
|
432
476
|
"schema_version": sm.metadata.schema_version,
|
|
433
477
|
"project_type": sm.project_type,
|
|
434
478
|
"project_summary": sm.project_summary,
|
|
435
479
|
"architecture_summary": sm.architecture_summary,
|
|
436
|
-
"
|
|
437
|
-
"stacks": [asdict(stack) for stack in sm.stacks],
|
|
480
|
+
"stacks": stacks_compact,
|
|
438
481
|
"entry_points": entry_points_compact,
|
|
439
|
-
"development_entry_points": (ep_groups["development"][:_EP_DEV_CAP] or None),
|
|
440
482
|
"dependency_summary": dep_summary_dict,
|
|
441
483
|
"key_dependencies": key_deps,
|
|
442
484
|
"env_summary": env_summary_dict,
|
|
@@ -444,14 +486,10 @@ def compact_view(sm: SourceMap, *, no_tree: bool = False) -> dict[str, Any]:
|
|
|
444
486
|
"code_notes_summary": code_notes_summary_dict,
|
|
445
487
|
"code_notes": code_notes_items,
|
|
446
488
|
"confidence_summary": conf_dict,
|
|
447
|
-
"anomalies": anomalies,
|
|
448
489
|
"analysis_gaps": gaps_list,
|
|
449
490
|
}
|
|
450
|
-
|
|
451
|
-
return {k: v for k, v in result.items() if v is not None or k in
|
|
452
|
-
"project_type", "project_summary", "architecture_summary",
|
|
453
|
-
"dependency_summary", "confidence_summary",
|
|
454
|
-
)}
|
|
491
|
+
_always_include = {"project_type", "project_summary", "architecture_summary", "dependency_summary"}
|
|
492
|
+
return {k: v for k, v in result.items() if v is not None or k in _always_include}
|
|
455
493
|
|
|
456
494
|
|
|
457
495
|
def normalize_source_map(sm: SourceMap) -> SourceMap:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
sourcecode/__init__.py,sha256=
|
|
1
|
+
sourcecode/__init__.py,sha256=ZYQhk-Q7wjL_jfJS398d9Y2BPlzoHCjDAh6exi9L7JI,102
|
|
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
|
|
@@ -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=Il-gUEVmVNOX3uA7A9HHf8n64ZoHSC9AqW5qaVTZUBs,64362
|
|
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-1.0.0.dist-info/METADATA,sha256=E8Jq944wOl_8nMXiZPj0T75q2WKWd1SjXwGQrKnXbhM,25208
|
|
64
|
+
sourcecode-1.0.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
65
|
+
sourcecode-1.0.0.dist-info/entry_points.txt,sha256=ex3F9rmbXeyDIoFQHtkEqTsKSaJow8F0LrVu8XfIktQ,57
|
|
66
|
+
sourcecode-1.0.0.dist-info/licenses/LICENSE,sha256=7DdHrU9Z_3e7dSvq4ISijZNjnuHo5NIHNiHDouMQ9JU,10491
|
|
67
|
+
sourcecode-1.0.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|