@on-par/factory-core 0.9.28-next.2 → 0.9.28-next.21
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 +1 -0
- package/dist/checkers/internal-exports.d.ts.map +1 -1
- package/dist/checkers/internal-exports.js +1 -0
- 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 +11 -2
- package/dist/config/example.js.map +1 -1
- package/dist/config/index.d.ts +20 -32
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +11 -30
- 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/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/config/tracker-section.d.ts +39 -0
- package/dist/config/tracker-section.d.ts.map +1 -0
- package/dist/config/tracker-section.js +31 -0
- package/dist/config/tracker-section.js.map +1 -0
- 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/queue-traits.d.ts +1 -1
- package/dist/events/queue-traits.d.ts.map +1 -1
- package/dist/events/queue-traits.js +5 -1
- package/dist/events/queue-traits.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 +11 -1
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +11 -0
- package/dist/internal.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 +12 -0
- package/dist/phases/ship-evidence-comment.d.ts.map +1 -0
- package/dist/phases/ship-evidence-comment.js +30 -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-open-pr.d.ts +19 -0
- package/dist/phases/ship-open-pr.d.ts.map +1 -0
- package/dist/phases/ship-open-pr.js +71 -0
- package/dist/phases/ship-open-pr.js.map +1 -0
- package/dist/phases/ship-options.d.ts +76 -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-pr-lookup.d.ts +8 -0
- package/dist/phases/ship-pr-lookup.d.ts.map +1 -0
- package/dist/phases/ship-pr-lookup.js +41 -0
- package/dist/phases/ship-pr-lookup.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-types.d.ts +36 -0
- package/dist/phases/ship-types.d.ts.map +1 -0
- package/dist/phases/ship-types.js +2 -0
- package/dist/phases/ship-types.js.map +1 -0
- package/dist/phases/ship.d.ts +6 -113
- package/dist/phases/ship.d.ts.map +1 -1
- package/dist/phases/ship.js +55 -458
- package/dist/phases/ship.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/internal-exports.d.ts +2 -0
- package/dist/queue/internal-exports.d.ts.map +1 -1
- package/dist/queue/internal-exports.js +1 -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-lifecycle.d.ts +62 -0
- package/dist/queue/linear-queue-lifecycle.d.ts.map +1 -0
- package/dist/queue/linear-queue-lifecycle.js +139 -0
- package/dist/queue/linear-queue-lifecycle.js.map +1 -0
- package/dist/queue/linear-queue.d.ts +51 -0
- package/dist/queue/linear-queue.d.ts.map +1 -0
- package/dist/queue/linear-queue.js +335 -0
- package/dist/queue/linear-queue.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 +12 -8
- package/dist/queue/review-rework-trigger.js.map +1 -1
- package/dist/reports/pr-body.d.ts.map +1 -1
- package/dist/reports/pr-body.js +18 -8
- package/dist/reports/pr-body.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/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 +10 -0
- package/dist/run/review-rework.d.ts.map +1 -1
- package/dist/run/review-rework.js +45 -15
- package/dist/run/review-rework.js.map +1 -1
- package/dist/run/state.d.ts +6 -4
- package/dist/run/state.d.ts.map +1 -1
- package/dist/run/state.js +8 -5
- 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/index.d.ts +2 -2
- package/dist/work/index.d.ts.map +1 -1
- package/dist/work/index.js +4 -2
- package/dist/work/index.js.map +1 -1
- package/dist/work/linear-client.d.ts +21 -0
- package/dist/work/linear-client.d.ts.map +1 -0
- package/dist/work/linear-client.js +69 -0
- package/dist/work/linear-client.js.map +1 -0
- package/dist/work/linear-issue.d.ts +11 -0
- package/dist/work/linear-issue.d.ts.map +1 -0
- package/dist/work/linear-issue.js +69 -0
- package/dist/work/linear-issue.js.map +1 -0
- package/dist/work/linear-preflight.d.ts +21 -0
- package/dist/work/linear-preflight.d.ts.map +1 -0
- package/dist/work/linear-preflight.js +67 -0
- package/dist/work/linear-preflight.js.map +1 -0
- package/package.json +5 -5
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// packages/core/src/phases/ship-finish.ts — SHIP preview gate, ready flip and final result
|
|
2
|
+
import { publishPreviewReceipt } from '../checkers/preview-receipt.js';
|
|
3
|
+
import { previewFailureReason, runPreviewGate } from './ship-preview.js';
|
|
4
|
+
import { markPrReadyWithRetry } from './ship-ready.js';
|
|
5
|
+
export async function finishShip(ctx) {
|
|
6
|
+
const { opts, run, owner, repoName, prNumber, headSha, ciOutcome, ciWatchError } = ctx;
|
|
7
|
+
const { octokit, worktree, log } = opts;
|
|
8
|
+
const ciPending = ciOutcome === 'timeout' || ciWatchError !== undefined;
|
|
9
|
+
let previewCheck;
|
|
10
|
+
if (opts.previewGate) {
|
|
11
|
+
const sha = headSha ?? (await run('git rev-parse HEAD', { cwd: worktree })).stdout.trim();
|
|
12
|
+
const publish = (n, r) => publishPreviewReceipt(octokit, owner, repoName, n, r);
|
|
13
|
+
const gateCtx = { log, ciPending, publish, ...(opts.logsDir ? { logsDir: opts.logsDir } : {}) };
|
|
14
|
+
previewCheck = await runPreviewGate(opts.previewGate, { prNumber, headSha: sha }, gateCtx);
|
|
15
|
+
if (previewCheck.status !== 'pass') {
|
|
16
|
+
return {
|
|
17
|
+
ok: false,
|
|
18
|
+
prNumber,
|
|
19
|
+
reason: previewFailureReason(prNumber, previewCheck),
|
|
20
|
+
previewCheck,
|
|
21
|
+
headSha: sha,
|
|
22
|
+
...(ciOutcome ? { ciOutcome } : {}),
|
|
23
|
+
...(ciPending ? { ciPending: true, draft: true } : {}),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (ciWatchError !== undefined) {
|
|
28
|
+
const reason = `CI unknown for PR #${prNumber}: the CI watch failed (${ciWatchError}); leaving PR as draft`;
|
|
29
|
+
log('ship', reason);
|
|
30
|
+
return { ok: false, prNumber, reason, ciPending: true, draft: true, ...(headSha ? { headSha } : {}) };
|
|
31
|
+
}
|
|
32
|
+
// Mark ready for review (if draft). REST pulls.update ignores `draft`;
|
|
33
|
+
// undrafting requires the markPullRequestReadyForReview GraphQL mutation.
|
|
34
|
+
if (opts.draft || ciPending) {
|
|
35
|
+
try {
|
|
36
|
+
const { data: pr } = await octokit.rest.pulls.get({ owner, repo: repoName, pull_number: prNumber });
|
|
37
|
+
if (!pr.draft)
|
|
38
|
+
log('ship', `PR #${prNumber} is already open and not a draft; draft mode leaves it as is`);
|
|
39
|
+
}
|
|
40
|
+
catch { }
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
const flip = await markPrReadyWithRetry(octokit, owner, repoName, prNumber);
|
|
44
|
+
if (!flip.ok) {
|
|
45
|
+
const reason = `could not mark PR #${prNumber} ready for review after one retry: ${flip.detail}`;
|
|
46
|
+
log('warn', reason);
|
|
47
|
+
return {
|
|
48
|
+
ok: false,
|
|
49
|
+
prNumber,
|
|
50
|
+
reason,
|
|
51
|
+
...(ciOutcome === undefined ? {} : { ciOutcome }),
|
|
52
|
+
...(headSha ? { headSha } : {}),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const noChecks = ciOutcome === 'no-checks' ? ' (CI skipped: no checks found)' : '';
|
|
57
|
+
const readyLabel = opts.draft || ciPending ? `left as draft${ciPending ? ' (CI pending)' : ''}` : 'ready for review';
|
|
58
|
+
log('ready', `PR #${prNumber} ${readyLabel}${noChecks}`);
|
|
59
|
+
return {
|
|
60
|
+
ok: true,
|
|
61
|
+
prNumber,
|
|
62
|
+
...(ciOutcome === undefined ? {} : { ciOutcome }),
|
|
63
|
+
...(headSha ? { headSha } : {}),
|
|
64
|
+
...(opts.draft || ciPending ? { draft: true } : {}),
|
|
65
|
+
...(ciPending ? { ciPending: true } : {}),
|
|
66
|
+
...(previewCheck ? { previewCheck } : {}),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=ship-finish.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ship-finish.js","sourceRoot":"","sources":["../../src/phases/ship-finish.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAG3F,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAIvE,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAGvD,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,GAShC;IACC,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,GAAG,GAAG,CAAC;IACvF,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IACxC,MAAM,SAAS,GAAG,SAAS,KAAK,SAAS,IAAI,YAAY,KAAK,SAAS,CAAC;IAExE,IAAI,YAA4C,CAAC;IACjD,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;QACrB,MAAM,GAAG,GAAG,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,oBAAoB,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QAC1F,MAAM,OAAO,GAAG,CAAC,CAAS,EAAE,CAAqB,EAAE,EAAE,CAAC,qBAAqB,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,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C;IACrH,GAAG,CAAC,OAAO,EAAE,OAAO,QAAQ,IAAI,UAAU,GAAG,QAAQ,EAAE,CAAC,CAAC;IACzD,OAAO;QACL,EAAE,EAAE,IAAI;QACR,QAAQ;QACR,GAAG,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC;QACjD,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/B,GAAG,CAAC,IAAI,CAAC,KAAK,IAAI,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACnD,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACzC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC1C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export type CommandRunner = (command: string, options?: {
|
|
2
|
+
cwd?: string;
|
|
3
|
+
timeout?: number;
|
|
4
|
+
}) => Promise<{
|
|
5
|
+
stdout: string;
|
|
6
|
+
}>;
|
|
7
|
+
/** Why a `git push` was refused, as far as git's own stderr says (#733). */
|
|
8
|
+
export type PushFailureKind = 'non-fast-forward' | 'network' | 'unknown';
|
|
9
|
+
/**
|
|
10
|
+
* The real reason a push failed, from git's own stderr when the runner exposes it
|
|
11
|
+
* (node's promisified `exec` rejection carries `stderr`), else the Error message, else the
|
|
12
|
+
* value's string form. Flattened to one line and bounded so a single event row stays
|
|
13
|
+
* greppable in `.factory/events.ndjson`.
|
|
14
|
+
*/
|
|
15
|
+
export declare function describePushFailure(err: unknown): {
|
|
16
|
+
kind: PushFailureKind;
|
|
17
|
+
detail: string;
|
|
18
|
+
};
|
|
19
|
+
/** Prefer stderr, then stdout, before the error fallback; keep details flattened and bounded. */
|
|
20
|
+
export declare function shortDetail(err: unknown): string;
|
|
21
|
+
/** Whether origin's head is an ancestor of local HEAD, i.e. a plain push is a fast-forward (#1815). */
|
|
22
|
+
export type RemoteAncestry = {
|
|
23
|
+
status: 'ancestor';
|
|
24
|
+
} | {
|
|
25
|
+
status: 'diverged';
|
|
26
|
+
} | {
|
|
27
|
+
status: 'unreadable';
|
|
28
|
+
detail: string;
|
|
29
|
+
};
|
|
30
|
+
export declare function checkRemoteIsAncestor(run: CommandRunner, worktree: string, remoteSha: string, localSha: string): Promise<RemoteAncestry>;
|
|
31
|
+
//# sourceMappingURL=ship-git-detail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ship-git-detail.d.ts","sourceRoot":"","sources":["../../src/phases/ship-git-detail.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,aAAa,GAAG,CAC1B,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,KACzC,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAEjC,4EAA4E;AAC5E,MAAM,MAAM,eAAe,GAAG,kBAAkB,GAAG,SAAS,GAAG,SAAS,CAAC;AA8BzE;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAM3F;AAKD,iGAAiG;AACjG,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAQhD;AAED,uGAAuG;AACvG,MAAM,MAAM,cAAc,GAAG;IAAE,MAAM,EAAE,UAAU,CAAA;CAAE,GAAG;IAAE,MAAM,EAAE,UAAU,CAAA;CAAE,GAAG;IAAE,MAAM,EAAE,YAAY,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAIxH,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,aAAa,EAClB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,cAAc,CAAC,CAYzB"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// packages/core/src/phases/ship-git-detail.ts — command runner type and push-failure description for SHIP
|
|
2
|
+
import { shellEscape } from '../utils/index.js';
|
|
3
|
+
/** Bound on the failure text copied into one NDJSON event row. */
|
|
4
|
+
const MAX_PUSH_ERROR_DETAIL = 400;
|
|
5
|
+
const NON_FAST_FORWARD_MARKERS = [
|
|
6
|
+
'non-fast-forward',
|
|
7
|
+
'! [rejected]',
|
|
8
|
+
'fetch first',
|
|
9
|
+
'updates were rejected',
|
|
10
|
+
'stale info',
|
|
11
|
+
];
|
|
12
|
+
const NETWORK_MARKERS = [
|
|
13
|
+
'could not resolve host',
|
|
14
|
+
'failed to connect',
|
|
15
|
+
'connection timed out',
|
|
16
|
+
'connection refused',
|
|
17
|
+
'network is unreachable',
|
|
18
|
+
'operation timed out',
|
|
19
|
+
'the remote end hung up unexpectedly',
|
|
20
|
+
];
|
|
21
|
+
function classifyPushFailure(text) {
|
|
22
|
+
const t = text.toLowerCase();
|
|
23
|
+
if (NON_FAST_FORWARD_MARKERS.some((m) => t.includes(m)))
|
|
24
|
+
return 'non-fast-forward';
|
|
25
|
+
if (NETWORK_MARKERS.some((m) => t.includes(m)))
|
|
26
|
+
return 'network';
|
|
27
|
+
return 'unknown';
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The real reason a push failed, from git's own stderr when the runner exposes it
|
|
31
|
+
* (node's promisified `exec` rejection carries `stderr`), else the Error message, else the
|
|
32
|
+
* value's string form. Flattened to one line and bounded so a single event row stays
|
|
33
|
+
* greppable in `.factory/events.ndjson`.
|
|
34
|
+
*/
|
|
35
|
+
export function describePushFailure(err) {
|
|
36
|
+
const raw = err?.stderr;
|
|
37
|
+
const stderr = typeof raw === 'string' ? raw : '';
|
|
38
|
+
const text = stderr.trim() || (err instanceof Error ? err.message : String(err));
|
|
39
|
+
const detail = text.replace(/\s+/g, ' ').trim().slice(0, MAX_PUSH_ERROR_DETAIL);
|
|
40
|
+
return { kind: classifyPushFailure(detail), detail: detail || 'no error output' };
|
|
41
|
+
}
|
|
42
|
+
/** Bound on the ls-remote failure text copied into one NDJSON event row (#735). */
|
|
43
|
+
const MAX_REMOTE_HEAD_DETAIL = 200;
|
|
44
|
+
/** Prefer stderr, then stdout, before the error fallback; keep details flattened and bounded. */
|
|
45
|
+
export function shortDetail(err) {
|
|
46
|
+
const output = err;
|
|
47
|
+
const rawStderr = output?.stderr;
|
|
48
|
+
const rawStdout = output?.stdout;
|
|
49
|
+
const stderr = typeof rawStderr === 'string' ? rawStderr.trim() : '';
|
|
50
|
+
const stdout = typeof rawStdout === 'string' ? rawStdout.trim() : '';
|
|
51
|
+
const text = stderr || stdout || (err instanceof Error ? err.message : String(err));
|
|
52
|
+
return text.replace(/\s+/g, ' ').trim().slice(0, MAX_REMOTE_HEAD_DETAIL) || 'no error output';
|
|
53
|
+
}
|
|
54
|
+
const MISSING_OBJECT_MARKERS = ['not a valid object name', 'not a valid commit', 'bad object', 'unknown revision'];
|
|
55
|
+
export async function checkRemoteIsAncestor(run, worktree, remoteSha, localSha) {
|
|
56
|
+
try {
|
|
57
|
+
await run(`git merge-base --is-ancestor ${shellEscape(remoteSha)} ${shellEscape(localSha)}`, { cwd: worktree });
|
|
58
|
+
return { status: 'ancestor' };
|
|
59
|
+
}
|
|
60
|
+
catch (err) {
|
|
61
|
+
// Exit 1 is git's documented "not an ancestor"; other non-zero statuses are errors.
|
|
62
|
+
if (err?.code === 1)
|
|
63
|
+
return { status: 'diverged' };
|
|
64
|
+
const detail = shortDetail(err);
|
|
65
|
+
// A remote commit absent from the local object store cannot be contained in local HEAD.
|
|
66
|
+
if (MISSING_OBJECT_MARKERS.some((marker) => detail.toLowerCase().includes(marker)))
|
|
67
|
+
return { status: 'diverged' };
|
|
68
|
+
return { status: 'unreadable', detail };
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=ship-git-detail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ship-git-detail.js","sourceRoot":"","sources":["../../src/phases/ship-git-detail.ts"],"names":[],"mappings":"AAAA,0GAA0G;AAE1G,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAUhD,kEAAkE;AAClE,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAElC,MAAM,wBAAwB,GAAG;IAC/B,kBAAkB;IAClB,cAAc;IACd,aAAa;IACb,uBAAuB;IACvB,YAAY;CACb,CAAC;AAEF,MAAM,eAAe,GAAG;IACtB,wBAAwB;IACxB,mBAAmB;IACnB,sBAAsB;IACtB,oBAAoB;IACpB,wBAAwB;IACxB,qBAAqB;IACrB,qCAAqC;CACtC,CAAC;AAEF,SAAS,mBAAmB,CAAC,IAAY;IACvC,MAAM,CAAC,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IAC7B,IAAI,wBAAwB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAAE,OAAO,kBAAkB,CAAC;IACnF,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAAE,OAAO,SAAS,CAAC;IACjE,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,GAAY;IAC9C,MAAM,GAAG,GAAI,GAA+C,EAAE,MAAM,CAAC;IACrE,MAAM,MAAM,GAAG,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAA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IAAI,iBAAiB,CAAC;AAChG,CAAC;AAKD,MAAM,sBAAsB,GAAG,CAAC,yBAAyB,EAAE,oBAAoB,EAAE,YAAY,EAAE,kBAAkB,CAAC,CAAC;AAEnH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,GAAkB,EAClB,QAAgB,EAChB,SAAiB,EACjB,QAAgB;IAEhB,IAAI,CAAC;QACH,MAAM,GAAG,CAAC,gCAAgC,WAAW,CAAC,SAAS,CAAC,IAAI,WAAW,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;QAChH,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;IAChC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,oFAAoF;QACpF,IAAK,GAAiC,EAAE,IAAI,KAAK,CAAC;YAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;QAClF,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;QAChC,wFAAwF;QACxF,IAAI,sBAAsB,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;QAClH,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC;IAC1C,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type CommandRunner, type PushFailureKind } from './ship-git-detail.js';
|
|
2
|
+
/** The result of comparing the pushed branch's remote head against local HEAD (#735). */
|
|
3
|
+
type RemoteHeadCheck = {
|
|
4
|
+
status: 'match';
|
|
5
|
+
localSha: string;
|
|
6
|
+
remoteSha: string;
|
|
7
|
+
} | {
|
|
8
|
+
status: 'mismatch';
|
|
9
|
+
localSha: string;
|
|
10
|
+
remoteSha: string;
|
|
11
|
+
} | {
|
|
12
|
+
status: 'unreadable';
|
|
13
|
+
localSha?: string;
|
|
14
|
+
remoteSha?: string;
|
|
15
|
+
detail: string;
|
|
16
|
+
};
|
|
17
|
+
/** origin/<branch>'s current SHA, `null` when the branch is absent, or the failure detail (#1869). */
|
|
18
|
+
export declare function readRemoteBranchSha(run: CommandRunner, worktree: string, branch: string): Promise<{
|
|
19
|
+
status: 'ok';
|
|
20
|
+
sha: string | null;
|
|
21
|
+
} | {
|
|
22
|
+
status: 'unreadable';
|
|
23
|
+
detail: string;
|
|
24
|
+
}>;
|
|
25
|
+
/**
|
|
26
|
+
* A zero-exit push is not proof the remote branch actually carries this run's commits — a
|
|
27
|
+
* concurrent push or an update that silently applied nothing leaves the remote head elsewhere,
|
|
28
|
+
* and a PR opened against it would advertise work that is not there (#735).
|
|
29
|
+
*/
|
|
30
|
+
export declare function verifyRemoteHead(run: CommandRunner, worktree: string, branch: string): Promise<RemoteHeadCheck>;
|
|
31
|
+
/** Outcome of one push followed by a remote-head check, the single verified push site for SHIP (#734/#735/#1813). */
|
|
32
|
+
export type VerifiedPush = {
|
|
33
|
+
status: 'pushed';
|
|
34
|
+
localSha: string;
|
|
35
|
+
remoteSha: string;
|
|
36
|
+
} | {
|
|
37
|
+
status: 'push-failed';
|
|
38
|
+
kind: PushFailureKind;
|
|
39
|
+
detail: string;
|
|
40
|
+
} | {
|
|
41
|
+
status: 'mismatch';
|
|
42
|
+
localSha: string;
|
|
43
|
+
remoteSha: string;
|
|
44
|
+
} | {
|
|
45
|
+
status: 'unreadable';
|
|
46
|
+
localSha?: string;
|
|
47
|
+
detail: string;
|
|
48
|
+
};
|
|
49
|
+
export declare function pushAndVerifyRemoteHead(run: CommandRunner, worktree: string, branch: string, pushCmd: string): Promise<VerifiedPush>;
|
|
50
|
+
export {};
|
|
51
|
+
//# sourceMappingURL=ship-git-remote.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ship-git-remote.d.ts","sourceRoot":"","sources":["../../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,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAC3D;IAAE,MAAM,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhE,wBAAsB,uBAAuB,CAC3C,GAAG,EAAE,aAAa,EAClB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,YAAY,CAAC,CAUvB"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// packages/core/src/phases/ship-git-remote.ts — remote-head verification and verified push for SHIP
|
|
2
|
+
import { shellEscape } from '../utils/index.js';
|
|
3
|
+
import { describePushFailure, shortDetail } from './ship-git-detail.js';
|
|
4
|
+
/** The SHA on the `refs/heads/<branch>` line of `git ls-remote` output. `--heads origin <branch>`
|
|
5
|
+
* is a suffix pattern, so it can list more than one ref — match the ref name exactly rather than
|
|
6
|
+
* trusting the first line. */
|
|
7
|
+
function parseRemoteHeadSha(stdout, branch) {
|
|
8
|
+
for (const line of stdout.split('\n')) {
|
|
9
|
+
const [sha, ref] = line.trim().split(/\s+/);
|
|
10
|
+
if (ref === `refs/heads/${branch}` && sha)
|
|
11
|
+
return sha;
|
|
12
|
+
}
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
/** origin/<branch>'s current SHA, `null` when the branch is absent, or the failure detail (#1869). */
|
|
16
|
+
export async function readRemoteBranchSha(run, worktree, branch) {
|
|
17
|
+
try {
|
|
18
|
+
const { stdout } = await run(`git ls-remote --heads origin ${shellEscape(branch)}`, { cwd: worktree });
|
|
19
|
+
return { status: 'ok', sha: parseRemoteHeadSha(stdout, branch) ?? null };
|
|
20
|
+
}
|
|
21
|
+
catch (err) {
|
|
22
|
+
return { status: 'unreadable', detail: shortDetail(err) };
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A zero-exit push is not proof the remote branch actually carries this run's commits — a
|
|
27
|
+
* concurrent push or an update that silently applied nothing leaves the remote head elsewhere,
|
|
28
|
+
* and a PR opened against it would advertise work that is not there (#735).
|
|
29
|
+
*/
|
|
30
|
+
export async function verifyRemoteHead(run, worktree, branch) {
|
|
31
|
+
let localSha;
|
|
32
|
+
try {
|
|
33
|
+
const { stdout } = await run('git rev-parse HEAD', { cwd: worktree });
|
|
34
|
+
localSha = stdout.trim();
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
return { status: 'unreadable', detail: shortDetail(err) };
|
|
38
|
+
}
|
|
39
|
+
if (!localSha)
|
|
40
|
+
return { status: 'unreadable', detail: 'git rev-parse HEAD produced no SHA' };
|
|
41
|
+
let listing;
|
|
42
|
+
try {
|
|
43
|
+
const { stdout } = await run(`git ls-remote --heads origin ${shellEscape(branch)}`, { cwd: worktree });
|
|
44
|
+
listing = stdout;
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
return { status: 'unreadable', localSha, detail: shortDetail(err) };
|
|
48
|
+
}
|
|
49
|
+
const remoteSha = parseRemoteHeadSha(listing, branch);
|
|
50
|
+
if (!remoteSha)
|
|
51
|
+
return { status: 'unreadable', localSha, detail: `no refs/heads/${branch} on origin` };
|
|
52
|
+
return remoteSha === localSha
|
|
53
|
+
? { status: 'match', localSha, remoteSha }
|
|
54
|
+
: { status: 'mismatch', localSha, remoteSha };
|
|
55
|
+
}
|
|
56
|
+
export async function pushAndVerifyRemoteHead(run, worktree, branch, pushCmd) {
|
|
57
|
+
try {
|
|
58
|
+
await run(pushCmd, { cwd: worktree });
|
|
59
|
+
}
|
|
60
|
+
catch (err) {
|
|
61
|
+
return { status: 'push-failed', ...describePushFailure(err) };
|
|
62
|
+
}
|
|
63
|
+
const head = await verifyRemoteHead(run, worktree, branch);
|
|
64
|
+
if (head.status === 'match')
|
|
65
|
+
return { status: 'pushed', localSha: head.localSha, remoteSha: head.remoteSha };
|
|
66
|
+
if (head.status === 'mismatch')
|
|
67
|
+
return head;
|
|
68
|
+
return { status: 'unreadable', localSha: head.localSha, detail: head.detail };
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=ship-git-remote.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ship-git-remote.js","sourceRoot":"","sources":["../../src/phases/ship-git-remote.ts"],"names":[],"mappings":"AAAA,oGAAoG;AAEpG,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAsB,mBAAmB,EAAwB,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAQlH;;+BAE+B;AAC/B,SAAS,kBAAkB,CAAC,MAAc,EAAE,MAAc;IACxD,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACtC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC5C,IAAI,GAAG,KAAK,cAAc,MAAM,EAAE,IAAI,GAAG;YAAE,OAAO,GAAG,CAAC;IACxD,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,sGAAsG;AACtG,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,GAAkB,EAClB,QAAgB,EAChB,MAAc;IAEd,IAAI,CAAC;QACH,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,CAAC,gCAAgC,WAAW,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;QACvG,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;IAC3E,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,CAAC,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Q,EAAE,SAAS,EAAE;QAC1C,CAAC,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;AAClD,CAAC;AASD,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,GAAkB,EAClB,QAAgB,EAChB,MAAc,EACd,OAAe;IAEf,IAAI,CAAC;QACH,MAAM,GAAG,CAAC,OAAO,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;IACxC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,mBAAmB,CAAC,GAAG,CAAC,EAAE,CAAC;IAChE,CAAC;IACD,MAAM,IAAI,GAAG,MAAM,gBAAgB,CAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC3D,IAAI,IAAI,CAAC,MAAM,KAAK,OAAO;QAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC;IAC7G,IAAI,IAAI,CAAC,MAAM,KAAK,UAAU;QAAE,OAAO,IAAI,CAAC;IAC5C,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;AAChF,CAAC"}
|
|
@@ -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,19 @@
|
|
|
1
|
+
import type { WorkRequest } from '../work/index.js';
|
|
2
|
+
import { type ShipPhaseOptions } from './ship-options.js';
|
|
3
|
+
import type { ShipResult } from './ship-types.js';
|
|
4
|
+
import type { lazyWalkthrough } from './ship-walkthrough.js';
|
|
5
|
+
import { type StackPosition } from './stack-order.js';
|
|
6
|
+
export declare function openOrFindPr(ctx: {
|
|
7
|
+
opts: ShipPhaseOptions;
|
|
8
|
+
inlineWork: Pick<WorkRequest, 'id' | 'kind' | 'title' | 'reference'> | undefined;
|
|
9
|
+
stack: StackPosition | undefined;
|
|
10
|
+
base: string;
|
|
11
|
+
owner: string;
|
|
12
|
+
repoName: string;
|
|
13
|
+
walkthrough: ReturnType<typeof lazyWalkthrough>;
|
|
14
|
+
}): Promise<{
|
|
15
|
+
stop: ShipResult;
|
|
16
|
+
} | {
|
|
17
|
+
prNumber: number;
|
|
18
|
+
}>;
|
|
19
|
+
//# 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;AAEpD,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,EAAwB,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAE5E,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,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,CA+DvD"}
|