@on-par/factory-core 0.9.28-next.8 → 0.9.28
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/dist/blockers/declared-prerequisites.d.ts +4 -1
- package/dist/blockers/declared-prerequisites.d.ts.map +1 -1
- package/dist/blockers/declared-prerequisites.js +10 -5
- package/dist/blockers/declared-prerequisites.js.map +1 -1
- package/dist/checkers/app-smoke.d.ts.map +1 -1
- package/dist/checkers/app-smoke.js +4 -1
- package/dist/checkers/app-smoke.js.map +1 -1
- package/dist/checkers/evidence-plan.d.ts +2 -0
- package/dist/checkers/evidence-plan.d.ts.map +1 -1
- package/dist/checkers/evidence-plan.js +13 -6
- package/dist/checkers/evidence-plan.js.map +1 -1
- package/dist/checkers/evidence-selector.d.ts +2 -0
- package/dist/checkers/evidence-selector.d.ts.map +1 -1
- package/dist/checkers/evidence-selector.js +13 -10
- package/dist/checkers/evidence-selector.js.map +1 -1
- package/dist/checkers/evidence-workspace.d.ts +21 -0
- package/dist/checkers/evidence-workspace.d.ts.map +1 -0
- package/dist/checkers/evidence-workspace.js +118 -0
- package/dist/checkers/evidence-workspace.js.map +1 -0
- package/dist/checkers/index.js +1 -1
- package/dist/checkers/index.js.map +1 -1
- package/dist/checkers/internal-exports.d.ts +3 -1
- package/dist/checkers/internal-exports.d.ts.map +1 -1
- package/dist/checkers/internal-exports.js +3 -1
- package/dist/checkers/internal-exports.js.map +1 -1
- package/dist/checkers/resolve-commands.d.ts.map +1 -1
- package/dist/checkers/resolve-commands.js +5 -1
- package/dist/checkers/resolve-commands.js.map +1 -1
- package/dist/config/example.d.ts.map +1 -1
- package/dist/config/example.js +5 -2
- package/dist/config/example.js.map +1 -1
- package/dist/config/index.d.ts +6 -32
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +17 -32
- package/dist/config/index.js.map +1 -1
- package/dist/config/merge-policy.d.ts +36 -0
- package/dist/config/merge-policy.d.ts.map +1 -0
- package/dist/config/merge-policy.js +31 -0
- package/dist/config/merge-policy.js.map +1 -0
- package/dist/config/repo.js +1 -1
- package/dist/config/repo.js.map +1 -1
- package/dist/config/run-config-env.d.ts +5 -0
- package/dist/config/run-config-env.d.ts.map +1 -0
- package/dist/config/run-config-env.js +11 -0
- package/dist/config/run-config-env.js.map +1 -0
- package/dist/config/run-config-ladder.d.ts +18 -0
- package/dist/config/run-config-ladder.d.ts.map +1 -0
- package/dist/config/run-config-ladder.js +110 -0
- package/dist/config/run-config-ladder.js.map +1 -0
- package/dist/config/run-config-source.d.ts +6 -6
- package/dist/config/run-config-source.d.ts.map +1 -1
- package/dist/config/run-config-source.js +16 -15
- package/dist/config/run-config-source.js.map +1 -1
- package/dist/constitutions/index.d.ts.map +1 -1
- package/dist/constitutions/index.js +8 -0
- package/dist/constitutions/index.js.map +1 -1
- package/dist/environment/process-groups.d.ts +5 -0
- package/dist/environment/process-groups.d.ts.map +1 -1
- package/dist/environment/process-groups.js +19 -0
- package/dist/environment/process-groups.js.map +1 -1
- package/dist/events/config-traits.d.ts +1 -1
- package/dist/events/config-traits.d.ts.map +1 -1
- package/dist/events/config-traits.js +2 -0
- package/dist/events/config-traits.js.map +1 -1
- package/dist/events/queue-traits.d.ts +1 -1
- package/dist/events/queue-traits.d.ts.map +1 -1
- package/dist/events/queue-traits.js +8 -1
- package/dist/events/queue-traits.js.map +1 -1
- package/dist/events/rotation.js +1 -1
- package/dist/events/rotation.js.map +1 -1
- package/dist/fakes/octokit.d.ts +13 -1
- package/dist/fakes/octokit.d.ts.map +1 -1
- package/dist/fakes/octokit.js +13 -0
- package/dist/fakes/octokit.js.map +1 -1
- package/dist/filing/redact.d.ts +1 -0
- package/dist/filing/redact.d.ts.map +1 -1
- package/dist/filing/redact.js +1 -1
- package/dist/filing/redact.js.map +1 -1
- package/dist/harness/opencode-version.d.ts +2 -2
- package/dist/harness/opencode-version.d.ts.map +1 -1
- package/dist/harness/opencode-version.js +3 -3
- package/dist/harness/opencode-version.js.map +1 -1
- package/dist/internal.d.ts +13 -1
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +14 -0
- package/dist/internal.js.map +1 -1
- package/dist/kpis/index.d.ts.map +1 -1
- package/dist/kpis/index.js +2 -1
- package/dist/kpis/index.js.map +1 -1
- package/dist/kpis/park.d.ts.map +1 -1
- package/dist/kpis/park.js +2 -1
- package/dist/kpis/park.js.map +1 -1
- package/dist/kpis/phase.d.ts.map +1 -1
- package/dist/kpis/phase.js +1 -0
- package/dist/kpis/phase.js.map +1 -1
- package/dist/land/changelog.d.ts +8 -0
- package/dist/land/changelog.d.ts.map +1 -0
- package/dist/land/changelog.js +90 -0
- package/dist/land/changelog.js.map +1 -0
- package/dist/land/sync.d.ts.map +1 -1
- package/dist/land/sync.js +93 -32
- package/dist/land/sync.js.map +1 -1
- package/dist/phases/check-evidence.d.ts.map +1 -1
- package/dist/phases/check-evidence.js +5 -1
- package/dist/phases/check-evidence.js.map +1 -1
- package/dist/phases/ship-approval.d.ts +17 -0
- package/dist/phases/ship-approval.d.ts.map +1 -0
- package/dist/phases/ship-approval.js +21 -0
- package/dist/phases/ship-approval.js.map +1 -0
- package/dist/phases/ship-branch-push.d.ts +17 -0
- package/dist/phases/ship-branch-push.d.ts.map +1 -0
- package/dist/phases/ship-branch-push.js +77 -0
- package/dist/phases/ship-branch-push.js.map +1 -0
- package/dist/phases/ship-ci-watch.d.ts +25 -0
- package/dist/phases/ship-ci-watch.d.ts.map +1 -0
- package/dist/phases/ship-ci-watch.js +53 -0
- package/dist/phases/ship-ci-watch.js.map +1 -0
- package/dist/phases/ship-evidence-comment.d.ts +14 -0
- package/dist/phases/ship-evidence-comment.d.ts.map +1 -0
- package/dist/phases/ship-evidence-comment.js +31 -0
- package/dist/phases/ship-evidence-comment.js.map +1 -0
- package/dist/phases/ship-existing-pr.d.ts +11 -0
- package/dist/phases/ship-existing-pr.d.ts.map +1 -0
- package/dist/phases/ship-existing-pr.js +36 -0
- package/dist/phases/ship-existing-pr.js.map +1 -0
- package/dist/phases/ship-finish.d.ts +15 -0
- package/dist/phases/ship-finish.d.ts.map +1 -0
- package/dist/phases/ship-finish.js +69 -0
- package/dist/phases/ship-finish.js.map +1 -0
- package/dist/phases/ship-git-detail.d.ts +31 -0
- package/dist/phases/ship-git-detail.d.ts.map +1 -0
- package/dist/phases/ship-git-detail.js +71 -0
- package/dist/phases/ship-git-detail.js.map +1 -0
- package/dist/phases/ship-git-remote.d.ts +51 -0
- package/dist/phases/ship-git-remote.d.ts.map +1 -0
- package/dist/phases/ship-git-remote.js +70 -0
- package/dist/phases/ship-git-remote.js.map +1 -0
- package/dist/phases/ship-git.d.ts +4 -79
- package/dist/phases/ship-git.d.ts.map +1 -1
- package/dist/phases/ship-git.js +2 -135
- package/dist/phases/ship-git.js.map +1 -1
- package/dist/phases/ship-main-sync.d.ts +18 -0
- package/dist/phases/ship-main-sync.d.ts.map +1 -0
- package/dist/phases/ship-main-sync.js +34 -0
- package/dist/phases/ship-main-sync.js.map +1 -0
- package/dist/phases/ship-open-pr.d.ts +24 -0
- package/dist/phases/ship-open-pr.d.ts.map +1 -0
- package/dist/phases/ship-open-pr.js +75 -0
- package/dist/phases/ship-open-pr.js.map +1 -0
- package/dist/phases/ship-options.d.ts +81 -0
- package/dist/phases/ship-options.d.ts.map +1 -0
- package/dist/phases/ship-options.js +4 -0
- package/dist/phases/ship-options.js.map +1 -0
- package/dist/phases/ship-recovery.d.ts +16 -0
- package/dist/phases/ship-recovery.d.ts.map +1 -0
- package/dist/phases/ship-recovery.js +81 -0
- package/dist/phases/ship-recovery.js.map +1 -0
- package/dist/phases/ship-reentry.d.ts +20 -0
- package/dist/phases/ship-reentry.d.ts.map +1 -0
- package/dist/phases/ship-reentry.js +47 -0
- package/dist/phases/ship-reentry.js.map +1 -0
- package/dist/phases/ship.d.ts +4 -76
- package/dist/phases/ship.d.ts.map +1 -1
- package/dist/phases/ship.js +67 -425
- package/dist/phases/ship.js.map +1 -1
- package/dist/phases/stack-order.d.ts +9 -0
- package/dist/phases/stack-order.d.ts.map +1 -1
- package/dist/phases/stack-order.js +13 -0
- package/dist/phases/stack-order.js.map +1 -1
- package/dist/queue/comment-rework-trigger.d.ts +24 -0
- package/dist/queue/comment-rework-trigger.d.ts.map +1 -0
- package/dist/queue/comment-rework-trigger.js +128 -0
- package/dist/queue/comment-rework-trigger.js.map +1 -0
- package/dist/queue/github-queue.d.ts +4 -2
- package/dist/queue/github-queue.d.ts.map +1 -1
- package/dist/queue/github-queue.js.map +1 -1
- package/dist/queue/internal-exports.d.ts +3 -0
- package/dist/queue/internal-exports.d.ts.map +1 -1
- package/dist/queue/internal-exports.js +2 -0
- package/dist/queue/internal-exports.js.map +1 -1
- package/dist/queue/lane-discovery-interval.d.ts +6 -0
- package/dist/queue/lane-discovery-interval.d.ts.map +1 -0
- package/dist/queue/lane-discovery-interval.js +9 -0
- package/dist/queue/lane-discovery-interval.js.map +1 -0
- package/dist/queue/linear-queue-backend.d.ts +17 -0
- package/dist/queue/linear-queue-backend.d.ts.map +1 -0
- package/dist/queue/linear-queue-backend.js +42 -0
- package/dist/queue/linear-queue-backend.js.map +1 -0
- package/dist/queue/linear-queue.d.ts +4 -2
- package/dist/queue/linear-queue.d.ts.map +1 -1
- package/dist/queue/linear-queue.js +79 -2
- package/dist/queue/linear-queue.js.map +1 -1
- package/dist/queue/prerequisite-stack.d.ts +47 -0
- package/dist/queue/prerequisite-stack.d.ts.map +1 -0
- package/dist/queue/prerequisite-stack.js +41 -0
- package/dist/queue/prerequisite-stack.js.map +1 -0
- package/dist/queue/queue-backend.d.ts +11 -5
- package/dist/queue/queue-backend.d.ts.map +1 -1
- package/dist/queue/queue-backend.js +8 -3
- package/dist/queue/queue-backend.js.map +1 -1
- package/dist/queue/review-rework-trigger.d.ts +7 -2
- package/dist/queue/review-rework-trigger.d.ts.map +1 -1
- package/dist/queue/review-rework-trigger.js +16 -8
- package/dist/queue/review-rework-trigger.js.map +1 -1
- package/dist/reports/pr-body.d.ts +5 -2
- package/dist/reports/pr-body.d.ts.map +1 -1
- package/dist/reports/pr-body.js +21 -10
- package/dist/reports/pr-body.js.map +1 -1
- package/dist/run/ci-rework-loop.d.ts.map +1 -1
- package/dist/run/ci-rework-loop.js +5 -1
- package/dist/run/ci-rework-loop.js.map +1 -1
- package/dist/run/feedback-github.d.ts +50 -0
- package/dist/run/feedback-github.d.ts.map +1 -0
- package/dist/run/feedback-github.js +87 -0
- package/dist/run/feedback-github.js.map +1 -0
- package/dist/run/feedback-round-hooks.d.ts +19 -0
- package/dist/run/feedback-round-hooks.d.ts.map +1 -0
- package/dist/run/feedback-round-hooks.js +106 -0
- package/dist/run/feedback-round-hooks.js.map +1 -0
- package/dist/run/feedback-round.d.ts +97 -0
- package/dist/run/feedback-round.d.ts.map +1 -0
- package/dist/run/feedback-round.js +275 -0
- package/dist/run/feedback-round.js.map +1 -0
- package/dist/run/linear-run.d.ts +23 -0
- package/dist/run/linear-run.d.ts.map +1 -0
- package/dist/run/linear-run.js +18 -0
- package/dist/run/linear-run.js.map +1 -0
- package/dist/run/park-comment.d.ts +9 -0
- package/dist/run/park-comment.d.ts.map +1 -1
- package/dist/run/park-comment.js +12 -0
- package/dist/run/park-comment.js.map +1 -1
- package/dist/run/ports.d.ts +10 -0
- package/dist/run/ports.d.ts.map +1 -1
- package/dist/run/ports.js +12 -0
- package/dist/run/ports.js.map +1 -1
- package/dist/run/pr-run-state.d.ts +99 -0
- package/dist/run/pr-run-state.d.ts.map +1 -0
- package/dist/run/pr-run-state.js +235 -0
- package/dist/run/pr-run-state.js.map +1 -0
- package/dist/run/prerequisite-restack.d.ts +39 -0
- package/dist/run/prerequisite-restack.d.ts.map +1 -0
- package/dist/run/prerequisite-restack.js +79 -0
- package/dist/run/prerequisite-restack.js.map +1 -0
- package/dist/run/review-rework-cap.d.ts +3 -1
- package/dist/run/review-rework-cap.d.ts.map +1 -1
- package/dist/run/review-rework-cap.js +2 -1
- package/dist/run/review-rework-cap.js.map +1 -1
- package/dist/run/review-rework.d.ts +17 -2
- package/dist/run/review-rework.d.ts.map +1 -1
- package/dist/run/review-rework.js +99 -33
- package/dist/run/review-rework.js.map +1 -1
- package/dist/run/run-issue.d.ts +5 -1
- package/dist/run/run-issue.d.ts.map +1 -1
- package/dist/run/run-issue.js +35 -28
- package/dist/run/run-issue.js.map +1 -1
- package/dist/run/stack-rebase.d.ts +28 -0
- package/dist/run/stack-rebase.d.ts.map +1 -0
- package/dist/run/stack-rebase.js +79 -0
- package/dist/run/stack-rebase.js.map +1 -0
- package/dist/run/stack-restack.d.ts.map +1 -1
- package/dist/run/stack-restack.js +21 -49
- package/dist/run/stack-restack.js.map +1 -1
- package/dist/utils/command-runner.d.ts.map +1 -1
- package/dist/utils/command-runner.js +4 -1
- package/dist/utils/command-runner.js.map +1 -1
- package/dist/utils/exec.d.ts.map +1 -1
- package/dist/utils/exec.js +4 -1
- package/dist/utils/exec.js.map +1 -1
- package/dist/utils/in-place.d.ts +24 -0
- package/dist/utils/in-place.d.ts.map +1 -0
- package/dist/utils/in-place.js +105 -0
- package/dist/utils/in-place.js.map +1 -0
- package/dist/work/internal-exports.d.ts +3 -0
- package/dist/work/internal-exports.d.ts.map +1 -0
- package/dist/work/internal-exports.js +4 -0
- package/dist/work/internal-exports.js.map +1 -0
- package/dist/work/ticket-writeback.d.ts +22 -0
- package/dist/work/ticket-writeback.d.ts.map +1 -0
- package/dist/work/ticket-writeback.js +73 -0
- package/dist/work/ticket-writeback.js.map +1 -0
- package/dist/work/work-key.d.ts +2 -0
- package/dist/work/work-key.d.ts.map +1 -1
- package/dist/work/work-key.js +4 -0
- package/dist/work/work-key.js.map +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ship-git.js","sourceRoot":"","sources":["../../src/phases/ship-git.ts"],"names":[],"mappings":"AAAA,uFAAuF;AAEvF,OAAO,EAAE,IAAI,IAAI,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"ship-git.js","sourceRoot":"","sources":["../../src/phases/ship-git.ts"],"names":[],"mappings":"AAAA,uFAAuF;AAEvF,OAAO,EAAE,IAAI,IAAI,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAItC,MAAM,UAAU,GAAkB,SAAS,CAAC,MAAM,CAAC,CAAC;AAEpD,4HAA4H;AAC5H,MAAM,UAAU,kBAAkB,CAAC,MAAmB,EAAE,GAAG,GAAkB,UAAU;IACrF,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE;QAC1B,MAAM,CAAC,cAAc,EAAE,CAAC;QACxB,OAAO,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC/B,CAAC,CAAC;AACJ,CAAC;AAGD,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC/F,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type LandSyncOptions, type LandSyncResult } from '../land/sync.js';
|
|
2
|
+
import type { CommandRunner } from './ship-git.js';
|
|
3
|
+
import type { ShipPhaseOptions } from './ship-options.js';
|
|
4
|
+
/**
|
|
5
|
+
* Merges origin/main into `branch` in `worktree` and returns the SHA CHECK ran on (HEAD before the
|
|
6
|
+
* merge), for the evidence pack. A sync that cannot finish is aborted, logged, and the branch ships
|
|
7
|
+
* unsynced, exactly as it would have without this step.
|
|
8
|
+
*/
|
|
9
|
+
export declare function syncShipBranchWithMain(ctx: {
|
|
10
|
+
run: CommandRunner;
|
|
11
|
+
worktree: string;
|
|
12
|
+
branch: string;
|
|
13
|
+
log: ShipPhaseOptions['log'];
|
|
14
|
+
sync?: (opts: LandSyncOptions) => Promise<LandSyncResult>;
|
|
15
|
+
}): Promise<{
|
|
16
|
+
checkedSha?: string;
|
|
17
|
+
}>;
|
|
18
|
+
//# sourceMappingURL=ship-main-sync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ship-main-sync.d.ts","sourceRoot":"","sources":["../../src/phases/ship-main-sync.ts"],"names":[],"mappings":"AAOA,OAAO,EAAkB,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC5F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D;;;;GAIG;AACH,wBAAsB,sBAAsB,CAAC,GAAG,EAAE;IAChD,GAAG,EAAE,aAAa,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAC7B,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;CAC3D,GAAG,OAAO,CAAC;IAAE,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAmBnC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// packages/core/src/phases/ship-main-sync.ts — merge origin/main into the branch before SHIP pushes it
|
|
2
|
+
//
|
|
3
|
+
// A lane builds from the main it started on; sibling PRs that merge meanwhile (each adding a
|
|
4
|
+
// CHANGELOG bullet) leave the new PR conflicting. GitHub runs no pull_request CI on a conflicting PR,
|
|
5
|
+
// so SHIP's CI watch timed out and stranded a draft. Syncing first, with land's CHANGELOG and ADR
|
|
6
|
+
// index auto-resolution, opens the PR mergeable so CI runs.
|
|
7
|
+
import { syncLandBranch } from '../land/sync.js';
|
|
8
|
+
/**
|
|
9
|
+
* Merges origin/main into `branch` in `worktree` and returns the SHA CHECK ran on (HEAD before the
|
|
10
|
+
* merge), for the evidence pack. A sync that cannot finish is aborted, logged, and the branch ships
|
|
11
|
+
* unsynced, exactly as it would have without this step.
|
|
12
|
+
*/
|
|
13
|
+
export async function syncShipBranchWithMain(ctx) {
|
|
14
|
+
const { run, worktree, branch, log } = ctx;
|
|
15
|
+
const head = async () => (await run('git rev-parse HEAD', { cwd: worktree })).stdout.trim() || undefined;
|
|
16
|
+
let checkedSha;
|
|
17
|
+
try {
|
|
18
|
+
checkedSha = await head();
|
|
19
|
+
const result = await (ctx.sync ?? syncLandBranch)({ worktree, branch, run, log });
|
|
20
|
+
if (!result.ok) {
|
|
21
|
+
log('ship', `could not sync ${branch} with origin/main before push (${result.message}); pushing it unsynced`);
|
|
22
|
+
return { checkedSha };
|
|
23
|
+
}
|
|
24
|
+
const synced = await head();
|
|
25
|
+
if (synced !== checkedSha)
|
|
26
|
+
log('ship', `merged origin/main into ${branch} before push (now ${synced?.slice(0, 12)})`);
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
const detail = err instanceof Error ? err.message : String(err);
|
|
30
|
+
log('ship', `could not sync ${branch} with origin/main before push (${detail}); pushing it unsynced`);
|
|
31
|
+
}
|
|
32
|
+
return { checkedSha };
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=ship-main-sync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ship-main-sync.js","sourceRoot":"","sources":["../../src/phases/ship-main-sync.ts"],"names":[],"mappings":"AAAA,uGAAuG;AACvG,EAAE;AACF,6FAA6F;AAC7F,sGAAsG;AACtG,kGAAkG;AAClG,4DAA4D;AAE5D,OAAO,EAAE,cAAc,EAA6C,MAAM,iBAAiB,CAAC;AAI5F;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,GAM5C;IACC,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC;IAC3C,MAAM,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,oBAAoB,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,SAAS,CAAC;IACzG,IAAI,UAA8B,CAAC;IACnC,IAAI,CAAC;QACH,UAAU,GAAG,MAAM,IAAI,EAAE,CAAC;QAC1B,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,IAAI,cAAc,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;QAClF,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;YACf,GAAG,CAAC,MAAM,EAAE,kBAAkB,MAAM,kCAAkC,MAAM,CAAC,OAAO,wBAAwB,CAAC,CAAC;YAC9G,OAAO,EAAE,UAAU,EAAE,CAAC;QACxB,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,IAAI,EAAE,CAAC;QAC5B,IAAI,MAAM,KAAK,UAAU;YACvB,GAAG,CAAC,MAAM,EAAE,2BAA2B,MAAM,qBAAqB,MAAM,EAAE,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC;IAC/F,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,MAAM,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAChE,GAAG,CAAC,MAAM,EAAE,kBAAkB,MAAM,kCAAkC,MAAM,wBAAwB,CAAC,CAAC;IACxG,CAAC;IACD,OAAO,EAAE,UAAU,EAAE,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { WorkRequest } from '../work/index.js';
|
|
2
|
+
import { type WorkKey } from '../work/work-key.js';
|
|
3
|
+
import { type ShipPhaseOptions } from './ship-options.js';
|
|
4
|
+
import type { ShipResult } from './ship-types.js';
|
|
5
|
+
import type { lazyWalkthrough } from './ship-walkthrough.js';
|
|
6
|
+
import { type StackPosition } from './stack-order.js';
|
|
7
|
+
export declare function openOrFindPr(ctx: {
|
|
8
|
+
opts: ShipPhaseOptions;
|
|
9
|
+
inlineWork: Pick<WorkRequest, 'id' | 'kind' | 'title' | 'reference'> | undefined;
|
|
10
|
+
ticket: {
|
|
11
|
+
key: WorkKey;
|
|
12
|
+
title: string;
|
|
13
|
+
} | undefined;
|
|
14
|
+
stack: StackPosition | undefined;
|
|
15
|
+
base: string;
|
|
16
|
+
owner: string;
|
|
17
|
+
repoName: string;
|
|
18
|
+
walkthrough: ReturnType<typeof lazyWalkthrough>;
|
|
19
|
+
}): Promise<{
|
|
20
|
+
stop: ShipResult;
|
|
21
|
+
} | {
|
|
22
|
+
prNumber: number;
|
|
23
|
+
}>;
|
|
24
|
+
//# sourceMappingURL=ship-open-pr.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ship-open-pr.d.ts","sourceRoot":"","sources":["../../src/phases/ship-open-pr.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAiB,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAoB,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAG5E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAgD,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEpG,wBAAsB,YAAY,CAAC,GAAG,EAAE;IACtC,IAAI,EAAE,gBAAgB,CAAC;IACvB,UAAU,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,GAAG,MAAM,GAAG,OAAO,GAAG,WAAW,CAAC,GAAG,SAAS,CAAC;IACjF,MAAM,EAAE;QAAE,GAAG,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;IACpD,KAAK,EAAE,aAAa,GAAG,SAAS,CAAC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;CACjD,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAmEvD"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// packages/core/src/phases/ship-open-pr.ts — SHIP draft PR creation and already-exists recovery
|
|
2
|
+
import { briefSummaryLine, renderPrBody, stripBriefIds } from '../reports/pr-body.js';
|
|
3
|
+
import { issueNumberOf } from '../work/work-key.js';
|
|
4
|
+
import { SHIP_BASE_BRANCH } from './ship-options.js';
|
|
5
|
+
import { findOpenPR, isPullAlreadyExistsError } from './ship-pr-lookup.js';
|
|
6
|
+
import { readRisk, readSpecBody } from './ship-spec.js';
|
|
7
|
+
import { prerequisiteStackOrder, renderStackOrderLine } from './stack-order.js';
|
|
8
|
+
export async function openOrFindPr(ctx) {
|
|
9
|
+
const { opts, inlineWork, ticket, stack, base, owner, repoName, walkthrough } = ctx;
|
|
10
|
+
const { octokit, issue, branch, checkSummary, log } = opts;
|
|
11
|
+
let prNumber;
|
|
12
|
+
// Get title from issue (skipped for a non-github work source — no such issue exists)
|
|
13
|
+
const title = inlineWork
|
|
14
|
+
? inlineWork.title
|
|
15
|
+
: ticket
|
|
16
|
+
? ticket.title
|
|
17
|
+
: (await octokit.rest.issues.get({ owner, repo: repoName, issue_number: issueNumberOf(issue) })).data.title;
|
|
18
|
+
const slice = inlineWork ? undefined : opts.slice;
|
|
19
|
+
const ref = ticket ? ticket.key : `#${issue}`;
|
|
20
|
+
const finalSlice = !slice || slice.index >= slice.count;
|
|
21
|
+
// A brief is a local file reviewers cannot open, so the body describes it by its title and links the
|
|
22
|
+
// open PR it builds on (a --stack or --base-branch base), never its id, digest or path.
|
|
23
|
+
const basePr = inlineWork && base !== SHIP_BASE_BRANCH ? await findOpenPR(octokit, owner, repoName, base) : undefined;
|
|
24
|
+
const summaryLine = inlineWork
|
|
25
|
+
? briefSummaryLine(title, basePr?.status === 'found' ? basePr.prNumber : undefined)
|
|
26
|
+
: slice
|
|
27
|
+
? `Implements slice ${slice.index}/${slice.count} of ${ref}.`
|
|
28
|
+
: `Implements ${ref}.`;
|
|
29
|
+
const prTitle = inlineWork
|
|
30
|
+
? stripBriefIds(title)
|
|
31
|
+
: slice
|
|
32
|
+
? `${title} — slice ${slice.index}/${slice.count} (${ref})`
|
|
33
|
+
: `${title} (${ref})`;
|
|
34
|
+
// Create PR
|
|
35
|
+
try {
|
|
36
|
+
const { data: pr } = await octokit.rest.pulls.create({
|
|
37
|
+
owner,
|
|
38
|
+
repo: repoName,
|
|
39
|
+
head: branch,
|
|
40
|
+
base,
|
|
41
|
+
title: prTitle,
|
|
42
|
+
draft: true,
|
|
43
|
+
body: renderPrBody({
|
|
44
|
+
summaryLine,
|
|
45
|
+
footer: opts.footer,
|
|
46
|
+
stackOrder: stack ? renderStackOrderLine(stack) : prerequisiteStackOrder(opts.prerequisiteStack, issue, base),
|
|
47
|
+
specBody: await readSpecBody(opts.specPath),
|
|
48
|
+
checkSummary,
|
|
49
|
+
reworkRounds: opts.reworkRounds,
|
|
50
|
+
risk: await readRisk(opts.specPath),
|
|
51
|
+
walkthrough: await walkthrough.walkthrough(),
|
|
52
|
+
typescriptLines: await walkthrough.counts(),
|
|
53
|
+
closes: inlineWork || !finalSlice ? undefined : (ticket?.key ?? issue),
|
|
54
|
+
partOf: !inlineWork && !finalSlice ? (ticket?.key ?? issue) : undefined,
|
|
55
|
+
tracker: ticket ? 'linear' : undefined,
|
|
56
|
+
}),
|
|
57
|
+
});
|
|
58
|
+
prNumber = pr.number;
|
|
59
|
+
log('pr_opened', `opened PR #${prNumber} for committed work on ${branch} (base ${base})`);
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
if (!isPullAlreadyExistsError(err))
|
|
63
|
+
throw err;
|
|
64
|
+
const existing = await findOpenPR(octokit, owner, repoName, branch);
|
|
65
|
+
if (existing.status !== 'found') {
|
|
66
|
+
const reason = `pulls.create reported an existing PR for ${branch} but re-querying did not find it (${existing.status === 'error' ? existing.detail : 'no open PR listed'})`;
|
|
67
|
+
log('ship', `${reason} — aborting`);
|
|
68
|
+
return { stop: { ok: false, reason } };
|
|
69
|
+
}
|
|
70
|
+
prNumber = existing.prNumber;
|
|
71
|
+
log('recovered', `PR #${prNumber} already existed for ${branch}; reusing it`);
|
|
72
|
+
}
|
|
73
|
+
return { prNumber };
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=ship-open-pr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ship-open-pr.js","sourceRoot":"","sources":["../../src/phases/ship-open-pr.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAEhG,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtF,OAAO,EAAE,aAAa,EAAgB,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAyB,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGxD,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAsB,MAAM,kBAAkB,CAAC;AAEpG,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,GASlC;IACC,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,E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'../approvals/index.js';
|
|
3
|
+
import type { LifecycleBus } from '../bus/index.js';
|
|
4
|
+
import type { EventKind } from '../events/kinds.js';
|
|
5
|
+
import type { ReviewRouting } from '../review/routing.js';
|
|
6
|
+
import type { CheckSummary } from '../types/index.js';
|
|
7
|
+
import type { watchChecksWithInfraRerun } from '../utils/ci-watch.js';
|
|
8
|
+
import type { WorkRequest } from '../work/index.js';
|
|
9
|
+
import type { WorkKey } from '../work/work-key.js';
|
|
10
|
+
import type { CommandRunner } from './ship-git.js';
|
|
11
|
+
import type { PreviewGate } from './ship-preview.js';
|
|
12
|
+
import type { WalkthroughShipOpts } from './ship-walkthrough.js';
|
|
13
|
+
import type { PrerequisiteStackTarget } from '../queue/prerequisite-stack.js';
|
|
14
|
+
import type { StackPosition } from './stack-order.js';
|
|
15
|
+
/** Ship opens PRs against, and watches required checks of, this branch. */
|
|
16
|
+
export declare const SHIP_BASE_BRANCH = "main";
|
|
17
|
+
export interface ShipPhaseOptions {
|
|
18
|
+
issue: WorkKey;
|
|
19
|
+
repo: string;
|
|
20
|
+
worktree: string;
|
|
21
|
+
branch: string;
|
|
22
|
+
octokit: Octokit;
|
|
23
|
+
watchCI?: boolean;
|
|
24
|
+
/** Merge origin/main into the branch before pushing a PR against main (#3945). */
|
|
25
|
+
syncMain?: boolean;
|
|
26
|
+
/** Resolved pr.footer; undefined uses the default, empty string omits it. */
|
|
27
|
+
footer?: string;
|
|
28
|
+
/** Stop at the draft PR: skip mark-ready (#3449). */
|
|
29
|
+
draft?: boolean;
|
|
30
|
+
/** Post the evidence pack as a PR comment (pr.evidenceComment); default off. */
|
|
31
|
+
evidenceComment?: boolean;
|
|
32
|
+
log: (type: EventKind, msg: string) => void;
|
|
33
|
+
run?: CommandRunner;
|
|
34
|
+
/** Runs the gh rerun argv for the CI infra rescue (#2365); default runCommand. */
|
|
35
|
+
rerun?: (argv: readonly string[]) => Promise<{
|
|
36
|
+
ok: boolean;
|
|
37
|
+
}>;
|
|
38
|
+
approvalGate?: ApprovalGate;
|
|
39
|
+
checkSummary?: CheckSummary;
|
|
40
|
+
specPath?: string;
|
|
41
|
+
eventsFile?: string;
|
|
42
|
+
startedAt?: string;
|
|
43
|
+
logsDir?: string;
|
|
44
|
+
reworkRounds?: number;
|
|
45
|
+
/** PR classifier decision (#1724), rendered into the evidence pack. */
|
|
46
|
+
reviewRouting?: ReviewRouting;
|
|
47
|
+
/** Model pins that were not honored (#2511), rendered into the evidence pack. */
|
|
48
|
+
pinNotes?: string[];
|
|
49
|
+
/** The run's resolved work request; when its kind is not 'github-issue', the PR
|
|
50
|
+
* title/body come from it instead of fetching the (nonexistent) issue (#507). */
|
|
51
|
+
work?: Pick<WorkRequest, 'id' | 'kind' | 'title' | 'reference'>;
|
|
52
|
+
/** The ADR-0147 slice this run ships; titles the PR `slice k/n` and only the final slice closes the issue. */
|
|
53
|
+
slice?: {
|
|
54
|
+
index: number;
|
|
55
|
+
count: number;
|
|
56
|
+
};
|
|
57
|
+
/** Stack-mode (ADR-0161) position: the PR opens on `stack.base` and its body names the stack order. Ignored for inline work. */
|
|
58
|
+
stack?: StackPosition;
|
|
59
|
+
/** PR base for a non-stack run started from another branch (#3764); default main. */
|
|
60
|
+
baseBranch?: string;
|
|
61
|
+
/** The open prerequisite PR this issue is stacked on (#3916): the body names the stack order and carries the marker. */
|
|
62
|
+
prerequisiteStack?: PrerequisiteStackTarget;
|
|
63
|
+
/** Lane id stamped onto emitted lifecycle events; defaults to `issue-<issue>` (#591). */
|
|
64
|
+
laneId?: string;
|
|
65
|
+
/** Lifecycle bus to emit onto; defaults to the process-wide `lifecycleBus` (#591). */
|
|
66
|
+
bus?: LifecycleBus;
|
|
67
|
+
/** origin/<branch> SHA recorded at worktree creation (#1868). When set, the new-PR push
|
|
68
|
+
* replaces that stale head under a lease on this SHA, and fails closed if the remote moved (#1869). */
|
|
69
|
+
recordedRemoteSha?: string;
|
|
70
|
+
/** SHIP re-entry after a CI rework round (#2816): same open PR, plain push, watch the pushed SHA. */
|
|
71
|
+
reentry?: {
|
|
72
|
+
prNumber: number;
|
|
73
|
+
previousHeadSha?: string;
|
|
74
|
+
};
|
|
75
|
+
/** CI watch deadline (#3569); default DEFAULT_CI_DEADLINE_MS. */
|
|
76
|
+
ciDeadlineMs?: number;
|
|
77
|
+
walkthrough?: WalkthroughShipOpts['walkthrough'];
|
|
78
|
+
previewGate?: PreviewGate;
|
|
79
|
+
ciWatch?: typeof watchChecksWithInfraRerun;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=ship-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ship-options.d.ts","sourceRoot":"","sources":["../../src/phases/ship-options.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAE,MAA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AC;IAChE,8GAA8G;IAC9G,KAAK,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IACzC,gIAAgI;IAChI,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,qFAAqF;IACrF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wHAAwH;IACxH,iBAAiB,CAAC,EAAE,uBAAuB,CAAC;IAC5C,yFAAyF;IACzF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sFAAsF;IACtF,GAAG,CAAC,EAAE,YAAY,CAAC;IACnB;4GACwG;IACxG,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,qGAAqG;IACrG,OAAO,CAAC,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,eAAe,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACzD,iEAAiE;IACjE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,mBAAmB,CAAC,aAAa,CAAC,CAAC;IACjD,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,OAAO,CAAC,EAAE,OAAO,yBAAyB,CAAC;CAC5C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ship-options.js","sourceRoot":"","sources":["../../src/phases/ship-options.ts"],"names":[],"mappings":"AAAA,qGAAqG;AAkBrG,2EAA2E;AAC3E,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Octokit } from '@octokit/rest';
|
|
2
|
+
import type { EventKind } from '../events/kinds.js';
|
|
3
|
+
import type { WorkKey } from '../work/work-key.js';
|
|
4
|
+
import type { CommandRunner } from './ship-git.js';
|
|
5
|
+
import type { ShipResult } from './ship-types.js';
|
|
6
|
+
export declare function recoverOrStop(ctx: {
|
|
7
|
+
run: CommandRunner;
|
|
8
|
+
worktree: string;
|
|
9
|
+
branch: string;
|
|
10
|
+
issue: WorkKey | undefined;
|
|
11
|
+
octokit: Octokit;
|
|
12
|
+
owner: string;
|
|
13
|
+
repoName: string;
|
|
14
|
+
log: (type: EventKind, msg: string) => void;
|
|
15
|
+
}): Promise<ShipResult | undefined>;
|
|
16
|
+
//# sourceMappingURL=ship-recovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ship-recovery.d.ts","sourceRoot":"","sources":["../../src/phases/ship-recovery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAGnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,wBAAsB,aAAa,CAAC,GAAG,EAAE;IACvC,GAAG,EAAE,aAAa,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,GAAG,SAAS,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7C,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAyDlC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { commitLeftoverBuildOutput } from './ship-leftover.js';
|
|
2
|
+
import { findMergedPR } from './ship-pr-lookup.js';
|
|
3
|
+
export async function recoverOrStop(ctx) {
|
|
4
|
+
const { run, worktree, branch, octokit, owner, repoName, log } = ctx;
|
|
5
|
+
try {
|
|
6
|
+
await run('git fetch origin main', { cwd: worktree });
|
|
7
|
+
}
|
|
8
|
+
catch {
|
|
9
|
+
log('ship', 'git fetch origin main failed — recovery may compare against a stale origin/main');
|
|
10
|
+
}
|
|
11
|
+
let recoveryState = await inspectRecoveryState(worktree, run);
|
|
12
|
+
if (!recoveryState.clean) {
|
|
13
|
+
const conflicts = conflictedPaths(recoveryState.statusLines);
|
|
14
|
+
if (conflicts.length > 0) {
|
|
15
|
+
const listed = conflicts.slice(0, 5).join(', ') + (conflicts.length > 5 ? ` (+${conflicts.length - 5} more)` : '');
|
|
16
|
+
const reason = `worktree has merge conflicts in ${listed}`;
|
|
17
|
+
log('ship', `not recovering ${branch}: ${reason} — worktree preserved`);
|
|
18
|
+
return { ok: false, reason };
|
|
19
|
+
}
|
|
20
|
+
const committed = await commitLeftoverBuildOutput({
|
|
21
|
+
run,
|
|
22
|
+
worktree,
|
|
23
|
+
branch,
|
|
24
|
+
issue: ctx.issue,
|
|
25
|
+
statusLines: recoveryState.statusLines,
|
|
26
|
+
log,
|
|
27
|
+
});
|
|
28
|
+
if (!committed.ok) {
|
|
29
|
+
log('ship', `not recovering ${branch}: ${committed.reason} — worktree preserved`);
|
|
30
|
+
return { ok: false, reason: committed.reason };
|
|
31
|
+
}
|
|
32
|
+
recoveryState = await inspectRecoveryState(worktree, run);
|
|
33
|
+
if (!recoveryState.clean) {
|
|
34
|
+
const reason = 'worktree still dirty after committing leftover build output';
|
|
35
|
+
log('ship', `not recovering ${branch}: ${reason} — worktree preserved`);
|
|
36
|
+
return { ok: false, reason };
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (recoveryState.landed || !recoveryState.ahead) {
|
|
40
|
+
const mergedLookup = await findMergedPR(octokit, owner, repoName, branch);
|
|
41
|
+
if (mergedLookup.status === 'error' && !recoveryState.landed) {
|
|
42
|
+
const reason = `could not determine whether ${branch} was already merged (${mergedLookup.detail})`;
|
|
43
|
+
log('ship', `not recovering ${branch}: ${reason}`);
|
|
44
|
+
return { ok: false, reason };
|
|
45
|
+
}
|
|
46
|
+
const mergedPr = mergedLookup.status === 'found' ? mergedLookup.prNumber : undefined;
|
|
47
|
+
if (mergedPr !== undefined || recoveryState.landed) {
|
|
48
|
+
log('ship', `not recovering ${branch}: already delivered${mergedPr !== undefined ? ` by merged PR #${mergedPr}` : ' (HEAD tree matches origin/main)'}`);
|
|
49
|
+
return { ok: true, prNumber: mergedPr, alreadyDelivered: true };
|
|
50
|
+
}
|
|
51
|
+
const reason = 'no commits ahead of origin/main';
|
|
52
|
+
log('ship', `not recovering ${branch}: ${reason}`);
|
|
53
|
+
return { ok: false, reason };
|
|
54
|
+
}
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
async function inspectRecoveryState(worktree, run) {
|
|
58
|
+
const [{ stdout: status }, { stdout: ahead }, landed] = await Promise.all([
|
|
59
|
+
run('git status --porcelain', { cwd: worktree }),
|
|
60
|
+
run('git rev-list --count origin/main..HEAD', { cwd: worktree }),
|
|
61
|
+
run('git diff --quiet origin/main..HEAD', { cwd: worktree }).then(() => true, () => false),
|
|
62
|
+
]);
|
|
63
|
+
return {
|
|
64
|
+
clean: status.trim() === '',
|
|
65
|
+
ahead: Number.parseInt(ahead.trim(), 10) > 0,
|
|
66
|
+
landed,
|
|
67
|
+
statusLines: status
|
|
68
|
+
.split('\n')
|
|
69
|
+
.map((l) => l.trimEnd())
|
|
70
|
+
.filter((l) => l.trim() !== ''),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function conflictedPaths(statusLines) {
|
|
74
|
+
return statusLines
|
|
75
|
+
.filter((line) => {
|
|
76
|
+
const xy = line.slice(0, 2);
|
|
77
|
+
return xy.includes('U') || xy === 'AA' || xy === 'DD';
|
|
78
|
+
})
|
|
79
|
+
.map((line) => line.slice(3));
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=ship-recovery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ship-recovery.js","sourceR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AAC,IAAI,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC;QAC5C,MAAM;QACN,WAAW,EAAE,MAAM;aAChB,KAAK,CAAC,IAAI,CAAC;aACX,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;aACvB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;KAClC,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,WAAqB;IAC5C,OAAO,WAAW;SACf,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;QACf,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC5B,OAAO,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,IAAI,CAAC;IACxD,CAAC,CAAC;SACD,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type CommandRunner } from './ship-git.js';
|
|
2
|
+
import type { ShipPhaseOptions } from './ship-options.js';
|
|
3
|
+
import type { ShipResult } from './ship-types.js';
|
|
4
|
+
export declare function pushReentry(ctx: {
|
|
5
|
+
run: CommandRunner;
|
|
6
|
+
worktree: string;
|
|
7
|
+
branch: string;
|
|
8
|
+
prNumber: number | undefined;
|
|
9
|
+
reentry: {
|
|
10
|
+
prNumber: number;
|
|
11
|
+
previousHeadSha?: string;
|
|
12
|
+
};
|
|
13
|
+
log: ShipPhaseOptions['log'];
|
|
14
|
+
}): Promise<{
|
|
15
|
+
stop: ShipResult;
|
|
16
|
+
} | {
|
|
17
|
+
watchRef: string;
|
|
18
|
+
headSha: string;
|
|
19
|
+
}>;
|
|
20
|
+
//# sourceMappingURL=ship-reentry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ship-reentry.d.ts","sourceRoot":"","sources":["../../src/phases/ship-reentry.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,aAAa,EAAsD,MAAM,eAAe,CAAC;AACvG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,wBAAsB,WAAW,CAAC,GAAG,EAAE;IACrC,GAAG,EAAE,aAAa,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,OAAO,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,eAAe,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACxD,GAAG,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAC;CAC9B,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAyCxE"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// packages/core/src/phases/ship-reentry.ts — SHIP re-entry push after a CI rework round
|
|
2
|
+
import { shellEscape } from '../utils/index.js';
|
|
3
|
+
import { describePushFailure, shortDetail, verifyRemoteHead } from './ship-git.js';
|
|
4
|
+
export async function pushReentry(ctx) {
|
|
5
|
+
const { run, worktree, branch, prNumber, reentry, log } = ctx;
|
|
6
|
+
if (prNumber !== reentry.prNumber) {
|
|
7
|
+
const reason = `re-entry expected open PR #${reentry.prNumber} for ${branch} but found ${prNumber === undefined ? 'none' : `#${prNumber}`}`;
|
|
8
|
+
log('ship', reason);
|
|
9
|
+
return { stop: { ok: false, reason } };
|
|
10
|
+
}
|
|
11
|
+
let localSha;
|
|
12
|
+
try {
|
|
13
|
+
localSha = (await run('git rev-parse HEAD', { cwd: worktree })).stdout.trim();
|
|
14
|
+
}
|
|
15
|
+
catch (err) {
|
|
16
|
+
const reason = `could not read local HEAD on re-entry (${shortDetail(err)})`;
|
|
17
|
+
log('ship', reason);
|
|
18
|
+
return { stop: { ok: false, prNumber, reason } };
|
|
19
|
+
}
|
|
20
|
+
if (localSha && localSha === reentry.previousHeadSha) {
|
|
21
|
+
const reason = `CI rework produced no new commit on ${branch}`;
|
|
22
|
+
log('ship', reason);
|
|
23
|
+
return { stop: { ok: false, prNumber, ciOutcome: 'failure', reason, headSha: localSha } };
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
await run(`git push origin ${shellEscape(branch)}`, { cwd: worktree });
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
const { kind, detail } = describePushFailure(err);
|
|
30
|
+
const reason = `re-entry push of ${branch} failed (${kind}): ${detail}`;
|
|
31
|
+
log('ship', reason);
|
|
32
|
+
return { stop: { ok: false, prNumber, reason } };
|
|
33
|
+
}
|
|
34
|
+
const remoteHead = await verifyRemoteHead(run, worktree, branch);
|
|
35
|
+
if (remoteHead.status !== 'match') {
|
|
36
|
+
const reason = remoteHead.status === 'mismatch'
|
|
37
|
+
? `remote head ${remoteHead.remoteSha} does not match local HEAD ${remoteHead.localSha} for ${branch} after re-entry push`
|
|
38
|
+
: `could not verify the remote head for ${branch} after re-entry push (${remoteHead.detail})`;
|
|
39
|
+
log('ship', reason);
|
|
40
|
+
return { stop: { ok: false, prNumber, reason } };
|
|
41
|
+
}
|
|
42
|
+
const watchRef = remoteHead.remoteSha;
|
|
43
|
+
const headSha = remoteHead.remoteSha;
|
|
44
|
+
log('ship', `re-entry pushed ${branch} @ ${headSha}`);
|
|
45
|
+
return { watchRef, headSha };
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=ship-reentry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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E,MAAM,EAAE,EAAE,CAAC;IACnD,CAAC;IACD,MAAM,QAAQ,GAAG,UAAU,CAAC,SAAS,CAAC;IACtC,MAAM,OAAO,GAAG,UAAU,CAAC,SAAS,CAAC;IACrC,GAAG,CAAC,MAAM,EAAE,mBAAmB,MAAM,MAAM,OAAO,EAAE,CAAC,CAAC;IACtD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;AAC/B,CAAC"}
|
package/dist/phases/ship.d.ts
CHANGED
|
@@ -1,79 +1,7 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import
|
|
3
|
-
import type { ApprovalGate } from '../approvals/index.js';
|
|
4
|
-
import { type LifecycleBus } from '../bus/index.js';
|
|
5
|
-
import type { EventKind } from '../events/kinds.js';
|
|
6
|
-
import { type WalkthroughShipOpts } from './ship-walkthrough.js';
|
|
7
|
-
import { type StackPosition } from './stack-order.js';
|
|
8
|
-
import type { ReviewRouting } from '../review/routing.js';
|
|
9
|
-
import { type CommandRunner } from './ship-git.js';
|
|
10
|
-
import { type PreviewGate } from './ship-preview.js';
|
|
11
|
-
import type { CheckSummary } from '../types/index.js';
|
|
12
|
-
import { watchChecksWithInfraRerun } from '../utils/ci-watch.js';
|
|
13
|
-
import type { WorkRequest } from '../work/index.js';
|
|
14
|
-
import { findMergedPR, findOpenPR, isPullAlreadyExistsError } from './ship-pr-lookup.js';
|
|
1
|
+
import { type ShipPhaseOptions } from './ship-options.js';
|
|
2
|
+
import { findMergedPR, findOpenPR } from './ship-pr-lookup.js';
|
|
15
3
|
import type { PrLookup, ShipResult } from './ship-types.js';
|
|
16
|
-
export { findMergedPR, findOpenPR
|
|
4
|
+
export { findMergedPR, findOpenPR };
|
|
17
5
|
export type { PrLookup, ShipResult };
|
|
18
|
-
export declare function shipPhase(opts:
|
|
19
|
-
declare function shipPhaseImpl(opts: {
|
|
20
|
-
issue: WorkKey;
|
|
21
|
-
repo: string;
|
|
22
|
-
worktree: string;
|
|
23
|
-
branch: string;
|
|
24
|
-
octokit: Octokit;
|
|
25
|
-
watchCI?: boolean;
|
|
26
|
-
/** Resolved pr.footer; undefined uses the default, empty string omits it. */
|
|
27
|
-
footer?: string;
|
|
28
|
-
/** Stop at the draft PR: skip mark-ready (#3449). */
|
|
29
|
-
draft?: boolean;
|
|
30
|
-
/** Post the evidence pack as a PR comment (pr.evidenceComment); default off. */
|
|
31
|
-
evidenceComment?: boolean;
|
|
32
|
-
log: (type: EventKind, msg: string) => void;
|
|
33
|
-
run?: CommandRunner;
|
|
34
|
-
/** Runs the gh rerun argv for the CI infra rescue (#2365); default runCommand. */
|
|
35
|
-
rerun?: (argv: readonly string[]) => Promise<{
|
|
36
|
-
ok: boolean;
|
|
37
|
-
}>;
|
|
38
|
-
approvalGate?: ApprovalGate;
|
|
39
|
-
checkSummary?: CheckSummary;
|
|
40
|
-
specPath?: string;
|
|
41
|
-
eventsFile?: string;
|
|
42
|
-
startedAt?: string;
|
|
43
|
-
logsDir?: string;
|
|
44
|
-
reworkRounds?: number;
|
|
45
|
-
/** PR classifier decision (#1724), rendered into the evidence pack. */
|
|
46
|
-
reviewRouting?: ReviewRouting;
|
|
47
|
-
/** Model pins that were not honored (#2511), rendered into the evidence pack. */
|
|
48
|
-
pinNotes?: string[];
|
|
49
|
-
/** The run's resolved work request; when its kind is not 'github-issue', the PR
|
|
50
|
-
* title/body come from it instead of fetching the (nonexistent) issue (#507). */
|
|
51
|
-
work?: Pick<WorkRequest, 'id' | 'kind' | 'title' | 'reference'>;
|
|
52
|
-
/** The ADR-0147 slice this run ships; titles the PR `slice k/n` and only the final slice closes the issue. */
|
|
53
|
-
slice?: {
|
|
54
|
-
index: number;
|
|
55
|
-
count: number;
|
|
56
|
-
};
|
|
57
|
-
/** Stack-mode (ADR-0161) position: the PR opens on `stack.base` and its body names the stack order. Ignored for inline work. */
|
|
58
|
-
stack?: StackPosition;
|
|
59
|
-
/** PR base for a non-stack run started from another branch (#3764); default main. */
|
|
60
|
-
baseBranch?: string;
|
|
61
|
-
/** Lane id stamped onto emitted lifecycle events; defaults to `issue-<issue>` (#591). */
|
|
62
|
-
laneId?: string;
|
|
63
|
-
/** Lifecycle bus to emit onto; defaults to the process-wide `lifecycleBus` (#591). */
|
|
64
|
-
bus?: LifecycleBus;
|
|
65
|
-
/** origin/<branch> SHA recorded at worktree creation (#1868). When set, the new-PR push
|
|
66
|
-
* replaces that stale head under a lease on this SHA, and fails closed if the remote moved (#1869). */
|
|
67
|
-
recordedRemoteSha?: string;
|
|
68
|
-
/** SHIP re-entry after a CI rework round (#2816): same open PR, plain push, watch the pushed SHA. */
|
|
69
|
-
reentry?: {
|
|
70
|
-
prNumber: number;
|
|
71
|
-
previousHeadSha?: string;
|
|
72
|
-
};
|
|
73
|
-
/** CI watch deadline (#3569); default DEFAULT_CI_DEADLINE_MS. */
|
|
74
|
-
ciDeadlineMs?: number;
|
|
75
|
-
walkthrough?: WalkthroughShipOpts['walkthrough'];
|
|
76
|
-
previewGate?: PreviewGate;
|
|
77
|
-
ciWatch?: typeof watchChecksWithInfraRerun;
|
|
78
|
-
}): Promise<ShipResult>;
|
|
6
|
+
export declare function shipPhase(opts: ShipPhaseOptions): Promise<ShipResult>;
|
|
79
7
|
//# sourceMappingURL=ship.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ship.d.ts","sourceRoot":"","sources":["../../src/phases/ship.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ship.d.ts","sourceRoot":"","sources":["../../src/phases/ship.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAoB,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE/D,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAI5D,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC;AACpC,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;AAIrC,wBAAsB,SAAS,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,UAAU,CAAC,CAiB3E"}
|