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.
Files changed (257) hide show
  1. mulle_roam_code-0.0.1.dist-info/METADATA +1590 -0
  2. mulle_roam_code-0.0.1.dist-info/RECORD +257 -0
  3. mulle_roam_code-0.0.1.dist-info/WHEEL +5 -0
  4. mulle_roam_code-0.0.1.dist-info/entry_points.txt +3 -0
  5. mulle_roam_code-0.0.1.dist-info/licenses/LICENSE +21 -0
  6. mulle_roam_code-0.0.1.dist-info/top_level.txt +1 -0
  7. roam/__init__.py +8 -0
  8. roam/__main__.py +5 -0
  9. roam/analysis/__init__.py +1 -0
  10. roam/analysis/effects.py +639 -0
  11. roam/analysis/taint.py +689 -0
  12. roam/api.py +238 -0
  13. roam/bridges/__init__.py +3 -0
  14. roam/bridges/base.py +49 -0
  15. roam/bridges/bridge_config.py +218 -0
  16. roam/bridges/bridge_protobuf.py +352 -0
  17. roam/bridges/bridge_rest_api.py +242 -0
  18. roam/bridges/bridge_salesforce.py +198 -0
  19. roam/bridges/bridge_template.py +247 -0
  20. roam/bridges/registry.py +51 -0
  21. roam/catalog/__init__.py +0 -0
  22. roam/catalog/detectors.py +2242 -0
  23. roam/catalog/fixes.py +86 -0
  24. roam/catalog/smells.py +599 -0
  25. roam/catalog/tasks.py +1260 -0
  26. roam/cli.py +548 -0
  27. roam/commands/__init__.py +0 -0
  28. roam/commands/changed_files.py +139 -0
  29. roam/commands/cmd_adversarial.py +699 -0
  30. roam/commands/cmd_affected.py +432 -0
  31. roam/commands/cmd_affected_tests.py +375 -0
  32. roam/commands/cmd_agent_context.py +168 -0
  33. roam/commands/cmd_agent_export.py +890 -0
  34. roam/commands/cmd_agent_plan.py +315 -0
  35. roam/commands/cmd_ai_ratio.py +765 -0
  36. roam/commands/cmd_ai_readiness.py +775 -0
  37. roam/commands/cmd_alerts.py +409 -0
  38. roam/commands/cmd_annotate.py +210 -0
  39. roam/commands/cmd_api_changes.py +796 -0
  40. roam/commands/cmd_api_drift.py +781 -0
  41. roam/commands/cmd_attest.py +913 -0
  42. roam/commands/cmd_auth_gaps.py +799 -0
  43. roam/commands/cmd_bisect.py +216 -0
  44. roam/commands/cmd_breaking.py +464 -0
  45. roam/commands/cmd_budget.py +413 -0
  46. roam/commands/cmd_bus_factor.py +403 -0
  47. roam/commands/cmd_capsule.py +275 -0
  48. roam/commands/cmd_check_rules.py +574 -0
  49. roam/commands/cmd_clean.py +147 -0
  50. roam/commands/cmd_closure.py +294 -0
  51. roam/commands/cmd_clusters.py +457 -0
  52. roam/commands/cmd_codeowners.py +600 -0
  53. roam/commands/cmd_complexity.py +364 -0
  54. roam/commands/cmd_config.py +310 -0
  55. roam/commands/cmd_context.py +1151 -0
  56. roam/commands/cmd_conventions.py +697 -0
  57. roam/commands/cmd_coupling.py +462 -0
  58. roam/commands/cmd_coverage_gaps.py +638 -0
  59. roam/commands/cmd_cut.py +235 -0
  60. roam/commands/cmd_dark_matter.py +127 -0
  61. roam/commands/cmd_dashboard.py +365 -0
  62. roam/commands/cmd_dead.py +1585 -0
  63. roam/commands/cmd_debt.py +731 -0
  64. roam/commands/cmd_deps.py +121 -0
  65. roam/commands/cmd_describe.py +959 -0
  66. roam/commands/cmd_dev_profile.py +580 -0
  67. roam/commands/cmd_diagnose.py +377 -0
  68. roam/commands/cmd_diff.py +633 -0
  69. roam/commands/cmd_digest.py +214 -0
  70. roam/commands/cmd_doc_staleness.py +334 -0
  71. roam/commands/cmd_docs_coverage.py +193 -0
  72. roam/commands/cmd_doctor.py +319 -0
  73. roam/commands/cmd_drift.py +377 -0
  74. roam/commands/cmd_duplicates.py +559 -0
  75. roam/commands/cmd_effects.py +362 -0
  76. roam/commands/cmd_endpoints.py +768 -0
  77. roam/commands/cmd_entry_points.py +358 -0
  78. roam/commands/cmd_fan.py +311 -0
  79. roam/commands/cmd_file.py +334 -0
  80. roam/commands/cmd_fingerprint.py +172 -0
  81. roam/commands/cmd_fitness.py +723 -0
  82. roam/commands/cmd_fn_coupling.py +295 -0
  83. roam/commands/cmd_forecast.py +366 -0
  84. roam/commands/cmd_grep.py +282 -0
  85. roam/commands/cmd_guard.py +434 -0
  86. roam/commands/cmd_health.py +922 -0
  87. roam/commands/cmd_hooks.py +458 -0
  88. roam/commands/cmd_hotspots.py +606 -0
  89. roam/commands/cmd_impact.py +228 -0
  90. roam/commands/cmd_index.py +102 -0
  91. roam/commands/cmd_ingest_trace.py +143 -0
  92. roam/commands/cmd_init.py +166 -0
  93. roam/commands/cmd_intent.py +459 -0
  94. roam/commands/cmd_invariants.py +301 -0
  95. roam/commands/cmd_layers.py +387 -0
  96. roam/commands/cmd_map.py +275 -0
  97. roam/commands/cmd_math.py +213 -0
  98. roam/commands/cmd_mcp_setup.py +135 -0
  99. roam/commands/cmd_metrics.py +663 -0
  100. roam/commands/cmd_migration_safety.py +712 -0
  101. roam/commands/cmd_minimap.py +519 -0
  102. roam/commands/cmd_missing_index.py +885 -0
  103. roam/commands/cmd_module.py +204 -0
  104. roam/commands/cmd_mutate.py +400 -0
  105. roam/commands/cmd_n1.py +967 -0
  106. roam/commands/cmd_onboard.py +740 -0
  107. roam/commands/cmd_orchestrate.py +180 -0
  108. roam/commands/cmd_orphan_routes.py +754 -0
  109. roam/commands/cmd_over_fetch.py +633 -0
  110. roam/commands/cmd_owner.py +299 -0
  111. roam/commands/cmd_partition.py +714 -0
  112. roam/commands/cmd_path_coverage.py +564 -0
  113. roam/commands/cmd_patterns.py +689 -0
  114. roam/commands/cmd_plan.py +616 -0
  115. roam/commands/cmd_plan_refactor.py +432 -0
  116. roam/commands/cmd_pr_diff.py +292 -0
  117. roam/commands/cmd_pr_risk.py +677 -0
  118. roam/commands/cmd_preflight.py +706 -0
  119. roam/commands/cmd_relate.py +405 -0
  120. roam/commands/cmd_report.py +304 -0
  121. roam/commands/cmd_reset.py +117 -0
  122. roam/commands/cmd_risk.py +533 -0
  123. roam/commands/cmd_rules.py +319 -0
  124. roam/commands/cmd_safe_delete.py +224 -0
  125. roam/commands/cmd_safe_zones.py +295 -0
  126. roam/commands/cmd_schema.py +166 -0
  127. roam/commands/cmd_search.py +295 -0
  128. roam/commands/cmd_search_semantic.py +101 -0
  129. roam/commands/cmd_secrets.py +636 -0
  130. roam/commands/cmd_semantic_diff.py +538 -0
  131. roam/commands/cmd_simulate.py +296 -0
  132. roam/commands/cmd_simulate_departure.py +632 -0
  133. roam/commands/cmd_sketch.py +160 -0
  134. roam/commands/cmd_smells.py +179 -0
  135. roam/commands/cmd_snapshot.py +50 -0
  136. roam/commands/cmd_spectral.py +183 -0
  137. roam/commands/cmd_split.py +432 -0
  138. roam/commands/cmd_suggest_refactoring.py +486 -0
  139. roam/commands/cmd_suggest_reviewers.py +491 -0
  140. roam/commands/cmd_supply_chain.py +831 -0
  141. roam/commands/cmd_symbol.py +135 -0
  142. roam/commands/cmd_syntax_check.py +301 -0
  143. roam/commands/cmd_test_gaps.py +574 -0
  144. roam/commands/cmd_testmap.py +308 -0
  145. roam/commands/cmd_tour.py +377 -0
  146. roam/commands/cmd_trace.py +304 -0
  147. roam/commands/cmd_trend.py +461 -0
  148. roam/commands/cmd_trends.py +929 -0
  149. roam/commands/cmd_understand.py +763 -0
  150. roam/commands/cmd_uses.py +170 -0
  151. roam/commands/cmd_verify.py +812 -0
  152. roam/commands/cmd_verify_imports.py +435 -0
  153. roam/commands/cmd_vibe_check.py +932 -0
  154. roam/commands/cmd_visualize.py +361 -0
  155. roam/commands/cmd_vuln_map.py +139 -0
  156. roam/commands/cmd_vuln_reach.py +289 -0
  157. roam/commands/cmd_vulns.py +414 -0
  158. roam/commands/cmd_watch.py +759 -0
  159. roam/commands/cmd_weather.py +118 -0
  160. roam/commands/cmd_why.py +325 -0
  161. roam/commands/cmd_ws.py +755 -0
  162. roam/commands/cmd_xlang.py +170 -0
  163. roam/commands/context_helpers.py +1137 -0
  164. roam/commands/gate_presets.py +222 -0
  165. roam/commands/graph_helpers.py +93 -0
  166. roam/commands/metrics_history.py +298 -0
  167. roam/commands/next_steps.py +107 -0
  168. roam/commands/resolve.py +302 -0
  169. roam/competitor_site_data.py +2229 -0
  170. roam/coverage_reports.py +462 -0
  171. roam/db/__init__.py +0 -0
  172. roam/db/connection.py +359 -0
  173. roam/db/queries.py +151 -0
  174. roam/db/schema.py +335 -0
  175. roam/exit_codes.py +100 -0
  176. roam/graph/__init__.py +43 -0
  177. roam/graph/anomaly.py +493 -0
  178. roam/graph/builder.py +61 -0
  179. roam/graph/clusters.py +286 -0
  180. roam/graph/cycles.py +210 -0
  181. roam/graph/dark_matter.py +207 -0
  182. roam/graph/diff.py +467 -0
  183. roam/graph/fingerprint.py +297 -0
  184. roam/graph/layers.py +134 -0
  185. roam/graph/pagerank.py +171 -0
  186. roam/graph/partition.py +437 -0
  187. roam/graph/pathfinding.py +119 -0
  188. roam/graph/propagation.py +208 -0
  189. roam/graph/simulate.py +286 -0
  190. roam/graph/spectral.py +260 -0
  191. roam/index/__init__.py +5 -0
  192. roam/index/complexity.py +1108 -0
  193. roam/index/discovery.py +338 -0
  194. roam/index/file_roles.py +586 -0
  195. roam/index/git_stats.py +577 -0
  196. roam/index/incremental.py +75 -0
  197. roam/index/indexer.py +1191 -0
  198. roam/index/parser.py +461 -0
  199. roam/index/relations.py +537 -0
  200. roam/index/symbols.py +71 -0
  201. roam/index/test_conventions.py +508 -0
  202. roam/languages/__init__.py +21 -0
  203. roam/languages/apex_lang.py +241 -0
  204. roam/languages/aura_lang.py +228 -0
  205. roam/languages/base.py +111 -0
  206. roam/languages/c_lang.py +458 -0
  207. roam/languages/csharp_lang.py +1215 -0
  208. roam/languages/foxpro_lang.py +1554 -0
  209. roam/languages/generic_lang.py +702 -0
  210. roam/languages/go_lang.py +392 -0
  211. roam/languages/hcl_lang.py +398 -0
  212. roam/languages/java_lang.py +418 -0
  213. roam/languages/javascript_lang.py +799 -0
  214. roam/languages/kotlin_lang.py +147 -0
  215. roam/languages/objc_lang.py +401 -0
  216. roam/languages/php_lang.py +696 -0
  217. roam/languages/python_lang.py +850 -0
  218. roam/languages/registry.py +283 -0
  219. roam/languages/ruby_lang.py +429 -0
  220. roam/languages/rust_lang.py +545 -0
  221. roam/languages/sfxml_lang.py +276 -0
  222. roam/languages/swift_lang.py +173 -0
  223. roam/languages/typescript_lang.py +323 -0
  224. roam/languages/visualforce_lang.py +151 -0
  225. roam/languages/yaml_lang.py +566 -0
  226. roam/mcp_server.py +4794 -0
  227. roam/output/__init__.py +0 -0
  228. roam/output/formatter.py +557 -0
  229. roam/output/mermaid.py +62 -0
  230. roam/output/sarif.py +897 -0
  231. roam/output/schema_registry.py +57 -0
  232. roam/plugins.py +208 -0
  233. roam/refactor/__init__.py +0 -0
  234. roam/refactor/codegen.py +106 -0
  235. roam/refactor/transforms.py +711 -0
  236. roam/rules/__init__.py +0 -0
  237. roam/rules/ast_match.py +238 -0
  238. roam/rules/builtin.py +617 -0
  239. roam/rules/dataflow.py +515 -0
  240. roam/rules/engine.py +943 -0
  241. roam/runtime/__init__.py +3 -0
  242. roam/runtime/hotspots.py +138 -0
  243. roam/runtime/trace_ingest.py +535 -0
  244. roam/search/__init__.py +1 -0
  245. roam/search/framework_packs.py +673 -0
  246. roam/search/index_embeddings.py +732 -0
  247. roam/search/onnx_embeddings.py +233 -0
  248. roam/search/tfidf.py +355 -0
  249. roam/security/__init__.py +1 -0
  250. roam/security/vuln_reach.py +246 -0
  251. roam/security/vuln_store.py +334 -0
  252. roam/surface_counts.py +158 -0
  253. roam/workspace/__init__.py +3 -0
  254. roam/workspace/aggregator.py +426 -0
  255. roam/workspace/api_scanner.py +538 -0
  256. roam/workspace/config.py +95 -0
  257. roam/workspace/db.py +136 -0
