@opensip-cli/graph 0.1.4 → 0.1.5

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 (37) hide show
  1. package/README.md +2 -2
  2. package/dist/__tests__/cli/graph-config.test.js +5 -3
  3. package/dist/__tests__/cli/graph-config.test.js.map +1 -1
  4. package/dist/__tests__/tool-branches.test.js +4 -1
  5. package/dist/__tests__/tool-branches.test.js.map +1 -1
  6. package/dist/cli/graph-config.d.ts.map +1 -1
  7. package/dist/cli/graph-config.js +20 -1
  8. package/dist/cli/graph-config.js.map +1 -1
  9. package/dist/cli/graph-feature-columns.d.ts +7 -0
  10. package/dist/cli/graph-feature-columns.d.ts.map +1 -0
  11. package/dist/cli/graph-feature-columns.js +10 -0
  12. package/dist/cli/graph-feature-columns.js.map +1 -0
  13. package/dist/cli/graph-multi-path-mode.d.ts +24 -0
  14. package/dist/cli/graph-multi-path-mode.d.ts.map +1 -0
  15. package/dist/cli/graph-multi-path-mode.js +64 -0
  16. package/dist/cli/graph-multi-path-mode.js.map +1 -0
  17. package/dist/cli/graph-run-outcome.d.ts +12 -0
  18. package/dist/cli/graph-run-outcome.d.ts.map +1 -0
  19. package/dist/cli/graph-run-outcome.js +2 -0
  20. package/dist/cli/graph-run-outcome.js.map +1 -0
  21. package/dist/cli/graph-session-contribution.d.ts +29 -0
  22. package/dist/cli/graph-session-contribution.d.ts.map +1 -0
  23. package/dist/cli/graph-session-contribution.js +58 -0
  24. package/dist/cli/graph-session-contribution.js.map +1 -0
  25. package/dist/cli/graph-sharded-engine.d.ts +77 -0
  26. package/dist/cli/graph-sharded-engine.d.ts.map +1 -0
  27. package/dist/cli/graph-sharded-engine.js +229 -0
  28. package/dist/cli/graph-sharded-engine.js.map +1 -0
  29. package/dist/cli/graph-workspace-mode.d.ts +11 -0
  30. package/dist/cli/graph-workspace-mode.d.ts.map +1 -0
  31. package/dist/cli/graph-workspace-mode.js +87 -0
  32. package/dist/cli/graph-workspace-mode.js.map +1 -0
  33. package/dist/cli/graph.d.ts +5 -129
  34. package/dist/cli/graph.d.ts.map +1 -1
  35. package/dist/cli/graph.js +13 -552
  36. package/dist/cli/graph.js.map +1 -1
  37. package/package.json +8 -8
