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
|
@@ -6,24 +6,20 @@ import { exitCodeForError } from "../../../../cli/exit-codes.js";
|
|
|
6
6
|
import { unknownEntityMessage, workflowModeMessage } from "../../../../cli/output.js";
|
|
7
7
|
import { CliError } from "../../../../shared/errors.js";
|
|
8
8
|
import { ensureGitClean } from "../../../guard/index.js";
|
|
9
|
-
import { gitDiffNames
|
|
9
|
+
import { gitDiffNames } from "../../../shared/git-diff.js";
|
|
10
10
|
import { gitBranchExists, gitCurrentBranch, gitRevParse } from "../../../shared/git-ops.js";
|
|
11
|
-
import {
|
|
11
|
+
import { findWorktreeForBranch } from "../../../shared/git-worktree.js";
|
|
12
|
+
import { loadCommandContext, loadTaskFromContext, resolveTaskBranchFromContext, } from "../../../shared/task-backend.js";
|
|
12
13
|
import { ensurePlanApprovedIfRequired, ensureVerificationSatisfiedIfRequired, } from "../../../task/shared.js";
|
|
13
|
-
import { resolvePrPaths } from "../../internal/pr-paths.js";
|
|
14
|
-
import {
|
|
14
|
+
import { readPrArtifact, resolvePrPaths } from "../../internal/pr-paths.js";
|
|
15
|
+
import { ensurePrArtifactsSynced } from "../../internal/sync.js";
|
|
16
|
+
import { readAndValidatePrArtifacts, ensureCommittedPrArtifactsOnBranch } from "../artifacts.js";
|
|
15
17
|
import { computeVerifyState } from "../verify.js";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
+
import { parsePrMetaForwardCompatible } from "../../../shared/pr-meta.js";
|
|
19
|
+
import { assessPrArtifactFreshness } from "../../internal/freshness.js";
|
|
18
20
|
export async function prepareIntegrate(opts) {
|
|
19
21
|
const ctx = opts.ctx ??
|
|
20
22
|
(await loadCommandContext({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null }));
|
|
21
|
-
const { task } = await loadBackendTask({
|
|
22
|
-
ctx,
|
|
23
|
-
cwd: opts.cwd,
|
|
24
|
-
rootOverride: opts.rootOverride,
|
|
25
|
-
taskId: opts.taskId,
|
|
26
|
-
});
|
|
27
23
|
const resolved = ctx.resolvedProject;
|
|
28
24
|
const loadedConfig = ctx.config;
|
|
29
25
|
if (loadedConfig.workflow_mode !== "branch_pr") {
|
|
@@ -33,8 +29,6 @@ export async function prepareIntegrate(opts) {
|
|
|
33
29
|
message: workflowModeMessage(loadedConfig.workflow_mode, "branch_pr"),
|
|
34
30
|
});
|
|
35
31
|
}
|
|
36
|
-
ensurePlanApprovedIfRequired(task, loadedConfig);
|
|
37
|
-
ensureVerificationSatisfiedIfRequired(task, loadedConfig);
|
|
38
32
|
await ensureGitClean({ cwd: opts.cwd, rootOverride: opts.rootOverride });
|
|
39
33
|
if (opts.base?.trim().length === 0) {
|
|
40
34
|
throw new CliError({
|
|
@@ -73,10 +67,16 @@ export async function prepareIntegrate(opts) {
|
|
|
73
67
|
let meta = null;
|
|
74
68
|
let branch = (opts.branch ?? "").trim();
|
|
75
69
|
if (await fileExists(metaPath)) {
|
|
76
|
-
meta =
|
|
70
|
+
meta = parsePrMetaForwardCompatible(await readFile(metaPath, "utf8"), opts.taskId);
|
|
77
71
|
if (!branch)
|
|
78
72
|
branch = (meta.branch ?? "").trim();
|
|
79
73
|
}
|
|
74
|
+
if (!branch) {
|
|
75
|
+
const inferredBranch = await resolveTaskBranchFromContext({ ctx, taskId: opts.taskId });
|
|
76
|
+
if (inferredBranch) {
|
|
77
|
+
branch = inferredBranch;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
80
|
if (!branch) {
|
|
81
81
|
throw new CliError({
|
|
82
82
|
exitCode: 2,
|
|
@@ -91,8 +91,27 @@ export async function prepareIntegrate(opts) {
|
|
|
91
91
|
message: unknownEntityMessage("branch", branch),
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
await ensureCommittedPrArtifactsOnBranch({
|
|
95
|
+
resolved,
|
|
96
|
+
prDir,
|
|
97
|
+
branch,
|
|
98
|
+
});
|
|
99
|
+
const worktreePath = await findWorktreeForBranch(resolved.gitRoot, branch);
|
|
100
|
+
const metaText = await readPrArtifact({
|
|
101
|
+
resolved,
|
|
102
|
+
prDir,
|
|
103
|
+
fileName: "meta.json",
|
|
104
|
+
branch,
|
|
105
|
+
worktreePath,
|
|
106
|
+
});
|
|
107
|
+
if (!metaText) {
|
|
108
|
+
throw new CliError({
|
|
109
|
+
exitCode: 4,
|
|
110
|
+
code: "E_IO",
|
|
111
|
+
message: `PR artifacts missing: ${path.relative(resolved.gitRoot, metaPath)} (run \`agentplane pr open\`)`,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
let metaSource = parsePrMetaForwardCompatible(metaText, opts.taskId);
|
|
96
115
|
const baseCandidate = opts.base ?? metaSource.base ?? baseBranch;
|
|
97
116
|
const base = typeof baseCandidate === "string" && baseCandidate.trim().length > 0
|
|
98
117
|
? baseCandidate.trim()
|
|
@@ -103,10 +122,16 @@ export async function prepareIntegrate(opts) {
|
|
|
103
122
|
prDir,
|
|
104
123
|
metaPath,
|
|
105
124
|
branch,
|
|
106
|
-
taskId:
|
|
125
|
+
taskId: opts.taskId,
|
|
107
126
|
});
|
|
108
127
|
// readAndValidatePrArtifacts() throws if verify.log is missing; keep this non-null downstream.
|
|
109
|
-
|
|
128
|
+
let verifyLogText = verifyLogTextMaybe;
|
|
129
|
+
const task = await loadTaskFromContext({
|
|
130
|
+
ctx,
|
|
131
|
+
taskId: opts.taskId,
|
|
132
|
+
preferBranchSnapshot: true,
|
|
133
|
+
branchSnapshotBranch: branch,
|
|
134
|
+
});
|
|
110
135
|
const changedPaths = await gitDiffNames(resolved.gitRoot, base, branch);
|
|
111
136
|
const tasksPath = loadedConfig.paths.tasks_path;
|
|
112
137
|
if (changedPaths.includes(tasksPath)) {
|
|
@@ -117,33 +142,71 @@ export async function prepareIntegrate(opts) {
|
|
|
117
142
|
});
|
|
118
143
|
}
|
|
119
144
|
const branchHeadSha = await gitRevParse(resolved.gitRoot, [branch]);
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
145
|
+
let freshness = await assessPrArtifactFreshness({
|
|
146
|
+
gitRoot: resolved.gitRoot,
|
|
147
|
+
workflowDir: loadedConfig.paths.workflow_dir,
|
|
148
|
+
taskId: opts.taskId,
|
|
149
|
+
branchHeadSha,
|
|
150
|
+
metaHeadSha: metaSource.head_sha ?? null,
|
|
151
|
+
metaLastVerifiedSha: metaSource.last_verified_sha ?? null,
|
|
152
|
+
metaVerifyStatus: metaSource.verify?.status ?? null,
|
|
153
|
+
taskVerificationState: task.verification?.state ?? null,
|
|
154
|
+
verifyLogText,
|
|
155
|
+
requiresVerify: Boolean(task.verify && task.verify.length > 0),
|
|
156
|
+
});
|
|
157
|
+
if (!freshness.reviewFresh && worktreePath) {
|
|
158
|
+
await ensurePrArtifactsSynced({
|
|
159
|
+
cwd: worktreePath,
|
|
160
|
+
taskId: opts.taskId,
|
|
161
|
+
branch,
|
|
162
|
+
});
|
|
163
|
+
const repairedMetaText = await readPrArtifact({
|
|
164
|
+
resolved,
|
|
165
|
+
prDir,
|
|
166
|
+
fileName: "meta.json",
|
|
167
|
+
branch,
|
|
168
|
+
worktreePath,
|
|
169
|
+
});
|
|
170
|
+
if (repairedMetaText) {
|
|
171
|
+
const repairedMetaSource = parsePrMetaForwardCompatible(repairedMetaText, opts.taskId);
|
|
172
|
+
const repairedArtifacts = await readAndValidatePrArtifacts({
|
|
173
|
+
ctx,
|
|
174
|
+
resolved,
|
|
175
|
+
prDir,
|
|
176
|
+
metaPath,
|
|
177
|
+
branch,
|
|
178
|
+
taskId: opts.taskId,
|
|
179
|
+
});
|
|
180
|
+
verifyLogText = repairedArtifacts.verifyLogText ?? verifyLogText;
|
|
181
|
+
freshness = await assessPrArtifactFreshness({
|
|
182
|
+
gitRoot: resolved.gitRoot,
|
|
183
|
+
workflowDir: loadedConfig.paths.workflow_dir,
|
|
184
|
+
taskId: opts.taskId,
|
|
185
|
+
branchHeadSha,
|
|
186
|
+
metaHeadSha: repairedMetaSource.head_sha ?? null,
|
|
187
|
+
metaLastVerifiedSha: repairedMetaSource.last_verified_sha ?? null,
|
|
188
|
+
metaVerifyStatus: repairedMetaSource.verify?.status ?? null,
|
|
189
|
+
taskVerificationState: task.verification?.state ?? null,
|
|
190
|
+
verifyLogText,
|
|
191
|
+
requiresVerify: Boolean(task.verify && task.verify.length > 0),
|
|
192
|
+
});
|
|
193
|
+
meta = repairedMetaSource;
|
|
194
|
+
metaSource = repairedMetaSource;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
if (!freshness.reviewFresh) {
|
|
129
198
|
throw new CliError({
|
|
130
199
|
exitCode: exitCodeForError("E_VALIDATION"),
|
|
131
200
|
code: "E_VALIDATION",
|
|
132
|
-
message: `PR artifacts stale for ${
|
|
201
|
+
message: `PR artifacts stale for ${opts.taskId}: meta.head_sha=${metaSource.head_sha ?? "<missing>"} ` +
|
|
133
202
|
`current_head=${branchHeadSha} (refresh the task branch artifacts before integrate)`,
|
|
134
203
|
});
|
|
135
204
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
gitRoot: resolved.gitRoot,
|
|
139
|
-
workflowDir: loadedConfig.paths.workflow_dir,
|
|
140
|
-
taskId: task.id,
|
|
141
|
-
fromRef: metaSource.last_verified_sha ?? null,
|
|
142
|
-
toRef: branchHeadSha,
|
|
143
|
-
}));
|
|
205
|
+
ensurePlanApprovedIfRequired(task, loadedConfig);
|
|
206
|
+
ensureVerificationSatisfiedIfRequired(task, loadedConfig);
|
|
144
207
|
const initialVerifyState = computeVerifyState({
|
|
145
208
|
rawVerify: task.verify,
|
|
146
|
-
metaLastVerifiedSha:
|
|
209
|
+
metaLastVerifiedSha: freshness.effectiveVerifiedSha,
|
|
147
210
|
verifyLogText,
|
|
148
211
|
branchHeadSha,
|
|
149
212
|
runVerify: opts.runVerify,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type PrArtifactFreshness = {
|
|
2
|
+
reviewFresh: boolean;
|
|
3
|
+
verifyFresh: boolean;
|
|
4
|
+
verifySatisfied: boolean;
|
|
5
|
+
verifyLogSha: string | null;
|
|
6
|
+
effectiveVerifiedSha: string | null;
|
|
7
|
+
};
|
|
8
|
+
export declare function assessPrArtifactFreshness(opts: {
|
|
9
|
+
gitRoot: string;
|
|
10
|
+
workflowDir: string;
|
|
11
|
+
taskId: string;
|
|
12
|
+
branchHeadSha: string;
|
|
13
|
+
metaHeadSha: unknown;
|
|
14
|
+
metaLastVerifiedSha: unknown;
|
|
15
|
+
metaVerifyStatus: unknown;
|
|
16
|
+
taskVerificationState: unknown;
|
|
17
|
+
verifyLogText: string | null;
|
|
18
|
+
requiresVerify: boolean;
|
|
19
|
+
}): Promise<PrArtifactFreshness>;
|
|
20
|
+
//# sourceMappingURL=freshness.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"freshness.d.ts","sourceRoot":"","sources":["../../../../src/commands/pr/internal/freshness.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,mBAAmB,GAAG;IAChC,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,eAAe,EAAE,OAAO,CAAC;IACzB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC,CAAC;AAEF,wBAAsB,yBAAyB,CAAC,IAAI,EAAE;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,cAAc,EAAE,OAAO,CAAC;CACzB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAgD/B"}
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
taskId: opts.taskId,
|
|
19
|
+
fromRef: metaHeadSha,
|
|
20
|
+
toRef: opts.branchHeadSha,
|
|
21
|
+
}));
|
|
22
|
+
if (!opts.requiresVerify) {
|
|
23
|
+
return {
|
|
24
|
+
reviewFresh,
|
|
25
|
+
verifyFresh: true,
|
|
26
|
+
verifySatisfied: true,
|
|
27
|
+
verifyLogSha,
|
|
28
|
+
effectiveVerifiedSha: null,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const verifiedFromMeta = metaVerifyPassed &&
|
|
32
|
+
(metaLastVerifiedSha === opts.branchHeadSha ||
|
|
33
|
+
(await isTaskLocalOnlyAdvance({
|
|
34
|
+
gitRoot: opts.gitRoot,
|
|
35
|
+
workflowDir: opts.workflowDir,
|
|
36
|
+
taskId: opts.taskId,
|
|
37
|
+
fromRef: metaLastVerifiedSha,
|
|
38
|
+
toRef: opts.branchHeadSha,
|
|
39
|
+
})));
|
|
40
|
+
const verifiedFromLog = verifyLogSha === opts.branchHeadSha;
|
|
41
|
+
const verifiedFromTaskState = opts.taskVerificationState === "ok" && reviewFresh && metaLastVerifiedSha === null;
|
|
42
|
+
const verifySatisfied = verifiedFromMeta || verifiedFromLog || verifiedFromTaskState;
|
|
43
|
+
return {
|
|
44
|
+
reviewFresh,
|
|
45
|
+
verifyFresh: verifySatisfied,
|
|
46
|
+
verifySatisfied,
|
|
47
|
+
verifyLogSha,
|
|
48
|
+
effectiveVerifiedSha: verifySatisfied ? opts.branchHeadSha : metaLastVerifiedSha,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
@@ -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;AACjC,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,8BAA8B,CAAC;AAsFtC,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;AAyOF,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,CA6SD"}
|