@@ -0,0 +1,296 @@
1
+ """Counterfactual architecture simulator -- test structural changes before making them."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import click
6
+
7
+ from roam.commands.resolve import ensure_index
8
+ from roam.db.connection import open_db
9
+ from roam.output.formatter import json_envelope, to_json
10
+
11
+
12
+ def _run_simulation(ctx, op_name, apply_fn, op_args_fn):
13
+ """Shared flow for all simulate subcommands.
14
+
15
+ Parameters
16
+ ----------
17
+ ctx : click.Context
18
+ op_name : str
19
+ Operation name for output.
20
+ apply_fn : callable
21
+ Transform function from simulate module.
22
+ op_args_fn : callable(G_sim, conn) -> (dict, str | None)
23
+ Returns (op_result, error_message). error_message is None on success.
24
+ """
25
+ json_mode = ctx.obj.get("json") if ctx.obj else False
26
+ ensure_index()
27
+
28
+ from roam.graph.builder import build_symbol_graph
29
+ from roam.graph.simulate import (
30
+ clone_graph,
31
+ compute_graph_metrics,
32
+ metric_delta,
33
+ )
34
+
35
+ with open_db(readonly=True) as conn:
36
+ G = build_symbol_graph(conn)
37
+ before = compute_graph_metrics(G)
38
+
39
+ G_sim = clone_graph(G)
40
+ op_result, error = op_args_fn(G_sim, conn)
41
+ if error:
42
+ if json_mode:
43
+ click.echo(
44
+ to_json(
45
+ json_envelope(
46
+ "simulate",
47
+ summary={
48
+ "verdict": error,
49
+ "operation": op_name,
50
+ "health_delta": 0,
51
+ "health_before": before["health_score"],
52
+ "health_after": before["health_score"],
53
+ "improved_metrics": 0,
54
+ "degraded_metrics": 0,
55
+ },
56
+ operation={"operation": op_name, "error": error},
57
+ metrics={},
58
+ warnings=[error],
59
+ )
60
+ )
61
+ )
62
+ return
63
+ click.echo(f"VERDICT: {error}")
64
+ return
65
+
66
+ after = compute_graph_metrics(G_sim)
67
+ deltas = metric_delta(before, after)
68
+
69
+ health_delta = after["health_score"] - before["health_score"]
70
+ improved = sum(1 for d in deltas.values() if d["direction"] == "improved")
71
+ degraded = sum(1 for d in deltas.values() if d["direction"] == "degraded")
72
+
73
+ # Warnings
74
+ warnings = []
75
+ if after["cycles"] > before["cycles"]:
76
+ warnings.append(f"new cycles introduced ({before['cycles']} -> {after['cycles']})")
77
+ if after["layer_violations"] > before["layer_violations"]:
78
+ warnings.append(f"new layer violations ({before['layer_violations']} -> {after['layer_violations']})")
79
+ if after["modularity"] < before["modularity"]:
80
+ warnings.append(f"modularity decreased ({before['modularity']} -> {after['modularity']})")
81
+
82
+ # Verdict
83
+ mod_delta = deltas.get("modularity", {})
84
+ mod_str = ""
85
+ if mod_delta:
86
+ md = mod_delta["delta"]
87
+ mod_str = f", modularity {md:+.2f}" if md != 0 else ", modularity unchanged"
88
+
89
+ cycle_delta = after["cycles"] - before["cycles"]
90
+ cycle_str = f", {cycle_delta} new cycles" if cycle_delta > 0 else ", 0 new cycles"
91
+
92
+ if health_delta > 0:
93
+ verdict = (
94
+ f"health {health_delta:+d} ({before['health_score']} -> {after['health_score']}){mod_str}{cycle_str}"
95
+ )
96
+ elif health_delta == 0:
97
+ verdict = f"health unchanged at {before['health_score']}{mod_str}{cycle_str}"
98
+ else:
99
+ verdict = (
100
+ f"health {health_delta:+d} ({before['health_score']} -> {after['health_score']}){mod_str}{cycle_str}"
101
+ )
102
+
103
+ if json_mode:
104
+ click.echo(
105
+ to_json(
106
+ json_envelope(
107
+ "simulate",
108
+ summary={
109
+ "verdict": verdict,
110
+ "operation": op_name,
111
+ "health_delta": health_delta,
112
+ "health_before": before["health_score"],
113
+ "health_after": after["health_score"],
114
+ "improved_metrics": improved,
115
+ "degraded_metrics": degraded,
116
+ },
117
+ operation=op_result,
118
+ metrics=deltas,
119
+ warnings=warnings,
120
+ )
121
+ )
122
+ )
123
+ return
124
+
125
+ # Text output
126
+ click.echo(f"VERDICT: {verdict}")
127
+ click.echo("")
128
+
129
+ # Operation summary
130
+ op_line = op_result.get("operation", op_name).upper()
131
+ sym = op_result.get("symbol", "")
132
+ from_f = op_result.get("from_file", "")
133
+ to_f = op_result.get("to_file", op_result.get("target_file", ""))
134
+ if sym and from_f and to_f:
135
+ click.echo(f"OPERATION: {op_line} {sym} from {from_f} to {to_f}")
136
+ elif op_result.get("removed"):
137
+ click.echo(f"OPERATION: {op_line} {', '.join(op_result['removed'])}")
138
+ elif op_result.get("merged_file"):
139
+ click.echo(f"OPERATION: {op_line} {op_result['merged_file']} into {to_f}")
140
+ else:
141
+ click.echo(f"OPERATION: {op_line}")
142
+ click.echo("")
143
+
144
+ # Metric deltas table
145
+ click.echo("METRIC DELTAS:")
146
+ label_map = {
147
+ "health_score": "Health score",
148
+ "cycles": "Cycles",
149
+ "tangle_ratio": "Tangle ratio",
150
+ "layer_violations": "Layer violations",
151
+ "modularity": "Modularity",
152
+ "fiedler": "Fiedler",
153
+ "propagation_cost": "Propagation cost",
154
+ "god_components": "God components",
155
+ "bottlenecks": "Bottlenecks",
156
+ "nodes": "Nodes",
157
+ "edges": "Edges",
158
+ }
159
+ display_order = [
160
+ "health_score",
161
+ "cycles",
162
+ "tangle_ratio",
163
+ "layer_violations",
164
+ "modularity",
165
+ "fiedler",
166
+ "propagation_cost",
167
+ "god_components",
168
+ "bottlenecks",
169
+ ]
170
+ for key in display_order:
171
+ d = deltas.get(key)
172
+ if d is None:
173
+ continue
174
+ label = label_map.get(key, key)
175
+ b_val = d["before"]
176
+ a_val = d["after"]
177
+ pct = d["pct_change"]
178
+ direction = d["direction"]
179
+
180
+ if isinstance(b_val, float):
181
+ val_str = f"{b_val:.4f} -> {a_val:.4f}"
182
+ else:
183
+ val_str = f"{b_val} -> {a_val}"
184
+
185
+ if direction == "unchanged":
186
+ pct_str = "(no change)"
187
+ else:
188
+ pct_str = f"({pct:+.1f}%)"
189
+
190
+ dir_str = ""
191
+ if direction == "improved":
192
+ dir_str = " IMPROVED"
193
+ elif direction == "degraded":
194
+ dir_str = " DEGRADED"
195
+
196
+ click.echo(f" {label:20s} {val_str:24s} {pct_str:14s}{dir_str}")
197
+
198
+ if warnings:
199
+ click.echo("")
200
+ click.echo("WARNINGS:")
201
+ for w in warnings:
202
+ click.echo(f" - {w}")
203
+
204
+
205
+ # ---------------------------------------------------------------------------
206
+ # Click group
207
+ # ---------------------------------------------------------------------------
208
+
209
+
210
+ @click.group("simulate")
211
+ @click.pass_context
212
+ def simulate(ctx):
213
+ """Counterfactual architecture simulator.
214
+
215
+ Test structural changes (move, extract, merge, delete) on the dependency
216
+ graph and see predicted metric deltas before making actual code changes.
217
+ """
218
+ ctx.ensure_object(dict)
219
+
220
+
221
+ # ---------------------------------------------------------------------------
222
+ # Subcommands
223
+ # ---------------------------------------------------------------------------
224
+
225
+
226
+ @simulate.command("move")
227
+ @click.argument("symbol")
228
+ @click.argument("target_file")
229
+ @click.pass_context
230
+ def simulate_move(ctx, symbol, target_file):
231
+ """Simulate moving a symbol to a different file."""
232
+ from roam.graph.simulate import apply_move, resolve_target
233
+
234
+ def do_op(G_sim, conn):
235
+ node_ids, label = resolve_target(G_sim, conn, symbol)
236
+ if not node_ids:
237
+ return {}, f"symbol not found: {symbol}"
238
+ result = apply_move(G_sim, node_ids[0], target_file)
239
+ return result, None
240
+
241
+ _run_simulation(ctx, "move", apply_move, do_op)
242
+
243
+
244
+ @simulate.command("extract")
245
+ @click.argument("symbol")
246
+ @click.argument("target_file")
247
+ @click.pass_context
248
+ def simulate_extract(ctx, symbol, target_file):
249
+ """Simulate extracting a symbol and its private callees to a new file."""
250
+ from roam.graph.simulate import apply_extract, resolve_target
251
+
252
+ def do_op(G_sim, conn):
253
+ node_ids, label = resolve_target(G_sim, conn, symbol)
254
+ if not node_ids:
255
+ return {}, f"symbol not found: {symbol}"
256
+ result = apply_extract(G_sim, node_ids[0], target_file)
257
+ return result, None
258
+
259
+ _run_simulation(ctx, "extract", apply_extract, do_op)
260
+
261
+
262
+ @simulate.command("merge")
263
+ @click.argument("file_a")
264
+ @click.argument("file_b")
265
+ @click.pass_context
266
+ def simulate_merge(ctx, file_a, file_b):
267
+ """Simulate merging file_b into file_a."""
268
+ from roam.graph.simulate import apply_merge
269
+
270
+ def do_op(G_sim, conn):
271
+ # Check file_b has nodes
272
+ norm_b = file_b.replace("\\", "/")
273
+ has_nodes = any(norm_b in (G_sim.nodes[n].get("file_path") or "").replace("\\", "/") for n in G_sim.nodes)
274
+ if not has_nodes:
275
+ return {}, f"no symbols found in: {file_b}"
276
+ result = apply_merge(G_sim, file_a, file_b)
277
+ return result, None
278
+
279
+ _run_simulation(ctx, "merge", apply_merge, do_op)
280
+
281
+
282
+ @simulate.command("delete")
283
+ @click.argument("target")
284
+ @click.pass_context
285
+ def simulate_delete(ctx, target):
286
+ """Simulate deleting a symbol or all symbols in a file."""
287
+ from roam.graph.simulate import apply_delete, resolve_target
288
+
289
+ def do_op(G_sim, conn):
290
+ node_ids, label = resolve_target(G_sim, conn, target)
291
+ if not node_ids:
292
+ return {}, f"target not found: {target}"
293
+ result = apply_delete(G_sim, node_ids)
294
+ return result, None
295
+
296
+ _run_simulation(ctx, "delete", apply_delete, do_op)