@uniqbit/mate-core 1.0.0-canary.3 → 1.0.0-canary.6
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 +61 -1
- package/claude-plugin/hooks/rtk-worktree-git.mjs +58 -0
- package/claude-plugin/hooks/session-attention.mjs +10 -0
- package/claude-plugin/hooks/session-end.mjs +9 -0
- package/claude-plugin/hooks/session-guidance.mjs +1 -1
- package/claude-plugin/hooks/workflow-turn.mjs +68 -0
- package/opencode-plugin/src/companion.ts +6 -0
- package/opencode-plugin/src/server.ts +46 -4
- package/package.json +5 -2
- package/src/cli/commands/artifact/apply-context.ts +1 -0
- package/src/cli/commands/artifact/artifact.ts +16 -0
- package/src/cli/commands/artifact/delivery/archive.ts +37 -112
- package/src/cli/commands/artifact/delivery/branch-flags.ts +19 -1
- package/src/cli/commands/artifact/delivery/environment.ts +32 -72
- package/src/cli/commands/artifact/delivery/link.ts +69 -33
- package/src/cli/commands/artifact/delivery/output.ts +34 -5
- package/src/cli/commands/artifact/delivery/resolve.ts +101 -0
- package/src/cli/commands/artifact/delivery/submit.ts +164 -0
- package/src/cli/commands/artifact/delivery/take.ts +45 -0
- package/src/cli/commands/artifact/extract-repo-name.ts +1 -1
- package/src/cli/commands/artifact/finish/command.ts +455 -43
- package/src/cli/commands/artifact/finish/engine.ts +79 -61
- package/src/cli/commands/artifact/finish/finisher.ts +5 -12
- package/src/cli/commands/artifact/finish/git.ts +9 -10
- package/src/cli/commands/artifact/finish/openspec.ts +22 -177
- package/src/cli/commands/artifact/finish/secret-scan.ts +5 -43
- package/src/cli/commands/artifact/finish/worktree-cleanup.ts +57 -7
- package/src/cli/commands/artifact/pending/command.ts +119 -6
- package/src/cli/commands/artifact/pending/discovery.ts +7 -11
- package/src/cli/commands/artifact/project/command.ts +60 -0
- package/src/cli/commands/companion/companion.ts +1 -1
- package/src/cli/commands/companion/link.ts +36 -4
- package/src/cli/commands/companion/list.ts +70 -14
- package/src/cli/commands/companion/open.ts +40 -12
- package/src/cli/commands/companion/sync.ts +18 -0
- package/src/cli/commands/companion/update.ts +4 -19
- package/src/cli/commands/doctor.ts +122 -0
- package/src/cli/commands/install.ts +48 -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/session/prepare.ts +32 -4
- package/src/cli/commands/session/registry.ts +90 -0
- 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 +72 -0
- package/src/cli/commands/studio/companion-removal.ts +86 -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/{lib/factory/outcomes/sessions.ts → cli/commands/studio/live-sessions.ts} +26 -2
- package/src/cli/commands/studio/mate-inventory.ts +1 -1
- package/src/cli/commands/studio/payload.ts +223 -30
- package/src/cli/commands/studio/reports.ts +19 -18
- package/src/cli/commands/studio/routes.ts +5 -18
- package/src/cli/commands/studio/selection.ts +12 -5
- package/src/cli/commands/studio/server.ts +321 -198
- package/src/cli/commands/studio/service-host.ts +266 -0
- package/src/cli/commands/studio/services.ts +54 -16
- package/src/cli/commands/studio/skill-files.ts +133 -0
- package/src/cli/commands/studio/studio-app.ts +1 -0
- package/src/cli/commands/studio/terminal.ts +45 -3
- package/src/cli/commands/studio/vault.ts +259 -84
- package/src/cli/commands/studio/views/model.ts +1 -14
- package/src/cli/commands/studio/views/vault/markdown-tree.ts +343 -10
- package/src/cli/commands/unwrap.ts +11 -0
- package/src/cli/commands/update.ts +28 -8
- package/src/cli/commands/vscode/release-vsix.json +4 -0
- package/src/cli/commands/vscode/setup.ts +213 -0
- package/src/cli/commands/vscode/vsix.ts +114 -0
- package/src/cli/commands/workflow/workflow.ts +516 -0
- package/src/cli/commands/working/cleanup.ts +73 -17
- package/src/cli/commands/working/worktree.ts +227 -36
- package/src/cli/commands/wrap.ts +33 -7
- package/src/cli/main.ts +48 -12
- package/src/cli/repo-list-table.tsx +73 -37
- package/src/cli/usage.ts +25 -9
- package/src/factory-host.ts +69 -0
- package/src/hooks/companion-instructions.ts +35 -16
- package/src/hooks/hook-io.ts +18 -1
- package/src/hooks/rtk-worktree-git.ts +48 -0
- package/src/hooks/session-banner.ts +30 -3
- package/src/hooks/session-end.ts +10 -0
- package/src/hooks/session-guidance.ts +10 -6
- package/src/hooks/session-prepare.ts +47 -31
- package/src/hooks/session-register.ts +199 -0
- package/src/hooks/tokensave-route.ts +7 -3
- package/src/hooks/validate-artifact-path.ts +53 -14
- package/src/hooks/workflow-turn.ts +219 -0
- package/src/lib/apply-context/fingerprint.ts +2 -1
- package/src/lib/apply-context/protocol.ts +2 -2
- package/src/lib/artifact-trailer.ts +27 -0
- package/src/lib/change-layout.ts +83 -38
- package/src/lib/delivery/branch-template.ts +114 -0
- package/src/lib/delivery/branches.ts +34 -14
- package/src/lib/delivery/checkout.ts +103 -0
- package/src/lib/delivery/environment.ts +131 -7
- package/src/lib/delivery/merge-git.ts +282 -26
- package/src/lib/delivery/overlap.ts +68 -16
- package/src/lib/delivery/record-delivery.ts +253 -57
- package/src/lib/delivery/record.ts +229 -53
- package/src/lib/delivery/refresh.ts +222 -141
- package/src/lib/delivery/remote.ts +66 -0
- package/src/lib/delivery/repository-access.ts +19 -60
- package/src/lib/delivery/resolve-branch.ts +318 -50
- package/src/lib/delivery/stages.ts +83 -50
- package/src/lib/delivery/staging/apply-chain.ts +164 -0
- package/src/lib/delivery/staging/artifact-type.ts +101 -0
- package/src/lib/delivery/staging/declared-type.ts +277 -0
- package/src/lib/delivery/staging/naming.ts +64 -0
- package/src/lib/delivery/staging/openspec-type.ts +135 -0
- package/src/lib/delivery/staging/pending-edit.ts +291 -0
- package/src/lib/delivery/staging/pending.ts +780 -0
- package/src/lib/delivery/staging/project.ts +373 -0
- package/src/lib/delivery/staging/publish.ts +1024 -0
- package/src/lib/delivery/staging/refs.ts +258 -0
- package/src/lib/delivery/staging/registry.ts +73 -0
- package/src/lib/delivery/staging/replay.ts +308 -0
- package/src/lib/delivery/staging/requirement-blocks.ts +10 -0
- package/src/lib/delivery/staging/resolve.ts +264 -0
- package/src/lib/delivery/staging/settle-linked.ts +290 -0
- package/src/lib/delivery/staging/submit.ts +929 -0
- package/src/lib/delivery/staging/worktree.ts +130 -0
- package/src/lib/delivery/submit-change.ts +443 -0
- package/src/lib/git-key.ts +15 -0
- package/src/lib/install.ts +2 -0
- package/src/lib/opencode-server.ts +238 -0
- package/src/lib/openspec-canonical-frontmatter.ts +159 -0
- package/src/lib/orchestrator/adapters/base.ts +31 -20
- package/src/lib/orchestrator/adapters/claude.ts +162 -4
- package/src/lib/orchestrator/adapters/opencode.ts +55 -2
- package/src/lib/orchestrator/checkout-adoption.ts +125 -0
- package/src/lib/orchestrator/companion-git-sync.ts +152 -16
- package/src/lib/orchestrator/companion-hub.ts +6 -1
- package/src/lib/orchestrator/companion-registry-store.ts +6 -2
- package/src/lib/orchestrator/editor.ts +2 -2
- package/src/lib/orchestrator/engine-floor.ts +48 -0
- package/src/lib/orchestrator/framework-context.ts +41 -15
- package/src/lib/orchestrator/global-config-store.ts +11 -0
- package/src/lib/orchestrator/launcher.ts +49 -3
- 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 +83 -11
- package/src/lib/orchestrator/projection-claude-skills.ts +30 -4
- package/src/lib/orchestrator/projection-companion-link.ts +12 -1
- 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 +4 -1
- package/src/lib/orchestrator/registry-checkouts.ts +177 -0
- package/src/lib/orchestrator/repository-link.ts +216 -57
- package/src/lib/orchestrator/serving-claude-wrap.ts +43 -0
- package/src/lib/orchestrator/session-context-link.ts +11 -5
- package/src/lib/orchestrator/session-prepare.ts +53 -8
- package/src/lib/orchestrator/setup-compatibilities.ts +1 -1
- package/src/lib/orchestrator/types.ts +9 -0
- package/src/lib/orchestrator/umbrella-checkouts.ts +102 -0
- package/src/lib/orchestrator/working-repo-projection.ts +24 -4
- package/src/lib/orchestrator/workspace-inventory.ts +5 -1
- package/src/lib/orchestrator/wrap-pass.ts +1 -0
- package/src/lib/prebuilt-workspace-prepare.ts +2 -1
- package/src/lib/prebuilt-workspace.ts +1 -0
- package/src/lib/public-npm.ts +105 -43
- package/src/lib/session-attribution.ts +52 -0
- package/src/lib/session-state.ts +356 -0
- package/src/lib/session-stop.ts +64 -0
- 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/workflow/declaration.ts +6 -0
- package/src/lib/workflow/handoff.ts +90 -0
- package/src/lib/workflow/hook-trust.ts +108 -0
- package/src/lib/workflow/position.ts +524 -0
- package/src/lib/workflow/report.ts +79 -0
- package/src/lib/workflow/work.ts +106 -0
- package/src/lib/workset/factory-local.ts +157 -0
- package/src/lib/workset/record.ts +45 -11
- package/src/lib/workset/repositories.ts +118 -25
- package/src/lib/workset/stage.ts +4 -2
- package/src/lib/workset/stages.ts +64 -4
- package/src/lib/workset/worktree-include.ts +161 -0
- package/src/lib/workset/worktree-index.ts +6 -2
- package/src/lib/workset/worktree.ts +665 -89
- package/src/opencode/background-server.ts +145 -0
- package/src/opencode/companion-hooks.ts +55 -14
- package/src/opencode/companion-policy.ts +20 -7
- package/src/opencode/enter-worktree.ts +254 -6
- package/src/opencode/projected-guidance.ts +7 -3
- package/src/opencode/session-register.ts +176 -0
- package/src/opencode/turn-hook.ts +241 -0
- package/src/playbooks/companion-guidance.ts +6 -3
- package/src/plugin-api.ts +42 -0
- package/src/runtime/artifact-trailers.ts +63 -0
- package/src/runtime/claude-bg-isolation.ts +138 -0
- package/src/runtime/claude-delivery-plan.ts +14 -3
- package/src/runtime/claude-hook-group.ts +2 -0
- package/src/runtime/companion-git-state.ts +155 -10
- package/src/runtime/companion-git.ts +96 -13
- package/src/runtime/companion-guidance.ts +107 -8
- package/src/runtime/companion-instructions.ts +1 -1
- package/src/runtime/companion-sync.ts +109 -21
- package/src/runtime/current-branch.ts +24 -0
- package/src/runtime/entered-worktree.ts +24 -0
- package/src/runtime/env-names.ts +2 -2
- package/src/runtime/env.ts +16 -9
- package/src/runtime/forge-remote.ts +48 -0
- package/src/runtime/git-layout.ts +185 -24
- package/src/runtime/git-tracked.ts +60 -0
- package/src/runtime/json-fields.ts +8 -0
- package/src/runtime/launch-env-guard.ts +65 -0
- package/src/runtime/opencode-server-record.ts +136 -0
- package/src/runtime/pending-records.ts +533 -0
- package/src/runtime/projected-guidance.ts +6 -2
- package/src/runtime/projection.ts +40 -6
- package/src/runtime/publication-secret-scan.ts +45 -0
- package/src/runtime/repo-destination.ts +72 -0
- package/src/runtime/repo-local.ts +29 -2
- 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-patterns.ts +3 -2
- package/src/runtime/secret-policy-weakening.ts +122 -0
- package/src/runtime/serving-claude-wrap.ts +41 -0
- package/src/runtime/session-context.ts +4 -3
- package/src/runtime/session-registry.ts +434 -0
- package/src/runtime/skill-prefix.ts +75 -0
- package/src/runtime/submitted-arrivals.ts +547 -0
- package/src/runtime/tokensave-route.ts +10 -5
- package/src/runtime/turn-state.d.mts +14 -0
- package/src/runtime/turn-state.mjs +93 -0
- package/src/runtime/umbrella-children.ts +52 -0
- package/src/runtime/umbrella-folder.ts +84 -0
- package/src/runtime/workflow/change-folders.ts +66 -0
- package/src/runtime/workflow/declaration.ts +720 -0
- package/src/runtime/workflow/globs.ts +85 -0
- package/src/runtime/workflow/next-handoff-process.ts +98 -0
- package/src/runtime/workflow/turn.ts +309 -0
- package/src/runtime/workflow/workflow.ts +262 -0
- package/src/runtime/wrap-state.ts +36 -13
- package/src/studio.ts +73 -19
- package/src/templates/capabilities/openspec-cap/{mate-v1 → mate-full}/schema.yaml +3 -3
- package/src/templates/capabilities/openspec-cap/{mate-v1 → mate-full}/templates/design.md +1 -1
- package/src/templates/capabilities/openspec-cap/{mate-v1 → mate-full}/templates/proposal.md +1 -1
- package/src/templates/capabilities/openspec-cap/{mate-v1 → mate-full}/templates/tasks.md +1 -1
- package/src/templates/capabilities/openspec-cap/mate-minimal/schema.yaml +3 -3
- package/src/templates/mate-skills/agents/mate-apply-change/SKILL.md +147 -46
- package/src/templates/mate-skills/agents/mate-apply-change/references/openspec-apply-change.md +1 -1
- package/src/templates/mate-skills/agents/mate-archive-change/SKILL.md +7 -75
- package/src/templates/mate-skills/agents/mate-clarify-intent/SKILL.md +13 -7
- package/src/templates/mate-skills/agents/mate-domain-modeling/SKILL.md +10 -0
- package/src/templates/mate-skills/agents/mate-explore-change/SKILL.md +46 -14
- package/src/templates/mate-skills/agents/mate-propose-change/SKILL.md +51 -38
- package/src/templates/mate-skills/agents/mate-propose-change/references/mate-revise.md +14 -10
- package/src/templates/mate-skills/agents/mate-propose-change/references/openspec-update-change.md +1 -1
- package/src/templates/mate-skills/agents/mate-publish-artifact/SKILL.md +113 -87
- package/src/templates/mate-skills/agents/mate-publish-artifact/references/openspec.md +111 -100
- package/src/templates/mate-skills/agents/mate-show-me/SKILL.md +11 -5
- package/src/templates/mate-skills/agents/mate-simplify-code/SKILL.md +16 -6
- package/src/templates/mate-skills/agents/mate-submit-change/SKILL.md +114 -0
- package/src/templates/mate-skills/claude/mate-apply-change/SKILL.md +147 -46
- package/src/templates/mate-skills/claude/mate-apply-change/references/openspec-apply-change.md +1 -1
- package/src/templates/mate-skills/claude/mate-archive-change/SKILL.md +7 -75
- package/src/templates/mate-skills/claude/mate-clarify-intent/SKILL.md +13 -7
- package/src/templates/mate-skills/claude/mate-domain-modeling/SKILL.md +10 -0
- package/src/templates/mate-skills/claude/mate-explore-change/SKILL.md +46 -14
- package/src/templates/mate-skills/claude/mate-propose-change/SKILL.md +51 -38
- package/src/templates/mate-skills/claude/mate-propose-change/references/mate-revise.md +14 -10
- package/src/templates/mate-skills/claude/mate-propose-change/references/openspec-update-change.md +1 -1
- package/src/templates/mate-skills/claude/mate-publish-artifact/SKILL.md +113 -87
- package/src/templates/mate-skills/claude/mate-publish-artifact/references/openspec.md +111 -100
- package/src/templates/mate-skills/claude/mate-show-me/SKILL.md +11 -5
- package/src/templates/mate-skills/claude/mate-simplify-code/SKILL.md +16 -6
- package/src/templates/mate-skills/claude/mate-submit-change/SKILL.md +114 -0
- package/src/templates/mate-skills/openspec-references.ts +3 -2
- package/src/tools/setup/__snapshots__/runtime-surface-golden.test.ts.snap +1301 -154
- package/src/tools/setup/capabilities/openspec.ts +54 -15
- package/src/tools/setup/capabilities/rtk.ts +98 -5
- package/src/tools/setup/capabilities/tokensave.ts +3 -2
- package/src/tools/setup/dynamic-plugins/api.ts +38 -0
- 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/host.ts +2 -32
- package/src/tools/setup/dynamic-plugins/hydrate.ts +8 -7
- 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/engine.ts +20 -1
- package/src/tools/setup/mate.ts +5 -3
- package/src/tools/setup/package-managers/bun.ts +8 -8
- package/src/tools/setup/plugin.ts +9 -1
- package/src/tools/setup/plugins/gitignore.ts +15 -9
- package/src/tools/setup/plugins/guidance.ts +4 -2
- package/src/tools/setup/providers/claude-plugin-hooks.ts +56 -0
- package/src/tools/setup/providers/claude.ts +64 -7
- package/src/tools/setup/service-registry.ts +69 -0
- package/src/tools/setup/service.ts +233 -0
- package/src/tools/setup/utils.ts +28 -5
- package/src/tools/setup/working-repo-cleanup.ts +2 -2
- package/src/tools/setup/working-repo-local-state.ts +2 -0
- package/src/tools/setup.ts +25 -14
- package/studio-dist/client/assets/app-BFVyWHGo.css +2 -0
- package/studio-dist/client/assets/button-D6LrRkOG.js +1 -0
- package/studio-dist/client/assets/combobox-Dk2MMZWE.js +1 -0
- package/studio-dist/client/assets/companion-view-BVaZNtiI.js +1 -0
- package/studio-dist/client/assets/fields-D_FYhxQr.js +1 -0
- package/studio-dist/client/assets/getting-started-ByWRg7hC.js +1 -0
- package/studio-dist/client/assets/getting-started-DZSjYC-b.js +1 -0
- package/studio-dist/client/assets/getting-started._topic-C6OyQ4G6.js +1 -0
- package/studio-dist/client/assets/getting-started.index-BkmPHdEm.js +1 -0
- package/studio-dist/client/assets/graph-7jm2XzyL.js +2 -0
- package/studio-dist/client/assets/graph-canvas-DDuzsNSx.js +3242 -0
- package/studio-dist/client/assets/guides-D9VTjWXP.js +1 -0
- package/studio-dist/client/assets/index-BBmFpG4y.js +40 -0
- package/studio-dist/client/assets/jsx-runtime-MZURdZre.js +1 -0
- package/studio-dist/client/assets/markdown-view-RL5YvfZg.js +1 -0
- package/studio-dist/client/assets/panel-B8F8sOKQ.js +1 -0
- package/studio-dist/client/assets/plugins._service._view-CynxTbMx.js +1 -0
- package/studio-dist/client/assets/queries-axYk2u9L.js +1 -0
- package/studio-dist/client/assets/react-r45OnJCw.js +27 -0
- package/studio-dist/client/assets/reports-BCAyXh6p.js +1 -0
- package/studio-dist/client/assets/routes-BFPqq89E.js +1 -0
- package/studio-dist/client/assets/skills-DTks_uBx.js +1 -0
- package/studio-dist/client/assets/specs-DU1kqcp5.js +1 -0
- package/studio-dist/client/assets/specs-view-omrd_5P3.js +1 -0
- package/studio-dist/client/assets/steps-DhIFuAZy.js +1 -0
- package/studio-dist/client/assets/store-DJ5cncKA.js +1 -0
- package/studio-dist/client/assets/studio-BR9j15J0.js +100 -0
- package/studio-dist/client/assets/studio-queries-CFP_yTpr.js +2 -0
- package/studio-dist/client/assets/usage-CHmwtkoM.js +55 -0
- package/studio-dist/client/assets/useBaseQuery-BlC-AZ35.js +1 -0
- package/studio-dist/client/assets/useSelector-AYcH7lB0.js +2 -0
- package/studio-dist/client/assets/vault-DRg8MScm.js +1 -0
- package/studio-dist/client/assets/warnings-UHFy6HAp.js +1 -0
- package/studio-dist/client/assets/workflow-Bv9vSfVV.js +1 -0
- package/studio-dist/server/assets/__23tanstack-start-server-fn-resolver-DAbZ6fzY.js +106 -0
- package/studio-dist/server/assets/_tanstack-start-manifest_v.js +86 -31
- package/studio-dist/server/assets/button-BfoNadNR.js +8193 -0
- package/studio-dist/server/assets/combobox-oxUI6r4V.js +2089 -0
- package/studio-dist/server/assets/{companion-view-aBady57v.js → companion-view-DHUjPpA0.js} +13 -7
- package/studio-dist/server/assets/companions-kBrJZAd6.js +31 -0
- package/studio-dist/server/assets/{createServerRpc-tK2lE9R2.js → createServerRpc-bFKFpGFG.js} +1 -1
- package/studio-dist/server/assets/fields-BD_c65T1.js +1190 -0
- package/studio-dist/server/assets/getting-started-7P0oyWaM.js +67 -0
- package/studio-dist/server/assets/getting-started-B136TP57.js +4 -0
- package/studio-dist/server/assets/getting-started._topic-B1mV0kGz.js +13 -0
- package/studio-dist/server/assets/getting-started.index-CeGtvUsm.js +13 -0
- package/studio-dist/server/assets/graph-BWtmJOH2.js +16 -0
- package/studio-dist/server/assets/graph-DSDVEELZ.js +801 -0
- package/studio-dist/server/assets/graph-canvas-CID9Nksc.js +21066 -0
- package/studio-dist/server/assets/graph-wire-BdSUx0G5.js +58 -0
- package/studio-dist/server/assets/guides-BLJenHwQ.js +5 -0
- package/studio-dist/server/assets/guides-Bm3RbUB-.js +13 -0
- package/studio-dist/server/assets/guides.server-rHHqRuzV.js +66 -0
- package/studio-dist/server/assets/jsx-runtime-Bt0s0YKS.js +451 -0
- package/studio-dist/server/assets/markdown-view-D3v9x-cM.js +105 -0
- package/studio-dist/server/assets/panel-yqOl5GMU.js +169 -0
- package/studio-dist/server/assets/plugins._service._view-DwqJX7s9.js +92 -0
- package/studio-dist/server/assets/queries-DYmGrhNO.js +32 -0
- package/studio-dist/server/assets/react-BO0uMhpm.js +89 -0
- package/studio-dist/server/assets/redirect-BaZ_QyqF.js +39 -0
- package/studio-dist/server/assets/reports-7yaPz7aP.js +147 -0
- package/studio-dist/server/assets/reports-C4Y_Jd-x.js +18 -0
- package/studio-dist/server/assets/router-Dnoq5auE.js +12844 -0
- package/studio-dist/server/assets/routes-Cok4p3mK.js +768 -0
- package/studio-dist/server/assets/{search-JAKurDNh.js → search-DUK7Jl6f.js} +21 -2
- package/studio-dist/server/assets/{shell-CboT2f66.js → shell-DNVXedgE.js} +16 -6
- package/studio-dist/server/assets/skills-D8qdXSku.js +267 -0
- package/studio-dist/server/assets/skills-pKmuAs0F.js +28 -0
- package/studio-dist/server/assets/specs-DeHYUNFp.js +51 -0
- package/studio-dist/server/assets/specs-view-BGn-5Ik_.js +425 -0
- package/studio-dist/server/assets/{start-BW5ovN0k.js → start-h3ICWwd2.js} +4 -1
- package/studio-dist/server/assets/steps-CV7Yk7L7.js +224 -0
- package/studio-dist/server/assets/store-CWDGIp6x.js +280 -0
- package/studio-dist/server/assets/studio-CB94np48.js +10437 -0
- package/studio-dist/server/assets/studio-queries-BqZGBE70.js +1335 -0
- package/studio-dist/server/assets/usage-M6Gi6Km7.js +25584 -0
- package/studio-dist/server/assets/usage-j5jR9gX9.js +24 -0
- package/studio-dist/server/assets/{studio-queries-CLnP9kGu.js → useBaseQuery-Tv_QJt9r.js} +4 -1318
- package/studio-dist/server/assets/{__23tanstack-start-server-fn-resolver-BQKuMdJW.js → useSelector-DUmCUXAs.js} +4 -498
- package/studio-dist/server/assets/vault-PqVmssmW.js +1035 -0
- package/studio-dist/server/assets/{vault-BGulVoNh.js → vault-lBlvSyD4.js} +19 -4
- package/studio-dist/server/assets/{views-Bd7cRr27.js → views-CsFp1i1G.js} +10 -9
- package/studio-dist/server/assets/warnings-BDs34j_m.js +24 -0
- package/studio-dist/server/assets/workflow-T0eEldsa.js +687 -0
- package/studio-dist/server/server.js +429 -9
- package/src/cli/commands/factory/factory.ts +0 -301
- package/src/cli/commands/report/collector.ts +0 -288
- package/src/cli/commands/studio/factory-credential.ts +0 -49
- package/src/cli/commands/studio/workset-session.ts +0 -131
- package/src/lib/delivery/archive-change.ts +0 -166
- package/src/lib/delivery/forge.ts +0 -279
- package/src/lib/delivery/token.ts +0 -24
- package/src/lib/factory/attach-client.ts +0 -113
- package/src/lib/factory/attach.ts +0 -178
- package/src/lib/factory/broker.ts +0 -190
- package/src/lib/factory/bun-commands.ts +0 -39
- package/src/lib/factory/client.ts +0 -92
- package/src/lib/factory/command.ts +0 -61
- package/src/lib/factory/credential-store.ts +0 -153
- package/src/lib/factory/frames.ts +0 -77
- package/src/lib/factory/ids.ts +0 -58
- package/src/lib/factory/outcomes/actions.ts +0 -114
- package/src/lib/factory/outcomes/index.ts +0 -381
- package/src/lib/factory/outcomes/lifecycle.ts +0 -205
- package/src/lib/factory/outcomes/runs.ts +0 -81
- package/src/lib/factory/prepare.ts +0 -49
- package/src/lib/factory/pty.ts +0 -103
- package/src/lib/factory/runner/companion-context.ts +0 -178
- package/src/lib/factory/runner/control.ts +0 -92
- package/src/lib/factory/runner/harness-agent.ts +0 -250
- package/src/lib/factory/runner/live.ts +0 -159
- package/src/lib/factory/runner/questions.ts +0 -22
- package/src/lib/factory/runner/rank.ts +0 -26
- package/src/lib/factory/runner/run-policy.ts +0 -12
- package/src/lib/factory/runner/run.ts +0 -199
- package/src/lib/factory/runner/scheduler.ts +0 -416
- package/src/lib/factory/runner/state.ts +0 -233
- package/src/lib/factory/runner/workflow.ts +0 -542
- package/src/lib/factory/runtime.ts +0 -972
- package/src/lib/factory/sandbox.ts +0 -292
- package/src/lib/factory/worktree-branch.ts +0 -17
- package/src/templates/capabilities/openspec-cap/mate-v1/templates/explore-brief.md +0 -25
- package/studio-dist/client/assets/companion-view-Csva26Ir.js +0 -1
- package/studio-dist/client/assets/delivery-path-DJMpRmiY.js +0 -1
- package/studio-dist/client/assets/factory-B7l9ZQyx.js +0 -4
- package/studio-dist/client/assets/index-n6uo_92S.js +0 -40
- package/studio-dist/client/assets/prepaint-CD5OpmTM.js +0 -24
- package/studio-dist/client/assets/queries-CN3JwMBX.js +0 -1
- package/studio-dist/client/assets/react-CabXf2Ds.js +0 -1
- package/studio-dist/client/assets/report-time-Dc-KOqQu.js +0 -1
- package/studio-dist/client/assets/reports-C01RsnMA.js +0 -1
- package/studio-dist/client/assets/rolldown-runtime-WkwZ5CU-.js +0 -1
- package/studio-dist/client/assets/routes-4pbC-2Hj.js +0 -1
- package/studio-dist/client/assets/skills-CihQganl.js +0 -1
- package/studio-dist/client/assets/spec-areas-C2L48N4C.js +0 -1
- package/studio-dist/client/assets/specs-D24_35_K.js +0 -1
- package/studio-dist/client/assets/studio-DKxfi691.css +0 -1
- package/studio-dist/client/assets/studio-queries-rvbJupCy.js +0 -3
- package/studio-dist/client/assets/vault-Bd4CQiTK.js +0 -1
- package/studio-dist/client/assets/warnings-V_Ys51wJ.js +0 -1
- package/studio-dist/client/assets/workflow-BJejeVwQ.js +0 -1
- package/studio-dist/server/assets/actions-Bvgj9eb8.js +0 -54
- package/studio-dist/server/assets/createServerFn-F5sAOF8V.js +0 -459
- package/studio-dist/server/assets/delivery-path-BkKNjgkf.js +0 -778
- package/studio-dist/server/assets/factory-D6xnjedJ.js +0 -2385
- package/studio-dist/server/assets/factory-DT3UzHlh.js +0 -68
- package/studio-dist/server/assets/prepaint-BMke0fo1.js +0 -41
- package/studio-dist/server/assets/queries-Ag2iL8q2.js +0 -107
- package/studio-dist/server/assets/react-COs0LHn-.js +0 -51
- package/studio-dist/server/assets/report-time-DAfzln-N.js +0 -8
- package/studio-dist/server/assets/reports-BnUNJVtx.js +0 -126
- package/studio-dist/server/assets/rolldown-runtime-DYf_mQCB.js +0 -34
- package/studio-dist/server/assets/router-BH--drIx.js +0 -4298
- package/studio-dist/server/assets/routes-khSDK1bV.js +0 -361
- package/studio-dist/server/assets/skills-MWYnWoKs.js +0 -106
- package/studio-dist/server/assets/spec-areas-DcnO6vW-.js +0 -16
- package/studio-dist/server/assets/specs-DE3w8hZP.js +0 -155
- package/studio-dist/server/assets/studio-BeltxxKt.js +0 -216
- package/studio-dist/server/assets/vault-CuyyhLyB.js +0 -832
- package/studio-dist/server/assets/warnings-BH05rOuG.js +0 -15
- package/studio-dist/server/assets/workflow-BSuIKWqH.js +0 -42
- /package/src/lib/{factory/keyed-serial.ts → keyed-serial.ts} +0 -0
- /package/src/templates/capabilities/openspec-cap/{mate-v1 → mate-full}/templates/spec.md +0 -0
|
@@ -4,8 +4,14 @@ import path from "node:path";
|
|
|
4
4
|
import { promisify } from "node:util";
|
|
5
5
|
|
|
6
6
|
import { FRAMEWORK_NAME } from "../../../framework";
|
|
7
|
-
import {
|
|
8
|
-
|
|
7
|
+
import {
|
|
8
|
+
companionTicketFormat,
|
|
9
|
+
TICKETS_OFF,
|
|
10
|
+
type TicketFormat,
|
|
11
|
+
} from "../../../lib/delivery/branches";
|
|
12
|
+
import type { DeliveryEnvironment } from "../../../lib/delivery/environment";
|
|
13
|
+
import { recordDelivery, type DeliveryRefusal } from "../../../lib/delivery/record-delivery";
|
|
14
|
+
import { isJiraKey, normalizeJiraKey, sameRepository } from "../../../lib/delivery/record";
|
|
9
15
|
import { resolveForCapability } from "../../../lib/orchestrator/framework-context";
|
|
10
16
|
import {
|
|
11
17
|
collectWorkspaceInventory,
|
|
@@ -17,21 +23,24 @@ import {
|
|
|
17
23
|
NOT_CREATED,
|
|
18
24
|
pruneWorksetWorktrees,
|
|
19
25
|
type PruneResult,
|
|
26
|
+
type UmbrellaWorktreeResult,
|
|
20
27
|
type WorktreeResult,
|
|
21
28
|
} from "../../../lib/workset/worktree";
|
|
29
|
+
import { attributeCurrentSession } from "../../../lib/session-attribution";
|
|
22
30
|
import { errorMessage } from "../../../runtime/error-message";
|
|
31
|
+
import { companionPolicySelectsRtk } from "../../../runtime/rtk-git-guard";
|
|
23
32
|
import { gitEnvironment } from "../../../runtime/companion-git";
|
|
24
33
|
import { resolveDeliveryEnvironment } from "../artifact/delivery/environment";
|
|
25
34
|
import { sharedRefusalMessage } from "../artifact/delivery/output";
|
|
26
|
-
import { ensureUnambiguousCompanion } from "../shared/companion-selection";
|
|
35
|
+
import { ensureUnambiguousCompanion, launchAmbiguityDeps } from "../shared/companion-selection";
|
|
27
36
|
import { readCompanionWorksetStages } from "../studio/payload";
|
|
28
37
|
|
|
29
38
|
const execFileAsync = promisify(execFile);
|
|
30
39
|
|
|
31
40
|
const n = FRAMEWORK_NAME;
|
|
32
41
|
const USAGE = [
|
|
33
|
-
`${n} working worktree: usage: ${n} working worktree <workset-id> [--companion <path>] [--no-install] [--json]`,
|
|
34
|
-
`${n} working worktree: usage: ${n} working worktree --change <change> [--enter] [--companion <path>] [--no-install] [--json]`,
|
|
42
|
+
`${n} working worktree: usage: ${n} working worktree <workset-id> [--ticket <KEY>] [--companion <path>] [--no-install] [--json]`,
|
|
43
|
+
`${n} working worktree: usage: ${n} working worktree --change <change> [--enter] [--take-branch] [--ticket <KEY>] [--companion <path>] [--no-install] [--json]`,
|
|
35
44
|
`${n} working worktree: usage: ${n} working worktree prune [--companion <path>] [--json]`,
|
|
36
45
|
].join("\n");
|
|
37
46
|
|
|
@@ -42,12 +51,25 @@ export interface EnterInstruction {
|
|
|
42
51
|
tool?: "EnterWorktree" | "mate_enter_worktree";
|
|
43
52
|
/** The current Working Repository's worktree; absent when it has none or it is unknown. */
|
|
44
53
|
path?: string;
|
|
54
|
+
/** Why a handoff; on Claude's `tool` with RTK selected, how git runs after the move. */
|
|
45
55
|
reason?: string;
|
|
46
56
|
}
|
|
47
57
|
|
|
48
58
|
/** The current Working Repository's worktree, its branch recorded; or why nothing was recorded. */
|
|
49
59
|
export type RecordedBranch =
|
|
50
60
|
| { repository: string; branch: string; path: string }
|
|
61
|
+
/**
|
|
62
|
+
* An Umbrella Repository's mirrored worktree on the Workset `branch`: `repositories` were
|
|
63
|
+
* recorded, `failed` names the rest. OpenCode moves the session into `path`; any other
|
|
64
|
+
* runtime hands off to a new session there, for the reason `handoff`.
|
|
65
|
+
*/
|
|
66
|
+
| {
|
|
67
|
+
handoff: string;
|
|
68
|
+
path: string;
|
|
69
|
+
branch?: string;
|
|
70
|
+
repositories: string[];
|
|
71
|
+
failed?: string[];
|
|
72
|
+
}
|
|
51
73
|
| { skipped: string }
|
|
52
74
|
| { failed: string[] };
|
|
53
75
|
|
|
@@ -68,6 +90,12 @@ export interface WorkingWorktreeDeps {
|
|
|
68
90
|
createForChange?: typeof createChangeWorktrees;
|
|
69
91
|
prune?: typeof pruneWorksetWorktrees;
|
|
70
92
|
worksetStages?: typeof readCompanionWorksetStages;
|
|
93
|
+
/** The companion's ticket setting; `--ticket` is refused unless it is `jira`. */
|
|
94
|
+
ticketFormat?: (companion: string) => Promise<TicketFormat>;
|
|
95
|
+
/** Records the change, and the worktree it moves to, on the agent session this runs in. */
|
|
96
|
+
attribute?: typeof attributeCurrentSession;
|
|
97
|
+
/** Whether the companion selects RTK, whose git rewrite Claude refuses in an entered worktree. */
|
|
98
|
+
rtkSelected?: (companion: string) => boolean;
|
|
71
99
|
}
|
|
72
100
|
|
|
73
101
|
async function canonicalPath(candidate: string): Promise<string> {
|
|
@@ -98,15 +126,18 @@ type Parsed = {
|
|
|
98
126
|
companion?: string;
|
|
99
127
|
install: boolean;
|
|
100
128
|
json: boolean;
|
|
101
|
-
|
|
129
|
+
ticket?: string;
|
|
130
|
+
} & ({ target: string } | { change: string; enter: boolean; takeBranch: boolean });
|
|
102
131
|
|
|
103
132
|
function parse(argv: string[]): Parsed | null {
|
|
104
133
|
const positional: string[] = [];
|
|
105
134
|
let companion: string | undefined;
|
|
106
135
|
let change: string | undefined;
|
|
136
|
+
let ticket: string | undefined;
|
|
107
137
|
let install = true;
|
|
108
138
|
let json = false;
|
|
109
139
|
let enter = false;
|
|
140
|
+
let takeBranch = false;
|
|
110
141
|
for (let index = 0; index < argv.length; index += 1) {
|
|
111
142
|
const arg = argv[index]!;
|
|
112
143
|
if (arg === "--companion") {
|
|
@@ -115,17 +146,26 @@ function parse(argv: string[]): Parsed | null {
|
|
|
115
146
|
} else if (arg === "--change") {
|
|
116
147
|
change = argv[++index];
|
|
117
148
|
if (!change) return null;
|
|
149
|
+
} else if (arg === "--ticket") {
|
|
150
|
+
ticket = argv[++index];
|
|
151
|
+
if (!ticket) return null;
|
|
118
152
|
} else if (arg === "--no-install") install = false;
|
|
119
153
|
else if (arg === "--enter") enter = true;
|
|
154
|
+
else if (arg === "--take-branch") takeBranch = true;
|
|
120
155
|
else if (arg === "--json") json = true;
|
|
121
156
|
else if (arg.startsWith("-")) return null;
|
|
122
157
|
else positional.push(arg);
|
|
123
158
|
}
|
|
124
|
-
const rest = {
|
|
125
|
-
|
|
159
|
+
const rest = {
|
|
160
|
+
...(companion ? { companion } : {}),
|
|
161
|
+
...(ticket ? { ticket } : {}),
|
|
162
|
+
install,
|
|
163
|
+
json,
|
|
164
|
+
};
|
|
165
|
+
if (change) return positional.length === 0 ? { change, enter, takeBranch, ...rest } : null;
|
|
126
166
|
const [target] = positional;
|
|
127
|
-
if (positional.length !== 1 || !target || enter) return null;
|
|
128
|
-
if (target === "prune" && !install) return null;
|
|
167
|
+
if (positional.length !== 1 || !target || enter || takeBranch) return null;
|
|
168
|
+
if (target === "prune" && (!install || ticket)) return null;
|
|
129
169
|
return { target, ...rest };
|
|
130
170
|
}
|
|
131
171
|
|
|
@@ -144,22 +184,36 @@ async function resolveCompanion(
|
|
|
144
184
|
}
|
|
145
185
|
}
|
|
146
186
|
const cwd = deps.cwd ?? process.cwd();
|
|
187
|
+
// Outside Git, as in an Umbrella Repository, the folder itself pairs.
|
|
147
188
|
const roots = await (deps.checkoutRoots ?? checkoutRoots)(cwd);
|
|
148
|
-
|
|
189
|
+
const pairedCompanions = await pairedWith(roots ?? [await canonicalPath(cwd)], deps);
|
|
190
|
+
// A registry entry naming a removed folder pairs with nothing; the repo-local link still holds.
|
|
191
|
+
const companions =
|
|
192
|
+
pairedCompanions.length > 0
|
|
193
|
+
? pairedCompanions
|
|
194
|
+
: (await launchAmbiguityDeps.resolveLinkedCompanions(cwd)).map((m) => m.companionPath);
|
|
195
|
+
const folder = roots?.[0] ?? cwd;
|
|
196
|
+
if (companions.length === 1) return { companion: companions[0]! };
|
|
197
|
+
if (companions.length === 0) {
|
|
198
|
+
const where = roots
|
|
199
|
+
? "is not linked to a companion"
|
|
200
|
+
: "is neither inside a Git working tree nor linked to a companion";
|
|
201
|
+
return { error: `${folder} ${where}; pass --companion <path>` };
|
|
202
|
+
}
|
|
203
|
+
return {
|
|
204
|
+
error: `${folder} is paired with several companions (${companions.join(", ")}); pass --companion <path>`,
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/** The companions whose registry pairs with one of the checkout's roots. */
|
|
209
|
+
async function pairedWith(roots: string[], deps: WorkingWorktreeDeps): Promise<string[]> {
|
|
149
210
|
const inventory = await (deps.collectInventory ?? collectWorkspaceInventory)();
|
|
150
211
|
const paired = await Promise.all(
|
|
151
212
|
inventory.pairings.map(async (pairing) =>
|
|
152
213
|
roots.includes(await canonicalPath(pairing.repository.path)) ? pairing.companionPath : null,
|
|
153
214
|
),
|
|
154
215
|
);
|
|
155
|
-
|
|
156
|
-
if (companions.length === 1) return { companion: companions[0]! };
|
|
157
|
-
if (companions.length === 0) {
|
|
158
|
-
return { error: `${roots[0]} is not linked to a companion; pass --companion <path>` };
|
|
159
|
-
}
|
|
160
|
-
return {
|
|
161
|
-
error: `${roots[0]} is paired with several companions (${companions.join(", ")}); pass --companion <path>`,
|
|
162
|
-
};
|
|
216
|
+
return [...new Set(paired.filter((entry): entry is string => entry !== null))];
|
|
163
217
|
}
|
|
164
218
|
|
|
165
219
|
/** As `mate artifact link <change> --branch <branch>` records it, for the current Working Repository. */
|
|
@@ -177,6 +231,17 @@ async function recordBranch(
|
|
|
177
231
|
return { failed: [environment.error ?? `cannot resolve the companion ${companion}`] };
|
|
178
232
|
}
|
|
179
233
|
const slug = environment.workingRepo?.slug;
|
|
234
|
+
if (!slug && environment.workingRepo?.umbrellaChildren) {
|
|
235
|
+
if (
|
|
236
|
+
!result.umbrella ||
|
|
237
|
+
!(await isSessionUmbrella(environment.workingRepo.path, result.umbrella))
|
|
238
|
+
) {
|
|
239
|
+
return {
|
|
240
|
+
skipped: `no child of the Umbrella Repository ${environment.workingRepo.path} got a worktree for ${result.workset}`,
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
return recordUmbrella(environment, change, result, result.umbrella);
|
|
244
|
+
}
|
|
180
245
|
if (!slug) return { failed: ["the Working Repository has no origin remote to identify it"] };
|
|
181
246
|
const entry = result.repositories.find((candidate) => sameRepository(candidate.repository, slug));
|
|
182
247
|
if (!entry) return { skipped: `${slug} got no worktree for ${result.workset}` };
|
|
@@ -185,26 +250,84 @@ async function recordBranch(
|
|
|
185
250
|
repository: slug,
|
|
186
251
|
edit: { delivery: { branch: entry.branch, direct: false } },
|
|
187
252
|
});
|
|
188
|
-
if ("refusal" in outcome) {
|
|
189
|
-
const { refusal } = outcome;
|
|
190
|
-
return {
|
|
191
|
-
failed: [
|
|
192
|
-
refusal.reason === "unknown-change"
|
|
193
|
-
? `no active change ${refusal.change}`
|
|
194
|
-
: sharedRefusalMessage(refusal),
|
|
195
|
-
],
|
|
196
|
-
};
|
|
197
|
-
}
|
|
253
|
+
if ("refusal" in outcome) return { failed: [refusalText(outcome.refusal)] };
|
|
198
254
|
return { repository: entry.repository, branch: entry.branch, path: entry.path };
|
|
199
255
|
}
|
|
200
256
|
|
|
257
|
+
/** The session's folder is the umbrella the mirrored worktree serves, or that worktree. */
|
|
258
|
+
async function isSessionUmbrella(
|
|
259
|
+
folder: string,
|
|
260
|
+
umbrella: UmbrellaWorktreeResult,
|
|
261
|
+
): Promise<boolean> {
|
|
262
|
+
const [session, ...served] = await Promise.all(
|
|
263
|
+
[folder, umbrella.path, umbrella.worktree].map(canonicalPath),
|
|
264
|
+
);
|
|
265
|
+
return served.includes(session!);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* In an Umbrella Repository session: the branch of every child worktree in the mirrored
|
|
270
|
+
* worktree, recorded per child.
|
|
271
|
+
*/
|
|
272
|
+
async function recordUmbrella(
|
|
273
|
+
environment: DeliveryEnvironment,
|
|
274
|
+
change: string,
|
|
275
|
+
result: WorktreeResult,
|
|
276
|
+
umbrella: UmbrellaWorktreeResult,
|
|
277
|
+
): Promise<RecordedBranch> {
|
|
278
|
+
const children = result.repositories.filter((entry) =>
|
|
279
|
+
umbrella.repositories.includes(entry.repository),
|
|
280
|
+
);
|
|
281
|
+
const recorded: string[] = [];
|
|
282
|
+
const failed: string[] = [];
|
|
283
|
+
for (const entry of children) {
|
|
284
|
+
// oxlint-disable-next-line no-await-in-loop -- one Delivery Record, written in order
|
|
285
|
+
const outcome = await recordDelivery(environment, {
|
|
286
|
+
changes: [change],
|
|
287
|
+
repository: entry.repository,
|
|
288
|
+
edit: { delivery: { branch: entry.branch, direct: false } },
|
|
289
|
+
});
|
|
290
|
+
if ("refusal" in outcome) failed.push(`${entry.repository}: ${refusalText(outcome.refusal)}`);
|
|
291
|
+
else recorded.push(entry.repository);
|
|
292
|
+
}
|
|
293
|
+
// The first child folder's in name order, as `currentBranch` reads the session's later.
|
|
294
|
+
const branch = children.toSorted((a, b) => (a.path < b.path ? -1 : a.path > b.path ? 1 : 0))[0]
|
|
295
|
+
?.branch;
|
|
296
|
+
return {
|
|
297
|
+
handoff: `${umbrella.worktree} is a mirrored umbrella worktree, not a Git worktree`,
|
|
298
|
+
path: umbrella.worktree,
|
|
299
|
+
...(branch ? { branch } : {}),
|
|
300
|
+
repositories: recorded,
|
|
301
|
+
...(failed.length > 0 ? { failed } : {}),
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
function refusalText(refusal: DeliveryRefusal): string {
|
|
306
|
+
return refusal.reason === "unknown-change"
|
|
307
|
+
? `no active change ${refusal.change}`
|
|
308
|
+
: sharedRefusalMessage(refusal);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/** Claude Code's worktree guard refuses RTK's `rtk git` rewrite once the session moved. */
|
|
312
|
+
const RTK_GIT_NOTE =
|
|
313
|
+
"then run git as RTK_DISABLED=1 git ...: Claude Code refuses git run through RTK in the entered worktree";
|
|
314
|
+
|
|
201
315
|
/** Detected by the markers each runtime sets for the commands its agent runs. */
|
|
202
316
|
function enterInstruction(
|
|
203
317
|
env: Record<string, string | undefined>,
|
|
204
318
|
recorded: RecordedBranch,
|
|
319
|
+
rtkSelected: () => boolean = () => false,
|
|
205
320
|
): EnterInstruction {
|
|
206
321
|
const runtime = runtimeOf(env);
|
|
207
322
|
if ("skipped" in recorded) return { runtime, action: "handoff", reason: recorded.skipped };
|
|
323
|
+
// Before `failed`: a mirrored worktree stays the place to work on when a record failed.
|
|
324
|
+
if ("handoff" in recorded) {
|
|
325
|
+
// Claude's `EnterWorktree` takes only Git worktrees; `mate_enter_worktree` takes this folder.
|
|
326
|
+
if (runtime === "opencode") {
|
|
327
|
+
return { runtime, action: "tool", tool: ENTER_TOOLS.opencode, path: recorded.path };
|
|
328
|
+
}
|
|
329
|
+
return { runtime, action: "handoff", path: recorded.path, reason: recorded.handoff };
|
|
330
|
+
}
|
|
208
331
|
if ("failed" in recorded) {
|
|
209
332
|
const reason = `recording the delivery branch failed: ${recorded.failed.join("; ")}`;
|
|
210
333
|
return { runtime, action: "handoff", reason };
|
|
@@ -214,7 +337,8 @@ function enterInstruction(
|
|
|
214
337
|
const reason = "this Agent Runtime cannot move a running session";
|
|
215
338
|
return { runtime, action: "handoff", path: target, reason };
|
|
216
339
|
}
|
|
217
|
-
|
|
340
|
+
const note = runtime === "claude" && rtkSelected() ? { reason: RTK_GIT_NOTE } : {};
|
|
341
|
+
return { runtime, action: "tool", tool: ENTER_TOOLS[runtime], path: target, ...note };
|
|
218
342
|
}
|
|
219
343
|
|
|
220
344
|
const ENTER_TOOLS = {
|
|
@@ -229,7 +353,10 @@ function runtimeOf(env: Record<string, string | undefined>): EnterInstruction["r
|
|
|
229
353
|
}
|
|
230
354
|
|
|
231
355
|
function enterLine(enter: EnterInstruction): string {
|
|
232
|
-
if (enter.action === "tool")
|
|
356
|
+
if (enter.action === "tool") {
|
|
357
|
+
const note = enter.reason ? `; ${enter.reason}` : "";
|
|
358
|
+
return `${n}: enter: call ${enter.tool} with ${enter.path}${note}`;
|
|
359
|
+
}
|
|
233
360
|
if (enter.path) return `${n}: enter: start a new session in ${enter.path} (${enter.reason})`;
|
|
234
361
|
return `${n}: enter: not entering (${enter.reason})`;
|
|
235
362
|
}
|
|
@@ -257,6 +384,14 @@ function printCreated(result: WorktreeResult): void {
|
|
|
257
384
|
} else if (wrap.outcome === "skipped") {
|
|
258
385
|
process.stdout.write(`${prefix} wrap skipped (${wrap.reason})\n`);
|
|
259
386
|
}
|
|
387
|
+
const { include } = entry;
|
|
388
|
+
if (include.sources.length > 0) {
|
|
389
|
+
const copied = include.copied.length > 0 ? include.copied.join(", ") : "nothing new";
|
|
390
|
+
process.stdout.write(`${prefix} copied from ${include.sources.join(", ")}: ${copied}\n`);
|
|
391
|
+
}
|
|
392
|
+
for (const failed of include.failed) {
|
|
393
|
+
process.stdout.write(`${prefix} copying ${failed.path} failed (${failed.reason})\n`);
|
|
394
|
+
}
|
|
260
395
|
const { command, outcome, reason } = entry.install;
|
|
261
396
|
process.stdout.write(
|
|
262
397
|
outcome === "skipped"
|
|
@@ -275,6 +410,21 @@ function printCreated(result: WorktreeResult): void {
|
|
|
275
410
|
}
|
|
276
411
|
if (entry.error) console.error(`${n} working worktree: ${entry.repository}: ${entry.error}`);
|
|
277
412
|
}
|
|
413
|
+
const { umbrella } = result;
|
|
414
|
+
if (!umbrella) return;
|
|
415
|
+
const prefix = `${n}: ${umbrella.path}:`;
|
|
416
|
+
process.stdout.write(`${prefix} ${umbrella.action} mirrored worktree ${umbrella.worktree}\n`);
|
|
417
|
+
const { wrap } = umbrella;
|
|
418
|
+
if (wrap.outcome === "ok") {
|
|
419
|
+
process.stdout.write(`${prefix} wrapped for ${wrap.runtimes.join(", ")}\n`);
|
|
420
|
+
} else if (wrap.outcome === "skipped") {
|
|
421
|
+
process.stdout.write(`${prefix} wrap skipped (${wrap.reason})\n`);
|
|
422
|
+
}
|
|
423
|
+
const { index } = umbrella;
|
|
424
|
+
process.stdout.write(
|
|
425
|
+
`${prefix} tokensave index ${index.outcome}${index.reason ? ` (${index.reason})` : ""}\n`,
|
|
426
|
+
);
|
|
427
|
+
if (umbrella.error) console.error(`${n} working worktree: ${umbrella.path}: ${umbrella.error}`);
|
|
278
428
|
}
|
|
279
429
|
|
|
280
430
|
function printPruned(result: PruneResult): void {
|
|
@@ -286,7 +436,15 @@ function printPruned(result: PruneResult): void {
|
|
|
286
436
|
`${n}: kept ${entry.path} (${entry.workset}, ${entry.repository}): ${entry.reason}\n`,
|
|
287
437
|
);
|
|
288
438
|
}
|
|
289
|
-
|
|
439
|
+
for (const entry of result.umbrellas?.removed ?? []) {
|
|
440
|
+
process.stdout.write(`${n}: removed mirrored worktree ${entry.path} (${entry.workset})\n`);
|
|
441
|
+
}
|
|
442
|
+
for (const entry of result.umbrellas?.kept ?? []) {
|
|
443
|
+
process.stdout.write(
|
|
444
|
+
`${n}: kept mirrored worktree ${entry.path} (${entry.workset}): ${entry.reason}\n`,
|
|
445
|
+
);
|
|
446
|
+
}
|
|
447
|
+
if (result.removed.length === 0 && result.kept.length === 0 && !result.umbrellas) {
|
|
290
448
|
process.stdout.write(`${n}: no worktree of a Done Workset to prune\n`);
|
|
291
449
|
}
|
|
292
450
|
}
|
|
@@ -295,7 +453,9 @@ function printPruned(result: PruneResult): void {
|
|
|
295
453
|
* `mate working worktree <workset-id>` creates or reuses the Workset's worktree in each
|
|
296
454
|
* Working Repository; `--change <change>` does so for the Workset the change resolves to,
|
|
297
455
|
* and with `--enter` also records the current repository's branch as the change's delivery
|
|
298
|
-
* and reports how the Agent Runtime enters the worktree; `
|
|
456
|
+
* and reports how the Agent Runtime enters the worktree; with `--take-branch` a branch
|
|
457
|
+
* checked out in a main checkout without tracked changes, inherited ones included, moves to the worktree, leaving
|
|
458
|
+
* that checkout on a detached HEAD; `mate working worktree prune`
|
|
299
459
|
* removes those of Done Worksets.
|
|
300
460
|
*/
|
|
301
461
|
export async function runWorkingWorktreeCommand(
|
|
@@ -327,7 +487,26 @@ export async function runWorkingWorktreeCommand(
|
|
|
327
487
|
else printPruned(result);
|
|
328
488
|
return;
|
|
329
489
|
}
|
|
330
|
-
|
|
490
|
+
let ticket: string | undefined;
|
|
491
|
+
if (parsed.ticket !== undefined) {
|
|
492
|
+
if (!isJiraKey(parsed.ticket)) {
|
|
493
|
+
console.error(`${n} working worktree: --ticket expects a Jira key such as ABC-123.`);
|
|
494
|
+
process.exitCode = 1;
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
if ((await (deps.ticketFormat ?? companionTicketFormat)(companion)) !== "jira") {
|
|
498
|
+
console.error(`${n} working worktree: ${TICKETS_OFF}`);
|
|
499
|
+
process.exitCode = 1;
|
|
500
|
+
return;
|
|
501
|
+
}
|
|
502
|
+
ticket = normalizeJiraKey(parsed.ticket);
|
|
503
|
+
}
|
|
504
|
+
const options = {
|
|
505
|
+
install: parsed.install,
|
|
506
|
+
streamInstall: !parsed.json,
|
|
507
|
+
...(ticket ? { ticket } : {}),
|
|
508
|
+
...("change" in parsed && parsed.takeBranch ? { takeBranch: true } : {}),
|
|
509
|
+
};
|
|
331
510
|
const result =
|
|
332
511
|
"change" in parsed
|
|
333
512
|
? await (deps.createForChange ?? createChangeWorktrees)(companion, parsed.change, options)
|
|
@@ -338,8 +517,20 @@ export async function runWorkingWorktreeCommand(
|
|
|
338
517
|
if ("change" in parsed && parsed.enter && result.ok) {
|
|
339
518
|
const record = deps.recordBranch ?? recordBranch;
|
|
340
519
|
const recorded = await record(companion, parsed.change, result, deps.cwd ?? process.cwd());
|
|
341
|
-
if ("failed" in recorded) result.warnings.push(...recorded.failed);
|
|
342
|
-
|
|
520
|
+
if ("failed" in recorded) result.warnings.push(...(recorded.failed ?? []));
|
|
521
|
+
// Read only for a Claude move, the one the note serves.
|
|
522
|
+
const rtkSelected = () => (deps.rtkSelected ?? companionPolicySelectsRtk)(companion);
|
|
523
|
+
enter = enterInstruction(deps.env ?? process.env, recorded, rtkSelected);
|
|
524
|
+
// A handed-off umbrella session stays where it is; its successor registers the branch.
|
|
525
|
+
const handedOff = "handoff" in recorded && enter.action !== "tool";
|
|
526
|
+
const move =
|
|
527
|
+
"branch" in recorded && recorded.branch && !handedOff
|
|
528
|
+
? { cwd: recorded.path, branch: recorded.branch }
|
|
529
|
+
: undefined;
|
|
530
|
+
await (deps.attribute ?? attributeCurrentSession)(
|
|
531
|
+
{ change: parsed.change, ...(move ? { move } : {}) },
|
|
532
|
+
deps.env ?? process.env,
|
|
533
|
+
);
|
|
343
534
|
}
|
|
344
535
|
reportProblems(result.diagnostics, result.warnings);
|
|
345
536
|
if (parsed.json) {
|
package/src/cli/commands/wrap.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
|
|
3
3
|
import { FRAMEWORK_NAME } from "../../framework";
|
|
4
|
+
import { adoptNewCheckout } from "../../lib/orchestrator/checkout-adoption";
|
|
4
5
|
import { findRepoLocalLinkedRepository } from "../../lib/orchestrator/repository-link";
|
|
5
6
|
import type { ProjectionChangedPaths } from "../../lib/orchestrator/projection-types";
|
|
6
7
|
import { attendedLockOptions } from "../../lib/orchestrator/companion-git-sync";
|
|
8
|
+
import {
|
|
9
|
+
reconcileServingClaudeWrap,
|
|
10
|
+
type ServingClaudeWrap,
|
|
11
|
+
} from "../../lib/orchestrator/serving-claude-wrap";
|
|
7
12
|
import { runWrapPass, type WrapPassResult } from "../../lib/orchestrator/wrap-pass";
|
|
8
13
|
import { withCompanionLock } from "../../runtime/companion-lock";
|
|
9
14
|
import { WRAP_RUNTIMES } from "../../runtime/wrap-state";
|
|
@@ -11,12 +16,15 @@ import { launchAmbiguityDeps } from "./shared/companion-selection";
|
|
|
11
16
|
|
|
12
17
|
export interface WrapCommandDependencies {
|
|
13
18
|
findRepoLocalLinkedRepository?: typeof findRepoLocalLinkedRepository;
|
|
19
|
+
/** A new Checkout of a linked clone is adopted before it is wrapped (design Decision 7). */
|
|
20
|
+
adoptNewCheckout?: (folder: string) => ReturnType<typeof adoptNewCheckout>;
|
|
14
21
|
runWrapPass?: typeof runWrapPass;
|
|
15
22
|
resolveLinkedCompanions?: typeof launchAmbiguityDeps.resolveLinkedCompanions;
|
|
16
23
|
}
|
|
17
24
|
|
|
18
25
|
export const wrapCommandDeps: Required<WrapCommandDependencies> = {
|
|
19
26
|
findRepoLocalLinkedRepository,
|
|
27
|
+
adoptNewCheckout,
|
|
20
28
|
runWrapPass,
|
|
21
29
|
resolveLinkedCompanions: (cwd: string) => launchAmbiguityDeps.resolveLinkedCompanions(cwd),
|
|
22
30
|
};
|
|
@@ -73,6 +81,7 @@ export async function runWrapCommand(
|
|
|
73
81
|
deps.findRepoLocalLinkedRepository ?? wrapCommandDeps.findRepoLocalLinkedRepository;
|
|
74
82
|
const wrap = deps.runWrapPass ?? wrapCommandDeps.runWrapPass;
|
|
75
83
|
const resolveLinked = deps.resolveLinkedCompanions ?? wrapCommandDeps.resolveLinkedCompanions;
|
|
84
|
+
const adopt = deps.adoptNewCheckout ?? wrapCommandDeps.adoptNewCheckout;
|
|
76
85
|
|
|
77
86
|
const parsed = parseWrapArgs(argv);
|
|
78
87
|
if ("error" in parsed) {
|
|
@@ -81,7 +90,7 @@ export async function runWrapCommand(
|
|
|
81
90
|
return;
|
|
82
91
|
}
|
|
83
92
|
|
|
84
|
-
const repository = await findRepository(cwd);
|
|
93
|
+
const repository = (await findRepository(cwd)) ?? (await adopt(cwd));
|
|
85
94
|
if (!repository) {
|
|
86
95
|
console.error(
|
|
87
96
|
`${FRAMEWORK_NAME}: this directory is not a working repository linked to a companion.`,
|
|
@@ -106,13 +115,30 @@ export async function runWrapCommand(
|
|
|
106
115
|
return;
|
|
107
116
|
}
|
|
108
117
|
|
|
109
|
-
/**
|
|
110
|
-
|
|
111
|
-
|
|
118
|
+
/**
|
|
119
|
+
* Serialized with Session Prepare and every sync, which rewrite the same
|
|
120
|
+
* manifest. In a linked worktree the Claude wrap serving it comes first, so
|
|
121
|
+
* the worktree's own leaves out what that one carries (design Decision 12).
|
|
122
|
+
*/
|
|
123
|
+
const locked = await withCompanionLock(
|
|
124
|
+
companionPath,
|
|
125
|
+
attendedLockOptions(companionPath),
|
|
126
|
+
async () => {
|
|
127
|
+
const served = await reconcileServingClaudeWrap(companionPath, repository, { create: true });
|
|
128
|
+
if (served?.result.kind === "failed") return { served, result: served.result };
|
|
129
|
+
return { served, result: await wrap(companionPath, repository) };
|
|
130
|
+
},
|
|
112
131
|
);
|
|
113
|
-
const result: WrapPassResult =
|
|
114
|
-
|
|
115
|
-
|
|
132
|
+
const { served, result }: { served?: ServingClaudeWrap | null; result: WrapPassResult } =
|
|
133
|
+
locked.acquired
|
|
134
|
+
? locked.value
|
|
135
|
+
: {
|
|
136
|
+
result: {
|
|
137
|
+
kind: "failed",
|
|
138
|
+
message: "another companion synchronization is still running.",
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
if (served) console.log(`Serving Claude wrap: ${served.repository.path} (${served.result.kind})`);
|
|
116
142
|
if (result.kind === "failed") {
|
|
117
143
|
console.error(`${FRAMEWORK_NAME}: ${result.message}`);
|
|
118
144
|
process.exitCode = 1;
|
package/src/cli/main.ts
CHANGED
|
@@ -21,9 +21,10 @@ import { runSessionCommand } from "./commands/session/prepare";
|
|
|
21
21
|
import { runStudioCommand } from "./commands/studio";
|
|
22
22
|
import { runUpdateCommand } from "./commands/update";
|
|
23
23
|
import { runUnwrapCommand } from "./commands/unwrap";
|
|
24
|
+
import { runVscodeCommand } from "./commands/vscode/setup";
|
|
24
25
|
import { parseWrapArgs, runWrapCommand } from "./commands/wrap";
|
|
25
26
|
import { runWorkingCommand } from "./commands/working/working";
|
|
26
|
-
import {
|
|
27
|
+
import { runWorkflowCommand } from "./commands/workflow/workflow";
|
|
27
28
|
import { runInstallCommand } from "./commands/install";
|
|
28
29
|
import { parseDirectLaunchArgs } from "./commands/launch/shared";
|
|
29
30
|
import {
|
|
@@ -39,6 +40,7 @@ import {
|
|
|
39
40
|
import { ensureRuntimeDirectory, refreshRuntimeDirectory } from "../lib/runtime-directory-refresh";
|
|
40
41
|
import { hydrateDynamicPlugins } from "../tools/setup/dynamic-plugins/hydrate";
|
|
41
42
|
import { findPluginCliCommand } from "./plugin-commands";
|
|
43
|
+
import { findServiceCommand } from "../tools/setup/service-registry";
|
|
42
44
|
import { usage } from "./usage";
|
|
43
45
|
|
|
44
46
|
export interface GateNeeds {
|
|
@@ -121,6 +123,10 @@ export async function main(argv = process.argv, deps: MainDeps = mainDeps): Prom
|
|
|
121
123
|
// scheduleBackgroundCheck() has been observed to race a large final stdout
|
|
122
124
|
// write against process exit, truncating it.
|
|
123
125
|
const ownsStdout = isPluginCommand;
|
|
126
|
+
// `report` and `workflow` print JSON contracts other processes parse (the
|
|
127
|
+
// turn hooks parse `workflow next`), so they skip the background check too
|
|
128
|
+
// but keep their stderr banner.
|
|
129
|
+
const skipsBackgroundCheck = ownsStdout || command === "report" || command === "workflow";
|
|
124
130
|
|
|
125
131
|
// Every dispatch case opens with a gate() call declaring what the command
|
|
126
132
|
// needs before it may run. Declared gates run in fixed order — update
|
|
@@ -130,7 +136,7 @@ export async function main(argv = process.argv, deps: MainDeps = mainDeps): Prom
|
|
|
130
136
|
const gate = async (needs: GateNeeds): Promise<boolean> => {
|
|
131
137
|
if (!ownsStdout) {
|
|
132
138
|
const updateStore = new UpdateStateStore();
|
|
133
|
-
scheduleBackgroundCheck(updateStore);
|
|
139
|
+
if (!skipsBackgroundCheck) scheduleBackgroundCheck(updateStore);
|
|
134
140
|
if (needs.updateGuard && (await enforceUpdateIfRequired(updateStore))) {
|
|
135
141
|
process.exitCode = 1;
|
|
136
142
|
return false;
|
|
@@ -205,6 +211,15 @@ export async function main(argv = process.argv, deps: MainDeps = mainDeps): Prom
|
|
|
205
211
|
if (!(await gate({ updateGuard: true, companion: true, install: true }))) return;
|
|
206
212
|
await runArtifactCommand(subcommand, rest);
|
|
207
213
|
return;
|
|
214
|
+
case "workflow":
|
|
215
|
+
// The gates of `artifact`: a stage skill resolves and records in its Session Companion.
|
|
216
|
+
// `next` writes nothing and the turn hooks run it, so a required update cannot switch
|
|
217
|
+
// their hand-off check off.
|
|
218
|
+
if (!(await gate({ updateGuard: subcommand !== "next", companion: true, install: true }))) {
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
await runWorkflowCommand(subcommand, rest);
|
|
222
|
+
return;
|
|
208
223
|
case "companion":
|
|
209
224
|
switch (subcommand) {
|
|
210
225
|
// setup/link are recovery paths and must never be gated on the
|
|
@@ -271,7 +286,19 @@ export async function main(argv = process.argv, deps: MainDeps = mainDeps): Prom
|
|
|
271
286
|
await runLaunchOpenCodeCommand(argv.slice(3), { directPassthrough: true });
|
|
272
287
|
return;
|
|
273
288
|
case "report":
|
|
274
|
-
if (!(await gate({ updateGuard: true, install: true })))
|
|
289
|
+
if (!(await gate({ updateGuard: true, install: true }))) {
|
|
290
|
+
console.log(
|
|
291
|
+
JSON.stringify({
|
|
292
|
+
kind: "error",
|
|
293
|
+
version: 1,
|
|
294
|
+
error: {
|
|
295
|
+
code: "PREFLIGHT_FAILED",
|
|
296
|
+
message: "Mate must be updated or installed before reporting; see stderr",
|
|
297
|
+
},
|
|
298
|
+
}),
|
|
299
|
+
);
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
275
302
|
await runReportCommand(argv.slice(3));
|
|
276
303
|
return;
|
|
277
304
|
case "studio":
|
|
@@ -302,12 +329,6 @@ export async function main(argv = process.argv, deps: MainDeps = mainDeps): Prom
|
|
|
302
329
|
if (!(await gate({}))) return;
|
|
303
330
|
await runWorkingCommand(subcommand, rest);
|
|
304
331
|
return;
|
|
305
|
-
case "factory":
|
|
306
|
-
// The appliance's factory broker, started by its root supervisor: no
|
|
307
|
-
// companion, no installation, no prompt may block it.
|
|
308
|
-
if (!(await gate({}))) return;
|
|
309
|
-
await runFactoryCommand(subcommand, rest);
|
|
310
|
-
return;
|
|
311
332
|
case "wrap": {
|
|
312
333
|
// Recording the answer is the point, so a recorded one must not suppress
|
|
313
334
|
// the wizard; a bad flag is reported without prompting first.
|
|
@@ -324,22 +345,37 @@ export async function main(argv = process.argv, deps: MainDeps = mainDeps): Prom
|
|
|
324
345
|
}
|
|
325
346
|
case "session":
|
|
326
347
|
/**
|
|
327
|
-
* Spawned by the OpenCode plugin for a bare session
|
|
328
|
-
* no
|
|
348
|
+
* Spawned by the OpenCode plugin for a bare session and by editor plugins
|
|
349
|
+
* for the session registry: no update prompt, no companion picker, no
|
|
350
|
+
* install repair may block it.
|
|
329
351
|
*/
|
|
330
352
|
if (!(await gate({}))) return;
|
|
331
353
|
await runSessionCommand(subcommand, rest);
|
|
332
354
|
return;
|
|
355
|
+
case "vscode":
|
|
356
|
+
// Installs an editor extension: needs no companion, repository, or installation.
|
|
357
|
+
if (!(await gate({}))) return;
|
|
358
|
+
await runVscodeCommand(subcommand, rest);
|
|
359
|
+
return;
|
|
333
360
|
case "unwrap":
|
|
334
361
|
// A recovery path: it withdraws what a wrap placed, so it must never be
|
|
335
362
|
// gated on a companion or an installation it does not consult.
|
|
336
363
|
if (!(await gate({}))) return;
|
|
337
364
|
await runUnwrapCommand(argv.slice(3));
|
|
338
365
|
return;
|
|
339
|
-
default:
|
|
366
|
+
default: {
|
|
367
|
+
// A service's own command, e.g. a daemon started by its supervisor: no
|
|
368
|
+
// companion, no installation, no prompt may block it.
|
|
369
|
+
const serviceCommand = findServiceCommand(command);
|
|
370
|
+
if (serviceCommand) {
|
|
371
|
+
if (!(await gate({}))) return;
|
|
372
|
+
await serviceCommand.run(argv.slice(3));
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
340
375
|
// Unknown commands fail fast: no case matched, so no gate ever ran.
|
|
341
376
|
console.error(`Unknown command: ${command}`);
|
|
342
377
|
console.error(usage());
|
|
343
378
|
process.exitCode = 1;
|
|
379
|
+
}
|
|
344
380
|
}
|
|
345
381
|
}
|