@opensip-cli/graph 0.1.9 → 0.1.11

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 (119) hide show
  1. package/README.md +4 -2
  2. package/dist/__tests__/cli/graph.test.d.ts.map +1 -1
  3. package/dist/__tests__/cli/graph.test.js +0 -1
  4. package/dist/__tests__/cli/graph.test.js.map +1 -1
  5. package/dist/__tests__/internal-surface.test.js +1 -1
  6. package/dist/__tests__/internal-surface.test.js.map +1 -1
  7. package/dist/__tests__/public-api.test.js +4 -0
  8. package/dist/__tests__/public-api.test.js.map +1 -1
  9. package/dist/__tests__/render/catalog-json.test.d.ts.map +1 -1
  10. package/dist/__tests__/render/catalog-json.test.js +0 -1
  11. package/dist/__tests__/render/catalog-json.test.js.map +1 -1
  12. package/dist/cli/__tests__/graph-envelope-view.test.js +9 -9
  13. package/dist/cli/__tests__/graph-envelope-view.test.js.map +1 -1
  14. package/dist/cli/__tests__/graph-runner.test.d.ts +5 -0
  15. package/dist/cli/__tests__/graph-runner.test.d.ts.map +1 -0
  16. package/dist/cli/__tests__/graph-runner.test.js +100 -0
  17. package/dist/cli/__tests__/graph-runner.test.js.map +1 -0
  18. package/dist/cli/equivalence-check-command.d.ts.map +1 -1
  19. package/dist/cli/equivalence-check-command.js +0 -4
  20. package/dist/cli/equivalence-check-command.js.map +1 -1
  21. package/dist/cli/graph/graph-aux-command-specs.d.ts +0 -25
  22. package/dist/cli/graph/graph-aux-command-specs.d.ts.map +1 -1
  23. package/dist/cli/graph/graph-aux-command-specs.js +6 -12
  24. package/dist/cli/graph/graph-aux-command-specs.js.map +1 -1
  25. package/dist/cli/graph/graph-command-spec.d.ts +3 -3
  26. package/dist/cli/graph/graph-command-spec.d.ts.map +1 -1
  27. package/dist/cli/graph/graph-command-spec.js +4 -4
  28. package/dist/cli/graph/graph-command-spec.js.map +1 -1
  29. package/dist/cli/graph-config-schema.d.ts.map +1 -1
  30. package/dist/cli/graph-config-schema.js +0 -1
  31. package/dist/cli/graph-config-schema.js.map +1 -1
  32. package/dist/cli/graph-config.d.ts.map +1 -1
  33. package/dist/cli/graph-config.js +0 -1
  34. package/dist/cli/graph-config.js.map +1 -1
  35. package/dist/cli/graph-envelope-view.d.ts +7 -36
  36. package/dist/cli/graph-envelope-view.d.ts.map +1 -1
  37. package/dist/cli/graph-envelope-view.js +6 -102
  38. package/dist/cli/graph-envelope-view.js.map +1 -1
  39. package/dist/cli/graph-modes.d.ts.map +1 -1
  40. package/dist/cli/graph-modes.js +0 -2
  41. package/dist/cli/graph-modes.js.map +1 -1
  42. package/dist/cli/graph-report.d.ts +4 -6
  43. package/dist/cli/graph-report.d.ts.map +1 -1
  44. package/dist/cli/graph-report.js +2 -2
  45. package/dist/cli/graph-report.js.map +1 -1
  46. package/dist/cli/graph-result-delivery.d.ts +30 -0
  47. package/dist/cli/graph-result-delivery.d.ts.map +1 -0
  48. package/dist/cli/graph-result-delivery.js +231 -0
  49. package/dist/cli/graph-result-delivery.js.map +1 -0
  50. package/dist/cli/graph-runner.d.ts +2 -83
  51. package/dist/cli/graph-runner.d.ts.map +1 -1
  52. package/dist/cli/graph-runner.js +71 -215
  53. package/dist/cli/graph-runner.js.map +1 -1
  54. package/dist/cli/graph-session-contribution.d.ts.map +1 -1
  55. package/dist/cli/graph-session-contribution.js +6 -2
  56. package/dist/cli/graph-session-contribution.js.map +1 -1
  57. package/dist/cli/graph-sharded-engine.d.ts.map +1 -1
  58. package/dist/cli/graph-sharded-engine.js +0 -1
  59. package/dist/cli/graph-sharded-engine.js.map +1 -1
  60. package/dist/cli/graph-single-run-mode.d.ts.map +1 -1
  61. package/dist/cli/graph-single-run-mode.js +0 -4
  62. package/dist/cli/graph-single-run-mode.js.map +1 -1
  63. package/dist/cli/graph-worker.d.ts.map +1 -1
  64. package/dist/cli/graph-worker.js +0 -1
  65. package/dist/cli/graph-worker.js.map +1 -1
  66. package/dist/cli/graph.d.ts +2 -22
  67. package/dist/cli/graph.d.ts.map +1 -1
  68. package/dist/cli/graph.js +3 -256
  69. package/dist/cli/graph.js.map +1 -1
  70. package/dist/cli/list-files.d.ts.map +1 -1
  71. package/dist/cli/list-files.js +0 -2
  72. package/dist/cli/list-files.js.map +1 -1
  73. package/dist/cli/orchestrate/cache-orchestrator.d.ts.map +1 -1
  74. package/dist/cli/orchestrate/cache-orchestrator.js +0 -1
  75. package/dist/cli/orchestrate/cache-orchestrator.js.map +1 -1
  76. package/dist/cli/orchestrate/flat-monorepo-strategy.js +1 -1
  77. package/dist/cli/orchestrate/flat-monorepo-strategy.js.map +1 -1
  78. package/dist/cli/orchestrate/sharded-graph.js +0 -4
  79. package/dist/cli/orchestrate/sharded-graph.js.map +1 -1
  80. package/dist/cli/orchestrate.d.ts.map +1 -1
  81. package/dist/cli/orchestrate.js +0 -1
  82. package/dist/cli/orchestrate.js.map +1 -1
  83. package/dist/cli/pressure-monitor.d.ts.map +1 -1
  84. package/dist/cli/pressure-monitor.js +0 -1
  85. package/dist/cli/pressure-monitor.js.map +1 -1
  86. package/dist/cli/workspace-runner.d.ts.map +1 -1
  87. package/dist/cli/workspace-runner.js +0 -1
  88. package/dist/cli/workspace-runner.js.map +1 -1
  89. package/dist/identity.d.ts +5 -0
  90. package/dist/identity.d.ts.map +1 -0
  91. package/dist/identity.js +6 -0
  92. package/dist/identity.js.map +1 -0
  93. package/dist/index.d.ts +4 -2
  94. package/dist/index.d.ts.map +1 -1
  95. package/dist/index.js +9 -3
  96. package/dist/index.js.map +1 -1
  97. package/dist/internal.d.ts +1 -1
  98. package/dist/internal.d.ts.map +1 -1
  99. package/dist/internal.js +4 -6
  100. package/dist/internal.js.map +1 -1
  101. package/dist/lang-adapter/read-source.d.ts +20 -0
  102. package/dist/lang-adapter/read-source.d.ts.map +1 -0
  103. package/dist/lang-adapter/read-source.js +49 -0
  104. package/dist/lang-adapter/read-source.js.map +1 -0
  105. package/dist/lang-adapter/read-source.test.d.ts +2 -0
  106. package/dist/lang-adapter/read-source.test.d.ts.map +1 -0
  107. package/dist/lang-adapter/read-source.test.js +41 -0
  108. package/dist/lang-adapter/read-source.test.js.map +1 -0
  109. package/dist/recipes/resolve.d.ts.map +1 -1
  110. package/dist/recipes/resolve.js +0 -1
  111. package/dist/recipes/resolve.js.map +1 -1
  112. package/dist/rules/define-rule.d.ts.map +1 -1
  113. package/dist/rules/define-rule.js +0 -3
  114. package/dist/rules/define-rule.js.map +1 -1
  115. package/dist/tool.d.ts.map +1 -1
  116. package/dist/tool.js +8 -4
  117. package/dist/tool.js.map +1 -1
  118. package/dist/types.d.ts +1 -1
  119. package/package.json +15 -10
