opensip-cli 0.1.14 → 0.1.15
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.
- package/dist/bootstrap/artifact-retention.d.ts +62 -0
- package/dist/bootstrap/artifact-retention.d.ts.map +1 -0
- package/dist/bootstrap/artifact-retention.js +117 -0
- package/dist/bootstrap/artifact-retention.js.map +1 -0
- package/dist/bootstrap/artifact-seams.d.ts +21 -1
- package/dist/bootstrap/artifact-seams.d.ts.map +1 -1
- package/dist/bootstrap/artifact-seams.js +76 -4
- package/dist/bootstrap/artifact-seams.js.map +1 -1
- package/dist/bootstrap/atomic-artifact-write.d.ts.map +1 -1
- package/dist/bootstrap/atomic-artifact-write.js +7 -2
- package/dist/bootstrap/atomic-artifact-write.js.map +1 -1
- package/dist/bootstrap/bundled-tools.manifest.json +2 -1
- package/dist/bootstrap/dispatch-fork-core.d.ts +15 -2
- package/dist/bootstrap/dispatch-fork-core.d.ts.map +1 -1
- package/dist/bootstrap/dispatch-fork-core.js +22 -4
- package/dist/bootstrap/dispatch-fork-core.js.map +1 -1
- package/dist/bootstrap/dispatch-host-rpc-handler.d.ts.map +1 -1
- package/dist/bootstrap/dispatch-host-rpc-handler.js +10 -0
- package/dist/bootstrap/dispatch-host-rpc-handler.js.map +1 -1
- package/dist/bootstrap/run-plane.d.ts +10 -0
- package/dist/bootstrap/run-plane.d.ts.map +1 -1
- package/dist/bootstrap/run-plane.js +20 -0
- package/dist/bootstrap/run-plane.js.map +1 -1
- package/dist/bootstrap/tool-command-dispatch-types.d.ts +15 -0
- package/dist/bootstrap/tool-command-dispatch-types.d.ts.map +1 -1
- package/dist/bootstrap/tool-command-worker-context.d.ts +5 -4
- package/dist/bootstrap/tool-command-worker-context.d.ts.map +1 -1
- package/dist/bootstrap/tool-command-worker-context.js +6 -4
- package/dist/bootstrap/tool-command-worker-context.js.map +1 -1
- package/dist/bootstrap/tool-command-worker-entry.d.ts.map +1 -1
- package/dist/bootstrap/tool-command-worker-entry.js +30 -5
- package/dist/bootstrap/tool-command-worker-entry.js.map +1 -1
- package/dist/bootstrap/tool-command-worker-rpc.d.ts.map +1 -1
- package/dist/bootstrap/tool-command-worker-rpc.js +23 -1
- package/dist/bootstrap/tool-command-worker-rpc.js.map +1 -1
- package/dist/cli-context.d.ts.map +1 -1
- package/dist/cli-context.js +26 -3
- package/dist/cli-context.js.map +1 -1
- package/dist/commands/agent-catalog.d.ts +9 -56
- package/dist/commands/agent-catalog.d.ts.map +1 -1
- package/dist/commands/agent-catalog.js +8 -199
- package/dist/commands/agent-catalog.js.map +1 -1
- package/dist/commands/assemble-opts.d.ts +13 -0
- package/dist/commands/assemble-opts.d.ts.map +1 -0
- package/dist/commands/assemble-opts.js +85 -0
- package/dist/commands/assemble-opts.js.map +1 -0
- package/dist/commands/history.d.ts +7 -11
- package/dist/commands/history.d.ts.map +1 -1
- package/dist/commands/history.js +7 -39
- package/dist/commands/history.js.map +1 -1
- package/dist/commands/host-subcommand-groups.d.ts.map +1 -1
- package/dist/commands/host-subcommand-groups.js +12 -1
- package/dist/commands/host-subcommand-groups.js.map +1 -1
- package/dist/commands/mount-command-spec-wiring.d.ts +1 -0
- package/dist/commands/mount-command-spec-wiring.d.ts.map +1 -1
- package/dist/commands/mount-command-spec-wiring.js +5 -5
- package/dist/commands/mount-command-spec-wiring.js.map +1 -1
- package/dist/commands/session-show.d.ts.map +1 -1
- package/dist/commands/session-show.js +14 -41
- package/dist/commands/session-show.js.map +1 -1
- package/dist/commands/shared.d.ts +3 -1
- package/dist/commands/shared.d.ts.map +1 -1
- package/dist/commands/suite/capturing-context.d.ts +19 -0
- package/dist/commands/suite/capturing-context.d.ts.map +1 -0
- package/dist/commands/suite/capturing-context.js +62 -0
- package/dist/commands/suite/capturing-context.js.map +1 -0
- package/dist/commands/suite/orchestrator.d.ts +12 -0
- package/dist/commands/suite/orchestrator.d.ts.map +1 -0
- package/dist/commands/suite/orchestrator.js +216 -0
- package/dist/commands/suite/orchestrator.js.map +1 -0
- package/dist/commands/suite/suite-add.d.ts +18 -0
- package/dist/commands/suite/suite-add.d.ts.map +1 -0
- package/dist/commands/suite/suite-add.js +130 -0
- package/dist/commands/suite/suite-add.js.map +1 -0
- package/dist/commands/suite/suite-command-specs.d.ts +4 -0
- package/dist/commands/suite/suite-command-specs.d.ts.map +1 -0
- package/dist/commands/suite/suite-command-specs.js +150 -0
- package/dist/commands/suite/suite-command-specs.js.map +1 -0
- package/dist/commands/suite/validate-suite.d.ts +21 -0
- package/dist/commands/suite/validate-suite.d.ts.map +1 -0
- package/dist/commands/suite/validate-suite.js +89 -0
- package/dist/commands/suite/validate-suite.js.map +1 -0
- package/dist/commands/tools/list.d.ts.map +1 -1
- package/dist/commands/tools/list.js +54 -31
- package/dist/commands/tools/list.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/report-compose.js +2 -2
- package/dist/report-compose.js.map +1 -1
- package/dist/ui/result-to-view.d.ts.map +1 -1
- package/dist/ui/result-to-view.js +22 -0
- package/dist/ui/result-to-view.js.map +1 -1
- package/dist/ui/views/misc-views.d.ts.map +1 -1
- package/dist/ui/views/misc-views.js +30 -7
- package/dist/ui/views/misc-views.js.map +1 -1
- package/dist/ui/views/suite-views.d.ts +6 -0
- package/dist/ui/views/suite-views.d.ts.map +1 -0
- package/dist/ui/views/suite-views.js +70 -0
- package/dist/ui/views/suite-views.js.map +1 -0
- package/dist/ui/views/tools-views.d.ts.map +1 -1
- package/dist/ui/views/tools-views.js +2 -0
- package/dist/ui/views/tools-views.js.map +1 -1
- package/package.json +34 -33
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-show.js","sourceRoot":"","sources":["../../src/commands/session-show.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"session-show.js","sourceRoot":"","sources":["../../src/commands/session-show.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,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,7 +12,7 @@
|
|
|
12
12
|
import type { SpecLike } from './completion.js';
|
|
13
13
|
import type { SessionReplayRegistry } from '../session-replay-registry.js';
|
|
14
14
|
import type { CommandResult } from '@opensip-cli/contracts';
|
|
15
|
-
import type { PluginLayout, ScaffoldContext, ScaffoldFile, ToolPluginManifest, ToolProvenance, ToolRegistry } from '@opensip-cli/core';
|
|
15
|
+
import type { PluginLayout, ScaffoldContext, ScaffoldFile, ToolPluginManifest, ToolProvenance, ToolRegistry, ToolCliContext } from '@opensip-cli/core';
|
|
16
16
|
/**
|
|
17
17
|
* One registered tool's `init`-scaffold contribution (ADR-0038): its structural
|
|
18
18
|
* `pluginLayout` (domain + userSubdirs the host `mkdir`s) plus the optional
|
|
@@ -101,6 +101,8 @@ export interface CliCommandsContext {
|
|
|
101
101
|
readonly toolInternalCommands?: ReadonlySet<string>;
|
|
102
102
|
/** Live tool registry for identity-aware host commands (optional in tests). */
|
|
103
103
|
readonly tools?: ToolRegistry;
|
|
104
|
+
/** Full tool context for host commands that re-dispatch tool specs (suite run). */
|
|
105
|
+
readonly toolContext?: ToolCliContext;
|
|
104
106
|
/** Admitted tool manifests for config declaration composition (optional in tests). */
|
|
105
107
|
readonly manifests?: readonly ToolPluginManifest[];
|
|
106
108
|
/** Per-run tool provenance for config declaration composition (optional in tests). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/commands/shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EACV,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,YAAY,
|
|
1
|
+
{"version":3,"file":"shared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AM,CAAC;QAC1B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;QAC7B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;KACxB,KAAK,IAAI,CAAC;IACX;;;;;;OAMG;IACH,QAAQ,CAAC,aAAa,EAAE,SAAS,YAAY,EAAE,CAAC;IAChD;;;;;OAKG;IACH,QAAQ,CAAC,aAAa,EAAE,SAAS,YAAY,EAAE,CAAC;IAChD,QAAQ,CAAC,qBAAqB,CAAC,EAAE,qBAAqB,CAAC;IACvD;;;;;;;;;OASG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAC;IAChD;;;;;;;OAOG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACpD,+EAA+E;IAC/E,QAAQ,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC;IAC9B,mFAAmF;IACnF,QAAQ,CAAC,WAAW,CAAC,EAAE,cAAc,CAAC;IACtC,sFAAsF;IACtF,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACnD,sFAAsF;IACtF,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;IAChD;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,OAAO,CAAC;CACnC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { SignalDeliveryResult, ToolCliContext } from '@opensip-cli/core';
|
|
2
|
+
export interface StepCapture {
|
|
3
|
+
/**
|
|
4
|
+
* The step's captured exit code — a SINGLE last-write-wins slot that mirrors the
|
|
5
|
+
* host's one exit holder (`bootstrap/output-plane.ts`: `let exitCode;
|
|
6
|
+
* setExitCode overwrites`), NOT an append-only log reduced by `Math.max`. The
|
|
7
|
+
* former array+max model diverged from the host holder in two ways (a
|
|
8
|
+
* `--report-to` failure exit 4 was never captured; an advisory lower-to-SUCCESS
|
|
9
|
+
* could not undo an earlier raise) — both are one defect: append+max ≠
|
|
10
|
+
* last-write-wins. `undefined` when the step neither called `setExitCode` nor
|
|
11
|
+
* delivered a failing / report-failed envelope (the orchestrator then defaults
|
|
12
|
+
* to `EXIT_CODES.SUCCESS`).
|
|
13
|
+
*/
|
|
14
|
+
readonly getExitCode: () => number | undefined;
|
|
15
|
+
readonly signalDeliveries: readonly SignalDeliveryResult[];
|
|
16
|
+
readonly context: ToolCliContext;
|
|
17
|
+
}
|
|
18
|
+
export declare function createCapturingContext(base: ToolCliContext): StepCapture;
|
|
19
|
+
//# sourceMappingURL=capturing-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capturing-context.d.ts","sourceRoot":"","sources":["../../../src/commands/suite/capturing-context.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAE9E,MAAM,WAAW,WAAW;IAC1B;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IAC/C,QAAQ,CAAC,gBAAgB,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAC3D,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;CAClC;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,cAAc,GAAG,WAAW,CAmExE"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { EXIT_CODES } from '@opensip-cli/contracts';
|
|
2
|
+
export function createCapturingContext(base) {
|
|
3
|
+
// Single mutable last-write-wins exit slot — the per-step mirror of the host's
|
|
4
|
+
// `outputPlane` holder. ALL exit sources for the step (the tool's `setExitCode`,
|
|
5
|
+
// the `deliverSignals` findings/report mirror below, and a direct `process.exit`
|
|
6
|
+
// routed in by `withProcessExitGuard`) write THIS slot, so `getExitCode()` is the
|
|
7
|
+
// single source of truth for the step's verdict.
|
|
8
|
+
let exitCode;
|
|
9
|
+
const signalDeliveries = [];
|
|
10
|
+
const context = Object.defineProperties({}, Object.getOwnPropertyDescriptors(base));
|
|
11
|
+
Object.defineProperties(context, {
|
|
12
|
+
setExitCode: {
|
|
13
|
+
value: (code) => {
|
|
14
|
+
// OVERWRITE (last-write-wins): a later `setExitCode(SUCCESS)` — e.g. yagni's
|
|
15
|
+
// `applyAdvisoryExitCode` re-affirming exit 0 after nested graph evidence
|
|
16
|
+
// raised the code — must be able to LOWER the step exit, exactly as the host
|
|
17
|
+
// holder does. The old append-then-`Math.max` could never lower.
|
|
18
|
+
exitCode = code;
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
getExitCode: {
|
|
22
|
+
// Read the slot (NOT the inherited host holder). The override above isolates
|
|
23
|
+
// the step's writes into the slot, so reads must come from the slot too —
|
|
24
|
+
// otherwise a tool that reads its own exit mid-run (yagni's advisory check
|
|
25
|
+
// inspects `cli.getExitCode()` for a prior REPORT_FAILED, or a nested
|
|
26
|
+
// `setExitCode` from graph evidence) would see a stale cross-step host value
|
|
27
|
+
// and split-brain against where its own writes landed.
|
|
28
|
+
value: () => exitCode,
|
|
29
|
+
},
|
|
30
|
+
deliverSignals: {
|
|
31
|
+
value: async (envelope, opts) => {
|
|
32
|
+
const result = await base.deliverSignals(envelope, opts);
|
|
33
|
+
signalDeliveries.push(result);
|
|
34
|
+
// Mirror the host's `deliverEnvelope` exit precedence
|
|
35
|
+
// (`bootstrap/deliver-envelope.ts` → `deriveReportExitDecision`). The host
|
|
36
|
+
// applies the findings/report exit through ITS OWN `outputPlane.setExitCode`,
|
|
37
|
+
// bypassing this wrapper's override — so without this mirror the step's
|
|
38
|
+
// verdict / report-upload exit would be invisible to the capture. Replicate
|
|
39
|
+
// the SAME precedence here, last-write-wins (SET, not push), and like
|
|
40
|
+
// `deliverEnvelope` only ever SET a failure code — never reset to 0 on a pass
|
|
41
|
+
// (a passing, no-`--report-to` run leaves the slot untouched):
|
|
42
|
+
// - runFailed (verdict failed, or an explicit gate-compare override)
|
|
43
|
+
// DOMINATES → RUNTIME_ERROR (1);
|
|
44
|
+
// - else a `--report-to` upload failure (`reportSuccess === false`)
|
|
45
|
+
// → REPORT_FAILED (4).
|
|
46
|
+
// `reportSuccess` is `undefined` on the no-`--report-to` path, so the strict
|
|
47
|
+
// `=== false` is exact and never fires there.
|
|
48
|
+
const runFailed = opts.runFailed ??
|
|
49
|
+
envelope?.verdict?.passed === false;
|
|
50
|
+
if (runFailed) {
|
|
51
|
+
exitCode = EXIT_CODES.RUNTIME_ERROR;
|
|
52
|
+
}
|
|
53
|
+
else if (result.reportSuccess === false) {
|
|
54
|
+
exitCode = EXIT_CODES.REPORT_FAILED;
|
|
55
|
+
}
|
|
56
|
+
return result;
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
return { getExitCode: () => exitCode, signalDeliveries, context };
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=capturing-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capturing-context.js","sourceRoot":"","sources":["../../../src/commands/suite/capturing-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAsBpD,MAAM,UAAU,sBAAsB,CAAC,IAAoB;IACzD,+EAA+E;IAC/E,iFAAiF;IACjF,iFAAiF;IACjF,kFAAkF;IAClF,iDAAiD;IACjD,IAAI,QAA4B,CAAC;IACjC,MAAM,gBAAgB,GAA2B,EAAE,CAAC;IACpD,MAAM,OAAO,GAAG,MAAM,CAAC,gBAAgB,CACrC,EAAE,EACF,MAAM,CAAC,yBAAyB,CAAC,IAAc,CAAC,CAC/B,CAAC;IAEpB,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE;QAC/B,WAAW,EAAE;YACX,KAAK,EAAE,CAAC,IAAY,EAAE,EAAE;gBACtB,6EAA6E;gBAC7E,0EAA0E;gBAC1E,6EAA6E;gBAC7E,iEAAiE;gBACjE,QAA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
import type { SuiteRunResult } from '@opensip-cli/contracts';
|
|
4
|
+
export interface RunSuiteInput {
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly suite: SuiteDefinition;
|
|
7
|
+
readonly tools: readonly Tool[];
|
|
8
|
+
readonly ctx: ToolCliContext;
|
|
9
|
+
readonly suiteOpts: Readonly<Record<string, unknown>>;
|
|
10
|
+
}
|
|
11
|
+
export declare function runSuite(input: RunSuiteInput): Promise<SuiteRunResult>;
|
|
12
|
+
//# sourceMappingURL=orchestrator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["../../../src/commands/suite/orchestrator.ts"],"names":[],"mappings":"AAGA,OAAO,EAIL,KAAK,IAAI,EACT,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;AAW3B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAoB,MAAM,wBAAwB,CAAC;AAQ/E,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;IAChC,QAAQ,CAAC,GAAG,EAAE,cAAc,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACvD;AAED,wBAAsB,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,CA4C5E"}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { performance } from 'node:perf_hooks';
|
|
2
|
+
import { EXIT_CODES } from '@opensip-cli/contracts';
|
|
3
|
+
import { currentLogger, currentScope, generatePrefixedId, } from '@opensip-cli/core';
|
|
4
|
+
import { buildMaybeDispatchExternal } from '../../bootstrap/bind-external-dispatch.js';
|
|
5
|
+
import { bindToolCliContext } from '../../bootstrap/bind-tool-context.js';
|
|
6
|
+
import { runWithSuiteRunContext } from '../../bootstrap/run-plane.js';
|
|
7
|
+
import { assembleOptsFromSpec } from '../assemble-opts.js';
|
|
8
|
+
import { dispatchOutput } from '../mount-command-spec.js';
|
|
9
|
+
import { createCapturingContext } from './capturing-context.js';
|
|
10
|
+
import { validateSuite } from './validate-suite.js';
|
|
11
|
+
class DirectProcessExit extends Error {
|
|
12
|
+
code;
|
|
13
|
+
constructor(code) {
|
|
14
|
+
super(`process.exit(${code})`);
|
|
15
|
+
this.code = code;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export async function runSuite(input) {
|
|
19
|
+
const suite = validateSuite({
|
|
20
|
+
name: input.name,
|
|
21
|
+
suite: input.suite,
|
|
22
|
+
tools: input.tools,
|
|
23
|
+
});
|
|
24
|
+
const suiteRunId = generatePrefixedId('suite');
|
|
25
|
+
const started = performance.now();
|
|
26
|
+
const log = currentLogger();
|
|
27
|
+
log.info?.({
|
|
28
|
+
evt: 'cli.suite.run.start',
|
|
29
|
+
suite: suite.name,
|
|
30
|
+
suiteRunId,
|
|
31
|
+
stepCount: suite.steps.length,
|
|
32
|
+
});
|
|
33
|
+
const steps = await runWithSuiteRunContext({ suiteRunId, suiteName: suite.name }, () => runStepsSerially({
|
|
34
|
+
suite,
|
|
35
|
+
suiteRunId,
|
|
36
|
+
ctx: input.ctx,
|
|
37
|
+
suiteOpts: input.suiteOpts,
|
|
38
|
+
}));
|
|
39
|
+
const exitCode = Math.max(0, ...steps.map((step) => step.exitCode));
|
|
40
|
+
const durationMs = Math.max(0, performance.now() - started);
|
|
41
|
+
log.info?.({
|
|
42
|
+
evt: 'cli.suite.run.complete',
|
|
43
|
+
suite: suite.name,
|
|
44
|
+
suiteRunId,
|
|
45
|
+
exitCode,
|
|
46
|
+
durationMs,
|
|
47
|
+
});
|
|
48
|
+
return {
|
|
49
|
+
type: 'suite-run',
|
|
50
|
+
suite: suite.name,
|
|
51
|
+
suiteRunId,
|
|
52
|
+
exitCode,
|
|
53
|
+
durationMs,
|
|
54
|
+
steps,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
async function runStepsSerially(args) {
|
|
58
|
+
const summaries = [];
|
|
59
|
+
let chain = Promise.resolve();
|
|
60
|
+
for (const step of args.suite.steps) {
|
|
61
|
+
chain = chain.then(async () => {
|
|
62
|
+
summaries.push(await runStep({
|
|
63
|
+
suite: args.suite,
|
|
64
|
+
suiteRunId: args.suiteRunId,
|
|
65
|
+
step,
|
|
66
|
+
ctx: args.ctx,
|
|
67
|
+
suiteOpts: args.suiteOpts,
|
|
68
|
+
}));
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
await chain;
|
|
72
|
+
return summaries;
|
|
73
|
+
}
|
|
74
|
+
async function runStep(args) {
|
|
75
|
+
const started = performance.now();
|
|
76
|
+
const bound = bindToolCliContext(args.step.tool, args.ctx);
|
|
77
|
+
const capture = createCapturingContext(bound);
|
|
78
|
+
// ADR-0054 out-of-process dispatch must run through the CAPTURING context, not
|
|
79
|
+
// the raw bound ctx. For an external-provenance step the worker replay
|
|
80
|
+
// (`replayResult`) calls `ctx.setExitCode` with the tool's verdict exit code;
|
|
81
|
+
// binding the hook to `capture.context` routes that into the capture's exit slot
|
|
82
|
+
// (`capture.getExitCode()`) so the external step participates in the suite
|
|
83
|
+
// worst-of aggregation exactly like the in-process handler (which already runs
|
|
84
|
+
// against `capture.context`). Binding to `bound` instead dropped the external
|
|
85
|
+
// step's exit code (it never reached the slot, so a findings/regression verdict
|
|
86
|
+
// silently aggregated to 0) AND leaked the code into the outer host context — the
|
|
87
|
+
// same isolation the bundled path preserves. (04↔05 regression: external adapter
|
|
88
|
+
// as a suite step.)
|
|
89
|
+
Object.assign(capture.context, {
|
|
90
|
+
maybeDispatchExternal: buildMaybeDispatchExternal(args.step.tool, capture.context),
|
|
91
|
+
});
|
|
92
|
+
const opts = stepOpts(args.step, args.suiteOpts);
|
|
93
|
+
const hooks = capture.context;
|
|
94
|
+
const diagnostics = currentScope()?.diagnostics;
|
|
95
|
+
const log = currentLogger();
|
|
96
|
+
let errorMessage;
|
|
97
|
+
let exitCode = EXIT_CODES.SUCCESS;
|
|
98
|
+
try {
|
|
99
|
+
diagnostics?.event('execute', 'debug', `suite step '${args.step.spec.name}' started`, {
|
|
100
|
+
suite: args.suite.name,
|
|
101
|
+
suiteRunId: args.suiteRunId,
|
|
102
|
+
tool: args.step.tool.metadata.id,
|
|
103
|
+
command: args.step.spec.name,
|
|
104
|
+
});
|
|
105
|
+
exitCode = await withProcessExitGuard(async () => {
|
|
106
|
+
hooks.resetRun?.();
|
|
107
|
+
hooks.beginRun?.();
|
|
108
|
+
const dispatched = await hooks.maybeDispatchExternal?.(args.step.spec.name, opts, args.step.positionals);
|
|
109
|
+
if (dispatched === true)
|
|
110
|
+
return capture.getExitCode() ?? EXIT_CODES.SUCCESS;
|
|
111
|
+
const result = await args.step.spec.handler(opts, capture.context);
|
|
112
|
+
hooks.completeRun?.(result);
|
|
113
|
+
await dispatchOutput(result, args.step.spec, opts, args.step.positionals, capture.context);
|
|
114
|
+
return capture.getExitCode() ?? EXIT_CODES.SUCCESS;
|
|
115
|
+
}, (code) => {
|
|
116
|
+
// A bundled step called `process.exit(code)` directly: route the code into
|
|
117
|
+
// the capture's last-write-wins slot (the single per-step exit source of
|
|
118
|
+
// truth) just as `setExitCode` would, then record it.
|
|
119
|
+
capture.context.setExitCode(code);
|
|
120
|
+
log.warn?.({
|
|
121
|
+
evt: 'cli.suite.run.step',
|
|
122
|
+
suite: args.suite.name,
|
|
123
|
+
suiteRunId: args.suiteRunId,
|
|
124
|
+
tool: args.step.tool.metadata.id,
|
|
125
|
+
command: args.step.spec.name,
|
|
126
|
+
exitCode: code,
|
|
127
|
+
msg: 'Bundled step called process.exit directly; captured as step verdict.',
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
diagnostics?.event('execute', 'debug', `suite step '${args.step.spec.name}' completed`, {
|
|
131
|
+
suite: args.suite.name,
|
|
132
|
+
suiteRunId: args.suiteRunId,
|
|
133
|
+
tool: args.step.tool.metadata.id,
|
|
134
|
+
command: args.step.spec.name,
|
|
135
|
+
exitCode,
|
|
136
|
+
});
|
|
137
|
+
diagnostics?.counter('suite.steps.completed', 1);
|
|
138
|
+
// @fitness-ignore-next-line exit-code-correctness -- suite steps convert thrown step failures into a non-zero step summary; runSuite later returns the max step exit code.
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
exitCode = EXIT_CODES.RUNTIME_ERROR;
|
|
142
|
+
errorMessage = error instanceof Error ? error.message : String(error);
|
|
143
|
+
diagnostics?.event('execute', 'error', `suite step '${args.step.spec.name}' failed`, {
|
|
144
|
+
suite: args.suite.name,
|
|
145
|
+
suiteRunId: args.suiteRunId,
|
|
146
|
+
tool: args.step.tool.metadata.id,
|
|
147
|
+
command: args.step.spec.name,
|
|
148
|
+
exitCode,
|
|
149
|
+
error: errorMessage,
|
|
150
|
+
});
|
|
151
|
+
log.error?.({
|
|
152
|
+
evt: 'cli.suite.run.step.error',
|
|
153
|
+
suite: args.suite.name,
|
|
154
|
+
suiteRunId: args.suiteRunId,
|
|
155
|
+
tool: args.step.tool.metadata.id,
|
|
156
|
+
command: args.step.spec.name,
|
|
157
|
+
error: errorMessage,
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
const durationMs = Math.max(0, performance.now() - started);
|
|
161
|
+
log.info?.({
|
|
162
|
+
evt: 'cli.suite.run.step',
|
|
163
|
+
suite: args.suite.name,
|
|
164
|
+
suiteRunId: args.suiteRunId,
|
|
165
|
+
tool: args.step.tool.metadata.id,
|
|
166
|
+
command: args.step.spec.name,
|
|
167
|
+
exitCode,
|
|
168
|
+
durationMs,
|
|
169
|
+
});
|
|
170
|
+
return {
|
|
171
|
+
tool: args.step.tool.metadata.name,
|
|
172
|
+
stableId: args.step.tool.metadata.id,
|
|
173
|
+
command: args.step.spec.name,
|
|
174
|
+
exitCode,
|
|
175
|
+
durationMs,
|
|
176
|
+
...(errorMessage === undefined ? {} : { error: errorMessage }),
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
function stepOpts(step, suiteOpts) {
|
|
180
|
+
const assembled = assembleOptsFromSpec({
|
|
181
|
+
options: step.spec.options,
|
|
182
|
+
suppliedValues: step.args,
|
|
183
|
+
}).opts;
|
|
184
|
+
const common = {};
|
|
185
|
+
for (const key of step.spec.commonFlags) {
|
|
186
|
+
const value = suiteOpts[key];
|
|
187
|
+
if (value !== undefined)
|
|
188
|
+
common[key] = value;
|
|
189
|
+
}
|
|
190
|
+
if (step.spec.commonFlags.includes('cwd') && common.cwd === undefined) {
|
|
191
|
+
common.cwd = process.cwd();
|
|
192
|
+
}
|
|
193
|
+
return { ...common, ...assembled, _args: step.positionals };
|
|
194
|
+
}
|
|
195
|
+
async function withProcessExitGuard(fn, onDirectExit) {
|
|
196
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method -- process.exit has no `this` contract; identity must be restored after the guard.
|
|
197
|
+
const original = process.exit;
|
|
198
|
+
// @fitness-ignore-next-line throws-documentation -- this private guard intentionally throws a sentinel so direct process.exit calls become suite step exit codes.
|
|
199
|
+
process.exit = (code) => {
|
|
200
|
+
throw new DirectProcessExit(typeof code === 'number' ? code : 0);
|
|
201
|
+
};
|
|
202
|
+
try {
|
|
203
|
+
return await fn();
|
|
204
|
+
}
|
|
205
|
+
catch (error) {
|
|
206
|
+
if (error instanceof DirectProcessExit) {
|
|
207
|
+
onDirectExit(error.code);
|
|
208
|
+
return error.code;
|
|
209
|
+
}
|
|
210
|
+
throw error;
|
|
211
|
+
}
|
|
212
|
+
finally {
|
|
213
|
+
process.exit = original;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
//# sourceMappingURL=orchestrator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator.js","sourceRoot":"","sources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AC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,iBAAiB,EAAE,CAAC;YACvC,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACzB,OAAO,KAAK,CAAC,IAAI,CAAC;QACpB,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;YAAS,CAAC;QACR,OAAoD,CAAC,IAAI,GAAG,QAAQ,CAAC;IACxE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type Tool } from '@opensip-cli/core';
|
|
2
|
+
export interface SuiteAddInput {
|
|
3
|
+
readonly suite: string;
|
|
4
|
+
readonly tool: string;
|
|
5
|
+
readonly command: string;
|
|
6
|
+
readonly argPairs: readonly string[];
|
|
7
|
+
readonly tools: readonly Tool[];
|
|
8
|
+
readonly projectRoot: string;
|
|
9
|
+
readonly configPath?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface SuiteAddOutput {
|
|
12
|
+
readonly configPath: string;
|
|
13
|
+
readonly changed: boolean;
|
|
14
|
+
readonly tool: Tool;
|
|
15
|
+
readonly args: Readonly<Record<string, unknown>>;
|
|
16
|
+
}
|
|
17
|
+
export declare function addSuiteStep(input: SuiteAddInput): SuiteAddOutput;
|
|
18
|
+
//# sourceMappingURL=suite-add.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suite-add.d.ts","sourceRoot":"","sources":["../../../src/commands/suite/suite-add.ts"],"names":[],"mappings":"AAIA,OAAO,EAAqC,KAAK,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAKjF,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;IAChC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CAClD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,aAAa,GAAG,cAAc,CAkBjE"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
// @fitness-ignore-file dogfood-one-config-document-ratchet -- `suite add` is the host-owned config authoring command: it intentionally edits opensip-cli.config.yml and does not participate in runtime config loading.
|
|
2
|
+
import { existsSync, readFileSync, statSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { ConfigurationError, currentLogger } from '@opensip-cli/core';
|
|
5
|
+
import { isMap, isSeq, parseDocument } from 'yaml';
|
|
6
|
+
const MAX_EDITABLE_CONFIG_BYTES = 1_000_000;
|
|
7
|
+
export function addSuiteStep(input) {
|
|
8
|
+
const tool = resolveTool(input.tool, input.tools);
|
|
9
|
+
const command = tool.commandSpecs?.find((spec) => spec.name === input.command);
|
|
10
|
+
if (command === undefined) {
|
|
11
|
+
throw new ConfigurationError(`Tool '${tool.metadata.name}' has no command '${input.command}'.`, { code: 'CONFIG.SUITE_ADD.UNKNOWN_COMMAND' });
|
|
12
|
+
}
|
|
13
|
+
const configPath = input.configPath ?? join(input.projectRoot, 'opensip-cli.config.yml');
|
|
14
|
+
const args = parseArgPairs(input.argPairs);
|
|
15
|
+
const changed = appendSuiteStep(configPath, input.suite, {
|
|
16
|
+
tool: tool.metadata.id,
|
|
17
|
+
name: tool.metadata.name,
|
|
18
|
+
command: command.name,
|
|
19
|
+
...(Object.keys(args).length === 0 ? {} : { args }),
|
|
20
|
+
});
|
|
21
|
+
return { configPath, changed, tool, args };
|
|
22
|
+
}
|
|
23
|
+
function resolveTool(selector, tools) {
|
|
24
|
+
const matches = tools.filter((tool) => tool.metadata.id === selector || tool.metadata.name === selector);
|
|
25
|
+
if (matches.length === 1) {
|
|
26
|
+
const [match] = matches;
|
|
27
|
+
if (match !== undefined)
|
|
28
|
+
return match;
|
|
29
|
+
}
|
|
30
|
+
if (matches.length > 1) {
|
|
31
|
+
throw new ConfigurationError(`Tool selector '${selector}' matched multiple tools. Use a UUID.`, {
|
|
32
|
+
code: 'CONFIG.SUITE_ADD.AMBIGUOUS_TOOL',
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
throw new ConfigurationError(`Unknown tool '${selector}'.`, {
|
|
36
|
+
code: 'CONFIG.SUITE_ADD.UNKNOWN_TOOL',
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function parseArgPairs(pairs) {
|
|
40
|
+
const args = {};
|
|
41
|
+
for (const pair of pairs) {
|
|
42
|
+
const eq = pair.indexOf('=');
|
|
43
|
+
if (eq <= 0) {
|
|
44
|
+
throw new ConfigurationError(`Invalid --arg '${pair}'. Expected key=value.`, {
|
|
45
|
+
code: 'CONFIG.SUITE_ADD.INVALID_ARG',
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
args[pair.slice(0, eq)] = parseScalar(pair.slice(eq + 1));
|
|
49
|
+
}
|
|
50
|
+
return args;
|
|
51
|
+
}
|
|
52
|
+
function parseScalar(raw) {
|
|
53
|
+
if (raw === 'true')
|
|
54
|
+
return true;
|
|
55
|
+
if (raw === 'false')
|
|
56
|
+
return false;
|
|
57
|
+
if (/^-?\d+(\.\d+)?$/.test(raw))
|
|
58
|
+
return Number(raw);
|
|
59
|
+
return raw;
|
|
60
|
+
}
|
|
61
|
+
function appendSuiteStep(configPath, suiteName, step) {
|
|
62
|
+
const doc = readOrCreateDocument(configPath);
|
|
63
|
+
const root = ensureRootMap(doc, configPath);
|
|
64
|
+
let suites = root.get('suites');
|
|
65
|
+
if (!isMap(suites)) {
|
|
66
|
+
suites = doc.createNode({});
|
|
67
|
+
root.set('suites', suites);
|
|
68
|
+
}
|
|
69
|
+
const suitesMap = suites;
|
|
70
|
+
let suite = suitesMap.get(suiteName);
|
|
71
|
+
if (!isMap(suite)) {
|
|
72
|
+
suite = doc.createNode({ steps: [] });
|
|
73
|
+
suitesMap.set(suiteName, suite);
|
|
74
|
+
}
|
|
75
|
+
const suiteMap = suite;
|
|
76
|
+
let seq = suiteMap.get('steps');
|
|
77
|
+
if (seq === undefined) {
|
|
78
|
+
seq = doc.createNode([]);
|
|
79
|
+
suiteMap.set('steps', seq);
|
|
80
|
+
}
|
|
81
|
+
if (!isSeq(seq)) {
|
|
82
|
+
throw new ConfigurationError(`Cannot edit suites.${suiteName}.steps in ${configPath}.`, {
|
|
83
|
+
code: 'CONFIG.SUITE_ADD.INVALID_STEPS',
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
const yamlSeq = seq;
|
|
87
|
+
const stepKey = JSON.stringify(step);
|
|
88
|
+
if (yamlSeq.items.some((item) => JSON.stringify(yamlNodeToJson(item)) === stepKey)) {
|
|
89
|
+
currentLogger().info?.({
|
|
90
|
+
evt: 'cli.suite.add.duplicate_step',
|
|
91
|
+
suite: suiteName,
|
|
92
|
+
configPath,
|
|
93
|
+
msg: 'Suite step already exists; leaving config unchanged.',
|
|
94
|
+
});
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
yamlSeq.add(step);
|
|
98
|
+
writeFileSync(configPath, doc.toString(), 'utf8');
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
function yamlNodeToJson(item) {
|
|
102
|
+
if (item && typeof item === 'object' && 'toJSON' in item) {
|
|
103
|
+
return item.toJSON();
|
|
104
|
+
}
|
|
105
|
+
return item;
|
|
106
|
+
}
|
|
107
|
+
function readOrCreateDocument(configPath) {
|
|
108
|
+
if (!existsSync(configPath))
|
|
109
|
+
return parseDocument('');
|
|
110
|
+
const stat = statSync(configPath);
|
|
111
|
+
if (stat.size > MAX_EDITABLE_CONFIG_BYTES) {
|
|
112
|
+
throw new ConfigurationError(`Cannot edit ${configPath}: file is larger than ${MAX_EDITABLE_CONFIG_BYTES} bytes.`, { code: 'CONFIG.SUITE_ADD.CONFIG_TOO_LARGE' });
|
|
113
|
+
}
|
|
114
|
+
const doc = parseDocument(readFileSync(configPath, 'utf8'));
|
|
115
|
+
if (doc.errors.length > 0) {
|
|
116
|
+
const first = doc.errors[0]?.message ?? 'unknown YAML error';
|
|
117
|
+
throw new ConfigurationError(`Cannot edit ${configPath}: ${first}.`, {
|
|
118
|
+
code: 'CONFIG.SUITE_ADD.MALFORMED_YAML',
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
return doc;
|
|
122
|
+
}
|
|
123
|
+
function ensureRootMap(doc, configPath) {
|
|
124
|
+
doc.contents ??= doc.createNode({});
|
|
125
|
+
if (!isMap(doc.contents)) {
|
|
126
|
+
throw new ConfigurationError(`Cannot edit ${configPath}: opensip-cli.config.yml must start with a YAML map.`, { code: 'CONFIG.SUITE_ADD.NON_MAP_CONFIG' });
|
|
127
|
+
}
|
|
128
|
+
return doc.contents;
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=suite-add.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suite-add.js","sourceRoot":"","sources":["../../../src/commands/suite/suite-add.ts"],"names":[],"mappings":"AAAA,wNAAwN;AACxN,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC5E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAa,MAAM,mBAAmB,CAAC;AACjF,OAAO,EAAE,KAAK,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