@uniqbit/mate-core 1.0.0-canary.7 → 1.0.0-canary.8
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/claude-capability-plugins/companion-mentions/.claude-plugin/plugin.json +1 -1
- package/package.json +6 -3
- package/src/cli/commands/artifact/delivery/submit.ts +6 -4
- package/src/cli/commands/artifact/finish/command.ts +28 -11
- package/src/cli/commands/artifact/pending/command.ts +71 -7
- package/src/cli/commands/cap/tokensave.ts +2 -2
- package/src/cli/commands/companion/update.ts +2 -3
- package/src/cli/commands/doctor.ts +16 -4
- package/src/cli/commands/install.ts +8 -4
- package/src/cli/commands/plugin/install.ts +82 -35
- package/src/cli/commands/studio/service-host.ts +3 -0
- package/src/cli/commands/triage.ts +32 -11
- package/src/cli/commands/vscode/release-vsix.json +2 -2
- package/src/cli/install-plan.tsx +3 -0
- package/src/cli/main.ts +51 -7
- package/src/cli/usage.ts +3 -3
- package/src/factory-host.ts +6 -0
- package/src/index.ts +1 -0
- package/src/lib/delivery/merge-git.ts +31 -7
- package/src/lib/delivery/overlap.ts +14 -1
- package/src/lib/delivery/repository-access.ts +11 -6
- package/src/lib/delivery/staging/apply-chain.ts +25 -7
- package/src/lib/delivery/staging/linked-merges.ts +175 -0
- package/src/lib/delivery/staging/naming.ts +3 -0
- package/src/lib/delivery/staging/openspec-type.ts +38 -7
- package/src/lib/delivery/staging/pending.ts +153 -11
- package/src/lib/delivery/staging/preflight.ts +239 -0
- package/src/lib/delivery/staging/project.ts +243 -104
- package/src/lib/delivery/staging/replay.ts +5 -3
- package/src/lib/delivery/staging/settle-linked.ts +5 -119
- package/src/lib/delivery/staging/submit.ts +139 -18
- package/src/lib/delivery/submit-change.ts +163 -37
- package/src/lib/friction/mark.ts +49 -11
- package/src/lib/friction/view/read.ts +10 -1
- package/src/lib/openspec-cli.ts +10 -5
- package/src/lib/skills-cli.ts +38 -0
- package/src/lib/tool-manifest.ts +73 -0
- package/src/lib/triage/context.ts +138 -12
- package/src/lib/triage/prepare.ts +19 -4
- package/src/plugin-api.ts +1 -0
- package/src/runtime/command-arg.ts +15 -0
- package/src/runtime/companion-guidance.ts +1 -1
- package/src/runtime/friction-log.ts +41 -17
- package/src/runtime/friction-recorder.ts +15 -2
- package/src/runtime/git-tracked.ts +13 -2
- package/src/studio.ts +6 -1
- package/src/templates/capabilities/openspec-cap/mate-minimal/schema.yaml +5 -1
- package/src/templates/capabilities/react-doctor/mate-react-doctor/SKILL.md +28 -0
- package/src/templates/mate-skills/agents/mate-apply-change/SKILL.md +42 -4
- package/src/templates/mate-skills/agents/mate-archive-change/SKILL.md +27 -2
- package/src/templates/mate-skills/agents/mate-backfill-spec/SKILL.md +23 -1
- package/src/templates/mate-skills/agents/mate-clarify-intent/SKILL.md +26 -1
- package/src/templates/mate-skills/agents/mate-domain-modeling/SKILL.md +28 -0
- package/src/templates/mate-skills/agents/mate-explore-change/SKILL.md +28 -3
- package/src/templates/mate-skills/agents/mate-grill-me/SKILL.md +28 -0
- package/src/templates/mate-skills/agents/mate-grill-with-docs/SKILL.md +28 -0
- package/src/templates/mate-skills/agents/mate-grilling/SKILL.md +25 -0
- package/src/templates/mate-skills/agents/mate-interview-me/SKILL.md +28 -0
- package/src/templates/mate-skills/agents/mate-propose-change/SKILL.md +28 -3
- package/src/templates/mate-skills/agents/mate-publish-artifact/SKILL.md +28 -6
- package/src/templates/mate-skills/agents/mate-show-me/SKILL.md +27 -2
- package/src/templates/mate-skills/agents/mate-simplify-code/SKILL.md +28 -0
- package/src/templates/mate-skills/agents/mate-submit-change/SKILL.md +24 -2
- package/src/templates/mate-skills/claude/mate-apply-change/SKILL.md +42 -4
- package/src/templates/mate-skills/claude/mate-archive-change/SKILL.md +27 -2
- package/src/templates/mate-skills/claude/mate-backfill-spec/SKILL.md +23 -1
- package/src/templates/mate-skills/claude/mate-clarify-intent/SKILL.md +26 -1
- package/src/templates/mate-skills/claude/mate-domain-modeling/SKILL.md +28 -0
- package/src/templates/mate-skills/claude/mate-explore-change/SKILL.md +28 -3
- package/src/templates/mate-skills/claude/mate-grill-me/SKILL.md +28 -0
- package/src/templates/mate-skills/claude/mate-grill-with-docs/SKILL.md +28 -0
- package/src/templates/mate-skills/claude/mate-grilling/SKILL.md +25 -0
- package/src/templates/mate-skills/claude/mate-interview-me/SKILL.md +28 -0
- package/src/templates/mate-skills/claude/mate-propose-change/SKILL.md +28 -3
- package/src/templates/mate-skills/claude/mate-publish-artifact/SKILL.md +28 -6
- package/src/templates/mate-skills/claude/mate-show-me/SKILL.md +27 -2
- package/src/templates/mate-skills/claude/mate-simplify-code/SKILL.md +28 -0
- package/src/templates/mate-skills/claude/mate-submit-change/SKILL.md +24 -2
- package/src/templates/triage/PLAYBOOK.md +9 -1
- package/src/tools/setup/__snapshots__/runtime-surface-golden.test.ts.snap +108 -108
- package/src/tools/setup/capabilities/graphify.ts +23 -1
- package/src/tools/setup/capabilities/rtk.ts +27 -86
- package/src/tools/setup/capabilities/tokensave.ts +76 -54
- package/src/tools/setup/dynamic-plugins/audiences.ts +28 -14
- package/src/tools/setup/dynamic-plugins/hydrate.ts +32 -14
- package/src/tools/setup/dynamic-plugins/install.ts +2 -0
- package/src/tools/setup/dynamic-plugins/installed.ts +73 -0
- package/src/tools/setup/dynamic-plugins/loader.ts +12 -10
- package/src/tools/setup/dynamic-plugins/local.ts +492 -0
- package/src/tools/setup/dynamic-plugins/paths.ts +34 -6
- package/src/tools/setup/dynamic-plugins/verify.ts +34 -14
- package/src/tools/setup/dynamic-plugins/workspaces.ts +17 -8
- package/src/tools/setup/mate.ts +26 -1
- package/src/tools/setup/plugins/gitignore.ts +45 -12
- package/src/tools/setup/service.ts +8 -0
- package/src/tools/setup/utils.ts +10 -1
- package/studio-dist/client/assets/app-ggXJ_QVh.css +2 -0
- package/studio-dist/client/assets/button-amJ3g5oD.js +1 -0
- package/studio-dist/client/assets/cn-BQPKiwI4.js +1 -0
- package/studio-dist/client/assets/combobox-CJ7aGFid.js +1 -0
- package/studio-dist/client/assets/{companion-view-DINdPF-b.js → companion-view-C_N237bf.js} +1 -1
- package/studio-dist/client/assets/fields-BAiGkJ5N.js +1 -0
- package/studio-dist/client/assets/friction-DqOU59v7.js +1 -0
- package/studio-dist/client/assets/getting-started-yp42dj5S.js +1 -0
- package/studio-dist/client/assets/{getting-started._topic-DVB8e5R9.js → getting-started._topic-C9zVXz_m.js} +1 -1
- package/studio-dist/client/assets/{getting-started.index-DQvLHEr1.js → getting-started.index-DWbDKICP.js} +1 -1
- package/studio-dist/client/assets/graph-BYaD_5Bq.js +2 -0
- package/studio-dist/client/assets/{graph-canvas-DIcAqwtK.js → graph-canvas-ySGKMhmk.js} +1 -1
- package/studio-dist/client/assets/index-Qx7reRPD.js +40 -0
- package/studio-dist/client/assets/panel-C4bf_h2W.js +1 -0
- package/studio-dist/client/assets/plugins._service._view-y6f2FDAB.js +1 -0
- package/studio-dist/client/assets/reports-JFSwSueq.js +1 -0
- package/studio-dist/client/assets/routes-BdOWSgzK.js +1 -0
- package/studio-dist/client/assets/select-BHYYWPhK.js +1 -0
- package/studio-dist/client/assets/skills-Bo9FLsBd.js +1 -0
- package/studio-dist/client/assets/{specs-Dl8HfGlU.js → specs-BrCOjOch.js} +1 -1
- package/studio-dist/client/assets/specs-view-CdE2rlli.js +1 -0
- package/studio-dist/client/assets/{store-DyXbi6o9.js → store-C3vJq8Wj.js} +1 -1
- package/studio-dist/client/assets/{usage-Blcl8kA_.js → usage-BLsLy0nN.js} +13 -13
- package/studio-dist/client/assets/{useAnchoredPopupScrollLock-BBXJpX5L.js → useAnchoredPopupScrollLock-DC7f8GOp.js} +1 -1
- package/studio-dist/client/assets/useMutation-uJUrejsi.js +1 -0
- package/studio-dist/client/assets/vault-BB1B_OhR.js +1 -0
- package/studio-dist/client/assets/warnings-CqOOGlPD.js +1 -0
- package/studio-dist/client/assets/workflow-BFzmI-06.js +1 -0
- package/studio-dist/server/assets/{__23tanstack-start-server-fn-resolver-JoHQ5ihx.js → __23tanstack-start-server-fn-resolver-gVfW5vIV.js} +1 -1
- package/studio-dist/server/assets/_tanstack-start-manifest_v.js +42 -42
- package/studio-dist/server/assets/{button-B7e1fRyW.js → button-D6bvrFmm.js} +3 -3480
- package/studio-dist/server/assets/cn-FXJAM0KO.js +5528 -0
- package/studio-dist/server/assets/{combobox--S_OmUfh.js → combobox-D2MbYV1O.js} +6 -5
- package/studio-dist/server/assets/{companion-view-D-vGM55e.js → companion-view-Mf1ANbMb.js} +2 -2
- package/studio-dist/server/assets/{fields-B4qM2ZwC.js → fields-B4mAPETz.js} +2 -1
- package/studio-dist/server/assets/{friction-sLxaWY-H.js → friction-9a5S1m7U.js} +54 -14
- package/studio-dist/server/assets/{getting-started-Cq5Pcnsr.js → getting-started-RU6tYU2Q.js} +2 -2
- package/studio-dist/server/assets/{getting-started._topic-CmWdl3u3.js → getting-started._topic-C02HGrC6.js} +2 -2
- package/studio-dist/server/assets/{getting-started.index-AB8xpTFY.js → getting-started.index-EzLRosbb.js} +2 -2
- package/studio-dist/server/assets/{graph-C_Hn-Wf_.js → graph-CZ2H9Fzr.js} +7 -6
- package/studio-dist/server/assets/{graph-canvas-BthrSmPS.js → graph-canvas-rP5TT14Z.js} +1 -1
- package/studio-dist/server/assets/{guides-BVQ4pt5B.js → guides-BGftp4wf.js} +1 -1
- package/studio-dist/server/assets/{markdown-view-rwiiVcPC.js → markdown-view-CArpV-CS.js} +1 -1
- package/studio-dist/server/assets/{panel-CUxRIpYL.js → panel-DR0iq46J.js} +4 -3
- package/studio-dist/server/assets/{plugins._service._view-BSvGnlhU.js → plugins._service._view-n7u2k5dF.js} +7 -4
- package/studio-dist/server/assets/{queries-S_Pl90IG.js → queries-D-yVP9i0.js} +1 -1
- package/studio-dist/server/assets/{reports-CJpAItPk.js → reports-C2SmTgqh.js} +6 -5
- package/studio-dist/server/assets/{router-DF0etoNa.js → router-CPt0TAk_.js} +54 -29
- package/studio-dist/server/assets/{routes-6ylCLkyg.js → routes-CwH8LEy2.js} +8 -7
- package/studio-dist/server/assets/{select-CjuKScan.js → select-C3i6TTX-.js} +5 -4
- package/studio-dist/server/assets/{shell-DLkP7wG9.js → shell-CagqZZMZ.js} +2 -1
- package/studio-dist/server/assets/{skills-zeU80A9S.js → skills-C21Mg_8-.js} +7 -6
- package/studio-dist/server/assets/{specs-DDBNT_v1.js → specs-DetoMiaB.js} +3 -3
- package/studio-dist/server/assets/{specs-view-exvmWdg0.js → specs-view-CmbfLDwN.js} +9 -8
- package/studio-dist/server/assets/{store-kS7zk0Hr.js → store-aC-I6f6o.js} +1 -1
- package/studio-dist/server/assets/{studio-queries-qOXOYoPt.js → studio-queries-Dqf-3nzj.js} +1 -1
- package/studio-dist/server/assets/{usage-C2um7YiV.js → usage-CS4CBK9D.js} +9 -9
- package/studio-dist/server/assets/{useAnchoredPopupScrollLock-kQBB3y_b.js → useAnchoredPopupScrollLock-BjMNgXv9.js} +2 -2
- package/studio-dist/server/assets/{useMutation-C-WO6hCM.js → useMutation-DpBIuWXt.js} +2 -2
- package/studio-dist/server/assets/{vault-B8vgVIH9.js → vault-DVQidlId.js} +6 -6
- package/studio-dist/server/assets/{warnings-BxK4VfV5.js → warnings-C7hgXpdk.js} +2 -1
- package/studio-dist/server/assets/{workflow-BrTK632u.js → workflow-6dZZ1ofw.js} +7 -6
- package/studio-dist/server/server.js +2 -2
- package/tool-manifest.yaml +85 -0
- package/studio-dist/client/assets/app-aIwDxf48.css +0 -2
- package/studio-dist/client/assets/button-CX0sWAJl.js +0 -1
- package/studio-dist/client/assets/combobox-BmA8RjOc.js +0 -1
- package/studio-dist/client/assets/fields-BobQ7zRF.js +0 -1
- package/studio-dist/client/assets/friction-YdYd3zaz.js +0 -1
- package/studio-dist/client/assets/getting-started-CY7NEtTw.js +0 -1
- package/studio-dist/client/assets/graph-DbNnR884.js +0 -2
- package/studio-dist/client/assets/index-CysBCSxM.js +0 -40
- package/studio-dist/client/assets/panel-Csr49lBo.js +0 -1
- package/studio-dist/client/assets/plugins._service._view-CEA_CcPe.js +0 -1
- package/studio-dist/client/assets/reports-CLdgxxkg.js +0 -1
- package/studio-dist/client/assets/routes-DGilWbDE.js +0 -1
- package/studio-dist/client/assets/select-DdebbX7K.js +0 -1
- package/studio-dist/client/assets/skills-C3zNkU8g.js +0 -1
- package/studio-dist/client/assets/specs-view-B_n0Pekv.js +0 -1
- package/studio-dist/client/assets/useBaseQuery-C2cjmeH2.js +0 -1
- package/studio-dist/client/assets/useMutation-DI6LbvVa.js +0 -1
- package/studio-dist/client/assets/vault-Cb9DmM1i.js +0 -1
- package/studio-dist/client/assets/warnings-B-rvoW8q.js +0 -1
- package/studio-dist/client/assets/workflow-DN5T19jd.js +0 -1
- package/studio-dist/server/assets/useBaseQuery--iH3rd-T.js +0 -2051
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { errorMessage } from "../../../runtime/error-message";
|
|
2
|
+
import { inboxText } from "../../../runtime/pending-records";
|
|
3
|
+
import { describeFailure, failureRemedy } from "./apply-chain";
|
|
4
|
+
import { isCommitId, readDeliveryRecord } from "../record";
|
|
5
|
+
import { sourceDir } from "./artifact-type";
|
|
6
|
+
import { byFolderPath, bySubmitOrder, deltaBase, sourcePathOf } from "./pending";
|
|
7
|
+
import {
|
|
8
|
+
chainContext,
|
|
9
|
+
runChain,
|
|
10
|
+
runMember,
|
|
11
|
+
type ChainContext,
|
|
12
|
+
type ProjectDeps,
|
|
13
|
+
type RunMember,
|
|
14
|
+
} from "./project";
|
|
15
|
+
import { defaultRef, pendingRef } from "./refs";
|
|
16
|
+
import { acceptsBlock, localPushes } from "./submit";
|
|
17
|
+
|
|
18
|
+
export type PreflightDeps = ProjectDeps & {
|
|
19
|
+
stateHome?: string;
|
|
20
|
+
/** Every group this run pushes, with the names it is given; their local folders are pushed. */
|
|
21
|
+
pushing?: ReadonlyMap<string, readonly string[]>;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* - `passed`: `message` is set when the fetch failed and the last fetched refs were read
|
|
26
|
+
* - `failed`: publication would refuse `change`, a member of the group (null: unknown)
|
|
27
|
+
* - `blocked`: publication would block the group on the stale delta of `change`, which this run
|
|
28
|
+
* pushes; only its copy on the pending branch can be resolved, so the push goes ahead
|
|
29
|
+
* - `skipped`: the group's `dependsOn` chain cannot be built or applied
|
|
30
|
+
*/
|
|
31
|
+
export type PreflightResult =
|
|
32
|
+
| { status: "passed"; message?: string }
|
|
33
|
+
| { status: "failed"; change: string | null; message: string }
|
|
34
|
+
| { status: "blocked"; change: string; message: string }
|
|
35
|
+
| { status: "skipped"; message: string };
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Archives Delivery Group `group` as publication would, before submit hands `names` to
|
|
39
|
+
* `submitGroups`: in a temporary worktree of the default branch, its unpublished `dependsOn`
|
|
40
|
+
* chain, each from the pending branch unless another group of `deps.pushing` pushes its local
|
|
41
|
+
* folder, then its members in publication order. Members are the local folders that push puts on
|
|
42
|
+
* the pending branch, then the group's other changes there, each as the push leaves it; a
|
|
43
|
+
* blocked change of `names` takes the default tip as base where the push would. Submit order is
|
|
44
|
+
* the pending branch's, then as Git lists the folders this run would add. Leaves the checkout
|
|
45
|
+
* untouched. Never throws.
|
|
46
|
+
*/
|
|
47
|
+
export async function preflightGroup(
|
|
48
|
+
companionPath: string,
|
|
49
|
+
group: string,
|
|
50
|
+
names: readonly string[],
|
|
51
|
+
deps: PreflightDeps = {},
|
|
52
|
+
): Promise<PreflightResult> {
|
|
53
|
+
let fetched = "";
|
|
54
|
+
const skipped = (cause: string): PreflightResult => ({
|
|
55
|
+
status: "skipped",
|
|
56
|
+
message: `the publication pre-flight of group ${group}${fetched} was skipped: ${cause}.`,
|
|
57
|
+
});
|
|
58
|
+
try {
|
|
59
|
+
const context = await chainContext(companionPath, deps);
|
|
60
|
+
const { type, submitted, published, remote } = context;
|
|
61
|
+
fetched = context.warning;
|
|
62
|
+
const carried = await localPushes(
|
|
63
|
+
companionPath,
|
|
64
|
+
group,
|
|
65
|
+
names,
|
|
66
|
+
new Set(submitted.map((change) => change.name)),
|
|
67
|
+
{
|
|
68
|
+
artifactType: type,
|
|
69
|
+
...(deps.git ? { git: deps.git } : {}),
|
|
70
|
+
...(deps.stateHome ? { stateHome: deps.stateHome } : {}),
|
|
71
|
+
},
|
|
72
|
+
);
|
|
73
|
+
if (carried === null) return skipped("Git could not tell which members changed locally");
|
|
74
|
+
const local = new Set(carried);
|
|
75
|
+
const members: RunMember[] = await Promise.all(
|
|
76
|
+
[
|
|
77
|
+
...carried,
|
|
78
|
+
...submitted
|
|
79
|
+
.filter((change) => change.group === group && !local.has(change.name))
|
|
80
|
+
.map((change) => change.name),
|
|
81
|
+
]
|
|
82
|
+
.filter((name) => !published.has(name))
|
|
83
|
+
.toSorted(
|
|
84
|
+
bySubmitOrder(
|
|
85
|
+
submitted.map((change) => change.name),
|
|
86
|
+
byFolderPath,
|
|
87
|
+
),
|
|
88
|
+
)
|
|
89
|
+
.map(async (name) => {
|
|
90
|
+
const copy = submitted.find((change) => change.name === name);
|
|
91
|
+
const member = runMember(
|
|
92
|
+
name,
|
|
93
|
+
local.has(name) ? await context.localDependencies(name) : null,
|
|
94
|
+
copy,
|
|
95
|
+
);
|
|
96
|
+
const rebased =
|
|
97
|
+
Boolean(copy?.blocked) &&
|
|
98
|
+
names.includes(name) &&
|
|
99
|
+
(member.source === "local" || (await pushAccepts(context, name)));
|
|
100
|
+
return { ...member, ...(rebased ? { rebased: true } : {}) };
|
|
101
|
+
}),
|
|
102
|
+
);
|
|
103
|
+
if (members.length === 0) return passed(context.fetchError, group);
|
|
104
|
+
|
|
105
|
+
// Publication refuses a change it cannot date; submit dates every folder it pushes.
|
|
106
|
+
if (remote) {
|
|
107
|
+
for (const member of members) {
|
|
108
|
+
if (member.source !== "submitted" || member.rebased || !member.submitted) continue;
|
|
109
|
+
if (member.submitted.touches.length === 0) continue;
|
|
110
|
+
// oxlint-disable-next-line no-await-in-loop -- a few members per group
|
|
111
|
+
const base = await deltaBase(
|
|
112
|
+
context.git,
|
|
113
|
+
defaultRef(remote),
|
|
114
|
+
pendingRef(remote),
|
|
115
|
+
member.submitted,
|
|
116
|
+
type,
|
|
117
|
+
);
|
|
118
|
+
if (base) continue;
|
|
119
|
+
const name = inboxText(member.name);
|
|
120
|
+
return {
|
|
121
|
+
status: "failed",
|
|
122
|
+
change: member.name,
|
|
123
|
+
message: `publication would refuse group ${group}${fetched}: the commit ${name} was written against is unknown, so what changed on ${remote.defaultBranch} since cannot be checked. Submit ${name} again with \`mate artifact submit ${name}\`.`,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Publication applies a dependency's pending copy; only one this run pushes is read here.
|
|
129
|
+
const elsewhere = await pushedElsewhere(companionPath, group, context, deps);
|
|
130
|
+
const onPending = new Set(submitted.map((change) => change.name));
|
|
131
|
+
const chainReads: ChainContext =
|
|
132
|
+
elsewhere === null
|
|
133
|
+
? context
|
|
134
|
+
: {
|
|
135
|
+
...context,
|
|
136
|
+
localDependencies: async (change) =>
|
|
137
|
+
onPending.has(change) && !elsewhere.has(change)
|
|
138
|
+
? null
|
|
139
|
+
: context.localDependencies(change),
|
|
140
|
+
};
|
|
141
|
+
const run = await runChain(
|
|
142
|
+
chainReads,
|
|
143
|
+
{ dependencies: [...new Set(members.flatMap((member) => member.dependsOn))], members },
|
|
144
|
+
async () => null,
|
|
145
|
+
);
|
|
146
|
+
if (run.status === "missing") {
|
|
147
|
+
return skipped(
|
|
148
|
+
`it depends on ${run.missing.map(inboxText).join(", ")}, which is neither here, submitted nor published`,
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
if (run.status !== "conflict") return passed(context.fetchError, group);
|
|
152
|
+
const { failure } = run;
|
|
153
|
+
// describeFailure leaves out archive's own refusal once it parsed the delta; it names what to fix.
|
|
154
|
+
const refusal =
|
|
155
|
+
failure.kind === "apply" && failure.failure ? ` (${inboxText(failure.detail)})` : "";
|
|
156
|
+
const reason = `${describeFailure(failure, run.branch)}${refusal}`;
|
|
157
|
+
const { change } = failure;
|
|
158
|
+
if (change !== null && run.chain.some((member) => member.name === change)) {
|
|
159
|
+
return skipped(`its dependencies cannot be published: ${reason}`);
|
|
160
|
+
}
|
|
161
|
+
const failing = members.find((member) => member.name === change);
|
|
162
|
+
if (failure.kind === "stale") {
|
|
163
|
+
// Its base stays as recorded, so refusing would hold it here for good.
|
|
164
|
+
if (failing?.source === "local" && !failing.submitted?.blocked) {
|
|
165
|
+
return {
|
|
166
|
+
status: "blocked",
|
|
167
|
+
change: failing.name,
|
|
168
|
+
message: `publication will block group ${group}${fetched}: ${reason}. It is pushed anyway, as only its copy on the pending branch can be resolved. ${failureRemedy(failure, [failing.name])} Do that before you publish: no member after it was checked.`,
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
return {
|
|
172
|
+
status: "failed",
|
|
173
|
+
change,
|
|
174
|
+
message: `publication would refuse group ${group}${fetched}: ${reason}. ${failureRemedy(failure, names)}`,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
return {
|
|
178
|
+
status: "failed",
|
|
179
|
+
change,
|
|
180
|
+
message: `publication would refuse group ${group}${fetched}: ${reason}.`,
|
|
181
|
+
};
|
|
182
|
+
} catch (error) {
|
|
183
|
+
return skipped(errorMessage(error));
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/** The local folders the other groups of `deps.pushing` push; null when Git cannot tell. */
|
|
188
|
+
async function pushedElsewhere(
|
|
189
|
+
companionPath: string,
|
|
190
|
+
group: string,
|
|
191
|
+
context: ChainContext,
|
|
192
|
+
deps: PreflightDeps,
|
|
193
|
+
): Promise<Set<string> | null> {
|
|
194
|
+
const found = new Set<string>();
|
|
195
|
+
const onPending = new Set(context.submitted.map((change) => change.name));
|
|
196
|
+
for (const [other, names] of deps.pushing ?? []) {
|
|
197
|
+
if (other === group) continue;
|
|
198
|
+
// oxlint-disable-next-line no-await-in-loop -- a few groups per run
|
|
199
|
+
const carried = await localPushes(companionPath, other, names, onPending, {
|
|
200
|
+
artifactType: context.type,
|
|
201
|
+
...(deps.git ? { git: deps.git } : {}),
|
|
202
|
+
...(deps.stateHome ? { stateHome: deps.stateHome } : {}),
|
|
203
|
+
});
|
|
204
|
+
if (carried === null) return null;
|
|
205
|
+
for (const name of carried) found.add(name);
|
|
206
|
+
}
|
|
207
|
+
return found;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Whether the push moves unchanged blocked `name`'s base to the default tip, deciding as
|
|
212
|
+
* `pushGroup` does: on the local record's `specBase` and the copy on the pending branch.
|
|
213
|
+
*/
|
|
214
|
+
async function pushAccepts(context: ChainContext, name: string): Promise<boolean> {
|
|
215
|
+
const { git, remote, type } = context;
|
|
216
|
+
if (!remote) return false;
|
|
217
|
+
const tip = (
|
|
218
|
+
await git.run(["rev-parse", "--verify", "-q", `${defaultRef(remote)}^{commit}`])
|
|
219
|
+
).stdout.trim();
|
|
220
|
+
const record = await readDeliveryRecord(sourceDir(context.companionPath, type, name)).catch(
|
|
221
|
+
() => null,
|
|
222
|
+
);
|
|
223
|
+
const specBase = record?.specBase;
|
|
224
|
+
if (!specBase || !isCommitId(specBase) || !isCommitId(tip)) return false;
|
|
225
|
+
const shared = await git.run(["merge-base", specBase, tip]);
|
|
226
|
+
const commit = shared.stdout.trim();
|
|
227
|
+
const base = shared.status === 0 && isCommitId(commit) ? commit : specBase;
|
|
228
|
+
if (base === tip) return false;
|
|
229
|
+
return acceptsBlock(type, git, pendingRef(remote), sourcePathOf(type, name), base, tip);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
function passed(fetchError: string | undefined, group: string): PreflightResult {
|
|
233
|
+
return fetchError
|
|
234
|
+
? {
|
|
235
|
+
status: "passed",
|
|
236
|
+
message: `the publication pre-flight of group ${group} passed on the last fetched state only; publication may still refuse it. Cause: ${fetchError}`,
|
|
237
|
+
}
|
|
238
|
+
: { status: "passed" };
|
|
239
|
+
}
|