mandrel 1.58.0 → 1.59.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/.agents/README.md +89 -87
- package/.agents/docs/SDLC.md +11 -7
- package/.agents/docs/workflows.md +2 -1
- package/.agents/schemas/audit-rules.json +20 -0
- package/.agents/scripts/acceptance-eval.js +20 -3
- package/.agents/scripts/assert-branch.js +1 -3
- package/.agents/scripts/bootstrap.js +1 -1
- package/.agents/scripts/check-arch-cycles.js +360 -0
- package/.agents/scripts/coverage-capture.js +24 -3
- package/.agents/scripts/epic-deliver-preflight.js +5 -3
- package/.agents/scripts/epic-deliver-prepare.js +12 -4
- package/.agents/scripts/epic-execute-record-wave.js +1 -1
- package/.agents/scripts/evidence-gate.js +1 -1
- package/.agents/scripts/git-rebase-and-resolve.js +1 -1
- package/.agents/scripts/hierarchy-gate.js +34 -14
- package/.agents/scripts/lib/baselines/kinds/coverage.js +33 -149
- package/.agents/scripts/lib/baselines/kinds/duplication.js +27 -116
- package/.agents/scripts/lib/baselines/kinds/kind-factory.js +192 -0
- package/.agents/scripts/lib/baselines/kinds/lighthouse.js +34 -133
- package/.agents/scripts/lib/baselines/kinds/maintainability.js +31 -124
- package/.agents/scripts/lib/baselines/kinds/mutation.js +25 -111
- package/.agents/scripts/lib/baselines/maintainability-baseline-io.js +59 -0
- package/.agents/scripts/lib/baselines/maintainability-baseline-save.js +37 -0
- package/.agents/scripts/lib/baselines/writer.js +1 -1
- package/.agents/scripts/lib/close-validation/commands.js +188 -0
- package/.agents/scripts/lib/close-validation/gates.js +235 -0
- package/.agents/scripts/lib/close-validation/process.js +101 -0
- package/.agents/scripts/lib/close-validation/projections/maintainability.js +1 -1
- package/.agents/scripts/lib/close-validation/runner.js +325 -0
- package/.agents/scripts/lib/close-validation/telemetry.js +70 -0
- package/.agents/scripts/lib/config/quality.js +6 -6
- package/.agents/scripts/lib/config-resolver.js +2 -5
- package/.agents/scripts/lib/coverage-capture.js +147 -4
- package/.agents/scripts/lib/cpu-pool.js +14 -0
- package/.agents/scripts/lib/crap-utils.js +6 -11
- package/.agents/scripts/lib/dynamic-workflow/documentation-report-contract.js +87 -0
- package/.agents/scripts/lib/git-utils.js +24 -22
- package/.agents/scripts/lib/maintainability-engine.js +1 -1
- package/.agents/scripts/lib/maintainability-utils.js +4 -187
- package/.agents/scripts/lib/observability/perf-report-readers.js +32 -23
- package/.agents/scripts/lib/orchestration/acceptance-eval-decision.js +80 -6
- package/.agents/scripts/lib/orchestration/code-review.js +90 -77
- package/.agents/scripts/lib/orchestration/dispatch-pipeline.js +5 -12
- package/.agents/scripts/lib/orchestration/epic-deliver-lease-guard.js +14 -14
- package/.agents/scripts/lib/orchestration/epic-plan-decompose/phases/planning-artifacts.js +2 -2
- package/.agents/scripts/lib/orchestration/epic-plan-lease-guard.js +184 -49
- package/.agents/scripts/lib/orchestration/epic-plan-spec/phases/drain.js +1 -1
- package/.agents/scripts/lib/orchestration/epic-plan-spec/phases/plan-epic.js +26 -2
- package/.agents/scripts/lib/orchestration/epic-plan-spec/phases/run-spec-phase.js +26 -6
- package/.agents/scripts/lib/orchestration/epic-runner/phases/build-wave-dag.js +7 -20
- package/.agents/scripts/lib/orchestration/epic-runner/progress-reporter/composition.js +1 -2
- package/.agents/scripts/lib/orchestration/epic-runner/progress-reporter/signals.js +0 -6
- package/.agents/scripts/lib/orchestration/epic-runner/progress-signals/component-drift.js +103 -0
- package/.agents/scripts/lib/orchestration/epic-runner/progress-signals/crap-drift.js +22 -64
- package/.agents/scripts/lib/orchestration/epic-runner/progress-signals/maintainability-drift.js +38 -76
- package/.agents/scripts/lib/orchestration/epic-runner/story-run-progress-writer.js +2 -2
- package/.agents/scripts/lib/orchestration/epic-runner/sub-agent-return.js +4 -16
- package/.agents/scripts/lib/orchestration/file-assumptions.js +4 -3
- package/.agents/scripts/lib/orchestration/lease-guard-shared.js +144 -0
- package/.agents/scripts/lib/orchestration/lifecycle/emit-story-heartbeat.js +2 -2
- package/.agents/scripts/lib/orchestration/lifecycle/listeners/watcher.js +7 -7
- package/.agents/scripts/lib/orchestration/post-merge/phases/notification.js +3 -3
- package/.agents/scripts/lib/orchestration/post-merge/phases/worktree-reap.js +7 -7
- package/.agents/scripts/lib/orchestration/preflight-cache.js +35 -12
- package/.agents/scripts/lib/orchestration/review-providers/codex.js +5 -60
- package/.agents/scripts/lib/orchestration/review-providers/native.js +7 -6
- package/.agents/scripts/lib/orchestration/review-providers/parse-findings.js +105 -0
- package/.agents/scripts/lib/orchestration/review-providers/security-review.js +7 -59
- package/.agents/scripts/lib/orchestration/single-story-close/phases/close-validation.js +2 -4
- package/.agents/scripts/lib/orchestration/single-story-close/phases/options.js +1 -1
- package/.agents/scripts/lib/orchestration/single-story-close/runner.js +2 -4
- package/.agents/scripts/lib/orchestration/single-story-lease-guard.js +32 -35
- package/.agents/scripts/lib/orchestration/skill-capsule-loader.js +1 -2
- package/.agents/scripts/lib/orchestration/story-close/auto-refresh-runner.js +451 -503
- package/.agents/scripts/lib/orchestration/story-close/baseline-attribution/phases/pre-merge-attribution.js +8 -2
- package/.agents/scripts/lib/orchestration/story-close/baseline-attribution/phases/refresh-commit.js +47 -2
- package/.agents/scripts/lib/orchestration/story-close/baseline-attribution/phases/regression-projection.js +2 -2
- package/.agents/scripts/lib/orchestration/story-close/format-autofix.js +358 -54
- package/.agents/scripts/lib/orchestration/story-close/phases/close.js +1 -1
- package/.agents/scripts/lib/orchestration/story-close/phases/gates.js +3 -2
- package/.agents/scripts/lib/orchestration/story-close/phases/locked-pipeline.js +30 -3
- package/.agents/scripts/lib/orchestration/story-close/post-merge-close.js +5 -18
- package/.agents/scripts/lib/orchestration/story-close/pre-merge-validation.js +3 -3
- package/.agents/scripts/lib/orchestration/story-close-recovery.js +33 -16
- package/.agents/scripts/lib/orchestration/story-reachability.js +47 -0
- package/.agents/scripts/lib/orchestration/ticket-validator-conflicts.js +2 -33
- package/.agents/scripts/lib/orchestration/ticketing/bulk.js +42 -64
- package/.agents/scripts/lib/orchestration/ticketing/reads.js +9 -0
- package/.agents/scripts/lib/orchestration/ticketing/state.js +50 -436
- package/.agents/scripts/lib/orchestration/ticketing/transition.js +471 -0
- package/.agents/scripts/lib/orchestration/ticketing.js +0 -1
- package/.agents/scripts/lib/orchestration/wave-record-notifications.js +1 -1
- package/.agents/scripts/lib/orchestration/wave-record-projection.js +1 -7
- package/.agents/scripts/lib/project-root.js +17 -0
- package/.agents/scripts/lib/story-adjacency.js +76 -0
- package/.agents/scripts/lib/story-lifecycle.js +1 -1
- package/.agents/scripts/lib/transpile.js +93 -0
- package/.agents/scripts/lib/wave-runner/tick.js +4 -153
- package/.agents/scripts/lib/workers/crap-worker.js +1 -1
- package/.agents/scripts/lib/workers/maintainability-report-worker.js +1 -1
- package/.agents/scripts/lib/worktree/lifecycle/creation.js +20 -2
- package/.agents/scripts/lib/worktree/lifecycle/force-drain.js +90 -0
- package/.agents/scripts/lib/worktree/lifecycle/reap.js +26 -8
- package/.agents/scripts/lib/worktree/node-modules-strategy.js +74 -0
- package/.agents/scripts/providers/github/tickets.js +110 -6
- package/.agents/scripts/run-lint.js +9 -0
- package/.agents/scripts/run-tests.js +24 -4
- package/.agents/scripts/stories-wave-tick.js +8 -5
- package/.agents/scripts/story-init.js +149 -10
- package/.agents/scripts/sync-branch-from-base.js +1 -1
- package/.agents/skills/stack/qa/lighthouse-baseline/SKILL.md +1 -1
- package/.agents/workflows/audit-documentation.md +226 -0
- package/.agents/workflows/epic-deliver.md +16 -23
- package/.agents/workflows/epic-plan.md +1 -1
- package/.agents/workflows/helpers/epic-deliver-story.md +17 -28
- package/.agents/workflows/helpers/single-story-deliver.md +2 -1
- package/.agents/workflows/onboard.md +4 -3
- package/.agents/workflows/story-deliver.md +1 -1
- package/README.md +13 -8
- package/lib/cli/init.js +336 -0
- package/package.json +2 -1
- package/.agents/scripts/lib/auto-refresh-baselines.js +0 -308
- package/.agents/scripts/lib/close-validation.js +0 -897
- package/.agents/scripts/lib/orchestration/cascade-grouping.js +0 -275
- package/.agents/scripts/lib/orchestration/epic-runner/progress-reporter.js +0 -69
- package/.agents/scripts/lib/orchestration/story-close/format-autofix-scoped.js +0 -221
- package/.agents/scripts/lib/orchestration/story-close/format-autofix-shared.js +0 -123
- package/.agents/scripts/lib/task-utils.js +0 -26
- package/.agents/scripts/story-deliver-prepare.js +0 -267
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* task-utils.js
|
|
3
|
-
*
|
|
4
|
-
* Shared utilities for inspecting task objects throughout the pipeline.
|
|
5
|
-
* Centralises the bookend-detection predicate so that any future addition of a
|
|
6
|
-
* new bookend type only requires a change in one place.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Returns true when the given task is a bookend (lifecycle-management) task.
|
|
11
|
-
*
|
|
12
|
-
* Bookend tasks are distinguished from regular development tasks by one of the
|
|
13
|
-
* following flags being truthy:
|
|
14
|
-
* - isQA — automated testing phase
|
|
15
|
-
* - isCodeReview — architectural review phase
|
|
16
|
-
* - isRetro — retrospective phase
|
|
17
|
-
* - isCloseSprint — sprint close-out + tagging phase
|
|
18
|
-
*
|
|
19
|
-
* @param {object} task - A task object from the sprint manifest.
|
|
20
|
-
* @returns {boolean}
|
|
21
|
-
*/
|
|
22
|
-
export function isBookendTask(task) {
|
|
23
|
-
return Boolean(
|
|
24
|
-
task.isQA || task.isCodeReview || task.isRetro || task.isCloseSprint,
|
|
25
|
-
);
|
|
26
|
-
}
|
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/* node:coverage ignore file */
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* story-deliver-prepare.js — post-init / pre-implementation prep step.
|
|
6
|
-
*
|
|
7
|
-
* After `story-init.js` has prepared the worktree and the operator (or
|
|
8
|
-
* sub-agent) has `cd`'d into the workCwd, this CLI consolidates the three
|
|
9
|
-
* things `/story-deliver` Step 0.5/0.6 used to express in English prose:
|
|
10
|
-
*
|
|
11
|
-
* 1. Read the `story-init` structured comment off the Story ticket via
|
|
12
|
-
* `findStructuredComment`. The comment carries `workCwd`, the install
|
|
13
|
-
* tri-state, and the canonical task list — re-derived here so a
|
|
14
|
-
* resumed run doesn't have to retain `story-init` stdout.
|
|
15
|
-
*
|
|
16
|
-
* 2. Apply the `dependenciesInstalled` tri-state truth table:
|
|
17
|
-
* - `'true'` → install already succeeded; skip.
|
|
18
|
-
* - `'false'` → install was attempted and failed; run the install
|
|
19
|
-
* command (default `npm ci`; `project.commands`
|
|
20
|
-
* doesn't carry a dedicated `install` key today —
|
|
21
|
-
* the `commands.test` adjacency is the spec hook for
|
|
22
|
-
* a future override).
|
|
23
|
-
* - `'skipped'` → no per-worktree install was performed (single-tree
|
|
24
|
-
* or symlink/pnpm-store strategy); trust the strategy.
|
|
25
|
-
*
|
|
26
|
-
* 3. Render the initial Story-phase snapshot with every Story phase
|
|
27
|
-
* (init/implement/validate/close) pinned to `pending` and
|
|
28
|
-
* `phase: 'init'` via `upsertStoryRunProgress`. Story #3909 — this is
|
|
29
|
-
* render-only: no `story-run-progress` comment is posted (that redundant
|
|
30
|
-
* mid-flight surface was deleted).
|
|
31
|
-
*
|
|
32
|
-
* Stdout: a single JSON envelope `{ workCwd, dependenciesInstalled,
|
|
33
|
-
* installAction, snapshot, renderedBody }` so the caller can decide what to
|
|
34
|
-
* do next. `renderedBody` is the markdown body for the initial Story-phase
|
|
35
|
-
* table — `/story-deliver` relays it as a chat message at the start of each
|
|
36
|
-
* Story so operators see it before the first commit lands.
|
|
37
|
-
*/
|
|
38
|
-
|
|
39
|
-
import { parseArgs } from 'node:util';
|
|
40
|
-
|
|
41
|
-
import { runAsCli } from './lib/cli-utils.js';
|
|
42
|
-
import { resolveConfig } from './lib/config-resolver.js';
|
|
43
|
-
import { runInstallCommand } from './lib/install-cmd-parser.js';
|
|
44
|
-
import {
|
|
45
|
-
defaultStoryPhases,
|
|
46
|
-
STORY_RUN_PROGRESS_TYPE,
|
|
47
|
-
upsertStoryRunProgress,
|
|
48
|
-
} from './lib/orchestration/epic-runner/story-run-progress-writer.js';
|
|
49
|
-
import { parseFencedJsonComment } from './lib/orchestration/structured-comment-parser.js';
|
|
50
|
-
import { findStructuredComment } from './lib/orchestration/ticketing.js';
|
|
51
|
-
import { createProvider } from './lib/provider-factory.js';
|
|
52
|
-
import { notify } from './notify.js';
|
|
53
|
-
|
|
54
|
-
const HELP = `Usage: node .agents/scripts/story-deliver-prepare.js \\
|
|
55
|
-
--story <id> [--cwd <workCwd>] [--skip-install] [--install-cmd "<cmd>"]
|
|
56
|
-
|
|
57
|
-
Reads the story-init structured comment off Story #<id>, runs the install
|
|
58
|
-
command when dependenciesInstalled === 'false', then renders the initial
|
|
59
|
-
Story-phase snapshot (phase=init, every Story phase pending) for chat relay.
|
|
60
|
-
No story-run-progress comment is posted (Story #3909).
|
|
61
|
-
`;
|
|
62
|
-
|
|
63
|
-
const VALID_INSTALLED_STATES = new Set(['true', 'false', 'skipped']);
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Apply the dependenciesInstalled tri-state to derive the next install action.
|
|
67
|
-
* Pure helper — exposes the Step 0.5 truth table as data so tests can pin
|
|
68
|
-
* each branch without spinning up a child process.
|
|
69
|
-
*
|
|
70
|
-
* @param {'true' | 'false' | 'skipped'} dependenciesInstalled
|
|
71
|
-
* @param {{ skipInstall?: boolean }} [options]
|
|
72
|
-
* @returns {'skip' | 'install'}
|
|
73
|
-
*/
|
|
74
|
-
export function deriveInstallAction(dependenciesInstalled, options = {}) {
|
|
75
|
-
if (!VALID_INSTALLED_STATES.has(dependenciesInstalled)) {
|
|
76
|
-
throw new RangeError(
|
|
77
|
-
`deriveInstallAction: dependenciesInstalled "${dependenciesInstalled}" must be one of: ${[...VALID_INSTALLED_STATES].join(', ')}`,
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
if (options.skipInstall) return 'skip';
|
|
81
|
-
return dependenciesInstalled === 'false' ? 'install' : 'skip';
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Resolve the install command to run when `dependenciesInstalled === 'false'`.
|
|
86
|
-
* `project.commands` does not currently carry a dedicated install key,
|
|
87
|
-
* so this defaults to `npm ci`. Operators can override per-invocation via
|
|
88
|
-
* `--install-cmd` (mirrors the spec note about a `commands.test`-adjacent
|
|
89
|
-
* future override).
|
|
90
|
-
*
|
|
91
|
-
* @param {{ override?: string }} [options]
|
|
92
|
-
* @returns {string}
|
|
93
|
-
*/
|
|
94
|
-
export function resolveInstallCommand(options = {}) {
|
|
95
|
-
const trimmed = options.override?.trim();
|
|
96
|
-
if (trimmed) {
|
|
97
|
-
return trimmed;
|
|
98
|
-
}
|
|
99
|
-
return 'npm ci';
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Hydrate the `story-init` payload off the Story ticket. Returns `null` when
|
|
104
|
-
* the comment can't be located (the operator must run `story-init` first).
|
|
105
|
-
*
|
|
106
|
-
* @param {{ provider: object, storyId: number }} args
|
|
107
|
-
* @returns {Promise<object | null>}
|
|
108
|
-
*/
|
|
109
|
-
export async function readStoryInitComment({ provider, storyId }) {
|
|
110
|
-
const comment = await findStructuredComment(provider, storyId, 'story-init');
|
|
111
|
-
if (!comment) return null;
|
|
112
|
-
const payload = parseFencedJsonComment(comment);
|
|
113
|
-
if (!payload || typeof payload !== 'object') return null;
|
|
114
|
-
return payload;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* End-to-end prepare. DI-friendly: tests pass `provider`, `runner`, and
|
|
119
|
-
* skip the real network/child-process side effects.
|
|
120
|
-
*
|
|
121
|
-
* @param {{
|
|
122
|
-
* storyId: number,
|
|
123
|
-
* cwd?: string,
|
|
124
|
-
* skipInstall?: boolean,
|
|
125
|
-
* installCmd?: string,
|
|
126
|
-
* provider?: object,
|
|
127
|
-
* runInstall?: (cmd: string, cwd: string) => { status: number, stderr?: string },
|
|
128
|
-
* }} args
|
|
129
|
-
* @returns {Promise<{
|
|
130
|
-
* storyId: number,
|
|
131
|
-
* workCwd: string,
|
|
132
|
-
* dependenciesInstalled: string,
|
|
133
|
-
* installAction: 'skip' | 'install',
|
|
134
|
-
* installCmd: string | null,
|
|
135
|
-
* installResult: { status: number, stderr?: string } | null,
|
|
136
|
-
* snapshot: object,
|
|
137
|
-
* renderedBody: string,
|
|
138
|
-
* }>}
|
|
139
|
-
*/
|
|
140
|
-
export async function runStoryDeliverPrepare(args) {
|
|
141
|
-
const {
|
|
142
|
-
storyId,
|
|
143
|
-
cwd: cwdOverride,
|
|
144
|
-
skipInstall = false,
|
|
145
|
-
installCmd: installCmdOverride,
|
|
146
|
-
provider: providerOverride,
|
|
147
|
-
runInstall: runInstallOverride,
|
|
148
|
-
} = args ?? {};
|
|
149
|
-
|
|
150
|
-
if (!Number.isInteger(storyId) || storyId <= 0) {
|
|
151
|
-
throw new TypeError(
|
|
152
|
-
'runStoryDeliverPrepare: --story must be a positive integer',
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
const config = providerOverride ? null : resolveConfig();
|
|
157
|
-
const provider = providerOverride ?? createProvider(config);
|
|
158
|
-
const notifyFn = providerOverride
|
|
159
|
-
? null
|
|
160
|
-
: (ticketId, payload, opts = {}) =>
|
|
161
|
-
notify(ticketId, payload, {
|
|
162
|
-
config,
|
|
163
|
-
provider,
|
|
164
|
-
...opts,
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
// 1. Hydrate the story-init payload off the Story ticket.
|
|
168
|
-
const initPayload = await readStoryInitComment({ provider, storyId });
|
|
169
|
-
if (!initPayload) {
|
|
170
|
-
throw new Error(
|
|
171
|
-
`runStoryDeliverPrepare: no story-init comment found on #${storyId}; ` +
|
|
172
|
-
`run \`node .agents/scripts/story-init.js --story ${storyId}\` first.`,
|
|
173
|
-
);
|
|
174
|
-
}
|
|
175
|
-
const dependenciesInstalled = String(
|
|
176
|
-
initPayload.dependenciesInstalled ?? 'skipped',
|
|
177
|
-
);
|
|
178
|
-
const workCwd = String(initPayload.workCwd ?? cwdOverride ?? process.cwd());
|
|
179
|
-
|
|
180
|
-
// 2. Apply the install tri-state.
|
|
181
|
-
const installAction = deriveInstallAction(dependenciesInstalled, {
|
|
182
|
-
skipInstall,
|
|
183
|
-
});
|
|
184
|
-
let installCmd = null;
|
|
185
|
-
let installResult = null;
|
|
186
|
-
if (installAction === 'install') {
|
|
187
|
-
installCmd = resolveInstallCommand({ override: installCmdOverride });
|
|
188
|
-
installResult = (runInstallOverride ?? runInstallCommand)(
|
|
189
|
-
installCmd,
|
|
190
|
-
workCwd,
|
|
191
|
-
);
|
|
192
|
-
if (installResult.status !== 0) {
|
|
193
|
-
throw new Error(
|
|
194
|
-
`runStoryDeliverPrepare: install command \`${installCmd}\` failed with status ${installResult.status}: ${installResult.stderr ?? ''}`,
|
|
195
|
-
);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
// 3. Render the initial Story-phase snapshot (render-only; Story #3909
|
|
200
|
-
// deleted the redundant story-run-progress comment).
|
|
201
|
-
//
|
|
202
|
-
// Under the 3-tier hierarchy (Epic → Feature → Story) the
|
|
203
|
-
// inline-acceptance Story is the only ticket shape: Stories have no
|
|
204
|
-
// child Tasks, so the snapshot is always the Story-phase `phases[]`
|
|
205
|
-
// shape (init/implement/validate/close pinned to `pending`).
|
|
206
|
-
const hierarchy = String(initPayload.hierarchy ?? '3-tier');
|
|
207
|
-
const branch = String(initPayload.storyBranch ?? `story-${storyId}`);
|
|
208
|
-
|
|
209
|
-
const phases = defaultStoryPhases();
|
|
210
|
-
const { body: renderedBody, payload: snapshot } =
|
|
211
|
-
await upsertStoryRunProgress({
|
|
212
|
-
provider,
|
|
213
|
-
storyId,
|
|
214
|
-
branch,
|
|
215
|
-
phase: 'init',
|
|
216
|
-
phases,
|
|
217
|
-
notify: notifyFn,
|
|
218
|
-
});
|
|
219
|
-
|
|
220
|
-
return {
|
|
221
|
-
storyId,
|
|
222
|
-
workCwd,
|
|
223
|
-
dependenciesInstalled,
|
|
224
|
-
installAction,
|
|
225
|
-
installCmd,
|
|
226
|
-
installResult,
|
|
227
|
-
hierarchy,
|
|
228
|
-
snapshot,
|
|
229
|
-
renderedBody,
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
export function parseArgv(argv) {
|
|
234
|
-
const { values } = parseArgs({
|
|
235
|
-
args: argv,
|
|
236
|
-
options: {
|
|
237
|
-
story: { type: 'string' },
|
|
238
|
-
cwd: { type: 'string' },
|
|
239
|
-
'skip-install': { type: 'boolean' },
|
|
240
|
-
'install-cmd': { type: 'string' },
|
|
241
|
-
help: { type: 'boolean' },
|
|
242
|
-
},
|
|
243
|
-
strict: false,
|
|
244
|
-
});
|
|
245
|
-
return {
|
|
246
|
-
help: Boolean(values.help),
|
|
247
|
-
storyId: Number.parseInt(values.story ?? '', 10),
|
|
248
|
-
cwd: values.cwd,
|
|
249
|
-
skipInstall: Boolean(values['skip-install']),
|
|
250
|
-
installCmd: values['install-cmd'],
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
export async function main(argv = process.argv.slice(2)) {
|
|
255
|
-
const parsed = parseArgv(argv);
|
|
256
|
-
if (parsed.help) {
|
|
257
|
-
process.stdout.write(HELP);
|
|
258
|
-
return;
|
|
259
|
-
}
|
|
260
|
-
const envelope = await runStoryDeliverPrepare(parsed);
|
|
261
|
-
process.stdout.write(`${JSON.stringify(envelope, null, 2)}\n`);
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
// Re-export for symmetry with the other prepare-suite CLIs.
|
|
265
|
-
export { STORY_RUN_PROGRESS_TYPE };
|
|
266
|
-
|
|
267
|
-
runAsCli(import.meta.url, main, { source: 'story-deliver-prepare' });
|