agentplane 0.3.22 → 0.3.24

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.
Files changed (62) hide show
  1. package/assets/policy/incidents.md +1 -0
  2. package/dist/.build-manifest.json +83 -28
  3. package/dist/cli/run-cli/commands/init/orchestrate-v2.d.ts.map +1 -1
  4. package/dist/cli/run-cli/commands/init/orchestrate-v2.js +10 -2
  5. package/dist/cli/run-cli/commands/init/orchestrate.d.ts.map +1 -1
  6. package/dist/cli/run-cli/commands/init/orchestrate.js +10 -2
  7. package/dist/cli/run-cli/commands/init/recipes.d.ts.map +1 -1
  8. package/dist/cli/run-cli/commands/init/recipes.js +3 -1
  9. package/dist/cli.js +337 -337
  10. package/dist/commands/guard/impl/commit-refresh.d.ts +25 -0
  11. package/dist/commands/guard/impl/commit-refresh.d.ts.map +1 -0
  12. package/dist/commands/guard/impl/commit-refresh.js +116 -0
  13. package/dist/commands/guard/impl/commit-stage.d.ts +21 -0
  14. package/dist/commands/guard/impl/commit-stage.d.ts.map +1 -0
  15. package/dist/commands/guard/impl/commit-stage.js +43 -0
  16. package/dist/commands/guard/impl/commit.d.ts.map +1 -1
  17. package/dist/commands/guard/impl/commit.js +10 -150
  18. package/dist/commands/hooks/install.d.ts +4 -0
  19. package/dist/commands/hooks/install.d.ts.map +1 -1
  20. package/dist/commands/hooks/install.js +19 -0
  21. package/dist/commands/hooks/run.pre-push.d.ts.map +1 -1
  22. package/dist/commands/hooks/run.pre-push.js +5 -2
  23. package/dist/commands/recipes/impl/installed-recipes.d.ts +5 -1
  24. package/dist/commands/recipes/impl/installed-recipes.d.ts.map +1 -1
  25. package/dist/commands/recipes/impl/installed-recipes.js +38 -19
  26. package/dist/commands/release/apply.mutation.d.ts.map +1 -1
  27. package/dist/commands/release/apply.mutation.js +5 -4
  28. package/dist/commands/release/apply.pipeline/mutation.d.ts.map +1 -1
  29. package/dist/commands/release/apply.pipeline/mutation.js +6 -1
  30. package/dist/commands/release/apply.preflight.d.ts +4 -29
  31. package/dist/commands/release/apply.preflight.d.ts.map +1 -1
  32. package/dist/commands/release/apply.preflight.git.d.ts +7 -0
  33. package/dist/commands/release/apply.preflight.git.d.ts.map +1 -0
  34. package/dist/commands/release/apply.preflight.git.js +138 -0
  35. package/dist/commands/release/apply.preflight.js +4 -368
  36. package/dist/commands/release/apply.preflight.package.d.ts +7 -0
  37. package/dist/commands/release/apply.preflight.package.d.ts.map +1 -0
  38. package/dist/commands/release/apply.preflight.package.js +69 -0
  39. package/dist/commands/release/apply.preflight.plan.d.ts +16 -0
  40. package/dist/commands/release/apply.preflight.plan.d.ts.map +1 -0
  41. package/dist/commands/release/apply.preflight.plan.js +92 -0
  42. package/dist/commands/release/apply.preflight.publish.d.ts +4 -0
  43. package/dist/commands/release/apply.preflight.publish.d.ts.map +1 -0
  44. package/dist/commands/release/apply.preflight.publish.js +81 -0
  45. package/dist/commands/task/migrate-doc.d.ts.map +1 -1
  46. package/dist/commands/task/migrate-doc.js +25 -248
  47. package/dist/commands/task/migrate-doc.readme.d.ts +8 -0
  48. package/dist/commands/task/migrate-doc.readme.d.ts.map +1 -0
  49. package/dist/commands/task/migrate-doc.readme.js +225 -0
  50. package/dist/runtime/prompt-modules/index.d.ts +3 -0
  51. package/dist/runtime/prompt-modules/index.d.ts.map +1 -0
  52. package/dist/runtime/prompt-modules/index.js +1 -0
  53. package/dist/runtime/prompt-modules/model.d.ts +89 -0
  54. package/dist/runtime/prompt-modules/model.d.ts.map +1 -0
  55. package/dist/runtime/prompt-modules/model.js +1 -0
  56. package/dist/runtime/prompt-modules/mutations.d.ts +103 -0
  57. package/dist/runtime/prompt-modules/mutations.d.ts.map +1 -0
  58. package/dist/runtime/prompt-modules/mutations.js +1 -0
  59. package/dist/shared/runtime-env.d.ts +3 -0
  60. package/dist/shared/runtime-env.d.ts.map +1 -0
  61. package/dist/shared/runtime-env.js +73 -0
  62. package/package.json +3 -3
