mulle-roam-code 0.0.1__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.
- mulle_roam_code-0.0.1.dist-info/METADATA +1590 -0
- mulle_roam_code-0.0.1.dist-info/RECORD +257 -0
- mulle_roam_code-0.0.1.dist-info/WHEEL +5 -0
- mulle_roam_code-0.0.1.dist-info/entry_points.txt +3 -0
- mulle_roam_code-0.0.1.dist-info/licenses/LICENSE +21 -0
- mulle_roam_code-0.0.1.dist-info/top_level.txt +1 -0
- roam/__init__.py +8 -0
- roam/__main__.py +5 -0
- roam/analysis/__init__.py +1 -0
- roam/analysis/effects.py +639 -0
- roam/analysis/taint.py +689 -0
- roam/api.py +238 -0
- roam/bridges/__init__.py +3 -0
- roam/bridges/base.py +49 -0
- roam/bridges/bridge_config.py +218 -0
- roam/bridges/bridge_protobuf.py +352 -0
- roam/bridges/bridge_rest_api.py +242 -0
- roam/bridges/bridge_salesforce.py +198 -0
- roam/bridges/bridge_template.py +247 -0
- roam/bridges/registry.py +51 -0
- roam/catalog/__init__.py +0 -0
- roam/catalog/detectors.py +2242 -0
- roam/catalog/fixes.py +86 -0
- roam/catalog/smells.py +599 -0
- roam/catalog/tasks.py +1260 -0
- roam/cli.py +548 -0
- roam/commands/__init__.py +0 -0
- roam/commands/changed_files.py +139 -0
- roam/commands/cmd_adversarial.py +699 -0
- roam/commands/cmd_affected.py +432 -0
- roam/commands/cmd_affected_tests.py +375 -0
- roam/commands/cmd_agent_context.py +168 -0
- roam/commands/cmd_agent_export.py +890 -0
- roam/commands/cmd_agent_plan.py +315 -0
- roam/commands/cmd_ai_ratio.py +765 -0
- roam/commands/cmd_ai_readiness.py +775 -0
- roam/commands/cmd_alerts.py +409 -0
- roam/commands/cmd_annotate.py +210 -0
- roam/commands/cmd_api_changes.py +796 -0
- roam/commands/cmd_api_drift.py +781 -0
- roam/commands/cmd_attest.py +913 -0
- roam/commands/cmd_auth_gaps.py +799 -0
- roam/commands/cmd_bisect.py +216 -0
- roam/commands/cmd_breaking.py +464 -0
- roam/commands/cmd_budget.py +413 -0
- roam/commands/cmd_bus_factor.py +403 -0
- roam/commands/cmd_capsule.py +275 -0
- roam/commands/cmd_check_rules.py +574 -0
- roam/commands/cmd_clean.py +147 -0
- roam/commands/cmd_closure.py +294 -0
- roam/commands/cmd_clusters.py +457 -0
- roam/commands/cmd_codeowners.py +600 -0
- roam/commands/cmd_complexity.py +364 -0
- roam/commands/cmd_config.py +310 -0
- roam/commands/cmd_context.py +1151 -0
- roam/commands/cmd_conventions.py +697 -0
- roam/commands/cmd_coupling.py +462 -0
- roam/commands/cmd_coverage_gaps.py +638 -0
- roam/commands/cmd_cut.py +235 -0
- roam/commands/cmd_dark_matter.py +127 -0
- roam/commands/cmd_dashboard.py +365 -0
- roam/commands/cmd_dead.py +1585 -0
- roam/commands/cmd_debt.py +731 -0
- roam/commands/cmd_deps.py +121 -0
- roam/commands/cmd_describe.py +959 -0
- roam/commands/cmd_dev_profile.py +580 -0
- roam/commands/cmd_diagnose.py +377 -0
- roam/commands/cmd_diff.py +633 -0
- roam/commands/cmd_digest.py +214 -0
- roam/commands/cmd_doc_staleness.py +334 -0
- roam/commands/cmd_docs_coverage.py +193 -0
- roam/commands/cmd_doctor.py +319 -0
- roam/commands/cmd_drift.py +377 -0
- roam/commands/cmd_duplicates.py +559 -0
- roam/commands/cmd_effects.py +362 -0
- roam/commands/cmd_endpoints.py +768 -0
- roam/commands/cmd_entry_points.py +358 -0
- roam/commands/cmd_fan.py +311 -0
- roam/commands/cmd_file.py +334 -0
- roam/commands/cmd_fingerprint.py +172 -0
- roam/commands/cmd_fitness.py +723 -0
- roam/commands/cmd_fn_coupling.py +295 -0
- roam/commands/cmd_forecast.py +366 -0
- roam/commands/cmd_grep.py +282 -0
- roam/commands/cmd_guard.py +434 -0
- roam/commands/cmd_health.py +922 -0
- roam/commands/cmd_hooks.py +458 -0
- roam/commands/cmd_hotspots.py +606 -0
- roam/commands/cmd_impact.py +228 -0
- roam/commands/cmd_index.py +102 -0
- roam/commands/cmd_ingest_trace.py +143 -0
- roam/commands/cmd_init.py +166 -0
- roam/commands/cmd_intent.py +459 -0
- roam/commands/cmd_invariants.py +301 -0
- roam/commands/cmd_layers.py +387 -0
- roam/commands/cmd_map.py +275 -0
- roam/commands/cmd_math.py +213 -0
- roam/commands/cmd_mcp_setup.py +135 -0
- roam/commands/cmd_metrics.py +663 -0
- roam/commands/cmd_migration_safety.py +712 -0
- roam/commands/cmd_minimap.py +519 -0
- roam/commands/cmd_missing_index.py +885 -0
- roam/commands/cmd_module.py +204 -0
- roam/commands/cmd_mutate.py +400 -0
- roam/commands/cmd_n1.py +967 -0
- roam/commands/cmd_onboard.py +740 -0
- roam/commands/cmd_orchestrate.py +180 -0
- roam/commands/cmd_orphan_routes.py +754 -0
- roam/commands/cmd_over_fetch.py +633 -0
- roam/commands/cmd_owner.py +299 -0
- roam/commands/cmd_partition.py +714 -0
- roam/commands/cmd_path_coverage.py +564 -0
- roam/commands/cmd_patterns.py +689 -0
- roam/commands/cmd_plan.py +616 -0
- roam/commands/cmd_plan_refactor.py +432 -0
- roam/commands/cmd_pr_diff.py +292 -0
- roam/commands/cmd_pr_risk.py +677 -0
- roam/commands/cmd_preflight.py +706 -0
- roam/commands/cmd_relate.py +405 -0
- roam/commands/cmd_report.py +304 -0
- roam/commands/cmd_reset.py +117 -0
- roam/commands/cmd_risk.py +533 -0
- roam/commands/cmd_rules.py +319 -0
- roam/commands/cmd_safe_delete.py +224 -0
- roam/commands/cmd_safe_zones.py +295 -0
- roam/commands/cmd_schema.py +166 -0
- roam/commands/cmd_search.py +295 -0
- roam/commands/cmd_search_semantic.py +101 -0
- roam/commands/cmd_secrets.py +636 -0
- roam/commands/cmd_semantic_diff.py +538 -0
- roam/commands/cmd_simulate.py +296 -0
- roam/commands/cmd_simulate_departure.py +632 -0
- roam/commands/cmd_sketch.py +160 -0
- roam/commands/cmd_smells.py +179 -0
- roam/commands/cmd_snapshot.py +50 -0
- roam/commands/cmd_spectral.py +183 -0
- roam/commands/cmd_split.py +432 -0
- roam/commands/cmd_suggest_refactoring.py +486 -0
- roam/commands/cmd_suggest_reviewers.py +491 -0
- roam/commands/cmd_supply_chain.py +831 -0
- roam/commands/cmd_symbol.py +135 -0
- roam/commands/cmd_syntax_check.py +301 -0
- roam/commands/cmd_test_gaps.py +574 -0
- roam/commands/cmd_testmap.py +308 -0
- roam/commands/cmd_tour.py +377 -0
- roam/commands/cmd_trace.py +304 -0
- roam/commands/cmd_trend.py +461 -0
- roam/commands/cmd_trends.py +929 -0
- roam/commands/cmd_understand.py +763 -0
- roam/commands/cmd_uses.py +170 -0
- roam/commands/cmd_verify.py +812 -0
- roam/commands/cmd_verify_imports.py +435 -0
- roam/commands/cmd_vibe_check.py +932 -0
- roam/commands/cmd_visualize.py +361 -0
- roam/commands/cmd_vuln_map.py +139 -0
- roam/commands/cmd_vuln_reach.py +289 -0
- roam/commands/cmd_vulns.py +414 -0
- roam/commands/cmd_watch.py +759 -0
- roam/commands/cmd_weather.py +118 -0
- roam/commands/cmd_why.py +325 -0
- roam/commands/cmd_ws.py +755 -0
- roam/commands/cmd_xlang.py +170 -0
- roam/commands/context_helpers.py +1137 -0
- roam/commands/gate_presets.py +222 -0
- roam/commands/graph_helpers.py +93 -0
- roam/commands/metrics_history.py +298 -0
- roam/commands/next_steps.py +107 -0
- roam/commands/resolve.py +302 -0
- roam/competitor_site_data.py +2229 -0
- roam/coverage_reports.py +462 -0
- roam/db/__init__.py +0 -0
- roam/db/connection.py +359 -0
- roam/db/queries.py +151 -0
- roam/db/schema.py +335 -0
- roam/exit_codes.py +100 -0
- roam/graph/__init__.py +43 -0
- roam/graph/anomaly.py +493 -0
- roam/graph/builder.py +61 -0
- roam/graph/clusters.py +286 -0
- roam/graph/cycles.py +210 -0
- roam/graph/dark_matter.py +207 -0
- roam/graph/diff.py +467 -0
- roam/graph/fingerprint.py +297 -0
- roam/graph/layers.py +134 -0
- roam/graph/pagerank.py +171 -0
- roam/graph/partition.py +437 -0
- roam/graph/pathfinding.py +119 -0
- roam/graph/propagation.py +208 -0
- roam/graph/simulate.py +286 -0
- roam/graph/spectral.py +260 -0
- roam/index/__init__.py +5 -0
- roam/index/complexity.py +1108 -0
- roam/index/discovery.py +338 -0
- roam/index/file_roles.py +586 -0
- roam/index/git_stats.py +577 -0
- roam/index/incremental.py +75 -0
- roam/index/indexer.py +1191 -0
- roam/index/parser.py +461 -0
- roam/index/relations.py +537 -0
- roam/index/symbols.py +71 -0
- roam/index/test_conventions.py +508 -0
- roam/languages/__init__.py +21 -0
- roam/languages/apex_lang.py +241 -0
- roam/languages/aura_lang.py +228 -0
- roam/languages/base.py +111 -0
- roam/languages/c_lang.py +458 -0
- roam/languages/csharp_lang.py +1215 -0
- roam/languages/foxpro_lang.py +1554 -0
- roam/languages/generic_lang.py +702 -0
- roam/languages/go_lang.py +392 -0
- roam/languages/hcl_lang.py +398 -0
- roam/languages/java_lang.py +418 -0
- roam/languages/javascript_lang.py +799 -0
- roam/languages/kotlin_lang.py +147 -0
- roam/languages/objc_lang.py +401 -0
- roam/languages/php_lang.py +696 -0
- roam/languages/python_lang.py +850 -0
- roam/languages/registry.py +283 -0
- roam/languages/ruby_lang.py +429 -0
- roam/languages/rust_lang.py +545 -0
- roam/languages/sfxml_lang.py +276 -0
- roam/languages/swift_lang.py +173 -0
- roam/languages/typescript_lang.py +323 -0
- roam/languages/visualforce_lang.py +151 -0
- roam/languages/yaml_lang.py +566 -0
- roam/mcp_server.py +4794 -0
- roam/output/__init__.py +0 -0
- roam/output/formatter.py +557 -0
- roam/output/mermaid.py +62 -0
- roam/output/sarif.py +897 -0
- roam/output/schema_registry.py +57 -0
- roam/plugins.py +208 -0
- roam/refactor/__init__.py +0 -0
- roam/refactor/codegen.py +106 -0
- roam/refactor/transforms.py +711 -0
- roam/rules/__init__.py +0 -0
- roam/rules/ast_match.py +238 -0
- roam/rules/builtin.py +617 -0
- roam/rules/dataflow.py +515 -0
- roam/rules/engine.py +943 -0
- roam/runtime/__init__.py +3 -0
- roam/runtime/hotspots.py +138 -0
- roam/runtime/trace_ingest.py +535 -0
- roam/search/__init__.py +1 -0
- roam/search/framework_packs.py +673 -0
- roam/search/index_embeddings.py +732 -0
- roam/search/onnx_embeddings.py +233 -0
- roam/search/tfidf.py +355 -0
- roam/security/__init__.py +1 -0
- roam/security/vuln_reach.py +246 -0
- roam/security/vuln_store.py +334 -0
- roam/surface_counts.py +158 -0
- roam/workspace/__init__.py +3 -0
- roam/workspace/aggregator.py +426 -0
- roam/workspace/api_scanner.py +538 -0
- roam/workspace/config.py +95 -0
- roam/workspace/db.py +136 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"""Show file import/imported-by relationships."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import click
|
|
6
|
+
|
|
7
|
+
from roam.commands.resolve import ensure_index, file_not_found_hint
|
|
8
|
+
from roam.db.connection import open_db
|
|
9
|
+
from roam.db.queries import FILE_BY_PATH, FILE_IMPORTED_BY, FILE_IMPORTS
|
|
10
|
+
from roam.output.formatter import format_table, json_envelope, summary_envelope, to_json
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@click.command()
|
|
14
|
+
@click.argument("path")
|
|
15
|
+
@click.option("--full", is_flag=True, help="Show all results without truncation")
|
|
16
|
+
@click.pass_context
|
|
17
|
+
def deps(ctx, path, full):
|
|
18
|
+
"""Show file import/imported-by relationships."""
|
|
19
|
+
json_mode = ctx.obj.get("json") if ctx.obj else False
|
|
20
|
+
detail = ctx.obj.get("detail", False) if ctx.obj else False
|
|
21
|
+
token_budget = ctx.obj.get("budget", 0) if ctx.obj else 0
|
|
22
|
+
ensure_index()
|
|
23
|
+
|
|
24
|
+
path = path.replace("\\", "/")
|
|
25
|
+
|
|
26
|
+
with open_db(readonly=True) as conn:
|
|
27
|
+
frow = conn.execute(FILE_BY_PATH, (path,)).fetchone()
|
|
28
|
+
if frow is None:
|
|
29
|
+
frow = conn.execute(
|
|
30
|
+
"SELECT * FROM files WHERE path LIKE ? LIMIT 1",
|
|
31
|
+
(f"%{path}",),
|
|
32
|
+
).fetchone()
|
|
33
|
+
if frow is None:
|
|
34
|
+
click.echo(file_not_found_hint(path))
|
|
35
|
+
raise SystemExit(1)
|
|
36
|
+
|
|
37
|
+
# --- Imports ---
|
|
38
|
+
imports = conn.execute(FILE_IMPORTS, (frow["id"],)).fetchall()
|
|
39
|
+
used_from: dict = {}
|
|
40
|
+
if imports:
|
|
41
|
+
import_file_ids = set(i["id"] for i in imports)
|
|
42
|
+
sym_edges = conn.execute(
|
|
43
|
+
"SELECT s_tgt.file_id as tgt_fid, s_tgt.name as tgt_name "
|
|
44
|
+
"FROM edges e "
|
|
45
|
+
"JOIN symbols s_src ON e.source_id = s_src.id "
|
|
46
|
+
"JOIN symbols s_tgt ON e.target_id = s_tgt.id "
|
|
47
|
+
"WHERE s_src.file_id = ? AND s_tgt.file_id != ?",
|
|
48
|
+
(frow["id"], frow["id"]),
|
|
49
|
+
).fetchall()
|
|
50
|
+
for se in sym_edges:
|
|
51
|
+
if se["tgt_fid"] in import_file_ids:
|
|
52
|
+
used_from.setdefault(se["tgt_fid"], set()).add(se["tgt_name"])
|
|
53
|
+
|
|
54
|
+
# --- Imported by ---
|
|
55
|
+
imported_by = conn.execute(FILE_IMPORTED_BY, (frow["id"],)).fetchall()
|
|
56
|
+
|
|
57
|
+
if json_mode:
|
|
58
|
+
envelope = json_envelope(
|
|
59
|
+
"deps",
|
|
60
|
+
summary={
|
|
61
|
+
"imports": len(imports),
|
|
62
|
+
"imported_by": len(imported_by),
|
|
63
|
+
},
|
|
64
|
+
budget=token_budget,
|
|
65
|
+
path=frow["path"],
|
|
66
|
+
imports=[
|
|
67
|
+
{
|
|
68
|
+
"path": i["path"],
|
|
69
|
+
"symbol_count": i["symbol_count"],
|
|
70
|
+
"used_symbols": sorted(used_from.get(i["id"], set())),
|
|
71
|
+
}
|
|
72
|
+
for i in imports
|
|
73
|
+
],
|
|
74
|
+
imported_by=[{"path": i["path"], "symbol_count": i["symbol_count"]} for i in imported_by],
|
|
75
|
+
)
|
|
76
|
+
if not detail:
|
|
77
|
+
envelope = summary_envelope(envelope)
|
|
78
|
+
click.echo(to_json(envelope))
|
|
79
|
+
return
|
|
80
|
+
|
|
81
|
+
# --- Text output ---
|
|
82
|
+
click.echo(f"{frow['path']}")
|
|
83
|
+
click.echo(f"Imports: {len(imports)} | Imported by: {len(imported_by)}")
|
|
84
|
+
click.echo()
|
|
85
|
+
|
|
86
|
+
if not detail:
|
|
87
|
+
# Summary mode: show counts and top 5
|
|
88
|
+
if imports:
|
|
89
|
+
click.echo("Imports (top 5, use --detail for full list):")
|
|
90
|
+
for i in imports[:5]:
|
|
91
|
+
names = used_from.get(i["id"], set())
|
|
92
|
+
sym_str = ", ".join(sorted(names)[:3])
|
|
93
|
+
if len(names) > 3:
|
|
94
|
+
sym_str += f" (+{len(names) - 3})"
|
|
95
|
+
click.echo(f" {i['path']} ({sym_str})")
|
|
96
|
+
if len(imports) > 5:
|
|
97
|
+
click.echo(f" (+{len(imports) - 5} more)")
|
|
98
|
+
else:
|
|
99
|
+
click.echo("Imports: (none)")
|
|
100
|
+
return
|
|
101
|
+
|
|
102
|
+
if imports:
|
|
103
|
+
rows = []
|
|
104
|
+
for i in imports:
|
|
105
|
+
names = used_from.get(i["id"], set())
|
|
106
|
+
sym_str = ", ".join(sorted(names)[:5])
|
|
107
|
+
if len(names) > 5:
|
|
108
|
+
sym_str += f" (+{len(names) - 5})"
|
|
109
|
+
rows.append([i["path"], str(i["symbol_count"]), sym_str])
|
|
110
|
+
click.echo("Imports:")
|
|
111
|
+
click.echo(format_table(["file", "symbols", "used"], rows))
|
|
112
|
+
else:
|
|
113
|
+
click.echo("Imports: (none)")
|
|
114
|
+
click.echo()
|
|
115
|
+
|
|
116
|
+
if imported_by:
|
|
117
|
+
rows = [[i["path"], str(i["symbol_count"])] for i in imported_by]
|
|
118
|
+
click.echo("Imported by:")
|
|
119
|
+
click.echo(format_table(["file", "symbols"], rows))
|
|
120
|
+
else:
|
|
121
|
+
click.echo("Imported by: (none)")
|