agentplane 0.2.25 → 0.2.26
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/bin/agentplane.js +91 -54
- package/dist/.build-manifest.json +11 -0
- package/dist/backends/task-backend/local-backend.d.ts +2 -0
- package/dist/backends/task-backend/local-backend.d.ts.map +1 -1
- package/dist/backends/task-backend/local-backend.js +12 -1
- package/dist/backends/task-backend/redmine/mapping.d.ts.map +1 -1
- package/dist/backends/task-backend/redmine/mapping.js +26 -1
- package/dist/backends/task-backend/redmine-backend.d.ts +4 -0
- package/dist/backends/task-backend/redmine-backend.d.ts.map +1 -1
- package/dist/backends/task-backend/redmine-backend.js +92 -9
- package/dist/backends/task-backend/shared/types.d.ts +1 -0
- package/dist/backends/task-backend/shared/types.d.ts.map +1 -1
- package/dist/backends/task-index.d.ts.map +1 -1
- package/dist/backends/task-index.js +8 -1
- package/dist/cli/command-guide.d.ts.map +1 -1
- package/dist/cli/command-guide.js +21 -8
- package/dist/cli/command-snippets.d.ts +24 -0
- package/dist/cli/command-snippets.d.ts.map +1 -0
- package/dist/cli/command-snippets.js +23 -0
- package/dist/cli/reason-codes.d.ts +9 -0
- package/dist/cli/reason-codes.d.ts.map +1 -0
- package/dist/cli/reason-codes.js +79 -0
- package/dist/cli/recipes-bundled.d.ts +1 -0
- package/dist/cli/recipes-bundled.d.ts.map +1 -1
- package/dist/cli/recipes-bundled.js +4 -1
- package/dist/cli/run-cli/command-catalog.d.ts +1 -1
- package/dist/cli/run-cli/command-catalog.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog.js +40 -1
- package/dist/cli/run-cli/commands/config.d.ts +5 -0
- package/dist/cli/run-cli/commands/config.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/config.js +86 -1
- package/dist/cli/run-cli/commands/core.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/core.js +55 -0
- package/dist/cli/run-cli/commands/init/recipes.d.ts +5 -1
- package/dist/cli/run-cli/commands/init/recipes.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/init/recipes.js +24 -4
- package/dist/cli/run-cli/commands/init/write-workflow.d.ts +7 -0
- package/dist/cli/run-cli/commands/init/write-workflow.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/init/write-workflow.js +52 -0
- package/dist/cli/run-cli/commands/init.d.ts +2 -1
- package/dist/cli/run-cli/commands/init.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/init.js +104 -54
- package/dist/cli/run-cli.d.ts.map +1 -1
- package/dist/cli/run-cli.js +70 -1
- package/dist/commands/backend/sync.command.d.ts.map +1 -1
- package/dist/commands/backend/sync.command.js +7 -6
- package/dist/commands/backend.d.ts.map +1 -1
- package/dist/commands/backend.js +2 -0
- package/dist/commands/doctor.run.d.ts.map +1 -1
- package/dist/commands/doctor.run.js +96 -10
- package/dist/commands/guard/impl/commands.d.ts.map +1 -1
- package/dist/commands/guard/impl/commands.js +12 -6
- package/dist/commands/recipes/impl/commands/install.d.ts.map +1 -1
- package/dist/commands/recipes/impl/commands/install.js +36 -13
- package/dist/commands/recipes/impl/scenario.d.ts.map +1 -1
- package/dist/commands/recipes/impl/scenario.js +25 -0
- package/dist/commands/recipes/impl/types.d.ts +4 -0
- package/dist/commands/recipes/impl/types.d.ts.map +1 -1
- package/dist/commands/scenario/impl/commands.d.ts.map +1 -1
- package/dist/commands/scenario/impl/commands.js +74 -3
- package/dist/commands/scenario/impl/report.d.ts +8 -0
- package/dist/commands/scenario/impl/report.d.ts.map +1 -1
- package/dist/commands/scenario/impl/report.js +1 -0
- package/dist/commands/shared/reconcile-check.d.ts +7 -0
- package/dist/commands/shared/reconcile-check.d.ts.map +1 -0
- package/dist/commands/shared/reconcile-check.js +60 -0
- package/dist/commands/sync.command.d.ts.map +1 -1
- package/dist/commands/sync.command.js +9 -2
- package/dist/commands/task/finish.d.ts.map +1 -1
- package/dist/commands/task/finish.js +2 -0
- package/dist/commands/task/list.d.ts.map +1 -1
- package/dist/commands/task/list.js +2 -1
- package/dist/commands/task/list.spec.d.ts.map +1 -1
- package/dist/commands/task/list.spec.js +7 -0
- package/dist/commands/task/next.d.ts.map +1 -1
- package/dist/commands/task/next.js +2 -1
- package/dist/commands/task/next.spec.d.ts.map +1 -1
- package/dist/commands/task/next.spec.js +7 -0
- package/dist/commands/task/search.d.ts.map +1 -1
- package/dist/commands/task/search.js +2 -1
- package/dist/commands/task/search.spec.d.ts.map +1 -1
- package/dist/commands/task/search.spec.js +7 -0
- package/dist/commands/task/shared.d.ts +7 -0
- package/dist/commands/task/shared.d.ts.map +1 -1
- package/dist/commands/task/shared.js +21 -1
- package/dist/commands/task/verify-record.d.ts.map +1 -1
- package/dist/commands/task/verify-record.js +2 -0
- package/dist/commands/workflow-build.command.d.ts +8 -0
- package/dist/commands/workflow-build.command.d.ts.map +1 -0
- package/dist/commands/workflow-build.command.js +96 -0
- package/dist/commands/workflow-playbook.command.d.ts +10 -0
- package/dist/commands/workflow-playbook.command.d.ts.map +1 -0
- package/dist/commands/workflow-playbook.command.js +174 -0
- package/dist/commands/workflow-restore.command.d.ts +5 -0
- package/dist/commands/workflow-restore.command.d.ts.map +1 -0
- package/dist/commands/workflow-restore.command.js +30 -0
- package/dist/commands/workflow.command.d.ts +6 -0
- package/dist/commands/workflow.command.d.ts.map +1 -0
- package/dist/commands/workflow.command.js +36 -0
- package/dist/harness/dynamic-tool-contract.d.ts +29 -0
- package/dist/harness/dynamic-tool-contract.d.ts.map +1 -0
- package/dist/harness/dynamic-tool-contract.js +86 -0
- package/dist/harness/hooks-lifecycle.d.ts +27 -0
- package/dist/harness/hooks-lifecycle.d.ts.map +1 -0
- package/dist/harness/hooks-lifecycle.js +67 -0
- package/dist/harness/index.d.ts +9 -0
- package/dist/harness/index.d.ts.map +1 -0
- package/dist/harness/index.js +8 -0
- package/dist/harness/reconcile.d.ts +37 -0
- package/dist/harness/reconcile.d.ts.map +1 -0
- package/dist/harness/reconcile.js +42 -0
- package/dist/harness/retry-policy.d.ts +31 -0
- package/dist/harness/retry-policy.d.ts.map +1 -0
- package/dist/harness/retry-policy.js +33 -0
- package/dist/harness/scheduler.d.ts +18 -0
- package/dist/harness/scheduler.d.ts.map +1 -0
- package/dist/harness/scheduler.js +55 -0
- package/dist/harness/state-machine.d.ts +17 -0
- package/dist/harness/state-machine.d.ts.map +1 -0
- package/dist/harness/state-machine.js +70 -0
- package/dist/harness/token-accounting.d.ts +19 -0
- package/dist/harness/token-accounting.d.ts.map +1 -0
- package/dist/harness/token-accounting.js +77 -0
- package/dist/harness/workspace-safety.d.ts +14 -0
- package/dist/harness/workspace-safety.d.ts.map +1 -0
- package/dist/harness/workspace-safety.js +62 -0
- package/dist/recipes/bundled-recipes.d.ts +4 -0
- package/dist/recipes/bundled-recipes.d.ts.map +1 -1
- package/dist/recipes/bundled-recipes.js +11 -0
- package/dist/shared/errors.d.ts +6 -0
- package/dist/shared/errors.d.ts.map +1 -1
- package/dist/shared/errors.js +1 -0
- package/dist/workflow-runtime/build.d.ts +4 -0
- package/dist/workflow-runtime/build.d.ts.map +1 -0
- package/dist/workflow-runtime/build.js +114 -0
- package/dist/workflow-runtime/enforcement.d.ts +3 -0
- package/dist/workflow-runtime/enforcement.d.ts.map +1 -0
- package/dist/workflow-runtime/enforcement.js +10 -0
- package/dist/workflow-runtime/file-ops.d.ts +11 -0
- package/dist/workflow-runtime/file-ops.d.ts.map +1 -0
- package/dist/workflow-runtime/file-ops.js +248 -0
- package/dist/workflow-runtime/fix.d.ts +9 -0
- package/dist/workflow-runtime/fix.d.ts.map +1 -0
- package/dist/workflow-runtime/fix.js +107 -0
- package/dist/workflow-runtime/index.d.ts +11 -0
- package/dist/workflow-runtime/index.d.ts.map +1 -0
- package/dist/workflow-runtime/index.js +10 -0
- package/dist/workflow-runtime/markdown.d.ts +10 -0
- package/dist/workflow-runtime/markdown.d.ts.map +1 -0
- package/dist/workflow-runtime/markdown.js +147 -0
- package/dist/workflow-runtime/observability.d.ts +12 -0
- package/dist/workflow-runtime/observability.d.ts.map +1 -0
- package/dist/workflow-runtime/observability.js +14 -0
- package/dist/workflow-runtime/paths.d.ts +3 -0
- package/dist/workflow-runtime/paths.d.ts.map +1 -0
- package/dist/workflow-runtime/paths.js +11 -0
- package/dist/workflow-runtime/template.d.ts +7 -0
- package/dist/workflow-runtime/template.d.ts.map +1 -0
- package/dist/workflow-runtime/template.js +94 -0
- package/dist/workflow-runtime/types.d.ts +68 -0
- package/dist/workflow-runtime/types.d.ts.map +1 -0
- package/dist/workflow-runtime/types.js +1 -0
- package/dist/workflow-runtime/validate.d.ts +8 -0
- package/dist/workflow-runtime/validate.d.ts.map +1 -0
- package/dist/workflow-runtime/validate.js +331 -0
- package/package.json +3 -3
|
@@ -5,6 +5,7 @@ import { warnMessage, successMessage } from "../cli/output.js";
|
|
|
5
5
|
import { RUNTIME_GITIGNORE_LINES } from "../shared/runtime-artifacts.js";
|
|
6
6
|
import { execFileAsync, gitEnv } from "./shared/git.js";
|
|
7
7
|
import { loadCommandContext } from "./shared/task-backend.js";
|
|
8
|
+
import { emitWorkflowEvent, isWorkflowEnforcementDisabled, resolveWorkflowPaths, safeAutofixWorkflowText, validateWorkflowAtPath, workflowEnforcementEnvHint, } from "../workflow-runtime/index.js";
|
|
8
9
|
async function listTsFiles(rootDir) {
|
|
9
10
|
const out = [];
|
|
10
11
|
async function walk(absDir) {
|
|
@@ -160,6 +161,75 @@ async function safeFixTaskIndex(repoRoot) {
|
|
|
160
161
|
return { changed: false, note: "Skip: could not rebuild tasks index cache." };
|
|
161
162
|
}
|
|
162
163
|
}
|
|
164
|
+
async function checkWorkflowContract(repoRoot) {
|
|
165
|
+
const result = await validateWorkflowAtPath(repoRoot);
|
|
166
|
+
const findings = result.diagnostics.map((d) => `[${d.severity}] ${d.code} ${d.path}: ${d.message}`);
|
|
167
|
+
emitWorkflowEvent({
|
|
168
|
+
event: "workflow_doctor_check",
|
|
169
|
+
details: { ok: result.ok, findings: result.diagnostics.length },
|
|
170
|
+
});
|
|
171
|
+
return findings;
|
|
172
|
+
}
|
|
173
|
+
function findingSeverity(problem) {
|
|
174
|
+
const normalized = problem.trimStart();
|
|
175
|
+
if (normalized.startsWith("[WARN]"))
|
|
176
|
+
return "WARN";
|
|
177
|
+
if (normalized.startsWith("[INFO]"))
|
|
178
|
+
return "INFO";
|
|
179
|
+
if (normalized.startsWith("[ERROR]"))
|
|
180
|
+
return "ERROR";
|
|
181
|
+
return "ERROR";
|
|
182
|
+
}
|
|
183
|
+
async function safeFixWorkflow(repoRoot) {
|
|
184
|
+
const paths = resolveWorkflowPaths(repoRoot);
|
|
185
|
+
let current = "";
|
|
186
|
+
let sourcePath = paths.workflowPath;
|
|
187
|
+
try {
|
|
188
|
+
current = await fs.readFile(paths.workflowPath, "utf8");
|
|
189
|
+
}
|
|
190
|
+
catch {
|
|
191
|
+
try {
|
|
192
|
+
current = await fs.readFile(paths.legacyWorkflowPath, "utf8");
|
|
193
|
+
sourcePath = paths.legacyWorkflowPath;
|
|
194
|
+
}
|
|
195
|
+
catch {
|
|
196
|
+
return { changed: false, note: "Skip: workflow contract file not found." };
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
const fixed = safeAutofixWorkflowText(current);
|
|
200
|
+
if (fixed.diagnostics.some((d) => d.code === "WF_FIX_SKIPPED_UNSAFE")) {
|
|
201
|
+
const details = fixed.diagnostics.map((d) => `${d.path}`).join(", ");
|
|
202
|
+
return {
|
|
203
|
+
changed: false,
|
|
204
|
+
note: `Skip: unsafe workflow autofix required (unknown keys). Proposed manual review: ${details}`,
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
if (!fixed.changed) {
|
|
208
|
+
if (sourcePath === paths.workflowPath) {
|
|
209
|
+
return { changed: false, note: "OK: workflow contract already normalized." };
|
|
210
|
+
}
|
|
211
|
+
await fs.mkdir(path.dirname(paths.workflowPath), { recursive: true });
|
|
212
|
+
await fs.writeFile(paths.workflowPath, current, "utf8");
|
|
213
|
+
await fs.rm(paths.legacyWorkflowPath, { force: true });
|
|
214
|
+
await fs.mkdir(paths.workflowDir, { recursive: true });
|
|
215
|
+
await fs.copyFile(paths.workflowPath, paths.lastKnownGoodPath);
|
|
216
|
+
return {
|
|
217
|
+
changed: true,
|
|
218
|
+
note: "Fixed: moved legacy WORKFLOW.md into .agentplane and refreshed last-known-good.",
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
await fs.mkdir(path.dirname(paths.workflowPath), { recursive: true });
|
|
222
|
+
await fs.writeFile(paths.workflowPath, fixed.text, "utf8");
|
|
223
|
+
if (sourcePath === paths.legacyWorkflowPath) {
|
|
224
|
+
await fs.rm(paths.legacyWorkflowPath, { force: true });
|
|
225
|
+
}
|
|
226
|
+
await fs.mkdir(paths.workflowDir, { recursive: true });
|
|
227
|
+
await fs.copyFile(paths.workflowPath, paths.lastKnownGoodPath);
|
|
228
|
+
return {
|
|
229
|
+
changed: true,
|
|
230
|
+
note: "Fixed: normalized workflow contract and refreshed last-known-good.",
|
|
231
|
+
};
|
|
232
|
+
}
|
|
163
233
|
async function checkDoneTaskCommitInvariants(repoRoot) {
|
|
164
234
|
const tasksPath = path.join(repoRoot, ".agentplane", "tasks.json");
|
|
165
235
|
let raw = "";
|
|
@@ -228,22 +298,38 @@ async function checkDoneTaskCommitInvariants(repoRoot) {
|
|
|
228
298
|
export const runDoctor = async (ctx, p) => {
|
|
229
299
|
const resolved = await resolveProject({ cwd: ctx.cwd, rootOverride: ctx.rootOverride ?? null });
|
|
230
300
|
const repoRoot = resolved.gitRoot;
|
|
231
|
-
const
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
return
|
|
301
|
+
const runChecks = async () => {
|
|
302
|
+
const checks = await checkWorkspace(repoRoot);
|
|
303
|
+
checks.push(...(await checkDoneTaskCommitInvariants(repoRoot)));
|
|
304
|
+
if (!isWorkflowEnforcementDisabled()) {
|
|
305
|
+
checks.push(...(await checkWorkflowContract(repoRoot)));
|
|
306
|
+
}
|
|
307
|
+
if (p.dev) {
|
|
308
|
+
checks.push(...(await checkLayering(repoRoot)));
|
|
309
|
+
}
|
|
310
|
+
return checks;
|
|
311
|
+
};
|
|
312
|
+
if (isWorkflowEnforcementDisabled()) {
|
|
313
|
+
console.log(successMessage("doctor", undefined, `workflow contract checks disabled via ${workflowEnforcementEnvHint()}.`));
|
|
241
314
|
}
|
|
242
315
|
if (p.fix) {
|
|
243
316
|
const fix = await safeFixGitignore(repoRoot);
|
|
244
317
|
console.log(successMessage("doctor fix", undefined, fix.note));
|
|
245
318
|
const idx = await safeFixTaskIndex(repoRoot);
|
|
246
319
|
console.log(successMessage("doctor fix", undefined, idx.note));
|
|
320
|
+
const workflowFix = await safeFixWorkflow(repoRoot);
|
|
321
|
+
console.log(successMessage("doctor fix", undefined, workflowFix.note));
|
|
322
|
+
}
|
|
323
|
+
const problems = await runChecks();
|
|
324
|
+
const errors = problems.filter((problem) => findingSeverity(problem) === "ERROR");
|
|
325
|
+
if (problems.length > 0) {
|
|
326
|
+
const warningCount = problems.filter((problem) => findingSeverity(problem) === "WARN").length;
|
|
327
|
+
const infoCount = problems.filter((problem) => findingSeverity(problem) === "INFO").length;
|
|
328
|
+
console.error(warnMessage(`doctor findings: errors=${errors.length} warnings=${warningCount} info=${infoCount}`));
|
|
329
|
+
for (const prob of problems)
|
|
330
|
+
console.error(`- ${prob}`);
|
|
331
|
+
if (errors.length > 0)
|
|
332
|
+
return 1;
|
|
247
333
|
}
|
|
248
334
|
console.log(successMessage("doctor", undefined, "OK"));
|
|
249
335
|
return 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../../src/commands/guard/impl/commands.ts"],"names":[],"mappings":"AAGA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../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AC,MAAM,CAAC,CAmJlB"}
|
|
@@ -4,6 +4,7 @@ import { CliError } from "../../../shared/errors.js";
|
|
|
4
4
|
import { loadCommandContext } from "../../shared/task-backend.js";
|
|
5
5
|
import { loadTaskFromContext } from "../../shared/task-backend.js";
|
|
6
6
|
import { execFileAsync, gitEnv } from "../../shared/git.js";
|
|
7
|
+
import { ensureReconciledBeforeMutation } from "../../shared/reconcile-check.js";
|
|
7
8
|
import { suggestAllowPrefixes } from "./allow.js";
|
|
8
9
|
import { buildCloseCommitMessage, taskReadmePathForTask } from "./close-message.js";
|
|
9
10
|
import { buildGitCommitEnv } from "./env.js";
|
|
@@ -111,7 +112,10 @@ export async function cmdGuardSuggestAllow(opts) {
|
|
|
111
112
|
}
|
|
112
113
|
export async function cmdGuardCommit(opts) {
|
|
113
114
|
try {
|
|
114
|
-
|
|
115
|
+
const ctx = opts.ctx ??
|
|
116
|
+
(await loadCommandContext({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null }));
|
|
117
|
+
await ensureReconciledBeforeMutation({ ctx, command: "guard commit" });
|
|
118
|
+
await guardCommitCheck({ ...opts, ctx });
|
|
115
119
|
if (!opts.quiet)
|
|
116
120
|
process.stdout.write("OK\n");
|
|
117
121
|
return 0;
|
|
@@ -124,9 +128,12 @@ export async function cmdGuardCommit(opts) {
|
|
|
124
128
|
}
|
|
125
129
|
export async function cmdCommit(opts) {
|
|
126
130
|
try {
|
|
131
|
+
const ctx = opts.ctx ??
|
|
132
|
+
(await loadCommandContext({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null }));
|
|
127
133
|
if (opts.close) {
|
|
128
|
-
|
|
129
|
-
|
|
134
|
+
if (!opts.closeCheckOnly) {
|
|
135
|
+
await ensureReconciledBeforeMutation({ ctx, command: "commit" });
|
|
136
|
+
}
|
|
130
137
|
// Make the close commit deterministic: start from a clean index unless --unstage-others is used.
|
|
131
138
|
let staged = await ctx.git.statusStagedPaths();
|
|
132
139
|
if (staged.length > 0 && opts.closeUnstageOthers) {
|
|
@@ -208,8 +215,9 @@ export async function cmdCommit(opts) {
|
|
|
208
215
|
message: "--auto-allow is disabled; pass explicit --allow <path-prefix>.",
|
|
209
216
|
});
|
|
210
217
|
}
|
|
218
|
+
await ensureReconciledBeforeMutation({ ctx, command: "commit" });
|
|
211
219
|
await guardCommitCheck({
|
|
212
|
-
ctx
|
|
220
|
+
ctx,
|
|
213
221
|
cwd: opts.cwd,
|
|
214
222
|
rootOverride: opts.rootOverride,
|
|
215
223
|
taskId: opts.taskId,
|
|
@@ -224,8 +232,6 @@ export async function cmdCommit(opts) {
|
|
|
224
232
|
requireClean: opts.requireClean,
|
|
225
233
|
quiet: opts.quiet,
|
|
226
234
|
});
|
|
227
|
-
const ctx = opts.ctx ??
|
|
228
|
-
(await loadCommandContext({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null }));
|
|
229
235
|
const env = buildGitCommitEnv({
|
|
230
236
|
taskId: opts.taskId,
|
|
231
237
|
allowTasks: opts.allowTasks,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../../../src/commands/recipes/impl/commands/install.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../../../src/commands/recipes/impl/commands/install.ts"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAM3E,wBAAsB,gBAAgB,CAAC,IAAI,EAAE;IAC3C,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,mBAAmB,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,kBAAkB,CAAC;IAC/B,GAAG,EAAE,OAAO,CAAC;CACd,GAAG,OAAO,CAAC,MAAM,CAAC,CA6NlB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mkdir, mkdtemp, rm } from "node:fs/promises";
|
|
1
|
+
import { cp, mkdir, mkdtemp, rm } from "node:fs/promises";
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { defaultConfig, loadConfig } from "@agentplaneorg/core";
|
|
@@ -8,6 +8,7 @@ import { mapCoreError } from "../../../../cli/error-map.js";
|
|
|
8
8
|
import { exitCodeForError } from "../../../../cli/exit-codes.js";
|
|
9
9
|
import { fileExists, getPathKind } from "../../../../cli/fs-utils.js";
|
|
10
10
|
import { downloadToFile } from "../../../../cli/http.js";
|
|
11
|
+
import { getBundledRecipeEntry, resolveBundledRecipeSourcePath, } from "../../../../recipes/bundled-recipes.js";
|
|
11
12
|
import { CliError } from "../../../../shared/errors.js";
|
|
12
13
|
import { ensureNetworkApproved } from "../../../shared/network-approval.js";
|
|
13
14
|
import { resolvePathFallback } from "../../../shared/path.js";
|
|
@@ -86,7 +87,7 @@ export async function cmdRecipeInstall(opts) {
|
|
|
86
87
|
const filename = path.basename(url.pathname) || "recipe.tar.gz";
|
|
87
88
|
const target = path.join(tempRoot, filename);
|
|
88
89
|
await downloadToFile(latest.url, target);
|
|
89
|
-
return target;
|
|
90
|
+
return { kind: "archive", path: target };
|
|
90
91
|
}
|
|
91
92
|
const resolved = path.resolve(opts.cwd, latest.url);
|
|
92
93
|
if (!(await fileExists(resolved))) {
|
|
@@ -96,11 +97,19 @@ export async function cmdRecipeInstall(opts) {
|
|
|
96
97
|
message: `Recipe archive not found: ${latest.url}`,
|
|
97
98
|
});
|
|
98
99
|
}
|
|
99
|
-
return resolved;
|
|
100
|
+
return { kind: "archive", path: resolved };
|
|
100
101
|
};
|
|
101
102
|
const resolveSourcePath = async (source) => {
|
|
102
|
-
if (source.type === "name")
|
|
103
|
+
if (source.type === "name") {
|
|
104
|
+
const bundledPath = resolveBundledRecipeSourcePath(source.value);
|
|
105
|
+
if (bundledPath && (await fileExists(path.join(bundledPath, "manifest.json")))) {
|
|
106
|
+
const bundledEntry = getBundledRecipeEntry(source.value);
|
|
107
|
+
const bundledVersion = bundledEntry?.versions.at(-1)?.version ?? "unknown";
|
|
108
|
+
sourceLabel = `bundled:${source.value}@${bundledVersion}`;
|
|
109
|
+
return { kind: "directory", path: bundledPath };
|
|
110
|
+
}
|
|
103
111
|
return await resolveFromIndex(source.value);
|
|
112
|
+
}
|
|
104
113
|
if (source.type === "url") {
|
|
105
114
|
await ensureApproved("recipes install downloads a recipe archive");
|
|
106
115
|
const url = new URL(source.value);
|
|
@@ -108,7 +117,7 @@ export async function cmdRecipeInstall(opts) {
|
|
|
108
117
|
const target = path.join(tempRoot, filename);
|
|
109
118
|
sourceLabel = source.value;
|
|
110
119
|
await downloadToFile(source.value, target);
|
|
111
|
-
return target;
|
|
120
|
+
return { kind: "archive", path: target };
|
|
112
121
|
}
|
|
113
122
|
if (source.type === "path") {
|
|
114
123
|
const candidate = await resolvePathFallback(source.value);
|
|
@@ -119,8 +128,13 @@ export async function cmdRecipeInstall(opts) {
|
|
|
119
128
|
message: `Recipe archive not found: ${source.value}`,
|
|
120
129
|
});
|
|
121
130
|
}
|
|
131
|
+
const kind = await getPathKind(candidate);
|
|
132
|
+
if (kind === "dir") {
|
|
133
|
+
sourceLabel = candidate;
|
|
134
|
+
return { kind: "directory", path: candidate };
|
|
135
|
+
}
|
|
122
136
|
sourceLabel = candidate;
|
|
123
|
-
return candidate;
|
|
137
|
+
return { kind: "archive", path: candidate };
|
|
124
138
|
}
|
|
125
139
|
if (isHttpUrl(source.value)) {
|
|
126
140
|
return await resolveSourcePath({ type: "url", value: source.value });
|
|
@@ -131,10 +145,11 @@ export async function cmdRecipeInstall(opts) {
|
|
|
131
145
|
}
|
|
132
146
|
return await resolveSourcePath({ type: "name", value: source.value });
|
|
133
147
|
};
|
|
134
|
-
const
|
|
148
|
+
const sourceInput = await resolveSourcePath(opts.source);
|
|
149
|
+
const sourcePath = sourceInput.path;
|
|
135
150
|
if (!sourceLabel)
|
|
136
151
|
sourceLabel = opts.source.value;
|
|
137
|
-
const actualSha = expectedSha ? await sha256File(sourcePath) : "";
|
|
152
|
+
const actualSha = expectedSha && sourceInput.kind === "archive" ? await sha256File(sourcePath) : "";
|
|
138
153
|
if (expectedSha && actualSha !== expectedSha) {
|
|
139
154
|
throw new CliError({
|
|
140
155
|
exitCode: 3,
|
|
@@ -142,11 +157,19 @@ export async function cmdRecipeInstall(opts) {
|
|
|
142
157
|
message: `Recipe checksum mismatch for ${sourceLabel}`,
|
|
143
158
|
});
|
|
144
159
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
160
|
+
let recipeRoot;
|
|
161
|
+
if (sourceInput.kind === "archive") {
|
|
162
|
+
await extractArchive({
|
|
163
|
+
archivePath: sourcePath,
|
|
164
|
+
destDir: tempRoot,
|
|
165
|
+
});
|
|
166
|
+
recipeRoot = await resolveRecipeRoot(tempRoot);
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
const stagedRecipeRoot = path.join(tempRoot, "recipe");
|
|
170
|
+
await cp(sourcePath, stagedRecipeRoot, { recursive: true });
|
|
171
|
+
recipeRoot = stagedRecipeRoot;
|
|
172
|
+
}
|
|
150
173
|
const manifest = await readRecipeManifest(path.join(recipeRoot, "manifest.json"));
|
|
151
174
|
const resolvedTags = manifest.tags && manifest.tags.length > 0 ? manifest.tags : normalizeRecipeTags(indexTags);
|
|
152
175
|
const manifestWithTags = resolvedTags.length > 0 ? { ...manifest, tags: resolvedTags } : manifest;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scenario.d.ts","sourceRoot":"","sources":["../../../../src/commands/recipes/impl/scenario.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"scenario.d.ts","sourceRoot":"","sources":["../../../../src/commands/recipes/impl/scenario.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAwD3F,wBAAsB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAG1F;AAED,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IACjE,cAAc,EAAE,CAAC,CAAC;IAClB,SAAS,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC/C,CAAC,CAeD;AAED,wBAAsB,4BAA4B,CAChD,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,cAAc,GACvB,OAAO,CAAC,oBAAoB,EAAE,CAAC,CA+CjC;AAED,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,OAAO,EACZ,UAAU,EAAE,MAAM,GACjB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAyB/D"}
|
|
@@ -5,6 +5,30 @@ import { invalidFieldMessage, requiredFieldMessage } from "../../../cli/output.j
|
|
|
5
5
|
import { isRecord } from "../../../shared/guards.js";
|
|
6
6
|
import { RECIPES_SCENARIOS_DIR_NAME, RECIPES_SCENARIOS_INDEX_NAME } from "./constants.js";
|
|
7
7
|
import { normalizeScenarioId } from "./normalize.js";
|
|
8
|
+
function normalizeScenarioEvidence(raw, sourcePath) {
|
|
9
|
+
if (raw === undefined)
|
|
10
|
+
return undefined;
|
|
11
|
+
if (!isRecord(raw)) {
|
|
12
|
+
throw new Error(invalidFieldMessage("scenario.evidence", "object", sourcePath));
|
|
13
|
+
}
|
|
14
|
+
const required = raw.required === true;
|
|
15
|
+
let files = [];
|
|
16
|
+
if (raw.files !== undefined) {
|
|
17
|
+
if (!Array.isArray(raw.files)) {
|
|
18
|
+
throw new Error(invalidFieldMessage("scenario.evidence.files", "string[]", sourcePath));
|
|
19
|
+
}
|
|
20
|
+
files = raw.files
|
|
21
|
+
.map((value) => (typeof value === "string" ? value.trim() : ""))
|
|
22
|
+
.filter(Boolean);
|
|
23
|
+
if (files.length !== raw.files.length) {
|
|
24
|
+
throw new Error(invalidFieldMessage("scenario.evidence.files", "string[]", sourcePath));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (required && files.length === 0) {
|
|
28
|
+
files = ["evidence.json"];
|
|
29
|
+
}
|
|
30
|
+
return { required, files };
|
|
31
|
+
}
|
|
8
32
|
function validateScenarioDefinition(raw, sourcePath) {
|
|
9
33
|
if (!isRecord(raw))
|
|
10
34
|
throw new Error(invalidFieldMessage("scenario", "object", sourcePath));
|
|
@@ -31,6 +55,7 @@ function validateScenarioDefinition(raw, sourcePath) {
|
|
|
31
55
|
goal,
|
|
32
56
|
inputs: raw.inputs,
|
|
33
57
|
outputs: raw.outputs,
|
|
58
|
+
evidence: normalizeScenarioEvidence(raw.evidence, sourcePath),
|
|
34
59
|
steps: raw.steps,
|
|
35
60
|
};
|
|
36
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/commands/recipes/impl/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG;IAC3B,cAAc,EAAE,GAAG,CAAC;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,CAAC,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,C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ands.ts"],"names":[],"mappings":"AAKA,OAAO,EAAmB,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAgCtE,KAAK,iBAAiB,GAAG,MAAM,GAAG,MAAM,CAAC;AAEzC,KAAK,oBAAoB,GAAG;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,CAAC;AAEF,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,iBAAiB,EAC1B,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EAAE,GACb,oBAAoB,CAQtB;AAED,wBAAsB,qBAAqB,CAAC,IAAI,EAAE;IAChD,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,MAAM,CAAC,CAoDlB;AAED,wBAAsB,qBAAqB,CAAC,IAAI,EAAE;IAChD,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../../src/commands/scenario/impl/commands.ts"],"names":[],"mappings":"AAKA,OAAO,EAAmB,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAgCtE,KAAK,iBAAiB,GAAG,MAAM,GAAG,MAAM,CAAC;AAEzC,KAAK,oBAAoB,GAAG;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,CAAC;AAEF,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,iBAAiB,EAC1B,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EAAE,GACb,oBAAoB,CAQtB;AAED,wBAAsB,qBAAqB,CAAC,IAAI,EAAE;IAChD,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,MAAM,CAAC,CAoDlB;AAED,wBAAsB,qBAAqB,CAAC,IAAI,EAAE;IAChD,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,MAAM,CAAC,CA2ElB;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,OAAO,EAAE,iBAAiB,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC7B,GAAG,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CA2ChE;AAkCD,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC;CACvD,GAAG,OAAO,CAAC,MAAM,CAAC,CAiQlB"}
|
|
@@ -125,6 +125,12 @@ export async function cmdScenarioInfoParsed(opts) {
|
|
|
125
125
|
process.stdout.write(`Goal: ${scenario.goal}\n`);
|
|
126
126
|
process.stdout.write(`Inputs: ${JSON.stringify(scenario.inputs, null, 2)}\n`);
|
|
127
127
|
process.stdout.write(`Outputs: ${JSON.stringify(scenario.outputs, null, 2)}\n`);
|
|
128
|
+
if (scenario.evidence?.required) {
|
|
129
|
+
process.stdout.write(`Evidence: required (${normalizeExpectedEvidenceFiles(scenario.evidence.files).join(", ")})\n`);
|
|
130
|
+
}
|
|
131
|
+
else if (scenario.evidence?.files && scenario.evidence.files.length > 0) {
|
|
132
|
+
process.stdout.write(`Evidence: optional (${scenario.evidence.files.join(", ")})\n`);
|
|
133
|
+
}
|
|
128
134
|
process.stdout.write("Steps:\n");
|
|
129
135
|
let stepIndex = 1;
|
|
130
136
|
for (const step of scenario.steps) {
|
|
@@ -185,6 +191,33 @@ export async function executeRecipeTool(opts) {
|
|
|
185
191
|
function sanitizeRunId(value) {
|
|
186
192
|
return value.replaceAll(/[^a-zA-Z0-9._-]/g, "_");
|
|
187
193
|
}
|
|
194
|
+
function normalizeExpectedEvidenceFiles(raw) {
|
|
195
|
+
if (!raw || raw.length === 0)
|
|
196
|
+
return ["evidence.json"];
|
|
197
|
+
const unique = [];
|
|
198
|
+
for (const value of raw) {
|
|
199
|
+
const file = value.trim();
|
|
200
|
+
if (!file)
|
|
201
|
+
continue;
|
|
202
|
+
if (unique.includes(file))
|
|
203
|
+
continue;
|
|
204
|
+
unique.push(file);
|
|
205
|
+
}
|
|
206
|
+
return unique.length > 0 ? unique : ["evidence.json"];
|
|
207
|
+
}
|
|
208
|
+
async function collectStepEvidenceFiles(stepDir, expectedFiles) {
|
|
209
|
+
const present = [];
|
|
210
|
+
const missing = [];
|
|
211
|
+
for (const file of expectedFiles) {
|
|
212
|
+
if (await fileExists(path.join(stepDir, file))) {
|
|
213
|
+
present.push(file);
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
missing.push(file);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
return { present, missing };
|
|
220
|
+
}
|
|
188
221
|
export async function cmdScenarioRunParsed(opts) {
|
|
189
222
|
const resolved = opts.resolved ??
|
|
190
223
|
(await resolveProject({
|
|
@@ -241,6 +274,13 @@ export async function cmdScenarioRunParsed(opts) {
|
|
|
241
274
|
.replaceAll(".", "-")}-${sanitizeRunId(scenarioId)}`;
|
|
242
275
|
const runDir = path.join(runsRoot, runId);
|
|
243
276
|
await mkdir(runDir, { recursive: true });
|
|
277
|
+
const evidenceRequired = scenario.evidence?.required === true;
|
|
278
|
+
const expectedEvidenceFiles = evidenceRequired
|
|
279
|
+
? normalizeExpectedEvidenceFiles(scenario.evidence?.files)
|
|
280
|
+
: normalizeExpectedEvidenceFiles(scenario.evidence?.files && scenario.evidence.files.length > 0
|
|
281
|
+
? scenario.evidence.files
|
|
282
|
+
: undefined);
|
|
283
|
+
const missingEvidenceSteps = [];
|
|
244
284
|
const stepsMeta = [];
|
|
245
285
|
const stepsReport = [];
|
|
246
286
|
for (let index = 0; index < scenario.steps.length; index++) {
|
|
@@ -299,6 +339,11 @@ export async function cmdScenarioRunParsed(opts) {
|
|
|
299
339
|
const durationMs = Date.now() - startedAt;
|
|
300
340
|
await atomicWriteFile(path.join(stepDir, "stdout.log"), result.stdout, "utf8");
|
|
301
341
|
await atomicWriteFile(path.join(stepDir, "stderr.log"), result.stderr, "utf8");
|
|
342
|
+
const stepEvidence = await collectStepEvidenceFiles(stepDir, expectedEvidenceFiles);
|
|
343
|
+
const missingRequiredEvidence = evidenceRequired ? stepEvidence.missing : [];
|
|
344
|
+
if (missingRequiredEvidence.length > 0) {
|
|
345
|
+
missingEvidenceSteps.push(index + 1);
|
|
346
|
+
}
|
|
302
347
|
stepsMeta.push({
|
|
303
348
|
tool: step.tool,
|
|
304
349
|
runtime,
|
|
@@ -313,10 +358,12 @@ export async function cmdScenarioRunParsed(opts) {
|
|
|
313
358
|
entrypoint,
|
|
314
359
|
args: redactArgs(step.args),
|
|
315
360
|
env_keys: stepEnvKeys,
|
|
361
|
+
evidence_files: stepEvidence.present,
|
|
362
|
+
missing_evidence_files: missingRequiredEvidence.length > 0 ? missingRequiredEvidence : undefined,
|
|
316
363
|
exit_code: result.exitCode,
|
|
317
364
|
duration_ms: durationMs,
|
|
318
365
|
});
|
|
319
|
-
if (result.exitCode !== 0) {
|
|
366
|
+
if (result.exitCode !== 0 || missingRequiredEvidence.length > 0) {
|
|
320
367
|
const gitSummary = await getGitDiffSummary(resolved.gitRoot);
|
|
321
368
|
await writeScenarioReport({
|
|
322
369
|
runDir,
|
|
@@ -326,18 +373,32 @@ export async function cmdScenarioRunParsed(opts) {
|
|
|
326
373
|
startedAt: runStartedAt,
|
|
327
374
|
status: "failed",
|
|
328
375
|
steps: stepsReport,
|
|
376
|
+
evidence: {
|
|
377
|
+
required: evidenceRequired,
|
|
378
|
+
expected_files: expectedEvidenceFiles,
|
|
379
|
+
missing_steps: missingEvidenceSteps,
|
|
380
|
+
},
|
|
329
381
|
gitSummary,
|
|
330
382
|
});
|
|
331
383
|
await atomicWriteFile(path.join(runDir, "meta.json"), `${JSON.stringify({
|
|
332
384
|
recipe: recipeId,
|
|
333
385
|
scenario: scenarioId,
|
|
334
386
|
run_id: runId,
|
|
387
|
+
evidence: {
|
|
388
|
+
required: evidenceRequired,
|
|
389
|
+
expected_files: expectedEvidenceFiles,
|
|
390
|
+
missing_steps: missingEvidenceSteps,
|
|
391
|
+
},
|
|
335
392
|
steps: stepsMeta,
|
|
336
393
|
}, null, 2)}\n`, "utf8");
|
|
394
|
+
const reason = missingRequiredEvidence.length > 0
|
|
395
|
+
? `Scenario step missing required evidence: ${step.tool} (${missingRequiredEvidence.join(", ")})`
|
|
396
|
+
: `Scenario step failed: ${step.tool}`;
|
|
397
|
+
const stepExitCode = result.exitCode === 0 ? 1 : result.exitCode;
|
|
337
398
|
throw new CliError({
|
|
338
|
-
exitCode:
|
|
399
|
+
exitCode: stepExitCode,
|
|
339
400
|
code: "E_INTERNAL",
|
|
340
|
-
message:
|
|
401
|
+
message: reason,
|
|
341
402
|
});
|
|
342
403
|
}
|
|
343
404
|
}
|
|
@@ -350,12 +411,22 @@ export async function cmdScenarioRunParsed(opts) {
|
|
|
350
411
|
startedAt: runStartedAt,
|
|
351
412
|
status: "success",
|
|
352
413
|
steps: stepsReport,
|
|
414
|
+
evidence: {
|
|
415
|
+
required: evidenceRequired,
|
|
416
|
+
expected_files: expectedEvidenceFiles,
|
|
417
|
+
missing_steps: missingEvidenceSteps,
|
|
418
|
+
},
|
|
353
419
|
gitSummary,
|
|
354
420
|
});
|
|
355
421
|
await atomicWriteFile(path.join(runDir, "meta.json"), `${JSON.stringify({
|
|
356
422
|
recipe: recipeId,
|
|
357
423
|
scenario: scenarioId,
|
|
358
424
|
run_id: runId,
|
|
425
|
+
evidence: {
|
|
426
|
+
required: evidenceRequired,
|
|
427
|
+
expected_files: expectedEvidenceFiles,
|
|
428
|
+
missing_steps: missingEvidenceSteps,
|
|
429
|
+
},
|
|
359
430
|
steps: stepsMeta,
|
|
360
431
|
}, null, 2)}\n`, "utf8");
|
|
361
432
|
process.stdout.write(`Run artifacts: ${path.relative(resolved.gitRoot, runDir)}\n`);
|
|
@@ -10,9 +10,16 @@ export type ScenarioRunReportStep = {
|
|
|
10
10
|
entrypoint: string;
|
|
11
11
|
args: string[];
|
|
12
12
|
env_keys: string[];
|
|
13
|
+
evidence_files: string[];
|
|
14
|
+
missing_evidence_files?: string[];
|
|
13
15
|
exit_code: number;
|
|
14
16
|
duration_ms: number;
|
|
15
17
|
};
|
|
18
|
+
type ScenarioRunEvidenceSummary = {
|
|
19
|
+
required: boolean;
|
|
20
|
+
expected_files: string[];
|
|
21
|
+
missing_steps: number[];
|
|
22
|
+
};
|
|
16
23
|
export declare function redactArgs(args: string[]): string[];
|
|
17
24
|
export declare function getGitDiffSummary(cwd: string): Promise<ScenarioRunGitSummary | undefined>;
|
|
18
25
|
export declare function collectScenarioEnvKeys(stepEnv: Record<string, string> | undefined): string[];
|
|
@@ -24,6 +31,7 @@ export declare function writeScenarioReport(opts: {
|
|
|
24
31
|
startedAt: string;
|
|
25
32
|
status: "success" | "failed";
|
|
26
33
|
steps: ScenarioRunReportStep[];
|
|
34
|
+
evidence: ScenarioRunEvidenceSummary;
|
|
27
35
|
gitSummary?: ScenarioRunGitSummary;
|
|
28
36
|
}): Promise<void>;
|
|
29
37
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../../../src/commands/scenario/impl/report.ts"],"names":[],"mappings":"AAYA,KAAK,qBAAqB,GAAG;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;
|
|
1
|
+
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../../../src/commands/scenario/impl/report.ts"],"names":[],"mappings":"AAYA,KAAK,qBAAqB,GAAG;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,sBAAsB,CAAC,EAAE,MAAM,EAAE,CAAC;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,KAAK,0BAA0B,GAAG;IAChC,QAAQ,EAAE,OAAO,CAAC;IAClB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB,CAAC;AA4BF,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAmBnD;AASD,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAwB/F;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,GAAG,MAAM,EAAE,CAU5F;AAED,wBAAsB,mBAAmB,CAAC,IAAI,EAAE;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC7B,KAAK,EAAE,qBAAqB,EAAE,CAAC;IAC/B,QAAQ,EAAE,0BAA0B,CAAC;IACrC,UAAU,CAAC,EAAE,qBAAqB,CAAC;CACpC,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBhB"}
|
|
@@ -93,6 +93,7 @@ export async function writeScenarioReport(opts) {
|
|
|
93
93
|
ended_at: new Date().toISOString(),
|
|
94
94
|
status: opts.status,
|
|
95
95
|
steps: opts.steps,
|
|
96
|
+
evidence: opts.evidence,
|
|
96
97
|
git: opts.gitSummary,
|
|
97
98
|
};
|
|
98
99
|
await atomicWriteFile(path.join(opts.runDir, SCENARIO_REPORT_NAME), `${JSON.stringify(report, null, 2)}\n`, "utf8");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reconcile-check.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/reconcile-check.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAgBvE,wBAAsB,8BAA8B,CAAC,IAAI,EAAE;IACzD,GAAG,EAAE,cAAc,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,GAAG,OAAO,CAAC,IAAI,CAAC,CA4ChB"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { exitCodeForError } from "../../cli/exit-codes.js";
|
|
2
|
+
import { CliError } from "../../shared/errors.js";
|
|
3
|
+
import { listTasksMemo } from "./task-backend.js";
|
|
4
|
+
function compactError(err) {
|
|
5
|
+
if (err instanceof Error) {
|
|
6
|
+
const text = err.message.trim();
|
|
7
|
+
return text.length > 0 ? text : err.name;
|
|
8
|
+
}
|
|
9
|
+
return String(err);
|
|
10
|
+
}
|
|
11
|
+
function summarizeWarnings(warnings) {
|
|
12
|
+
const preview = warnings.slice(0, 3).join("; ");
|
|
13
|
+
const suffix = warnings.length > 3 ? `; +${warnings.length - 3} more` : "";
|
|
14
|
+
return `skipped ${warnings.length} task files during scan (${preview}${suffix})`;
|
|
15
|
+
}
|
|
16
|
+
export async function ensureReconciledBeforeMutation(opts) {
|
|
17
|
+
try {
|
|
18
|
+
await opts.ctx.git.statusChangedPaths();
|
|
19
|
+
}
|
|
20
|
+
catch (err) {
|
|
21
|
+
throw new CliError({
|
|
22
|
+
exitCode: exitCodeForError("E_GIT"),
|
|
23
|
+
code: "E_GIT",
|
|
24
|
+
message: `reconcile check failed: cannot inspect git status (${compactError(err)})`,
|
|
25
|
+
context: {
|
|
26
|
+
command: opts.command,
|
|
27
|
+
reason_code: "reconcile_git_state_unreadable",
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
if (opts.strictTaskScan === false)
|
|
32
|
+
return;
|
|
33
|
+
try {
|
|
34
|
+
await listTasksMemo(opts.ctx);
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
throw new CliError({
|
|
38
|
+
exitCode: exitCodeForError("E_VALIDATION"),
|
|
39
|
+
code: "E_VALIDATION",
|
|
40
|
+
message: `reconcile check failed: task scan error (${compactError(err)})`,
|
|
41
|
+
context: {
|
|
42
|
+
command: opts.command,
|
|
43
|
+
reason_code: "reconcile_task_scan_failed",
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
const warnings = opts.ctx.taskBackend.getLastListWarnings?.() ?? [];
|
|
48
|
+
if (warnings.length === 0)
|
|
49
|
+
return;
|
|
50
|
+
throw new CliError({
|
|
51
|
+
exitCode: exitCodeForError("E_VALIDATION"),
|
|
52
|
+
code: "E_VALIDATION",
|
|
53
|
+
message: `reconcile check failed: ${summarizeWarnings(warnings)}`,
|
|
54
|
+
context: {
|
|
55
|
+
command: opts.command,
|
|
56
|
+
reason_code: "reconcile_task_scan_incomplete",
|
|
57
|
+
warning_count: warnings.length,
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
}
|