@@ -0,0 +1,231 @@
1
+ import { EXIT_CODES } from '@opensip-cli/contracts';
2
+ import { currentScope, logger } from '@opensip-cli/core';
3
+ import { finalizeGraphSignals } from './apply-suppressions.js';
4
+ import { buildGraphEnvelope } from './build-envelope.js';
5
+ import { runCatalogJsonMode, runGateMode } from './graph-modes.js';
6
+ import { buildUnifiedReportLines, resolutionBannerText } from './graph-report.js';
7
+ import { buildGraphSessionContribution } from './graph-session-contribution.js';
8
+ import { GraphProfileBuilder, writeGraphProfile } from './profile.js';
9
+ const EVT_GRAPH_COMPLETE = 'graph.cli.graph.complete';
10
+ const MODULE_GRAPH_CLI = 'graph:cli';
11
+ const MODULE_GRAPH_RENDER = 'graph:render';
12
+ /** Profile bucket for the run shape: workspace fan-out, multi-path, or single graph. */
13
+ function profileMode(opts) {
14
+ if (opts.workspace === true)
15
+ return 'workspace';
16
+ if ((opts.paths?.length ?? 0) > 1)
17
+ return 'multi-path';
18
+ return 'graph';
19
+ }
20
+ /** Create a profile builder when `--profile-output` is set. */
21
+ export function createProfileBuilder(opts, startedAt) {
22
+ if (typeof opts.profileOutput !== 'string' || opts.profileOutput.length === 0) {
23
+ return undefined;
24
+ }
25
+ return new GraphProfileBuilder({
26
+ cwd: opts.cwd,
27
+ mode: profileMode(opts),
28
+ resolutionMode: opts.resolution,
29
+ startedAt,
30
+ });
31
+ }
32
+ /** Write the timing profile when `--profile-output` was requested. */
33
+ export function writeProfileIfRequested(opts, profile) {
34
+ if (profile === undefined)
35
+ return;
36
+ if (typeof opts.profileOutput !== 'string' || opts.profileOutput.length === 0)
37
+ return;
38
+ const outPath = writeGraphProfile(opts.profileOutput, opts.cwd, profile.complete());
39
+ logger.info({
40
+ evt: 'graph.profile.write.complete',
41
+ module: MODULE_GRAPH_CLI,
42
+ output: outPath,
43
+ });
44
+ }
45
+ /**
46
+ * Assemble the run's {@link SignalEnvelope} from its raw engine signals
47
+ * (ADR-0011). Centralises `runId`/`createdAt` resolution off the live scope so
48
+ * cloud egress correlates with the run id the logger stamps; the envelope is
49
+ * pure (the clock read happens here, once).
50
+ */
51
+ function envelopeFor(opts, result, durationMs) {
52
+ return buildGraphEnvelope({
53
+ signals: result.signals,
54
+ recipe: opts.recipe,
55
+ runId: currentScope()?.runId ?? '',
56
+ createdAt: new Date().toISOString(),
57
+ durationMs,
58
+ resolutionMode: result.catalog?.resolutionMode,
59
+ });
60
+ }
61
+ /**
62
+ * Dispatch a completed graph run to its output mode and return the run outcome
63
+ * for signal delivery and session persistence (undefined for plain `--json`).
64
+ */
65
+ export async function dispatchGraphResult(opts, rawResult, cli, startedAt, suppressionRoot) {
66
+ // ADR-0014: apply the inline graph-ignore waivers BEFORE any mode consumes
67
+ // the signals — the gate baseline, catalog, render, and session persistence
68
+ // all see the post-waiver set. `--workspace` is covered transitively: each
69
+ // child runs `graph --json` through this function, so the parent aggregates
70
+ // already-waived signals.
71
+ //
72
+ // `suppressionRoot` is the build root the signals' `code.file` paths are
73
+ // RELATIVE TO — i.e. the positional subtree / sharded-child / workspace-unit
74
+ // root, NOT necessarily `opts.cwd`. A `graph <subdir>` run (and every
75
+ // `--workspace` child, which runs `graph <unitRoot> --json`) builds against
76
+ // `runCwd = positionalPaths[0]`, so its signal paths and directive files
77
+ // resolve under that root. Resolving against `opts.cwd` instead made every
78
+ // `@graph-ignore` directive file unreadable (ENOENT), silently leaking the
79
+ // waiver — the bug this parameter closes.
80
+ // Route through the SINGLE suppression chokepoint (finalizeGraphSignals) — the
81
+ // same seam the live/worker producers cross via buildLiveGraphOutput. The
82
+ // branded FinalizedSignals it returns is the only signal shape the
83
+ // session-contribution builder (and, transitively, the verdict + render) will
84
+ // accept, so a future fourth output path cannot deliver un-waived signals: the
85
+ // compiler rejects it.
86
+ const finalized = await finalizeGraphSignals(rawResult.signals, suppressionRoot);
87
+ return deliverGraphResult(opts, { ...rawResult, signals: finalized.signals }, cli, startedAt, finalized);
88
+ }
89
+ /**
90
+ * Deliver an already-waived run to its output mode (gate / catalog-json /
91
+ * render) and, on the human-facing render path, BUILD the generic-session
92
+ * contribution the host run plane persists (host-owned-run-timing Phase 3 —
93
+ * graph never writes the row itself). Split out of {@link dispatchGraphResult}
94
+ * so the multi-path path — which must waive each path's signals against ITS
95
+ * OWN root before aggregating (the roots differ) — can aggregate the kept
96
+ * signals and deliver once, without a second (wrong-root) suppression pass.
97
+ *
98
+ * The contribution is built HERE, where the branded {@link FinalizedSignals}
99
+ * is in scope, so the dashboard history can only ever carry post-waiver
100
+ * findings (the branding guard is not lost across the return boundary).
101
+ */
102
+ export async function deliverGraphResult(opts, result, cli, startedAt, finalized) {
103
+ const suppressedCount = finalized.suppressedCount;
104
+ const durationMs = Math.max(0, Date.now() - Date.parse(startedAt));
105
+ if (opts.gateSave === true || opts.gateCompare === true) {
106
+ // ADR-0036: the envelope arrives fingerprint-stamped — `buildGraphEnvelope`
107
+ // passes graph's byte-preserved strategy into `buildSignalEnvelope`, which
108
+ // stamps at construction (over the canonical remapped ruleIds, exactly what
109
+ // the former post-hoc gate-path stamp produced). The host seams only read
110
+ // `signal.fingerprint`. runGateMode owns the deliverSignals call
111
+ // (host-derived exit), so the command-spec skips it.
112
+ const envelope = envelopeFor(opts, result, durationMs);
113
+ await runGateMode(opts, envelope, cli, result.catalog?.resolutionMode);
114
+ logger.info({
115
+ evt: EVT_GRAPH_COMPLETE,
116
+ module: MODULE_GRAPH_CLI,
117
+ suppressed: suppressedCount,
118
+ });
119
+ return { envelope };
120
+ }
121
+ if (typeof opts.catalogOutput === 'string' && opts.catalogOutput.length > 0) {
122
+ runCatalogJsonMode(opts, result, cli, startedAt);
123
+ logger.info({
124
+ evt: EVT_GRAPH_COMPLETE,
125
+ module: MODULE_GRAPH_CLI,
126
+ suppressed: suppressedCount,
127
+ });
128
+ return { envelope: envelopeFor(opts, result, durationMs) };
129
+ }
130
+ const envelope = await renderGraphResult(opts, result, startedAt, cli);
131
+ // Session persistence is dashboard history — populated on human-facing runs
132
+ // only. Skipped for:
133
+ // - `--json` (the machine-artifact mode AND the carrier each
134
+ // `executeWorkspaceGraph` child runs under — keeps "one human invocation
135
+ // = one session"; the --workspace parent persists the single aggregate);
136
+ // - `--report-to` (an export mode; like gate/catalog it opts out of session
137
+ // history — the root delivers the envelope to the receiver instead).
138
+ // The host persists the returned `session` after the handler resolves; graph
139
+ // builds it here from the BRANDED FinalizedSignals so the contribution can
140
+ // only ever carry post-waiver findings regardless of which path reached here.
141
+ const isReportTo = typeof opts.reportTo === 'string' && opts.reportTo.length > 0;
142
+ const session = opts.json !== true && !isReportTo ? buildGraphSessionContribution(opts, finalized) : undefined;
143
+ cli.setExitCode(EXIT_CODES.SUCCESS);
144
+ logger.info({
145
+ evt: EVT_GRAPH_COMPLETE,
146
+ module: MODULE_GRAPH_CLI,
147
+ signals: result.signals.length,
148
+ suppressed: suppressedCount,
149
+ });
150
+ // Plain `--json` is the workspace-child carrier: it returns `undefined` so
151
+ // the root does not cloud-emit per child (the parent owns the dashboard
152
+ // aggregate, not per-unit signal batches — audit P1-2). Every other mode
153
+ // (default render, `--report-to`) returns the outcome for root delivery; only
154
+ // the non-export render path carries a `session`.
155
+ return opts.json === true ? undefined : { envelope, ...(session ? { session } : {}) };
156
+ }
157
+ /**
158
+ * Render the run and return its {@link SignalEnvelope} (ADR-0011).
159
+ *
160
+ * `--json` emits the envelope through the shared `formatSignalJson`
161
+ * (`cli.emitEnvelope`). The default/`--verbose` path hands a {@link RunPresentation}
162
+ * to the render seam (Ink on TTY, plain text in pipes/CI): the SAME `envelope`
163
+ * already built here IS carried on the render object (envelope-first-presentation
164
+ * plan, RP-2), so `presentationToView` derives the PASS/FAIL summary and verdict
165
+ * from it — graph no longer carries a count-based `graph-done` summary. The
166
+ * verbose catalog/findings/entry-point body rides as `verboseDetail`
167
+ * ({kind:'lines'}, ADR-0021), and that verbose/detail surface also carries the
168
+ * per-unit table; graph's fast-tier caveat moves to `RunPresentation.banners` (a
169
+ * muted line above the summary); the non-verbose footer hints are emitted by the
170
+ * shared seam. The host-stamped
171
+ * `durationMs` (ADR-0051) is threaded as `RunPresentation.durationMs` so the
172
+ * summary shows the real wall-clock — graph's envelope units carry `durationMs: 0`,
173
+ * so without this thread `presentationToView`'s unit-sum default would render
174
+ * `0ms`. The envelope is also RETURNED for the composition root's cloud +
175
+ * `--report-to` delivery (egress, a separate plane — untouched here).
176
+ */
177
+ async function renderGraphResult(opts, result, startedAt, cli) {
178
+ const durationMs = Math.max(0, Date.now() - Date.parse(startedAt));
179
+ const envelope = envelopeFor(opts, result, durationMs);
180
+ if (opts.json === true) {
181
+ logger.info({
182
+ evt: 'graph.render.json.start',
183
+ module: MODULE_GRAPH_RENDER,
184
+ });
185
+ cli.emitEnvelope(envelope);
186
+ logger.info({
187
+ evt: 'graph.render.json.complete',
188
+ module: MODULE_GRAPH_RENDER,
189
+ });
190
+ return envelope;
191
+ }
192
+ logger.info({ evt: 'graph.render.presentation.start', module: MODULE_GRAPH_RENDER });
193
+ const verbose = opts.verbose === true;
194
+ // ADR-0021: graph's verbose body is carried as VerboseDetail{kind:'lines'} and
195
+ // rendered through the shared resultToView seam — the same path the live runner
196
+ // uses — instead of a graph-only `reportLines`/`footerHints` shape. The
197
+ // non-verbose footer hints are emitted by the seam (envelope-first-presentation
198
+ // RP-2 → `presentationToView`).
199
+ const verboseDetail = verbose
200
+ ? {
201
+ kind: 'lines',
202
+ lines: buildUnifiedReportLines({
203
+ catalog: result.catalog,
204
+ indexes: result.indexes,
205
+ signals: result.signals,
206
+ cacheHit: result.cacheHit,
207
+ }, { includeSummary: false }),
208
+ }
209
+ : undefined;
210
+ const resolutionBanner = resolutionBannerText(result.catalog?.resolutionMode);
211
+ // envelope-first-presentation RP-2: route graph's static render through the
212
+ // shared RunPresentation. The envelope IS carried (it drives the verdict and
213
+ // optional verbose/detail table); `durationMs` is threaded so the host-owned
214
+ // wall-clock wins over the unit-sum (graph units carry durationMs:0); the
215
+ // resolution caveat moves to `banners`.
216
+ const presentation = {
217
+ type: 'run-presentation',
218
+ tool: 'graph',
219
+ envelope,
220
+ ...(verboseDetail === undefined ? {} : { verboseDetail }),
221
+ ...(resolutionBanner === undefined ? {} : { banners: [resolutionBanner] }),
222
+ durationMs,
223
+ };
224
+ await cli.render(presentation);
225
+ logger.info({
226
+ evt: 'graph.render.presentation.complete',
227
+ module: MODULE_GRAPH_RENDER,
228
+ });
229
+ return envelope;
230
+ }
231
+ //# sourceMappingURL=graph-result-delivery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-result-delivery.js","sourceRoot":"","sources":["../../src/cli/graph-result-delivery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,EAAE,oBAAoB,EAAyB,MAAM,yBAAyB,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAClF,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAQtE,MAAM,k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AAa,EAAE,CAAC;QACzD,GAAG,CAAC,gBAAgB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,gBAAgB,CAAC,EAAE,CAAC;QAC1E,UAAU;KACX,CAAC;IACF,MAAM,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAC/B,MAAM,CAAC,IAAI,CAAC;QACV,GAAG,EAAE,oCAAoC;QACzC,MAAM,EAAE,mBAAmB;KAC5B,CAAC,CAAC;IACH,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -1,105 +1,24 @@
1
1
  /**
2
- * graph-runner — owns the live-view state machine for `opensip graph`.
3
- *
4
- * Layer 5 Phase 3 lifted the graph live view out of `opensip-cli`.
5
- * The state machine (loading → running → done | error), `runGraph`
6
- * orchestration, `buildUnifiedReportLines` post-call, and the Ink/React
7
- * render tree live here, in the package that owns the graph command
8
- * surface. Adding a fourth tool with a live view requires zero CLI
9
- * edits — each tool ships its own renderer and registers it via
10
- * `cli.registerLiveView(key, renderer)`.
11
- *
12
- * Progress rendering is the shared `<LiveProgress>` from
13
- * `@opensip-cli/cli-ui` (ADR-0016), driven in `phases` mode: graph's
14
- * 7 fixed pipeline stages map onto the universal `ProgressEvent` stream.
15
- * The former graph-local StageChecklist/StageLine/RunningStageLine are
16
- * gone. The build runs OFF the main process (ADR-0028): the runner forks
17
- * the CLI to `graph-run-worker` via `runOffThreadOrInProcess`, which
18
- * re-bootstraps the scope, runs the selected graph engine (exact or sharded),
19
- * and streams stage progress + the slim {@link LiveGraphOutput} back over IPC
20
- * — so this process stays free to animate the spinner + 80ms clock instead of
21
- * freezing under type-checking, shard coordination, merge/link, or rule work.
22
- * It falls back to the in-process closure when forking is disabled
23
- * (`OPENSIP_CLI_NO_WORKER`) or the fork fails; both paths reduce to the same
24
- * `{ signals, reportLines }` payload.
25
- *
26
- * Single exit-code write path: error outcomes route through the
27
- * supplied `setExitCode` callback (`ToolCliContext.setExitCode`) so the
28
- * CLI keeps its only `process.exitCode` mutator.
2
+ * graph-runner — live-view entry for `opensip graph` via @opensip-cli/cli-live.
29
3
  */
