substrate-ai 0.19.17 → 0.19.18
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/cli/index.js +78 -2
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -7170,7 +7170,7 @@ function registerBrainstormCommand(program, _version = "0.0.0", projectRoot = pr
|
|
|
7170
7170
|
//#region src/cli/commands/retry-escalated.ts
|
|
7171
7171
|
const logger$3 = createLogger("retry-escalated-cmd");
|
|
7172
7172
|
async function runRetryEscalatedAction(options) {
|
|
7173
|
-
const { runId, dryRun, force, outputFormat, projectRoot, concurrency, pack: packName, registry: injectedRegistry, agent: agentId } = options;
|
|
7173
|
+
const { runId, dryRun, force, outputFormat, projectRoot, concurrency, pack: packName, registry: injectedRegistry, agent: agentId, events: eventsFlag } = options;
|
|
7174
7174
|
const dbRoot = await resolveMainRepoRoot(projectRoot);
|
|
7175
7175
|
const dbPath = join(dbRoot, ".substrate", "substrate.db");
|
|
7176
7176
|
const doltDir = join(dbRoot, ".substrate", "state", ".dolt");
|
|
@@ -7279,6 +7279,74 @@ async function runRetryEscalatedAction(options) {
|
|
|
7279
7279
|
projectRoot,
|
|
7280
7280
|
agentId
|
|
7281
7281
|
});
|
|
7282
|
+
const ndjsonEmitter = eventsFlag === true ? createEventEmitter() : void 0;
|
|
7283
|
+
if (ndjsonEmitter !== void 0) {
|
|
7284
|
+
ndjsonEmitter.emit({
|
|
7285
|
+
type: "pipeline:start",
|
|
7286
|
+
ts: new Date().toISOString(),
|
|
7287
|
+
run_id: pipelineRun.id,
|
|
7288
|
+
stories: retryable,
|
|
7289
|
+
concurrency
|
|
7290
|
+
});
|
|
7291
|
+
const mapPhase = (p) => {
|
|
7292
|
+
switch (p) {
|
|
7293
|
+
case "IN_STORY_CREATION": return "create-story";
|
|
7294
|
+
case "IN_DEV": return "dev-story";
|
|
7295
|
+
case "IN_REVIEW": return "code-review";
|
|
7296
|
+
case "IN_MINOR_FIX":
|
|
7297
|
+
case "IN_MAJOR_FIX": return "fix";
|
|
7298
|
+
default: return null;
|
|
7299
|
+
}
|
|
7300
|
+
};
|
|
7301
|
+
eventBus.on("orchestrator:story-phase-start", (payload) => {
|
|
7302
|
+
const phase = mapPhase(payload.phase);
|
|
7303
|
+
if (phase !== null) ndjsonEmitter.emit({
|
|
7304
|
+
type: "story:phase",
|
|
7305
|
+
ts: new Date().toISOString(),
|
|
7306
|
+
key: payload.storyKey,
|
|
7307
|
+
phase,
|
|
7308
|
+
status: "in_progress"
|
|
7309
|
+
});
|
|
7310
|
+
});
|
|
7311
|
+
eventBus.on("orchestrator:story-phase-complete", (payload) => {
|
|
7312
|
+
const phase = mapPhase(payload.phase);
|
|
7313
|
+
if (phase !== null) {
|
|
7314
|
+
const result = payload.result;
|
|
7315
|
+
ndjsonEmitter.emit({
|
|
7316
|
+
type: "story:phase",
|
|
7317
|
+
ts: new Date().toISOString(),
|
|
7318
|
+
key: payload.storyKey,
|
|
7319
|
+
phase,
|
|
7320
|
+
status: "complete",
|
|
7321
|
+
...phase === "code-review" && result?.verdict !== void 0 ? { verdict: result.verdict } : {}
|
|
7322
|
+
});
|
|
7323
|
+
}
|
|
7324
|
+
});
|
|
7325
|
+
eventBus.on("orchestrator:story-complete", (payload) => {
|
|
7326
|
+
ndjsonEmitter.emit({
|
|
7327
|
+
type: "story:done",
|
|
7328
|
+
ts: new Date().toISOString(),
|
|
7329
|
+
key: payload.storyKey,
|
|
7330
|
+
result: "success",
|
|
7331
|
+
review_cycles: payload.reviewCycles
|
|
7332
|
+
});
|
|
7333
|
+
});
|
|
7334
|
+
eventBus.on("orchestrator:story-escalated", (payload) => {
|
|
7335
|
+
ndjsonEmitter.emit({
|
|
7336
|
+
type: "story:escalation",
|
|
7337
|
+
ts: new Date().toISOString(),
|
|
7338
|
+
key: payload.storyKey,
|
|
7339
|
+
reason: payload.lastVerdict,
|
|
7340
|
+
cycles: payload.reviewCycles,
|
|
7341
|
+
issues: payload.issues.map((i) => ({
|
|
7342
|
+
severity: i.severity ?? "unknown",
|
|
7343
|
+
file: i.file ?? "",
|
|
7344
|
+
desc: i.description ?? ""
|
|
7345
|
+
})),
|
|
7346
|
+
...payload.diagnosis !== void 0 ? { diagnosis: payload.diagnosis } : {}
|
|
7347
|
+
});
|
|
7348
|
+
});
|
|
7349
|
+
}
|
|
7282
7350
|
eventBus.on("orchestrator:story-phase-complete", (payload) => {
|
|
7283
7351
|
try {
|
|
7284
7352
|
const result = payload.result;
|
|
@@ -7308,6 +7376,13 @@ async function runRetryEscalatedAction(options) {
|
|
|
7308
7376
|
});
|
|
7309
7377
|
}
|
|
7310
7378
|
await orchestrator.run(retryable);
|
|
7379
|
+
if (ndjsonEmitter !== void 0) ndjsonEmitter.emit({
|
|
7380
|
+
type: "pipeline:complete",
|
|
7381
|
+
ts: new Date().toISOString(),
|
|
7382
|
+
succeeded: [],
|
|
7383
|
+
failed: retryable,
|
|
7384
|
+
escalated: []
|
|
7385
|
+
});
|
|
7311
7386
|
if (outputFormat === "json") process.stdout.write(formatOutput({
|
|
7312
7387
|
retryKeys: retryable,
|
|
7313
7388
|
skippedKeys: skipped
|
|
@@ -7331,7 +7406,7 @@ function registerRetryEscalatedCommand(program, _version = "0.0.0", projectRoot
|
|
|
7331
7406
|
const n = parseInt(v, 10);
|
|
7332
7407
|
if (isNaN(n) || n < 1) throw new Error(`--concurrency must be a positive integer, got: ${v}`);
|
|
7333
7408
|
return n;
|
|
7334
|
-
}, 3).option("--pack <name>", "Methodology pack name", "bmad").option("--project-root <path>", "Project root directory", projectRoot).option("--output-format <format>", "Output format: human (default) or json", "human").option("--agent <id>", "Agent backend: claude-code (default), codex, or gemini").action(async (opts) => {
|
|
7409
|
+
}, 3).option("--pack <name>", "Methodology pack name", "bmad").option("--project-root <path>", "Project root directory", projectRoot).option("--output-format <format>", "Output format: human (default) or json", "human").option("--agent <id>", "Agent backend: claude-code (default), codex, or gemini").option("--events", "Emit structured NDJSON events on stdout for programmatic consumption").action(async (opts) => {
|
|
7335
7410
|
const outputFormat = opts.outputFormat === "json" ? "json" : "human";
|
|
7336
7411
|
const exitCode = await runRetryEscalatedAction({
|
|
7337
7412
|
runId: opts.runId,
|
|
@@ -7342,6 +7417,7 @@ function registerRetryEscalatedCommand(program, _version = "0.0.0", projectRoot
|
|
|
7342
7417
|
concurrency: opts.concurrency,
|
|
7343
7418
|
pack: opts.pack,
|
|
7344
7419
|
agent: opts.agent,
|
|
7420
|
+
events: opts.events,
|
|
7345
7421
|
registry
|
|
7346
7422
|
});
|
|
7347
7423
|
process.exitCode = exitCode;
|