agentplane 0.3.10 → 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/governance.md +3 -4
- package/assets/policy/incidents.md +20 -88
- package/assets/policy/workflow.branch_pr.md +1 -1
- package/assets/policy/workflow.direct.md +2 -2
- package/bin/agentplane.js +114 -4
- package/bin/runtime-watch.js +1 -0
- package/bin/stale-dist-policy.d.ts +1 -1
- package/bin/stale-dist-policy.js +19 -1
- package/dist/.build-manifest.json +251 -166
- 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/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/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 +1 -0
- package/dist/cli/run-cli.test-helpers.d.ts.map +1 -1
- package/dist/cli/run-cli.test-helpers.js +26 -0
- package/dist/commands/branch/cleanup-merged.d.ts +3 -0
- package/dist/commands/branch/cleanup-merged.d.ts.map +1 -1
- package/dist/commands/branch/cleanup-merged.js +149 -36
- package/dist/commands/branch/work-start.d.ts.map +1 -1
- package/dist/commands/branch/work-start.js +137 -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 +1 -0
- package/dist/commands/guard/impl/commands.d.ts.map +1 -1
- package/dist/commands/guard/impl/commands.js +94 -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 +1 -1
- package/dist/commands/hooks/index.d.ts.map +1 -1
- package/dist/commands/hooks/index.js +139 -6
- 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 +241 -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 +43 -2
- 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/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 +43 -12
- 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/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/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 +4 -2
- package/dist/commands/pr/integrate/internal/prepare.d.ts.map +1 -1
- package/dist/commands/pr/integrate/internal/prepare.js +109 -38
- 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 +21 -0
- package/dist/commands/pr/internal/freshness.d.ts.map +1 -0
- package/dist/commands/pr/internal/freshness.js +52 -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 +531 -124
- 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 +24 -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 +71 -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 +356 -34
- 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.preflight.d.ts.map +1 -1
- package/dist/commands/release/apply.preflight.js +1 -1
- 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/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/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 +9 -0
- package/dist/commands/shared/post-commit-pr-artifacts.d.ts.map +1 -0
- package/dist/commands/shared/post-commit-pr-artifacts.js +57 -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 +71 -27
- 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/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 +2 -0
- package/dist/commands/task/finish-shared.d.ts.map +1 -1
- package/dist/commands/task/finish-shared.js +56 -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 +449 -0
- package/dist/commands/task/hosted-close.command.d.ts.map +1 -1
- package/dist/commands/task/hosted-close.command.js +234 -19
- package/dist/commands/task/hosted-merge-sync.d.ts +41 -0
- package/dist/commands/task/hosted-merge-sync.d.ts.map +1 -1
- package/dist/commands/task/hosted-merge-sync.js +291 -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.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
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { extractLastVerifiedSha } from "../../shared/pr-meta.js";
|
|
2
|
+
import { isTaskLocalOnlyAdvance } from "../../shared/task-local-freshness.js";
|
|
3
|
+
function normalizeSha(value) {
|
|
4
|
+
if (typeof value !== "string")
|
|
5
|
+
return null;
|
|
6
|
+
const trimmed = value.trim();
|
|
7
|
+
return trimmed.length > 0 ? trimmed : null;
|
|
8
|
+
}
|
|
9
|
+
export async function assessPrArtifactFreshness(opts) {
|
|
10
|
+
const metaHeadSha = normalizeSha(opts.metaHeadSha);
|
|
11
|
+
const metaLastVerifiedSha = normalizeSha(opts.metaLastVerifiedSha);
|
|
12
|
+
const verifyLogSha = normalizeSha(extractLastVerifiedSha(opts.verifyLogText ?? ""));
|
|
13
|
+
const metaVerifyPassed = opts.metaVerifyStatus === "pass";
|
|
14
|
+
const reviewFresh = metaHeadSha === opts.branchHeadSha ||
|
|
15
|
+
(await isTaskLocalOnlyAdvance({
|
|
16
|
+
gitRoot: opts.gitRoot,
|
|
17
|
+
workflowDir: opts.workflowDir,
|
|
18
|
+
tasksPath: opts.tasksPath,
|
|
19
|
+
taskId: opts.taskId,
|
|
20
|
+
fromRef: metaHeadSha,
|
|
21
|
+
toRef: opts.branchHeadSha,
|
|
22
|
+
}));
|
|
23
|
+
if (!opts.requiresVerify) {
|
|
24
|
+
return {
|
|
25
|
+
reviewFresh,
|
|
26
|
+
verifyFresh: true,
|
|
27
|
+
verifySatisfied: true,
|
|
28
|
+
verifyLogSha,
|
|
29
|
+
effectiveVerifiedSha: null,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const verifiedFromMeta = metaVerifyPassed &&
|
|
33
|
+
(metaLastVerifiedSha === opts.branchHeadSha ||
|
|
34
|
+
(await isTaskLocalOnlyAdvance({
|
|
35
|
+
gitRoot: opts.gitRoot,
|
|
36
|
+
workflowDir: opts.workflowDir,
|
|
37
|
+
tasksPath: opts.tasksPath,
|
|
38
|
+
taskId: opts.taskId,
|
|
39
|
+
fromRef: metaLastVerifiedSha,
|
|
40
|
+
toRef: opts.branchHeadSha,
|
|
41
|
+
})));
|
|
42
|
+
const verifiedFromLog = verifyLogSha === opts.branchHeadSha;
|
|
43
|
+
const verifiedFromTaskState = opts.taskVerificationState === "ok" && reviewFresh && metaLastVerifiedSha === null;
|
|
44
|
+
const verifySatisfied = verifiedFromMeta || verifiedFromLog || verifiedFromTaskState;
|
|
45
|
+
return {
|
|
46
|
+
reviewFresh,
|
|
47
|
+
verifyFresh: verifySatisfied,
|
|
48
|
+
verifySatisfied,
|
|
49
|
+
verifyLogSha,
|
|
50
|
+
effectiveVerifiedSha: verifySatisfied ? opts.branchHeadSha : metaLastVerifiedSha,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function ghEnv(): NodeJS.ProcessEnv;
|
|
2
|
+
export declare function resolveDefaultGithubRepo(cwd: string): Promise<string>;
|
|
3
|
+
export declare function runGhApiJson<T>(cwd: string, args: string[]): Promise<T>;
|
|
4
|
+
export declare function runGhApiNoOutput(cwd: string, args: string[]): Promise<void>;
|
|
5
|
+
export declare function isGhNotFound(err: unknown): boolean;
|
|
6
|
+
//# sourceMappingURL=gh-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gh-api.d.ts","sourceRoot":"","sources":["../../../../src/commands/pr/internal/gh-api.ts"],"names":[],"mappings":"AAqBA,wBAAgB,KAAK,IAAI,MAAM,CAAC,UAAU,CAiBzC;AAED,wBAAsB,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAe3E;AAED,wBAAsB,YAAY,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAa7E;AAED,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAYjF;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAElD"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
import { promisify } from "node:util";
|
|
3
|
+
import { exitCodeForError } from "../../../cli/exit-codes.js";
|
|
4
|
+
import { CliError } from "../../../shared/errors.js";
|
|
5
|
+
import { isDotEnvLoadedKey } from "../../../shared/env.js";
|
|
6
|
+
import { gitEnv } from "../../shared/git.js";
|
|
7
|
+
import { normalizeGhTransportError, withGhTransportRetry } from "../../shared/gh-transport.js";
|
|
8
|
+
const execFileAsyncRaw = promisify(execFile);
|
|
9
|
+
function parseGithubRepoFromRemoteUrl(remoteUrl) {
|
|
10
|
+
const trimmed = remoteUrl.trim();
|
|
11
|
+
if (!trimmed)
|
|
12
|
+
return null;
|
|
13
|
+
const httpsMatch = /^https?:\/\/github\.com\/([^/]+)\/([^/]+?)(?:\.git)?\/?$/.exec(trimmed);
|
|
14
|
+
if (httpsMatch)
|
|
15
|
+
return `${httpsMatch[1]}/${httpsMatch[2]}`;
|
|
16
|
+
const sshMatch = /^git@github\.com:([^/]+)\/([^/]+?)(?:\.git)?$/.exec(trimmed);
|
|
17
|
+
if (sshMatch)
|
|
18
|
+
return `${sshMatch[1]}/${sshMatch[2]}`;
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
export function ghEnv() {
|
|
22
|
+
const env = gitEnv();
|
|
23
|
+
// Preserve explicit shell/CI auth, but do not let repo-local `.env` tokens override
|
|
24
|
+
// a valid gh keyring session for nested CLI invocations.
|
|
25
|
+
if (isDotEnvLoadedKey("GH_TOKEN"))
|
|
26
|
+
delete env.GH_TOKEN;
|
|
27
|
+
if (isDotEnvLoadedKey("GITHUB_TOKEN"))
|
|
28
|
+
delete env.GITHUB_TOKEN;
|
|
29
|
+
if (typeof process.env.GH_TOKEN === "string" && !isDotEnvLoadedKey("GH_TOKEN")) {
|
|
30
|
+
env.GH_TOKEN = process.env.GH_TOKEN;
|
|
31
|
+
}
|
|
32
|
+
if (typeof process.env.GITHUB_TOKEN === "string" && !isDotEnvLoadedKey("GITHUB_TOKEN")) {
|
|
33
|
+
env.GITHUB_TOKEN = process.env.GITHUB_TOKEN;
|
|
34
|
+
}
|
|
35
|
+
if (typeof process.env.GH_CONFIG_DIR === "string")
|
|
36
|
+
env.GH_CONFIG_DIR = process.env.GH_CONFIG_DIR;
|
|
37
|
+
if (typeof process.env.XDG_CONFIG_HOME === "string")
|
|
38
|
+
env.XDG_CONFIG_HOME = process.env.XDG_CONFIG_HOME;
|
|
39
|
+
if (typeof process.env.HOME === "string")
|
|
40
|
+
env.HOME = process.env.HOME;
|
|
41
|
+
return env;
|
|
42
|
+
}
|
|
43
|
+
export async function resolveDefaultGithubRepo(cwd) {
|
|
44
|
+
const { stdout } = await execFileAsyncRaw("git", ["remote", "get-url", "origin"], {
|
|
45
|
+
cwd,
|
|
46
|
+
env: gitEnv(),
|
|
47
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
48
|
+
});
|
|
49
|
+
const repo = parseGithubRepoFromRemoteUrl(stdout);
|
|
50
|
+
if (!repo) {
|
|
51
|
+
throw new CliError({
|
|
52
|
+
exitCode: exitCodeForError("E_VALIDATION"),
|
|
53
|
+
code: "E_VALIDATION",
|
|
54
|
+
message: "Could not derive GitHub owner/repo from git remote origin.",
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return repo;
|
|
58
|
+
}
|
|
59
|
+
export async function runGhApiJson(cwd, args) {
|
|
60
|
+
const { stdout } = await withGhTransportRetry(() => execFileAsyncRaw("gh", ["api", ...args], {
|
|
61
|
+
cwd,
|
|
62
|
+
env: ghEnv(),
|
|
63
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
64
|
+
}), {
|
|
65
|
+
label: `running gh api ${args[0] ?? ""}`,
|
|
66
|
+
});
|
|
67
|
+
return JSON.parse(stdout);
|
|
68
|
+
}
|
|
69
|
+
export async function runGhApiNoOutput(cwd, args) {
|
|
70
|
+
await withGhTransportRetry(() => execFileAsyncRaw("gh", ["api", ...args], {
|
|
71
|
+
cwd,
|
|
72
|
+
env: ghEnv(),
|
|
73
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
74
|
+
}), {
|
|
75
|
+
label: `running gh api ${args[0] ?? ""}`,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
export function isGhNotFound(err) {
|
|
79
|
+
return /\b404\b/.test(normalizeGhTransportError(err));
|
|
80
|
+
}
|
|
@@ -28,5 +28,15 @@ export declare function readPrArtifact(opts: {
|
|
|
28
28
|
prDir: string;
|
|
29
29
|
fileName: string;
|
|
30
30
|
branch: string;
|
|
31
|
+
worktreePath?: string | null;
|
|
32
|
+
}): Promise<string | null>;
|
|
33
|
+
export declare function readPrArtifactFromBranch(opts: {
|
|
34
|
+
resolved: {
|
|
35
|
+
gitRoot: string;
|
|
36
|
+
};
|
|
37
|
+
prDir: string;
|
|
38
|
+
fileName: string;
|
|
39
|
+
branch: string;
|
|
40
|
+
worktreePath?: string | null;
|
|
31
41
|
}): Promise<string | null>;
|
|
32
42
|
//# sourceMappingURL=pr-paths.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pr-paths.d.ts","sourceRoot":"","sources":["../../../../src/commands/pr/internal/pr-paths.ts"],"names":[],"mappings":"AAGA,OAAO,EAA8B,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAIxF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAEnE,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC;IACrD,MAAM,EAAE,gBAAgB,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,wBAAsB,cAAc,CAAC,IAAI,EAAE;IACzC,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,eAAe,CAAC,CAuB3B;AAED,wBAAsB,cAAc,CAAC,IAAI,EAAE;IACzC,QAAQ,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"pr-paths.d.ts","sourceRoot":"","sources":["../../../../src/commands/pr/internal/pr-paths.ts"],"names":[],"mappings":"AAGA,OAAO,EAA8B,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAIxF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAEnE,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC;IACrD,MAAM,EAAE,gBAAgB,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,wBAAsB,cAAc,CAAC,IAAI,EAAE;IACzC,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,eAAe,CAAC,CAuB3B;AAED,wBAAsB,cAAc,CAAC,IAAI,EAAE;IACzC,QAAQ,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAMzB;AAED,wBAAsB,wBAAwB,CAAC,IAAI,EAAE;IACnD,QAAQ,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAiBzB"}
|
|
@@ -31,6 +31,16 @@ export async function readPrArtifact(opts) {
|
|
|
31
31
|
if (await fileExists(filePath)) {
|
|
32
32
|
return await readFile(filePath, "utf8");
|
|
33
33
|
}
|
|
34
|
+
return await readPrArtifactFromBranch(opts);
|
|
35
|
+
}
|
|
36
|
+
export async function readPrArtifactFromBranch(opts) {
|
|
37
|
+
const filePath = path.join(opts.prDir, opts.fileName);
|
|
38
|
+
if (opts.worktreePath) {
|
|
39
|
+
const worktreeFilePath = path.join(opts.worktreePath, path.relative(opts.resolved.gitRoot, filePath));
|
|
40
|
+
if (await fileExists(worktreeFilePath)) {
|
|
41
|
+
return await readFile(worktreeFilePath, "utf8");
|
|
42
|
+
}
|
|
43
|
+
}
|
|
34
44
|
const rel = toGitPath(path.relative(opts.resolved.gitRoot, filePath));
|
|
35
45
|
try {
|
|
36
46
|
return await gitShowFile(opts.resolved.gitRoot, opts.branch, rel);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"review-template.d.ts","sourceRoot":"","sources":["../../../../src/commands/pr/internal/review-template.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"review-template.d.ts","sourceRoot":"","sources":["../../../../src/commands/pr/internal/review-template.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAoJrD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAKzD;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,MAAM,CAeT;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAS5E;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKnE;AAMD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,aAAa,EAAE,GAAG,MAAM,EAAE,CAOrE;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,MAAM,CAgBpF;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE;IAC3C,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,aAAa,EAAE,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;CACrB,GAAG,MAAM,CAgBT;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACvC,IAAI,EAAE,QAAQ,CAAC;IACf,YAAY,CAAC,EAAE,aAAa,EAAE,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;CACrB,GAAG,MAAM,CAST;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAiB7E;AAED,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAajF"}
|
|
@@ -65,7 +65,7 @@ function renderRiskSummary(task) {
|
|
|
65
65
|
rollbackPlan,
|
|
66
66
|
].join("\n");
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function renderReviewSections(opts) {
|
|
69
69
|
return [
|
|
70
70
|
SUMMARY_SECTION,
|
|
71
71
|
"",
|
|
@@ -89,6 +89,40 @@ function renderSharedPrSections(opts) {
|
|
|
89
89
|
"",
|
|
90
90
|
];
|
|
91
91
|
}
|
|
92
|
+
function renderGithubVerificationSummary(task) {
|
|
93
|
+
const state = task.verification?.state ?? "pending";
|
|
94
|
+
const note = typeof task.verification?.note === "string" ? task.verification.note.trim() : "";
|
|
95
|
+
const statusLine = state === "ok"
|
|
96
|
+
? note || "Recorded as passed."
|
|
97
|
+
: state === "needs_rework"
|
|
98
|
+
? note || "Recorded as needs rework."
|
|
99
|
+
: note || "Not recorded yet.";
|
|
100
|
+
return [
|
|
101
|
+
`- State: ${state}`,
|
|
102
|
+
`- Note: ${statusLine}`,
|
|
103
|
+
"- Full verification checklist lives in local review.md.",
|
|
104
|
+
].join("\n");
|
|
105
|
+
}
|
|
106
|
+
function renderGithubBodySections(opts) {
|
|
107
|
+
return [
|
|
108
|
+
SUMMARY_SECTION,
|
|
109
|
+
"",
|
|
110
|
+
sectionText(opts.task, "Summary", opts.task.title.trim() || "- Not recorded."),
|
|
111
|
+
"",
|
|
112
|
+
SCOPE_SECTION,
|
|
113
|
+
"",
|
|
114
|
+
sectionText(opts.task, "Scope", "- Not recorded."),
|
|
115
|
+
"",
|
|
116
|
+
VERIFICATION_SECTION,
|
|
117
|
+
"",
|
|
118
|
+
renderGithubVerificationSummary(opts.task),
|
|
119
|
+
"",
|
|
120
|
+
HANDOFF_NOTES_MARKER,
|
|
121
|
+
"",
|
|
122
|
+
...renderPrHandoffNotes(opts.handoffNotes),
|
|
123
|
+
"",
|
|
124
|
+
];
|
|
125
|
+
}
|
|
92
126
|
export function buildGithubPrTitle(task) {
|
|
93
127
|
const suffix = extractTaskSuffix(task.id);
|
|
94
128
|
const scope = informativeTags(task).slice(0, 2).join("/");
|
|
@@ -160,7 +194,7 @@ export function renderPrReviewDocument(opts) {
|
|
|
160
194
|
`Created: ${opts.createdAt || "UNKNOWN"}`,
|
|
161
195
|
`Branch: ${opts.branch || "UNKNOWN"}`,
|
|
162
196
|
"",
|
|
163
|
-
...
|
|
197
|
+
...renderReviewSections({
|
|
164
198
|
task: opts.task,
|
|
165
199
|
handoffNotes: opts.handoffNotes ?? [],
|
|
166
200
|
}),
|
|
@@ -172,7 +206,7 @@ export function renderPrReviewDocument(opts) {
|
|
|
172
206
|
}
|
|
173
207
|
export function renderGithubPrBody(opts) {
|
|
174
208
|
return [
|
|
175
|
-
...
|
|
209
|
+
...renderGithubBodySections({
|
|
176
210
|
task: opts.task,
|
|
177
211
|
handoffNotes: opts.handoffNotes ?? [],
|
|
178
212
|
}),
|
|
@@ -204,7 +238,6 @@ export function validateGithubPrBodyContents(body, errors) {
|
|
|
204
238
|
SUMMARY_SECTION,
|
|
205
239
|
SCOPE_SECTION,
|
|
206
240
|
VERIFICATION_SECTION,
|
|
207
|
-
RISKS_SECTION,
|
|
208
241
|
HANDOFF_NOTES_MARKER,
|
|
209
242
|
];
|
|
210
243
|
for (const section of requiredSections) {
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
+
import { type PrMeta } from "../../shared/pr-meta.js";
|
|
1
2
|
import { type CommandContext } from "../../shared/task-backend.js";
|
|
3
|
+
export type PrRemoteMode = "auto" | "sync-only";
|
|
4
|
+
export type PrOpenOutcome = {
|
|
5
|
+
action: "linked-existing" | "created" | "sync-only" | "staged";
|
|
6
|
+
message: string;
|
|
7
|
+
};
|
|
2
8
|
type PrSyncMode = "open" | "update";
|
|
3
9
|
export declare function ensurePrArtifactsSynced(opts: {
|
|
4
10
|
ctx?: CommandContext;
|
|
@@ -22,11 +28,14 @@ export declare function syncPrArtifacts(opts: {
|
|
|
22
28
|
mode: PrSyncMode;
|
|
23
29
|
author?: string;
|
|
24
30
|
branch?: string;
|
|
31
|
+
remoteMode?: PrRemoteMode;
|
|
25
32
|
}): Promise<{
|
|
33
|
+
meta: PrMeta;
|
|
26
34
|
prDir: string;
|
|
27
35
|
resolved: {
|
|
28
36
|
gitRoot: string;
|
|
29
37
|
};
|
|
38
|
+
openOutcome?: PrOpenOutcome;
|
|
30
39
|
}>;
|
|
31
40
|
export {};
|
|
32
41
|
//# sourceMappingURL=sync.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../../../src/commands/pr/internal/sync.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../../../src/commands/pr/internal/sync.ts"],"names":[],"mappings":"AAqBA,OAAO,EAML,KAAK,MAAM,EACZ,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,8BAA8B,CAAC;AAoFtC,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,WAAW,CAAC;AAEhD,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,iBAAiB,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;IAC/D,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAySF,KAAK,UAAU,GAAG,MAAM,GAAG,QAAQ,CAAC;AAmCpC,wBAAsB,uBAAuB,CAAC,IAAI,EAAE;IAClD,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,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,CAAC;IACV,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAC/B,GAAG,IAAI,CAAC,CAmDR;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE;IAC1C,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,YAAY,CAAC;CAC3B,GAAG,OAAO,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9B,WAAW,CAAC,EAAE,aAAa,CAAC;CAC7B,CAAC,CA4TD"}
|