agentplane 0.3.21 → 0.3.23
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/assets/policy/incidents.md +4 -0
- package/dist/.build-manifest.json +67 -42
- package/dist/cli/bootstrap-guide.d.ts +1 -0
- package/dist/cli/bootstrap-guide.d.ts.map +1 -1
- package/dist/cli/bootstrap-guide.js +3 -2
- package/dist/cli/command-guide.d.ts.map +1 -1
- package/dist/cli/command-guide.js +5 -4
- package/dist/cli/run-cli/commands/init/orchestrate-v2.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/init/orchestrate-v2.js +10 -2
- package/dist/cli/run-cli/commands/init/orchestrate.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/init/orchestrate.js +10 -2
- package/dist/cli/run-cli/commands/init/recipes.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/init/recipes.js +3 -1
- package/dist/cli.js +356 -341
- package/dist/commands/branch/work-start.hook-shim.d.ts.map +1 -1
- package/dist/commands/branch/work-start.hook-shim.js +16 -4
- package/dist/commands/doctor/hook-readiness.d.ts +2 -0
- package/dist/commands/doctor/hook-readiness.d.ts.map +1 -0
- package/dist/commands/doctor/hook-readiness.js +171 -0
- package/dist/commands/doctor/workspace.d.ts.map +1 -1
- package/dist/commands/doctor/workspace.js +2 -1
- package/dist/commands/guard/impl/commit.d.ts.map +1 -1
- package/dist/commands/guard/impl/commit.js +26 -0
- package/dist/commands/hooks/install.d.ts +4 -0
- package/dist/commands/hooks/install.d.ts.map +1 -1
- package/dist/commands/hooks/install.js +35 -4
- package/dist/commands/hooks/run.pre-push.d.ts.map +1 -1
- package/dist/commands/hooks/run.pre-push.js +237 -13
- package/dist/commands/recipes/impl/installed-recipes.d.ts +5 -1
- package/dist/commands/recipes/impl/installed-recipes.d.ts.map +1 -1
- package/dist/commands/recipes/impl/installed-recipes.js +38 -19
- package/dist/commands/release/apply.mutation.d.ts.map +1 -1
- package/dist/commands/release/apply.mutation.js +5 -4
- package/dist/commands/release/apply.pipeline/mutation.d.ts.map +1 -1
- package/dist/commands/release/apply.pipeline/mutation.js +6 -1
- package/dist/commands/release/apply.preflight.d.ts.map +1 -1
- package/dist/commands/release/apply.preflight.js +5 -4
- package/dist/commands/task/derive.command.js +1 -1
- package/dist/commands/task/finish-execute.d.ts.map +1 -1
- package/dist/commands/task/finish-execute.js +8 -1
- package/dist/commands/task/shared/transitions.d.ts.map +1 -1
- package/dist/commands/task/shared/transitions.js +11 -2
- package/dist/commands/task/verify-command-shared.d.ts.map +1 -1
- package/dist/commands/task/verify-command-shared.js +8 -2
- package/dist/runtime/prompt-modules/index.d.ts +3 -0
- package/dist/runtime/prompt-modules/index.d.ts.map +1 -0
- package/dist/runtime/prompt-modules/index.js +1 -0
- package/dist/runtime/prompt-modules/model.d.ts +89 -0
- package/dist/runtime/prompt-modules/model.d.ts.map +1 -0
- package/dist/runtime/prompt-modules/model.js +1 -0
- package/dist/runtime/prompt-modules/mutations.d.ts +103 -0
- package/dist/runtime/prompt-modules/mutations.d.ts.map +1 -0
- package/dist/runtime/prompt-modules/mutations.js +1 -0
- package/dist/shared/runtime-env.d.ts +3 -0
- package/dist/shared/runtime-env.d.ts.map +1 -0
- package/dist/shared/runtime-env.js +73 -0
- package/package.json +3 -3
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import { resolveProject } from "@agentplaneorg/core/project";
|
|
2
2
|
import { runProcessSync } from "@agentplaneorg/core/process";
|
|
3
|
+
import fs from "node:fs";
|
|
3
4
|
import path from "node:path";
|
|
4
5
|
import { fileExists } from "../../cli/fs-utils.js";
|
|
5
|
-
import { CliError } from "../../shared/errors.js";
|
|
6
6
|
import { resolveAgentplaneRepoScriptPath } from "../../shared/package-paths.js";
|
|
7
|
+
import { resolvePreferredNodeExecutable, withPreferredRuntimePath, } from "../../shared/runtime-env.js";
|
|
7
8
|
function resolveBundledPrePushHookScriptPath() {
|
|
8
9
|
return resolveAgentplaneRepoScriptPath("run-pre-push-hook.mjs");
|
|
9
10
|
}
|
|
11
|
+
class HookFailure extends Error {
|
|
12
|
+
details;
|
|
13
|
+
constructor(message, details = []) {
|
|
14
|
+
super(message);
|
|
15
|
+
this.details = details;
|
|
16
|
+
this.name = "HookFailure";
|
|
17
|
+
}
|
|
18
|
+
}
|
|
10
19
|
export async function resolvePrePushHookScriptPath(gitRoot, opts = {}) {
|
|
11
20
|
const repoScriptPath = path.join(gitRoot, "scripts", "run-pre-push-hook.mjs");
|
|
12
21
|
if (await fileExists(repoScriptPath))
|
|
@@ -16,6 +25,230 @@ export async function resolvePrePushHookScriptPath(gitRoot, opts = {}) {
|
|
|
16
25
|
return bundledScriptPath;
|
|
17
26
|
return null;
|
|
18
27
|
}
|
|
28
|
+
function parsePrePushStdin(rawStdin) {
|
|
29
|
+
return rawStdin
|
|
30
|
+
.split("\n")
|
|
31
|
+
.map((line) => line.trim())
|
|
32
|
+
.filter(Boolean)
|
|
33
|
+
.map((line) => {
|
|
34
|
+
const [localRef = "", localSha = "", remoteRef = "", remoteSha = ""] = line.split(/\s+/);
|
|
35
|
+
return { localRef, localSha, remoteRef, remoteSha };
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function isAllZeroSha(value) {
|
|
39
|
+
return /^[0]+$/.test(value);
|
|
40
|
+
}
|
|
41
|
+
function isBranchRef(ref) {
|
|
42
|
+
return ref.startsWith("refs/heads/");
|
|
43
|
+
}
|
|
44
|
+
function runHookCommand(gitRoot, command, args) {
|
|
45
|
+
const result = runProcessSync({
|
|
46
|
+
command,
|
|
47
|
+
args,
|
|
48
|
+
cwd: gitRoot,
|
|
49
|
+
env: withPreferredRuntimePath(process.env),
|
|
50
|
+
stdout: "inherit",
|
|
51
|
+
stderr: "inherit",
|
|
52
|
+
reject: false,
|
|
53
|
+
});
|
|
54
|
+
return result.exitCode ?? (result.signal ? 1 : 0);
|
|
55
|
+
}
|
|
56
|
+
function runHookCommandWithEnv(gitRoot, command, args, env) {
|
|
57
|
+
const result = runProcessSync({
|
|
58
|
+
command,
|
|
59
|
+
args,
|
|
60
|
+
cwd: gitRoot,
|
|
61
|
+
env,
|
|
62
|
+
stdout: "inherit",
|
|
63
|
+
stderr: "inherit",
|
|
64
|
+
reject: false,
|
|
65
|
+
});
|
|
66
|
+
return result.exitCode ?? (result.signal ? 1 : 0);
|
|
67
|
+
}
|
|
68
|
+
function readGitText(gitRoot, args) {
|
|
69
|
+
const result = runProcessSync({
|
|
70
|
+
command: "git",
|
|
71
|
+
args,
|
|
72
|
+
cwd: gitRoot,
|
|
73
|
+
encoding: "utf8",
|
|
74
|
+
reject: false,
|
|
75
|
+
});
|
|
76
|
+
if (result.exitCode !== 0)
|
|
77
|
+
return "";
|
|
78
|
+
return String(result.stdout ?? "").trim();
|
|
79
|
+
}
|
|
80
|
+
function readPackageScripts(gitRoot) {
|
|
81
|
+
try {
|
|
82
|
+
const parsed = JSON.parse(fs.readFileSync(path.join(gitRoot, "package.json"), "utf8"));
|
|
83
|
+
if (!parsed.scripts || typeof parsed.scripts !== "object" || Array.isArray(parsed.scripts)) {
|
|
84
|
+
return {};
|
|
85
|
+
}
|
|
86
|
+
const scripts = {};
|
|
87
|
+
for (const [name, value] of Object.entries(parsed.scripts)) {
|
|
88
|
+
if (typeof value === "string")
|
|
89
|
+
scripts[name] = value;
|
|
90
|
+
}
|
|
91
|
+
return scripts;
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
return {};
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function hasProjectScript(scripts, name) {
|
|
98
|
+
return Object.hasOwn(scripts, name);
|
|
99
|
+
}
|
|
100
|
+
function runOptionalProjectScript(gitRoot, scripts, name, opts = {}) {
|
|
101
|
+
if (!hasProjectScript(scripts, name)) {
|
|
102
|
+
process.stdout.write(`Skipping ${name}: package.json script is not defined.\n`);
|
|
103
|
+
return { exitCode: 0, skipped: true };
|
|
104
|
+
}
|
|
105
|
+
if (opts.heading)
|
|
106
|
+
process.stdout.write(opts.heading);
|
|
107
|
+
const exitCode = opts.env
|
|
108
|
+
? runHookCommandWithEnv(gitRoot, "bun", ["run", name], opts.env)
|
|
109
|
+
: runHookCommand(gitRoot, "bun", ["run", name]);
|
|
110
|
+
return { exitCode, skipped: false };
|
|
111
|
+
}
|
|
112
|
+
function trackedChangesShort(gitRoot) {
|
|
113
|
+
return readGitText(gitRoot, ["status", "--short", "--untracked-files=no"]);
|
|
114
|
+
}
|
|
115
|
+
function fail(message, details = []) {
|
|
116
|
+
throw new HookFailure(message, details);
|
|
117
|
+
}
|
|
118
|
+
function failIfTrackedChanges(gitRoot, message) {
|
|
119
|
+
const changes = trackedChangesShort(gitRoot);
|
|
120
|
+
if (!changes)
|
|
121
|
+
return;
|
|
122
|
+
fail(message, [changes]);
|
|
123
|
+
}
|
|
124
|
+
function gitRefExists(gitRoot, ref) {
|
|
125
|
+
return readGitText(gitRoot, ["rev-parse", "--verify", "--quiet", ref]).length > 0;
|
|
126
|
+
}
|
|
127
|
+
function hasReleaseTagPush(updates) {
|
|
128
|
+
return updates.some((update) => update.remoteRef.startsWith("refs/tags/"));
|
|
129
|
+
}
|
|
130
|
+
function isDeleteOnlyPush(updates) {
|
|
131
|
+
return (updates.length > 0 &&
|
|
132
|
+
updates.every((update) => isBranchRef(update.remoteRef) && isAllZeroSha(update.localSha) && Boolean(update.remoteSha)));
|
|
133
|
+
}
|
|
134
|
+
function resolveDefaultBaseRef(gitRoot) {
|
|
135
|
+
const remoteHead = readGitText(gitRoot, [
|
|
136
|
+
"symbolic-ref",
|
|
137
|
+
"--quiet",
|
|
138
|
+
"--short",
|
|
139
|
+
"refs/remotes/origin/HEAD",
|
|
140
|
+
]);
|
|
141
|
+
if (remoteHead)
|
|
142
|
+
return remoteHead;
|
|
143
|
+
if (gitRefExists(gitRoot, "origin/main"))
|
|
144
|
+
return "origin/main";
|
|
145
|
+
if (gitRefExists(gitRoot, "main"))
|
|
146
|
+
return "main";
|
|
147
|
+
return null;
|
|
148
|
+
}
|
|
149
|
+
function selectBranchDiffRange(updates, opts = {}) {
|
|
150
|
+
const branchUpdates = updates.filter((update) => isBranchRef(update.localRef) && isBranchRef(update.remoteRef));
|
|
151
|
+
if (branchUpdates.length !== 1)
|
|
152
|
+
return null;
|
|
153
|
+
const [update] = branchUpdates;
|
|
154
|
+
if (!update?.localSha || !update.remoteSha)
|
|
155
|
+
return null;
|
|
156
|
+
if (isAllZeroSha(update.localSha))
|
|
157
|
+
return null;
|
|
158
|
+
if (isAllZeroSha(update.remoteSha)) {
|
|
159
|
+
const fallbackRef = typeof opts.newBranchFallbackRef === "string" ? opts.newBranchFallbackRef.trim() : "";
|
|
160
|
+
return fallbackRef ? { from: fallbackRef, to: update.localSha } : null;
|
|
161
|
+
}
|
|
162
|
+
return { from: update.remoteSha, to: update.localSha };
|
|
163
|
+
}
|
|
164
|
+
function readChangedFilesForRange(gitRoot, range) {
|
|
165
|
+
if (!range)
|
|
166
|
+
return [];
|
|
167
|
+
const output = readGitText(gitRoot, ["diff", "--name-only", `${range.from}..${range.to}`]);
|
|
168
|
+
return output
|
|
169
|
+
.split("\n")
|
|
170
|
+
.map((line) => line.trim())
|
|
171
|
+
.filter(Boolean);
|
|
172
|
+
}
|
|
173
|
+
function fileExistsSync(filePath) {
|
|
174
|
+
try {
|
|
175
|
+
return fs.statSync(filePath).isFile();
|
|
176
|
+
}
|
|
177
|
+
catch {
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
function isTruthyHookEnv(name) {
|
|
182
|
+
return (String(process.env[name] ?? "")
|
|
183
|
+
.trim()
|
|
184
|
+
.toLowerCase() === "1");
|
|
185
|
+
}
|
|
186
|
+
function runInternalPrePushHook(gitRoot, stdin) {
|
|
187
|
+
try {
|
|
188
|
+
const updates = parsePrePushStdin(stdin);
|
|
189
|
+
const envRelease = isTruthyHookEnv("AGENTPLANE_HOOKS_RELEASE");
|
|
190
|
+
const envFull = isTruthyHookEnv("AGENTPLANE_HOOKS_FULL");
|
|
191
|
+
const isReleasePush = envRelease || envFull || hasReleaseTagPush(updates);
|
|
192
|
+
if (!isReleasePush && isDeleteOnlyPush(updates)) {
|
|
193
|
+
process.stdout.write("Skipping pre-push checks for delete-only remote branch cleanup.\n");
|
|
194
|
+
return 0;
|
|
195
|
+
}
|
|
196
|
+
const mode = isReleasePush ? "release" : "standard";
|
|
197
|
+
process.stdout.write(`Running pre-push checks in ${mode} mode.\n`);
|
|
198
|
+
const ciScript = envFull ? "ci:local:full" : "ci:local:fast";
|
|
199
|
+
const scripts = readPackageScripts(gitRoot);
|
|
200
|
+
const changedFiles = readChangedFilesForRange(gitRoot, selectBranchDiffRange(updates, {
|
|
201
|
+
newBranchFallbackRef: resolveDefaultBaseRef(gitRoot),
|
|
202
|
+
}));
|
|
203
|
+
const ciEnv = changedFiles.length > 0
|
|
204
|
+
? { ...process.env, AGENTPLANE_FAST_CHANGED_FILES: changedFiles.join("\n") }
|
|
205
|
+
: process.env;
|
|
206
|
+
const formatResult = runOptionalProjectScript(gitRoot, scripts, "format:check", {
|
|
207
|
+
heading: "\n== Format (check) ==\n",
|
|
208
|
+
});
|
|
209
|
+
if (formatResult.exitCode !== 0) {
|
|
210
|
+
failIfTrackedChanges(gitRoot, "pre-push blocked: format:check changed tracked files unexpectedly. Revert or commit those changes and push again.");
|
|
211
|
+
fail("pre-push blocked: formatting check failed. Run `bun run format`, review the diff, commit it, and push again.");
|
|
212
|
+
}
|
|
213
|
+
if (!formatResult.skipped) {
|
|
214
|
+
failIfTrackedChanges(gitRoot, "pre-push blocked: format:check changed tracked files unexpectedly. Revert or commit those changes and push again.");
|
|
215
|
+
}
|
|
216
|
+
const ciResult = runOptionalProjectScript(gitRoot, scripts, ciScript, { env: ciEnv });
|
|
217
|
+
if (!ciResult.skipped) {
|
|
218
|
+
failIfTrackedChanges(gitRoot, `pre-push blocked: ${ciScript} changed tracked files. Commit or revert those changes and push again.`);
|
|
219
|
+
}
|
|
220
|
+
if (ciResult.exitCode !== 0) {
|
|
221
|
+
fail(`pre-push blocked: ${ciScript} failed. Fix the reported checks and push again.`);
|
|
222
|
+
}
|
|
223
|
+
if (isReleasePush) {
|
|
224
|
+
const releaseNotesScript = path.join(gitRoot, "scripts", "check-release-notes.mjs");
|
|
225
|
+
if (fileExistsSync(releaseNotesScript)) {
|
|
226
|
+
const notesExitCode = runHookCommand(gitRoot, resolvePreferredNodeExecutable(process.env), [
|
|
227
|
+
"scripts/check-release-notes.mjs",
|
|
228
|
+
]);
|
|
229
|
+
if (notesExitCode !== 0)
|
|
230
|
+
return notesExitCode;
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
process.stdout.write("Skipping release notes check: scripts/check-release-notes.mjs is not defined.\n");
|
|
234
|
+
}
|
|
235
|
+
return runOptionalProjectScript(gitRoot, scripts, "release:prepublish").exitCode;
|
|
236
|
+
}
|
|
237
|
+
return 0;
|
|
238
|
+
}
|
|
239
|
+
catch (error) {
|
|
240
|
+
if (error instanceof HookFailure) {
|
|
241
|
+
process.stderr.write(`\n${error.message}\n`);
|
|
242
|
+
for (const detail of error.details) {
|
|
243
|
+
if (!detail)
|
|
244
|
+
continue;
|
|
245
|
+
process.stderr.write(`${detail}\n`);
|
|
246
|
+
}
|
|
247
|
+
return 1;
|
|
248
|
+
}
|
|
249
|
+
throw error;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
19
252
|
async function readHookStdinUtf8(timeoutMs = 25) {
|
|
20
253
|
if (process.stdin.isTTY)
|
|
21
254
|
return "";
|
|
@@ -59,19 +292,10 @@ export async function runPrePushHook(opts) {
|
|
|
59
292
|
cwd: opts.cwd,
|
|
60
293
|
rootOverride: opts.rootOverride ?? null,
|
|
61
294
|
});
|
|
295
|
+
const stdin = await readHookStdinUtf8();
|
|
62
296
|
const scriptPath = await resolvePrePushHookScriptPath(resolved.gitRoot);
|
|
63
297
|
if (!scriptPath) {
|
|
64
|
-
|
|
65
|
-
exitCode: 2,
|
|
66
|
-
code: "E_USAGE",
|
|
67
|
-
message: [
|
|
68
|
-
"Missing pre-push hook script: scripts/run-pre-push-hook.mjs",
|
|
69
|
-
"The pre-push hook needs a repository-local script or an installed CLI bundle that ships the fallback.",
|
|
70
|
-
"Fix:",
|
|
71
|
-
" 1) Restore scripts/run-pre-push-hook.mjs in this repository, or",
|
|
72
|
-
" 2) Run `agentplane hooks uninstall` if this repository should not use the agentplane pre-push gate.",
|
|
73
|
-
].join("\n"),
|
|
74
|
-
});
|
|
298
|
+
return runInternalPrePushHook(resolved.gitRoot, stdin);
|
|
75
299
|
}
|
|
76
300
|
const result = runProcessSync({
|
|
77
301
|
command: "node",
|
|
@@ -79,7 +303,7 @@ export async function runPrePushHook(opts) {
|
|
|
79
303
|
cwd: resolved.gitRoot,
|
|
80
304
|
env: process.env,
|
|
81
305
|
encoding: "utf8",
|
|
82
|
-
input:
|
|
306
|
+
input: stdin,
|
|
83
307
|
stdin: "pipe",
|
|
84
308
|
stdout: "inherit",
|
|
85
309
|
stderr: "inherit",
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { type InstalledRecipesFile } from "@agentplaneorg/recipes";
|
|
2
|
+
type ValidateInstalledRecipesFileOptions = {
|
|
3
|
+
dropInvalidEntries?: boolean;
|
|
4
|
+
};
|
|
2
5
|
export declare function readInstalledRecipesFile(filePath: string): Promise<InstalledRecipesFile>;
|
|
3
|
-
export declare function readAndMigrateInstalledRecipesFile(filePath: string): Promise<InstalledRecipesFile>;
|
|
6
|
+
export declare function readAndMigrateInstalledRecipesFile(filePath: string, opts?: ValidateInstalledRecipesFileOptions): Promise<InstalledRecipesFile>;
|
|
4
7
|
export declare function writeInstalledRecipesFile(filePath: string, file: InstalledRecipesFile): Promise<void>;
|
|
8
|
+
export {};
|
|
5
9
|
//# sourceMappingURL=installed-recipes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installed-recipes.d.ts","sourceRoot":"","sources":["../../../../src/commands/recipes/impl/installed-recipes.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"installed-recipes.d.ts","sourceRoot":"","sources":["../../../../src/commands/recipes/impl/installed-recipes.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,wBAAwB,CAAC;AAMhC,KAAK,mCAAmC,GAAG;IACzC,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAC;AAgEF,wBAAsB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAS9F;AAED,wBAAsB,kCAAkC,CACtD,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,mCAAmC,GACzC,OAAO,CAAC,oBAAoB,CAAC,CAc/B;AAED,wBAAsB,yBAAyB,CAC7C,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,oBAAoB,GACzB,OAAO,CAAC,IAAI,CAAC,CAOf"}
|
|
@@ -5,7 +5,39 @@ import { normalizeRecipeTags, validateRecipeManifest, } from "@agentplaneorg/rec
|
|
|
5
5
|
import { invalidFieldMessage } from "../../../cli/output.js";
|
|
6
6
|
import { isRecord } from "../../../shared/guards.js";
|
|
7
7
|
import { writeJsonStableIfChanged } from "../../../shared/write-if-changed.js";
|
|
8
|
-
function
|
|
8
|
+
function normalizeInstalledRecipeEntry(entry, opts) {
|
|
9
|
+
if (!isRecord(entry)) {
|
|
10
|
+
if (opts?.dropInvalidEntries)
|
|
11
|
+
return null;
|
|
12
|
+
throw new Error(invalidFieldMessage("recipes.json.recipes[]", "object"));
|
|
13
|
+
}
|
|
14
|
+
let manifest;
|
|
15
|
+
try {
|
|
16
|
+
manifest = validateRecipeManifest(entry.manifest);
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
if (opts?.dropInvalidEntries)
|
|
20
|
+
return null;
|
|
21
|
+
throw error;
|
|
22
|
+
}
|
|
23
|
+
const id = typeof entry.id === "string" ? entry.id.trim() : manifest.id;
|
|
24
|
+
const version = typeof entry.version === "string" ? entry.version.trim() : manifest.version;
|
|
25
|
+
const source = typeof entry.source === "string" ? entry.source.trim() : "";
|
|
26
|
+
const installedAt = typeof entry.installed_at === "string" ? entry.installed_at.trim() : "";
|
|
27
|
+
if (!id || !version || !source || !installedAt) {
|
|
28
|
+
if (opts?.dropInvalidEntries)
|
|
29
|
+
return null;
|
|
30
|
+
throw new Error(invalidFieldMessage("recipes.json.recipes[]", "id, version, source, installed_at"));
|
|
31
|
+
}
|
|
32
|
+
if (id !== manifest.id || version !== manifest.version) {
|
|
33
|
+
if (opts?.dropInvalidEntries)
|
|
34
|
+
return null;
|
|
35
|
+
throw new Error(invalidFieldMessage("recipes.json.recipes[]", "id/version match manifest"));
|
|
36
|
+
}
|
|
37
|
+
const tags = normalizeRecipeTags(entry.tags ?? manifest.tags ?? []);
|
|
38
|
+
return { id, version, source, installed_at: installedAt, tags, manifest };
|
|
39
|
+
}
|
|
40
|
+
function validateInstalledRecipesFile(raw, opts) {
|
|
9
41
|
if (!isRecord(raw))
|
|
10
42
|
throw new Error(invalidFieldMessage("recipes.json", "object"));
|
|
11
43
|
if (raw.schema_version !== 1)
|
|
@@ -13,22 +45,9 @@ function validateInstalledRecipesFile(raw) {
|
|
|
13
45
|
if (!Array.isArray(raw.recipes))
|
|
14
46
|
throw new Error(invalidFieldMessage("recipes.json.recipes", "array"));
|
|
15
47
|
const updatedAt = typeof raw.updated_at === "string" ? raw.updated_at : "";
|
|
16
|
-
const recipes = raw.recipes
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const manifest = validateRecipeManifest(entry.manifest);
|
|
20
|
-
const id = typeof entry.id === "string" ? entry.id.trim() : manifest.id;
|
|
21
|
-
const version = typeof entry.version === "string" ? entry.version.trim() : manifest.version;
|
|
22
|
-
const source = typeof entry.source === "string" ? entry.source.trim() : "";
|
|
23
|
-
const installedAt = typeof entry.installed_at === "string" ? entry.installed_at.trim() : "";
|
|
24
|
-
if (!id || !version || !source || !installedAt) {
|
|
25
|
-
throw new Error(invalidFieldMessage("recipes.json.recipes[]", "id, version, source, installed_at"));
|
|
26
|
-
}
|
|
27
|
-
if (id !== manifest.id || version !== manifest.version) {
|
|
28
|
-
throw new Error(invalidFieldMessage("recipes.json.recipes[]", "id/version match manifest"));
|
|
29
|
-
}
|
|
30
|
-
const tags = normalizeRecipeTags(entry.tags ?? manifest.tags ?? []);
|
|
31
|
-
return { id, version, source, installed_at: installedAt, tags, manifest };
|
|
48
|
+
const recipes = raw.recipes.flatMap((entry) => {
|
|
49
|
+
const normalized = normalizeInstalledRecipeEntry(entry, opts);
|
|
50
|
+
return normalized ? [normalized] : [];
|
|
32
51
|
});
|
|
33
52
|
return { schema_version: 1, updated_at: updatedAt, recipes };
|
|
34
53
|
}
|
|
@@ -54,10 +73,10 @@ export async function readInstalledRecipesFile(filePath) {
|
|
|
54
73
|
throw err;
|
|
55
74
|
}
|
|
56
75
|
}
|
|
57
|
-
export async function readAndMigrateInstalledRecipesFile(filePath) {
|
|
76
|
+
export async function readAndMigrateInstalledRecipesFile(filePath, opts) {
|
|
58
77
|
try {
|
|
59
78
|
const raw = JSON.parse(await readFile(filePath, "utf8"));
|
|
60
|
-
const normalized = sortInstalledRecipes(validateInstalledRecipesFile(raw));
|
|
79
|
+
const normalized = sortInstalledRecipes(validateInstalledRecipesFile(raw, opts));
|
|
61
80
|
if (installedRecipesNeedMigration(raw, normalized)) {
|
|
62
81
|
await mkdir(path.dirname(filePath), { recursive: true });
|
|
63
82
|
await writeJsonStableIfChanged(filePath, normalized);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply.mutation.d.ts","sourceRoot":"","sources":["../../../src/commands/release/apply.mutation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"apply.mutation.d.ts","sourceRoot":"","sources":["../../../src/commands/release/apply.mutation.ts"],"names":[],"mappings":"AAaA,wBAAsB,2BAA2B,CAC/C,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC,CAWf;AAED,wBAAsB,gCAAgC,CACpD,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC,CAqCf;AAED,wBAAsB,+BAA+B,CACnD,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,MAAM,EACtB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC,CAiBf;AAED,wBAAsB,uBAAuB,CAC3C,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,OAAO,CAAC,CAKlB;AAED,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,GAC1C,OAAO,CAAC,IAAI,CAAC,CAyBf;AAED,wBAAsB,8BAA8B,CAClD,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,GAC1C,OAAO,CAAC,OAAO,CAAC,CAyBlB;AAED,wBAAsB,8BAA8B,CAClD,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,OAAO,CAAC,CAQlB;AAED,wBAAgB,YAAY,IAAI,MAAM,CAAC,UAAU,CAOhD"}
|
|
@@ -3,6 +3,7 @@ import { readFile, writeFile } from "node:fs/promises";
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { exitCodeForError } from "../../cli/exit-codes.js";
|
|
5
5
|
import { CliError } from "../../shared/errors.js";
|
|
6
|
+
import { resolvePreferredNodeExecutable, withPreferredRuntimePath, } from "../../shared/runtime-env.js";
|
|
6
7
|
import { execFileAsync } from "@agentplaneorg/core/process";
|
|
7
8
|
import { gitEnv } from "@agentplaneorg/core/git";
|
|
8
9
|
export async function replacePackageVersionInFile(pkgJsonPath, nextVersion) {
|
|
@@ -75,7 +76,7 @@ export async function maybeUpdateBunLockfile(gitRoot, fileExists) {
|
|
|
75
76
|
try {
|
|
76
77
|
await execFileAsync("bun", ["install", "--ignore-scripts"], {
|
|
77
78
|
cwd: gitRoot,
|
|
78
|
-
env: process.env,
|
|
79
|
+
env: withPreferredRuntimePath(process.env),
|
|
79
80
|
maxBuffer: 50 * 1024 * 1024,
|
|
80
81
|
});
|
|
81
82
|
}
|
|
@@ -97,9 +98,9 @@ export async function maybeRefreshGeneratedReference(gitRoot, fileExists) {
|
|
|
97
98
|
if (!(await fileExists(scriptPath)))
|
|
98
99
|
return false;
|
|
99
100
|
try {
|
|
100
|
-
await execFileAsync(
|
|
101
|
+
await execFileAsync(resolvePreferredNodeExecutable(process.env), [scriptPath], {
|
|
101
102
|
cwd: gitRoot,
|
|
102
|
-
env: process.env,
|
|
103
|
+
env: withPreferredRuntimePath(process.env),
|
|
103
104
|
maxBuffer: 20 * 1024 * 1024,
|
|
104
105
|
});
|
|
105
106
|
}
|
|
@@ -132,5 +133,5 @@ export function cleanHookEnv() {
|
|
|
132
133
|
delete env.AGENTPLANE_STATUS_TO;
|
|
133
134
|
delete env.AGENTPLANE_AGENT_ID;
|
|
134
135
|
env.AGENTPLANE_ALLOW_CONFIG = "1";
|
|
135
|
-
return env;
|
|
136
|
+
return withPreferredRuntimePath(env);
|
|
136
137
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutation.d.ts","sourceRoot":"","sources":["../../../../src/commands/release/apply.pipeline/mutation.ts"],"names":[],"mappings":"AAKA,OAAO,EAAU,UAAU,EAAyB,MAAM,yBAAyB,CAAC;AAYpF,OAAO,KAAK,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAGrF,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,UAAU,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACpC,gBAAgB,EAAE,MAAM,CAAC;CAC1B,GAAG,OAAO,CAAC,sBAAsB,CAAC,
|
|
1
|
+
{"version":3,"file":"mutation.d.ts","sourceRoot":"","sources":["../../../../src/commands/release/apply.pipeline/mutation.ts"],"names":[],"mappings":"AAKA,OAAO,EAAU,UAAU,EAAyB,MAAM,yBAAyB,CAAC;AAYpF,OAAO,KAAK,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAGrF,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,UAAU,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACpC,gBAAgB,EAAE,MAAM,CAAC;CAC1B,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAuElC;AAED,wBAAsB,wBAAwB,CAC5C,KAAK,EAAE,mBAAmB,GACzB,OAAO,CAAC,sBAAsB,CAAC,CAgBjC"}
|
|
@@ -14,9 +14,14 @@ export async function applyReleaseMutation(opts) {
|
|
|
14
14
|
]);
|
|
15
15
|
const shouldUpdateTestkitAgentplaneDependency = (await fileExists(opts.testkitPkgPath)) &&
|
|
16
16
|
(await packageDependencyExists(opts.testkitPkgPath, "agentplane"));
|
|
17
|
+
const shouldUpdateTestkitCoreDependency = (await fileExists(opts.testkitPkgPath)) &&
|
|
18
|
+
(await packageDependencyExists(opts.testkitPkgPath, "@agentplaneorg/core"));
|
|
17
19
|
if (shouldUpdateTestkitAgentplaneDependency) {
|
|
18
20
|
await replacePackageDependencyVersion(opts.testkitPkgPath, "agentplane", opts.nextVersion);
|
|
19
21
|
}
|
|
22
|
+
if (shouldUpdateTestkitCoreDependency) {
|
|
23
|
+
await replacePackageDependencyVersion(opts.testkitPkgPath, "@agentplaneorg/core", opts.nextVersion);
|
|
24
|
+
}
|
|
20
25
|
const expectedCliVersionPersisted = await maybePersistExpectedCliVersion(opts.agentplaneDir, opts.nextVersion);
|
|
21
26
|
await maybeUpdateBunLockfile(opts.gitRoot, fileExists);
|
|
22
27
|
const generatedReferenceExists = await maybeRefreshGeneratedReference(opts.gitRoot, fileExists);
|
|
@@ -26,7 +31,7 @@ export async function applyReleaseMutation(opts) {
|
|
|
26
31
|
"packages/recipes/package.json",
|
|
27
32
|
path.relative(opts.gitRoot, opts.notesPath),
|
|
28
33
|
];
|
|
29
|
-
if (shouldUpdateTestkitAgentplaneDependency) {
|
|
34
|
+
if (shouldUpdateTestkitAgentplaneDependency || shouldUpdateTestkitCoreDependency) {
|
|
30
35
|
stagePaths.push("packages/testkit/package.json");
|
|
31
36
|
}
|
|
32
37
|
if (expectedCliVersionPersisted) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply.preflight.d.ts","sourceRoot":"","sources":["../../../src/commands/release/apply.preflight.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"apply.preflight.d.ts","sourceRoot":"","sources":["../../../src/commands/release/apply.preflight.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,k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M,EAAE,MAAM,EACd,YAAY,GAAE,mBAAqC,GAClD,OAAO,CAAC,IAAI,CAAC,CA+Bf;AAED,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,YAAY,GAAE,mBAAqC,GAClD,OAAO,CAAC,IAAI,CAAC,CAyDf;AAED,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,YAAY,GAAE,mBAAqC,GAClD,OAAO,CAAC,IAAI,CAAC,CAuCf;AAgBD,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,MAAM,EACf,YAAY,GAAE,mBAAqC,GAClD,OAAO,CAAC,IAAI,CAAC,CAsCf;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC;IAC/F,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,kBAAkB,CAAC;IACzB,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC,CAwBD"}
|
|
@@ -3,6 +3,7 @@ import path from "node:path";
|
|
|
3
3
|
import { exitCodeForError } from "../../cli/exit-codes.js";
|
|
4
4
|
import { withDiagnosticContext } from "../shared/diagnostics.js";
|
|
5
5
|
import { CliError } from "../../shared/errors.js";
|
|
6
|
+
import { resolvePreferredNodeExecutable, withPreferredRuntimePath, } from "../../shared/runtime-env.js";
|
|
6
7
|
import { execFileAsync } from "@agentplaneorg/core/process";
|
|
7
8
|
import { gitEnv } from "@agentplaneorg/core/git";
|
|
8
9
|
export async function fileExists(p) {
|
|
@@ -270,9 +271,9 @@ export async function ensureRemoteTagDoesNotExist(gitRoot, remote, tag, commandL
|
|
|
270
271
|
export async function ensureNpmVersionsAvailable(gitRoot, version, commandLabel = "release apply") {
|
|
271
272
|
const scriptPath = path.join(gitRoot, "scripts", "check-npm-version-availability.mjs");
|
|
272
273
|
try {
|
|
273
|
-
await execFileAsync(
|
|
274
|
+
await execFileAsync(resolvePreferredNodeExecutable(process.env), [scriptPath, "--version", version], {
|
|
274
275
|
cwd: gitRoot,
|
|
275
|
-
env: process.env,
|
|
276
|
+
env: withPreferredRuntimePath(process.env),
|
|
276
277
|
maxBuffer: 10 * 1024 * 1024,
|
|
277
278
|
});
|
|
278
279
|
}
|
|
@@ -299,13 +300,13 @@ export async function ensureNpmVersionsAvailable(gitRoot, version, commandLabel
|
|
|
299
300
|
async function runReleasePrepublishPhase(gitRoot, phase) {
|
|
300
301
|
await execFileAsync("bun", ["run", `release:prepublish:${phase}`], {
|
|
301
302
|
cwd: gitRoot,
|
|
302
|
-
env: {
|
|
303
|
+
env: withPreferredRuntimePath({
|
|
303
304
|
...process.env,
|
|
304
305
|
GIT_AUTHOR_NAME: process.env.GIT_AUTHOR_NAME ?? "agentplane-release",
|
|
305
306
|
GIT_AUTHOR_EMAIL: process.env.GIT_AUTHOR_EMAIL ?? "agentplane-release@example.com",
|
|
306
307
|
GIT_COMMITTER_NAME: process.env.GIT_COMMITTER_NAME ?? "agentplane-release",
|
|
307
308
|
GIT_COMMITTER_EMAIL: process.env.GIT_COMMITTER_EMAIL ?? "agentplane-release@example.com",
|
|
308
|
-
},
|
|
309
|
+
}),
|
|
309
310
|
maxBuffer: 200 * 1024 * 1024,
|
|
310
311
|
});
|
|
311
312
|
}
|
|
@@ -55,7 +55,7 @@ export const taskDeriveSpec = {
|
|
|
55
55
|
],
|
|
56
56
|
examples: [
|
|
57
57
|
{
|
|
58
|
-
cmd: 'agentplane task derive 202602070101-ABCD --title "Implement X" --description "Do the thing" --owner CODER --tag code --verify "bun test"',
|
|
58
|
+
cmd: 'agentplane task derive 202602070101-ABCD --title "Implement X" --description "Do the thing" --owner CODER --tag code --verify "bun run test:project -- cli-core"',
|
|
59
59
|
why: "Create an implementation task derived from a spike with seeded verify steps.",
|
|
60
60
|
},
|
|
61
61
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"finish-execute.d.ts","sourceRoot":"","sources":["../../../src/commands/task/finish-execute.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAmBhE,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAE5E,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,GAAG,EAAE,cAAc,CAAC;IACpB,OAAO,EAAE,aAAa,CAAC;IACvB,IAAI,EAAE,mBAAmB,CAAC;CAC3B,GAAG,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"finish-execute.d.ts","sourceRoot":"","sources":["../../../src/commands/task/finish-execute.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAmBhE,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAE5E,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,GAAG,EAAE,cAAc,CAAC;IACpB,OAAO,EAAE,aAAa,CAAC;IACvB,IAAI,EAAE,mBAAmB,CAAC;CAC3B,GAAG,OAAO,CAAC,MAAM,CAAC,CA6GlB"}
|
|
@@ -22,7 +22,14 @@ export async function executeFinishPlan(opts) {
|
|
|
22
22
|
throw new CliError({
|
|
23
23
|
exitCode: 2,
|
|
24
24
|
code: "E_USAGE",
|
|
25
|
-
message:
|
|
25
|
+
message: [
|
|
26
|
+
"finish requires --commit <hash> or existing task commit metadata on every task; implicit HEAD fallback was removed.",
|
|
27
|
+
`tasks_missing_commit=${tasksMissingCommit.join(", ")}`,
|
|
28
|
+
"Fix:",
|
|
29
|
+
" 1) Select the implementation commit explicitly: git log --oneline --decorate -n 10",
|
|
30
|
+
' 2) Re-run finish with: agentplane finish <task-id> --author <ROLE> --body "Verified: ..." --result "..." --commit <hash>',
|
|
31
|
+
" 3) If the implementation is still unstaged, use --commit-from-comment with explicit --commit-allow <path-prefix> instead of relying on HEAD.",
|
|
32
|
+
].join("\n"),
|
|
26
33
|
});
|
|
27
34
|
}
|
|
28
35
|
if (options.commitFromComment || plan.statusCommitRequested) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transitions.d.ts","sourceRoot":"","sources":["../../../../src/commands/task/shared/transitions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AASnE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAGlE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAOnE,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAc3F;AAED,wBAAgB,qCAAqC,CACnD,IAAI,EAAE,QAAQ,EACd,MAAM,EAAE,gBAAgB,GACvB,IAAI,CAmBN;AAED,wBAAgB,0BAA0B,CAAC,IAAI,EAAE;IAC/C,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,gBAAgB,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,IAAI,CAKP;AAED,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAKxF;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"transitions.d.ts","s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C;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,IAAI,CAKP;AAED,wBAAsB,cAAc,CAClC,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,GACV,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAI5C;AAED,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAMlE"}
|
|
@@ -60,14 +60,23 @@ export function requireStructuredComment(body, prefix, minChars) {
|
|
|
60
60
|
throw new CliError({
|
|
61
61
|
exitCode: 2,
|
|
62
62
|
code: "E_USAGE",
|
|
63
|
-
message:
|
|
63
|
+
message: [
|
|
64
|
+
`Comment body must start with ${prefix}`,
|
|
65
|
+
`actual_start=${JSON.stringify(normalized.slice(0, Math.max(prefix.length, 1)))}`,
|
|
66
|
+
`actual_length=${normalized.length}; minimum_length=${minChars}`,
|
|
67
|
+
`Fix: pass --body "${prefix} <specific verification or start note at least ${minChars} characters long>"`,
|
|
68
|
+
].join("\n"),
|
|
64
69
|
});
|
|
65
70
|
}
|
|
66
71
|
if (normalized.length < minChars) {
|
|
67
72
|
throw new CliError({
|
|
68
73
|
exitCode: 2,
|
|
69
74
|
code: "E_USAGE",
|
|
70
|
-
message:
|
|
75
|
+
message: [
|
|
76
|
+
`Comment body must be at least ${minChars} characters`,
|
|
77
|
+
`actual_length=${normalized.length}; minimum_length=${minChars}; required_prefix=${prefix}`,
|
|
78
|
+
`Fix: expand --body "${prefix} <specific verification or start note at least ${minChars} characters long>"`,
|
|
79
|
+
].join("\n"),
|
|
71
80
|
});
|
|
72
81
|
}
|
|
73
82
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify-command-shared.d.ts","sourceRoot":"","sources":["../../../src/commands/task/verify-command-shared.ts"],"names":[],"mappings":"AACA,OAAO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AG,EAAE,SAAS,EACd,IAAI,EAAE,WAAW,CAAC,OAAO,CAAC,EAC1B,IAAI,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAC1B,IAAI,CA+BN;AAED,wBAAgB,2BAA2B,CAAC,OAAO,EACjD,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,WAAW,CAAC,OAAO,CAAC,EAC1B,IAAI,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAC1B,IAAI,
|
|
1
|
+
{"version":3,"file":"verify-command-shared.d.ts","sourceRoot":"","sources":["../../../src/commands/task/verify-command-shared.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEjF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;IACf,gBAAgB,EAAE,OAAO,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,SAAS,UAAU,EA+D5C,CAAC;AAEX,eAAO,MAAM,mBAAmB,EAAE,SAAS,UAAU,EAwC3C,CAAC;AAEX,wBAAgB,kCAAkC,CAAC,OAAO,EACxD,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,WAAW,CAAC,OAAO,CAAC,EAC1B,IAAI,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAC5C,IAAI,CAQN;AAED,wBAAgB,2BAA2B,CAAC,OAAO,EACjD,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,WAAW,CAAC,OAAO,CAAC,EAC1B,IAAI,EAAE,IAAI,GAAG,MAAM,GAClB,IAAI,CAKN;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAC9C,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,WAAW,CAAC,OAAO,CAAC,EAC1B,IAAI,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAC1B,IAAI,CA+BN;AAED,wBAAgB,2BAA2B,CAAC,OAAO,EACjD,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,WAAW,CAAC,OAAO,CAAC,EAC1B,IAAI,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAC1B,IAAI,CAyCN;AAED,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,SAAS,GAAG,kBAAkB,CAuB3E"}
|
|
@@ -151,6 +151,13 @@ export function validateVerifyNoteSource(raw, spec, opts) {
|
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
export function validateVerifyFindingSource(raw, spec, opts) {
|
|
154
|
+
if (raw.opts["local-only"] === true && raw.opts["repo-fixable"] === true) {
|
|
155
|
+
throw usageError({
|
|
156
|
+
spec,
|
|
157
|
+
command: opts?.command,
|
|
158
|
+
message: "--local-only cannot be combined with --repo-fixable.",
|
|
159
|
+
});
|
|
160
|
+
}
|
|
154
161
|
const hasFindingField = [
|
|
155
162
|
raw.opts.observation,
|
|
156
163
|
raw.opts.impact,
|
|
@@ -162,8 +169,7 @@ export function validateVerifyFindingSource(raw, spec, opts) {
|
|
|
162
169
|
const hasFindingCollections = Array.isArray(raw.opts["incident-tag"]) && raw.opts["incident-tag"].length > 0
|
|
163
170
|
? true
|
|
164
171
|
: Array.isArray(raw.opts["incident-match"]) && raw.opts["incident-match"].length > 0;
|
|
165
|
-
|
|
166
|
-
if (!hasFindingField && !hasFindingCollections && !hasFindingToggle)
|
|
172
|
+
if (!hasFindingField && !hasFindingCollections)
|
|
167
173
|
return;
|
|
168
174
|
const observation = raw.opts.observation;
|
|
169
175
|
const impact = raw.opts.impact;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { PROMPT_MODULE_CONTRACT_SCHEMA_VERSION, type PromptModule, type PromptModuleAddress, type PromptModuleConflictPolicy, type PromptModuleContentKind, type PromptModuleContractSchemaVersion, type PromptModuleDependency, type PromptModuleGraph, type PromptModuleGraphNode, type PromptModuleLoadCondition, type PromptModuleMergeMode, type PromptModuleMergePolicy, type PromptModuleMutability, type PromptModuleNamespace, type PromptModuleOwner, type PromptModuleProvenance, type PromptModuleReference, type PromptModuleSlot, type PromptModuleSourceKind, type PromptModuleSurface, type PromptModuleTarget, } from "./model.js";
|
|
2
|
+
export type { PromptModuleAddMutation, PromptModuleBindMutation, PromptModuleBinding, PromptModuleBindingKind, PromptModuleDisableMutation, PromptModuleMutation, PromptModuleMutationBase, PromptModuleMutationSet, PromptModuleMutationSource, PromptModuleMutationWhen, PromptModulePatchMutation, PromptModuleReplaceMutation, PromptModuleSelector, PromptModuleStructuredPatch, PromptModuleValidator, PromptModuleValidatorMutation, PromptModuleValidatorPhase, } from "./mutations.js";
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/prompt-modules/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qCAAqC,EACrC,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,EAC5B,KAAK,iCAAiC,EACtC,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,GACxB,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,uBAAuB,EACvB,wBAAwB,EACxB,mBAAmB,EACnB,uBAAuB,EACvB,2BAA2B,EAC3B,oBAAoB,EACpB,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,EAC1B,wBAAwB,EACxB,yBAAyB,EACzB,2BAA2B,EAC3B,oBAAoB,EACpB,2BAA2B,EAC3B,qBAAqB,EACrB,6BAA6B,EAC7B,0BAA0B,GAC3B,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PROMPT_MODULE_CONTRACT_SCHEMA_VERSION, } from "./model.js";
|