@@ -0,0 +1,229 @@
1
+ import { realpathSync } from 'node:fs';
2
+ import { resolve } from 'node:path';
3
+ import { pickAdapter } from '../lang-adapter/registry.js';
4
+ import { CatalogRepo } from '../persistence/catalog-repo.js';
5
+ import { currentRules } from '../rules/registry.js';
6
+ import { DASHBOARD_FEATURE_COLUMNS } from './graph-feature-columns.js';
7
+ import { buildLiveGraphOutput } from './graph-report.js';
8
+ import { resolveCanonicalFileSet } from './orchestrate/canonical-file-set.js';
9
+ import { detectMonorepoLayout, partitionFlatRepo, selectStrategyForLayout, } from './orchestrate/flat-monorepo-strategy.js';
10
+ import { partitionFilesIntoShards } from './orchestrate/partition-files.js';
11
+ import { loadGraphConfig, runShardedGraph } from './orchestrate.js';
12
+ import { resolveAdaptersForRun } from './resolve-adapters.js';
13
+ import { discoverPolyglotUnits } from './workspace-runner.js';
14
+ /**
15
+ * Resolve a path to absolute (a relative input resolves against `base`, not
16
+ * necessarily `process.cwd()`), then realpath it so exact and sharded engines see
17
+ * one canonical run root. Falls back to the absolute path when realpath fails.
18
+ */
19
+ export function realpathOrSelf(input, base) {
20
+ const absolute = resolve(base, input);
21
+ try {
22
+ return realpathSync(absolute);
23
+ }
24
+ catch {
25
+ /* v8 ignore next */
26
+ return absolute;
27
+ }
28
+ }
29
+ /**
30
+ * Engine-selection policy (ADR-0033, superseding ADR-0032/0031). The sharded
31
+ * engine is the default when the project can actually shard; exact is selected
32
+ * for `--exact`, positional runs, or non-shardable projects.
33
+ */
34
+ export async function resolveEngineShards(opts, cli, positionalPaths) {
35
+ if (opts.exact === true)
36
+ return { shards: [] };
37
+ if (positionalPaths.length > 0)
38
+ return { shards: [] };
39
+ return resolveShards(opts, cli);
40
+ }
41
+ /** Human-readable explanation for the graph engine observability event. */
42
+ export function engineSelectionReason(opts, positionalPaths, sharded) {
43
+ if (sharded)
44
+ return 'sharded-default';
45
+ if (opts.exact === true)
46
+ return 'exact-opt-out';
47
+ if (positionalPaths.length > 0)
48
+ return 'exact-positional-paths';
49
+ return 'exact-not-shardable';
50
+ }
51
+ async function resolveShards(opts, cli) {
52
+ const cliScript = opts.cliScript ?? process.argv[1];
53
+ if (typeof cliScript !== 'string' || cliScript.length === 0)
54
+ return { shards: [] };
55
+ let units;
56
+ try {
57
+ units = await discoverPolyglotUnits(opts.cwd, resolveAdaptersForRun(opts, cli));
58
+ }
59
+ catch {
60
+ /* v8 ignore next */
61
+ return resolveSyntheticFlatShards(opts);
62
+ }
63
+ if (units.length <= 1)
64
+ return resolveSyntheticFlatShards(opts);
65
+ const adapter = pickAdapter(opts.cwd);
66
+ let rootDiscovery;
67
+ try {
68
+ rootDiscovery = adapter.discoverFiles({ cwd: opts.cwd });
69
+ }
70
+ catch {
71
+ /* v8 ignore next */
72
+ return resolveSyntheticFlatShards(opts);
73
+ }
74
+ const canonicalFiles = resolveCanonicalFileSet(rootDiscovery.files);
75
+ const shards = partitionFilesIntoShards({
76
+ canonicalFiles,
77
+ units: units.map((u) => ({
78
+ id: u.id,
79
+ rootDir: u.rootDir,
80
+ ...(u.configPath === undefined ? {} : { configPathAbs: u.configPath }),
81
+ })),
82
+ projectRoot: rootDiscovery.projectDirAbs,
83
+ rootConfigPathAbs: rootDiscovery.configPathAbs,
84
+ });
85
+ if (shards.length > 1)
86
+ return { shards };
87
+ return resolveSyntheticFlatShards(opts);
88
+ }
89
+ /**
90
+ * Resolve a project's shard set the same way a production `graph` run does,
91
+ * exposed for the real-repo equivalence guardrail.
92
+ */
93
+ export async function resolveShardsForCwd(cwd, cliScript, cli) {
94
+ const resolution = await resolveShards({ cwd, cliScript, noCache: true }, cli);
95
+ return resolution.shards;
96
+ }
97
+ function resolveSyntheticFlatShards(opts) {
98
+ if (typeof opts.language === 'string' && opts.language.length > 0)
99
+ return { shards: [] };
100
+ const adapter = pickAdapter(opts.cwd);
101
+ if (adapter.id !== 'typescript')
102
+ return { shards: [] };
103
+ let discovery;
104
+ try {
105
+ discovery = adapter.discoverFiles({ cwd: opts.cwd });
106
+ }
107
+ catch {
108
+ return { shards: [] };
109
+ }
110
+ const canonicalFiles = resolveCanonicalFileSet(discovery.files);
111
+ const partitionStart = Date.now();
112
+ const layout = detectMonorepoLayout({
113
+ repoRoot: discovery.projectDirAbs,
114
+ files: canonicalFiles,
115
+ });
116
+ const selection = selectStrategyForLayout(layout);
117
+ if (layout.kind !== 'flat-large' || selection.mode !== 'synthetic-partition') {
118
+ return { shards: [] };
119
+ }
120
+ const graphConfig = loadGraphConfig(opts.cwd);
121
+ const strategy = graphConfig.partitionStrategy ?? selection.partitionStrategy ?? 'hybrid';
122
+ const partitions = partitionFlatRepo({
123
+ files: layout.files,
124
+ repoRoot: discovery.projectDirAbs,
125
+ strategy,
126
+ });
127
+ const shards = partitions
128
+ .filter((p) => p.files.length > 0)
129
+ .map((p) => ({
130
+ id: `partition:${p.id}`,
131
+ rootDir: discovery.projectDirAbs,
132
+ files: p.files,
133
+ configPathAbs: discovery.configPathAbs,
134
+ }));
135
+ if (shards.length <= 1)
136
+ return { shards: [] };
137
+ return {
138
+ shards,
139
+ partition: {
140
+ durationMs: Date.now() - partitionStart,
141
+ detail: `${strategy}: ${String(shards.length)} partition(s)`,
142
+ },
143
+ };
144
+ }
145
+ async function runShardedBuild(ctx) {
146
+ const { opts, shards, projectRoot, cli, config, rules } = ctx;
147
+ const datastore = cli.scope.datastore();
148
+ const sharded = await runShardedGraph({
149
+ shards,
150
+ projectRoot,
151
+ cliScript: opts.cliScript ?? process.argv[1] ?? '',
152
+ adapter: pickAdapter(projectRoot, opts.language),
153
+ resolutionMode: opts.resolution ?? 'exact',
154
+ concurrency: opts.concurrency,
155
+ useCache: opts.noCache !== true,
156
+ config,
157
+ rules,
158
+ catalogRepo: datastore ? new CatalogRepo(datastore) : null,
159
+ emitFeatures: DASHBOARD_FEATURE_COLUMNS,
160
+ ...(ctx.onProgress === undefined ? {} : { onProgress: ctx.onProgress }),
161
+ ...(opts.language === undefined ? {} : { language: opts.language }),
162
+ });
163
+ return {
164
+ catalog: sharded.catalog,
165
+ indexes: sharded.indexes,
166
+ signals: sharded.signals,
167
+ resolutionStats: sharded.resolutionStats,
168
+ cacheHit: sharded.cacheHit,
169
+ features: sharded.features,
170
+ shardStats: sharded.shardStats,
171
+ };
172
+ }
173
+ /**
174
+ * Run a sharded build and record its wall-clock stage in the optional graph
175
+ * profile. The build result is unchanged; this helper only centralizes timing
176
+ * so the main command handler does not own sharded profiling mechanics.
177
+ */
178
+ export async function runProfiledShardedBuild(profileRun, ctx) {
179
+ const started = Date.now();
180
+ const result = await runShardedBuild(ctx);
181
+ if (profileRun !== undefined) {
182
+ // @fitness-ignore-next-line detached-promises -- GraphProfileRunRecorder.recordStage is synchronous timing bookkeeping, not a promise-returning call.
183
+ profileRun.recordStage('sharded-build', Date.now() - started, `${String(ctx.shards.length)} shard(s)`);
184
+ }
185
+ return result;
186
+ }
187
+ /**
188
+ * Resolve the live runner's build engine with the same shardability policy the
189
+ * static `graph` command uses. The live UI consumes the returned shard list to
190
+ * choose exact vs. sharded worker execution.
191
+ */
192
+ export async function resolveLiveEngineShards(args, cli) {
193
+ const opts = {
194
+ cwd: args.cwd,
195
+ noCache: args.noCache,
196
+ resolution: args.resolution,
197
+ exact: args.exact,
198
+ ...(args.cliScript === undefined ? {} : { cliScript: args.cliScript }),
199
+ };
200
+ const resolution = await resolveEngineShards(opts, cli, []);
201
+ return resolution.shards;
202
+ }
203
+ /**
204
+ * Execute a sharded graph build for the interactive/live runner and reduce the
205
+ * result to the serializable `LiveGraphOutput` shape consumed by Ink and worker
206
+ * transports.
207
+ */
208
+ export async function runShardedLiveBuild(args, shards, datastore, onProgress) {
209
+ const result = await runShardedGraph({
210
+ shards,
211
+ projectRoot: args.cwd,
212
+ cliScript: args.cliScript ?? process.argv[1] ?? '',
213
+ adapter: pickAdapter(args.cwd),
214
+ resolutionMode: args.resolution ?? 'exact',
215
+ useCache: args.noCache !== true,
216
+ config: args.config ?? {},
217
+ rules: args.rules ?? currentRules(),
218
+ catalogRepo: datastore ? new CatalogRepo(datastore) : null,
219
+ emitFeatures: DASHBOARD_FEATURE_COLUMNS,
220
+ onProgress,
221
+ });
222
+ return buildLiveGraphOutput({
223
+ catalog: result.catalog,
224
+ indexes: result.indexes,
225
+ signals: result.signals,
226
+ cacheHit: result.cacheHit,
227
+ }, args.cwd);
228
+ }
229
+ //# sourceMappingURL=graph-sharded-engine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-sharded-engine.js","sourceRoot":"","sources":["../../src/cli/graph-sharded-engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAwB,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAU9D;;;;GAIG;AACH,MAAM,UAA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Q,EAAE,IAAI,CAAC,OAAO,KAAK,IAAI;QAC/B,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,EAAE;QACzB,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,YAAY,EAAE;QACnC,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC,IAAI,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI;QAC1D,YAAY,EAAE,yBAAyB;QACvC,UAAU;KACX,CAAC,CAAC;IACH,OAAO,oBAAoB,CACzB;QACE,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,QAAQ,EAAE,MAAM,CAAC,QAAQ;KAC1B,EACD,IAAI,CAAC,GAAG,CACT,CAAC;AACJ,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { type ToolCliContext } from '@opensip-cli/core';
2
+ import { type GraphProfileBuilder } from './profile.js';
3
+ import type { GraphCommandOptions } from './graph-options.js';
4
+ import type { GraphRunOutcome } from './graph-run-outcome.js';
5
+ /**
6
+ * `graph --workspace` fan-out. The parent aggregates per-unit child runs for
7
+ * reporting and a single dashboard session, but intentionally does not emit a
8
+ * cloud signal envelope for the aggregate.
9
+ */
10
+ export declare function executeWorkspaceGraph(opts: GraphCommandOptions, cli: ToolCliContext, profile?: GraphProfileBuilder): Promise<GraphRunOutcome | undefined>;
11
+ //# sourceMappingURL=graph-workspace-mode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-workspace-mode.d.ts","sourceRoot":"","sources":["../../src/cli/graph-workspace-mode.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,cAAc,EAEpB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,KAAK,mBAAmB,EAGzB,MAAM,cAAc,CAAC;AAKtB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAwB9D;;;;GAIG;AACH,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,mBAAmB,EACzB,GAAG,EAAE,cAAc,EACnB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC,CAsEtC"}
@@ -0,0 +1,87 @@
1
+ import { EXIT_CODES } from '@opensip-cli/contracts';
2
+ import { ConfigurationError, logger, } from '@opensip-cli/core';
3
+ import { buildWorkspaceSessionContribution } from './graph-session-contribution.js';
4
+ import { resolveAdaptersForRun } from './resolve-adapters.js';
5
+ import { buildWorkspaceJsonDocument, writeWorkspaceReport } from './workspace-report.js';
6
+ import { discoverPolyglotUnits, runWorkspaceUnitsInParallel } from './workspace-runner.js';
7
+ const EVT_GRAPH_COMPLETE = 'graph.cli.graph.complete';
8
+ const MODULE_GRAPH_CLI = 'graph:cli';
9
+ function setProfileStageRecorded(profileRun, durationMs, unitCount) {
10
+ if (profileRun !== undefined) {
11
+ profileRun.recordStage('workspace-fanout', durationMs, `${String(unitCount)} unit(s)`);
12
+ }
13
+ }
14
+ function setProfileSummaryFinished(profileRun, summary) {
15
+ if (profileRun !== undefined) {
16
+ profileRun.finishSummary(summary);
17
+ }
18
+ }
19
+ /**
20
+ * `graph --workspace` fan-out. The parent aggregates per-unit child runs for
21
+ * reporting and a single dashboard session, but intentionally does not emit a
22
+ * cloud signal envelope for the aggregate.
23
+ */
24
+ export async function executeWorkspaceGraph(opts, cli, profile) {
25
+ const cliScript = opts.cliScript ?? process.argv[1];
26
+ if (typeof cliScript !== 'string' || cliScript.length === 0) {
27
+ throw new ConfigurationError('--workspace: could not determine the CLI entry script (process.argv[1] is empty).');
28
+ }
29
+ const adapters = resolveAdaptersForRun(opts, cli);
30
+ const units = await discoverPolyglotUnits(opts.cwd, adapters);
31
+ if (units.length === 0) {
32
+ const adapterLabel = adapters.map((a) => a.id).join(', ') || '(no language adapters available)';
33
+ throw new ConfigurationError(`--workspace: no workspace units detected for [${adapterLabel}]. Use 'opensip graph' for whole-project analysis.`);
34
+ }
35
+ const profileRun = profile?.startRun({
36
+ label: 'workspace',
37
+ cwd: opts.cwd,
38
+ mode: 'workspace',
39
+ });
40
+ // Internal per-run timer for the workspace report artifact. The generic
41
+ // session row's timing remains host-owned.
42
+ const startedAt = Date.now();
43
+ const result = await runWorkspaceUnitsInParallel({
44
+ cwd: opts.cwd,
45
+ units,
46
+ cliScript,
47
+ concurrency: opts.concurrency,
48
+ noCache: opts.noCache,
49
+ resolution: opts.resolution,
50
+ recipe: opts.recipe,
51
+ ...(opts.language === undefined ? {} : { language: opts.language }),
52
+ });
53
+ const durationMs = Date.now() - startedAt;
54
+ setProfileStageRecorded(profileRun, durationMs, units.length);
55
+ const allSignals = [];
56
+ for (const r of result.perUnit)
57
+ allSignals.push(...r.signals);
58
+ setProfileSummaryFinished(profileRun, {
59
+ cacheHit: false,
60
+ signals: allSignals.length,
61
+ });
62
+ let session;
63
+ if (opts.json === true) {
64
+ cli.emitJson(buildWorkspaceJsonDocument(result.perUnit, durationMs));
65
+ }
66
+ else {
67
+ await writeWorkspaceReport(result.perUnit, durationMs, cli);
68
+ session = buildWorkspaceSessionContribution(opts, allSignals);
69
+ }
70
+ if (result.anyChildFailed) {
71
+ cli.setExitCode(EXIT_CODES.RUNTIME_ERROR);
72
+ process.stderr.write(`graph --workspace: at least one unit run failed; see per-unit output above.\n`);
73
+ }
74
+ else {
75
+ cli.setExitCode(EXIT_CODES.SUCCESS);
76
+ }
77
+ logger.info({
78
+ evt: EVT_GRAPH_COMPLETE,
79
+ module: MODULE_GRAPH_CLI,
80
+ units: result.perUnit.length,
81
+ findings: allSignals.length,
82
+ failed: result.anyChildFailed,
83
+ durationMs,
84
+ });
85
+ return session === undefined ? undefined : { session };
86
+ }
87
+ //# sourceMappingURL=graph-workspace-mode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-workspace-mode.js","sourceRoot":"","sources":["../../src/cli/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or of the polyglot surface
19
19
  * above; see docs/plans/graph-cli-language-neutral-scoping/.
