@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
|
@@ -3,15 +3,10 @@
|
|
|
3
3
|
import { Box, Text, render as inkRender } from "ink";
|
|
4
4
|
import React, { useEffect } from "react";
|
|
5
5
|
|
|
6
|
+
import type { CompanionListing, ConnectedCompanion } from "./commands/companion/list";
|
|
6
7
|
import type { LinkedRepository } from "../lib/orchestrator/types";
|
|
7
8
|
|
|
8
|
-
interface
|
|
9
|
-
repositories: LinkedRepository[];
|
|
10
|
-
activeRepositoryId?: string;
|
|
11
|
-
onMounted?: () => void;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
interface RenderRepoListTableOptions {
|
|
9
|
+
interface RenderCompanionListTableOptions {
|
|
15
10
|
stdout?: NodeJS.WriteStream;
|
|
16
11
|
stderr?: NodeJS.WriteStream;
|
|
17
12
|
}
|
|
@@ -24,19 +19,56 @@ function pad(value: string, width: number): string {
|
|
|
24
19
|
return value.padEnd(width);
|
|
25
20
|
}
|
|
26
21
|
|
|
27
|
-
function
|
|
28
|
-
repositories,
|
|
29
|
-
activeRepositoryId,
|
|
30
|
-
onMounted,
|
|
31
|
-
}: RepoListTableProps): React.JSX.Element {
|
|
22
|
+
function useMounted(onMounted?: () => void): void {
|
|
32
23
|
useEffect(() => {
|
|
33
24
|
onMounted?.();
|
|
34
25
|
}, [onMounted]);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function CompanionTable({
|
|
29
|
+
companions,
|
|
30
|
+
onMounted,
|
|
31
|
+
}: {
|
|
32
|
+
companions: ConnectedCompanion[];
|
|
33
|
+
onMounted?: () => void;
|
|
34
|
+
}): React.JSX.Element {
|
|
35
|
+
useMounted(onMounted);
|
|
35
36
|
|
|
36
37
|
const markerWidth = columnWidth(
|
|
37
38
|
"Active",
|
|
38
|
-
|
|
39
|
+
companions.map((companion) => (companion.active ? "*" : "")),
|
|
40
|
+
);
|
|
41
|
+
const pathWidth = columnWidth(
|
|
42
|
+
"Path",
|
|
43
|
+
companions.map((companion) => companion.path),
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<Box flexDirection="column" width="100%">
|
|
48
|
+
<Text bold>Connected companion</Text>
|
|
49
|
+
<Box marginTop={1} flexDirection="column">
|
|
50
|
+
<Text dimColor>
|
|
51
|
+
{pad("Active", markerWidth)} {pad("Path", pathWidth)}
|
|
52
|
+
</Text>
|
|
53
|
+
{companions.map((companion) => (
|
|
54
|
+
<Text key={companion.path} color={companion.active ? "green" : undefined}>
|
|
55
|
+
{pad(companion.active ? "*" : "", markerWidth)} {pad(companion.path, pathWidth)}
|
|
56
|
+
</Text>
|
|
57
|
+
))}
|
|
58
|
+
</Box>
|
|
59
|
+
</Box>
|
|
39
60
|
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function RepositoryTable({
|
|
64
|
+
repositories,
|
|
65
|
+
onMounted,
|
|
66
|
+
}: {
|
|
67
|
+
repositories: LinkedRepository[];
|
|
68
|
+
onMounted?: () => void;
|
|
69
|
+
}): React.JSX.Element {
|
|
70
|
+
useMounted(onMounted);
|
|
71
|
+
|
|
40
72
|
const idWidth = columnWidth(
|
|
41
73
|
"ID",
|
|
42
74
|
repositories.map((repository) => repository.id),
|
|
@@ -51,28 +83,36 @@ function RepoListTable({
|
|
|
51
83
|
<Text bold>Linked repositories</Text>
|
|
52
84
|
<Box marginTop={1} flexDirection="column">
|
|
53
85
|
<Text dimColor>
|
|
54
|
-
{pad("
|
|
86
|
+
{pad("ID", idWidth)} {pad("Path", pathWidth)}
|
|
55
87
|
</Text>
|
|
56
|
-
{repositories.map((repository) =>
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
<Text key={repository.id} color={isActive ? "green" : undefined}>
|
|
62
|
-
{pad(marker, markerWidth)} {pad(repository.id, idWidth)}{" "}
|
|
63
|
-
{pad(repository.path, pathWidth)}
|
|
64
|
-
</Text>
|
|
65
|
-
);
|
|
66
|
-
})}
|
|
88
|
+
{repositories.map((repository) => (
|
|
89
|
+
<Text key={repository.id}>
|
|
90
|
+
{pad(repository.id, idWidth)} {pad(repository.path, pathWidth)}
|
|
91
|
+
</Text>
|
|
92
|
+
))}
|
|
67
93
|
</Box>
|
|
68
94
|
</Box>
|
|
69
95
|
);
|
|
70
96
|
}
|
|
71
97
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
98
|
+
/** The connected companions in a Working Repository, the linked repositories in a companion root. */
|
|
99
|
+
export function CompanionListTable({
|
|
100
|
+
listing,
|
|
101
|
+
onMounted,
|
|
102
|
+
}: {
|
|
103
|
+
listing: CompanionListing;
|
|
104
|
+
onMounted?: () => void;
|
|
105
|
+
}): React.JSX.Element {
|
|
106
|
+
return "companions" in listing ? (
|
|
107
|
+
<CompanionTable companions={listing.companions} onMounted={onMounted} />
|
|
108
|
+
) : (
|
|
109
|
+
<RepositoryTable repositories={listing.repositories} onMounted={onMounted} />
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export async function renderCompanionListTable(
|
|
114
|
+
listing: CompanionListing,
|
|
115
|
+
options: RenderCompanionListTableOptions = {},
|
|
76
116
|
): Promise<void> {
|
|
77
117
|
const stdout = options.stdout ?? process.stdout;
|
|
78
118
|
const stderr = options.stderr ?? process.stderr;
|
|
@@ -85,13 +125,9 @@ export async function renderRepoListTable(
|
|
|
85
125
|
resolve();
|
|
86
126
|
};
|
|
87
127
|
|
|
88
|
-
rendered = inkRender(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
onMounted={onMounted}
|
|
93
|
-
/>,
|
|
94
|
-
{ stdout, stderr },
|
|
95
|
-
);
|
|
128
|
+
rendered = inkRender(<CompanionListTable listing={listing} onMounted={onMounted} />, {
|
|
129
|
+
stdout,
|
|
130
|
+
stderr,
|
|
131
|
+
});
|
|
96
132
|
});
|
|
97
133
|
}
|
package/src/cli/usage.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getActiveDistribution } from "../distribution";
|
|
2
2
|
import { FRAMEWORK_NAME } from "../framework";
|
|
3
3
|
import { pluginCliCommandLines } from "./plugin-commands";
|
|
4
|
+
import { serviceCommandLines } from "../tools/setup/service-registry";
|
|
4
5
|
|
|
5
6
|
export function usage(): string {
|
|
6
7
|
const n = FRAMEWORK_NAME;
|
|
@@ -18,28 +19,44 @@ export function usage(): string {
|
|
|
18
19
|
` ${n} companion list`,
|
|
19
20
|
` ${n} companion sync`,
|
|
20
21
|
` ${n} companion update [--yes]`,
|
|
21
|
-
` ${n} companion open`,
|
|
22
|
+
` ${n} companion open [--no-open] [--json]`,
|
|
22
23
|
` ${n} companion tui`,
|
|
23
24
|
` ${n} working cleanup`,
|
|
24
25
|
` ${n} working link --companion <path> --yes`,
|
|
25
26
|
` ${n} working worktree <workset-id> [--companion <path>] [--no-install] [--json]`,
|
|
26
|
-
` ${n} working worktree --change <change> [--enter] [--companion <path>] [--no-install] [--json]`,
|
|
27
|
+
` ${n} working worktree --change <change> [--enter] [--take-branch] [--companion <path>] [--no-install] [--json]`,
|
|
27
28
|
` ${n} working worktree prune [--companion <path>] [--json]`,
|
|
28
29
|
` ${n} wrap [--companion PATH]`,
|
|
29
30
|
` ${n} unwrap`,
|
|
30
31
|
` ${n} session prepare --repo <dir> [--json] [--sync]`,
|
|
31
32
|
` ${n} session context --repo <dir> [--json]`,
|
|
33
|
+
` ${n} session add --runtime <claude|opencode> --id <id> --cwd <dir> --json`,
|
|
34
|
+
` ${n} session list --json`,
|
|
35
|
+
` ${n} session remove <id> --json`,
|
|
36
|
+
` ${n} session stop <id> --json`,
|
|
32
37
|
` ${n} hub init [folder]`,
|
|
33
38
|
` ${n} hub add [source] [--id ID] [--path PATH]`,
|
|
34
39
|
` ${n} hub sync [--json] (companions + hub plugins)`,
|
|
35
|
-
` ${n} artifact publish <
|
|
36
|
-
"
|
|
40
|
+
` ${n} artifact publish <group|change|anchor>|--specs [<path>...]|--all [--refresh]`,
|
|
41
|
+
" [--confirm-merged|--confirm-open|--confirm-dropped] [--type openspec] [--no-push] [--json]",
|
|
42
|
+
" target: a Delivery Group or submitted change, or a dated archive anchor of an earlier Mate",
|
|
37
43
|
` ${n} artifact pending [--json]`,
|
|
38
44
|
` ${n} artifact link <change>... [--repository <org/repo>] [--branch <b> [--direct]]`,
|
|
39
45
|
" [--not-applicable <reason>] [--pr <url>] [--ticket <KEY>] [--refresh]",
|
|
40
|
-
" [--confirm-merged|--confirm-open|--confirm-dropped] [--json]",
|
|
41
|
-
` ${n} artifact
|
|
46
|
+
" [--confirm-merged|--confirm-open|--confirm-dropped] [--spec-base] [--json]",
|
|
47
|
+
` ${n} artifact submit <change>... [--repository <org/repo>]`,
|
|
48
|
+
" [--branch <b> [--direct]|--not-applicable <reason>|--skip-branch] [--fetch] [--json]",
|
|
49
|
+
` ${n} artifact submit --drop <change>... [--json]`,
|
|
50
|
+
` ${n} artifact take <change> [--json] a submitted change into this checkout, to revise it`,
|
|
51
|
+
` ${n} artifact archive <change> [options] (deprecated alias of artifact submit)`,
|
|
52
|
+
` ${n} artifact resolve <change> (--capability <c> --requirement <name> --file <path>)...`,
|
|
53
|
+
" [--json] one triple per stale requirement of the change",
|
|
54
|
+
` ${n} artifact project <change> [--json]`,
|
|
42
55
|
` ${n} artifact apply-context <change> --json [--since <digest>]`,
|
|
56
|
+
` ${n} workflow steps <stage> [--json] a Delivery Path stage's steps, entry and next stage`,
|
|
57
|
+
` ${n} workflow done <skill> [<change>] [--json] record a finished step; prints the next`,
|
|
58
|
+
` ${n} workflow next <change> [--after <skill>] [--json] the stage a change is at and its next actions`,
|
|
59
|
+
` ${n} workflow trust [--json] approve the run: commands the companion's workflow declares`,
|
|
43
60
|
` ${n} doctor`,
|
|
44
61
|
` ${n} report [--days N] [--input FILE|-] [--json]`,
|
|
45
62
|
` ${n} studio [--writable] [--terminal] [--detach-timeout <minutes>]`,
|
|
@@ -47,10 +64,9 @@ export function usage(): string {
|
|
|
47
64
|
" [--detach-timeout <minutes>] [--token <value>] [--allowed-host <host>]",
|
|
48
65
|
" [--public-origin <origin>] [--companion <path>] [--no-git]",
|
|
49
66
|
" [--profile standard|appliance]",
|
|
50
|
-
|
|
51
|
-
" --user <name> --companions-dir <dir> (the appliance's factory broker, run as root)",
|
|
52
|
-
` ${n} factory attach <workset> --session <id> --companion <path> [--start clarify|explore|continue]`,
|
|
67
|
+
...serviceCommandLines(),
|
|
53
68
|
` ${n} config`,
|
|
69
|
+
` ${n} vscode setup [--editor code|cursor] [--vsix <path>] [--if-installed]`,
|
|
54
70
|
` ${n} claude [args...] (after --: --no-git, --companion, --yes no-op)`,
|
|
55
71
|
` ${n} opencode [args...] (after --: --no-git, --companion, --yes no-op)`,
|
|
56
72
|
` ${n} cap openspec <subcommand> [args...]`,
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core runtime the Mate factory plugin (github.com/uniqbit-ag/mate-factory) uses:
|
|
3
|
+
* Worksets, Delivery records, companion config and Studio's server for its tests.
|
|
4
|
+
*
|
|
5
|
+
* Not a stable API. The factory pins mate-core exactly and must share the running
|
|
6
|
+
* core's module instance: its distribution imports this entry from the same
|
|
7
|
+
* `node_modules` tree as `@uniqbit/mate-core` itself, never from a second copy.
|
|
8
|
+
*/
|
|
9
|
+
export { usage } from "./cli/usage";
|
|
10
|
+
export { readCompanionWorksetStages } from "./cli/commands/studio/payload";
|
|
11
|
+
export type { StudioCompanionPayload, StudioWorkset } from "./cli/commands/studio/payload";
|
|
12
|
+
export { companionDigest } from "./cli/commands/studio/selection";
|
|
13
|
+
export { createStudioAccess } from "./cli/commands/studio/access";
|
|
14
|
+
export { createStudioFetch } from "./cli/commands/studio/server";
|
|
15
|
+
export { LiveSessions } from "./cli/commands/studio/live-sessions";
|
|
16
|
+
export { activeChanges, changesDirOf } from "./lib/change-layout";
|
|
17
|
+
export { companionTicketFormat, TICKETS_OFF, workingRepoGit } from "./lib/delivery/branches";
|
|
18
|
+
export { deliveryCheckout } from "./lib/delivery/checkout";
|
|
19
|
+
export { declaredDependencies } from "./lib/delivery/overlap";
|
|
20
|
+
export {
|
|
21
|
+
defaultDeliveryBranch,
|
|
22
|
+
findDelivery,
|
|
23
|
+
readDeliveryRecord,
|
|
24
|
+
sameRepository,
|
|
25
|
+
unlinkedRecord,
|
|
26
|
+
upsertDelivery,
|
|
27
|
+
writeDeliveryRecord,
|
|
28
|
+
} from "./lib/delivery/record";
|
|
29
|
+
export { parseRemote } from "./lib/delivery/remote";
|
|
30
|
+
export {
|
|
31
|
+
newBranchBase,
|
|
32
|
+
resolveDeliveryBranch,
|
|
33
|
+
worktreeAddArgs,
|
|
34
|
+
} from "./lib/delivery/resolve-branch";
|
|
35
|
+
export { groupOfChange, hasUnsubmittedWork, submissionState } from "./lib/delivery/staging/submit";
|
|
36
|
+
export { pathIsDirectory } from "./lib/fs-utils";
|
|
37
|
+
export { gitKeyOf, gitTokenKeyOf } from "./lib/git-key";
|
|
38
|
+
export { KeyedSerial } from "./lib/keyed-serial";
|
|
39
|
+
export { scopedRepositories } from "./lib/openspec-scopes";
|
|
40
|
+
export { mateSessionEnvironment } from "./lib/orchestrator/adapters/base";
|
|
41
|
+
export { readCompanionConfig } from "./lib/orchestrator/config-store";
|
|
42
|
+
export type { FrameworkConfig } from "./lib/orchestrator/types";
|
|
43
|
+
export {
|
|
44
|
+
addLocalRepository,
|
|
45
|
+
readLocalRepositories,
|
|
46
|
+
removeLocalRepository,
|
|
47
|
+
} from "./lib/workset/factory-local";
|
|
48
|
+
export {
|
|
49
|
+
advanceWorkset,
|
|
50
|
+
createOutcome,
|
|
51
|
+
findWorkset,
|
|
52
|
+
isRepositoryIdentity,
|
|
53
|
+
isWorksetId,
|
|
54
|
+
readWorksets,
|
|
55
|
+
removeWorkset,
|
|
56
|
+
resolveWorksetBranch,
|
|
57
|
+
setWorksetStarted,
|
|
58
|
+
WorksetError,
|
|
59
|
+
writeWorkset,
|
|
60
|
+
type WorksetRecord,
|
|
61
|
+
} from "./lib/workset/record";
|
|
62
|
+
export { linkedRepositoryIdentities, repositorySources } from "./lib/workset/repositories";
|
|
63
|
+
export type { WorksetStageId } from "./lib/workset/stage";
|
|
64
|
+
export { readWorksetStages, type WorksetWithStage } from "./lib/workset/stages";
|
|
65
|
+
export { buildCompanionGuidance } from "./playbooks/companion-guidance";
|
|
66
|
+
export { errorMessage } from "./runtime/error-message";
|
|
67
|
+
export { resolveSecretPolicy } from "./runtime/policy";
|
|
68
|
+
export { deployReactDoctorSkill } from "./tools/setup/capabilities/react-doctor";
|
|
69
|
+
export { applyMateSkills, MATE_SKILLS } from "./tools/setup/mate";
|
|
@@ -5,15 +5,17 @@ import {
|
|
|
5
5
|
COMPANION_INSTRUCTIONS_BUDGET,
|
|
6
6
|
buildCompanionInstructions,
|
|
7
7
|
companionInstructionsUnavailableLine,
|
|
8
|
+
type CompanionInstructions,
|
|
8
9
|
type CompanionInstructionsInput,
|
|
9
10
|
type InstructionReader,
|
|
10
11
|
} from "../runtime/companion-instructions";
|
|
11
12
|
import { MATE_ENV, hasLaunchEnvironment } from "../runtime/env";
|
|
12
13
|
import { FRAMEWORK_NAME } from "../runtime/framework";
|
|
13
14
|
import { PROJECTED_FLAG } from "../runtime/projected-flag";
|
|
14
|
-
import {
|
|
15
|
+
import { checkoutServedFrom } from "../runtime/git-layout";
|
|
16
|
+
import { projectionCheckout, resolveProjection } from "../runtime/projection";
|
|
15
17
|
import { managedSessionKind, type SessionKind } from "../runtime/session-kind";
|
|
16
|
-
import { hookOutcome, runHook, type HookCall, type HookEnv } from "./hook-io";
|
|
18
|
+
import { hookFolder, hookOutcome, runHook, type HookCall, type HookEnv } from "./hook-io";
|
|
17
19
|
|
|
18
20
|
export interface InstructionHookPayload {
|
|
19
21
|
hookSpecificOutput?: { hookEventName: InstructionEvent; additionalContext: string };
|
|
@@ -79,30 +81,47 @@ function ownsEvent(event: InstructionEvent, kind: SessionKind, projected: boolea
|
|
|
79
81
|
return false;
|
|
80
82
|
}
|
|
81
83
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
type Unavailable = Extract<CompanionInstructions, { kind: "unavailable" }>;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Reached only for a repository-scoped launch, so the companion and repository paths are
|
|
88
|
+
* set. A partial one is not completed from a projection, which may name another
|
|
89
|
+
* repository. A session moved into another Checkout of the clone names it.
|
|
90
|
+
*/
|
|
91
|
+
function launchReaderInput(env: HookEnv, folder: string): CompanionInstructionsInput | Unavailable {
|
|
92
|
+
const companionPath = env[MATE_ENV.companionPath] ?? "";
|
|
85
93
|
const id = env[MATE_ENV.repositoryId];
|
|
86
|
-
const repoPath = env[MATE_ENV.repositoryPath];
|
|
94
|
+
const repoPath = env[MATE_ENV.repositoryPath] ?? "";
|
|
87
95
|
const wrapperBinPath = env[MATE_ENV.wrapperBinPath];
|
|
88
|
-
if (!
|
|
89
|
-
|
|
96
|
+
if (!id || !wrapperBinPath) {
|
|
97
|
+
const missing = [!id && MATE_ENV.repositoryId, !wrapperBinPath && MATE_ENV.wrapperBinPath];
|
|
98
|
+
return {
|
|
99
|
+
kind: "unavailable",
|
|
100
|
+
source: "the Mate launch environment",
|
|
101
|
+
reason: `lacks ${missing.filter(Boolean).join(", ")}`,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
return {
|
|
105
|
+
companionPath,
|
|
106
|
+
repository: { id, path: checkoutServedFrom(repoPath, folder) },
|
|
107
|
+
wrapperBinPath,
|
|
108
|
+
};
|
|
90
109
|
}
|
|
91
110
|
|
|
92
111
|
/** The environment always wins: a managed session never reads the projection. */
|
|
93
112
|
function readerInput(
|
|
94
113
|
env: HookEnv,
|
|
95
114
|
kind: SessionKind,
|
|
96
|
-
|
|
115
|
+
folder: string,
|
|
97
116
|
resolve: typeof resolveProjection,
|
|
98
|
-
): CompanionInstructionsInput | null {
|
|
99
|
-
if (kind !== "unmanaged") return launchReaderInput(env);
|
|
100
|
-
const projection = resolve(
|
|
117
|
+
): CompanionInstructionsInput | Unavailable | null {
|
|
118
|
+
if (kind !== "unmanaged") return launchReaderInput(env, folder);
|
|
119
|
+
const projection = resolve(folder);
|
|
101
120
|
if (!projection) return null;
|
|
102
121
|
return {
|
|
103
122
|
companionPath: projection.companionPath,
|
|
104
|
-
/** A linked worktree on a
|
|
105
|
-
repository: { id: projection.repositoryId, path: projection
|
|
123
|
+
/** A linked worktree on a borrowed or copied projection names itself, not the lender. */
|
|
124
|
+
repository: { id: projection.repositoryId, path: projectionCheckout(projection) },
|
|
106
125
|
wrapperBinPath: projection.wrapperBinPath,
|
|
107
126
|
};
|
|
108
127
|
}
|
|
@@ -127,10 +146,10 @@ function evaluate(
|
|
|
127
146
|
const kind = sessionKind(env);
|
|
128
147
|
if (!ownsEvent(event, kind, projected)) return null;
|
|
129
148
|
|
|
130
|
-
const reader = readerInput(env, kind, directory || input
|
|
149
|
+
const reader = readerInput(env, kind, directory || hookFolder(input, env, cwd), resolve);
|
|
131
150
|
if (!reader) return null;
|
|
132
151
|
|
|
133
|
-
const result = read(reader);
|
|
152
|
+
const result = "kind" in reader ? reader : read(reader);
|
|
134
153
|
if (result.kind === "unavailable") {
|
|
135
154
|
const line = companionInstructionsUnavailableLine(result);
|
|
136
155
|
return instructionOutput(event, line, line);
|
package/src/hooks/hook-io.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** Stdin and stdout of a Claude hook shim. */
|
|
2
|
+
import { guardLaunchEnvironment } from "../runtime/launch-env-guard";
|
|
2
3
|
|
|
3
4
|
export type HookEnv = Record<string, string | undefined>;
|
|
4
5
|
|
|
@@ -10,6 +11,18 @@ export interface HookCall {
|
|
|
10
11
|
input: unknown;
|
|
11
12
|
}
|
|
12
13
|
|
|
14
|
+
/**
|
|
15
|
+
* The folder a hook resolves its session for (design Decision 10): the
|
|
16
|
+
* input's `cwd`, which follows the session into a worktree after EnterWorktree,
|
|
17
|
+
* then `CLAUDE_PROJECT_DIR`, which still names the folder the session started
|
|
18
|
+
* in, then the process's own folder.
|
|
19
|
+
*/
|
|
20
|
+
export function hookFolder(input: unknown, env: HookEnv, cwd: string): string {
|
|
21
|
+
const fromInput =
|
|
22
|
+
input && typeof input === "object" ? (input as { cwd?: unknown }).cwd : undefined;
|
|
23
|
+
return (typeof fromInput === "string" && fromInput) || env.CLAUDE_PROJECT_DIR || cwd;
|
|
24
|
+
}
|
|
25
|
+
|
|
13
26
|
export interface HookOutcome {
|
|
14
27
|
exitCode: number;
|
|
15
28
|
stdout: string;
|
|
@@ -44,10 +57,14 @@ async function readHookInput(): Promise<unknown> {
|
|
|
44
57
|
export async function runHook(
|
|
45
58
|
build: (input: unknown) => HookOutcome | Promise<HookOutcome>,
|
|
46
59
|
onError: (error: unknown) => HookOutcome,
|
|
60
|
+
/** The payload; stdin by default, or what a shim already read from it. */
|
|
61
|
+
readInput: () => Promise<unknown> = readHookInput,
|
|
47
62
|
): Promise<number> {
|
|
48
63
|
let outcome: HookOutcome;
|
|
49
64
|
try {
|
|
50
|
-
|
|
65
|
+
// A background session can inherit another launch's environment from Claude's daemon.
|
|
66
|
+
guardLaunchEnvironment(process.env, process.cwd());
|
|
67
|
+
outcome = await build(await readInput());
|
|
51
68
|
} catch (error) {
|
|
52
69
|
outcome = onError(error);
|
|
53
70
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Deny a git call RTK would wrap in a Claude session moved into a linked worktree.
|
|
2
|
+
import { movedIntoLinkedWorktree } from "../runtime/entered-worktree";
|
|
3
|
+
import {
|
|
4
|
+
companionSelectsRtk,
|
|
5
|
+
runnableGitCommand,
|
|
6
|
+
type RewriteRunner,
|
|
7
|
+
} from "../runtime/rtk-git-guard";
|
|
8
|
+
import { hookOutcome, type HookEnv, type HookOutcome } from "./hook-io";
|
|
9
|
+
|
|
10
|
+
interface BashHookInput {
|
|
11
|
+
cwd?: unknown;
|
|
12
|
+
tool_input?: unknown;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface RtkWorktreeGitDeps {
|
|
16
|
+
rtkSelected?: (cwd: string, env: HookEnv) => boolean;
|
|
17
|
+
rewrite?: RewriteRunner;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* A deny naming the runnable command, else no output. Never `updatedInput`: two
|
|
22
|
+
* rewriting hooks race and the slower one wins, so a rewrite could lose to RTK's.
|
|
23
|
+
* Cheapest checks first; `rtk rewrite` runs only for a moved session with RTK selected.
|
|
24
|
+
*/
|
|
25
|
+
export function buildRtkWorktreeGit(
|
|
26
|
+
input: unknown,
|
|
27
|
+
env: HookEnv = process.env,
|
|
28
|
+
deps: RtkWorktreeGitDeps = {},
|
|
29
|
+
): HookOutcome {
|
|
30
|
+
try {
|
|
31
|
+
const { cwd, tool_input: toolInput } = (input ?? {}) as BashHookInput;
|
|
32
|
+
const command = (toolInput as { command?: unknown } | null | undefined)?.command;
|
|
33
|
+
if (typeof cwd !== "string" || typeof command !== "string") return hookOutcome(null);
|
|
34
|
+
if (!movedIntoLinkedWorktree(cwd, env.CLAUDE_PROJECT_DIR)) return hookOutcome(null);
|
|
35
|
+
if (!(deps.rtkSelected ?? companionSelectsRtk)(cwd, env)) return hookOutcome(null);
|
|
36
|
+
const runnable = runnableGitCommand(command, deps.rewrite);
|
|
37
|
+
if (!runnable) return hookOutcome(null);
|
|
38
|
+
return hookOutcome({
|
|
39
|
+
hookSpecificOutput: {
|
|
40
|
+
hookEventName: "PreToolUse",
|
|
41
|
+
permissionDecision: "deny",
|
|
42
|
+
permissionDecisionReason: `This session moved into a linked worktree, where Claude Code refuses git run through RTK (rtk git). Run instead: ${runnable}`,
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
} catch {
|
|
46
|
+
return hookOutcome(null);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -14,7 +14,29 @@ import { FRAMEWORK_NAME } from "../runtime/framework";
|
|
|
14
14
|
import { projectionFreshness, projectionStalenessLines } from "../runtime/freshness";
|
|
15
15
|
import { mateVersion } from "../runtime/install";
|
|
16
16
|
import { PROJECTED_FLAG } from "../runtime/projected-flag";
|
|
17
|
-
import {
|
|
17
|
+
import { pendingSubmittedLine } from "../runtime/pending-records";
|
|
18
|
+
import { projectionCheckout } from "../runtime/projection";
|
|
19
|
+
import { readWorkflow } from "../runtime/workflow/declaration";
|
|
20
|
+
import { hookFolder, hookOutcome, runHook, type HookEnv, type HookOutcome } from "./hook-io";
|
|
21
|
+
|
|
22
|
+
/** Problems of an invalid declaration named in the banner; the rest are counted. */
|
|
23
|
+
const WORKFLOW_PROBLEMS_SHOWN = 5;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* An invalid workflow declaration, by problem: its stages do not run and guidance keeps the
|
|
27
|
+
* built-in reading rule until it is fixed. Empty for a valid or absent one.
|
|
28
|
+
*/
|
|
29
|
+
export function workflowProblemLines(companionPath: string): string[] {
|
|
30
|
+
const verdict = readWorkflow(companionPath);
|
|
31
|
+
if (verdict.ok) return [];
|
|
32
|
+
const shown = verdict.problems.slice(0, WORKFLOW_PROBLEMS_SHOWN);
|
|
33
|
+
const more = verdict.problems.length - shown.length;
|
|
34
|
+
return [
|
|
35
|
+
`workflow: ${verdict.file} is invalid; its stages do not run until it is fixed`,
|
|
36
|
+
...shown.map((problem) => ` ${problem.path ? `${problem.path}: ` : ""}${problem.message}`),
|
|
37
|
+
...(more > 0 ? [` and ${more} more`] : []),
|
|
38
|
+
];
|
|
39
|
+
}
|
|
18
40
|
|
|
19
41
|
/**
|
|
20
42
|
* Resolves in-process from either source — no subprocess in either branch.
|
|
@@ -46,7 +68,8 @@ export async function buildBanner(
|
|
|
46
68
|
*/
|
|
47
69
|
const ownsGitSync =
|
|
48
70
|
!hasLaunchEnvironment(env) &&
|
|
49
|
-
unmanagedClaudeDelivery(projection
|
|
71
|
+
unmanagedClaudeDelivery(projection ? projectionCheckout(projection) : undefined).gitSync ===
|
|
72
|
+
"banner";
|
|
50
73
|
const gitNotes = ownsGitSync
|
|
51
74
|
? unattendedSyncStalenessLines(
|
|
52
75
|
await syncCompanionUnattended(context.companionPath, { lock: "try", ...syncOptions }),
|
|
@@ -65,6 +88,10 @@ export async function buildBanner(
|
|
|
65
88
|
}
|
|
66
89
|
/** `systemMessage` only: the model must never be told to run the command. */
|
|
67
90
|
for (const note of gitNotes) lines.push(` ${note}`);
|
|
91
|
+
/** Read after the synchronization above, with bounded local Git only. */
|
|
92
|
+
const pending = await pendingSubmittedLine(context.companionPath, syncOptions.homeDir);
|
|
93
|
+
if (pending) lines.push(` ${pending}`);
|
|
94
|
+
for (const note of workflowProblemLines(context.companionPath)) lines.push(` ${note}`);
|
|
68
95
|
|
|
69
96
|
return hookOutcome({ systemMessage: lines.join("\n") });
|
|
70
97
|
}
|
|
@@ -72,7 +99,7 @@ export async function buildBanner(
|
|
|
72
99
|
/** Plugin-shim entry; exits zero even when the banner fails. */
|
|
73
100
|
export function run(argv: readonly string[] = process.argv.slice(2)): Promise<number> {
|
|
74
101
|
return runHook(
|
|
75
|
-
() => buildBanner(process.env, process.cwd(), argv),
|
|
102
|
+
(input) => buildBanner(process.env, hookFolder(input, process.env, process.cwd()), argv),
|
|
76
103
|
(error) =>
|
|
77
104
|
hookOutcome({
|
|
78
105
|
systemMessage: `${FRAMEWORK_NAME}: session banner failed: ${errorMessage(error)}`,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Shim entries for the `SessionEnd` and `Notification` hooks: session registry updates only. */
|
|
2
|
+
import { isWrapCopy, runEnd, runNotification } from "./session-register";
|
|
3
|
+
|
|
4
|
+
export function run(argv: readonly string[] = process.argv.slice(2)): Promise<number> {
|
|
5
|
+
return runEnd(isWrapCopy, argv);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function runAttention(argv: readonly string[] = process.argv.slice(2)): Promise<number> {
|
|
9
|
+
return runNotification(isWrapCopy, argv);
|
|
10
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Deliver the companion guidance to a Claude session Mate did not launch.
|
|
2
|
+
import { guardLaunchEnvironment } from "../runtime/launch-env-guard";
|
|
2
3
|
import { buildProjectedGuidance } from "../runtime/projected-guidance";
|
|
3
|
-
import { hookOutcome, type HookEnv, type HookOutcome } from "./hook-io";
|
|
4
|
+
import { hookFolder, hookOutcome, runHook, type HookEnv, type HookOutcome } from "./hook-io";
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* `SessionStart.additionalContext` is the file-based form of the managed
|
|
@@ -24,9 +25,12 @@ export function buildSessionGuidance(env: HookEnv, cwd: string = process.cwd()):
|
|
|
24
25
|
});
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
export function run(): number {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return
|
|
28
|
+
/** Plugin-shim entry; emits nothing when it fails, as when no companion resolves. */
|
|
29
|
+
export function run(): Promise<number> {
|
|
30
|
+
// A background session can inherit another launch's environment from Claude's daemon.
|
|
31
|
+
guardLaunchEnvironment(process.env, process.cwd());
|
|
32
|
+
return runHook(
|
|
33
|
+
(input) => buildSessionGuidance(process.env, hookFolder(input, process.env, process.cwd())),
|
|
34
|
+
() => hookOutcome(null),
|
|
35
|
+
);
|
|
32
36
|
}
|