agentplane 0.3.11 → 0.3.12
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/AGENTS.md +2 -2
- package/assets/agents/CODER.json +4 -0
- package/assets/agents/CREATOR.json +1 -0
- package/assets/agents/DOCS.json +2 -1
- package/assets/agents/INTEGRATOR.json +2 -1
- package/assets/agents/ORCHESTRATOR.json +2 -0
- package/assets/agents/PLANNER.json +3 -1
- package/assets/agents/REVIEWER.json +1 -0
- package/assets/agents/TESTER.json +2 -2
- package/assets/agents/UPDATER.json +1 -0
- package/assets/agents/UPGRADER.json +1 -1
- package/assets/policy/incidents.md +1 -0
- package/bin/agentplane.js +58 -3
- package/bin/stale-dist-policy.js +6 -1
- package/dist/.build-manifest.json +88 -68
- package/dist/cli/run-cli/command-catalog/core.d.ts +1 -1
- package/dist/cli/run-cli/command-catalog/core.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/core.js +6 -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.test-helpers.d.ts +1 -0
- package/dist/cli/run-cli.test-helpers.d.ts.map +1 -1
- package/dist/cli/run-cli.test-helpers.js +14 -0
- package/dist/commands/branch/cleanup-merged.d.ts +1 -0
- package/dist/commands/branch/cleanup-merged.d.ts.map +1 -1
- package/dist/commands/branch/cleanup-merged.js +18 -9
- package/dist/commands/branch/work-start.d.ts.map +1 -1
- package/dist/commands/branch/work-start.js +82 -5
- package/dist/commands/doctor/branch-pr.js +2 -2
- package/dist/commands/guard/impl/commands.d.ts +1 -0
- package/dist/commands/guard/impl/commands.d.ts.map +1 -1
- package/dist/commands/guard/impl/commands.js +78 -8
- package/dist/commands/hooks/index.d.ts +1 -1
- package/dist/commands/hooks/index.d.ts.map +1 -1
- package/dist/commands/hooks/index.js +48 -12
- package/dist/commands/pr/check.d.ts.map +1 -1
- package/dist/commands/pr/check.js +3 -0
- package/dist/commands/pr/integrate/cmd.d.ts.map +1 -1
- package/dist/commands/pr/integrate/cmd.js +27 -2
- package/dist/commands/pr/integrate/internal/cleanup.d.ts +1 -11
- package/dist/commands/pr/integrate/internal/cleanup.d.ts.map +1 -1
- package/dist/commands/pr/integrate/internal/cleanup.js +1 -46
- package/dist/commands/pr/integrate/internal/finalize.d.ts.map +1 -1
- package/dist/commands/pr/integrate/internal/finalize.js +3 -0
- package/dist/commands/pr/integrate/internal/github-protection.d.ts +5 -0
- package/dist/commands/pr/integrate/internal/github-protection.d.ts.map +1 -0
- package/dist/commands/pr/integrate/internal/github-protection.js +13 -0
- package/dist/commands/pr/integrate/internal/pre-integrate-bootstrap.d.ts +15 -0
- package/dist/commands/pr/integrate/internal/pre-integrate-bootstrap.d.ts.map +1 -0
- package/dist/commands/pr/integrate/internal/pre-integrate-bootstrap.js +35 -0
- package/dist/commands/pr/integrate/internal/prepare.d.ts +1 -0
- package/dist/commands/pr/integrate/internal/prepare.d.ts.map +1 -1
- package/dist/commands/pr/integrate/internal/prepare.js +8 -0
- package/dist/commands/pr/internal/auto-commit.d.ts +7 -0
- package/dist/commands/pr/internal/auto-commit.d.ts.map +1 -0
- package/dist/commands/pr/internal/auto-commit.js +64 -0
- package/dist/commands/pr/internal/freshness.d.ts +1 -0
- package/dist/commands/pr/internal/freshness.d.ts.map +1 -1
- package/dist/commands/pr/internal/freshness.js +2 -0
- package/dist/commands/pr/internal/sync.d.ts.map +1 -1
- package/dist/commands/pr/internal/sync.js +93 -26
- package/dist/commands/pr/open.d.ts.map +1 -1
- package/dist/commands/pr/open.js +11 -0
- package/dist/commands/pr/update.d.ts.map +1 -1
- package/dist/commands/pr/update.js +13 -2
- package/dist/commands/release/apply.command.d.ts +3 -1
- package/dist/commands/release/apply.command.d.ts.map +1 -1
- package/dist/commands/release/apply.command.js +354 -18
- package/dist/commands/release/apply.mutation.d.ts.map +1 -1
- package/dist/commands/release/apply.mutation.js +1 -0
- package/dist/commands/release/apply.reporting.d.ts +1 -0
- package/dist/commands/release/apply.reporting.d.ts.map +1 -1
- package/dist/commands/release/apply.reporting.js +12 -8
- package/dist/commands/release/apply.types.d.ts +13 -0
- package/dist/commands/release/apply.types.d.ts.map +1 -1
- package/dist/commands/release/plan.command.d.ts.map +1 -1
- package/dist/commands/release/plan.command.js +48 -0
- package/dist/commands/shared/merged-branch-cleanup.d.ts +12 -0
- package/dist/commands/shared/merged-branch-cleanup.d.ts.map +1 -0
- package/dist/commands/shared/merged-branch-cleanup.js +46 -0
- package/dist/commands/shared/post-commit-pr-artifacts.d.ts.map +1 -1
- package/dist/commands/shared/post-commit-pr-artifacts.js +35 -0
- package/dist/commands/shared/task-backend.d.ts.map +1 -1
- package/dist/commands/shared/task-backend.js +37 -5
- package/dist/commands/shared/task-local-freshness.d.ts +2 -0
- package/dist/commands/shared/task-local-freshness.d.ts.map +1 -1
- package/dist/commands/shared/task-local-freshness.js +7 -1
- package/dist/commands/task/finish-shared.d.ts +1 -0
- package/dist/commands/task/finish-shared.d.ts.map +1 -1
- package/dist/commands/task/finish-shared.js +1 -0
- package/dist/commands/task/hosted-close-pr.command.d.ts.map +1 -1
- package/dist/commands/task/hosted-close-pr.command.js +35 -0
- package/dist/commands/task/hosted-close.command.d.ts.map +1 -1
- package/dist/commands/task/hosted-close.command.js +185 -18
- package/dist/commands/task/hosted-merge-sync.d.ts +4 -1
- package/dist/commands/task/hosted-merge-sync.d.ts.map +1 -1
- package/dist/commands/task/hosted-merge-sync.js +52 -10
- package/dist/commands/task/start-ready.d.ts.map +1 -1
- package/dist/commands/task/start-ready.js +0 -86
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/cli/run-cli/command-catalog/core.ts"],"names":[],"mappings":"AAgCA,OAAO,EAAS,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAEvD,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/cli/run-cli/command-catalog/core.ts"],"names":[],"mappings":"AAgCA,OAAO,EAAS,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAEvD,eAAO,MAAM,aAAa,mZA0OkB,CAAC"}
|
|
@@ -8,7 +8,7 @@ import { workflowRestoreSpec } from "../../../commands/workflow-restore.command.
|
|
|
8
8
|
import { incidentsAdviseSpec } from "../../../commands/incidents/advise.command.js";
|
|
9
9
|
import { incidentsCollectSpec } from "../../../commands/incidents/collect.command.js";
|
|
10
10
|
import { incidentsSpec } from "../../../commands/incidents/incidents.command.js";
|
|
11
|
-
import { releaseApplySpec } from "../../../commands/release/apply.command.js";
|
|
11
|
+
import { releaseApplySpec, releaseCandidateSpec } from "../../../commands/release/apply.command.js";
|
|
12
12
|
import { releasePlanSpec } from "../../../commands/release/plan.command.js";
|
|
13
13
|
import { releaseSpec } from "../../../commands/release/release.command.js";
|
|
14
14
|
import { configSetSpec, configShowSpec, modeGetSpec, modeSetSpec, profileSetSpec, } from "../commands/config.js";
|
|
@@ -47,6 +47,11 @@ export const CORE_COMMANDS = [
|
|
|
47
47
|
needsLoadedConfig: false,
|
|
48
48
|
needsTaskContext: false,
|
|
49
49
|
}),
|
|
50
|
+
entry(releaseCandidateSpec, () => import("../../../commands/release/apply.command.js").then((m) => m.runReleaseCandidate), {
|
|
51
|
+
needsProject: true,
|
|
52
|
+
needsLoadedConfig: false,
|
|
53
|
+
needsTaskContext: false,
|
|
54
|
+
}),
|
|
50
55
|
entry(quickstartSpec, () => import("../commands/core/quickstart.js").then((m) => m.runQuickstart), {
|
|
51
56
|
needsProject: false,
|
|
52
57
|
needsLoadedConfig: false,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CommandId } from "../spec/spec.js";
|
|
2
2
|
import type { CommandEntry } from "./command-catalog/shared.js";
|
|
3
3
|
export type { CommandEntry, RunDeps } from "./command-catalog/shared.js";
|
|
4
|
-
export declare const COMMANDS: readonly [CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry];
|
|
4
|
+
export declare const COMMANDS: readonly [CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry];
|
|
5
5
|
export type CatalogMatch = {
|
|
6
6
|
entry: (typeof COMMANDS)[number];
|
|
7
7
|
consumed: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-catalog.d.ts","sourceRoot":"","sources":["../../../src/cli/run-cli/command-catalog.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAOhE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAEzE,eAAO,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"command-catalog.d.ts","sourceRoot":"","sources":["../../../src/cli/run-cli/command-catalog.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAOhE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAEzE,eAAO,MAAM,QAAQ,yxDAKuB,CAAC;AAE7C,MAAM,MAAM,YAAY,GAAG;IAAE,KAAK,EAAE,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAYlF,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,YAAY,GAAG,IAAI,CAGlF;AAED,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,SAAS,GAAG,YAAY,GAAG,IAAI,CAEnE;AAED,wBAAgB,4BAA4B,CAAC,QAAQ,GAAE,SAAc,GAAG,SAAS,YAAY,EAAE,CAE9F;AAED,wBAAgB,0BAA0B,CAAC,QAAQ,GAAE,SAAc,GAAG,SAAS,MAAM,EAAE,CAEtF;AAED,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,SAAS,GAAG,MAAM,CAM1D"}
|
|
@@ -70,5 +70,6 @@ export declare function cleanGitEnv(): NodeJS.ProcessEnv;
|
|
|
70
70
|
export declare function pathExists(filePath: string): Promise<boolean>;
|
|
71
71
|
export declare function gitBranchExists(root: string, branch: string): Promise<boolean>;
|
|
72
72
|
export declare function commitAll(root: string, message: string): Promise<void>;
|
|
73
|
+
export declare function commitPathsIfChanged(root: string, paths: string[], message: string): Promise<boolean>;
|
|
73
74
|
export declare function stageGitignoreIfPresent(root: string): Promise<void>;
|
|
74
75
|
//# sourceMappingURL=run-cli.test-helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-cli.test-helpers.d.ts","sourceRoot":"","sources":["../../src/cli/run-cli.test-helpers.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAsD/D,wBAAgB,sBAAsB,IAAI,IAAI,CAuD7C;AAED,wBAAgB,+BAA+B,IAAI,IAAI,CAYtD;AAED,wBAAgB,iBAAiB,IAAI,MAAM,GAAG,IAAI,CAEjD;AAED,wBAAgB,YAAY;;;;EAgC3B;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAMvD;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,CAExE;AAED,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,iBAAiB,EAC1B,IAAI,EAAE;IACJ,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,OAAO,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GACA,IAAI,CAYN;AAED,wBAAgB,YAAY,IAAI,MAAM,IAAI,CAkBzC;AAED,wB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K,EAAE,MAAM,EAAE,EACf,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,OAAO,CAAC,CAgBlB;AAED,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAIzE"}
|
|
@@ -744,6 +744,20 @@ export async function commitAll(root, message) {
|
|
|
744
744
|
env: cleanGitEnv(),
|
|
745
745
|
});
|
|
746
746
|
}
|
|
747
|
+
export async function commitPathsIfChanged(root, paths, message) {
|
|
748
|
+
await execFileAsync("git", ["add", "--", ...paths], { cwd: root, env: cleanGitEnv() });
|
|
749
|
+
const { stdout } = await execFileAsync("git", ["diff", "--cached", "--name-only", "--", ...paths], {
|
|
750
|
+
cwd: root,
|
|
751
|
+
env: cleanGitEnv(),
|
|
752
|
+
});
|
|
753
|
+
if (!stdout.trim())
|
|
754
|
+
return false;
|
|
755
|
+
await execFileAsync("git", ["commit", "--no-verify", "-m", message], {
|
|
756
|
+
cwd: root,
|
|
757
|
+
env: cleanGitEnv(),
|
|
758
|
+
});
|
|
759
|
+
return true;
|
|
760
|
+
}
|
|
747
761
|
export async function stageGitignoreIfPresent(root) {
|
|
748
762
|
const gitignorePath = path.join(root, ".gitignore");
|
|
749
763
|
if (!(await pathExists(gitignorePath)))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cleanup-merged.d.ts","sourceRoot":"","sources":["../../../src/commands/branch/cleanup-merged.ts"],"names":[],"mappings":"AAqBA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AAgInC,wBAAsB,gBAAgB,CAAC,IAAI,EAAE;IAC3C,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,OAAO,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"cleanup-merged.d.ts","sourceRoot":"","sources":["../../../src/commands/branch/cleanup-merged.ts"],"names":[],"mappings":"AAqBA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AAgInC,wBAAsB,gBAAgB,CAAC,IAAI,EAAE;IAC3C,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,OAAO,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,GAAG,OAAO,CAAC,MAAM,CAAC,CA8JlB"}
|
|
@@ -185,18 +185,26 @@ export async function cmdCleanupMerged(opts) {
|
|
|
185
185
|
}
|
|
186
186
|
return 0;
|
|
187
187
|
}
|
|
188
|
+
const skipUnsafeWorktrees = opts.skipUnsafeWorktrees === true;
|
|
188
189
|
let deletedRemoteBranches = 0;
|
|
190
|
+
let skippedUnsafe = 0;
|
|
189
191
|
for (const item of sortedCandidates) {
|
|
190
192
|
const worktreePath = item.worktreePath ? await resolvePathFallback(item.worktreePath) : null;
|
|
191
193
|
if (worktreePath) {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
194
|
+
const outsideRepo = !isPathWithin(repoRoot, worktreePath);
|
|
195
|
+
const currentWorktree = worktreePath === repoRoot;
|
|
196
|
+
if (outsideRepo || currentWorktree) {
|
|
197
|
+
if (skipUnsafeWorktrees) {
|
|
198
|
+
skippedUnsafe += 1;
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
if (outsideRepo) {
|
|
202
|
+
throw new CliError({
|
|
203
|
+
exitCode: 5,
|
|
204
|
+
code: "E_GIT",
|
|
205
|
+
message: `Refusing to remove worktree outside repo: ${worktreePath}`,
|
|
206
|
+
});
|
|
207
|
+
}
|
|
200
208
|
throw new CliError({
|
|
201
209
|
exitCode: 5,
|
|
202
210
|
code: "E_GIT",
|
|
@@ -234,7 +242,8 @@ export async function cmdCleanupMerged(opts) {
|
|
|
234
242
|
const remoteDetail = opts.deleteRemoteBranches
|
|
235
243
|
? ` remote_deleted=${deletedRemoteBranches}`
|
|
236
244
|
: "";
|
|
237
|
-
|
|
245
|
+
const skippedDetail = skipUnsafeWorktrees ? ` skipped_unsafe=${skippedUnsafe}` : "";
|
|
246
|
+
output.success("cleanup merged", undefined, `deleted=${candidates.length - skippedUnsafe}${remoteDetail}${skippedDetail}`);
|
|
238
247
|
}
|
|
239
248
|
return 0;
|
|
240
249
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"work-start.d.ts","sourceRoot":"","sources":["../../../src/commands/branch/work-start.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"work-start.d.ts","sourceRoot":"","sources":["../../../src/commands/branch/work-start.ts"],"names":[],"mappings":"AA0BA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AAsRnC,wBAAsB,YAAY,CAAC,IAAI,EAAE;IACvC,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;CACnB,GAAG,OAAO,CAAC,MAAM,CAAC,CA+JlB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { copyFile, cp, mkdir, readFile, readdir, symlink, writeFile } from "node:fs/promises";
|
|
1
|
+
import { chmod, copyFile, cp, mkdir, readFile, readdir, rm, symlink, writeFile, } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { resolveBaseBranch } from "@agentplaneorg/core";
|
|
4
4
|
import { LocalBackend } from "../../backends/task-backend.js";
|
|
@@ -11,9 +11,40 @@ import { execFileAsync, gitEnv } from "../shared/git.js";
|
|
|
11
11
|
import { gitAheadBehind } from "../shared/git-diff.js";
|
|
12
12
|
import { gitBranchExists, gitBranchUpstream, gitCurrentBranch } from "../shared/git-ops.js";
|
|
13
13
|
import { isPathWithin } from "../shared/path.js";
|
|
14
|
+
import { resolveRuntimeSourceInfo } from "../../shared/runtime-source.js";
|
|
14
15
|
import { loadBackendTask, loadCommandContext, } from "../shared/task-backend.js";
|
|
16
|
+
function isPresentString(value) {
|
|
17
|
+
return value !== null;
|
|
18
|
+
}
|
|
15
19
|
import { ensurePlanApprovedIfRequired } from "../task/shared.js";
|
|
16
20
|
import { validateWorkAgent, validateWorkSlug } from "./internal/work-validate.js";
|
|
21
|
+
const HOOK_SHIM_MARKER = "agentplane-hook-shim";
|
|
22
|
+
function repoLocalHookShimText() {
|
|
23
|
+
return [
|
|
24
|
+
"#!/usr/bin/env sh",
|
|
25
|
+
`# ${HOOK_SHIM_MARKER} (do not edit)`,
|
|
26
|
+
"set -e",
|
|
27
|
+
'SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"',
|
|
28
|
+
'REPO_ROOT="$(dirname "$(dirname "$SCRIPT_DIR")")"',
|
|
29
|
+
'LOCAL_BIN="$REPO_ROOT/packages/agentplane/bin/agentplane.js"',
|
|
30
|
+
'if command -v node >/dev/null 2>&1 && [ -f "$LOCAL_BIN" ]; then',
|
|
31
|
+
' exec node "$LOCAL_BIN" "$@"',
|
|
32
|
+
"fi",
|
|
33
|
+
'ENV_BIN="${AGENTPLANE_HOOK_RUNNER:-}"',
|
|
34
|
+
'if [ -n "$ENV_BIN" ] && command -v node >/dev/null 2>&1 && [ -f "$ENV_BIN" ]; then',
|
|
35
|
+
' exec node "$ENV_BIN" "$@"',
|
|
36
|
+
"fi",
|
|
37
|
+
"if command -v agentplane >/dev/null 2>&1; then",
|
|
38
|
+
' exec agentplane "$@"',
|
|
39
|
+
"fi",
|
|
40
|
+
"if command -v npx >/dev/null 2>&1; then",
|
|
41
|
+
' exec npx --yes agentplane "$@"',
|
|
42
|
+
"fi",
|
|
43
|
+
'echo "agentplane shim: runner not found (need env runner, repo-local source, agentplane in PATH, or node+npx)." >&2',
|
|
44
|
+
" exit 127",
|
|
45
|
+
"",
|
|
46
|
+
].join("\n");
|
|
47
|
+
}
|
|
17
48
|
function directWorkLockPath(agentplaneDir) {
|
|
18
49
|
// Intentionally under cache/ so it stays out of git by default.
|
|
19
50
|
return path.join(agentplaneDir, "cache", "direct-work.json");
|
|
@@ -54,16 +85,35 @@ async function materializeLocalBackendReadmesForWorktree(opts) {
|
|
|
54
85
|
for (const entry of entries) {
|
|
55
86
|
if (!entry.isDirectory())
|
|
56
87
|
continue;
|
|
88
|
+
const sourceTaskRoot = path.join(sourceRoot, entry.name);
|
|
57
89
|
const sourceReadme = path.join(sourceRoot, entry.name, "README.md");
|
|
58
90
|
if (!(await fileExists(sourceReadme)))
|
|
59
91
|
continue;
|
|
60
92
|
const targetReadme = path.join(targetRoot, entry.name, "README.md");
|
|
61
93
|
await mkdir(path.dirname(targetReadme), { recursive: true });
|
|
62
94
|
await copyFile(sourceReadme, targetReadme);
|
|
95
|
+
if (entry.name !== opts.taskId)
|
|
96
|
+
continue;
|
|
97
|
+
// Hand off ownership of the active task README to the task worktree so
|
|
98
|
+
// later merges cannot collide with a stale untracked copy on the base checkout.
|
|
99
|
+
await rm(sourceReadme, { force: true });
|
|
100
|
+
const remainingEntries = await readdir(sourceTaskRoot).catch(() => []);
|
|
101
|
+
if (remainingEntries.length === 0) {
|
|
102
|
+
await rm(sourceTaskRoot, { recursive: true, force: true });
|
|
103
|
+
}
|
|
63
104
|
}
|
|
64
105
|
}
|
|
65
106
|
async function materializeRepoLocalDistForWorktree(opts) {
|
|
66
|
-
const
|
|
107
|
+
const runtimeSource = resolveRuntimeSourceInfo({ cwd: process.cwd() });
|
|
108
|
+
const sourceRoots = [
|
|
109
|
+
...new Set([
|
|
110
|
+
path.resolve(opts.repoRoot),
|
|
111
|
+
path.resolve(process.cwd()),
|
|
112
|
+
runtimeSource.agentplane.packageRoot
|
|
113
|
+
? path.resolve(runtimeSource.agentplane.packageRoot, "..", "..")
|
|
114
|
+
: null,
|
|
115
|
+
].filter((value) => isPresentString(value))),
|
|
116
|
+
];
|
|
67
117
|
const copyTargets = [
|
|
68
118
|
["packages/core/dist", "packages/core/dist"],
|
|
69
119
|
["packages/agentplane/dist", "packages/agentplane/dist"],
|
|
@@ -88,8 +138,15 @@ async function materializeRepoLocalDistForWorktree(opts) {
|
|
|
88
138
|
}
|
|
89
139
|
}
|
|
90
140
|
async function linkDirectoryIntoWorktree(opts) {
|
|
91
|
-
|
|
92
|
-
|
|
141
|
+
let sourcePath = "";
|
|
142
|
+
for (const sourceRoot of opts.sourceRoots) {
|
|
143
|
+
const candidate = path.join(sourceRoot, opts.relativePath);
|
|
144
|
+
if (await fileExists(candidate)) {
|
|
145
|
+
sourcePath = candidate;
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
if (!sourcePath)
|
|
93
150
|
return false;
|
|
94
151
|
const targetPath = path.join(opts.worktreePath, opts.relativePath);
|
|
95
152
|
if (await fileExists(targetPath))
|
|
@@ -99,6 +156,16 @@ async function linkDirectoryIntoWorktree(opts) {
|
|
|
99
156
|
return true;
|
|
100
157
|
}
|
|
101
158
|
async function materializeRepoLocalInstallLayoutForWorktree(opts) {
|
|
159
|
+
const runtimeSource = resolveRuntimeSourceInfo({ cwd: process.cwd() });
|
|
160
|
+
const sourceRoots = [
|
|
161
|
+
...new Set([
|
|
162
|
+
path.resolve(opts.repoRoot),
|
|
163
|
+
path.resolve(process.cwd()),
|
|
164
|
+
runtimeSource.agentplane.packageRoot
|
|
165
|
+
? path.resolve(runtimeSource.agentplane.packageRoot, "..", "..")
|
|
166
|
+
: null,
|
|
167
|
+
].filter((value) => isPresentString(value))),
|
|
168
|
+
];
|
|
102
169
|
const linkTargets = [
|
|
103
170
|
"node_modules",
|
|
104
171
|
path.join("packages", "core", "node_modules"),
|
|
@@ -107,12 +174,20 @@ async function materializeRepoLocalInstallLayoutForWorktree(opts) {
|
|
|
107
174
|
];
|
|
108
175
|
for (const relativePath of linkTargets) {
|
|
109
176
|
await linkDirectoryIntoWorktree({
|
|
110
|
-
|
|
177
|
+
sourceRoots,
|
|
111
178
|
worktreePath: opts.worktreePath,
|
|
112
179
|
relativePath,
|
|
113
180
|
});
|
|
114
181
|
}
|
|
115
182
|
}
|
|
183
|
+
async function materializeHookShimForWorktree(worktreePath) {
|
|
184
|
+
const shimPath = path.join(worktreePath, ".agentplane", "bin", "agentplane");
|
|
185
|
+
if (await fileExists(shimPath))
|
|
186
|
+
return;
|
|
187
|
+
await mkdir(path.dirname(shimPath), { recursive: true });
|
|
188
|
+
await writeFile(shimPath, repoLocalHookShimText(), "utf8");
|
|
189
|
+
await chmod(shimPath, 0o755);
|
|
190
|
+
}
|
|
116
191
|
async function ensureGitClean(gitRoot) {
|
|
117
192
|
const { stdout } = await execFileAsync("git", ["status", "--porcelain"], {
|
|
118
193
|
cwd: gitRoot,
|
|
@@ -278,6 +353,7 @@ export async function cmdWorkStart(opts) {
|
|
|
278
353
|
backend: ctx.taskBackend,
|
|
279
354
|
repoRoot: resolved.gitRoot,
|
|
280
355
|
worktreePath,
|
|
356
|
+
taskId: opts.taskId,
|
|
281
357
|
});
|
|
282
358
|
await materializeRepoLocalDistForWorktree({
|
|
283
359
|
repoRoot: resolved.gitRoot,
|
|
@@ -287,6 +363,7 @@ export async function cmdWorkStart(opts) {
|
|
|
287
363
|
repoRoot: resolved.gitRoot,
|
|
288
364
|
worktreePath,
|
|
289
365
|
});
|
|
366
|
+
await materializeHookShimForWorktree(worktreePath);
|
|
290
367
|
}
|
|
291
368
|
else {
|
|
292
369
|
if (branchExists) {
|
|
@@ -56,8 +56,8 @@ export async function checkBranchPrDoneTaskOpenPrDrift(ctx) {
|
|
|
56
56
|
state: "DONE branch_pr tasks still have open or unmerged PR artifacts",
|
|
57
57
|
likelyCause: "the task was marked DONE, but its branch_pr PR artifacts were never reconciled to MERGED and the task branch still exists",
|
|
58
58
|
nextAction: {
|
|
59
|
-
command: "agentplane task normalize --sync-
|
|
60
|
-
reason: "reconcile the shipped task's branch_pr PR artifacts to MERGED without scanning unrelated task history",
|
|
59
|
+
command: "agentplane task normalize --sync-branch-pr-state --task-id <task-id>",
|
|
60
|
+
reason: "reconcile the shipped task's local branch_pr state and PR artifacts to MERGED without scanning unrelated task history",
|
|
61
61
|
},
|
|
62
62
|
details: [
|
|
63
63
|
`Affected tasks: ${matches.length}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../../src/commands/guard/impl/commands.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../../src/commands/guard/impl/commands.ts"],"names":[],"mappings":"AAaA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAQvF,OAAO,EAAoB,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAC;AA8SxE,wBAAsB,aAAa,CAAC,IAAI,EAAE;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAsBlB;AAED,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC;CAC1B,GAAG,OAAO,CAAC,MAAM,CAAC,CAyBlB;AAED,wBAAsB,cAAc,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAa9E;AAED,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,CAsPlB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { mkdir, rm, writeFile } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
|
+
import { extractTaskSuffix } from "@agentplaneorg/core";
|
|
3
4
|
import { resolveTaskIndexPath } from "../../../backends/task-index.js";
|
|
4
5
|
import { mapCoreError } from "../../../cli/error-map.js";
|
|
5
6
|
import { infoMessage, successMessage } from "../../../cli/output.js";
|
|
@@ -7,6 +8,7 @@ import { stripAnsi } from "../../../cli/shared/ansi.js";
|
|
|
7
8
|
import { withDiagnosticContext } from "../../../shared/diagnostics.js";
|
|
8
9
|
import { CliError } from "../../../shared/errors.js";
|
|
9
10
|
import { refreshBranchPrArtifactsAfterTaskCommit } from "../../shared/post-commit-pr-artifacts.js";
|
|
11
|
+
import { isTaskLocalAdvancePath } from "../../shared/task-local-freshness.js";
|
|
10
12
|
import { loadCommandContext } from "../../shared/task-backend.js";
|
|
11
13
|
import { loadTaskFromContext } from "../../shared/task-backend.js";
|
|
12
14
|
import { execFileAsync, gitEnv } from "../../shared/git.js";
|
|
@@ -111,6 +113,64 @@ function detectCommitFailureSignal(output) {
|
|
|
111
113
|
}
|
|
112
114
|
return null;
|
|
113
115
|
}
|
|
116
|
+
function taskArtifactRefreshCommitMessage(taskId) {
|
|
117
|
+
return `📝 ${extractTaskSuffix(taskId)} task: refresh PR artifacts`;
|
|
118
|
+
}
|
|
119
|
+
async function commitRefreshedTaskArtifacts(opts) {
|
|
120
|
+
const changedPaths = await opts.ctx.git.statusChangedPaths();
|
|
121
|
+
const taskArtifactPaths = changedPaths.filter((relPath) => isTaskLocalAdvancePath({
|
|
122
|
+
workflowDir: opts.ctx.config.paths.workflow_dir,
|
|
123
|
+
taskId: opts.taskId,
|
|
124
|
+
tasksPath: opts.ctx.config.paths.tasks_path,
|
|
125
|
+
relPath,
|
|
126
|
+
}));
|
|
127
|
+
if (taskArtifactPaths.length === 0)
|
|
128
|
+
return false;
|
|
129
|
+
await stageAllowlist({
|
|
130
|
+
ctx: opts.ctx,
|
|
131
|
+
allow: [],
|
|
132
|
+
allowTasks: true,
|
|
133
|
+
allowPolicy: false,
|
|
134
|
+
allowConfig: false,
|
|
135
|
+
allowHooks: false,
|
|
136
|
+
allowCI: false,
|
|
137
|
+
tasksPath: opts.ctx.config.paths.tasks_path,
|
|
138
|
+
workflowDir: opts.ctx.config.paths.workflow_dir,
|
|
139
|
+
taskId: opts.taskId,
|
|
140
|
+
allowTaskOnly: true,
|
|
141
|
+
emptyAllowMessage: "PR artifact refresh produced no task-local files to stage for the follow-up commit.",
|
|
142
|
+
noMatchMessage: "PR artifact refresh produced changes outside the active task artifact scope; inspect the working tree before retrying the commit flow.",
|
|
143
|
+
});
|
|
144
|
+
const message = taskArtifactRefreshCommitMessage(opts.taskId);
|
|
145
|
+
await guardCommitCheck({
|
|
146
|
+
ctx: opts.ctx,
|
|
147
|
+
cwd: opts.cwd,
|
|
148
|
+
rootOverride: opts.rootOverride,
|
|
149
|
+
baseBranchOverride: null,
|
|
150
|
+
taskId: opts.taskId,
|
|
151
|
+
message,
|
|
152
|
+
allow: [],
|
|
153
|
+
allowBase: false,
|
|
154
|
+
allowTasks: true,
|
|
155
|
+
allowPolicy: false,
|
|
156
|
+
allowConfig: false,
|
|
157
|
+
allowHooks: false,
|
|
158
|
+
allowCI: false,
|
|
159
|
+
requireClean: true,
|
|
160
|
+
quiet: opts.quiet,
|
|
161
|
+
});
|
|
162
|
+
const env = buildGitCommitEnv({
|
|
163
|
+
taskId: opts.taskId,
|
|
164
|
+
allowTasks: true,
|
|
165
|
+
allowBase: false,
|
|
166
|
+
allowPolicy: false,
|
|
167
|
+
allowConfig: false,
|
|
168
|
+
allowHooks: false,
|
|
169
|
+
allowCI: false,
|
|
170
|
+
});
|
|
171
|
+
await opts.ctx.git.commit({ message, env });
|
|
172
|
+
return true;
|
|
173
|
+
}
|
|
114
174
|
function commitFailureDiagnostic(phase, output) {
|
|
115
175
|
const signal = detectCommitFailureSignal(output);
|
|
116
176
|
if (signal === "formatter") {
|
|
@@ -327,15 +387,17 @@ export async function cmdCommit(opts) {
|
|
|
327
387
|
return 0;
|
|
328
388
|
}
|
|
329
389
|
if (opts.closeStageTaskArtifacts === true) {
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
390
|
+
if (opts.closeRefreshTaskArtifacts !== false) {
|
|
391
|
+
await refreshBranchPrArtifactsAfterTaskCommit({
|
|
392
|
+
ctx,
|
|
393
|
+
cwd: opts.cwd,
|
|
394
|
+
rootOverride: opts.rootOverride,
|
|
395
|
+
taskId: opts.taskId,
|
|
396
|
+
quiet: opts.quiet,
|
|
397
|
+
});
|
|
398
|
+
}
|
|
337
399
|
// Artifact refresh writes tracked task files on disk; invalidate the memoized
|
|
338
|
-
// porcelain snapshot so staging/cleanliness checks see the
|
|
400
|
+
// porcelain snapshot so staging/cleanliness checks see the current task artifact state.
|
|
339
401
|
ctx.git.invalidateStatus();
|
|
340
402
|
}
|
|
341
403
|
await (opts.closeStageTaskArtifacts === true
|
|
@@ -459,6 +521,14 @@ export async function cmdCommit(opts) {
|
|
|
459
521
|
taskId: opts.taskId,
|
|
460
522
|
quiet: opts.quiet,
|
|
461
523
|
});
|
|
524
|
+
ctx.git.invalidateStatus();
|
|
525
|
+
await commitRefreshedTaskArtifacts({
|
|
526
|
+
ctx,
|
|
527
|
+
cwd: opts.cwd,
|
|
528
|
+
rootOverride: opts.rootOverride,
|
|
529
|
+
taskId: opts.taskId,
|
|
530
|
+
quiet: opts.quiet,
|
|
531
|
+
});
|
|
462
532
|
if (!opts.quiet) {
|
|
463
533
|
const { hash, subject } = await ctx.git.headHashSubject();
|
|
464
534
|
process.stdout.write(`${successMessage("committed", `${hash?.slice(0, 12) ?? ""} ${subject ?? ""}`.trim(), autoStaged.length > 0 ? `staged=${autoStaged.join(", ")}` : undefined)}\n`);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const HOOK_NAMES: readonly ["commit-msg", "pre-commit", "pre-push"];
|
|
1
|
+
export declare const HOOK_NAMES: readonly ["commit-msg", "pre-commit", "pre-push", "post-merge"];
|
|
2
2
|
export declare function cmdHooksInstall(opts: {
|
|
3
3
|
cwd: string;
|
|
4
4
|
rootOverride?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/hooks/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/hooks/index.ts"],"names":[],"mappings":"AAsBA,eAAO,MAAM,UAAU,iEAAkE,CAAC;AA8K1F,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;AAED,wBAAsB,WAAW,CAAC,IAAI,EAAE;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;IAClC,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAoLlB"}
|
|
@@ -8,14 +8,16 @@ import { mapBackendError, mapCoreError } from "../../cli/error-map.js";
|
|
|
8
8
|
import { fileExists } from "../../cli/fs-utils.js";
|
|
9
9
|
import { infoMessage, successMessage } from "../../cli/output.js";
|
|
10
10
|
import { CliError } from "../../shared/errors.js";
|
|
11
|
+
import { cmdCleanupMerged } from "../branch/index.js";
|
|
11
12
|
import { GitContext } from "../shared/git-context.js";
|
|
12
13
|
import { throwIfPolicyDenied } from "../shared/policy-deny.js";
|
|
13
14
|
import { gitCurrentBranch, gitRevParse } from "../shared/git-ops.js";
|
|
14
15
|
import { parseTaskIdFromBranch, parseTaskIdFromCloseBranch } from "../shared/git-worktree.js";
|
|
15
16
|
import { isPathWithin } from "../shared/path.js";
|
|
17
|
+
import { loadCommandContext } from "../shared/task-backend.js";
|
|
16
18
|
const HOOK_MARKER = "agentplane-hook";
|
|
17
19
|
const SHIM_MARKER = "agentplane-hook-shim";
|
|
18
|
-
export const HOOK_NAMES = ["commit-msg", "pre-commit", "pre-push"];
|
|
20
|
+
export const HOOK_NAMES = ["commit-msg", "pre-commit", "pre-push", "post-merge"];
|
|
19
21
|
async function inferTaskIdFromBranchContext(opts) {
|
|
20
22
|
try {
|
|
21
23
|
const branch = await gitCurrentBranch(opts.gitRoot);
|
|
@@ -83,14 +85,14 @@ function shimScriptText() {
|
|
|
83
85
|
"set -e",
|
|
84
86
|
'SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"',
|
|
85
87
|
'REPO_ROOT="$(dirname "$(dirname "$SCRIPT_DIR")")"',
|
|
86
|
-
'ENV_BIN="${AGENTPLANE_HOOK_RUNNER:-}"',
|
|
87
|
-
'if [ -n "$ENV_BIN" ] && command -v node >/dev/null 2>&1 && [ -f "$ENV_BIN" ]; then',
|
|
88
|
-
' exec node "$ENV_BIN" "$@"',
|
|
89
|
-
"fi",
|
|
90
88
|
'LOCAL_BIN="$REPO_ROOT/packages/agentplane/bin/agentplane.js"',
|
|
91
89
|
'if command -v node >/dev/null 2>&1 && [ -f "$LOCAL_BIN" ]; then',
|
|
92
90
|
' exec node "$LOCAL_BIN" "$@"',
|
|
93
91
|
"fi",
|
|
92
|
+
'ENV_BIN="${AGENTPLANE_HOOK_RUNNER:-}"',
|
|
93
|
+
'if [ -n "$ENV_BIN" ] && command -v node >/dev/null 2>&1 && [ -f "$ENV_BIN" ]; then',
|
|
94
|
+
' exec node "$ENV_BIN" "$@"',
|
|
95
|
+
"fi",
|
|
94
96
|
"if command -v agentplane >/dev/null 2>&1; then",
|
|
95
97
|
' exec agentplane "$@"',
|
|
96
98
|
"fi",
|
|
@@ -344,18 +346,52 @@ export async function cmdHooksRun(opts) {
|
|
|
344
346
|
env: process.env,
|
|
345
347
|
encoding: "utf8",
|
|
346
348
|
input: await readHookStdinUtf8(),
|
|
347
|
-
stdio: "pipe",
|
|
349
|
+
stdio: ["pipe", "inherit", "inherit"],
|
|
348
350
|
});
|
|
349
|
-
if (typeof result.stdout === "string" && result.stdout.length > 0) {
|
|
350
|
-
process.stdout.write(result.stdout);
|
|
351
|
-
}
|
|
352
|
-
if (typeof result.stderr === "string" && result.stderr.length > 0) {
|
|
353
|
-
process.stderr.write(result.stderr);
|
|
354
|
-
}
|
|
355
351
|
if (result.error)
|
|
356
352
|
throw result.error;
|
|
357
353
|
return result.status ?? (result.signal ? 1 : 0);
|
|
358
354
|
}
|
|
355
|
+
if (opts.hook === "post-merge") {
|
|
356
|
+
try {
|
|
357
|
+
const ctx = await loadCommandContext({
|
|
358
|
+
cwd: opts.cwd,
|
|
359
|
+
rootOverride: opts.rootOverride ?? null,
|
|
360
|
+
});
|
|
361
|
+
if (ctx.config.workflow_mode !== "branch_pr")
|
|
362
|
+
return 0;
|
|
363
|
+
const baseBranch = await resolveBaseBranch({
|
|
364
|
+
cwd: opts.cwd,
|
|
365
|
+
rootOverride: opts.rootOverride ?? null,
|
|
366
|
+
cliBaseOpt: null,
|
|
367
|
+
mode: ctx.config.workflow_mode,
|
|
368
|
+
});
|
|
369
|
+
if (!baseBranch)
|
|
370
|
+
return 0;
|
|
371
|
+
const currentBranch = await gitCurrentBranch(ctx.resolvedProject.gitRoot);
|
|
372
|
+
if (currentBranch !== baseBranch)
|
|
373
|
+
return 0;
|
|
374
|
+
return await cmdCleanupMerged({
|
|
375
|
+
ctx,
|
|
376
|
+
cwd: opts.cwd,
|
|
377
|
+
rootOverride: opts.rootOverride,
|
|
378
|
+
base: baseBranch,
|
|
379
|
+
yes: true,
|
|
380
|
+
archive: false,
|
|
381
|
+
deleteRemoteBranches: false,
|
|
382
|
+
fetch: false,
|
|
383
|
+
quiet: true,
|
|
384
|
+
skipUnsafeWorktrees: true,
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
catch (error) {
|
|
388
|
+
const message = error instanceof Error && error.message.trim().length > 0
|
|
389
|
+
? error.message.trim()
|
|
390
|
+
: String(error);
|
|
391
|
+
process.stderr.write(`warning: post-merge cleanup skipped: ${message}\n`);
|
|
392
|
+
return 0;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
359
395
|
return 0;
|
|
360
396
|
}
|
|
361
397
|
catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../../src/commands/pr/check.ts"],"names":[],"mappings":"AAeA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../../src/commands/pr/check.ts"],"names":[],"mappings":"AAeA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AAkLnC,wBAAsB,UAAU,CAAC,IAAI,EAAE;IACrC,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CA6NlB"}
|
|
@@ -79,6 +79,7 @@ async function evaluateSnapshotFreshness(opts) {
|
|
|
79
79
|
const freshness = await assessPrArtifactFreshness({
|
|
80
80
|
gitRoot: opts.gitRoot,
|
|
81
81
|
workflowDir: opts.workflowDir,
|
|
82
|
+
tasksPath: opts.tasksPath,
|
|
82
83
|
taskId: opts.taskId,
|
|
83
84
|
branchHeadSha: opts.branchHeadSha,
|
|
84
85
|
metaHeadSha: opts.snapshot.meta.head_sha ?? null,
|
|
@@ -212,6 +213,7 @@ export async function cmdPrCheck(opts) {
|
|
|
212
213
|
snapshot: localSnapshot,
|
|
213
214
|
gitRoot: resolved.gitRoot,
|
|
214
215
|
workflowDir: config.paths.workflow_dir,
|
|
216
|
+
tasksPath: config.paths.tasks_path,
|
|
215
217
|
taskId: task.id,
|
|
216
218
|
branchHeadSha,
|
|
217
219
|
taskVerificationState: task.verification?.state ?? null,
|
|
@@ -294,6 +296,7 @@ export async function cmdPrCheck(opts) {
|
|
|
294
296
|
snapshot: branchSnapshot,
|
|
295
297
|
gitRoot: resolved.gitRoot,
|
|
296
298
|
workflowDir: config.paths.workflow_dir,
|
|
299
|
+
tasksPath: config.paths.tasks_path,
|
|
297
300
|
taskId: task.id,
|
|
298
301
|
branchHeadSha,
|
|
299
302
|
taskVerificationState: task.verification?.state ?? null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cmd.d.ts","sourceRoot":"","sources":["../../../../src/commands/pr/integrate/cmd.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cmd.d.ts","sourceRoot":"","sources":["../../../../src/commands/pr/integrate/cmd.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAUnE,wBAAsB,YAAY,CAAC,IAAI,EAAE;IACvC,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;IAC7C,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CA+OlB"}
|