20
20
  */
21
- import { type LiveGraphOutput } from './graph-report.js';
22
21
  import { runGraph } from './orchestrate.js';
23
22
  import type { GraphCommandOptions } from './graph-options.js';
24
- import type { Shard } from './orchestrate/shard-model.js';
25
- import type { GraphProgressCallback } from './orchestrate.js';
26
- import type { GraphConfig, ResolutionMode, Rule } from '../types.js';
27
- import type { SignalEnvelope } from '@opensip-cli/contracts';
28
- import type { Signal, ToolCliContext, ToolSessionContribution } from '@opensip-cli/core';
29
- import type { DataStore } from '@opensip-cli/datastore';
23
+ import type { GraphRunOutcome } from './graph-run-outcome.js';
24
+ import type { ToolCliContext } from '@opensip-cli/core';
30
25
  export type { GraphCommandOptions } from './graph-options.js';
31
26
  export type { UnifiedReportInput, LiveGraphOutput } from './graph-report.js';
32
- /**
33
- * The result of a static graph run that the command handler returns to the
34
- * host (host-owned-run-timing Phase 3). Carries the run's deliverable
35
- * {@link SignalEnvelope} (for cloud + `--report-to` egress) plus the OPTIONAL
36
- * generic-session contribution the host run plane persists after the handler
37
- * resolves. `session` is present only on the human-facing render path (and the
38
- * `--workspace` aggregate); the export/carrier modes (`--json`, `--report-to`,
39
- * gate) return `{ envelope }` with no session — preserving "one human
40
- * invocation = one session".
41
- *
42
- * Graph never writes the generic `StoredSession` row itself: it builds the
43
- * contribution from BRANDED {@link FinalizedSignals} and hands it up; the host
44
- * stamps `startedAt`/`completedAt`/`durationMs`/`id` and performs the save.
45
- *
46
- * `envelope` is optional because the `--workspace` aggregate carries a
47
- * `session` (the one aggregate row the host persists) but NO deliverable
48
- * envelope — the parent aggregates per-unit findings for the dashboard, not
49
- * signals for the cloud (audit P1-2). The command handler's egress is guarded
50
- * on `outcome?.envelope`, so a session-only outcome cloud-emits nothing.
51
- */
52
- export interface GraphRunOutcome {
53
- readonly envelope?: SignalEnvelope;
54
- readonly session?: ToolSessionContribution;
55
- }
56
27
  /**
57
28
  * Run graph and return the run's {@link GraphRunOutcome} — the deliverable
58
29
  * {@link SignalEnvelope} (so the composition root can cloud + `--report-to`
@@ -68,105 +39,10 @@ export interface GraphRunOutcome {
68
39
  * comes back.
69
40
  */