@@ -0,0 +1,25 @@
1
+ import { type CommandContext } from "../../shared/task-backend.js";
2
+ type CommitRef = {
3
+ hash: string;
4
+ subject: string;
5
+ } | null;
6
+ export declare function resetRebuildableTaskIndexCache(ctx: CommandContext): Promise<void>;
7
+ export declare function formatCommitRef(commit: CommitRef): string;
8
+ export declare function commitRefreshedTaskArtifacts(opts: {
9
+ ctx: CommandContext;
10
+ cwd: string;
11
+ rootOverride?: string;
12
+ taskId: string;
13
+ sourceMessage: string;
14
+ quiet: boolean;
15
+ }): Promise<CommitRef>;
16
+ export declare function refreshBranchPrArtifactsForCloseCommit(opts: {
17
+ ctx: CommandContext;
18
+ cwd: string;
19
+ rootOverride?: string;
20
+ taskId: string;
21
+ quiet: boolean;
22
+ refreshTaskArtifacts: boolean;
23
+ }): Promise<void>;
24
+ export {};
25
+ //# sourceMappingURL=commit-refresh.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commit-refresh.d.ts","sourceRoot":"","sources":["../../../../src/commands/guard/impl/commit-refresh.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAKnE,KAAK,SAAS,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC;AAE1D,wBAAsB,8BAA8B,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CA2BvF;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAGzD;AAED,wBAAsB,4BAA4B,CAAC,IAAI,EAAE;IACvD,GAAG,EAAE,cAAc,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,SAAS,CAAC,CAgErB;AAED,wBAAsB,sCAAsC,CAAC,IAAI,EAAE;IACjE,GAAG,EAAE,cAAc,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,oBAAoB,EAAE,OAAO,CAAC;CAC/B,GAAG,OAAO,CAAC,IAAI,CAAC,CAWhB"}
@@ -0,0 +1,116 @@
1
+ import { mkdir, rm, writeFile } from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { buildTaskArtifactRefreshCommitSubject } from "@agentplaneorg/core/commit";
4
+ import { gitEnv } from "@agentplaneorg/core/git";
5
+ import { execFileAsync } from "@agentplaneorg/core/process";
6
+ import { resolveTaskIndexPath } from "../../../backends/task-index.js";
7
+ import { refreshBranchPrArtifactsAfterTaskCommit } from "../../shared/post-commit-pr-artifacts.js";
8
+ import { isTaskLocalAdvancePath } from "../../shared/task-local-freshness.js";
9
+ import { stageAllowlist } from "./allow.js";
10
+ import { buildGitCommitEnv, resolveCanonicalGitIdentity } from "./env.js";
11
+ import { guardCommitCheck } from "./policy.js";
12
+ export async function resetRebuildableTaskIndexCache(ctx) {
13
+ const gitRoot = path.resolve(ctx.resolvedProject.gitRoot);
14
+ const workflowDirAbs = path.resolve(gitRoot, ctx.config.paths.workflow_dir);
15
+ const cachePath = path.resolve(resolveTaskIndexPath(workflowDirAbs));
16
+ const relativeCachePath = path.relative(gitRoot, cachePath);
17
+ if (!relativeCachePath || relativeCachePath.startsWith(".."))
18
+ return;
19
+ try {
20
+ await execFileAsync("git", ["ls-files", "--error-unmatch", "--", relativeCachePath], {
21
+ cwd: gitRoot,
22
+ env: gitEnv(),
23
+ });
24
+ const gitPath = relativeCachePath.split(path.sep).join("/");
25
+ const cacheBlob = await execFileAsync("git", ["show", `HEAD:${gitPath}`], {
26
+ cwd: gitRoot,
27
+ env: gitEnv(),
28
+ });
29
+ await mkdir(path.dirname(cachePath), { recursive: true });
30
+ await writeFile(cachePath, cacheBlob.stdout, "utf8");
31
+ await execFileAsync("git", ["restore", "--staged", "--", relativeCachePath], {
32
+ cwd: gitRoot,
33
+ env: gitEnv(),
34
+ });
35
+ }
36
+ catch {
37
+ await rm(cachePath, { force: true });
38
+ }
39
+ ctx.git.invalidateStatus();
40
+ }
41
+ export function formatCommitRef(commit) {
42
+ if (!commit)
43
+ return "";
44
+ return `${commit.hash?.slice(0, 12) ?? ""} ${commit.subject ?? ""}`.trim();
45
+ }
46
+ export async function commitRefreshedTaskArtifacts(opts) {
47
+ const changedPaths = await opts.ctx.git.statusChangedPaths();
48
+ const taskArtifactPaths = changedPaths.filter((relPath) => isTaskLocalAdvancePath({
49
+ workflowDir: opts.ctx.config.paths.workflow_dir,
50
+ taskId: opts.taskId,
51
+ tasksPath: opts.ctx.config.paths.tasks_path,
52
+ relPath,
53
+ }));
54
+ if (taskArtifactPaths.length === 0)
55
+ return null;
56
+ await stageAllowlist({
57
+ ctx: opts.ctx,
58
+ allow: [],
59
+ allowTasks: true,
60
+ allowPolicy: false,
61
+ allowConfig: false,
62
+ allowHooks: false,
63
+ allowCI: false,
64
+ tasksPath: opts.ctx.config.paths.tasks_path,
65
+ workflowDir: opts.ctx.config.paths.workflow_dir,
66
+ taskId: opts.taskId,
67
+ allowTaskOnly: true,
68
+ emptyAllowMessage: "PR artifact refresh produced no task-local files to stage for the follow-up commit.",
69
+ noMatchMessage: "PR artifact refresh produced changes outside the active task artifact scope; inspect the working tree before retrying the commit flow.",
70
+ });
71
+ const message = buildTaskArtifactRefreshCommitSubject({
72
+ taskId: opts.taskId,
73
+ baseSubject: opts.sourceMessage,
74
+ });
75
+ await guardCommitCheck({
76
+ ctx: opts.ctx,
77
+ cwd: opts.cwd,
78
+ rootOverride: opts.rootOverride,
79
+ baseBranchOverride: null,
80
+ taskId: opts.taskId,
81
+ message,
82
+ allow: [],
83
+ allowBase: false,
84
+ allowTasks: true,
85
+ allowPolicy: false,
86
+ allowConfig: false,
87
+ allowHooks: false,
88
+ allowCI: false,
89
+ requireClean: true,
90
+ quiet: opts.quiet,
91
+ });
92
+ const env = buildGitCommitEnv({
93
+ taskId: opts.taskId,
94
+ allowTasks: true,
95
+ allowBase: false,
96
+ allowPolicy: false,
97
+ allowConfig: false,
98
+ allowHooks: false,
99
+ allowCI: false,
100
+ gitIdentity: await resolveCanonicalGitIdentity(),
101
+ });
102
+ await opts.ctx.git.commit({ message, env });
103
+ return await opts.ctx.git.headHashSubject();
104
+ }
105
+ export async function refreshBranchPrArtifactsForCloseCommit(opts) {
106
+ if (opts.refreshTaskArtifacts) {
107
+ await refreshBranchPrArtifactsAfterTaskCommit({
108
+ ctx: opts.ctx,
109
+ cwd: opts.cwd,
110
+ rootOverride: opts.rootOverride,
111
+ taskId: opts.taskId,
112
+ quiet: opts.quiet,
113
+ });
114
+ }
115
+ opts.ctx.git.invalidateStatus();
116
+ }
@@ -0,0 +1,21 @@
1
+ import { type CommandContext } from "../../shared/task-backend.js";
2
+ export declare function hasExplicitCommitScope(opts: {
3
+ allow: string[];
4
+ allowTasks: boolean;
5
+ allowPolicy: boolean;
6
+ allowConfig: boolean;
7
+ allowHooks: boolean;
8
+ allowCI: boolean;
9
+ }): boolean;
10
+ export declare function stageActiveTaskArtifactsFromAllowTasks(opts: {
11
+ ctx: CommandContext;
12
+ taskId: string;
13
+ allowTasks: boolean;
14
+ }): Promise<string[]>;
15
+ export declare function stageCloseCommitPaths(opts: {
16
+ ctx: CommandContext;
17
+ readmeRel: string;
18
+ taskId: string;
19
+ allowPolicy: boolean;
20
+ }): Promise<void>;
21
+ //# sourceMappingURL=commit-stage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commit-stage.d.ts","sourceRoot":"","sources":["../../../../src/commands/guard/impl/commit-stage.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAEnE,wBAAgB,sBAAsB,CAAC,IAAI,EAAE;IAC3C,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;CAClB,GAAG,OAAO,CASV;AAED,wBAAsB,sCAAsC,CAAC,IAAI,EAAE;IACjE,GAAG,EAAE,cAAc,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,OAAO,CAAC;CACrB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAiBpB;AAED,wBAAsB,qBAAqB,CAAC,IAAI,EAAE;IAChD,GAAG,EAAE,cAAc,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,OAAO,CAAC;CACtB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBhB"}
@@ -0,0 +1,43 @@
1
+ import { protectedPathKindForFile } from "../../../shared/protected-paths.js";
2
+ import { isTaskLocalAdvancePath } from "../../shared/task-local-freshness.js";
3
+ export function hasExplicitCommitScope(opts) {
4
+ return (opts.allow.some((prefix) => prefix.trim().length > 0) ||
5
+ opts.allowTasks ||
6
+ opts.allowPolicy ||
7
+ opts.allowConfig ||
8
+ opts.allowHooks ||
9
+ opts.allowCI);
10
+ }
11
+ export async function stageActiveTaskArtifactsFromAllowTasks(opts) {
12
+ if (!opts.allowTasks)
13
+ return [];
14
+ const changedPaths = await opts.ctx.git.statusChangedPaths();
15
+ const taskArtifactPaths = changedPaths.filter((relPath) => isTaskLocalAdvancePath({
16
+ workflowDir: opts.ctx.config.paths.workflow_dir,
17
+ taskId: opts.taskId,
18
+ tasksPath: opts.ctx.config.paths.tasks_path,
19
+ relPath,
20
+ }));
21
+ if (taskArtifactPaths.length === 0)
22
+ return [];
23
+ const unique = [...new Set(taskArtifactPaths)].toSorted((a, b) => a.localeCompare(b));
24
+ await opts.ctx.git.stage(unique);
25
+ return unique;
26
+ }
27
+ export async function stageCloseCommitPaths(opts) {
28
+ const stagePaths = new Set([opts.readmeRel]);
29
+ if (opts.allowPolicy) {
30
+ const changedPaths = await opts.ctx.git.statusChangedPaths();
31
+ for (const relPath of changedPaths) {
32
+ if (protectedPathKindForFile({
33
+ filePath: relPath,
34
+ tasksPath: opts.ctx.config.paths.tasks_path,
35
+ workflowDir: opts.ctx.config.paths.workflow_dir,
36
+ taskId: opts.taskId,
37
+ }) === "policy") {
38
+ stagePaths.add(relPath);
39
+ }
40
+ }
41
+ }
42
+ await opts.ctx.git.stage([...stagePaths].toSorted((a, b) => a.localeCompare(b)));
43
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"commit.d.ts","sourceRoot":"","sources":["../../../../src/commands/guard/impl/commit.ts"],"names":[],"mappings":"AAaA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,8BAA8B,CAAC;AAwLtC,wBAAsB,SAAS,CAAC,IAAI,EAAE;IACpC,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;IACf,kBAAkB,EAAE,OAAO,CAAC;IAC5B,cAAc,EAAE,OAAO,CAAC;IACxB,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC,GAAG,OAAO,CAAC,MAAM,CAAC,CAwIlB"}
1
+ {"version":3,"file":"commit.d.ts","sourceRoot":"","sources":["../../../../src/commands/guard/impl/commit.ts"],"names":[],"mappings":"AAKA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,8BAA8B,CAAC;AAsBtC,wBAAsB,SAAS,CAAC,IAAI,EAAE;IACpC,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;IACf,kBAAkB,EAAE,OAAO,CAAC;IAC5B,cAAc,EAAE,OAAO,CAAC;IACxB,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC,GAAG,OAAO,CAAC,MAAM,CAAC,CAwIlB"}
@@ -1,14 +1,8 @@
1
- import { mkdir, rm, writeFile } from "node:fs/promises";
2
- import path from "node:path";
3
- import { buildTaskArtifactRefreshCommitSubject } from "@agentplaneorg/core/commit";
4
- import { resolveTaskIndexPath } from "../../../backends/task-index.js";
5
1
  import { mapCoreError } from "../../../cli/error-map.js";
