@opensip-cli/contracts 0.1.0
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/LICENSE +202 -0
- package/NOTICE +8 -0
- package/README.md +31 -0
- package/dist/__tests__/exit-codes.test.d.ts +2 -0
- package/dist/__tests__/exit-codes.test.d.ts.map +1 -0
- package/dist/__tests__/exit-codes.test.js +185 -0
- package/dist/__tests__/exit-codes.test.js.map +1 -0
- package/dist/__tests__/manifest-reexport.test.d.ts +6 -0
- package/dist/__tests__/manifest-reexport.test.d.ts.map +1 -0
- package/dist/__tests__/manifest-reexport.test.js +38 -0
- package/dist/__tests__/manifest-reexport.test.js.map +1 -0
- package/dist/__tests__/types-only.test.d.ts +10 -0
- package/dist/__tests__/types-only.test.d.ts.map +1 -0
- package/dist/__tests__/types-only.test.js +49 -0
- package/dist/__tests__/types-only.test.js.map +1 -0
- package/dist/cli-flags.d.ts +56 -0
- package/dist/cli-flags.d.ts.map +1 -0
- package/dist/cli-flags.js +85 -0
- package/dist/cli-flags.js.map +1 -0
- package/dist/cli-flags.test.d.ts +2 -0
- package/dist/cli-flags.test.d.ts.map +1 -0
- package/dist/cli-flags.test.js +51 -0
- package/dist/cli-flags.test.js.map +1 -0
- package/dist/command-outcome.d.ts +87 -0
- package/dist/command-outcome.d.ts.map +1 -0
- package/dist/command-outcome.js +32 -0
- package/dist/command-outcome.js.map +1 -0
- package/dist/command-outcome.test.d.ts +10 -0
- package/dist/command-outcome.test.d.ts.map +1 -0
- package/dist/command-outcome.test.js +68 -0
- package/dist/command-outcome.test.js.map +1 -0
- package/dist/command-results.d.ts +501 -0
- package/dist/command-results.d.ts.map +1 -0
- package/dist/command-results.js +14 -0
- package/dist/command-results.js.map +1 -0
- package/dist/exit-codes.d.ts +44 -0
- package/dist/exit-codes.d.ts.map +1 -0
- package/dist/exit-codes.js +186 -0
- package/dist/exit-codes.js.map +1 -0
- package/dist/graph-catalog.d.ts +143 -0
- package/dist/graph-catalog.d.ts.map +1 -0
- package/dist/graph-catalog.js +13 -0
- package/dist/graph-catalog.js.map +1 -0
- package/dist/index.d.ts +62 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +56 -0
- package/dist/index.js.map +1 -0
- package/dist/recipe-default.d.ts +53 -0
- package/dist/recipe-default.d.ts.map +1 -0
- package/dist/recipe-default.js +55 -0
- package/dist/recipe-default.js.map +1 -0
- package/dist/recipe-default.test.d.ts +2 -0
- package/dist/recipe-default.test.d.ts.map +1 -0
- package/dist/recipe-default.test.js +32 -0
- package/dist/recipe-default.test.js.map +1 -0
- package/dist/score.d.ts +26 -0
- package/dist/score.d.ts.map +1 -0
- package/dist/score.js +25 -0
- package/dist/score.js.map +1 -0
- package/dist/score.test.d.ts +2 -0
- package/dist/score.test.d.ts.map +1 -0
- package/dist/score.test.js +22 -0
- package/dist/score.test.js.map +1 -0
- package/dist/session-types.d.ts +132 -0
- package/dist/session-types.d.ts.map +1 -0
- package/dist/session-types.js +11 -0
- package/dist/session-types.js.map +1 -0
- package/dist/signal-envelope.d.ts +118 -0
- package/dist/signal-envelope.d.ts.map +1 -0
- package/dist/signal-envelope.js +84 -0
- package/dist/signal-envelope.js.map +1 -0
- package/dist/signal-envelope.test.d.ts +2 -0
- package/dist/signal-envelope.test.d.ts.map +1 -0
- package/dist/signal-envelope.test.js +168 -0
- package/dist/signal-envelope.test.js.map +1 -0
- package/dist/types.d.ts +78 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/dist/verbose-detail.d.ts +26 -0
- package/dist/verbose-detail.d.ts.map +1 -0
- package/dist/verbose-detail.js +75 -0
- package/dist/verbose-detail.js.map +1 -0
- package/dist/verbose-detail.test.d.ts +2 -0
- package/dist/verbose-detail.test.d.ts.map +1 -0
- package/dist/verbose-detail.test.js +53 -0
- package/dist/verbose-detail.test.js.map +1 -0
- package/dist/verdict-envelope.test.d.ts +8 -0
- package/dist/verdict-envelope.test.d.ts.map +1 -0
- package/dist/verdict-envelope.test.js +67 -0
- package/dist/verdict-envelope.test.js.map +1 -0
- package/package.json +56 -0
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CommandResult — the discriminated union of every command outcome, plus its
|
|
3
|
+
* per-command variant interfaces.
|
|
4
|
+
*
|
|
5
|
+
* Extracted from `types.ts` so that file stays focused on CLI option / output
|
|
6
|
+
* shapes and neither grows past the file-length limit. This module depends on
|
|
7
|
+
* `session-types.ts` for `StoredSession` and `signal-envelope.ts` for the
|
|
8
|
+
* `SignalEnvelope` every migrated tool returns; `types.ts` does NOT import
|
|
9
|
+
* back, so there is no cycle. Re-exported from the package barrel
|
|
10
|
+
* (`index.ts`), so consumers still import these from `@opensip-cli/contracts`.
|
|
11
|
+
*/
|
|
12
|
+
import type { StoredSession } from './session-types.js';
|
|
13
|
+
import type { SignalEnvelope } from './signal-envelope.js';
|
|
14
|
+
import type { ToolProvenance } from '@opensip-cli/core';
|
|
15
|
+
/** One displayed finding inside a verbose findings group. Display fields only —
|
|
16
|
+
* no core `Signal` type leaks into contracts. */
|
|
17
|
+
export interface FindingLine {
|
|
18
|
+
readonly severity: 'error' | 'warning';
|
|
19
|
+
readonly message: string;
|
|
20
|
+
/** Source location for display, e.g. `"path/to/file.ts:42"`. */
|
|
21
|
+
readonly location?: string;
|
|
22
|
+
readonly suggestion?: string;
|
|
23
|
+
}
|
|
24
|
+
/** A verbose findings block — one per unit (check / scenario) that emitted ≥1
|
|
25
|
+
* finding, or that errored. */
|
|
26
|
+
export interface FindingGroup {
|
|
27
|
+
/** Display name (pretty), falling back to the unit slug. */
|
|
28
|
+
readonly title: string;
|
|
29
|
+
/** Set when the unit itself errored (vs. emitted findings). */
|
|
30
|
+
readonly error?: string;
|
|
31
|
+
readonly errorCount: number;
|
|
32
|
+
readonly warningCount: number;
|
|
33
|
+
readonly findings: readonly FindingLine[];
|
|
34
|
+
}
|
|
35
|
+
/** Renderer-agnostic verbose detail body carried on a migrated `*DoneResult`.
|
|
36
|
+
* `resultToView` switches on `kind`: `lines` → verbatim text; `findings` → the
|
|
37
|
+
* coloured findings block (rendered identically in Ink and plain text). */
|
|
38
|
+
export type VerboseDetail = {
|
|
39
|
+
readonly kind: 'lines';
|
|
40
|
+
readonly lines: readonly string[];
|
|
41
|
+
} | {
|
|
42
|
+
readonly kind: 'findings';
|
|
43
|
+
readonly groups: readonly FindingGroup[];
|
|
44
|
+
};
|
|
45
|
+
/** Union type for all command results — App.tsx dispatches on result.type */
|
|
46
|
+
export type CommandResult = FitDoneResult | SimDoneResult | GraphDoneResult | GateDoneResult | GraphStatusResult | ListChecksResult | ListRecipesResult | HistoryResult | ReportResult | InitResult | SimNoticeResult | PluginResult | ClearDoneResult | ConfigureDoneResult | UninstallDoneResult | TextLinesResult | ToolsListResult | ToolsValidateResult | ToolsInstallResult | ToolsUninstallResult | ToolsDataPurgeResult | SessionReplayResult | HelpResult | ErrorResult;
|
|
47
|
+
/** Outcome of an `opensip uninstall` run. */
|
|
48
|
+
export interface UninstallDoneResult {
|
|
49
|
+
type: 'uninstall-done';
|
|
50
|
+
/** Discriminator on the dispatch the run took. */
|
|
51
|
+
action: 'removed' | 'dry-run' | 'cancelled' | 'empty';
|
|
52
|
+
/** 'user' (default) or 'project' (`--project [path]`). */
|
|
53
|
+
mode: 'user' | 'project';
|
|
54
|
+
/** Targets considered for removal. Empty when `action === 'empty'`. */
|
|
55
|
+
targets: readonly {
|
|
56
|
+
readonly path: string;
|
|
57
|
+
readonly kind: 'file' | 'dir';
|
|
58
|
+
}[];
|
|
59
|
+
/** Total bytes the targets occupied on disk (0 when nothing was found). */
|
|
60
|
+
sizeBytes: number;
|
|
61
|
+
/** Resolved root that was probed (user-level dir or project dir). */
|
|
62
|
+
rootPath: string;
|
|
63
|
+
}
|
|
64
|
+
export interface ClearDoneResult {
|
|
65
|
+
type: 'clear-done';
|
|
66
|
+
action: 'done' | 'cancelled' | 'empty';
|
|
67
|
+
deletedCount: number;
|
|
68
|
+
sessionCount: number;
|
|
69
|
+
}
|
|
70
|
+
/** Outcome of an `opensip configure` interactive run. */
|
|
71
|
+
export interface ConfigureDoneResult {
|
|
72
|
+
type: 'configure-done';
|
|
73
|
+
/** Where the global config landed on disk. */
|
|
74
|
+
configPath: string;
|
|
75
|
+
/** Discriminator: did the user supply a key, or bail at the prompt? */
|
|
76
|
+
action: 'saved' | 'cancelled';
|
|
77
|
+
/** When `action === 'saved'`, the masked-for-display key (`abcd…wxyz`). */
|
|
78
|
+
maskedKey?: string;
|
|
79
|
+
}
|
|
80
|
+
export interface FitDoneResult {
|
|
81
|
+
type: 'fit-done';
|
|
82
|
+
label: string;
|
|
83
|
+
cwd: string;
|
|
84
|
+
/**
|
|
85
|
+
* The run's signal envelope (ADR-0011). REQUIRED since Phase 6 (fitness is
|
|
86
|
+
* migrated): the composition root derives the terminal table (one row per
|
|
87
|
+
* check `unit`, grouped by `signal.source === checkSlug`) and the
|
|
88
|
+
* `--json`/cloud/`--report-to` paths FROM this envelope. The fitness-only
|
|
89
|
+
* `Validated`/`Ignores` columns ride on `envelope.units` as
|
|
90
|
+
* `filesValidated`/`itemType`/`ignoredCount`.
|
|
91
|
+
*/
|
|
92
|
+
envelope: SignalEnvelope;
|
|
93
|
+
reportStatus?: {
|
|
94
|
+
url: string;
|
|
95
|
+
findingCount: number;
|
|
96
|
+
runCount: number;
|
|
97
|
+
success: boolean;
|
|
98
|
+
error?: string;
|
|
99
|
+
chunksTotal?: number;
|
|
100
|
+
chunksSucceeded?: number;
|
|
101
|
+
};
|
|
102
|
+
/** Whether an opensip-cli.config.yml was found in the target directory */
|
|
103
|
+
configFound?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Verbose detail body (ADR-0021), present only on `--verbose` runs.
|
|
106
|
+
* Rendered by the shared `resultToView` seam so the detail is identical
|
|
107
|
+
* in a TTY and a pipe. Fit populates the `findings` kind.
|
|
108
|
+
*/
|
|
109
|
+
readonly verboseDetail?: VerboseDetail;
|
|
110
|
+
/**
|
|
111
|
+
* User-facing non-fatal warnings collected during the run (plugin load
|
|
112
|
+
* failures, unknown languages in config, missing check packages, etc.).
|
|
113
|
+
*
|
|
114
|
+
* These flow through the result rather than direct stderr writes because
|
|
115
|
+
* the live-view renderer (Ink) owns the screen and any ambient stderr
|
|
116
|
+
* write during render desyncs Ink's cursor tracking. Renderers display
|
|
117
|
+
* these in the summary; non-Ink paths (--json, gate modes) surface them
|
|
118
|
+
* at their own boundary.
|
|
119
|
+
*/
|
|
120
|
+
warnings?: readonly string[];
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Outcome of a `graph <scope>` run on the non-`--json` path. Carries only
|
|
124
|
+
* plain data (no graph types — contracts sits below graph) so `resultToView`
|
|
125
|
+
* can express it as a view-model the render seam emits as Ink or plain text.
|
|
126
|
+
*/
|
|
127
|
+
export interface GraphDoneResult {
|
|
128
|
+
type: 'graph-done';
|
|
129
|
+
/** Fast-tier approximation caveat, or `undefined` for an exact catalog. */
|
|
130
|
+
readonly resolutionBanner?: string;
|
|
131
|
+
/** Counts for the shared one-line PASS/FAIL summary. */
|
|
132
|
+
readonly summary: {
|
|
133
|
+
readonly passed: number;
|
|
134
|
+
readonly failed: number;
|
|
135
|
+
readonly errors: number;
|
|
136
|
+
readonly warnings: number;
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* Duration for the top-level summary line (host-owned-run-timing).
|
|
140
|
+
* After migration this field will be omitted from the result (the host
|
|
141
|
+
* timer supplies the value that matches the persisted StoredSession so
|
|
142
|
+
* CLI summary, sessions list, and report agree). Optional during the
|
|
143
|
+
* transition; when absent the render layer falls back to the host RunTimer.
|
|
144
|
+
*/
|
|
145
|
+
readonly durationMs?: number;
|
|
146
|
+
/**
|
|
147
|
+
* Verbose detail body (ADR-0021). Graph populates the `lines` kind (its
|
|
148
|
+
* catalog / findings-by-rule / entry-point dump). Rendered by the shared
|
|
149
|
+
* `resultToView` seam; the non-verbose footer hints are emitted by the seam
|
|
150
|
+
* too (the old per-result `reportLines`/`footerHints` were retired here).
|
|
151
|
+
*/
|
|
152
|
+
readonly verboseDetail?: VerboseDetail;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Outcome of a `fit --gate-save` / `fit --gate-compare` run on the
|
|
156
|
+
* non-`--json` path. Carries the already-composed lines so the render seam
|
|
157
|
+
* emits them as Ink or plain text. Exit code (degraded → 1) set by the caller.
|
|
158
|
+
*/
|
|
159
|
+
export interface GateDoneResult {
|
|
160
|
+
type: 'gate-done';
|
|
161
|
+
/** Full gate output, one string per line (save summary or compare report). */
|
|
162
|
+
readonly lines: readonly string[];
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Generic carrier for graph's line-oriented mode output that has no Ink
|
|
166
|
+
* component twin: `graph-lookup`, `--workspace`, and the `--report-to` status
|
|
167
|
+
* line. Carries pre-composed plain lines (no graph types — contracts sits
|
|
168
|
+
* below graph) so the render seam emits them as Ink or plain text instead of
|
|
169
|
+
* the command writing to stdout directly. The `--json` paths for these
|
|
170
|
+
* commands are unaffected and still write their machine output at their own
|
|
171
|
+
* boundary.
|
|
172
|
+
*/
|
|
173
|
+
export interface GraphStatusResult {
|
|
174
|
+
type: 'graph-status';
|
|
175
|
+
/** Pre-composed report lines, one string per line. */
|
|
176
|
+
readonly lines: readonly string[];
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Generic human-readable line carrier for extension commands that do not need a
|
|
180
|
+
* bespoke first-party view. This keeps `command-result` usable without adding a
|
|
181
|
+
* new closed union member for every simple command shape.
|
|
182
|
+
*/
|
|
183
|
+
export interface TextLinesResult {
|
|
184
|
+
type: 'text-lines';
|
|
185
|
+
/** Optional heading rendered above the lines. */
|
|
186
|
+
readonly title?: string;
|
|
187
|
+
/** Pre-composed display lines, one string per line. */
|
|
188
|
+
readonly lines: readonly string[];
|
|
189
|
+
}
|
|
190
|
+
/** One row of the `tools list` effective-tool inventory (ADR-0041). */
|
|
191
|
+
export interface ToolsListRow {
|
|
192
|
+
/** The tool's stable id (from its manifest; package name when unreadable). */
|
|
193
|
+
readonly id: string;
|
|
194
|
+
/** npm package name, when the tool is a package install. */
|
|
195
|
+
readonly packageName?: string;
|
|
196
|
+
readonly version: string;
|
|
197
|
+
/** Where the tool comes from, in the user-facing vocabulary. */
|
|
198
|
+
readonly source: 'bundled' | 'global' | 'project';
|
|
199
|
+
/** Command names the manifest declares (names only — no runtime is loaded). */
|
|
200
|
+
readonly commands: readonly string[];
|
|
201
|
+
/**
|
|
202
|
+
* `loaded` — admitted by THIS run's bootstrap; `manifest-only` — present on
|
|
203
|
+
* disk (marker + manifest file read) but not loaded this run. `tools list`
|
|
204
|
+
* never dynamic-imports a runtime, so this is as much as a listing can know.
|
|
205
|
+
*/
|
|
206
|
+
readonly status: 'loaded' | 'manifest-only';
|
|
207
|
+
/** True on a GLOBAL row whose tool id is shadowed by a project-local install. */
|
|
208
|
+
readonly shadowed?: boolean;
|
|
209
|
+
}
|
|
210
|
+
/** Outcome of `opensip tools list` (ADR-0041). */
|
|
211
|
+
export interface ToolsListResult {
|
|
212
|
+
type: 'tools-list';
|
|
213
|
+
tools: readonly ToolsListRow[];
|
|
214
|
+
totalCount: number;
|
|
215
|
+
}
|
|
216
|
+
/** One `tools validate` report section (ADR-0041 / ADR-0042 Tier A). */
|
|
217
|
+
export interface ToolsValidateSection {
|
|
218
|
+
readonly name: string;
|
|
219
|
+
/**
|
|
220
|
+
* `skipped` = the section could not run AND that is expected (in-place path
|
|
221
|
+
* validation without `--install-deps`); it still makes the overall verdict
|
|
222
|
+
* `incomplete`, never `passed` — an unverified runtime is not a pass.
|
|
223
|
+
*/
|
|
224
|
+
readonly status: 'passed' | 'failed' | 'skipped';
|
|
225
|
+
readonly diagnostics: readonly string[];
|
|
226
|
+
}
|
|
227
|
+
/** Outcome of `opensip tools validate <spec>` (ADR-0041). */
|
|
228
|
+
export interface ToolsValidateResult {
|
|
229
|
+
type: 'tools-validate';
|
|
230
|
+
readonly spec: string;
|
|
231
|
+
readonly toolId?: string;
|
|
232
|
+
readonly verdict: 'passed' | 'failed' | 'incomplete';
|
|
233
|
+
readonly sections: readonly ToolsValidateSection[];
|
|
234
|
+
}
|
|
235
|
+
/** Outcome of `opensip tools install <spec>` (ADR-0041): stage → validate → activate. */
|
|
236
|
+
export interface ToolsInstallResult {
|
|
237
|
+
type: 'tools-install';
|
|
238
|
+
readonly spec: string;
|
|
239
|
+
readonly success: boolean;
|
|
240
|
+
/** The requested install scope. */
|
|
241
|
+
readonly scope: 'global' | 'project';
|
|
242
|
+
/** The full validation report the activation decision was made on. */
|
|
243
|
+
readonly validation: ToolsValidateResult;
|
|
244
|
+
readonly toolId?: string;
|
|
245
|
+
readonly version?: string;
|
|
246
|
+
/** Activation-step failure detail (validation failures live in `validation`). */
|
|
247
|
+
readonly error?: string;
|
|
248
|
+
}
|
|
249
|
+
/** Outcome of `opensip tools data-purge <tool-id>` (ADR-0042): per-tool row counts. */
|
|
250
|
+
export interface ToolsDataPurgeResult {
|
|
251
|
+
type: 'tools-data-purge';
|
|
252
|
+
readonly toolId: string;
|
|
253
|
+
readonly sessions: number;
|
|
254
|
+
readonly baselineEntries: number;
|
|
255
|
+
/** Whether a baseline existence marker was removed. */
|
|
256
|
+
readonly baselineMeta: boolean;
|
|
257
|
+
readonly stateRows: number;
|
|
258
|
+
}
|
|
259
|
+
/** Outcome of `opensip tools uninstall <name-or-id>` (ADR-0041). */
|
|
260
|
+
export interface ToolsUninstallResult {
|
|
261
|
+
type: 'tools-uninstall';
|
|
262
|
+
/** The id-or-package-name argument as given. */
|
|
263
|
+
readonly target: string;
|
|
264
|
+
readonly success: boolean;
|
|
265
|
+
/** The resolved identity that was removed (displayed before deletion). */
|
|
266
|
+
readonly removed?: {
|
|
267
|
+
readonly id: string;
|
|
268
|
+
readonly packageName: string;
|
|
269
|
+
readonly scope: 'global' | 'project';
|
|
270
|
+
};
|
|
271
|
+
readonly error?: string;
|
|
272
|
+
}
|
|
273
|
+
export interface ListChecksResult {
|
|
274
|
+
type: 'list-checks';
|
|
275
|
+
checks: {
|
|
276
|
+
slug: string;
|
|
277
|
+
description: string;
|
|
278
|
+
tags: string[];
|
|
279
|
+
}[];
|
|
280
|
+
totalCount: number;
|
|
281
|
+
}
|
|
282
|
+
export interface ListRecipesResult {
|
|
283
|
+
type: 'list-recipes';
|
|
284
|
+
recipes: {
|
|
285
|
+
name: string;
|
|
286
|
+
description: string;
|
|
287
|
+
checkCount: string;
|
|
288
|
+
}[];
|
|
289
|
+
}
|
|
290
|
+
export interface HistorySession extends StoredSession {
|
|
291
|
+
readonly summary?: {
|
|
292
|
+
readonly total: number;
|
|
293
|
+
readonly passed: number;
|
|
294
|
+
readonly failed: number;
|
|
295
|
+
readonly errors: number;
|
|
296
|
+
readonly warnings: number;
|
|
297
|
+
};
|
|
298
|
+
readonly showCommand: string;
|
|
299
|
+
}
|
|
300
|
+
export interface HistoryResult {
|
|
301
|
+
type: 'history';
|
|
302
|
+
sessions: HistorySession[];
|
|
303
|
+
}
|
|
304
|
+
export interface ReportResult {
|
|
305
|
+
type: 'report';
|
|
306
|
+
path: string;
|
|
307
|
+
opened: boolean;
|
|
308
|
+
}
|
|
309
|
+
/** Classification for a file present under `opensip-cli/` before init ran. */
|
|
310
|
+
export interface PreExistingFile {
|
|
311
|
+
readonly path: string;
|
|
312
|
+
readonly classification: 'scaffolded' | 'custom' | 'stale-scaffolded';
|
|
313
|
+
}
|
|
314
|
+
export interface InitResult {
|
|
315
|
+
type: 'init';
|
|
316
|
+
created: boolean;
|
|
317
|
+
path: string;
|
|
318
|
+
cwd: string;
|
|
319
|
+
configFilename: string;
|
|
320
|
+
/**
|
|
321
|
+
* Set when init refused because the user invoked it from inside an
|
|
322
|
+
* existing project without an explicit --cwd flag. Carries the
|
|
323
|
+
* discovered root path and the rendered message — the message is
|
|
324
|
+
* computed in init.ts so --json consumers get the same string the
|
|
325
|
+
* human-readable renderer prints.
|
|
326
|
+
*/
|
|
327
|
+
insideExistingProject?: {
|
|
328
|
+
readonly discoveredRoot: string;
|
|
329
|
+
readonly message: string;
|
|
330
|
+
};
|
|
331
|
+
/**
|
|
332
|
+
* The state of the working directory at init time. Useful for
|
|
333
|
+
* `--json` consumers and for the rendered output to show what
|
|
334
|
+
* happened. Absent when init bailed before classification (cwd
|
|
335
|
+
* missing, language unresolvable, mutex flag error).
|
|
336
|
+
*/
|
|
337
|
+
state?: 'pristine' | 'fully-initialized' | 'partial-config-only' | 'partial-dir-only';
|
|
338
|
+
/** Languages selected for this scaffold (post-detection or from --language). */
|
|
339
|
+
languages?: readonly ('typescript' | 'rust' | 'python' | 'go' | 'java' | 'cpp')[];
|
|
340
|
+
/**
|
|
341
|
+
* Every file init created, in display order. Includes the config
|
|
342
|
+
* file plus example check / recipe / scenario scaffolds. Empty
|
|
343
|
+
* when init refused to write anything.
|
|
344
|
+
*/
|
|
345
|
+
createdFiles?: readonly string[];
|
|
346
|
+
/** True when init appended `opensip-cli/.runtime/` to .gitignore. */
|
|
347
|
+
gitignoreUpdated?: boolean;
|
|
348
|
+
/**
|
|
349
|
+
* Files that existed before init ran, classified. Empty (or absent)
|
|
350
|
+
* in state 'pristine'. Populated for the other states so the user
|
|
351
|
+
* can see what survived (`--keep`) or was removed (`--remove`).
|
|
352
|
+
*/
|
|
353
|
+
preExistingFiles?: readonly PreExistingFile[];
|
|
354
|
+
/**
|
|
355
|
+
* When init refuses due to partial state (or fully-initialized state)
|
|
356
|
+
* and no flag was passed, surfaces what's there + a flag hint. Set
|
|
357
|
+
* together with `created: false`.
|
|
358
|
+
*/
|
|
359
|
+
partialStateError?: {
|
|
360
|
+
readonly state: 'partial-config-only' | 'partial-dir-only' | 'fully-initialized';
|
|
361
|
+
readonly preExistingFiles: readonly PreExistingFile[];
|
|
362
|
+
readonly message: string;
|
|
363
|
+
};
|
|
364
|
+
/**
|
|
365
|
+
* When detection is ambiguous and --language wasn't passed, init
|
|
366
|
+
* exits without writing anything and surfaces this error so the
|
|
367
|
+
* user can re-invoke with --language <list>.
|
|
368
|
+
*/
|
|
369
|
+
ambiguousLanguageError?: {
|
|
370
|
+
detected: readonly string[];
|
|
371
|
+
message: string;
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
export interface SimNoticeResult {
|
|
375
|
+
type: 'sim-notice';
|
|
376
|
+
tool: 'sim';
|
|
377
|
+
cwd: string;
|
|
378
|
+
}
|
|
379
|
+
/** Outcome of a `sim --recipe <name>` run. */
|
|
380
|
+
export interface SimDoneResult {
|
|
381
|
+
type: 'sim-done';
|
|
382
|
+
recipeName: string;
|
|
383
|
+
cwd: string;
|
|
384
|
+
/**
|
|
385
|
+
* Duration for the top-level summary line (host-owned-run-timing).
|
|
386
|
+
* See GraphDoneResult.durationMs for rationale; optional in transition.
|
|
387
|
+
*/
|
|
388
|
+
durationMs?: number;
|
|
389
|
+
/**
|
|
390
|
+
* The run's signal envelope (ADR-0011). REQUIRED since Phase 4 (sim is
|
|
391
|
+
* migrated): the composition root derives the terminal table (one row per
|
|
392
|
+
* scenario `unit`, grouped by `signal.source === scenarioId`) and the
|
|
393
|
+
* `--json`/cloud/`--report-to` paths FROM this envelope. The per-scenario
|
|
394
|
+
* pass/fail summary is recovered from `envelope.units`, so no scenario
|
|
395
|
+
* summary fields are duplicated on the result.
|
|
396
|
+
*/
|
|
397
|
+
envelope: SignalEnvelope;
|
|
398
|
+
/**
|
|
399
|
+
* Verbose detail body (ADR-0021), present only on `--verbose` runs. Rendered
|
|
400
|
+
* by the shared `resultToView` seam. Sim populates the `findings` kind
|
|
401
|
+
* (per-scenario detail).
|
|
402
|
+
*/
|
|
403
|
+
readonly verboseDetail?: VerboseDetail;
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Identity of a discovered plugin (exposed by `plugin list`).
|
|
407
|
+
* Mirrors the `DiscoveredPlugin` shape from core, but kept here as a
|
|
408
|
+
* separate contract type so the CLI ↔ plugin-result boundary is
|
|
409
|
+
* stable independently of core's internal representation.
|
|
410
|
+
*/
|
|
411
|
+
export interface PluginInfo {
|
|
412
|
+
readonly domain: string;
|
|
413
|
+
readonly namespace: string;
|
|
414
|
+
readonly pluginType: 'package' | 'file';
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Per-package status from `plugin sync`. `installed: true` means the
|
|
418
|
+
* `npm install` succeeded; `false` means it failed (the message is
|
|
419
|
+
* carried in the surrounding `errors[]`).
|
|
420
|
+
*/
|
|
421
|
+
export interface SyncEntry {
|
|
422
|
+
readonly domain: string;
|
|
423
|
+
readonly package: string;
|
|
424
|
+
readonly installed: boolean;
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Discriminated union — one variant per `plugin` subcommand. Each
|
|
428
|
+
* variant has its own top-level `type` literal, matching the rest of
|
|
429
|
+
* `CommandResult` (`'fit-done'`, `'sim-done'`, `'list-checks'`, …).
|
|
430
|
+
* Consumers switch on `result.type` directly; producer/consumer drift
|
|
431
|
+
* surfaces at compile time.
|
|
432
|
+
*/
|
|
433
|
+
export type PluginResult = {
|
|
434
|
+
type: 'plugin-list';
|
|
435
|
+
/**
|
|
436
|
+
* Ordered plugin domains to render, sourced from registered tool
|
|
437
|
+
* `pluginLayout` descriptors plus the built-in Tool plugin domain.
|
|
438
|
+
*/
|
|
439
|
+
domains: readonly string[];
|
|
440
|
+
plugins: readonly PluginInfo[];
|
|
441
|
+
totalCount: number;
|
|
442
|
+
/**
|
|
443
|
+
* Provenance of the tools admitted through the launch compatibility
|
|
444
|
+
* gate this run (source + identity + `manifestHash`). Additive — a
|
|
445
|
+
* parallel section to the discovered-plugin list, sourced from the
|
|
446
|
+
* per-run provenance holder, not from a disk re-scan. Empty array
|
|
447
|
+
* when no bootstrap ran (e.g. isolated unit tests).
|
|
448
|
+
*/
|
|
449
|
+
toolProvenance: readonly ToolProvenance[];
|
|
450
|
+
} | {
|
|
451
|
+
type: 'plugin-add';
|
|
452
|
+
packageName: string;
|
|
453
|
+
success: boolean;
|
|
454
|
+
error?: string;
|
|
455
|
+
} | {
|
|
456
|
+
type: 'plugin-remove';
|
|
457
|
+
packageName: string;
|
|
458
|
+
success: boolean;
|
|
459
|
+
error?: string;
|
|
460
|
+
} | {
|
|
461
|
+
type: 'plugin-sync';
|
|
462
|
+
synced: readonly SyncEntry[];
|
|
463
|
+
success: boolean;
|
|
464
|
+
errors?: readonly string[];
|
|
465
|
+
};
|
|
466
|
+
/**
|
|
467
|
+
* Outcome of `sessions show <ref>` (and the `--show` shorthand on fit/graph/sim)
|
|
468
|
+
* on the non-`--json` path. Unlike a live run, a replay is uniform across tools:
|
|
469
|
+
* it carries the projected {@link SignalEnvelope} (ADR-0011) + display metadata,
|
|
470
|
+
* and `resultToView` renders it through the SAME shared envelope→table view every
|
|
471
|
+
* tool's live results use — so a replayed graph session finally shows a table,
|
|
472
|
+
* and none of them show the live-run "Use --verbose / report" footer (which is
|
|
473
|
+
* guidance for a fresh run, not a replay).
|
|
474
|
+
*/
|
|
475
|
+
export interface SessionReplayResult {
|
|
476
|
+
type: 'session-replay';
|
|
477
|
+
readonly session: {
|
|
478
|
+
readonly id: string;
|
|
479
|
+
readonly tool: string;
|
|
480
|
+
readonly startedAt: string;
|
|
481
|
+
readonly completedAt: string;
|
|
482
|
+
readonly recipe?: string;
|
|
483
|
+
readonly score: number;
|
|
484
|
+
readonly passed: boolean;
|
|
485
|
+
readonly durationMs: number;
|
|
486
|
+
};
|
|
487
|
+
/** The projected run envelope — rendered via the shared per-unit table. */
|
|
488
|
+
readonly envelope: SignalEnvelope;
|
|
489
|
+
/** Replay fidelity, e.g. `'projection'` (rebuilt from persisted findings). */
|
|
490
|
+
readonly fidelity: string;
|
|
491
|
+
}
|
|
492
|
+
export interface HelpResult {
|
|
493
|
+
type: 'help';
|
|
494
|
+
}
|
|
495
|
+
export interface ErrorResult {
|
|
496
|
+
type: 'error';
|
|
497
|
+
message: string;
|
|
498
|
+
suggestion?: string;
|
|
499
|
+
exitCode: number;
|
|
500
|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AE,IAAI,EAAE,eAAe,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAChF;IACE,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,SAAS,SAAS,EAAE,CAAC;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5B,CAAC;AAEN;;;;;;;;GAQG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,gBAAgB,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE;QAChB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;QAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;QAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;QACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;KAC7B,CAAC;IACF,2EAA2E;IAC3E,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,8EAA8E;IAC9E,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// @fitness-ignore-file file-length-limit -- one cohesive contract surface: the CommandResult discriminated union plus every per-command variant interface, each member carrying load-bearing JSDoc. Splitting the union across files would fragment the single type the host renders/dispatches. Sits just past the 400-line soft limit (and only shrank under ADR-0035, which removed the per-tool exit-flag field).
|
|
2
|
+
/**
|
|
3
|
+
* CommandResult — the discriminated union of every command outcome, plus its
|
|
4
|
+
* per-command variant interfaces.
|
|
5
|
+
*
|
|
6
|
+
* Extracted from `types.ts` so that file stays focused on CLI option / output
|
|
7
|
+
* shapes and neither grows past the file-length limit. This module depends on
|
|
8
|
+
* `session-types.ts` for `StoredSession` and `signal-envelope.ts` for the
|
|
9
|
+
* `SignalEnvelope` every migrated tool returns; `types.ts` does NOT import
|
|
10
|
+
* back, so there is no cycle. Re-exported from the package barrel
|
|
11
|
+
* (`index.ts`), so consumers still import these from `@opensip-cli/contracts`.
|
|
12
|
+
*/
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=command-results.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-results.js","sourceRoot":"","sources":["../src/command-results.ts"],"names":[],"mappings":"AAAA,sZAAsZ;AACtZ;;;;;;;;;;GAUG"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type ToolError } from '@opensip-cli/core';
|
|
2
|
+
export declare const EXIT_CODES: {
|
|
3
|
+
readonly SUCCESS: 0;
|
|
4
|
+
readonly RUNTIME_ERROR: 1;
|
|
5
|
+
readonly CONFIGURATION_ERROR: 2;
|
|
6
|
+
readonly CHECK_NOT_FOUND: 3;
|
|
7
|
+
readonly REPORT_FAILED: 4;
|
|
8
|
+
/**
|
|
9
|
+
* A plugin was rejected by the compatibility gate (launch) — its
|
|
10
|
+
* declared `apiVersion` is out of range and it was explicitly requested
|
|
11
|
+
* (fail-closed; the skip path is silent). Dedicated rather than reusing
|
|
12
|
+
* `CONFIGURATION_ERROR` so an incompatible plugin is diagnosable from the
|
|
13
|
+
* exit code alone. Read by the CLI fail-closed admission path (Phase 3).
|
|
14
|
+
*/
|
|
15
|
+
readonly PLUGIN_INCOMPATIBLE: 5;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Canonical mapping from typed `ToolError` subclasses to CLI exit
|
|
19
|
+
* codes. This is the single source of truth for how typed errors flow
|
|
20
|
+
* into the process exit code — both the CLI's top-level
|
|
21
|
+
* `handleParseError` and any tool that chooses to handle its own
|
|
22
|
+
* `ToolError` locally route through this function.
|
|
23
|
+
*
|
|
24
|
+
* The mapping policy (see `Tool` interface JSDoc in
|
|
25
|
+
* `@opensip-cli/core` for the full contract):
|
|
26
|
+
*
|
|
27
|
+
* - `NotFoundError` → `CHECK_NOT_FOUND` (exit 3)
|
|
28
|
+
* - `ConfigurationError` → `CONFIGURATION_ERROR` (exit 2)
|
|
29
|
+
* - `ValidationError` → `CONFIGURATION_ERROR` (exit 2)
|
|
30
|
+
* - `NetworkError` → `REPORT_FAILED` (exit 4)
|
|
31
|
+
* - `PluginIncompatibleError`→ `PLUGIN_INCOMPATIBLE` (exit 5)
|
|
32
|
+
* - `TimeoutError` → `RUNTIME_ERROR` (exit 1)
|
|
33
|
+
* - any other `ToolError` → `RUNTIME_ERROR` (exit 1)
|
|
34
|
+
*/
|
|
35
|
+
export declare function mapToolErrorToExitCode(error: ToolError): number;
|
|
36
|
+
/** Human-readable diagnosis surfaced when a tool fails, with the exit code it maps to. */
|
|
37
|
+
export interface ErrorSuggestion {
|
|
38
|
+
message: string;
|
|
39
|
+
action?: string;
|
|
40
|
+
exitCode: number;
|
|
41
|
+
}
|
|
42
|
+
/** Matches an arbitrary error against the suggestion-rule table; returns null if no rule fires. */
|
|
43
|
+
export declare function getErrorSuggestion(err: unknown): ErrorSuggestion | null;
|
|
44
|
+
//# sourceMappingURL=exit-codes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exit-codes.d.ts","sourceRoot":"","sources":["../src/exit-codes.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,mBAAmB,CAAC;AAE3B,eAAO,MAAM,UAAU;;;;;;IAMrB;;;;;;OAMG;;CAEK,CAAC;AAEX;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAQ/D;AAED,0FAA0F;AAC1F,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AA4JD,mGAAmG;AACnG,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,eAAe,GAAG,IAAI,CAWvE"}
|