70
41
  export declare function executeGraph(opts: GraphCommandOptions, cli: ToolCliContext): Promise<GraphRunOutcome | undefined>;
71
- /**
72
- * Resolve a project's shard set the SAME way a production `graph` run does
73
- * (workspace units → canonical-file partition, else synthetic flat shards),
74
- * exposed for the real-repo equivalence guardrail (`graph-equivalence-check`).
75
- * Returns `[]` when the project isn't shardable (≤1 shard / no worker script) —
76
- * the guardrail rejects that, since the comparison is only meaningful on a
77
- * shardable multi-package repo. Reuses the private {@link resolveShards} so
78
- * there is ONE shard-resolution model, never a drifting copy.
79
- */
80
- export declare function resolveShardsForCwd(cwd: string, cliScript: string, cli: ToolCliContext): Promise<readonly Shard[]>;
81
- /**
82
- * The serializable live-build request the interactive runner (`graph-runner.tsx`)
83
- * hands the engine. Mirrors the subset of {@link GraphCommandOptions} the
84
- * whole-project live view exercises: cwd scope, cache/resolution tier, the
85
- * resolved rule subset + config, and `exact` (which, with the project's
86
- * shardability, selects the engine — ADR-0032). `cliScript` is needed to spawn
87
- * the shard subprocesses when the sharded path runs in the worker or degraded
88
- * in-process fallback.
89
- */
90
- export interface GraphLiveBuildArgs {
91
- readonly cwd: string;
92
- readonly noCache?: boolean;
93
- readonly resolution?: ResolutionMode;
94
- readonly exact?: boolean;
95
- readonly config?: GraphConfig;
96
- readonly rules?: readonly Rule[];
97
- readonly cliScript?: string;
98
- }
99
- /**
100
- * Resolve the build engine for the interactive live path — the SAME policy
101
- * `executeGraph` uses (ADR-0032): the SHARDED engine when `--exact` is absent
102
- * and the project yields >1 non-empty shard, the EXACT (single-program) engine
103
- * otherwise. Returns the shard set (`length > 1` ⇒ sharded) so the live runner
104
- * can choose engine-aware labels and pass the plain-data plan to
105
- * `graph-run-worker` (ADR-0028). `isTTY` is NEVER consulted — the engine is a
106
- * pure function of the request + shardability, identical to the static path.
107
- */
108
- export declare function resolveLiveEngineShards(args: GraphLiveBuildArgs, cli: ToolCliContext): Promise<Shard[]>;
109
- /**
110
- * Run the SHARDED live build and reduce it to the slim, serializable
111
- * {@link LiveGraphOutput} the interactive runner consumes — IDENTICAL in shape
112
- * to what the exact worker streams back, so live transports converge on one
113
- * payload. In the normal path this runs inside `graph-run-worker`, keeping the
114
- * render process free while the worker coordinates shard subprocesses and the
115
- * synchronous merge/link/rules work. The same function remains the degraded
116
- * in-process fallback when worker execution is explicitly disabled or unavailable.
117
- * Progress events flow through `onProgress`, mapped onto the same seven
118
- * canonical stages the exact engine emits.
119
- *
120
- * Crosses the single suppression chokepoint via {@link buildLiveGraphOutput}
121
- * (against `args.cwd`, the build root) — so the live sharded path waives
122
- * `@graph-ignore` directives IDENTICALLY to the static/exact paths (ADR-0014/0031).
123
- */
124
- export declare function runShardedLiveBuild(args: GraphLiveBuildArgs, shards: readonly Shard[], datastore: DataStore | undefined, onProgress: GraphProgressCallback): Promise<LiveGraphOutput>;
125
42
  export declare function dispatchGraphResult(opts: GraphCommandOptions, rawResult: Awaited<ReturnType<typeof runGraph>>, cli: ToolCliContext, startedAt: string, suppressionRoot: string): Promise<GraphRunOutcome | undefined>;
