@uniqbit/mate-core 0.20.0 → 0.21.0
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/claude-capability-plugins/companion-mentions/hooks/register.ts +1 -1
- package/claude-plugin/hooks/hooks.json +10 -1
- package/claude-plugin/hooks/rtk-worktree-git.mjs +58 -0
- package/opencode-plugin/src/server.ts +9 -2
- package/package.json +2 -1
- package/src/cli/commands/artifact/delivery/environment.ts +28 -8
- package/src/cli/commands/artifact/delivery/link.ts +28 -9
- package/src/cli/commands/artifact/delivery/output.ts +7 -0
- package/src/cli/commands/companion/update.ts +2 -19
- package/src/cli/commands/factory/factory.ts +11 -1
- package/src/cli/commands/install.ts +47 -36
- package/src/cli/commands/launch/claude.ts +2 -0
- package/src/cli/commands/launch/shared.ts +33 -6
- package/src/cli/commands/plugin/install.ts +27 -11
- package/src/cli/commands/report/index.ts +180 -184
- package/src/cli/commands/report/markdown.ts +67 -72
- package/src/cli/commands/shared/companion-selection.ts +3 -1
- package/src/cli/commands/studio/access.ts +6 -14
- package/src/cli/commands/studio/areas.ts +112 -33
- package/src/cli/commands/studio/companion-add.ts +87 -0
- package/src/cli/commands/studio/companion-removal.ts +15 -8
- package/src/cli/commands/studio/factory-credential.ts +1 -15
- package/src/cli/commands/studio/factory-git-tokens.ts +40 -0
- package/src/cli/commands/studio/factory-relay.ts +18 -0
- package/src/cli/commands/studio/graph-model.ts +61 -0
- package/src/cli/commands/studio/graph.ts +336 -0
- package/src/cli/commands/studio/index.ts +4 -4
- package/src/cli/commands/studio/payload.ts +42 -15
- package/src/cli/commands/studio/repository-add.ts +116 -0
- package/src/cli/commands/studio/routes.ts +6 -0
- package/src/cli/commands/studio/selection.ts +12 -3
- package/src/cli/commands/studio/server.ts +127 -5
- package/src/cli/commands/studio/services.ts +40 -0
- package/src/cli/commands/studio/terminal.ts +45 -3
- package/src/cli/commands/studio/views/vault/markdown-tree.ts +84 -3
- package/src/cli/commands/studio/workset-session.ts +47 -14
- package/src/cli/commands/unwrap.ts +3 -0
- package/src/cli/commands/update.ts +2 -0
- package/src/cli/commands/vscode/release-vsix.json +4 -0
- package/src/cli/commands/vscode/setup.ts +71 -13
- package/src/cli/commands/vscode/vsix.ts +48 -7
- package/src/cli/commands/working/cleanup.ts +40 -8
- package/src/cli/commands/working/worktree.ts +176 -35
- package/src/cli/main.ts +17 -2
- package/src/cli/usage.ts +1 -1
- package/src/hooks/rtk-worktree-git.ts +48 -0
- package/src/hooks/validate-artifact-path.ts +38 -7
- package/src/lib/delivery/branch-template.ts +122 -0
- package/src/lib/delivery/branches.ts +21 -16
- package/src/lib/delivery/checkout.ts +102 -0
- package/src/lib/delivery/environment.ts +2 -0
- package/src/lib/delivery/merge-git.ts +13 -1
- package/src/lib/delivery/record-delivery.ts +83 -29
- package/src/lib/delivery/record.ts +15 -3
- package/src/lib/delivery/resolve-branch.ts +157 -110
- package/src/lib/factory/attach-client.ts +11 -1
- package/src/lib/factory/broker.ts +37 -40
- package/src/lib/factory/client.ts +22 -1
- package/src/lib/factory/clone-url.ts +39 -0
- package/src/lib/factory/command.ts +21 -5
- package/src/lib/factory/git-auth.ts +61 -0
- package/src/lib/factory/git-credential-store.ts +181 -0
- package/src/lib/factory/ids.ts +12 -2
- package/src/lib/factory/outcomes/actions.ts +20 -4
- package/src/lib/factory/outcomes/index.ts +77 -11
- package/src/lib/factory/outcomes/lifecycle.ts +9 -2
- package/src/lib/factory/outcomes/sessions.ts +23 -1
- package/src/lib/factory/prepare.ts +9 -3
- package/src/lib/factory/runner/scheduler.ts +96 -14
- package/src/lib/factory/runner/workflow.ts +5 -1
- package/src/lib/factory/runtime.ts +143 -43
- package/src/lib/orchestrator/companion-hub.ts +6 -1
- package/src/lib/orchestrator/engine-floor.ts +48 -0
- package/src/lib/orchestrator/launcher.ts +34 -1
- package/src/lib/orchestrator/projection-claude-commands.ts +2 -2
- package/src/lib/orchestrator/projection-claude-entry.ts +42 -21
- package/src/lib/orchestrator/projection-claude-links.ts +32 -8
- package/src/lib/orchestrator/projection-claude-skills.ts +2 -2
- package/src/lib/orchestrator/projection-entries.ts +22 -18
- package/src/lib/orchestrator/projection-opencode-copies.ts +65 -21
- package/src/lib/orchestrator/projection-runtime-documents.ts +66 -43
- package/src/lib/orchestrator/projection-types.ts +28 -1
- package/src/lib/orchestrator/refresh-working-claude-links.ts +3 -1
- package/src/lib/orchestrator/session-prepare.ts +6 -1
- package/src/lib/orchestrator/setup-compatibilities.ts +1 -1
- package/src/lib/orchestrator/types.ts +4 -0
- package/src/lib/orchestrator/umbrella-checkouts.ts +102 -0
- package/src/lib/orchestrator/working-repo-projection.ts +24 -4
- package/src/lib/orchestrator/wrap-pass.ts +1 -0
- package/src/lib/public-npm.ts +95 -50
- package/src/lib/session-state.ts +72 -2
- package/src/lib/update-checker.ts +7 -1
- package/src/lib/usage/aggregate.ts +202 -0
- package/src/lib/usage/cache.ts +87 -0
- package/src/lib/usage/claude-pricing.ts +71 -0
- package/src/lib/usage/claude.ts +189 -0
- package/src/lib/usage/collect.ts +56 -0
- package/src/lib/usage/opencode.ts +188 -0
- package/src/lib/usage/records.ts +80 -0
- package/src/lib/usage/rtk-database.ts +72 -0
- package/src/lib/usage/savings.ts +209 -0
- package/src/lib/usage/scope.ts +182 -0
- package/src/lib/usage/source.ts +102 -0
- package/src/lib/usage/types.ts +143 -0
- package/src/lib/usage/window.ts +37 -0
- package/src/lib/workset/factory-local.ts +157 -0
- package/src/lib/workset/record.ts +25 -11
- package/src/lib/workset/repositories.ts +118 -25
- package/src/lib/workset/worktree-include.ts +161 -0
- package/src/lib/workset/worktree-index.ts +6 -2
- package/src/lib/workset/worktree.ts +591 -101
- package/src/opencode/companion-hooks.ts +46 -8
- package/src/opencode/companion-policy.ts +18 -5
- package/src/opencode/enter-worktree.ts +254 -6
- package/src/opencode/session-register.ts +2 -2
- package/src/runtime/claude-bg-isolation.ts +138 -0
- package/src/runtime/companion-git.ts +10 -2
- package/src/runtime/companion-guidance.ts +17 -4
- package/src/runtime/current-branch.ts +16 -2
- package/src/runtime/entered-worktree.ts +24 -0
- package/src/runtime/git-tracked.ts +60 -0
- package/src/runtime/repo-destination.ts +72 -0
- package/src/runtime/repo-local.ts +25 -3
- package/src/runtime/rtk-git-guard.ts +66 -0
- package/src/runtime/runtime-document-manifest.ts +229 -19
- package/src/runtime/runtime-document-manifest.typecheck.ts +10 -0
- package/src/runtime/secret-guard.ts +9 -2
- package/src/runtime/secret-policy-weakening.ts +122 -0
- package/src/runtime/serving-claude-wrap.ts +15 -2
- package/src/runtime/umbrella-folder.ts +56 -0
- package/src/runtime/wrap-state.ts +5 -13
- package/src/studio.ts +37 -0
- package/src/templates/mate-skills/agents/mate-apply-change/SKILL.md +61 -6
- package/src/templates/mate-skills/agents/mate-explore-change/SKILL.md +8 -4
- package/src/templates/mate-skills/agents/mate-propose-change/SKILL.md +9 -5
- package/src/templates/mate-skills/agents/mate-publish-artifact/SKILL.md +5 -4
- package/src/templates/mate-skills/agents/mate-show-me/SKILL.md +10 -4
- package/src/templates/mate-skills/agents/mate-simplify-code/SKILL.md +5 -1
- package/src/templates/mate-skills/claude/mate-apply-change/SKILL.md +61 -6
- package/src/templates/mate-skills/claude/mate-explore-change/SKILL.md +8 -4
- package/src/templates/mate-skills/claude/mate-propose-change/SKILL.md +9 -5
- package/src/templates/mate-skills/claude/mate-publish-artifact/SKILL.md +5 -4
- package/src/templates/mate-skills/claude/mate-show-me/SKILL.md +10 -4
- package/src/templates/mate-skills/claude/mate-simplify-code/SKILL.md +5 -1
- package/src/tools/setup/__snapshots__/runtime-surface-golden.test.ts.snap +305 -42
- package/src/tools/setup/capabilities/rtk.ts +93 -1
- package/src/tools/setup/dynamic-plugins/audiences.ts +65 -21
- package/src/tools/setup/dynamic-plugins/frozen.ts +32 -13
- package/src/tools/setup/dynamic-plugins/hydrate.ts +4 -4
- package/src/tools/setup/dynamic-plugins/install.ts +24 -22
- package/src/tools/setup/dynamic-plugins/loader.ts +11 -7
- package/src/tools/setup/dynamic-plugins/paths.ts +30 -10
- package/src/tools/setup/dynamic-plugins/verify.ts +10 -7
- package/src/tools/setup/dynamic-plugins/workspaces.ts +153 -0
- package/src/tools/setup/mate.ts +3 -3
- package/src/tools/setup/plugins/gitignore.ts +15 -9
- package/src/tools/setup/providers/claude-plugin-hooks.ts +12 -0
- package/src/tools/setup/providers/claude.ts +25 -3
- package/src/tools/setup/utils.ts +4 -2
- package/src/tools/setup/working-repo-cleanup.ts +2 -2
- package/src/tools/setup.ts +25 -14
- package/studio-dist/client/assets/app-D9cw6szy.css +2 -0
- package/studio-dist/client/assets/artifacts-WD2ZXYrx.js +1 -0
- package/studio-dist/client/assets/button-Br0O1sXw.js +1 -0
- package/studio-dist/client/assets/combobox-DA7RAUUZ.js +1 -0
- package/studio-dist/client/assets/companion-view-CrabvxS8.js +1 -0
- package/studio-dist/client/assets/factory-DGS0E16C.js +6 -0
- package/studio-dist/client/assets/fields-6aXBpFhJ.js +1 -0
- package/studio-dist/client/assets/getting-started-Clde4w6P.js +1 -0
- package/studio-dist/client/assets/getting-started-D6kgWwWZ.js +1 -0
- package/studio-dist/client/assets/getting-started._topic-BiunccbT.js +1 -0
- package/studio-dist/client/assets/getting-started.index-DpiNoGw8.js +1 -0
- package/studio-dist/client/assets/graph-B_TCBVbu.js +2 -0
- package/studio-dist/client/assets/graph-canvas-Ba37Y5AE.js +3242 -0
- package/studio-dist/client/assets/guides-Du_RtJxP.js +1 -0
- package/studio-dist/client/assets/index-Df8L1LQa.js +40 -0
- package/studio-dist/client/assets/jsx-runtime-MZURdZre.js +1 -0
- package/studio-dist/client/assets/markdown-view-BOX6x0rL.js +1 -0
- package/studio-dist/client/assets/panel-dbmCx7Mx.js +1 -0
- package/studio-dist/client/assets/queries-RvHeXY12.js +1 -0
- package/studio-dist/client/assets/react-3QStrcDO.js +27 -0
- package/studio-dist/client/assets/report-url-XRL0x1SY.js +1 -0
- package/studio-dist/client/assets/reports-r3IK7Doz.js +1 -0
- package/studio-dist/client/assets/routes-C0A5LTFc.js +1 -0
- package/studio-dist/client/assets/select-CnaMd617.js +1 -0
- package/studio-dist/client/assets/skills-CzjzHpBT.js +1 -0
- package/studio-dist/client/assets/specs-B0ldF_6J.js +1 -0
- package/studio-dist/client/assets/specs-view-BnCLA0gW.js +1 -0
- package/studio-dist/client/assets/spinner-Dcm3fqK1.js +1 -0
- package/studio-dist/client/assets/steps-C0p2N1Pb.js +1 -0
- package/studio-dist/client/assets/store-Dw34catY.js +1 -0
- package/studio-dist/client/assets/studio-Cpz_HRHp.js +100 -0
- package/studio-dist/client/assets/studio-queries-ibmpFo6R.js +2 -0
- package/studio-dist/client/assets/usage-C2QJ_0IZ.js +55 -0
- package/studio-dist/client/assets/useAnchoredPopupScrollLock-Bj-FWb8z.js +1 -0
- package/studio-dist/client/assets/useMutation-aAr2uiay.js +1 -0
- package/studio-dist/client/assets/useSelector-AYcH7lB0.js +2 -0
- package/studio-dist/client/assets/vault-BGcxkSIY.js +1 -0
- package/studio-dist/client/assets/warnings-R1cE1rLf.js +1 -0
- package/studio-dist/client/assets/workflow-C2qTrMDH.js +1 -0
- package/studio-dist/server/assets/__23tanstack-start-server-fn-resolver-Bn896ZYj.js +122 -0
- package/studio-dist/server/assets/_tanstack-start-manifest_v.js +102 -35
- package/studio-dist/server/assets/{actions-Bvgj9eb8.js → actions-DYSv-9VV.js} +10 -4
- package/studio-dist/server/assets/artifacts-DnF9L3dZ.js +216 -0
- package/studio-dist/server/assets/{button-CIJqAhni.js → button-CgOIVdmD.js} +13 -1702
- package/studio-dist/server/assets/combobox-DV_s9W0s.js +483 -0
- package/studio-dist/server/assets/{companion-view-DISASvdJ.js → companion-view-BKVXD3TO.js} +3 -3
- package/studio-dist/server/assets/companions-C7fctnU9.js +31 -0
- package/studio-dist/server/assets/{createServerRpc-tK2lE9R2.js → createServerRpc-bFKFpGFG.js} +1 -1
- package/studio-dist/server/assets/{factory-DUTa0eDs.js → factory-C7Ybg0xG.js} +1256 -353
- package/studio-dist/server/assets/{factory-DGPmNGbo.js → factory-Df5uAHjb.js} +53 -6
- package/studio-dist/server/assets/fields-BbieQTD0.js +1190 -0
- package/studio-dist/server/assets/getting-started-B136TP57.js +4 -0
- package/studio-dist/server/assets/getting-started-CRxMWorQ.js +67 -0
- package/studio-dist/server/assets/getting-started._topic-DJKQAzYl.js +13 -0
- package/studio-dist/server/assets/getting-started.index-D84gec1t.js +13 -0
- package/studio-dist/server/assets/graph-CSje3029.js +801 -0
- package/studio-dist/server/assets/graph-DDZzXM1L.js +16 -0
- package/studio-dist/server/assets/graph-canvas-22bWB5-2.js +21066 -0
- package/studio-dist/server/assets/graph-wire-BdSUx0G5.js +58 -0
- package/studio-dist/server/assets/guides-D9dk1Frq.js +13 -0
- package/studio-dist/server/assets/guides-IE-19POz.js +5 -0
- package/studio-dist/server/assets/guides.server-vcYRY5wx.js +66 -0
- package/studio-dist/server/assets/jsx-runtime-Bt0s0YKS.js +451 -0
- package/studio-dist/server/assets/{markdown-view-Bn7xPdks.js → markdown-view-BR8dJ7aR.js} +28 -9
- package/studio-dist/server/assets/{panel-3Jmn4awF.js → panel-BR_t9iMM.js} +4 -4
- package/studio-dist/server/assets/queries-DWoTin-q.js +32 -0
- package/studio-dist/server/assets/react-CdqSUhaL.js +89 -0
- package/studio-dist/server/assets/redirect-BaZ_QyqF.js +39 -0
- package/studio-dist/server/assets/report-url-BUXPcE_8.js +9 -0
- package/studio-dist/server/assets/{reports-D6YMqhnO.js → reports-CQ9qQ1-n.js} +9 -10
- package/studio-dist/server/assets/{reports-C06RXVE2.js → reports-dYDEoBeq.js} +3 -3
- package/studio-dist/server/assets/{router-C8MGqlAY.js → router-DkRHNTpE.js} +787 -2862
- package/studio-dist/server/assets/{routes-BcFgvqf7.js → routes-B6GfOew4.js} +22 -171
- package/studio-dist/server/assets/{search-JAKurDNh.js → search-BJnWLfkG.js} +21 -2
- package/studio-dist/server/assets/select-Af7Wibii.js +1609 -0
- package/studio-dist/server/assets/{shell-DS3wUexh.js → shell-Hq-hXgnT.js} +6 -5
- package/studio-dist/server/assets/{skills-BEnOxiDl.js → skills-B7nEuVbx.js} +9 -8
- package/studio-dist/server/assets/{skills-CtrBAtX3.js → skills-B_YYL7q8.js} +3 -3
- package/studio-dist/server/assets/specs-BpLUFntA.js +51 -0
- package/studio-dist/server/assets/specs-view-0peMVd22.js +426 -0
- package/studio-dist/server/assets/spinner-CdwJW4VB.js +20 -0
- package/studio-dist/server/assets/{steps-Dq_CwY_s.js → steps-D56DApvK.js} +1 -1
- package/studio-dist/server/assets/store-Cs17okNG.js +280 -0
- package/studio-dist/server/assets/studio-CAcKp3bM.js +10340 -0
- package/studio-dist/server/assets/studio-queries-BtRGzDdh.js +1451 -0
- package/studio-dist/server/assets/usage-COdjd1gD.js +25570 -0
- package/studio-dist/server/assets/usage-f6pqE1tm.js +24 -0
- package/studio-dist/server/assets/useAnchoredPopupScrollLock-DlBKHRw7.js +756 -0
- package/studio-dist/server/assets/useMutation-DzTZGenE.js +690 -0
- package/studio-dist/server/assets/{__23tanstack-start-server-fn-resolver-M2GBs8s3.js → useSelector-DUmCUXAs.js} +4 -668
- package/studio-dist/server/assets/{vault-Fvxt2Tzl.js → vault-BDuIUq0F.js} +8 -5
- package/studio-dist/server/assets/{vault-BmWnryh3.js → vault-BVLp6zu3.js} +3 -3
- package/studio-dist/server/assets/{views-BgYa-za2.js → views-flRUr21z.js} +4 -4
- package/studio-dist/server/assets/{warnings-DzR6fyZh.js → warnings-CDy9pdgL.js} +3 -2
- package/studio-dist/server/assets/{delivery-path-C29fBynY.js → workflow-D9GKI2EV.js} +132 -106
- package/studio-dist/server/server.js +582 -8
- package/src/cli/commands/report/collector.ts +0 -288
- package/studio-dist/client/assets/app-CdPiFv59.css +0 -2
- package/studio-dist/client/assets/button-BIIHE0EQ.js +0 -3
- package/studio-dist/client/assets/companion-view-DM6YyXaR.js +0 -1
- package/studio-dist/client/assets/delivery-path-DELxj0Av.js +0 -1
- package/studio-dist/client/assets/factory-BZy0E8ty.js +0 -4
- package/studio-dist/client/assets/index-B3wkMzjA.js +0 -40
- package/studio-dist/client/assets/markdown-view-pQ2Qp_i5.js +0 -1
- package/studio-dist/client/assets/panel-CbajlC3p.js +0 -1
- package/studio-dist/client/assets/prepaint-CwSrpdFA.js +0 -27
- package/studio-dist/client/assets/react-CN2GSx7x.js +0 -1
- package/studio-dist/client/assets/reports-DllhYQ5_.js +0 -1
- package/studio-dist/client/assets/rolldown-runtime-WkwZ5CU-.js +0 -1
- package/studio-dist/client/assets/routes-COm-G3mK.js +0 -1
- package/studio-dist/client/assets/skills-DmWAy-jZ.js +0 -1
- package/studio-dist/client/assets/specs-BG3Wi3ln.js +0 -1
- package/studio-dist/client/assets/steps-DFsH3Neu.js +0 -1
- package/studio-dist/client/assets/vault-B2q1nBY5.js +0 -1
- package/studio-dist/client/assets/warnings-BSXIyuSQ.js +0 -1
- package/studio-dist/client/assets/workflow-DlsQD6Hc.js +0 -1
- package/studio-dist/server/assets/companions-BYbHWKOZ.js +0 -15
- package/studio-dist/server/assets/createServerFn-F5sAOF8V.js +0 -459
- package/studio-dist/server/assets/prepaint-DJfTQ_VH.js +0 -45
- package/studio-dist/server/assets/react-Ce6dj15C.js +0 -46
- package/studio-dist/server/assets/rolldown-runtime-DYf_mQCB.js +0 -34
- package/studio-dist/server/assets/specs-C8rv34-5.js +0 -211
- package/studio-dist/server/assets/studio-BeltxxKt.js +0 -216
- package/studio-dist/server/assets/workflow-liRYecHk.js +0 -73
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { execFile } from "node:child_process";
|
|
2
1
|
import fs from "node:fs/promises";
|
|
3
2
|
import os from "node:os";
|
|
4
3
|
import path from "node:path";
|
|
5
|
-
import { promisify } from "node:util";
|
|
6
4
|
|
|
7
5
|
import { FRAMEWORK_NAME } from "../../framework";
|
|
8
|
-
import {
|
|
6
|
+
import { gitTracks } from "../../runtime/git-tracked";
|
|
7
|
+
import { repoDestination } from "../../runtime/repo-destination";
|
|
9
8
|
import {
|
|
9
|
+
CLAUDE_LOCAL_CONFIG_DOCUMENT,
|
|
10
10
|
documentRegions,
|
|
11
11
|
readManifest,
|
|
12
12
|
updateManifest,
|
|
@@ -17,6 +17,13 @@ import {
|
|
|
17
17
|
} from "../../runtime/runtime-document-manifest";
|
|
18
18
|
import { writeAtomic } from "../../runtime/write-atomic";
|
|
19
19
|
import { pruneEmptyAncestors } from "../../tools/setup/utils";
|
|
20
|
+
import {
|
|
21
|
+
removalWithWarnings,
|
|
22
|
+
writeWithWarnings,
|
|
23
|
+
type ProjectionRemovalReport,
|
|
24
|
+
type ProjectionWriteReport,
|
|
25
|
+
type ProjectionWriteState,
|
|
26
|
+
} from "./projection-types";
|
|
20
27
|
|
|
21
28
|
export {
|
|
22
29
|
CLAUDE_LOCAL_CONFIG_DOCUMENT,
|
|
@@ -41,23 +48,7 @@ export {
|
|
|
41
48
|
* else in it belongs to Claude Code.
|
|
42
49
|
*/
|
|
43
50
|
export function isExternalDocument(documentPath: string): boolean {
|
|
44
|
-
return documentPath
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const execFileAsync = promisify(execFile);
|
|
48
|
-
|
|
49
|
-
/** Whether Git tracks the repo-relative path; any `ls-files` failure reads as untracked. */
|
|
50
|
-
async function gitTracks(repoPath: string, relativePath: string): Promise<boolean> {
|
|
51
|
-
try {
|
|
52
|
-
const { stdout } = await execFileAsync("git", ["ls-files", "-z", "--", relativePath], {
|
|
53
|
-
cwd: path.resolve(repoPath),
|
|
54
|
-
encoding: "utf8",
|
|
55
|
-
env: gitEnvironment(),
|
|
56
|
-
});
|
|
57
|
-
return stdout.split("\0").includes(relativePath);
|
|
58
|
-
} catch {
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
51
|
+
return documentPath === CLAUDE_LOCAL_CONFIG_DOCUMENT;
|
|
61
52
|
}
|
|
62
53
|
|
|
63
54
|
/**
|
|
@@ -85,11 +76,19 @@ export const runtimeDocumentDeps = {
|
|
|
85
76
|
homeDir: (): string => os.homedir(),
|
|
86
77
|
};
|
|
87
78
|
|
|
88
|
-
|
|
79
|
+
/** Where a recorded document lives; `root` bounds pruning and is absent for the external one. */
|
|
80
|
+
type DocumentTarget =
|
|
81
|
+
| { kind: "inside"; path: string; root?: string }
|
|
82
|
+
| { kind: "refused"; warning: string };
|
|
83
|
+
|
|
84
|
+
function documentPathIn(repoPath: string, documentPath: string): DocumentTarget {
|
|
89
85
|
if (isExternalDocument(documentPath)) {
|
|
90
|
-
return
|
|
86
|
+
return {
|
|
87
|
+
kind: "inside",
|
|
88
|
+
path: path.join(runtimeDocumentDeps.homeDir(), ...documentPath.slice("~/".length).split("/")),
|
|
89
|
+
};
|
|
91
90
|
}
|
|
92
|
-
return
|
|
91
|
+
return repoDestination(repoPath, documentPath);
|
|
93
92
|
}
|
|
94
93
|
|
|
95
94
|
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
@@ -257,7 +256,7 @@ export async function placeRuntimeDocument(
|
|
|
257
256
|
repoPath: string,
|
|
258
257
|
documentPath: string,
|
|
259
258
|
documents?: readonly RenderedRuntimeDocument[],
|
|
260
|
-
): Promise<
|
|
259
|
+
): Promise<ProjectionWriteState | ProjectionWriteReport> {
|
|
261
260
|
/**
|
|
262
261
|
* No render at all is not an empty render: a scope that supplies no documents
|
|
263
262
|
* — a launch, which projects this entry without rendering for it — is claiming
|
|
@@ -266,13 +265,12 @@ export async function placeRuntimeDocument(
|
|
|
266
265
|
if (!documents) return "skipped";
|
|
267
266
|
|
|
268
267
|
const rendered = documents.find((candidate) => candidate.path === documentPath);
|
|
269
|
-
if (!rendered)
|
|
270
|
-
return (await removeRuntimeDocument(repoPath, documentPath)) === "removed"
|
|
271
|
-
? "written"
|
|
272
|
-
: "current";
|
|
273
|
-
}
|
|
268
|
+
if (!rendered) return asWrite(await removeRuntimeDocument(repoPath, documentPath));
|
|
274
269
|
|
|
275
|
-
const
|
|
270
|
+
const destination = documentPathIn(repoPath, documentPath);
|
|
271
|
+
/** Refused: the record stays, so nothing Mate placed earlier is forgotten. */
|
|
272
|
+
if (destination.kind === "refused") return { state: "skipped", warnings: [destination.warning] };
|
|
273
|
+
const target = destination.path;
|
|
276
274
|
const raw = await readRaw(target);
|
|
277
275
|
const document = parseDocument(raw, target);
|
|
278
276
|
|
|
@@ -295,18 +293,31 @@ export async function placeRuntimeDocument(
|
|
|
295
293
|
return "written";
|
|
296
294
|
}
|
|
297
295
|
|
|
296
|
+
/** A removal as the write of an entry whose write is that removal. */
|
|
297
|
+
export function asWrite(
|
|
298
|
+
removed: "removed" | "absent" | ProjectionRemovalReport,
|
|
299
|
+
): ProjectionWriteState | ProjectionWriteReport {
|
|
300
|
+
if (typeof removed === "string") return removed === "removed" ? "written" : "current";
|
|
301
|
+
return writeWithWarnings(
|
|
302
|
+
removed.state === "removed" ? "written" : "current",
|
|
303
|
+
removed.warnings ?? [],
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
|
|
298
307
|
/**
|
|
299
308
|
* Strips the recorded regions and leaves the document Mate found; a document
|
|
300
309
|
* left empty is deleted along with any directory Mate created to hold it.
|
|
310
|
+
* A refused destination keeps its record and warns.
|
|
301
311
|
*/
|
|
302
312
|
export async function removeRuntimeDocument(
|
|
303
313
|
repoPath: string,
|
|
304
314
|
documentPath: string,
|
|
305
|
-
): Promise<"removed" | "absent"> {
|
|
315
|
+
): Promise<"removed" | "absent" | ProjectionRemovalReport> {
|
|
306
316
|
const regions = documentRegions(await readManifest(repoPath), documentPath);
|
|
307
317
|
if (!regions) return "absent";
|
|
308
318
|
|
|
309
|
-
await revertDocumentOnDisk(repoPath, documentPath, regions);
|
|
319
|
+
const reverted = await revertDocumentOnDisk(repoPath, documentPath, regions);
|
|
320
|
+
if (reverted !== null) return removalWithWarnings("absent", [reverted]);
|
|
310
321
|
await updateManifest(repoPath, (manifest) => withoutDocuments(manifest, [documentPath]));
|
|
311
322
|
return "removed";
|
|
312
323
|
}
|
|
@@ -315,28 +326,29 @@ export async function removeRuntimeDocument(
|
|
|
315
326
|
* One document's regions, taken back out of the file that holds them. Knows
|
|
316
327
|
* nothing of the manifest, which is what lets several destinations be reverted
|
|
317
328
|
* at once: every document is a distinct file, while the manifest recording them
|
|
318
|
-
* all is not.
|
|
329
|
+
* all is not. Answers the refusal warning when the destination is refused.
|
|
319
330
|
*/
|
|
320
331
|
async function revertDocumentOnDisk(
|
|
321
332
|
repoPath: string,
|
|
322
333
|
documentPath: string,
|
|
323
334
|
regions: readonly ManagedRegion[],
|
|
324
|
-
): Promise<
|
|
325
|
-
const
|
|
335
|
+
): Promise<string | null> {
|
|
336
|
+
const destination = documentPathIn(repoPath, documentPath);
|
|
337
|
+
if (destination.kind === "refused") return destination.warning;
|
|
338
|
+
const target = destination.path;
|
|
326
339
|
const raw = await readRaw(target);
|
|
327
|
-
if (raw === null) return;
|
|
340
|
+
if (raw === null) return null;
|
|
328
341
|
|
|
329
342
|
const document = parseDocument(raw, target);
|
|
330
343
|
for (const region of regions) revertRegion(document, region);
|
|
331
|
-
if (Object.keys(document).length === 0 &&
|
|
344
|
+
if (Object.keys(document).length === 0 && destination.root !== undefined) {
|
|
332
345
|
await fs.unlink(target);
|
|
333
346
|
const holder = path.dirname(target);
|
|
334
|
-
if (holder !==
|
|
335
|
-
await pruneEmptyAncestors(holder, path.resolve(repoPath));
|
|
336
|
-
}
|
|
347
|
+
if (holder !== destination.root) await pruneEmptyAncestors(holder, destination.root);
|
|
337
348
|
} else {
|
|
338
349
|
await writeAtomic(target, serialize(document));
|
|
339
350
|
}
|
|
351
|
+
return null;
|
|
340
352
|
}
|
|
341
353
|
|
|
342
354
|
/**
|
|
@@ -355,11 +367,16 @@ async function revertDocumentOnDisk(
|
|
|
355
367
|
export async function removeRuntimeDocuments(
|
|
356
368
|
repoPath: string,
|
|
357
369
|
documentPaths: readonly string[],
|
|
358
|
-
): Promise<{
|
|
370
|
+
): Promise<{
|
|
371
|
+
removed: string[];
|
|
372
|
+
absent: string[];
|
|
373
|
+
warnings: string[];
|
|
374
|
+
error?: { document: string; error: Error };
|
|
375
|
+
}> {
|
|
359
376
|
const manifest = await readManifest(repoPath);
|
|
360
377
|
const recorded = documentPaths.filter((candidate) => documentRegions(manifest, candidate));
|
|
361
378
|
const absent = documentPaths.filter((candidate) => !documentRegions(manifest, candidate));
|
|
362
|
-
if (recorded.length === 0) return { removed: [], absent };
|
|
379
|
+
if (recorded.length === 0) return { removed: [], absent, warnings: [] };
|
|
363
380
|
|
|
364
381
|
const settled = await Promise.allSettled(
|
|
365
382
|
recorded.map((documentPath) =>
|
|
@@ -368,6 +385,7 @@ export async function removeRuntimeDocuments(
|
|
|
368
385
|
);
|
|
369
386
|
|
|
370
387
|
const removed: string[] = [];
|
|
388
|
+
const warnings: string[] = [];
|
|
371
389
|
let failure: { document: string; error: Error } | undefined;
|
|
372
390
|
for (const [index, result] of settled.entries()) {
|
|
373
391
|
const documentPath = recorded[index]!;
|
|
@@ -378,9 +396,14 @@ export async function removeRuntimeDocuments(
|
|
|
378
396
|
};
|
|
379
397
|
continue;
|
|
380
398
|
}
|
|
399
|
+
/** Refused: not a failure, and the record stays. */
|
|
400
|
+
if (result.value !== null) {
|
|
401
|
+
warnings.push(result.value);
|
|
402
|
+
continue;
|
|
403
|
+
}
|
|
381
404
|
removed.push(documentPath);
|
|
382
405
|
}
|
|
383
406
|
|
|
384
407
|
await updateManifest(repoPath, (current) => withoutDocuments(current, removed));
|
|
385
|
-
return { removed, absent, ...(failure ? { error: failure } : {}) };
|
|
408
|
+
return { removed, absent, warnings, ...(failure ? { error: failure } : {}) };
|
|
386
409
|
}
|
|
@@ -86,9 +86,10 @@ export interface ProjectionWriteReport {
|
|
|
86
86
|
* What a `self` removal may return instead of a bare state, when it kept
|
|
87
87
|
* shared exclude lines another Checkout of the clone still needs: `retained`
|
|
88
88
|
* when it kept everything it would have removed, `removed` when only part.
|
|
89
|
+
* Also how a removal that has only warnings reports them.
|
|
89
90
|
*/
|
|
90
91
|
export interface ProjectionRemovalReport {
|
|
91
|
-
state: "removed" | "retained";
|
|
92
|
+
state: "removed" | "retained" | "absent";
|
|
92
93
|
/** The kept lines. */
|
|
93
94
|
kept: string[];
|
|
94
95
|
/** Paths of the Checkouts that still need them. */
|
|
@@ -99,6 +100,28 @@ export interface ProjectionRemovalReport {
|
|
|
99
100
|
/** What a `self` removal returns. */
|
|
100
101
|
export type ProjectionSelfRemoval = "removed" | "absent" | ProjectionRemovalReport;
|
|
101
102
|
|
|
103
|
+
/** A write state carrying warnings; the bare state when there are none. */
|
|
104
|
+
export function writeWithWarnings(
|
|
105
|
+
written: ProjectionWriteState | ProjectionWriteReport,
|
|
106
|
+
warnings: readonly string[],
|
|
107
|
+
): ProjectionWriteState | ProjectionWriteReport {
|
|
108
|
+
if (warnings.length === 0) return written;
|
|
109
|
+
if (typeof written === "string") return { state: written, warnings: [...warnings] };
|
|
110
|
+
return { ...written, warnings: [...(written.warnings ?? []), ...warnings] };
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** A removal state carrying warnings; the bare state when there are none. */
|
|
114
|
+
export function removalWithWarnings(
|
|
115
|
+
removed: ProjectionSelfRemoval,
|
|
116
|
+
warnings: readonly string[],
|
|
117
|
+
): ProjectionSelfRemoval {
|
|
118
|
+
if (warnings.length === 0) return removed;
|
|
119
|
+
if (typeof removed === "string") {
|
|
120
|
+
return { state: removed, kept: [], keptFor: [], warnings: [...warnings] };
|
|
121
|
+
}
|
|
122
|
+
return { ...removed, warnings: [...(removed.warnings ?? []), ...warnings] };
|
|
123
|
+
}
|
|
124
|
+
|
|
102
125
|
/** A shared exclude-file edit as a removal outcome. */
|
|
103
126
|
export function excludeRemovalReport(result: ExcludeEditResult): ProjectionSelfRemoval {
|
|
104
127
|
if (result.kept.length === 0) return result.changed ? "removed" : "absent";
|
|
@@ -177,11 +200,15 @@ export interface ProjectionResult {
|
|
|
177
200
|
root: string;
|
|
178
201
|
scope: ProjectionScope;
|
|
179
202
|
outcomes: ProjectionEntryOutcome[];
|
|
203
|
+
/** About the pass rather than one entry, such as records the manifest had ignored. */
|
|
204
|
+
warnings: string[];
|
|
180
205
|
}
|
|
181
206
|
|
|
182
207
|
export interface ProjectionRemovalResult {
|
|
183
208
|
root: string;
|
|
184
209
|
outcomes: ProjectionEntryOutcome[];
|
|
210
|
+
/** About the pass rather than one entry, such as records the manifest had ignored. */
|
|
211
|
+
warnings: string[];
|
|
185
212
|
}
|
|
186
213
|
|
|
187
214
|
export interface ProjectionEntryPresence {
|
|
@@ -73,7 +73,9 @@ export async function refreshWorkingClaudeLinks(
|
|
|
73
73
|
enabled,
|
|
74
74
|
registered,
|
|
75
75
|
);
|
|
76
|
-
const written = skills
|
|
76
|
+
const written = [skills, commands].some(
|
|
77
|
+
(result) => (typeof result === "string" ? result : result.state) === "written",
|
|
78
|
+
);
|
|
77
79
|
results.push({ repository, outcome: written ? "written" : "current" });
|
|
78
80
|
} catch (error) {
|
|
79
81
|
results.push({
|
|
@@ -318,6 +318,11 @@ async function projectClaude(
|
|
|
318
318
|
companionPath: input.companionPath,
|
|
319
319
|
config,
|
|
320
320
|
});
|
|
321
|
+
// The launch pass rewrites the manifest, so the wrap pass below no longer sees what it dropped.
|
|
322
|
+
run.warnings.push(
|
|
323
|
+
...(result.warnings ?? []),
|
|
324
|
+
...result.outcomes.flatMap((outcome) => outcome.warnings ?? []),
|
|
325
|
+
);
|
|
321
326
|
for (const outcome of result.outcomes) {
|
|
322
327
|
if (outcome.state === "failed" && outcome.degradable) {
|
|
323
328
|
run.warnings.push(entryFailureMessage(outcome, repository.id));
|
|
@@ -464,7 +469,7 @@ export async function prepareSession(input: PrepareSessionInput): Promise<Prepar
|
|
|
464
469
|
...(input.repository ? { repositoryId: input.repository.id } : {}),
|
|
465
470
|
companionPath: input.companionPath,
|
|
466
471
|
steps: run.steps,
|
|
467
|
-
warnings: run.warnings,
|
|
472
|
+
warnings: [...new Set(run.warnings)],
|
|
468
473
|
...(run.companionChanged ? { companionChanged: true as const } : {}),
|
|
469
474
|
...(run.failure === undefined ? {} : { failure: run.failure }),
|
|
470
475
|
...(run.wrapState ? { wrapState: run.wrapState } : {}),
|
|
@@ -48,7 +48,7 @@ const TICKET_COMPATIBILITIES: TicketCompatibility[] = [
|
|
|
48
48
|
id: "jira",
|
|
49
49
|
label: "Jira",
|
|
50
50
|
description:
|
|
51
|
-
"Propose, apply, and archive ask for an optional Jira key (ABC-123), which
|
|
51
|
+
"Propose, apply, and archive ask for an optional Jira key (ABC-123), which goes into the Delivery Branch template (default workset/<KEY>-<workset-id>).",
|
|
52
52
|
},
|
|
53
53
|
];
|
|
54
54
|
|
|
@@ -74,6 +74,8 @@ export interface CapabilityConfig {
|
|
|
74
74
|
protectedBranches?: string[];
|
|
75
75
|
/** openspec only: how changes record tickets; absent means `none`. */
|
|
76
76
|
ticket?: string;
|
|
77
|
+
/** openspec only: Delivery Branch template with `{workset}` and optional `{ticket}`. */
|
|
78
|
+
branchTemplate?: string;
|
|
77
79
|
}
|
|
78
80
|
|
|
79
81
|
export type FrameworkType = "working" | "companion" | "hub";
|
|
@@ -174,6 +176,8 @@ export interface LaunchRequest {
|
|
|
174
176
|
scope?: LaunchScope;
|
|
175
177
|
skipGit?: boolean;
|
|
176
178
|
interactiveGit?: boolean;
|
|
179
|
+
/** The launch's preparation already ran and was reported; its notices are not repeated. */
|
|
180
|
+
quiet?: boolean;
|
|
177
181
|
}
|
|
178
182
|
|
|
179
183
|
export interface LaunchResult {
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
import { promisify } from "node:util";
|
|
3
|
+
|
|
4
|
+
import { gitEnvironment } from "../../runtime/companion-git";
|
|
5
|
+
import { readGitLayout } from "../../runtime/git-layout";
|
|
6
|
+
import { umbrellaChildFolders } from "../../runtime/umbrella-folder";
|
|
7
|
+
import { parseRemote, type ForgeRepo } from "../delivery/forge";
|
|
8
|
+
|
|
9
|
+
export {
|
|
10
|
+
mirroredUmbrellaOf,
|
|
11
|
+
umbrellaFolderOf,
|
|
12
|
+
umbrellaMirroredBy,
|
|
13
|
+
} from "../../runtime/umbrella-folder";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Umbrella Repositories: a linked folder that is no Git checkout itself and whose
|
|
17
|
+
* direct children are. Derived from the filesystem on every lookup; the registry
|
|
18
|
+
* records nothing about it.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
const execFileAsync = promisify(execFile);
|
|
22
|
+
|
|
23
|
+
/** A checkout a registry entry stands for. */
|
|
24
|
+
export interface EntryCheckout {
|
|
25
|
+
path: string;
|
|
26
|
+
/** The `origin` URL as `readOrigin` returned it; null without one. */
|
|
27
|
+
origin: string | null;
|
|
28
|
+
/** The forge repository `origin` names; null without one or for another host form. */
|
|
29
|
+
remote: ForgeRepo | null;
|
|
30
|
+
/** The Umbrella Repository holding the checkout; absent for the entry itself. */
|
|
31
|
+
umbrella?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Reads a checkout's `origin` URL; null without one. */
|
|
35
|
+
export type OriginReader = (checkout: string) => Promise<string | null>;
|
|
36
|
+
|
|
37
|
+
/** Raw config, not `remote get-url`, so `insteadOf` rewrites do not change the identity. */
|
|
38
|
+
const rawOrigin: OriginReader = async (checkout) => {
|
|
39
|
+
try {
|
|
40
|
+
const { stdout } = await execFileAsync("git", ["config", "--get", "remote.origin.url"], {
|
|
41
|
+
cwd: checkout,
|
|
42
|
+
env: gitEnvironment(),
|
|
43
|
+
});
|
|
44
|
+
return stdout.trim() || null;
|
|
45
|
+
} catch {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The Umbrella Repository's children at `folder`, in name order: direct child folders
|
|
52
|
+
* with a Git layout, an `origin` that names a forge repository, and no Repository
|
|
53
|
+
* Link of their own (theirs wins). Empty when `folder` is a Git checkout, so it is no
|
|
54
|
+
* umbrella.
|
|
55
|
+
*/
|
|
56
|
+
export async function umbrellaChildrenOf(
|
|
57
|
+
folder: string,
|
|
58
|
+
readOrigin: OriginReader = rawOrigin,
|
|
59
|
+
): Promise<EntryCheckout[]> {
|
|
60
|
+
if (readGitLayout(folder)) return [];
|
|
61
|
+
const candidates = umbrellaChildFolders(folder);
|
|
62
|
+
const children = await mapBounded(candidates, async (child): Promise<EntryCheckout | null> => {
|
|
63
|
+
const origin = await readOrigin(child);
|
|
64
|
+
const remote = origin ? parseRemote(origin) : null;
|
|
65
|
+
return remote ? { path: child, origin, remote, umbrella: folder } : null;
|
|
66
|
+
});
|
|
67
|
+
return children.filter((child): child is EntryCheckout => child !== null);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** Git subprocesses at once: a broad folder such as `~/src` may hold hundreds of clones. */
|
|
71
|
+
const ORIGIN_READS = 8;
|
|
72
|
+
|
|
73
|
+
/** `map` over `items` in order, at most `ORIGIN_READS` at a time. */
|
|
74
|
+
async function mapBounded<T, R>(items: readonly T[], map: (item: T) => Promise<R>): Promise<R[]> {
|
|
75
|
+
const results: R[] = Array.from({ length: items.length });
|
|
76
|
+
let next = 0;
|
|
77
|
+
const worker = async (): Promise<void> => {
|
|
78
|
+
while (next < items.length) {
|
|
79
|
+
const at = next++;
|
|
80
|
+
// oxlint-disable-next-line no-await-in-loop -- each worker reads one child at a time
|
|
81
|
+
results[at] = await map(items[at]!);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
await Promise.all(Array.from({ length: Math.min(ORIGIN_READS, items.length) }, worker));
|
|
85
|
+
return results;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* The checkouts a registry entry stands for: an Umbrella Repository's children, else
|
|
90
|
+
* the entry's own folder, with its `origin` when it has one. `readChildOrigin` reads the
|
|
91
|
+
* children, raw config by default so every caller gives a child the same identity.
|
|
92
|
+
*/
|
|
93
|
+
export async function linkedCheckoutsOf(
|
|
94
|
+
entry: { path: string },
|
|
95
|
+
readOrigin: OriginReader = rawOrigin,
|
|
96
|
+
readChildOrigin: OriginReader = rawOrigin,
|
|
97
|
+
): Promise<EntryCheckout[]> {
|
|
98
|
+
const children = await umbrellaChildrenOf(entry.path, readChildOrigin);
|
|
99
|
+
if (children.length > 0) return children;
|
|
100
|
+
const origin = await readOrigin(entry.path);
|
|
101
|
+
return [{ path: entry.path, origin, remote: origin ? parseRemote(origin) : null }];
|
|
102
|
+
}
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
copies as recordedCopies,
|
|
11
11
|
documents as recordedDocuments,
|
|
12
12
|
readManifest,
|
|
13
|
+
readManifestNotices,
|
|
13
14
|
} from "../../runtime/runtime-document-manifest";
|
|
14
15
|
import { removeRuntimeDocuments } from "./projection-runtime-documents";
|
|
15
16
|
import {
|
|
@@ -103,6 +104,8 @@ export async function project(
|
|
|
103
104
|
input: ProjectionInput,
|
|
104
105
|
): Promise<ProjectionResult> {
|
|
105
106
|
const outcomes: ProjectionEntryOutcome[] = [];
|
|
107
|
+
/** Read before any entry rewrites the manifest and drops what it ignored. */
|
|
108
|
+
const warnings = await readManifestNotices(input.repoPath);
|
|
106
109
|
const runtimes = input.runtimes ? new Set(input.runtimes) : null;
|
|
107
110
|
for (const entry of projectionEntries()) {
|
|
108
111
|
if (!entry.scopes.includes(scope)) continue;
|
|
@@ -114,7 +117,7 @@ export async function project(
|
|
|
114
117
|
outcomes.push(outcome(entry, "failed", toError(error)));
|
|
115
118
|
}
|
|
116
119
|
}
|
|
117
|
-
return { root: repoLocalDirPath(input.repoPath), scope, outcomes };
|
|
120
|
+
return { root: repoLocalDirPath(input.repoPath), scope, outcomes, warnings };
|
|
118
121
|
}
|
|
119
122
|
|
|
120
123
|
/**
|
|
@@ -124,6 +127,8 @@ export async function project(
|
|
|
124
127
|
*/
|
|
125
128
|
export async function unproject(input: ProjectionRemovalInput): Promise<ProjectionRemovalResult> {
|
|
126
129
|
const outcomes: ProjectionEntryOutcome[] = [];
|
|
130
|
+
/** Read before the Projection Root, manifest included, is removed. */
|
|
131
|
+
const warnings = await readManifestNotices(input.repoPath);
|
|
127
132
|
for (const entry of projectionEntries().toReversed()) {
|
|
128
133
|
const { removal } = entry;
|
|
129
134
|
if (removal.by === "entry") {
|
|
@@ -142,7 +147,7 @@ export async function unproject(input: ProjectionRemovalInput): Promise<Projecti
|
|
|
142
147
|
outcomes.push(outcome(entry, "failed", toError(error)));
|
|
143
148
|
}
|
|
144
149
|
}
|
|
145
|
-
return { root: repoLocalDirPath(input.repoPath), outcomes };
|
|
150
|
+
return { root: repoLocalDirPath(input.repoPath), outcomes, warnings };
|
|
146
151
|
}
|
|
147
152
|
|
|
148
153
|
/**
|
|
@@ -231,6 +236,8 @@ export type UnwrapResult =
|
|
|
231
236
|
documents: string[];
|
|
232
237
|
copies: string[];
|
|
233
238
|
kept?: UnwrapKeptLines;
|
|
239
|
+
/** Ignored manifest records and refused destinations, for the caller to present. */
|
|
240
|
+
warnings: string[];
|
|
234
241
|
}
|
|
235
242
|
| { kind: "failed"; document: string; error: Error };
|
|
236
243
|
|
|
@@ -262,8 +269,14 @@ export async function unwrapWorkingRuntimeDocuments(
|
|
|
262
269
|
repoPath: string,
|
|
263
270
|
globalConfigStore: GlobalConfigStore = new GlobalConfigStore(),
|
|
264
271
|
): Promise<UnwrapResult> {
|
|
272
|
+
const notices = await readManifestNotices(repoPath);
|
|
265
273
|
const manifest = await readManifest(repoPath);
|
|
266
274
|
const documents = recordedDocuments(manifest);
|
|
275
|
+
const warningsOf = (outcomes: ProjectionEntryOutcome[], refused: string[] = []): string[] => [
|
|
276
|
+
...notices,
|
|
277
|
+
...refused,
|
|
278
|
+
...outcomes.flatMap((entry) => entry.warnings ?? []),
|
|
279
|
+
];
|
|
267
280
|
const copies = Object.keys(recordedCopies(manifest));
|
|
268
281
|
const removeWrapEntries = async (): Promise<ProjectionEntryOutcome[]> =>
|
|
269
282
|
removeWorkingRepositoryUnwrapEntries(repoPath, await globalConfigStore.list());
|
|
@@ -283,6 +296,7 @@ export async function unwrapWorkingRuntimeDocuments(
|
|
|
283
296
|
documents: [],
|
|
284
297
|
copies: removedAny ? copies : [],
|
|
285
298
|
...keptLines(outcomes),
|
|
299
|
+
warnings: warningsOf(outcomes),
|
|
286
300
|
};
|
|
287
301
|
}
|
|
288
302
|
|
|
@@ -293,7 +307,7 @@ export async function unwrapWorkingRuntimeDocuments(
|
|
|
293
307
|
* a surviving key reads back as still wrapped — leaving a launch refused after
|
|
294
308
|
* a successful unwrap.
|
|
295
309
|
*/
|
|
296
|
-
const { removed, error } = await removeRuntimeDocuments(repoPath, documents);
|
|
310
|
+
const { removed, warnings: refused, error } = await removeRuntimeDocuments(repoPath, documents);
|
|
297
311
|
/** Reported after the successful withdrawals are already durable. */
|
|
298
312
|
if (error) return { kind: "failed", document: error.document, error: error.error };
|
|
299
313
|
const outcomes = await removeWrapEntries();
|
|
@@ -305,7 +319,13 @@ export async function unwrapWorkingRuntimeDocuments(
|
|
|
305
319
|
error: failure.error ?? new Error("wrap entry removal failed"),
|
|
306
320
|
};
|
|
307
321
|
}
|
|
308
|
-
return {
|
|
322
|
+
return {
|
|
323
|
+
kind: "unwrapped",
|
|
324
|
+
documents: removed,
|
|
325
|
+
copies,
|
|
326
|
+
...keptLines(outcomes),
|
|
327
|
+
warnings: warningsOf(outcomes, refused),
|
|
328
|
+
};
|
|
309
329
|
}
|
|
310
330
|
|
|
311
331
|
/**
|
|
@@ -143,6 +143,7 @@ export async function runWrapPass(
|
|
|
143
143
|
},
|
|
144
144
|
warnings: [
|
|
145
145
|
...rendered.warnings,
|
|
146
|
+
...result.warnings,
|
|
146
147
|
...result.outcomes.flatMap((outcome) => outcome.warnings ?? []),
|
|
147
148
|
/** A degradable failure does not fail the pass, but it is never silent. */
|
|
148
149
|
...result.outcomes
|