agentplane 0.3.10 → 0.3.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/policy/governance.md +3 -4
- package/assets/policy/incidents.md +19 -88
- package/assets/policy/workflow.branch_pr.md +1 -1
- package/assets/policy/workflow.direct.md +2 -2
- package/bin/agentplane.js +56 -1
- package/bin/runtime-watch.js +1 -0
- package/bin/stale-dist-policy.d.ts +1 -1
- package/bin/stale-dist-policy.js +13 -0
- package/dist/.build-manifest.json +219 -154
- package/dist/cli/bootstrap-guide.d.ts.map +1 -1
- package/dist/cli/bootstrap-guide.js +3 -2
- package/dist/cli/command-guide.d.ts.map +1 -1
- package/dist/cli/command-guide.js +2 -1
- package/dist/cli/command-invocations.d.ts.map +1 -1
- package/dist/cli/command-invocations.js +4 -1
- package/dist/cli/run-cli/command-catalog/project.d.ts +1 -1
- package/dist/cli/run-cli/command-catalog/project.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/project.js +3 -1
- package/dist/cli/run-cli/command-catalog/task.d.ts +1 -1
- package/dist/cli/run-cli/command-catalog/task.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/task.js +10 -0
- 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/commands/core/preflight.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/core/preflight.js +44 -1
- package/dist/cli/run-cli.test-helpers.d.ts.map +1 -1
- package/dist/cli/run-cli.test-helpers.js +12 -0
- package/dist/commands/branch/cleanup-merged.d.ts +2 -0
- package/dist/commands/branch/cleanup-merged.d.ts.map +1 -1
- package/dist/commands/branch/cleanup-merged.js +132 -28
- package/dist/commands/branch/work-start.d.ts.map +1 -1
- package/dist/commands/branch/work-start.js +60 -1
- package/dist/commands/cleanup/merged.command.d.ts +2 -0
- package/dist/commands/cleanup/merged.command.d.ts.map +1 -1
- package/dist/commands/cleanup/merged.command.js +24 -0
- package/dist/commands/doctor/branch-pr.d.ts +4 -0
- package/dist/commands/doctor/branch-pr.d.ts.map +1 -0
- package/dist/commands/doctor/branch-pr.js +96 -0
- package/dist/commands/doctor/fixes.d.ts +5 -0
- package/dist/commands/doctor/fixes.d.ts.map +1 -1
- package/dist/commands/doctor/fixes.js +70 -0
- package/dist/commands/doctor.run.d.ts.map +1 -1
- package/dist/commands/doctor.run.js +6 -1
- package/dist/commands/finish.run.d.ts.map +1 -1
- package/dist/commands/finish.run.js +11 -0
- package/dist/commands/finish.spec.d.ts +11 -0
- package/dist/commands/finish.spec.d.ts.map +1 -1
- package/dist/commands/finish.spec.js +51 -0
- package/dist/commands/guard/impl/close-message.d.ts.map +1 -1
- package/dist/commands/guard/impl/close-message.js +23 -6
- package/dist/commands/guard/impl/commands.d.ts.map +1 -1
- package/dist/commands/guard/impl/commands.js +24 -2
- package/dist/commands/guard/impl/env.d.ts +1 -0
- package/dist/commands/guard/impl/env.d.ts.map +1 -1
- package/dist/commands/guard/impl/env.js +1 -0
- package/dist/commands/hooks/index.d.ts.map +1 -1
- package/dist/commands/hooks/index.js +98 -1
- package/dist/commands/incidents/collect.command.d.ts.map +1 -1
- package/dist/commands/incidents/collect.command.js +12 -7
- package/dist/commands/incidents/incidents.command.js +1 -1
- package/dist/commands/incidents/shared.d.ts +34 -0
- package/dist/commands/incidents/shared.d.ts.map +1 -1
- package/dist/commands/incidents/shared.js +166 -12
- package/dist/commands/pr/check.d.ts.map +1 -1
- package/dist/commands/pr/check.js +238 -135
- package/dist/commands/pr/close-superseded.d.ts +9 -0
- package/dist/commands/pr/close-superseded.d.ts.map +1 -0
- package/dist/commands/pr/close-superseded.js +129 -0
- package/dist/commands/pr/close.d.ts +11 -0
- package/dist/commands/pr/close.d.ts.map +1 -0
- package/dist/commands/pr/close.js +116 -0
- package/dist/commands/pr/index.d.ts +2 -0
- package/dist/commands/pr/index.d.ts.map +1 -1
- package/dist/commands/pr/index.js +2 -0
- package/dist/commands/pr/integrate/artifacts.d.ts +7 -0
- package/dist/commands/pr/integrate/artifacts.d.ts.map +1 -1
- package/dist/commands/pr/integrate/artifacts.js +66 -1
- package/dist/commands/pr/integrate/cmd.d.ts.map +1 -1
- package/dist/commands/pr/integrate/cmd.js +16 -0
- package/dist/commands/pr/integrate/internal/bootstrap-guidance.d.ts +8 -0
- package/dist/commands/pr/integrate/internal/bootstrap-guidance.d.ts.map +1 -0
- package/dist/commands/pr/integrate/internal/bootstrap-guidance.js +59 -0
- package/dist/commands/pr/integrate/internal/finalize.d.ts.map +1 -1
- package/dist/commands/pr/integrate/internal/finalize.js +40 -12
- package/dist/commands/pr/integrate/internal/merge.d.ts.map +1 -1
- package/dist/commands/pr/integrate/internal/merge.js +36 -13
- package/dist/commands/pr/integrate/internal/post-integrate-bootstrap.d.ts +13 -0
- package/dist/commands/pr/integrate/internal/post-integrate-bootstrap.d.ts.map +1 -0
- package/dist/commands/pr/integrate/internal/post-integrate-bootstrap.js +25 -0
- package/dist/commands/pr/integrate/internal/prepare.d.ts +3 -2
- package/dist/commands/pr/integrate/internal/prepare.d.ts.map +1 -1
- package/dist/commands/pr/integrate/internal/prepare.js +101 -38
- package/dist/commands/pr/internal/freshness.d.ts +20 -0
- package/dist/commands/pr/internal/freshness.d.ts.map +1 -0
- package/dist/commands/pr/internal/freshness.js +50 -0
- package/dist/commands/pr/internal/gh-api.d.ts +6 -0
- package/dist/commands/pr/internal/gh-api.d.ts.map +1 -0
- package/dist/commands/pr/internal/gh-api.js +80 -0
- package/dist/commands/pr/internal/pr-paths.d.ts +10 -0
- package/dist/commands/pr/internal/pr-paths.d.ts.map +1 -1
- package/dist/commands/pr/internal/pr-paths.js +10 -0
- package/dist/commands/pr/internal/review-template.d.ts.map +1 -1
- package/dist/commands/pr/internal/review-template.js +37 -4
- package/dist/commands/pr/internal/sync.d.ts +9 -0
- package/dist/commands/pr/internal/sync.d.ts.map +1 -1
- package/dist/commands/pr/internal/sync.js +462 -122
- package/dist/commands/pr/open.d.ts +1 -0
- package/dist/commands/pr/open.d.ts.map +1 -1
- package/dist/commands/pr/open.js +13 -2
- package/dist/commands/pr/pr.command.d.ts +15 -0
- package/dist/commands/pr/pr.command.d.ts.map +1 -1
- package/dist/commands/pr/pr.command.js +118 -2
- package/dist/commands/pr/update.d.ts.map +1 -1
- package/dist/commands/pr/update.js +59 -1
- package/dist/commands/release/apply.command.d.ts.map +1 -1
- package/dist/commands/release/apply.command.js +3 -17
- package/dist/commands/release/apply.preflight.d.ts.map +1 -1
- package/dist/commands/release/apply.preflight.js +1 -1
- package/dist/commands/shared/gh-transport.d.ts +16 -0
- package/dist/commands/shared/gh-transport.d.ts.map +1 -0
- package/dist/commands/shared/gh-transport.js +71 -0
- package/dist/commands/shared/git-diff.d.ts +3 -1
- package/dist/commands/shared/git-diff.d.ts.map +1 -1
- package/dist/commands/shared/git-diff.js +10 -2
- package/dist/commands/shared/git-ops.d.ts +1 -0
- package/dist/commands/shared/git-ops.d.ts.map +1 -1
- package/dist/commands/shared/git-ops.js +15 -0
- package/dist/commands/shared/git-worktree.d.ts +2 -0
- package/dist/commands/shared/git-worktree.d.ts.map +1 -1
- package/dist/commands/shared/git-worktree.js +22 -2
- package/dist/commands/shared/post-commit-pr-artifacts.d.ts +9 -0
- package/dist/commands/shared/post-commit-pr-artifacts.d.ts.map +1 -0
- package/dist/commands/shared/post-commit-pr-artifacts.js +22 -0
- package/dist/commands/shared/pr-meta.d.ts +20 -0
- package/dist/commands/shared/pr-meta.d.ts.map +1 -1
- package/dist/commands/shared/pr-meta.js +125 -0
- package/dist/commands/shared/task-backend.d.ts +7 -0
- package/dist/commands/shared/task-backend.d.ts.map +1 -1
- package/dist/commands/shared/task-backend.js +34 -22
- package/dist/commands/task/close-duplicate.d.ts.map +1 -1
- package/dist/commands/task/close-duplicate.js +34 -1
- package/dist/commands/task/derive.js +1 -1
- package/dist/commands/task/doc-template.d.ts.map +1 -1
- package/dist/commands/task/doc-template.js +7 -11
- package/dist/commands/task/findings-add.command.d.ts +20 -0
- package/dist/commands/task/findings-add.command.d.ts.map +1 -0
- package/dist/commands/task/findings-add.command.js +165 -0
- package/dist/commands/task/findings.command.d.ts +7 -0
- package/dist/commands/task/findings.command.d.ts.map +1 -0
- package/dist/commands/task/findings.command.js +20 -0
- package/dist/commands/task/findings.d.ts +63 -0
- package/dist/commands/task/findings.d.ts.map +1 -0
- package/dist/commands/task/findings.js +188 -0
- 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 +55 -1
- package/dist/commands/task/finish.d.ts +10 -0
- package/dist/commands/task/finish.d.ts.map +1 -1
- package/dist/commands/task/finish.js +125 -6
- package/dist/commands/task/hosted-close-pr.command.d.ts +11 -0
- package/dist/commands/task/hosted-close-pr.command.d.ts.map +1 -0
- package/dist/commands/task/hosted-close-pr.command.js +414 -0
- package/dist/commands/task/hosted-close.command.d.ts.map +1 -1
- package/dist/commands/task/hosted-close.command.js +49 -1
- package/dist/commands/task/hosted-merge-sync.d.ts +38 -0
- package/dist/commands/task/hosted-merge-sync.d.ts.map +1 -1
- package/dist/commands/task/hosted-merge-sync.js +249 -17
- package/dist/commands/task/index.d.ts +1 -0
- package/dist/commands/task/index.d.ts.map +1 -1
- package/dist/commands/task/index.js +1 -0
- package/dist/commands/task/new.d.ts +1 -0
- package/dist/commands/task/new.d.ts.map +1 -1
- package/dist/commands/task/new.js +71 -1
- package/dist/commands/task/new.spec.d.ts.map +1 -1
- package/dist/commands/task/new.spec.js +7 -0
- package/dist/commands/task/normalize.command.d.ts +2 -0
- package/dist/commands/task/normalize.command.d.ts.map +1 -1
- package/dist/commands/task/normalize.command.js +45 -0
- package/dist/commands/task/normalize.d.ts +2 -0
- package/dist/commands/task/normalize.d.ts.map +1 -1
- package/dist/commands/task/normalize.js +85 -8
- package/dist/commands/task/plan.d.ts.map +1 -1
- package/dist/commands/task/plan.js +7 -10
- package/dist/commands/task/shared/docs.d.ts +6 -0
- package/dist/commands/task/shared/docs.d.ts.map +1 -1
- package/dist/commands/task/shared/docs.js +14 -0
- package/dist/commands/task/shared/transitions.d.ts.map +1 -1
- package/dist/commands/task/shared/transitions.js +11 -1
- package/dist/commands/task/shared.d.ts +1 -1
- package/dist/commands/task/shared.d.ts.map +1 -1
- package/dist/commands/task/shared.js +1 -1
- package/dist/commands/task/start-ready.d.ts.map +1 -1
- package/dist/commands/task/start-ready.js +86 -0
- package/dist/commands/task/start.d.ts.map +1 -1
- package/dist/commands/task/start.js +7 -10
- package/dist/commands/task/task.command.d.ts.map +1 -1
- package/dist/commands/task/task.command.js +4 -0
- package/dist/commands/task/verify-command-shared.d.ts +19 -0
- package/dist/commands/task/verify-command-shared.d.ts.map +1 -1
- package/dist/commands/task/verify-command-shared.js +152 -1
- package/dist/commands/task/verify-ok.command.d.ts.map +1 -1
- package/dist/commands/task/verify-ok.command.js +15 -2
- package/dist/commands/task/verify-record.d.ts +36 -0
- package/dist/commands/task/verify-record.d.ts.map +1 -1
- package/dist/commands/task/verify-record.js +166 -11
- package/dist/commands/task/verify-rework.command.d.ts.map +1 -1
- package/dist/commands/task/verify-rework.command.js +15 -2
- package/dist/commands/task/verify-show.command.d.ts +1 -1
- package/dist/commands/task/verify-show.command.d.ts.map +1 -1
- package/dist/commands/task/verify-show.command.js +28 -1
- package/dist/commands/verify.run.d.ts.map +1 -1
- package/dist/commands/verify.run.js +12 -0
- package/dist/commands/verify.spec.d.ts +2 -6
- package/dist/commands/verify.spec.d.ts.map +1 -1
- package/dist/commands/verify.spec.js +30 -3
- package/dist/runtime/incidents/index.d.ts +1 -1
- package/dist/runtime/incidents/index.d.ts.map +1 -1
- package/dist/runtime/incidents/resolve.d.ts.map +1 -1
- package/dist/runtime/incidents/resolve.js +319 -73
- package/dist/runtime/incidents/types.d.ts +14 -2
- package/dist/runtime/incidents/types.d.ts.map +1 -1
- package/dist/shared/env.d.ts +1 -0
- package/dist/shared/env.d.ts.map +1 -1
- package/dist/shared/env.js +22 -1
- package/dist/shared/protected-paths.d.ts +1 -1
- package/dist/shared/protected-paths.d.ts.map +1 -1
- package/dist/shared/protected-paths.js +4 -0
- package/package.json +2 -2
package/dist/commands/pr/open.js
CHANGED
|
@@ -4,6 +4,16 @@ import { exitCodeForError } from "../../cli/exit-codes.js";
|
|
|
4
4
|
import { createCliEmitter } from "../../cli/output.js";
|
|
5
5
|
import { CliError } from "../../shared/errors.js";
|
|
6
6
|
import { syncPrArtifacts } from "./internal/sync.js";
|
|
7
|
+
function prOpenOutcomeDetails(meta, openOutcome) {
|
|
8
|
+
if (openOutcome)
|
|
9
|
+
return openOutcome.message;
|
|
10
|
+
if (typeof meta.pr_number === "number" && meta.pr_number > 0) {
|
|
11
|
+
return meta.pr_url?.trim()
|
|
12
|
+
? `linked to GitHub PR #${meta.pr_number}: ${meta.pr_url.trim()}`
|
|
13
|
+
: `linked to GitHub PR #${meta.pr_number}`;
|
|
14
|
+
}
|
|
15
|
+
return "local PR artifacts synced; remote PR creation staged";
|
|
16
|
+
}
|
|
7
17
|
export async function cmdPrOpen(opts) {
|
|
8
18
|
try {
|
|
9
19
|
const output = createCliEmitter();
|
|
@@ -15,7 +25,7 @@ export async function cmdPrOpen(opts) {
|
|
|
15
25
|
message: "Invalid value for --author.",
|
|
16
26
|
});
|
|
17
27
|
}
|
|
18
|
-
const { prDir, resolved } = await syncPrArtifacts({
|
|
28
|
+
const { meta, prDir, resolved, openOutcome } = await syncPrArtifacts({
|
|
19
29
|
ctx: opts.ctx,
|
|
20
30
|
cwd: opts.cwd,
|
|
21
31
|
rootOverride: opts.rootOverride,
|
|
@@ -23,8 +33,9 @@ export async function cmdPrOpen(opts) {
|
|
|
23
33
|
mode: "open",
|
|
24
34
|
author,
|
|
25
35
|
branch: opts.branch,
|
|
36
|
+
remoteMode: opts.syncOnly ? "sync-only" : "auto",
|
|
26
37
|
});
|
|
27
|
-
output.success("pr open", path.relative(resolved.gitRoot, prDir));
|
|
38
|
+
output.success("pr open", path.relative(resolved.gitRoot, prDir), prOpenOutcomeDetails(meta, openOutcome ?? null));
|
|
28
39
|
return 0;
|
|
29
40
|
}
|
|
30
41
|
catch (err) {
|
|
@@ -7,6 +7,7 @@ export type PrOpenParsed = {
|
|
|
7
7
|
taskId: string;
|
|
8
8
|
author: string;
|
|
9
9
|
branch: string | null;
|
|
10
|
+
syncOnly: boolean;
|
|
10
11
|
};
|
|
11
12
|
export declare const prOpenSpec: CommandSpec<PrOpenParsed>;
|
|
12
13
|
export type PrUpdateParsed = {
|
|
@@ -22,11 +23,25 @@ export type PrNoteParsed = {
|
|
|
22
23
|
author: string;
|
|
23
24
|
body: string;
|
|
24
25
|
};
|
|
26
|
+
export type PrCloseParsed = {
|
|
27
|
+
prNumber: number;
|
|
28
|
+
repo?: string;
|
|
29
|
+
comment?: string;
|
|
30
|
+
deleteRemoteBranch: boolean;
|
|
31
|
+
};
|
|
32
|
+
export type PrCloseSupersededParsed = {
|
|
33
|
+
taskId: string;
|
|
34
|
+
deleteRemoteBranch: boolean;
|
|
35
|
+
};
|
|
25
36
|
export declare const prNoteSpec: CommandSpec<PrNoteParsed>;
|
|
37
|
+
export declare const prCloseSpec: CommandSpec<PrCloseParsed>;
|
|
38
|
+
export declare const prCloseSupersededSpec: CommandSpec<PrCloseSupersededParsed>;
|
|
26
39
|
export declare function makeRunPrHandler(_getCtx: (cmd: string) => Promise<CommandContext>): CommandHandler<GroupCommandParsed>;
|
|
27
40
|
export declare function makeRunPrOpenHandler(getCtx: (cmd: string) => Promise<CommandContext>): (ctx: CommandCtx, p: PrOpenParsed) => Promise<number>;
|
|
28
41
|
export declare function makeRunPrUpdateHandler(getCtx: (cmd: string) => Promise<CommandContext>): (ctx: CommandCtx, p: PrUpdateParsed) => Promise<number>;
|
|
29
42
|
export declare function makeRunPrCheckHandler(getCtx: (cmd: string) => Promise<CommandContext>): (ctx: CommandCtx, p: PrCheckParsed) => Promise<number>;
|
|
30
43
|
export declare function makeRunPrNoteHandler(getCtx: (cmd: string) => Promise<CommandContext>): (ctx: CommandCtx, p: PrNoteParsed) => Promise<number>;
|
|
44
|
+
export declare function makeRunPrCloseHandler(getCtx: (cmd: string) => Promise<CommandContext>): (ctx: CommandCtx, p: PrCloseParsed) => Promise<number>;
|
|
45
|
+
export declare function makeRunPrCloseSupersededHandler(getCtx: (cmd: string) => Promise<CommandContext>): (ctx: CommandCtx, p: PrCloseSupersededParsed) => Promise<number>;
|
|
31
46
|
export {};
|
|
32
47
|
//# sourceMappingURL=pr.command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pr.command.d.ts","sourceRoot":"","sources":["../../../src/commands/pr/pr.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,EAIL,KAAK,kBAAkB,EACxB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"pr.command.d.ts","sourceRoot":"","sources":["../../../src/commands/pr/pr.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,EAIL,KAAK,kBAAkB,EACxB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAWhE,KAAK,aAAa,GAAG,kBAAkB,CAAC;AAExC,eAAO,MAAM,MAAM,EAAE,WAAW,CAAC,aAAa,CA8B7C,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,W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AsB,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,IACvE,KAAK,UAAU,EAAE,GAAG,cAAc,KAAG,OAAO,CAAC,MAAM,CAAC,CAQnE;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,IACtE,KAAK,UAAU,EAAE,GAAG,aAAa,KAAG,OAAO,CAAC,MAAM,CAAC,CAQlE;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,IACrE,KAAK,UAAU,EAAE,GAAG,YAAY,KAAG,OAAO,CAAC,MAAM,CAAC,CAUjE;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,IACtE,KAAK,UAAU,EAAE,GAAG,aAAa,KAAG,OAAO,CAAC,MAAM,CAAC,CAWlE;AAED,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,CAS5E"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { loadDirectSubcommandNames, parseGroupCommand, throwGroupCommandUsage, } from "../../cli/group-command.js";
|
|
2
2
|
import { usageError } from "../../cli/spec/errors.js";
|
|
3
|
-
import { cmdPrCheck, cmdPrNote, cmdPrOpen, cmdPrUpdate } from "./index.js";
|
|
3
|
+
import { cmdPrCheck, cmdPrClose, cmdPrCloseSuperseded, cmdPrNote, cmdPrOpen, cmdPrUpdate, } from "./index.js";
|
|
4
4
|
export const prSpec = {
|
|
5
5
|
id: ["pr"],
|
|
6
6
|
group: "PR",
|
|
7
7
|
summary: "Manage local PR review and GitHub publication artifacts for a task (branch_pr workflow).",
|
|
8
|
-
synopsis: [
|
|
8
|
+
synopsis: [
|
|
9
|
+
"agentplane pr <open|update|check|note|close|close-superseded> <task-id|pr-number> [options]",
|
|
10
|
+
],
|
|
9
11
|
args: [{ name: "cmd", required: false, variadic: true, valueHint: "<cmd>" }],
|
|
10
12
|
examples: [
|
|
11
13
|
{ cmd: "agentplane pr open 202602030608-F1Q8AB --author CODER", why: "Create PR artifacts." },
|
|
@@ -18,6 +20,14 @@ export const prSpec = {
|
|
|
18
20
|
cmd: 'agentplane pr note 202602030608-F1Q8AB --author REVIEWER --body "Looks good"',
|
|
19
21
|
why: "Append a handoff note.",
|
|
20
22
|
},
|
|
23
|
+
{
|
|
24
|
+
cmd: 'agentplane pr close 123 --comment "Superseded by #456" --delete-remote-branch',
|
|
25
|
+
why: "Close a stale GitHub PR through REST and optionally delete its remote head branch.",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
cmd: "agentplane pr close-superseded 202604072308-A1XE27 --delete-remote-branch",
|
|
29
|
+
why: "Close a superseded task PR from task artifacts after protected-main closure.",
|
|
30
|
+
},
|
|
21
31
|
],
|
|
22
32
|
parse: (raw) => parseGroupCommand(raw),
|
|
23
33
|
};
|
|
@@ -40,6 +50,12 @@ export const prOpenSpec = {
|
|
|
40
50
|
valueHint: "<name>",
|
|
41
51
|
description: "Branch name (default: current branch).",
|
|
42
52
|
},
|
|
53
|
+
{
|
|
54
|
+
kind: "boolean",
|
|
55
|
+
name: "sync-only",
|
|
56
|
+
default: false,
|
|
57
|
+
description: "Only write local PR artifacts; do not create a remote GitHub PR.",
|
|
58
|
+
},
|
|
43
59
|
],
|
|
44
60
|
examples: [{ cmd: "agentplane pr open 202602030608-F1Q8AB --author CODER", why: "Open." }],
|
|
45
61
|
validateRaw: (raw) => {
|
|
@@ -52,6 +68,7 @@ export const prOpenSpec = {
|
|
|
52
68
|
taskId: String(raw.args["task-id"]),
|
|
53
69
|
author: String(raw.opts.author),
|
|
54
70
|
branch: typeof raw.opts.branch === "string" ? raw.opts.branch : null,
|
|
71
|
+
syncOnly: Boolean(raw.opts["sync-only"]),
|
|
55
72
|
}),
|
|
56
73
|
};
|
|
57
74
|
export const prUpdateSpec = {
|
|
@@ -113,6 +130,80 @@ export const prNoteSpec = {
|
|
|
113
130
|
body: String(raw.opts.body),
|
|
114
131
|
}),
|
|
115
132
|
};
|
|
133
|
+
export const prCloseSpec = {
|
|
134
|
+
id: ["pr", "close"],
|
|
135
|
+
group: "PR",
|
|
136
|
+
summary: "Close a GitHub PR through REST with optional remote head-branch deletion.",
|
|
137
|
+
args: [{ name: "pr-number", required: true, valueHint: "<pr-number>" }],
|
|
138
|
+
options: [
|
|
139
|
+
{
|
|
140
|
+
kind: "string",
|
|
141
|
+
name: "repo",
|
|
142
|
+
valueHint: "<owner/name>",
|
|
143
|
+
description: "Optional. GitHub owner/repo override (defaults to origin remote).",
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
kind: "string",
|
|
147
|
+
name: "comment",
|
|
148
|
+
valueHint: "<text>",
|
|
149
|
+
description: "Optional. Add a close comment before closing the PR.",
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
kind: "boolean",
|
|
153
|
+
name: "delete-remote-branch",
|
|
154
|
+
default: false,
|
|
155
|
+
description: "Delete the remote head branch after a successful close when it belongs to the target repo.",
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
examples: [
|
|
159
|
+
{
|
|
160
|
+
cmd: 'agentplane pr close 123 --comment "Superseded by #456" --delete-remote-branch',
|
|
161
|
+
why: "Close a stale PR and remove its remote head branch when it belongs to the same repo.",
|
|
162
|
+
},
|
|
163
|
+
],
|
|
164
|
+
validateRaw: (raw) => {
|
|
165
|
+
const prNumber = Number.parseInt(String(raw.args["pr-number"] ?? ""), 10);
|
|
166
|
+
if (!Number.isInteger(prNumber) || prNumber <= 0) {
|
|
167
|
+
throw usageError({ spec: prCloseSpec, message: "Invalid value for <pr-number>." });
|
|
168
|
+
}
|
|
169
|
+
if (typeof raw.opts.repo === "string" && raw.opts.repo.trim() === "") {
|
|
170
|
+
throw usageError({ spec: prCloseSpec, message: "Invalid value for --repo: empty." });
|
|
171
|
+
}
|
|
172
|
+
if (typeof raw.opts.comment === "string" && raw.opts.comment.trim() === "") {
|
|
173
|
+
throw usageError({ spec: prCloseSpec, message: "Invalid value for --comment: empty." });
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
parse: (raw) => ({
|
|
177
|
+
prNumber: Number.parseInt(String(raw.args["pr-number"]), 10),
|
|
178
|
+
repo: typeof raw.opts.repo === "string" ? raw.opts.repo : undefined,
|
|
179
|
+
comment: typeof raw.opts.comment === "string" ? raw.opts.comment : undefined,
|
|
180
|
+
deleteRemoteBranch: raw.opts["delete-remote-branch"] === true,
|
|
181
|
+
}),
|
|
182
|
+
};
|
|
183
|
+
export const prCloseSupersededSpec = {
|
|
184
|
+
id: ["pr", "close-superseded"],
|
|
185
|
+
group: "PR",
|
|
186
|
+
summary: "Close a superseded task PR using task artifacts.",
|
|
187
|
+
args: [{ name: "task-id", required: true, valueHint: "<task-id>" }],
|
|
188
|
+
options: [
|
|
189
|
+
{
|
|
190
|
+
kind: "boolean",
|
|
191
|
+
name: "delete-remote-branch",
|
|
192
|
+
default: false,
|
|
193
|
+
description: "Delete the remote head branch after a successful close when it belongs to the task repo.",
|
|
194
|
+
},
|
|
195
|
+
],
|
|
196
|
+
examples: [
|
|
197
|
+
{
|
|
198
|
+
cmd: "agentplane pr close-superseded 202604072308-A1XE27 --delete-remote-branch",
|
|
199
|
+
why: "Repair a stale task PR after the task has already been merged to main.",
|
|
200
|
+
},
|
|
201
|
+
],
|
|
202
|
+
parse: (raw) => ({
|
|
203
|
+
taskId: String(raw.args["task-id"]),
|
|
204
|
+
deleteRemoteBranch: raw.opts["delete-remote-branch"] === true,
|
|
205
|
+
}),
|
|
206
|
+
};
|
|
116
207
|
async function runPrRootGroup(_ctx, p) {
|
|
117
208
|
throwGroupCommandUsage({
|
|
118
209
|
spec: prSpec,
|
|
@@ -133,6 +224,7 @@ export function makeRunPrOpenHandler(getCtx) {
|
|
|
133
224
|
taskId: p.taskId,
|
|
134
225
|
author: p.author,
|
|
135
226
|
branch: p.branch ?? undefined,
|
|
227
|
+
syncOnly: p.syncOnly,
|
|
136
228
|
});
|
|
137
229
|
};
|
|
138
230
|
}
|
|
@@ -168,3 +260,27 @@ export function makeRunPrNoteHandler(getCtx) {
|
|
|
168
260
|
});
|
|
169
261
|
};
|
|
170
262
|
}
|
|
263
|
+
export function makeRunPrCloseHandler(getCtx) {
|
|
264
|
+
return async (ctx, p) => {
|
|
265
|
+
return await cmdPrClose({
|
|
266
|
+
ctx: await getCtx("pr close"),
|
|
267
|
+
cwd: ctx.cwd,
|
|
268
|
+
rootOverride: ctx.rootOverride,
|
|
269
|
+
prNumber: p.prNumber,
|
|
270
|
+
repo: p.repo,
|
|
271
|
+
comment: p.comment,
|
|
272
|
+
deleteRemoteBranch: p.deleteRemoteBranch,
|
|
273
|
+
});
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
export function makeRunPrCloseSupersededHandler(getCtx) {
|
|
277
|
+
return async (ctx, p) => {
|
|
278
|
+
return await cmdPrCloseSuperseded({
|
|
279
|
+
ctx: await getCtx("pr close-superseded"),
|
|
280
|
+
cwd: ctx.cwd,
|
|
281
|
+
rootOverride: ctx.rootOverride,
|
|
282
|
+
taskId: p.taskId,
|
|
283
|
+
deleteRemoteBranch: p.deleteRemoteBranch,
|
|
284
|
+
});
|
|
285
|
+
};
|
|
286
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/commands/pr/update.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/commands/pr/update.ts"],"names":[],"mappings":"AAOA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AAmEnC,wBAAsB,WAAW,CAAC,IAAI,EAAE;IACtC,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,CA4BlB"}
|
|
@@ -1,18 +1,76 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
1
2
|
import path from "node:path";
|
|
2
3
|
import { mapBackendError } from "../../cli/error-map.js";
|
|
3
4
|
import { createCliEmitter } from "../../cli/output.js";
|
|
4
5
|
import { CliError } from "../../shared/errors.js";
|
|
6
|
+
import { gitRevParse } from "../shared/git-ops.js";
|
|
7
|
+
import { loadBackendTask, loadCommandContext, } from "../shared/task-backend.js";
|
|
8
|
+
import { assessPrArtifactFreshness } from "./internal/freshness.js";
|
|
5
9
|
import { syncPrArtifacts } from "./internal/sync.js";
|
|
10
|
+
async function readTextIfExists(filePath) {
|
|
11
|
+
try {
|
|
12
|
+
return await readFile(filePath, "utf8");
|
|
13
|
+
}
|
|
14
|
+
catch (err) {
|
|
15
|
+
const code = err?.code;
|
|
16
|
+
if (code === "ENOENT")
|
|
17
|
+
return null;
|
|
18
|
+
throw err;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
async function warnOnStaleVerifyAfterUpdate(opts) {
|
|
22
|
+
const branch = opts.meta.branch?.trim() ?? "";
|
|
23
|
+
if (!branch)
|
|
24
|
+
return;
|
|
25
|
+
const ctx = opts.ctx ??
|
|
26
|
+
(await loadCommandContext({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null }));
|
|
27
|
+
const { config, task } = await loadBackendTask({
|
|
28
|
+
ctx,
|
|
29
|
+
cwd: opts.cwd,
|
|
30
|
+
rootOverride: opts.rootOverride,
|
|
31
|
+
taskId: opts.taskId,
|
|
32
|
+
});
|
|
33
|
+
const requiresVerify = Boolean(task.verify && task.verify.length > 0);
|
|
34
|
+
if (!requiresVerify)
|
|
35
|
+
return;
|
|
36
|
+
const branchHeadSha = await gitRevParse(opts.resolved.gitRoot, [`${branch}^{commit}`]);
|
|
37
|
+
const verifyLogText = await readTextIfExists(path.join(opts.prDir, "verify.log"));
|
|
38
|
+
const freshness = await assessPrArtifactFreshness({
|
|
39
|
+
gitRoot: opts.resolved.gitRoot,
|
|
40
|
+
workflowDir: path.join(opts.resolved.gitRoot, config.paths.workflow_dir),
|
|
41
|
+
taskId: opts.taskId,
|
|
42
|
+
branchHeadSha,
|
|
43
|
+
metaHeadSha: opts.meta.head_sha ?? null,
|
|
44
|
+
metaLastVerifiedSha: opts.meta.last_verified_sha ?? null,
|
|
45
|
+
metaVerifyStatus: opts.meta.verify?.status ?? null,
|
|
46
|
+
taskVerificationState: task.verification?.state ?? null,
|
|
47
|
+
verifyLogText,
|
|
48
|
+
requiresVerify,
|
|
49
|
+
});
|
|
50
|
+
if (opts.meta.last_verified_sha && !freshness.verifyFresh) {
|
|
51
|
+
opts.output.warn(`Verify state stale: last_verified_sha=${opts.meta.last_verified_sha} current_head=${branchHeadSha}; run \`agentplane verify ${opts.taskId} --ok --by <ROLE> --note "Verified: ..."\` before integrating`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
6
54
|
export async function cmdPrUpdate(opts) {
|
|
7
55
|
try {
|
|
8
56
|
const output = createCliEmitter();
|
|
9
|
-
const { prDir, resolved } = await syncPrArtifacts({
|
|
57
|
+
const { meta, prDir, resolved } = await syncPrArtifacts({
|
|
10
58
|
ctx: opts.ctx,
|
|
11
59
|
cwd: opts.cwd,
|
|
12
60
|
rootOverride: opts.rootOverride,
|
|
13
61
|
taskId: opts.taskId,
|
|
14
62
|
mode: "update",
|
|
15
63
|
});
|
|
64
|
+
await warnOnStaleVerifyAfterUpdate({
|
|
65
|
+
output,
|
|
66
|
+
ctx: opts.ctx,
|
|
67
|
+
cwd: opts.cwd,
|
|
68
|
+
rootOverride: opts.rootOverride,
|
|
69
|
+
taskId: opts.taskId,
|
|
70
|
+
prDir,
|
|
71
|
+
resolved,
|
|
72
|
+
meta,
|
|
73
|
+
});
|
|
16
74
|
output.success("pr update", path.relative(resolved.gitRoot, prDir));
|
|
17
75
|
return 0;
|
|
18
76
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply.command.d.ts","sourceRoot":"","sources":["../../../src/commands/release/apply.command.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AA8B1E,OAAO,KAAK,EAAE,kBAAkB,EAA0C,MAAM,kBAAkB,CAAC;AAkOnG,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,kBAAkB,
|
|
1
|
+
{"version":3,"file":"apply.command.d.ts","sourceRoot":"","sources":["../../../src/commands/release/apply.command.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AA8B1E,OAAO,KAAK,EAAE,kBAAkB,EAA0C,MAAM,kBAAkB,CAAC;AAkOnG,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,kBAAkB,CA0E5D,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,cAAc,CAAC,kBAAkB,CA2E9D,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -192,8 +192,8 @@ export const releaseApplySpec = {
|
|
|
192
192
|
kind: "boolean",
|
|
193
193
|
name: "push",
|
|
194
194
|
default: false,
|
|
195
|
-
description: "
|
|
196
|
-
"(requires --yes).
|
|
195
|
+
description: "Optional direct-push mode: push the release commit and tag immediately " +
|
|
196
|
+
"(requires --yes). Leave this off when publishing happens later from a protected branch workflow.",
|
|
197
197
|
},
|
|
198
198
|
{
|
|
199
199
|
kind: "string",
|
|
@@ -217,13 +217,6 @@ export const releaseApplySpec = {
|
|
|
217
217
|
};
|
|
218
218
|
},
|
|
219
219
|
validate: (p) => {
|
|
220
|
-
if (!p.push && process.env.AGENTPLANE_RELEASE_DRY_RUN !== "1") {
|
|
221
|
-
throw usageError({
|
|
222
|
-
spec: releaseApplySpec,
|
|
223
|
-
command: "release apply",
|
|
224
|
-
message: "Release publish is mandatory. Run `agentplane release apply --push --yes`.",
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
220
|
if (p.push && p.yes !== true) {
|
|
228
221
|
throw usageError({
|
|
229
222
|
spec: releaseApplySpec,
|
|
@@ -242,7 +235,7 @@ export const releaseApplySpec = {
|
|
|
242
235
|
examples: [
|
|
243
236
|
{
|
|
244
237
|
cmd: "agentplane release apply",
|
|
245
|
-
why: "Apply the latest release plan (expects docs/releases/vX.Y.Z.md to exist).",
|
|
238
|
+
why: "Apply the latest release plan locally (expects docs/releases/vX.Y.Z.md to exist).",
|
|
246
239
|
},
|
|
247
240
|
{
|
|
248
241
|
cmd: "agentplane release apply --plan .agentplane/.release/plan/<runId>",
|
|
@@ -255,13 +248,6 @@ export const releaseApplySpec = {
|
|
|
255
248
|
],
|
|
256
249
|
};
|
|
257
250
|
export const runReleaseApply = async (ctx, flags) => {
|
|
258
|
-
if (!flags.push && process.env.AGENTPLANE_RELEASE_DRY_RUN !== "1") {
|
|
259
|
-
throw usageError({
|
|
260
|
-
spec: releaseApplySpec,
|
|
261
|
-
command: "release apply",
|
|
262
|
-
message: "Release publish is mandatory. Run `agentplane release apply --push --yes`.",
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
251
|
return await runOperatorPipeline({
|
|
266
252
|
init: async () => {
|
|
267
253
|
const resolved = await resolveProject({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply.preflight.d.ts","sourceRoot":"","sources":["../../../src/commands/release/apply.preflight.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEvE,wBAAsB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,O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,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAgBpF;AAED,wBAAsB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAwB/F;AAED,wBAAsB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgC3E;AAED,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA6BvF;AAED,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA+BvF;AAED,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,IAAI,CAAC,CAyDf;AAED,wBAAsB,0BAA0B,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAmChG;AAED,wBAAsB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA0C7E;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC;IAC/F,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,kBAAkB,CAAC;IACzB,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC,CAwBD"}
|
|
@@ -140,7 +140,7 @@ export async function ensureCleanTrackedTree(gitRoot) {
|
|
|
140
140
|
likelyCause: "the release flow needs to create one deterministic version-bump commit and tag, but tracked edits already exist in the workspace",
|
|
141
141
|
nextAction: {
|
|
142
142
|
command: "git status --short --untracked-files=no",
|
|
143
|
-
reason: "inspect or clear tracked changes before rerunning `agentplane release apply
|
|
143
|
+
reason: "inspect or clear tracked changes before rerunning `agentplane release apply`",
|
|
144
144
|
reasonCode: "release_dirty_tree",
|
|
145
145
|
},
|
|
146
146
|
}),
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const GH_LOOKUP_MAX_ATTEMPTS = 3;
|
|
2
|
+
export declare const GH_LOOKUP_BASE_DELAY_MS = 250;
|
|
3
|
+
export declare function normalizeGhTransportError(err: unknown): string;
|
|
4
|
+
export declare function isTransientGhTransportError(err: unknown): boolean;
|
|
5
|
+
export declare function withGhTransportRetry<T>(operation: () => Promise<T>, opts: {
|
|
6
|
+
label: string;
|
|
7
|
+
maxAttempts?: number;
|
|
8
|
+
baseDelayMs?: number;
|
|
9
|
+
onRetry?: (ctx: {
|
|
10
|
+
attempt: number;
|
|
11
|
+
maxAttempts: number;
|
|
12
|
+
error: unknown;
|
|
13
|
+
label: string;
|
|
14
|
+
}) => void;
|
|
15
|
+
}): Promise<T>;
|
|
16
|
+
//# sourceMappingURL=gh-transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gh-transport.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/gh-transport.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,IAAI,CAAC;AACxC,eAAO,MAAM,uBAAuB,MAAM,CAAC;AA8B3C,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAU9D;AAED,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAIjE;AAOD,wBAAsB,oBAAoB,CAAC,CAAC,EAC1C,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAC3B,IAAI,EAAE;IACJ,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,MAAM,CAAC;QACpB,KAAK,EAAE,OAAO,CAAC;QACf,KAAK,EAAE,MAAM,CAAC;KACf,KAAK,IAAI,CAAC;CACZ,GACA,OAAO,CAAC,CAAC,CAAC,CAiBZ"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export const GH_LOOKUP_MAX_ATTEMPTS = 3;
|
|
2
|
+
export const GH_LOOKUP_BASE_DELAY_MS = 250;
|
|
3
|
+
const GH_TRANSIENT_ERROR_PATTERNS = [
|
|
4
|
+
/eof\b/i,
|
|
5
|
+
/tls handshake timeout/i,
|
|
6
|
+
/ssl_error_syscall/i,
|
|
7
|
+
/connection reset by peer/i,
|
|
8
|
+
/\beconnreset\b/i,
|
|
9
|
+
/\betimedout\b/i,
|
|
10
|
+
/socket hang up/i,
|
|
11
|
+
/temporary failure in name resolution/i,
|
|
12
|
+
/network is unreachable/i,
|
|
13
|
+
/server closed the connection/i,
|
|
14
|
+
];
|
|
15
|
+
const GH_PERMANENT_ERROR_PATTERNS = [
|
|
16
|
+
/authentication required/i,
|
|
17
|
+
/not logged into github/i,
|
|
18
|
+
/could not resolve to a pull request/i,
|
|
19
|
+
/graphql: field/i,
|
|
20
|
+
/bad credentials/i,
|
|
21
|
+
/permission denied/i,
|
|
22
|
+
/\b404\b/i,
|
|
23
|
+
/\b422\b/i,
|
|
24
|
+
/\b403\b/i,
|
|
25
|
+
/\b401\b/i,
|
|
26
|
+
/unknown command/i,
|
|
27
|
+
/usage:/i,
|
|
28
|
+
];
|
|
29
|
+
export function normalizeGhTransportError(err) {
|
|
30
|
+
if (err instanceof Error) {
|
|
31
|
+
const parts = [err.name, err.message];
|
|
32
|
+
const stderr = err.stderr;
|
|
33
|
+
const stdout = err.stdout;
|
|
34
|
+
if (typeof stderr === "string" && stderr.trim())
|
|
35
|
+
parts.push(stderr);
|
|
36
|
+
if (typeof stdout === "string" && stdout.trim())
|
|
37
|
+
parts.push(stdout);
|
|
38
|
+
return parts.filter((part) => part.trim().length > 0).join("\n");
|
|
39
|
+
}
|
|
40
|
+
return String(err);
|
|
41
|
+
}
|
|
42
|
+
export function isTransientGhTransportError(err) {
|
|
43
|
+
const text = normalizeGhTransportError(err);
|
|
44
|
+
if (GH_PERMANENT_ERROR_PATTERNS.some((pattern) => pattern.test(text)))
|
|
45
|
+
return false;
|
|
46
|
+
return GH_TRANSIENT_ERROR_PATTERNS.some((pattern) => pattern.test(text));
|
|
47
|
+
}
|
|
48
|
+
async function sleep(ms) {
|
|
49
|
+
if (ms <= 0)
|
|
50
|
+
return;
|
|
51
|
+
await new Promise((resolve) => setTimeout(resolve, ms));
|
|
52
|
+
}
|
|
53
|
+
export async function withGhTransportRetry(operation, opts) {
|
|
54
|
+
const maxAttempts = opts.maxAttempts ?? GH_LOOKUP_MAX_ATTEMPTS;
|
|
55
|
+
const baseDelayMs = opts.baseDelayMs ?? GH_LOOKUP_BASE_DELAY_MS;
|
|
56
|
+
let lastError = null;
|
|
57
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {
|
|
58
|
+
try {
|
|
59
|
+
return await operation();
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
lastError = error;
|
|
63
|
+
if (!isTransientGhTransportError(error) || attempt === maxAttempts) {
|
|
64
|
+
throw error;
|
|
65
|
+
}
|
|
66
|
+
opts.onRetry?.({ attempt, maxAttempts, error, label: opts.label });
|
|
67
|
+
await sleep(baseDelayMs * attempt);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
throw lastError instanceof Error ? lastError : new Error(String(lastError));
|
|
71
|
+
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export declare function toGitPath(filePath: string): string;
|
|
2
2
|
export declare function gitShowFile(cwd: string, ref: string, relPath: string): Promise<string>;
|
|
3
3
|
export declare function gitDiffNames(cwd: string, base: string, branch: string): Promise<string[]>;
|
|
4
|
-
export declare function gitDiffStat(cwd: string, base: string, branch: string
|
|
4
|
+
export declare function gitDiffStat(cwd: string, base: string, branch: string, opts?: {
|
|
5
|
+
excludePaths?: string[];
|
|
6
|
+
}): Promise<string>;
|
|
5
7
|
export declare function gitAheadBehind(cwd: string, base: string, branch: string): Promise<{
|
|
6
8
|
ahead: number;
|
|
7
9
|
behind: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-diff.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/git-diff.ts"],"names":[],"mappings":"AAIA,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,wBAAsB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAM5F;AAED,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAS/F;AAED,wBAAsB,WAAW,
|
|
1
|
+
{"version":3,"file":"git-diff.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/git-diff.ts"],"names":[],"mappings":"AAIA,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,wBAAsB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAM5F;AAED,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAS/F;AAED,wBAAsB,WAAW,CAC/B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE;IAAE,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,GACjC,OAAO,CAAC,MAAM,CAAC,CAcjB;AAED,wBAAsB,cAAc,CAClC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,GACb,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAa5C"}
|
|
@@ -20,8 +20,16 @@ export async function gitDiffNames(cwd, base, branch) {
|
|
|
20
20
|
.map((line) => line.trim())
|
|
21
21
|
.filter((line) => line.length > 0);
|
|
22
22
|
}
|
|
23
|
-
export async function gitDiffStat(cwd, base, branch) {
|
|
24
|
-
const
|
|
23
|
+
export async function gitDiffStat(cwd, base, branch, opts) {
|
|
24
|
+
const args = ["diff", "--stat", `${base}...${branch}`];
|
|
25
|
+
const excludePaths = (opts?.excludePaths ?? [])
|
|
26
|
+
.map((relPath) => relPath.trim())
|
|
27
|
+
.filter((relPath) => relPath.length > 0)
|
|
28
|
+
.map((relPath) => `:(exclude)${toGitPath(relPath)}`);
|
|
29
|
+
if (excludePaths.length > 0) {
|
|
30
|
+
args.push("--", ".", ...excludePaths);
|
|
31
|
+
}
|
|
32
|
+
const { stdout } = await execFileAsync("git", args, {
|
|
25
33
|
cwd,
|
|
26
34
|
env: gitEnv(),
|
|
27
35
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare function gitRevParse(cwd: string, args: string[]): Promise<string>;
|
|
2
2
|
export declare function gitCurrentBranch(cwd: string): Promise<string>;
|
|
3
3
|
export declare function gitBranchExists(cwd: string, branch: string): Promise<boolean>;
|
|
4
|
+
export declare function gitIsAncestor(cwd: string, maybeAncestor: string, descendant: string): Promise<boolean>;
|
|
4
5
|
export declare function gitBranchUpstream(cwd: string, branch: string): Promise<string | null>;
|
|
5
6
|
export declare function gitListBranches(cwd: string): Promise<string[]>;
|
|
6
7
|
export declare function gitStagedP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AAED,wBAAsB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAG7E;AAED,wBAAsB,SAAS,CAC7B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,GACtD,OAAO,CAAC,IAAI,CAAC,CAKf;AAED,wBAAsB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgB5E;AAED,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAe9F;AAED,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,OAAO,CAAC,MAAM,CAAC,CAiDlB;AAED,wBAAsB,gBAAgB,CAAC,IAAI,EAAE;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;CACpB,GAAG,OAAO,CAAC,IAAI,CAAC,CAwBhB"}
|
|
@@ -52,6 +52,21 @@ export async function gitBranchExists(cwd, branch) {
|
|
|
52
52
|
throw err;
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
+
export async function gitIsAncestor(cwd, maybeAncestor, descendant) {
|
|
56
|
+
try {
|
|
57
|
+
await execFileAsync("git", ["merge-base", "--is-ancestor", maybeAncestor, descendant], {
|
|
58
|
+
cwd,
|
|
59
|
+
env: gitEnv(),
|
|
60
|
+
});
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
catch (err) {
|
|
64
|
+
const code = err?.code;
|
|
65
|
+
if (code === 1)
|
|
66
|
+
return false;
|
|
67
|
+
throw err;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
55
70
|
export async function gitBranchUpstream(cwd, branch) {
|
|
56
71
|
try {
|
|
57
72
|
const { stdout } = await execFileAsync("git", ["for-each-ref", "--format=%(upstream:short)", `refs/heads/${branch}`], {
|
|
@@ -4,5 +4,7 @@ export declare function listWorktrees(cwd: string): Promise<{
|
|
|
4
4
|
}[]>;
|
|
5
5
|
export declare function findWorktreeForBranch(cwd: string, branch: string): Promise<string | null>;
|
|
6
6
|
export declare function parseTaskIdFromBranch(prefix: string, branch: string): string | null;
|
|
7
|
+
export declare function parseTaskIdFromCloseBranch(branch: string): string | null;
|
|
8
|
+
export declare function gitListBranchesByPrefixes(cwd: string, prefixes: string[]): Promise<string[]>;
|
|
7
9
|
export declare function gitListTaskBranches(cwd: string, prefix: string): Promise<string[]>;
|
|
8
10
|
//# sourceMappingURL=git-worktree.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-worktree.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/git-worktree.ts"],"names":[],"mappings":"AAEA,wBAAsB,aAAa,CACjC,GAAG,EAAE,MAAM,GACV,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,EAAE,CAAC,CAoBpD;AAED,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAQ/F;AAMD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAMnF;AAED,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"git-worktree.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/git-worktree.ts"],"names":[],"mappings":"AAEA,wBAAsB,aAAa,CACjC,GAAG,EAAE,MAAM,GACV,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,EAAE,CAAC,CAoBpD;AAED,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAQ/F;AAMD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAMnF;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAMxE;AAED,wBAAsB,yBAAyB,CAC7C,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAAE,GACjB,OAAO,CAAC,MAAM,EAAE,CAAC,CAkBnB;AAED,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAExF"}
|
|
@@ -39,10 +39,30 @@ export function parseTaskIdFromBranch(prefix, branch) {
|
|
|
39
39
|
const taskId = rest.split("/", 1)[0];
|
|
40
40
|
return taskId ? taskId.trim() : null;
|
|
41
41
|
}
|
|
42
|
-
export
|
|
43
|
-
const
|
|
42
|
+
export function parseTaskIdFromCloseBranch(branch) {
|
|
43
|
+
const normalized = stripBranchRef(branch);
|
|
44
|
+
if (!normalized.startsWith("task-close/"))
|
|
45
|
+
return null;
|
|
46
|
+
const rest = normalized.slice("task-close/".length);
|
|
47
|
+
const taskId = rest.split("/", 1)[0];
|
|
48
|
+
return taskId ? taskId.trim() : null;
|
|
49
|
+
}
|
|
50
|
+
export async function gitListBranchesByPrefixes(cwd, prefixes) {
|
|
51
|
+
const patterns = prefixes
|
|
52
|
+
.map((prefix) => prefix.trim())
|
|
53
|
+
.filter((prefix) => prefix.length > 0)
|
|
54
|
+
.map((prefix) => `refs/heads/${prefix}`);
|
|
55
|
+
if (patterns.length === 0)
|
|
56
|
+
return [];
|
|
57
|
+
const { stdout } = await execFileAsync("git", ["for-each-ref", "--format=%(refname:short)", ...patterns], {
|
|
58
|
+
cwd,
|
|
59
|
+
env: gitEnv(),
|
|
60
|
+
});
|
|
44
61
|
return stdout
|
|
45
62
|
.split("\n")
|
|
46
63
|
.map((line) => line.trim())
|
|
47
64
|
.filter((line) => line.length > 0);
|
|
48
65
|
}
|
|
66
|
+
export async function gitListTaskBranches(cwd, prefix) {
|
|
67
|
+
return await gitListBranchesByPrefixes(cwd, [prefix]);
|
|
68
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CommandContext } from "../shared/task-backend.js";
|
|
2
|
+
export declare function refreshBranchPrArtifactsAfterTaskCommit(opts: {
|
|
3
|
+
ctx: CommandContext;
|
|
4
|
+
cwd: string;
|
|
5
|
+
rootOverride?: string;
|
|
6
|
+
taskId: string;
|
|
7
|
+
quiet: boolean;
|
|
8
|
+
}): Promise<void>;
|
|
9
|
+
//# sourceMappingURL=post-commit-pr-artifacts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"post-commit-pr-artifacts.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/post-commit-pr-artifacts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhE,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,CAoBhB"}
|