6
2
  import { infoMessage, successMessage } from "../../../cli/output.js";
7
3
  import { withDiagnosticContext } from "../../shared/diagnostics.js";
8
4
  import { CliError } from "../../../shared/errors.js";
9
- import { protectedPathKindForFile } from "../../../shared/protected-paths.js";
10
5
  import { refreshBranchPrArtifactsAfterTaskCommit } from "../../shared/post-commit-pr-artifacts.js";
11
- import { isTaskLocalAdvancePath } from "../../shared/task-local-freshness.js";
12
6
  import { loadCommandContext, loadTaskFromContext, } from "../../shared/task-backend.js";
13
7
  import { execFileAsync } from "@agentplaneorg/core/process";
14
8
  import { gitEnv } from "@agentplaneorg/core/git";
@@ -18,141 +12,9 @@ import { resolveIgnoredDirectCloseDirtyPaths } from "./close-dirt.js";
18
12
  import { buildCloseCommitMessage, taskReadmePathForTask } from "./close-message.js";
19
13
  import { asCommitFailure } from "./commit-diagnostics.js";
20
14
  import { buildGitCommitEnv, resolveCanonicalGitIdentity } from "./env.js";
15
+ import { commitRefreshedTaskArtifacts, formatCommitRef, refreshBranchPrArtifactsForCloseCommit, resetRebuildableTaskIndexCache, } from "./commit-refresh.js";
16
+ import { hasExplicitCommitScope, stageActiveTaskArtifactsFromAllowTasks, stageCloseCommitPaths, } from "./commit-stage.js";
21
17
  import { guardCommitCheck } from "./policy.js";
