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
|
@@ -13,6 +13,12 @@ export type ReleaseVersionPlan = {
|
|
|
13
13
|
nextVersion: string;
|
|
14
14
|
bump: BumpKind;
|
|
15
15
|
};
|
|
16
|
+
export type ReleaseApplyRoute = {
|
|
17
|
+
kind: "direct_release" | "release_candidate";
|
|
18
|
+
workflow_mode: "direct" | "branch_pr";
|
|
19
|
+
current_branch: string;
|
|
20
|
+
base_branch: string | null;
|
|
21
|
+
};
|
|
16
22
|
export type PlanChange = {
|
|
17
23
|
hash: string;
|
|
18
24
|
authorDateIso: string;
|
|
@@ -37,10 +43,17 @@ export type ReleaseApplyReport = {
|
|
|
37
43
|
hash: string;
|
|
38
44
|
subject: string;
|
|
39
45
|
} | null;
|
|
46
|
+
route: ReleaseApplyRoute;
|
|
47
|
+
tag: {
|
|
48
|
+
name: string;
|
|
49
|
+
created: boolean;
|
|
50
|
+
pushed: boolean;
|
|
51
|
+
};
|
|
40
52
|
push: {
|
|
41
53
|
requested: boolean;
|
|
42
54
|
remote: string;
|
|
43
55
|
performed: boolean;
|
|
56
|
+
refs: string[];
|
|
44
57
|
};
|
|
45
58
|
};
|
|
46
59
|
//# sourceMappingURL=apply.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply.types.d.ts","sourceRoot":"","sources":["../../../src/commands/release/apply.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAEnD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,OAAO,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,CAAC;AAEnD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,QAAQ,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;CAC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C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan.command.d.ts","sourceRoot":"","sources":["../../../src/commands/release/plan.command.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAO1E,KAAK,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAE5C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,OAAO,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"plan.command.d.ts","sourceRoot":"","sources":["../../../src/commands/release/plan.command.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAO1E,KAAK,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAE5C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,OAAO,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,gBAAgB,CAAC;AAkLjD,eAAO,MAAM,eAAe,EAAE,WAAW,CAAC,iBAAiB,CA4E1D,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,cAAc,CAAC,iBAAiB,CAiF5D,CAAC"}
|
|
@@ -18,6 +18,43 @@ function parseSemver(version) {
|
|
|
18
18
|
return null;
|
|
19
19
|
return { major, minor, patch };
|
|
20
20
|
}
|
|
21
|
+
function compareSemver(left, right) {
|
|
22
|
+
const leftParsed = parseSemver(left);
|
|
23
|
+
const rightParsed = parseSemver(right);
|
|
24
|
+
if (!leftParsed || !rightParsed) {
|
|
25
|
+
throw new CliError({
|
|
26
|
+
exitCode: exitCodeForError("E_VALIDATION"),
|
|
27
|
+
code: "E_VALIDATION",
|
|
28
|
+
message: `Invalid semver comparison: ${left} vs ${right}`,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
if (leftParsed.major !== rightParsed.major)
|
|
32
|
+
return leftParsed.major - rightParsed.major;
|
|
33
|
+
if (leftParsed.minor !== rightParsed.minor)
|
|
34
|
+
return leftParsed.minor - rightParsed.minor;
|
|
35
|
+
return leftParsed.patch - rightParsed.patch;
|
|
36
|
+
}
|
|
37
|
+
function normalizeTagVersion(tag) {
|
|
38
|
+
if (!tag)
|
|
39
|
+
return null;
|
|
40
|
+
return tag.startsWith("v") ? tag.slice(1) : tag;
|
|
41
|
+
}
|
|
42
|
+
function listMissingPatchTags(fromVersion, toVersion) {
|
|
43
|
+
const fromParsed = parseSemver(fromVersion);
|
|
44
|
+
const toParsed = parseSemver(toVersion);
|
|
45
|
+
if (!fromParsed || !toParsed)
|
|
46
|
+
return [];
|
|
47
|
+
if (fromParsed.major !== toParsed.major ||
|
|
48
|
+
fromParsed.minor !== toParsed.minor ||
|
|
49
|
+
toParsed.patch <= fromParsed.patch) {
|
|
50
|
+
return [];
|
|
51
|
+
}
|
|
52
|
+
const out = [];
|
|
53
|
+
for (let patch = fromParsed.patch + 1; patch <= toParsed.patch; patch += 1) {
|
|
54
|
+
out.push(`v${fromParsed.major}.${fromParsed.minor}.${patch}`);
|
|
55
|
+
}
|
|
56
|
+
return out;
|
|
57
|
+
}
|
|
21
58
|
function bumpVersion(version, bump) {
|
|
22
59
|
const parsed = parseSemver(version);
|
|
23
60
|
if (!parsed) {
|
|
@@ -220,6 +257,17 @@ export const runReleasePlan = async (ctx, flags) => {
|
|
|
220
257
|
});
|
|
221
258
|
}
|
|
222
259
|
const prevTag = flags.since ?? (await getLatestSemverTag(gitRoot));
|
|
260
|
+
const latestPublishedVersion = normalizeTagVersion(prevTag);
|
|
261
|
+
if (latestPublishedVersion && compareSemver(coreVersion, latestPublishedVersion) > 0) {
|
|
262
|
+
const missingTags = listMissingPatchTags(latestPublishedVersion, coreVersion);
|
|
263
|
+
const missingText = missingTags.length > 0 ? missingTags.join(", ") : coreVersion;
|
|
264
|
+
throw new CliError({
|
|
265
|
+
exitCode: exitCodeForError("E_VALIDATION"),
|
|
266
|
+
code: "E_VALIDATION",
|
|
267
|
+
message: `Release planning blocked: workspace version is already ${coreVersion} while the latest published/tagged release is ${prevTag}. ` +
|
|
268
|
+
`Publish or recover the missing release sequence first: ${missingText}.`,
|
|
269
|
+
});
|
|
270
|
+
}
|
|
223
271
|
const nextVersion = bumpVersion(coreVersion, flags.bump);
|
|
224
272
|
const nextTag = `v${nextVersion}`;
|
|
225
273
|
const changes = await listChanges(gitRoot, prevTag);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type MergedBranchCleanupResult = {
|
|
2
|
+
removedBranch: boolean;
|
|
3
|
+
removedWorktree: boolean;
|
|
4
|
+
worktreePath: string | null;
|
|
5
|
+
skippedReason: "outside_repo" | "current_worktree" | null;
|
|
6
|
+
};
|
|
7
|
+
export declare function cleanupMergedLocalBranch(opts: {
|
|
8
|
+
gitRoot: string;
|
|
9
|
+
branch: string;
|
|
10
|
+
worktreePathHint?: string | null;
|
|
11
|
+
}): Promise<MergedBranchCleanupResult>;
|
|
12
|
+
//# sourceMappingURL=merged-branch-cleanup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merged-branch-cleanup.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/merged-branch-cleanup.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,yBAAyB,GAAG;IACtC,aAAa,EAAE,OAAO,CAAC;IACvB,eAAe,EAAE,OAAO,CAAC;IACzB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,aAAa,EAAE,cAAc,GAAG,kBAAkB,GAAG,IAAI,CAAC;CAC3D,CAAC;AAEF,wBAAsB,wBAAwB,CAAC,IAAI,EAAE;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC,GAAG,OAAO,CAAC,yBAAyB,CAAC,CA4CrC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { execFileAsync, gitEnv } from "./git.js";
|
|
2
|
+
import { gitBranchExists } from "./git-ops.js";
|
|
3
|
+
import { findWorktreeForBranch } from "./git-worktree.js";
|
|
4
|
+
import { isPathWithin, resolvePathFallback } from "./path.js";
|
|
5
|
+
export async function cleanupMergedLocalBranch(opts) {
|
|
6
|
+
const repoRoot = await resolvePathFallback(opts.gitRoot);
|
|
7
|
+
const discoveredWorktree = await findWorktreeForBranch(opts.gitRoot, opts.branch);
|
|
8
|
+
const rawWorktreePath = discoveredWorktree ?? opts.worktreePathHint ?? null;
|
|
9
|
+
const worktreePath = rawWorktreePath ? await resolvePathFallback(rawWorktreePath) : null;
|
|
10
|
+
if (worktreePath) {
|
|
11
|
+
if (!isPathWithin(repoRoot, worktreePath)) {
|
|
12
|
+
return {
|
|
13
|
+
removedBranch: false,
|
|
14
|
+
removedWorktree: false,
|
|
15
|
+
worktreePath,
|
|
16
|
+
skippedReason: "outside_repo",
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
if (worktreePath === repoRoot) {
|
|
20
|
+
return {
|
|
21
|
+
removedBranch: false,
|
|
22
|
+
removedWorktree: false,
|
|
23
|
+
worktreePath,
|
|
24
|
+
skippedReason: "current_worktree",
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
await execFileAsync("git", ["worktree", "remove", "--force", worktreePath], {
|
|
28
|
+
cwd: opts.gitRoot,
|
|
29
|
+
env: gitEnv(),
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
let removedBranch = false;
|
|
33
|
+
if (await gitBranchExists(opts.gitRoot, opts.branch)) {
|
|
34
|
+
await execFileAsync("git", ["branch", "-D", opts.branch], {
|
|
35
|
+
cwd: opts.gitRoot,
|
|
36
|
+
env: gitEnv(),
|
|
37
|
+
});
|
|
38
|
+
removedBranch = true;
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
removedBranch,
|
|
42
|
+
removedWorktree: Boolean(worktreePath),
|
|
43
|
+
worktreePath,
|
|
44
|
+
skippedReason: null,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"post-commit-pr-artifacts.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/post-commit-pr-artifacts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"post-commit-pr-artifacts.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/post-commit-pr-artifacts.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AA2BhE,wBAAsB,uCAAuC,CAAC,IAAI,EAAE;IAClE,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;CAChB,GAAG,OAAO,CAAC,IAAI,CAAC,CAmChB"}
|
|
@@ -1,10 +1,45 @@
|
|
|
1
1
|
import { warnMessage } from "../../cli/output.js";
|
|
2
2
|
import { normalizeGhTransportError } from "../shared/gh-transport.js";
|
|
3
|
+
import { execFileAsync, gitEnv } from "../shared/git.js";
|
|
3
4
|
import { ensurePrArtifactsSynced } from "../pr/internal/sync.js";
|
|
5
|
+
import { isTaskLocalOnlyAdvance } from "./task-local-freshness.js";
|
|
6
|
+
function isUnknownRevisionError(err) {
|
|
7
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
8
|
+
return (/unknown revision or path not in the working tree/i.test(message) ||
|
|
9
|
+
/bad revision/i.test(message) ||
|
|
10
|
+
/ambiguous argument/i.test(message));
|
|
11
|
+
}
|
|
12
|
+
async function resolveHeadParent(gitRoot) {
|
|
13
|
+
try {
|
|
14
|
+
const { stdout } = await execFileAsync("git", ["rev-parse", "HEAD^"], {
|
|
15
|
+
cwd: gitRoot,
|
|
16
|
+
env: gitEnv(),
|
|
17
|
+
});
|
|
18
|
+
const parent = stdout.trim();
|
|
19
|
+
return parent.length > 0 ? parent : null;
|
|
20
|
+
}
|
|
21
|
+
catch (err) {
|
|
22
|
+
if (!isUnknownRevisionError(err))
|
|
23
|
+
throw err;
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
4
27
|
export async function refreshBranchPrArtifactsAfterTaskCommit(opts) {
|
|
5
28
|
if (opts.ctx.config.workflow_mode !== "branch_pr")
|
|
6
29
|
return;
|
|
7
30
|
try {
|
|
31
|
+
const gitRoot = opts.ctx.resolvedProject.gitRoot;
|
|
32
|
+
const headParent = await resolveHeadParent(gitRoot);
|
|
33
|
+
if (await isTaskLocalOnlyAdvance({
|
|
34
|
+
gitRoot,
|
|
35
|
+
workflowDir: opts.ctx.config.paths.workflow_dir,
|
|
36
|
+
tasksPath: opts.ctx.config.paths.tasks_path,
|
|
37
|
+
taskId: opts.taskId,
|
|
38
|
+
fromRef: headParent,
|
|
39
|
+
toRef: "HEAD",
|
|
40
|
+
})) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
8
43
|
await ensurePrArtifactsSynced({
|
|
9
44
|
ctx: opts.ctx,
|
|
10
45
|
cwd: opts.cwd,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-backend.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/task-backend.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"task-backend.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/task-backend.ts"],"names":[],"mappings":"AAEA,OAAO,EAOL,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACrB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gCA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ChB,CAAC,CAaD;AAED,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,YAAY,CAAC,EACtD,KAAK,EAAE,SAAS,QAAQ,EAAE,GACzB,OAAO,CAAC,IAAI,CAAC,CASf;AAED,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAgBvF;AAED,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,CAQ3F;AAED,wBAAsB,4BAA4B,CAAC,IAAI,EAAE;IACvD,GAAG,EAAE,cAAc,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,IAAI,CAAC,CAchB"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
1
2
|
import path from "node:path";
|
|
2
3
|
import { resolveTaskDocUpdatedBy, parseTaskReadme, taskDocToSectionMap, validateTaskReadmeFrontmatter, withTaskReadmeFrontmatterDefaults, } from "@agentplaneorg/core";
|
|
3
4
|
import { CliError } from "../../shared/errors.js";
|
|
4
5
|
import { loadTaskBackend, taskRecordToData, toTaskSummary, } from "../../backends/task-backend.js";
|
|
5
6
|
import { gitShowFile, toGitPath } from "./git-diff.js";
|
|
6
7
|
import { GitContext } from "./git-context.js";
|
|
7
|
-
import { gitListTaskBranches, parseTaskIdFromBranch } from "./git-worktree.js";
|
|
8
|
+
import { findWorktreeForBranch, gitListTaskBranches, parseTaskIdFromBranch, } from "./git-worktree.js";
|
|
8
9
|
function normalizeDocUpdatedBy(value) {
|
|
9
10
|
const trimmed = value?.trim() ?? "";
|
|
10
11
|
if (!trimmed)
|
|
@@ -131,14 +132,45 @@ export async function loadTaskFromBranchSnapshot(opts) {
|
|
|
131
132
|
: await resolveTaskBranchFromContext({ ctx: opts.ctx, taskId: opts.taskId });
|
|
132
133
|
if (!branch)
|
|
133
134
|
return null;
|
|
135
|
+
const liveWorktreePath = await findWorktreeForBranch(opts.ctx.resolvedProject.gitRoot, branch);
|
|
136
|
+
if (liveWorktreePath) {
|
|
137
|
+
const liveReadmePath = path.join(liveWorktreePath, path.relative(opts.ctx.resolvedProject.gitRoot, opts.readmePath));
|
|
138
|
+
try {
|
|
139
|
+
const liveText = await readFile(liveReadmePath, "utf8");
|
|
140
|
+
const parsed = parseTaskReadme(liveText);
|
|
141
|
+
const frontmatter = validateTaskReadmeFrontmatter(withTaskReadmeFrontmatterDefaults({
|
|
142
|
+
...parsed.frontmatter,
|
|
143
|
+
id: typeof parsed.frontmatter.id === "string" && parsed.frontmatter.id.trim().length > 0
|
|
144
|
+
? parsed.frontmatter.id
|
|
145
|
+
: opts.taskId,
|
|
146
|
+
}));
|
|
147
|
+
return taskRecordToData({
|
|
148
|
+
id: opts.taskId,
|
|
149
|
+
frontmatter: frontmatter,
|
|
150
|
+
body: parsed.body,
|
|
151
|
+
readmePath: opts.readmePath,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
catch {
|
|
155
|
+
// Fall back to the committed branch snapshot when the live worktree lacks the README.
|
|
156
|
+
}
|
|
157
|
+
}
|
|
134
158
|
const relReadmePath = toGitPath(path.relative(opts.ctx.resolvedProject.gitRoot, opts.readmePath));
|
|
159
|
+
const refsToTry = [branch, branch.startsWith("origin/") ? null : `origin/${branch}`].filter((ref) => Boolean(ref && ref.trim().length > 0));
|
|
135
160
|
let text = "";
|
|
136
|
-
|
|
137
|
-
|
|
161
|
+
let loaded = false;
|
|
162
|
+
for (const ref of refsToTry) {
|
|
163
|
+
try {
|
|
164
|
+
text = await gitShowFile(opts.ctx.resolvedProject.gitRoot, ref, relReadmePath);
|
|
165
|
+
loaded = true;
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
catch {
|
|
169
|
+
// Try the next candidate ref.
|
|
170
|
+
}
|
|
138
171
|
}
|
|
139
|
-
|
|
172
|
+
if (!loaded)
|
|
140
173
|
return null;
|
|
141
|
-
}
|
|
142
174
|
const parsed = parseTaskReadme(text);
|
|
143
175
|
const frontmatter = validateTaskReadmeFrontmatter(withTaskReadmeFrontmatterDefaults({
|
|
144
176
|
...parsed.frontmatter,
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
export declare function isTaskLocalAdvancePath(opts: {
|
|
2
2
|
workflowDir: string;
|
|
3
3
|
taskId: string;
|
|
4
|
+
tasksPath?: string;
|
|
4
5
|
relPath: string;
|
|
5
6
|
}): boolean;
|
|
6
7
|
export declare function isTaskLocalOnlyAdvance(opts: {
|
|
7
8
|
gitRoot: string;
|
|
8
9
|
workflowDir: string;
|
|
9
10
|
taskId: string;
|
|
11
|
+
tasksPath?: string;
|
|
10
12
|
fromRef: string | null;
|
|
11
13
|
toRef: string;
|
|
12
14
|
}): Promise<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-local-freshness.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/task-local-freshness.ts"],"names":[],"mappings":"AAQA,wBAAgB,sBAAsB,CAAC,IAAI,EAAE;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,
|
|
1
|
+
{"version":3,"file":"task-local-freshness.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/task-local-freshness.ts"],"names":[],"mappings":"AAQA,wBAAgB,sBAAsB,CAAC,IAAI,EAAE;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,CAOV;AAED,wBAAsB,sBAAsB,CAAC,IAAI,EAAE;IACjD,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,OAAO,CAAC,OAAO,CAAC,CAgBnB"}
|
|
@@ -4,7 +4,12 @@ function taskRootPrefix(workflowDir, taskId) {
|
|
|
4
4
|
return `${toGitPath(path.join(workflowDir, taskId))}/`;
|
|
5
5
|
}
|
|
6
6
|
export function isTaskLocalAdvancePath(opts) {
|
|
7
|
-
|
|
7
|
+
const normalizedRelPath = toGitPath(opts.relPath);
|
|
8
|
+
if (normalizedRelPath.startsWith(taskRootPrefix(opts.workflowDir, opts.taskId))) {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
const normalizedTasksPath = opts.tasksPath ? toGitPath(opts.tasksPath) : null;
|
|
12
|
+
return normalizedTasksPath !== null && normalizedRelPath === normalizedTasksPath;
|
|
8
13
|
}
|
|
9
14
|
export async function isTaskLocalOnlyAdvance(opts) {
|
|
10
15
|
if (!opts.fromRef || opts.fromRef === opts.toRef) {
|
|
@@ -15,6 +20,7 @@ export async function isTaskLocalOnlyAdvance(opts) {
|
|
|
15
20
|
changedPaths.every((relPath) => isTaskLocalAdvancePath({
|
|
16
21
|
workflowDir: opts.workflowDir,
|
|
17
22
|
taskId: opts.taskId,
|
|
23
|
+
tasksPath: opts.tasksPath,
|
|
18
24
|
relPath,
|
|
19
25
|
})));
|
|
20
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"finish-shared.d.ts","sourceRoot":"","sources":["../../../src/commands/task/finish-shared.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAG/D,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AACrF,OAAO,EAA6B,YAAY,EAAmB,MAAM,yBAAyB,CAAC;AAWnG,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,E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CAAC,IAAI,CAAC,CAuEhB;AAED,wBAAsB,qBAAqB,CAAC,IAAI,EAAE;IAChD,GAAG,EAAE,cAAc,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,KAAK,EAAE,OAAO,CAAC;IACf,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC,GAAG,OAAO,CAAC,IAAI,CAAC,CAwBhB"}
|
|
@@ -234,5 +234,6 @@ export async function createTaskCloseCommit(opts) {
|
|
|
234
234
|
closeUnstageOthers: opts.closeUnstageOthers === true,
|
|
235
235
|
closeCheckOnly: false,
|
|
236
236
|
closeStageTaskArtifacts: opts.ctx.config.workflow_mode === "branch_pr",
|
|
237
|
+
closeRefreshTaskArtifacts: opts.closeRefreshTaskArtifacts,
|
|
237
238
|
});
|
|
238
239
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosted-close-pr.command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/hosted-close-pr.command.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"hosted-close-pr.command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/hosted-close-pr.command.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAStE,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AAQnC,KAAK,uBAAuB,GAAG;IAC7B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB,CAAC;AAgBF,eAAO,MAAM,qBAAqB,EAAE,WAAW,CAAC,uBAAuB,CAoEtE,CAAC;AA4aF,wBAAgB,+BAA+B,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,IAChF,KAAK,UAAU,EAAE,GAAG,uBAAuB,KAAG,OAAO,CAAC,MAAM,CAAC,CAsB5E"}
|
|
@@ -6,6 +6,7 @@ import { exitCodeForError } from "../../cli/exit-codes.js";
|
|
|
6
6
|
import { fileExists } from "../../cli/fs-utils.js";
|
|
7
7
|
import { CliError } from "../../shared/errors.js";
|
|
8
8
|
import { execFileAsync, gitEnv } from "../shared/git.js";
|
|
9
|
+
import { cleanupMergedLocalBranch } from "../shared/merged-branch-cleanup.js";
|
|
9
10
|
import { loadTaskFromContext, resolveTaskBranchFromContext, } from "../shared/task-backend.js";
|
|
10
11
|
import { parseTaskIdFromCloseBranch } from "../shared/git-worktree.js";
|
|
11
12
|
import { parsePrMeta } from "../shared/pr-meta.js";
|
|
@@ -263,6 +264,35 @@ function normalizeGithubPrLink(prNumber, prUrl, verb) {
|
|
|
263
264
|
? `${verb} GitHub PR #${prNumber}: ${prUrl.trim()}`
|
|
264
265
|
: `${verb} GitHub PR #${prNumber}`;
|
|
265
266
|
}
|
|
267
|
+
async function maybeCleanupMergedTaskBranch(opts) {
|
|
268
|
+
try {
|
|
269
|
+
const cleanup = await cleanupMergedLocalBranch({
|
|
270
|
+
gitRoot: opts.gitRoot,
|
|
271
|
+
branch: opts.branch,
|
|
272
|
+
});
|
|
273
|
+
if (!cleanup.removedBranch && !cleanup.removedWorktree) {
|
|
274
|
+
if (cleanup.skippedReason === "current_worktree") {
|
|
275
|
+
opts.output.info(`local merged branch cleanup skipped: ${opts.branch} is the current checkout`);
|
|
276
|
+
}
|
|
277
|
+
else if (cleanup.skippedReason === "outside_repo") {
|
|
278
|
+
opts.output.info(`local merged branch cleanup skipped: ${opts.branch} is attached to a worktree outside the current checkout root`);
|
|
279
|
+
}
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
const details = [];
|
|
283
|
+
if (cleanup.removedWorktree && cleanup.worktreePath) {
|
|
284
|
+
details.push(`removed worktree ${cleanup.worktreePath}`);
|
|
285
|
+
}
|
|
286
|
+
if (cleanup.removedBranch) {
|
|
287
|
+
details.push(`deleted branch ${opts.branch}`);
|
|
288
|
+
}
|
|
289
|
+
opts.output.info(`local merged branch cleanup: ${details.join("; ")}`);
|
|
290
|
+
}
|
|
291
|
+
catch (error) {
|
|
292
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
293
|
+
opts.output.warn(`local merged branch cleanup failed for ${opts.branch}: ${message}`);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
266
296
|
async function openHostedClosePr(opts) {
|
|
267
297
|
const output = createCliEmitter();
|
|
268
298
|
const { meta, task, taskBranch } = await readHostedCloseState({
|
|
@@ -339,6 +369,11 @@ async function openHostedClosePr(opts) {
|
|
|
339
369
|
explicitBranch: opts.branch ?? null,
|
|
340
370
|
mergeCommit,
|
|
341
371
|
});
|
|
372
|
+
await maybeCleanupMergedTaskBranch({
|
|
373
|
+
output,
|
|
374
|
+
gitRoot,
|
|
375
|
+
branch: sourceBranch,
|
|
376
|
+
});
|
|
342
377
|
const owner = repo.split("/")[0]?.trim() ?? "";
|
|
343
378
|
const existingQuery = new URLSearchParams({
|
|
344
379
|
state: "open",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosted-close.command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/hosted-close.command.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAStE,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"hosted-close.command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/hosted-close.command.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAStE,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAOrF,MAAM,MAAM,qBAAqB,GAAG;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,qBAAqB,CAqClE,CAAC;AAmYF,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,IAC9E,KAAK,UAAU,EAAE,QAAQ,qBAAqB,KAAG,OAAO,CAAC,MAAM,CAAC,CA2B/E"}
|