30
4
  import { type LiveViewContext, type ToolRunCompletion } from '@opensip-cli/core';
31
5
  import type { Shard } from './orchestrate/shard-model.js';
32
6
  import type { GraphConfig, ResolutionMode, Rule } from '../types.js';
33
7
  import type { DataStore } from '@opensip-cli/datastore';
34
- interface GraphRunnerArgs {
8
+ export interface GraphRunnerArgs {
35
9
  readonly cwd: string;
36
10
  readonly noCache?: boolean;
37
- /**
38
- * `--resolution`: edge resolution tier. Forwarded to `runGraph` so the
39
- * interactive default path (`graph --resolution fast` with no other
40
- * flags) actually runs the chosen tier instead of silently using exact.
41
- */
42
11
  readonly resolution?: ResolutionMode;
43
- /**
44
- * `--verbose`: when true, show the detailed catalog / findings-by-rule
45
- * / entry-points blocks in the done view. Default (false) shows the
46
- * summary line + footer hint only, matching fit's default surface.
47
- */
48
12
  readonly verbose?: boolean;
49
- /** `--quiet`: suppress the banner / project header / run header chrome, leaving
50
- * only the live progress, summary, and (when not verbose) footer hints —
51
- * parity with fit/sim. */
52
13
  readonly quiet?: boolean;
53
- /**
54
- * The project's `graph:` config block (rule knobs like
55
- * `minCrossPackageDuplicatePackages`, `minDuplicateBodyLines`,
56
- * `entryPointHashes`). Forwarded to `runGraph` so the interactive
57
- * default path honors the SAME config as the `executeGraph` dispatch
58
- * path.
59
- */
60
14
  readonly config?: GraphConfig;
61
- /**
62
- * `--recipe`: the resolved rule subset for this run. Resolved on the
63
- * dispatch seam (`tool.ts`, inside the entered RunScope) and forwarded
64
- * to `runGraph` so the interactive path honors `--recipe` for parity
65
- * with `executeGraph`. Absent ⇒ `runGraph` falls back to `currentRules()`.
66
- */
67
15
  readonly rules?: readonly Rule[];
68
- /**
69
- * `--recipe` NAME (serializable), forwarded to the off-process worker so it can
70
- * re-resolve the rule set itself (rules are functions — they can't cross the
71
- * fork boundary). The in-process fallback uses {@link GraphRunnerArgs.rules}.
72
- */
73
16
  readonly recipe?: string;
74
- /**
75
- * `--exact`: whether the user opted out of the default sharded engine. Threaded
76
- * through so the live view drives the SAME engine the static path's policy
77
- * selects (ADR-0032). `isTTY` NEVER affects the engine — only `exact` +
78
- * shardability do.
79
- */
80
17
  readonly exact?: boolean;
81
- /**
82
- * The pre-resolved shard set (ADR-0032), computed on the dispatch seam
83
- * (`dispatchGraphLiveView`, which holds the `cli` context the engine policy
84
- * needs). `length > 1` ⇒ the SHARDED engine. The normal path serializes this
85
- * plain-data plan into the worker spec so the render process never coordinates
86
- * the sharded build.
87
- */
88
18
  readonly shards?: readonly Shard[];
89
19
  }
90
20
  export interface RenderGraphLiveOptions {
91
21
  readonly setExitCode?: (code: number) => void;
92
22
  }
93
- /**
94
- * Render the live `graph` view. Resolves once the underlying Ink app exits with
95
- * a {@link ToolRunCompletion} carrying the run's `session` contribution (the
96
- * HOST persists it after this resolves — host-owned-run-timing Phase 2; the
97
- * component no longer writes the session itself). Graph's cloud egress lives on
98
- * the static gate path, so the live wrapper returns no envelope.
99
- *
100
- * `setExitCode` is the single mutator path on `process.exitCode`; the runner
101
- * calls it for error outcomes so the CLI's exit-code seam stays the only writer.
102
- */
103
23
  export declare function renderGraphLive(args: GraphRunnerArgs, datastore?: DataStore, options?: RenderGraphLiveOptions, liveContext?: LiveViewContext): Promise<ToolRunCompletion>;
104
- export {};
105
24
  //# sourceMappingURL=graph-runner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"graph-runner.d.ts","sourceRoot":"","sources":["../../src/cli/graph-runner.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AA6BH,OAAO,EAIL,KAAK,eAAe,EACpB,KAAK,iBAAiB,EAEvB,MAAM,mBAAmB,CAAC;AAkB3B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAE1D,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,IAAI,EAAE,MAA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