@on-par/factory-core 0.9.28-next.9 → 0.9.29-next.1
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/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 +14 -2
- package/dist/config/example.js.map +1 -1
- package/dist/config/index.d.ts +14 -33
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +26 -35
- 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/config/runtime-config-keys.d.ts.map +1 -1
- package/dist/config/runtime-config-keys.js +1 -0
- package/dist/config/runtime-config-keys.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-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 +70 -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-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-types.d.ts +4 -0
- package/dist/phases/ship-types.d.ts.map +1 -1
- package/dist/phases/ship.d.ts +4 -76
- package/dist/phases/ship.d.ts.map +1 -1
- package/dist/phases/ship.js +40 -297
- 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 +4 -1
- package/dist/queue/internal-exports.d.ts.map +1 -1
- package/dist/queue/internal-exports.js +3 -1
- package/dist/queue/internal-exports.js.map +1 -1
- package/dist/queue/iterate-command.d.ts +18 -0
- package/dist/queue/iterate-command.d.ts.map +1 -1
- package/dist/queue/iterate-command.js +38 -0
- package/dist/queue/iterate-command.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/router/breaker.d.ts +1 -1
- package/dist/router/breaker.d.ts.map +1 -1
- package/dist/router/breaker.js +3 -2
- package/dist/router/breaker.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/outcome.d.ts +9 -0
- package/dist/run/outcome.d.ts.map +1 -1
- package/dist/run/outcome.js +8 -0
- package/dist/run/outcome.js.map +1 -1
- 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 +102 -0
- package/dist/run/pr-run-state.d.ts.map +1 -0
- package/dist/run/pr-run-state.js +240 -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 +37 -31
- package/dist/run/run-issue.js.map +1 -1
- package/dist/run/run-state-record.d.ts.map +1 -1
- package/dist/run/run-state-record.js +1 -0
- package/dist/run/run-state-record.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/run/state.d.ts +2 -0
- package/dist/run/state.d.ts.map +1 -1
- package/dist/run/state.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,82 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
cwd?: string;
|
|
3
|
-
timeout?: number;
|
|
4
|
-
}) => Promise<{
|
|
5
|
-
stdout: string;
|
|
6
|
-
}>;
|
|
1
|
+
import type { CommandRunner } from './ship-git-detail.js';
|
|
7
2
|
/** Wraps a runner so no command starts once the lane's claim is lost (#3146): push and remote-head checks refuse to run. */
|
|
8
3
|
export declare function claimGuardedRunner(signal: AbortSignal, run?: CommandRunner): CommandRunner;
|
|
9
|
-
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
* The real reason a push failed, from git's own stderr when the runner exposes it
|
|
13
|
-
* (node's promisified `exec` rejection carries `stderr`), else the Error message, else the
|
|
14
|
-
* value's string form. Flattened to one line and bounded so a single event row stays
|
|
15
|
-
* greppable in `.factory/events.ndjson`.
|
|
16
|
-
*/
|
|
17
|
-
export declare function describePushFailure(err: unknown): {
|
|
18
|
-
kind: PushFailureKind;
|
|
19
|
-
detail: string;
|
|
20
|
-
};
|
|
21
|
-
/** The result of comparing the pushed branch's remote head against local HEAD (#735). */
|
|
22
|
-
type RemoteHeadCheck = {
|
|
23
|
-
status: 'match';
|
|
24
|
-
localSha: string;
|
|
25
|
-
remoteSha: string;
|
|
26
|
-
} | {
|
|
27
|
-
status: 'mismatch';
|
|
28
|
-
localSha: string;
|
|
29
|
-
remoteSha: string;
|
|
30
|
-
} | {
|
|
31
|
-
status: 'unreadable';
|
|
32
|
-
localSha?: string;
|
|
33
|
-
remoteSha?: string;
|
|
34
|
-
detail: string;
|
|
35
|
-
};
|
|
36
|
-
/** Prefer stderr, then stdout, before the error fallback; keep details flattened and bounded. */
|
|
37
|
-
export declare function shortDetail(err: unknown): string;
|
|
38
|
-
/** origin/<branch>'s current SHA, `null` when the branch is absent, or the failure detail (#1869). */
|
|
39
|
-
export declare function readRemoteBranchSha(run: CommandRunner, worktree: string, branch: string): Promise<{
|
|
40
|
-
status: 'ok';
|
|
41
|
-
sha: string | null;
|
|
42
|
-
} | {
|
|
43
|
-
status: 'unreadable';
|
|
44
|
-
detail: string;
|
|
45
|
-
}>;
|
|
46
|
-
/**
|
|
47
|
-
* A zero-exit push is not proof the remote branch actually carries this run's commits — a
|
|
48
|
-
* concurrent push or an update that silently applied nothing leaves the remote head elsewhere,
|
|
49
|
-
* and a PR opened against it would advertise work that is not there (#735).
|
|
50
|
-
*/
|
|
51
|
-
export declare function verifyRemoteHead(run: CommandRunner, worktree: string, branch: string): Promise<RemoteHeadCheck>;
|
|
52
|
-
/** Whether origin's head is an ancestor of local HEAD, i.e. a plain push is a fast-forward (#1815). */
|
|
53
|
-
export type RemoteAncestry = {
|
|
54
|
-
status: 'ancestor';
|
|
55
|
-
} | {
|
|
56
|
-
status: 'diverged';
|
|
57
|
-
} | {
|
|
58
|
-
status: 'unreadable';
|
|
59
|
-
detail: string;
|
|
60
|
-
};
|
|
61
|
-
export declare function checkRemoteIsAncestor(run: CommandRunner, worktree: string, remoteSha: string, localSha: string): Promise<RemoteAncestry>;
|
|
62
|
-
/** Outcome of one push followed by a remote-head check, the single verified push site for SHIP (#734/#735/#1813). */
|
|
63
|
-
export type VerifiedPush = {
|
|
64
|
-
status: 'pushed';
|
|
65
|
-
localSha: string;
|
|
66
|
-
remoteSha: string;
|
|
67
|
-
} | {
|
|
68
|
-
status: 'push-failed';
|
|
69
|
-
kind: PushFailureKind;
|
|
70
|
-
detail: string;
|
|
71
|
-
} | {
|
|
72
|
-
status: 'mismatch';
|
|
73
|
-
localSha: string;
|
|
74
|
-
remoteSha: string;
|
|
75
|
-
} | {
|
|
76
|
-
status: 'unreadable';
|
|
77
|
-
localSha?: string;
|
|
78
|
-
detail: string;
|
|
79
|
-
};
|
|
80
|
-
export declare function pushAndVerifyRemoteHead(run: CommandRunner, worktree: string, branch: string, pushCmd: string): Promise<VerifiedPush>;
|
|
81
|
-
export {};
|
|
4
|
+
export type { CommandRunner } from './ship-git-detail.js';
|
|
5
|
+
export { checkRemoteIsAncestor, describePushFailure, shortDetail } from './ship-git-detail.js';
|
|
6
|
+
export { pushAndVerifyRemoteHead, readRemoteBranchSha, verifyRemoteHead } from './ship-git-remote.js';
|
|
82
7
|
//# sourceMappingURL=ship-git.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ship-git.d.ts","sourceRoot":"","sources":["../../src/phases/ship-git.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ship-git.d.ts","sourceRoot":"","sources":["../../src/phases/ship-git.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAI1D,4HAA4H;AAC5H,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,GAAE,aAA0B,GAAG,aAAa,CAKtG;AAED,YAAY,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC/F,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/phases/ship-git.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// packages/core/src/phases/ship-git.ts — push-failure and remote-head helpers for SHIP
|
|
2
2
|
import { exec as execCb } from 'node:child_process';
|
|
3
3
|
import { promisify } from 'node:util';
|
|
4
|
-
import { shellEscape } from '../utils/index.js';
|
|
5
4
|
const defaultRun = promisify(execCb);
|
|
6
5
|
/** Wraps a runner so no command starts once the lane's claim is lost (#3146): push and remote-head checks refuse to run. */
|
|
7
6
|
export function claimGuardedRunner(signal, run = defaultRun) {
|
|
@@ -10,138 +9,6 @@ export function claimGuardedRunner(signal, run = defaultRun) {
|
|
|
10
9
|
return run(command, options);
|
|
11
10
|
};
|
|
12
11
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const NON_FAST_FORWARD_MARKERS = [
|
|
16
|
-
'non-fast-forward',
|
|
17
|
-
'! [rejected]',
|
|
18
|
-
'fetch first',
|
|
19
|
-
'updates were rejected',
|
|
20
|
-
'stale info',
|
|
21
|
-
];
|
|
22
|
-
const NETWORK_MARKERS = [
|
|
23
|
-
'could not resolve host',
|
|
24
|
-
'failed to connect',
|
|
25
|
-
'connection timed out',
|
|
26
|
-
'connection refused',
|
|
27
|
-
'network is unreachable',
|
|
28
|
-
'operation timed out',
|
|
29
|
-
'the remote end hung up unexpectedly',
|
|
30
|
-
];
|
|
31
|
-
function classifyPushFailure(text) {
|
|
32
|
-
const t = text.toLowerCase();
|
|
33
|
-
if (NON_FAST_FORWARD_MARKERS.some((m) => t.includes(m)))
|
|
34
|
-
return 'non-fast-forward';
|
|
35
|
-
if (NETWORK_MARKERS.some((m) => t.includes(m)))
|
|
36
|
-
return 'network';
|
|
37
|
-
return 'unknown';
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* The real reason a push failed, from git's own stderr when the runner exposes it
|
|
41
|
-
* (node's promisified `exec` rejection carries `stderr`), else the Error message, else the
|
|
42
|
-
* value's string form. Flattened to one line and bounded so a single event row stays
|
|
43
|
-
* greppable in `.factory/events.ndjson`.
|
|
44
|
-
*/
|
|
45
|
-
export function describePushFailure(err) {
|
|
46
|
-
const raw = err?.stderr;
|
|
47
|
-
const stderr = typeof raw === 'string' ? raw : '';
|
|
48
|
-
const text = stderr.trim() || (err instanceof Error ? err.message : String(err));
|
|
49
|
-
const detail = text.replace(/\s+/g, ' ').trim().slice(0, MAX_PUSH_ERROR_DETAIL);
|
|
50
|
-
return { kind: classifyPushFailure(detail), detail: detail || 'no error output' };
|
|
51
|
-
}
|
|
52
|
-
/** Bound on the ls-remote failure text copied into one NDJSON event row (#735). */
|
|
53
|
-
const MAX_REMOTE_HEAD_DETAIL = 200;
|
|
54
|
-
/** Prefer stderr, then stdout, before the error fallback; keep details flattened and bounded. */
|
|
55
|
-
export function shortDetail(err) {
|
|
56
|
-
const output = err;
|
|
57
|
-
const rawStderr = output?.stderr;
|
|
58
|
-
const rawStdout = output?.stdout;
|
|
59
|
-
const stderr = typeof rawStderr === 'string' ? rawStderr.trim() : '';
|
|
60
|
-
const stdout = typeof rawStdout === 'string' ? rawStdout.trim() : '';
|
|
61
|
-
const text = stderr || stdout || (err instanceof Error ? err.message : String(err));
|
|
62
|
-
return text.replace(/\s+/g, ' ').trim().slice(0, MAX_REMOTE_HEAD_DETAIL) || 'no error output';
|
|
63
|
-
}
|
|
64
|
-
/** The SHA on the `refs/heads/<branch>` line of `git ls-remote` output. `--heads origin <branch>`
|
|
65
|
-
* is a suffix pattern, so it can list more than one ref — match the ref name exactly rather than
|
|
66
|
-
* trusting the first line. */
|
|
67
|
-
function parseRemoteHeadSha(stdout, branch) {
|
|
68
|
-
for (const line of stdout.split('\n')) {
|
|
69
|
-
const [sha, ref] = line.trim().split(/\s+/);
|
|
70
|
-
if (ref === `refs/heads/${branch}` && sha)
|
|
71
|
-
return sha;
|
|
72
|
-
}
|
|
73
|
-
return undefined;
|
|
74
|
-
}
|
|
75
|
-
/** origin/<branch>'s current SHA, `null` when the branch is absent, or the failure detail (#1869). */
|
|
76
|
-
export async function readRemoteBranchSha(run, worktree, branch) {
|
|
77
|
-
try {
|
|
78
|
-
const { stdout } = await run(`git ls-remote --heads origin ${shellEscape(branch)}`, { cwd: worktree });
|
|
79
|
-
return { status: 'ok', sha: parseRemoteHeadSha(stdout, branch) ?? null };
|
|
80
|
-
}
|
|
81
|
-
catch (err) {
|
|
82
|
-
return { status: 'unreadable', detail: shortDetail(err) };
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* A zero-exit push is not proof the remote branch actually carries this run's commits — a
|
|
87
|
-
* concurrent push or an update that silently applied nothing leaves the remote head elsewhere,
|
|
88
|
-
* and a PR opened against it would advertise work that is not there (#735).
|
|
89
|
-
*/
|
|
90
|
-
export async function verifyRemoteHead(run, worktree, branch) {
|
|
91
|
-
let localSha;
|
|
92
|
-
try {
|
|
93
|
-
const { stdout } = await run('git rev-parse HEAD', { cwd: worktree });
|
|
94
|
-
localSha = stdout.trim();
|
|
95
|
-
}
|
|
96
|
-
catch (err) {
|
|
97
|
-
return { status: 'unreadable', detail: shortDetail(err) };
|
|
98
|
-
}
|
|
99
|
-
if (!localSha)
|
|
100
|
-
return { status: 'unreadable', detail: 'git rev-parse HEAD produced no SHA' };
|
|
101
|
-
let listing;
|
|
102
|
-
try {
|
|
103
|
-
const { stdout } = await run(`git ls-remote --heads origin ${shellEscape(branch)}`, { cwd: worktree });
|
|
104
|
-
listing = stdout;
|
|
105
|
-
}
|
|
106
|
-
catch (err) {
|
|
107
|
-
return { status: 'unreadable', localSha, detail: shortDetail(err) };
|
|
108
|
-
}
|
|
109
|
-
const remoteSha = parseRemoteHeadSha(listing, branch);
|
|
110
|
-
if (!remoteSha)
|
|
111
|
-
return { status: 'unreadable', localSha, detail: `no refs/heads/${branch} on origin` };
|
|
112
|
-
return remoteSha === localSha
|
|
113
|
-
? { status: 'match', localSha, remoteSha }
|
|
114
|
-
: { status: 'mismatch', localSha, remoteSha };
|
|
115
|
-
}
|
|
116
|
-
const MISSING_OBJECT_MARKERS = ['not a valid object name', 'not a valid commit', 'bad object', 'unknown revision'];
|
|
117
|
-
export async function checkRemoteIsAncestor(run, worktree, remoteSha, localSha) {
|
|
118
|
-
try {
|
|
119
|
-
await run(`git merge-base --is-ancestor ${shellEscape(remoteSha)} ${shellEscape(localSha)}`, { cwd: worktree });
|
|
120
|
-
return { status: 'ancestor' };
|
|
121
|
-
}
|
|
122
|
-
catch (err) {
|
|
123
|
-
// Exit 1 is git's documented "not an ancestor"; other non-zero statuses are errors.
|
|
124
|
-
if (err?.code === 1)
|
|
125
|
-
return { status: 'diverged' };
|
|
126
|
-
const detail = shortDetail(err);
|
|
127
|
-
// A remote commit absent from the local object store cannot be contained in local HEAD.
|
|
128
|
-
if (MISSING_OBJECT_MARKERS.some((marker) => detail.toLowerCase().includes(marker)))
|
|
129
|
-
return { status: 'diverged' };
|
|
130
|
-
return { status: 'unreadable', detail };
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
export async function pushAndVerifyRemoteHead(run, worktree, branch, pushCmd) {
|
|
134
|
-
try {
|
|
135
|
-
await run(pushCmd, { cwd: worktree });
|
|
136
|
-
}
|
|
137
|
-
catch (err) {
|
|
138
|
-
return { status: 'push-failed', ...describePushFailure(err) };
|
|
139
|
-
}
|
|
140
|
-
const head = await verifyRemoteHead(run, worktree, branch);
|
|
141
|
-
if (head.status === 'match')
|
|
142
|
-
return { status: 'pushed', localSha: head.localSha, remoteSha: head.remoteSha };
|
|
143
|
-
if (head.status === 'mismatch')
|
|
144
|
-
return head;
|
|
145
|
-
return { status: 'unreadable', localSha: head.localSha, detail: head.detail };
|
|
146
|
-
}
|
|
12
|
+
export { checkRemoteIsAncestor, describePushFailure, shortDetail } from './ship-git-detail.js';
|
|
13
|
+
export { pushAndVerifyRemoteHead, readRemoteBranchSha, verifyRemoteHead } from './ship-git-remote.js';
|
|
147
14
|
//# sourceMappingURL=ship-git.js.map
|
|
@@ -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,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,GAAG,CAAC;IACpF,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC3D,IAAI,QAAgB,CAAC;IACrB,qFAAqF;IACrF,MAAM,KAAK,GAAG,UAAU;QACtB,CAAC,CAAC,UAAU,CAAC,KAAK;QAClB,CAAC,CAAC,MAAM;YACN,CAAC,CAAC,MA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QACrB,GAAG,CAAC,WAAW,EAAE,cAAc,QAAQ,0BAA0B,MAAM,UAAU,IAAI,GAAG,CAAC,CAAC;IAC5F,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,wBAAwB,CAAC,GAAG,CAAC;YAAE,MAAM,GAAG,CAAC;QAC9C,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;QACpE,IAAI,QAAQ,CAAC,MAAM,KAAK,OAAO,EAAE,CAAC;YAChC,MAAM,MAAM,GAAG,4CAA4C,MAAM,qCAAqC,QAAQ,CAAC,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,mBAAmB,GAAG,CAAC;YAC7K,GAAG,CAAC,MAAM,EAAE,GAAG,MAAM,aAAa,CAAC,CAAC;YACpC,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC;QACzC,CAAC;QACD,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC;QAC7B,GAAG,CAAC,WAAW,EAAE,OAAO,QAAQ,wBAAwB,MAAM,cAAc,CAAC,CAAC;IAChF,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { Octokit } from '@octokit/rest';
|
|
2
|
+
import type { ApprovalGate } from '../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
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AAM,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,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":"ship-reentry.js","sourceRoot":"","sources":["../../src/phases/ship-reentry.ts"],"names":[],"mappings":"AAA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AU,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"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { PreviewCheckResult } from '../checkers/preview-check.js';
|
|
2
2
|
import type { CiFailureEvidence } from '../types/index.js';
|
|
3
3
|
import type { InfraRerunOutcome } from '../utils/ci-watch.js';
|
|
4
|
+
/** Why SHIP left a PR as a draft (#3932): 'ci-pending' = CI had not finished (the sweep may land it); 'requested' = draft mode. */
|
|
5
|
+
export type ShipDraftReason = 'ci-pending' | 'requested';
|
|
4
6
|
export interface ShipResult {
|
|
5
7
|
ok: boolean;
|
|
6
8
|
prNumber?: number;
|
|
@@ -19,6 +21,8 @@ export interface ShipResult {
|
|
|
19
21
|
draft?: boolean;
|
|
20
22
|
/** CI watch timed out before a verdict (#3569): the PR was left as draft. */
|
|
21
23
|
ciPending?: boolean;
|
|
24
|
+
/** Why an ok result is a draft (#3932); the run-state comment carries it for the CI-pending sweep. */
|
|
25
|
+
draftReason?: ShipDraftReason;
|
|
22
26
|
previewCheck?: PreviewCheckResult;
|
|
23
27
|
}
|
|
24
28
|
/** The result of asking GitHub whether a PR exists for a branch. `error` is never collapsed
|