22
- async function resetRebuildableTaskIndexCache(ctx) {
23
- const gitRoot = path.resolve(ctx.resolvedProject.gitRoot);
24
- const workflowDirAbs = path.resolve(gitRoot, ctx.config.paths.workflow_dir);
25
- const cachePath = path.resolve(resolveTaskIndexPath(workflowDirAbs));
26
- const relativeCachePath = path.relative(gitRoot, cachePath);
27
- if (!relativeCachePath || relativeCachePath.startsWith(".."))
28
- return;
29
- try {
30
- await execFileAsync("git", ["ls-files", "--error-unmatch", "--", relativeCachePath], {
31
- cwd: gitRoot,
32
- env: gitEnv(),
33
- });
34
- const gitPath = relativeCachePath.split(path.sep).join("/");
35
- const cacheBlob = await execFileAsync("git", ["show", `HEAD:${gitPath}`], {
36
- cwd: gitRoot,
37
- env: gitEnv(),
38
- });
39
- await mkdir(path.dirname(cachePath), { recursive: true });
40
- await writeFile(cachePath, cacheBlob.stdout, "utf8");
41
- await execFileAsync("git", ["restore", "--staged", "--", relativeCachePath], {
42
- cwd: gitRoot,
43
- env: gitEnv(),
44
- });
45
- }
46
- catch {
47
- await rm(cachePath, { force: true });
48
- }
49
- ctx.git.invalidateStatus();
50
- }
51
- async function stageCloseCommitPaths(opts) {
52
- const stagePaths = new Set([opts.readmeRel]);
53
- if (opts.allowPolicy) {
54
- const changedPaths = await opts.ctx.git.statusChangedPaths();
55
- for (const relPath of changedPaths) {
56
- if (protectedPathKindForFile({
57
- filePath: relPath,
58
- tasksPath: opts.ctx.config.paths.tasks_path,
59
- workflowDir: opts.ctx.config.paths.workflow_dir,
60
- taskId: opts.taskId,
61
- }) === "policy") {
62
- stagePaths.add(relPath);
63
- }
64
- }
65
- }
66
- await opts.ctx.git.stage([...stagePaths].toSorted((a, b) => a.localeCompare(b)));
67
- }
68
- async function commitRefreshedTaskArtifacts(opts) {
69
- const changedPaths = await opts.ctx.git.statusChangedPaths();
70
- const taskArtifactPaths = changedPaths.filter((relPath) => isTaskLocalAdvancePath({
71
- workflowDir: opts.ctx.config.paths.workflow_dir,
72
- taskId: opts.taskId,
73
- tasksPath: opts.ctx.config.paths.tasks_path,
74
- relPath,
75
- }));
76
- if (taskArtifactPaths.length === 0)
77
- return null;
78
- await stageAllowlist({
79
- ctx: opts.ctx,
80
- allow: [],
81
- allowTasks: true,
82
- allowPolicy: false,
83
- allowConfig: false,
84
- allowHooks: false,
85
- allowCI: false,
86
- tasksPath: opts.ctx.config.paths.tasks_path,
87
- workflowDir: opts.ctx.config.paths.workflow_dir,
88
- taskId: opts.taskId,
89
- allowTaskOnly: true,
90
- emptyAllowMessage: "PR artifact refresh produced no task-local files to stage for the follow-up commit.",
91
- noMatchMessage: "PR artifact refresh produced changes outside the active task artifact scope; inspect the working tree before retrying the commit flow.",
92
- });
93
- const message = buildTaskArtifactRefreshCommitSubject({
94
- taskId: opts.taskId,
95
- baseSubject: opts.sourceMessage,
96
- });
97
- await guardCommitCheck({
98
- ctx: opts.ctx,
99
- cwd: opts.cwd,
100
- rootOverride: opts.rootOverride,
101
- baseBranchOverride: null,
102
- taskId: opts.taskId,
103
- message,
104
- allow: [],
105
- allowBase: false,
106
- allowTasks: true,
107
- allowPolicy: false,
108
- allowConfig: false,
109
- allowHooks: false,
110
- allowCI: false,
111
- requireClean: true,
112
- quiet: opts.quiet,
113
- });
114
- const env = buildGitCommitEnv({
115
- taskId: opts.taskId,
116
- allowTasks: true,
117
- allowBase: false,
118
- allowPolicy: false,
119
- allowConfig: false,
120
- allowHooks: false,
121
- allowCI: false,
122
- gitIdentity: await resolveCanonicalGitIdentity(),
123
- });
124
- await opts.ctx.git.commit({ message, env });
125
- return await opts.ctx.git.headHashSubject();
126
- }
127
- function hasExplicitCommitScope(opts) {
128
- return (opts.allow.some((prefix) => prefix.trim().length > 0) ||
129
- opts.allowTasks ||
130
- opts.allowPolicy ||
131
- opts.allowConfig ||
132
- opts.allowHooks ||
133
- opts.allowCI);
134
- }
135
- function formatCommitRef(commit) {
136
- if (!commit)
137
- return "";
138
- return `${commit.hash?.slice(0, 12) ?? ""} ${commit.subject ?? ""}`.trim();
139
- }
140
- async function stageActiveTaskArtifactsFromAllowTasks(opts) {
141
- if (!opts.allowTasks)
142
- return [];
143
- const changedPaths = await opts.ctx.git.statusChangedPaths();
144
- const taskArtifactPaths = changedPaths.filter((relPath) => isTaskLocalAdvancePath({
145
- workflowDir: opts.ctx.config.paths.workflow_dir,
146
- taskId: opts.taskId,
147
- tasksPath: opts.ctx.config.paths.tasks_path,
148
- relPath,
149
- }));
150
- if (taskArtifactPaths.length === 0)
151
- return [];
152
- const unique = [...new Set(taskArtifactPaths)].toSorted((a, b) => a.localeCompare(b));
153
- await opts.ctx.git.stage(unique);
154
- return unique;
155
- }
156
18
  export async function cmdCommit(opts) {
157
19
  try {
158
20
  const ctx = opts.ctx ??
@@ -321,16 +183,14 @@ async function cmdCloseCommit(opts) {
321
183
  return 0;
322
184
  }
323
185
  if (opts.closeStageTaskArtifacts === true) {
324
- if (opts.closeRefreshTaskArtifacts !== false) {
325
- await refreshBranchPrArtifactsAfterTaskCommit({
326
- ctx: opts.ctx,
327
- cwd: opts.cwd,
328
- rootOverride: opts.rootOverride,
329
- taskId: opts.taskId,
330
- quiet: opts.quiet,
331
- });
332
- }
333
- opts.ctx.git.invalidateStatus();
186
+ await refreshBranchPrArtifactsForCloseCommit({
187
+ ctx: opts.ctx,
188
+ cwd: opts.cwd,
189
+ rootOverride: opts.rootOverride,
190
+ taskId: opts.taskId,
191
+ quiet: opts.quiet,
192
+ refreshTaskArtifacts: opts.closeRefreshTaskArtifacts !== false,
193
+ });
334
194
  }
335
195
  await (opts.closeStageTaskArtifacts === true
336
196
  ? stageAllowlist({
@@ -1,3 +1,7 @@
1
+ export declare function collectHooksInstallConflicts(opts: {
2
+ gitRoot: string;
3
+ agentplaneDir: string;
4
+ }): Promise<string[]>;
1
5
  export declare function cmdHooksInstall(opts: {
2
6
  cwd: string;
3
7
  rootOverride?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/commands/hooks/install.ts"],"names":[],"mappings":"AAgGA,wBAAsB,eAAe,CAAC,IAAI,EAAE;IAC1C,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAmClB;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CA4BlB"}
1
+ {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/commands/hooks/install.ts"],"names":[],"mappings":"AA+CA,wBAAsB,4BAA4B,CAAC,IAAI,EAAE;IACvD,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAiBpB;AAmDD,wBAAsB,eAAe,CAAC,IAAI,EAAE;IAC1C,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAmClB;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CA4BlB"}
@@ -32,6 +32,25 @@ function resolveInstalledHookRunnerPath() {
32
32
  const activeBin = String(process.env.AGENTPLANE_RUNTIME_ACTIVE_BIN ?? "").trim();
33
33
  return activeBin || resolveAgentplaneBinPath();
34
34
  }
35
+ export async function collectHooksInstallConflicts(opts) {
36
+ const hooksDir = await resolveGitHooksDir(opts.gitRoot);
37
+ const conflicts = [];
38
+ const shimPath = path.join(opts.agentplaneDir, "bin", "agentplane");
39
+ if (await fileExists(shimPath)) {
40
+ const managed = await fileIsManaged(shimPath, SHIM_MARKER);
41
+ if (!managed)
42
+ conflicts.push(shimPath);
43
+ }
44
+ for (const hook of HOOK_NAMES) {
45
+ const hookPath = path.join(hooksDir, hook);
46
+ if (!(await fileExists(hookPath)))
47
+ continue;
48
+ const managed = await fileIsManaged(hookPath, HOOK_MARKER);
49
+ if (!managed)
50
+ conflicts.push(hookPath);
51
+ }
52
+ return conflicts;
53
+ }
35
54
  function shimScriptText(installedRunnerPath) {
36
55
  return [
37
56
  "#!/usr/bin/env sh",
@@ -1 +1 @@
1
- {"version":3,"file":"run.pre-push.d.ts","sourceRoot":"","sources":["../../../src/commands/hooks/run.pre-push.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAyBhD,wBAAsB,4BAA4B,CAChD,OAAO,EAAE,MAAM,EACf,IAAI,GAAE;IAAE,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAAO,GACxC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAMxB;AA+TD,wBAAsB,cAAc,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAuB3E"}
1
+ {"version":3,"file":"run.pre-push.d.ts","sourceRoot":"","sources":["../../../src/commands/hooks/run.pre-push.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAyBhD,wBAAsB,4BAA4B,CAChD,OAAO,EAAE,MAAM,EACf,IAAI,GAAE;IAAE,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAAO,GACxC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAMxB;AAiUD,wBAAsB,cAAc,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAuB3E"}
@@ -4,6 +4,7 @@ import fs from "node:fs";
4
4
  import path from "node:path";
5
5
  import { fileExists } from "../../cli/fs-utils.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
  }
@@ -45,7 +46,7 @@ function runHookCommand(gitRoot, command, args) {
45
46
  command,
46
47
  args,
47
48
  cwd: gitRoot,
48
- env: process.env,
49
+ env: withPreferredRuntimePath(process.env),
49
50
  stdout: "inherit",
50
51
  stderr: "inherit",
51
52
  reject: false,
@@ -222,7 +223,9 @@ function runInternalPrePushHook(gitRoot, stdin) {
222
223
  if (isReleasePush) {
223
224
  const releaseNotesScript = path.join(gitRoot, "scripts", "check-release-notes.mjs");
224
225
  if (fileExistsSync(releaseNotesScript)) {
225
- const notesExitCode = runHookCommand(gitRoot, "node", ["scripts/check-release-notes.mjs"]);
226
+ const notesExitCode = runHookCommand(gitRoot, resolvePreferredNodeExecutable(process.env), [
227
+ "scripts/check-release-notes.mjs",
228
+ ]);
226
229
  if (notesExitCode !== 0)
227
230
  return notesExitCode;
228
231
  }
@@ -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;AAgDhC,wBAAsB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAS9F;AAED,wBAAsB,kCAAkC,CACtD,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,oBAAoB,CAAC,CAc/B;AAED,wBAAsB,yBAAyB,CAC7C,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,oBAAoB,GACzB,OAAO,CAAC,IAAI,CAAC,CAOf"}
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 validateInstalledRecipesFile(raw) {
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
- .filter((entry) => isRecord(entry))
18
- .map((entry) => {
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":"AASA,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"}
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("node", [scriptPath], {
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,CA6DlC;AAED,wBAAsB,wBAAwB,CAC5C,KAAK,EAAE,mBAAmB,GACzB,OAAO,CAAC,sBAAsB,CAAC,CAgBjC"}
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) {