@opensip-cli/graph 0.1.4 → 0.1.6

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 (49) 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/__tests__/graph-command-plan.test.d.ts +2 -0
  7. package/dist/cli/__tests__/graph-command-plan.test.d.ts.map +1 -0
  8. package/dist/cli/__tests__/graph-command-plan.test.js +46 -0
  9. package/dist/cli/__tests__/graph-command-plan.test.js.map +1 -0
  10. package/dist/cli/graph-command-plan.d.ts +23 -0
  11. package/dist/cli/graph-command-plan.d.ts.map +1 -0
  12. package/dist/cli/graph-command-plan.js +43 -0
  13. package/dist/cli/graph-command-plan.js.map +1 -0
  14. package/dist/cli/graph-config.d.ts.map +1 -1
  15. package/dist/cli/graph-config.js +20 -1
  16. package/dist/cli/graph-config.js.map +1 -1
  17. package/dist/cli/graph-feature-columns.d.ts +7 -0
  18. package/dist/cli/graph-feature-columns.d.ts.map +1 -0
  19. package/dist/cli/graph-feature-columns.js +10 -0
  20. package/dist/cli/graph-feature-columns.js.map +1 -0
  21. package/dist/cli/graph-multi-path-mode.d.ts +24 -0
  22. package/dist/cli/graph-multi-path-mode.d.ts.map +1 -0
  23. package/dist/cli/graph-multi-path-mode.js +64 -0
  24. package/dist/cli/graph-multi-path-mode.js.map +1 -0
  25. package/dist/cli/graph-run-outcome.d.ts +12 -0
  26. package/dist/cli/graph-run-outcome.d.ts.map +1 -0
  27. package/dist/cli/graph-run-outcome.js +2 -0
  28. package/dist/cli/graph-run-outcome.js.map +1 -0
  29. package/dist/cli/graph-session-contribution.d.ts +29 -0
  30. package/dist/cli/graph-session-contribution.d.ts.map +1 -0
  31. package/dist/cli/graph-session-contribution.js +58 -0
  32. package/dist/cli/graph-session-contribution.js.map +1 -0
  33. package/dist/cli/graph-sharded-engine.d.ts +77 -0
  34. package/dist/cli/graph-sharded-engine.d.ts.map +1 -0
  35. package/dist/cli/graph-sharded-engine.js +229 -0
  36. package/dist/cli/graph-sharded-engine.js.map +1 -0
  37. package/dist/cli/graph-single-run-mode.d.ts +23 -0
  38. package/dist/cli/graph-single-run-mode.d.ts.map +1 -0
  39. package/dist/cli/graph-single-run-mode.js +107 -0
  40. package/dist/cli/graph-single-run-mode.js.map +1 -0
  41. package/dist/cli/graph-workspace-mode.d.ts +11 -0
  42. package/dist/cli/graph-workspace-mode.d.ts.map +1 -0
  43. package/dist/cli/graph-workspace-mode.js +87 -0
  44. package/dist/cli/graph-workspace-mode.js.map +1 -0
  45. package/dist/cli/graph.d.ts +7 -131
  46. package/dist/cli/graph.d.ts.map +1 -1
  47. package/dist/cli/graph.js +18 -681
  48. package/dist/cli/graph.js.map +1 -1
  49. package/package.json +8 -8
@@ -18,41 +18,12 @@
18
18
  * `--packages` flags were retired in favor 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
- import { runGraph } from './orchestrate.js';
21
+ import { type RunGraphResult } 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
- 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;
42
+ export declare function dispatchGraphResult(opts: GraphCommandOptions, rawResult: RunGraphResult, cli: ToolCliContext, startedAt: string, suppressionRoot: string): Promise<GraphRunOutcome | undefined>;
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,"file":"graph.d.ts","sourceRoot":"","sources":["../../src/cli/graph.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;GAmBG;AA6BH,OAAO,EAKL,KAAK,eAAe,EACrB,MAAM,mBAAmB,CAAC;AAQ3B,OAAO,EAGL,QAAQ,EAET,MAAM,kBAAkB,CAAC;AAQ1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,KAAK,EAAE,qBAAqB,EAAkB,MAAM,kBAAkB,CAAC;AAE9E,OAAO,KAAK,EAGV,WAAW,EAEX,cAAc,EACd,IAAI,EACL,MAAM,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