126
- /**
127
- * Shared contribution builder: derive graph's opaque session payload + the
128
- * generic verdict (`score`/`passed`) from a run's engine-slug `Signal[]`. The
129
- * payload is graph-owned detail (summary + rule-grouped per-signal findings);
130
- * the generic session row holds zero graph vocabulary. `score`/`passed` mirror
131
- * exactly what the former `saveGraphSession` computed (pass rate over
132
- * passed/total rules; `passed` ⇔ no error-severity signals).
133
- */
134
- /**
135
- * Engine slugs of every rule a run evaluated — the session payload's full rule
136
- * list, so a CLEAN run still records a PASS row per rule (the session detail
137
- * then shows the complete rule list, exactly the way fitness shows every check,
138
- * not just the failing ones).
139
- *
140
- * Prefer the EXPLICITLY-resolved rule set the run actually used (the `--recipe`
141
- * subset, threaded from the dispatch seam as `args.rules`); otherwise read the
142
- * current scope's full registry — this mirrors `runGraph`'s own
143
- * `args.rules ?? currentRules()` resolution, so the recorded set is exactly what
144
- * ran. Degrades to the empty set (fired-rules-only) when no graph scope is
145
- * active — e.g. an isolated dispatch unit test; production always runs the
146
- * handler inside the entered RunScope.
147
- *
148
- * Exported so BOTH contribution-building paths derive the evaluated set
149
- * identically: the static `executeGraph` dispatch (below) AND the live Ink
150
- * runner (`graph-runner.tsx`). Before it was shared, only the static path
151
- * threaded it, so a clean run on the live (interactive) path persisted an empty
152
- * `checks[]` and the report rendered "no results" instead of the rule list.
153
- */
154
- export declare function evaluatedRuleSlugs(explicitRules?: readonly Rule[]): readonly string[];
155
- /**
156
- * Build graph's generic-session contribution from a run's engine-slug
157
- * `Signal[]` plus the engine slugs of the rules it evaluated. The SINGLE
158
- * assembly point for both the static dispatch path and the live Ink runner, so
159
- * the contribution shape (and the "every evaluated rule gets a row" behaviour)
160
- * can never drift between them again. The payload is graph-owned detail
161
- * (summary + rule-grouped per-signal findings); the generic session row holds
162
- * zero graph vocabulary. `score`/`passed` follow fit's semantics (pass rate over
163
- * passed/total rules; `passed` ⇔ no error-severity signal).
164
- *
165
- * `evaluatedSlugs` defaults to {@link evaluatedRuleSlugs}() (the scope's full
166
- * registry) for the static callers, which build inside the entered RunScope; the
167
- * live runner passes its `args.rules`-derived set explicitly.
168
- */
169
- export declare function contributionFromSignals(opts: Pick<GraphCommandOptions, 'cwd' | 'recipe'>, signals: readonly Signal[], evaluatedSlugs?: readonly string[]): ToolSessionContribution;
170
43
  export declare function handleGraphError(label: string, error: unknown, cli: ToolCliContext): void;
44
+ export { contributionFromSignals, evaluatedRuleSlugs } from './graph-session-contribution.js';
45
+ export { resolveLiveEngineShards, resolveShardsForCwd, runShardedLiveBuild, } from './graph-sharded-engine.js';
46
+ export type { GraphLiveBuildArgs } from './graph-sharded-engine.js';
171
47
  export { buildUnifiedReportLines, buildLiveGraphOutput } from './graph-report.js';
172
48
  //# sourceMappingURL=graph.d.ts.map
@@ -1 +1 @@
1
- {"version":3,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