@uniqbit/mate-core 0.21.1 → 1.0.0-canary.10
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-plugin/hooks/hooks.json +32 -1
- package/claude-plugin/hooks/workflow-turn.mjs +68 -0
- package/opencode-plugin/src/companion.ts +6 -0
- package/opencode-plugin/src/server.ts +24 -0
- package/package.json +9 -4
- 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 +30 -90
- package/src/cli/commands/artifact/delivery/link.ts +26 -26
- package/src/cli/commands/artifact/delivery/output.ts +27 -4
- package/src/cli/commands/artifact/delivery/resolve.ts +102 -0
- package/src/cli/commands/artifact/delivery/submit.ts +171 -0
- package/src/cli/commands/artifact/delivery/take.ts +46 -0
- package/src/cli/commands/artifact/extract-repo-name.ts +1 -1
- package/src/cli/commands/artifact/finish/command.ts +486 -55
- package/src/cli/commands/artifact/finish/engine.ts +87 -69
- 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 +21 -174
- 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 +187 -10
- package/src/cli/commands/artifact/pending/discovery.ts +7 -11
- package/src/cli/commands/artifact/project/command.ts +59 -0
- package/src/cli/commands/cap/tokensave.ts +2 -2
- package/src/cli/commands/companion/hub.ts +11 -6
- package/src/cli/commands/companion/link.ts +173 -46
- package/src/cli/commands/companion/list.ts +70 -14
- package/src/cli/commands/companion/sync.ts +18 -0
- package/src/cli/commands/companion/update.ts +4 -3
- package/src/cli/commands/doctor.ts +84 -4
- package/src/cli/commands/friction.ts +558 -0
- package/src/cli/commands/install.ts +9 -4
- package/src/cli/commands/plugin/install.ts +82 -35
- package/src/cli/commands/studio/companion-add.ts +12 -27
- package/src/cli/commands/studio/connection.ts +53 -0
- package/src/{lib/factory/outcomes/sessions.ts → cli/commands/studio/live-sessions.ts} +7 -5
- package/src/cli/commands/studio/mcp-manager.ts +162 -0
- package/src/cli/commands/studio/payload.ts +172 -17
- package/src/cli/commands/studio/reports.ts +19 -18
- package/src/cli/commands/studio/routes.ts +8 -24
- package/src/cli/commands/studio/selection.ts +13 -4
- package/src/cli/commands/studio/server.ts +267 -243
- package/src/cli/commands/studio/service-host.ts +269 -0
- package/src/cli/commands/studio/services.ts +53 -34
- package/src/cli/commands/studio/studio-app.ts +1 -0
- package/src/cli/commands/studio/terminal.ts +1 -1
- package/src/cli/commands/studio/vault.ts +41 -40
- package/src/cli/commands/studio/views/model.ts +1 -9
- package/src/cli/commands/studio/views/vault/markdown-tree.ts +6 -5
- package/src/cli/commands/triage.ts +172 -0
- package/src/cli/commands/vscode/release-vsix.json +2 -2
- package/src/cli/commands/workflow/workflow.ts +516 -0
- package/src/cli/commands/working/cleanup.ts +1 -18
- package/src/cli/companion-link-wizard.tsx +158 -91
- package/src/cli/install-plan.tsx +3 -0
- package/src/cli/main.ts +106 -26
- package/src/cli/plugin-commands.ts +6 -1
- package/src/cli/repo-list-table.tsx +73 -37
- package/src/cli/usage.ts +30 -9
- package/src/create-mate.ts +15 -6
- package/src/distribution.ts +2 -0
- package/src/factory-host.ts +75 -0
- package/src/hooks/companion-instructions.ts +19 -8
- package/src/hooks/hook-io.ts +3 -1
- package/src/hooks/session-banner.ts +25 -0
- package/src/hooks/validate-artifact-path.ts +73 -22
- package/src/hooks/workflow-turn.ts +219 -0
- package/src/index.ts +1 -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 +4 -12
- package/src/lib/delivery/checkout.ts +3 -2
- package/src/lib/delivery/environment.ts +129 -7
- package/src/lib/delivery/merge-git.ts +312 -28
- package/src/lib/delivery/overlap.ts +81 -16
- package/src/lib/delivery/record-delivery.ts +102 -9
- package/src/lib/delivery/record.ts +186 -24
- package/src/lib/delivery/refresh.ts +241 -152
- package/src/lib/delivery/remote.ts +66 -0
- package/src/lib/delivery/repository-access.ts +30 -66
- package/src/lib/delivery/stages.ts +83 -50
- package/src/lib/delivery/staging/apply-chain.ts +182 -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/linked-merges.ts +175 -0
- package/src/lib/delivery/staging/naming.ts +67 -0
- package/src/lib/delivery/staging/openspec-type.ts +166 -0
- package/src/lib/delivery/staging/pending-edit.ts +291 -0
- package/src/lib/delivery/staging/pending.ts +922 -0
- package/src/lib/delivery/staging/preflight.ts +239 -0
- package/src/lib/delivery/staging/project.ts +512 -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 +310 -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 +176 -0
- package/src/lib/delivery/staging/submit.ts +1050 -0
- package/src/lib/delivery/staging/worktree.ts +130 -0
- package/src/lib/delivery/submit-change.ts +569 -0
- package/src/lib/friction/describe.ts +42 -0
- package/src/lib/friction/fields.ts +60 -0
- package/src/lib/friction/mark.ts +194 -0
- package/src/lib/friction/view/model.ts +67 -0
- package/src/lib/friction/view/read.ts +145 -0
- package/src/lib/friction/view/select.ts +54 -0
- package/src/lib/git-key.ts +15 -0
- package/src/lib/install.ts +2 -0
- package/src/lib/mcp-manager/resolve.ts +88 -0
- package/src/lib/mcp-manager/store.ts +133 -0
- package/src/lib/mcp-manager/types.ts +72 -0
- package/src/lib/mcp-manager/validate.ts +242 -0
- package/src/lib/openspec-canonical-frontmatter.ts +159 -0
- package/src/lib/openspec-cli.ts +10 -5
- package/src/lib/orchestrator/adapters/base.ts +31 -20
- package/src/lib/orchestrator/adapters/claude.ts +21 -7
- package/src/lib/orchestrator/adapters/opencode.ts +4 -0
- package/src/lib/orchestrator/companion-git-sync.ts +152 -16
- package/src/lib/orchestrator/config-store.ts +30 -7
- package/src/lib/orchestrator/engine-floor.ts +16 -4
- package/src/lib/orchestrator/engine-guard.ts +7 -1
- package/src/lib/orchestrator/framework-context.ts +15 -1
- package/src/lib/orchestrator/projection-claude-links.ts +1 -0
- package/src/lib/orchestrator/refresh-working-claude-links.ts +1 -0
- package/src/lib/orchestrator/repo-local-store.ts +14 -0
- package/src/lib/orchestrator/repository-link.ts +80 -52
- package/src/lib/orchestrator/root-context.ts +40 -7
- package/src/lib/orchestrator/session-prepare.ts +11 -1
- package/src/lib/orchestrator/types.ts +4 -0
- package/src/lib/orchestrator/umbrella-checkouts.ts +4 -4
- package/src/lib/package-paths.ts +23 -15
- package/src/lib/prebuilt-workspace-prepare.ts +2 -1
- package/src/lib/prebuilt-workspace.ts +1 -0
- package/src/lib/session-attribution.ts +3 -7
- package/src/lib/session-state.ts +3 -2
- package/src/lib/skills-cli.ts +38 -0
- package/src/lib/tool-manifest.ts +73 -0
- package/src/lib/triage/context.ts +312 -0
- package/src/lib/triage/launch.ts +52 -0
- package/src/lib/triage/prepare.ts +112 -0
- package/src/lib/triage/session.ts +126 -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 +2 -2
- package/src/lib/workset/repositories.ts +2 -2
- package/src/lib/workset/stage.ts +4 -2
- package/src/lib/workset/stages.ts +64 -4
- package/src/lib/workset/worktree.ts +32 -14
- package/src/opencode/companion-hooks.ts +63 -14
- package/src/opencode/projected-guidance.ts +7 -2
- package/src/opencode/turn-hook.ts +241 -0
- package/src/playbooks/companion-guidance.ts +7 -4
- package/src/plugin-api.ts +48 -0
- package/src/runtime/artifact-trailers.ts +63 -0
- package/src/runtime/claude-hook-group.ts +2 -0
- package/src/runtime/command-arg.ts +15 -0
- package/src/runtime/command-friction.ts +97 -0
- package/src/runtime/companion-git-state.ts +155 -10
- package/src/runtime/companion-git.ts +86 -11
- package/src/runtime/companion-guidance.ts +120 -17
- package/src/runtime/companion-instructions.ts +1 -1
- package/src/runtime/companion-sync.ts +109 -21
- package/src/runtime/env-names.ts +2 -2
- package/src/runtime/env.ts +7 -6
- package/src/runtime/forge-remote.ts +54 -0
- package/src/runtime/friction-fingerprint.ts +35 -0
- package/src/runtime/friction-log.ts +376 -0
- package/src/runtime/friction-recorder.ts +212 -0
- package/src/runtime/friction-retention.ts +1 -0
- package/src/runtime/friction-state.ts +110 -0
- package/src/runtime/friction-switch.ts +26 -0
- package/src/runtime/friction-vocabulary.ts +42 -0
- package/src/runtime/git-layout.ts +21 -7
- package/src/runtime/git-tracked.ts +13 -2
- package/src/runtime/json-fields.ts +8 -0
- package/src/runtime/pending-records.ts +533 -0
- package/src/runtime/projected-guidance.ts +8 -3
- package/src/runtime/publication-secret-scan.ts +45 -0
- package/src/runtime/secret-patterns.ts +7 -5
- package/src/runtime/secret-values.ts +16 -0
- package/src/runtime/session-id.ts +24 -0
- package/src/runtime/session-prepare-runner.ts +3 -0
- package/src/runtime/skill-prefix.ts +75 -0
- package/src/runtime/submitted-arrivals.ts +547 -0
- 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 +31 -3
- 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 +99 -0
- package/src/runtime/workflow/turn.ts +311 -0
- package/src/runtime/workflow/workflow.ts +262 -0
- package/src/studio.ts +113 -23
- 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 +7 -3
- package/src/templates/capabilities/react-doctor/mate-react-doctor/SKILL.md +28 -0
- package/src/templates/mate-skills/agents/mate-apply-change/SKILL.md +84 -28
- 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 +30 -68
- package/src/templates/mate-skills/agents/mate-backfill-spec/SKILL.md +23 -1
- package/src/templates/mate-skills/agents/mate-clarify-intent/SKILL.md +39 -8
- package/src/templates/mate-skills/agents/mate-domain-modeling/SKILL.md +38 -0
- package/src/templates/mate-skills/agents/mate-explore-change/SKILL.md +65 -12
- package/src/templates/mate-skills/agents/mate-grill-me/SKILL.md +28 -0
- package/src/templates/mate-skills/agents/mate-grill-with-docs/SKILL.md +28 -0
- package/src/templates/mate-skills/agents/mate-grilling/SKILL.md +25 -0
- package/src/templates/mate-skills/agents/mate-interview-me/SKILL.md +28 -0
- package/src/templates/mate-skills/agents/mate-propose-change/SKILL.md +68 -28
- package/src/templates/mate-skills/agents/mate-propose-change/references/mate-revise.md +13 -7
- 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 +136 -86
- 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 +28 -3
- package/src/templates/mate-skills/agents/mate-simplify-code/SKILL.md +39 -5
- package/src/templates/mate-skills/agents/mate-submit-change/SKILL.md +138 -0
- package/src/templates/mate-skills/claude/mate-apply-change/SKILL.md +84 -28
- 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 +30 -68
- package/src/templates/mate-skills/claude/mate-backfill-spec/SKILL.md +23 -1
- package/src/templates/mate-skills/claude/mate-clarify-intent/SKILL.md +39 -8
- package/src/templates/mate-skills/claude/mate-domain-modeling/SKILL.md +38 -0
- package/src/templates/mate-skills/claude/mate-explore-change/SKILL.md +65 -12
- package/src/templates/mate-skills/claude/mate-grill-me/SKILL.md +28 -0
- package/src/templates/mate-skills/claude/mate-grill-with-docs/SKILL.md +28 -0
- package/src/templates/mate-skills/claude/mate-grilling/SKILL.md +25 -0
- package/src/templates/mate-skills/claude/mate-interview-me/SKILL.md +28 -0
- package/src/templates/mate-skills/claude/mate-propose-change/SKILL.md +68 -28
- package/src/templates/mate-skills/claude/mate-propose-change/references/mate-revise.md +13 -7
- 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 +136 -86
- 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 +28 -3
- package/src/templates/mate-skills/claude/mate-simplify-code/SKILL.md +39 -5
- package/src/templates/mate-skills/claude/mate-submit-change/SKILL.md +138 -0
- package/src/templates/mate-skills/openspec-references.ts +3 -2
- package/src/templates/triage/PLAYBOOK.md +120 -0
- package/src/tools/setup/__snapshots__/runtime-surface-golden.test.ts.snap +678 -170
- package/src/tools/setup/capabilities/graphify.ts +23 -1
- package/src/tools/setup/capabilities/mcp-manager.ts +73 -0
- package/src/tools/setup/capabilities/openspec.ts +54 -15
- package/src/tools/setup/capabilities/rtk.ts +47 -94
- package/src/tools/setup/capabilities/tokensave.ts +79 -56
- package/src/tools/setup/context-services.ts +35 -6
- package/src/tools/setup/dynamic-plugins/api.ts +38 -0
- package/src/tools/setup/dynamic-plugins/audiences.ts +31 -16
- package/src/tools/setup/dynamic-plugins/host.ts +2 -32
- package/src/tools/setup/dynamic-plugins/hydrate.ts +32 -14
- package/src/tools/setup/dynamic-plugins/install.ts +2 -0
- package/src/tools/setup/dynamic-plugins/installed.ts +73 -0
- package/src/tools/setup/dynamic-plugins/loader.ts +12 -10
- package/src/tools/setup/dynamic-plugins/local.ts +492 -0
- package/src/tools/setup/dynamic-plugins/paths.ts +34 -6
- package/src/tools/setup/dynamic-plugins/verify.ts +34 -14
- package/src/tools/setup/dynamic-plugins/workspaces.ts +21 -12
- package/src/tools/setup/engine.ts +75 -4
- package/src/tools/setup/mate.ts +28 -1
- package/src/tools/setup/package-managers/bun.ts +8 -8
- package/src/tools/setup/plugin.ts +28 -1
- package/src/tools/setup/plugins/gitignore.ts +45 -12
- package/src/tools/setup/plugins/guidance.ts +4 -2
- package/src/tools/setup/providers/claude-format.ts +39 -2
- package/src/tools/setup/providers/claude-plugin-hooks.ts +18 -0
- package/src/tools/setup/providers/claude.ts +56 -6
- package/src/tools/setup/providers/opencode-format.ts +13 -3
- package/src/tools/setup/providers/opencode.ts +7 -18
- package/src/tools/setup/providers/relative-path-warnings.ts +26 -0
- package/src/tools/setup/service-registry.ts +69 -0
- package/src/tools/setup/service.ts +245 -0
- package/src/tools/setup/utils.ts +34 -4
- package/src/tools/setup.ts +16 -2
- package/studio-dist/client/assets/DialogTitle-B_G47-lk.js +1 -0
- package/studio-dist/client/assets/app-0NoFqMou.css +2 -0
- package/studio-dist/client/assets/button-D_0295cs.js +1 -0
- package/studio-dist/client/assets/cn-Cx_D6I3u.js +1 -0
- package/studio-dist/client/assets/combobox-D0iPQP50.js +1 -0
- package/studio-dist/client/assets/{companion-view-CrabvxS8.js → companion-view-D3A76MLj.js} +1 -1
- package/studio-dist/client/assets/fields-Ctheim1h.js +1 -0
- package/studio-dist/client/assets/friction-Cn9n_zBA.js +1 -0
- package/studio-dist/client/assets/getting-started-DgoVWbWo.js +1 -0
- package/studio-dist/client/assets/{getting-started-D6kgWwWZ.js → getting-started-MmLqvy01.js} +1 -1
- package/studio-dist/client/assets/getting-started._topic-DBF0khhz.js +1 -0
- package/studio-dist/client/assets/getting-started.index-BRdAVqIh.js +1 -0
- package/studio-dist/client/assets/graph-BVRdq46V.js +2 -0
- package/studio-dist/client/assets/{graph-canvas-Ba37Y5AE.js → graph-canvas-BNzd-eVb.js} +1 -1
- package/studio-dist/client/assets/guides-DY1W9LRs.js +1 -0
- package/studio-dist/client/assets/index-CuTIc9yd.js +40 -0
- package/studio-dist/client/assets/{markdown-view-BOX6x0rL.js → markdown-view-BqZQkk_k.js} +1 -1
- package/studio-dist/client/assets/mcp-CIFxmDs0.js +4 -0
- package/studio-dist/client/assets/panel-DafanLQ4.js +1 -0
- package/studio-dist/client/assets/plugins._service._view-xSRLxHNM.js +1 -0
- package/studio-dist/client/assets/prepaint-C--F50QZ.js +27 -0
- package/studio-dist/client/assets/{queries-RvHeXY12.js → queries-ByCoiacy.js} +1 -1
- package/studio-dist/client/assets/react-BYUSgtBs.js +1 -0
- package/studio-dist/client/assets/reports-Diryyked.js +1 -0
- package/studio-dist/client/assets/routes-DbRwPd55.js +1 -0
- package/studio-dist/client/assets/search-BDKQRwa5.js +1 -0
- package/studio-dist/client/assets/select-_9JT3hpU.js +1 -0
- package/studio-dist/client/assets/skills-D5a6ybQM.js +1 -0
- package/studio-dist/client/assets/{specs-B0ldF_6J.js → specs-COAWUTog.js} +1 -1
- package/studio-dist/client/assets/specs-view-9eTn9TcN.js +1 -0
- package/studio-dist/client/assets/steps-BS588WAV.js +1 -0
- package/studio-dist/client/assets/store-3cffhIO6.js +1 -0
- package/studio-dist/client/assets/studio-CG9eioSx.js +100 -0
- package/studio-dist/client/assets/studio-queries-BS1yR7Wc.js +2 -0
- package/studio-dist/client/assets/{usage-C2QJ_0IZ.js → usage-Ccl4d7w0.js} +15 -15
- package/studio-dist/client/assets/useAnchoredPopupScrollLock-D_y83VP7.js +1 -0
- package/studio-dist/client/assets/useBlocker-BQOfcu_f.js +1 -0
- package/studio-dist/client/assets/useMutation-BDmS2V6y.js +1 -0
- package/studio-dist/client/assets/usePopupHandleStore-BcqpNR-F.js +1 -0
- package/studio-dist/client/assets/vault-C1tOhQMe.js +1 -0
- package/studio-dist/client/assets/warnings-BZ_X1nkO.js +1 -0
- package/studio-dist/client/assets/workflow-Cm2fsnly.js +1 -0
- package/studio-dist/server/assets/DialogTitle-KSVhF_7V.js +421 -0
- package/studio-dist/server/assets/{__23tanstack-start-server-fn-resolver-Bn896ZYj.js → __23tanstack-start-server-fn-resolver-QQnIXyKi.js} +40 -28
- package/studio-dist/server/assets/_tanstack-start-manifest_v.js +84 -74
- package/studio-dist/server/assets/{button-CgOIVdmD.js → button-C7EMLaX6.js} +229 -5527
- package/studio-dist/server/assets/cn-D7uJiH_O.js +5528 -0
- package/studio-dist/server/assets/{combobox-DV_s9W0s.js → combobox-Dc4_y20Y.js} +6 -5
- package/studio-dist/server/assets/{companion-view-BKVXD3TO.js → companion-view-CrSi37Mb.js} +2 -2
- package/studio-dist/server/assets/{companions-C7fctnU9.js → companions-CDSuLqA4.js} +1 -1
- package/studio-dist/server/assets/{fields-BbieQTD0.js → fields-BxBN6-Dz.js} +10 -2
- package/studio-dist/server/assets/friction-B1K8Kp8r.js +62 -0
- package/studio-dist/server/assets/friction-Vl3B6THL.js +943 -0
- package/studio-dist/server/assets/{getting-started-CRxMWorQ.js → getting-started-B3lu5W7M.js} +2 -2
- package/studio-dist/server/assets/{getting-started._topic-DJKQAzYl.js → getting-started._topic-EYtxZM-Y.js} +2 -2
- package/studio-dist/server/assets/{getting-started.index-D84gec1t.js → getting-started.index-CTaXYycH.js} +2 -2
- package/studio-dist/server/assets/{graph-DDZzXM1L.js → graph-Bhmk7H8V.js} +1 -1
- package/studio-dist/server/assets/{graph-CSje3029.js → graph-D3fXCaKt.js} +8 -8
- package/studio-dist/server/assets/{graph-canvas-22bWB5-2.js → graph-canvas-DIvTodML.js} +2 -2
- package/studio-dist/server/assets/{guides-IE-19POz.js → guides-BZWFpJl-.js} +1 -1
- package/studio-dist/server/assets/{guides-D9dk1Frq.js → guides-CHBkRO6R.js} +1 -1
- package/studio-dist/server/assets/{guides.server-vcYRY5wx.js → guides.server-DX9KRkcK.js} +1 -1
- package/studio-dist/server/assets/{markdown-view-BR8dJ7aR.js → markdown-view-qrCSkVta.js} +1 -1
- package/studio-dist/server/assets/mcp-Ljf4simO.js +1103 -0
- package/studio-dist/server/assets/mcp-manager-DohRwmJU.js +50 -0
- package/studio-dist/server/assets/{panel-BR_t9iMM.js → panel-CAwz4mKp.js} +6 -4
- package/studio-dist/server/assets/plugins._service._view-DUpAo5D_.js +97 -0
- package/studio-dist/server/assets/prepaint-BxZ-pU7t.js +45 -0
- package/studio-dist/server/assets/{queries-DWoTin-q.js → queries-W4LXzTnT.js} +1 -1
- package/studio-dist/server/assets/react-CiBZPDs8.js +45 -0
- package/studio-dist/server/assets/{reports-CQ9qQ1-n.js → reports-BVNSPHU3.js} +13 -7
- package/studio-dist/server/assets/{reports-dYDEoBeq.js → reports-CGG_wRN5.js} +1 -1
- package/studio-dist/server/assets/{router-DkRHNTpE.js → router-KH1x6ryF.js} +1039 -1096
- package/studio-dist/server/assets/{routes-B6GfOew4.js → routes-Bl90FC4R.js} +333 -38
- package/studio-dist/server/assets/search-BjG5f16n.js +110 -0
- package/studio-dist/server/assets/{select-Af7Wibii.js → select-B8q9tLbl.js} +5 -4
- package/studio-dist/server/assets/{shell-Hq-hXgnT.js → shell-C5emwofr.js} +12 -3
- package/studio-dist/server/assets/{skills-B7nEuVbx.js → skills-10l0eCfP.js} +8 -8
- package/studio-dist/server/assets/{skills-B_YYL7q8.js → skills-vG6TTvP1.js} +1 -1
- package/studio-dist/server/assets/{specs-BpLUFntA.js → specs-C1P2BEao.js} +4 -4
- package/studio-dist/server/assets/{specs-view-0peMVd22.js → specs-view-csUBtMWU.js} +10 -10
- package/studio-dist/server/assets/{steps-D56DApvK.js → steps-T4wXftgd.js} +88 -45
- package/studio-dist/server/assets/store-CWlRjv9s.js +93 -0
- package/studio-dist/server/assets/{studio-CAcKp3bM.js → studio-D-ZPWSMv.js} +1567 -59
- package/studio-dist/server/assets/{studio-queries-BtRGzDdh.js → studio-queries-DC273ifg.js} +66 -124
- package/studio-dist/server/assets/{usage-COdjd1gD.js → usage-CT3IWLJc.js} +13 -30
- package/studio-dist/server/assets/{usage-f6pqE1tm.js → usage-D4t_ibR8.js} +1 -1
- package/studio-dist/server/assets/{useAnchoredPopupScrollLock-DlBKHRw7.js → useAnchoredPopupScrollLock-BchJDJYg.js} +2 -2
- package/studio-dist/server/assets/useBlocker-CQtANHK8.js +111 -0
- package/studio-dist/server/assets/{useMutation-DzTZGenE.js → useMutation-0HbcKUsQ.js} +2 -2
- package/studio-dist/server/assets/usePopupHandleStore-B3SNGTic.js +26 -0
- package/studio-dist/server/assets/{vault-BDuIUq0F.js → vault-BIytrudF.js} +10 -117
- package/studio-dist/server/assets/{vault-BVLp6zu3.js → vault-MINXmyXA.js} +1 -1
- package/studio-dist/server/assets/{views-flRUr21z.js → views-DrmY_3J5.js} +7 -4
- package/studio-dist/server/assets/{warnings-CDy9pdgL.js → warnings-BVZCDbIz.js} +2 -2
- package/studio-dist/server/assets/{workflow-D9GKI2EV.js → workflow-DFdqnMtW.js} +57 -50
- package/studio-dist/server/server.js +2 -2
- package/tool-manifest.yaml +85 -0
- package/src/cli/commands/factory/factory.ts +0 -311
- package/src/cli/commands/studio/factory-credential.ts +0 -35
- package/src/cli/commands/studio/factory-git-tokens.ts +0 -40
- package/src/cli/commands/studio/factory-relay.ts +0 -18
- package/src/cli/commands/studio/repository-add.ts +0 -116
- package/src/cli/commands/studio/workset-session.ts +0 -164
- package/src/lib/delivery/archive-change.ts +0 -165
- package/src/lib/delivery/forge.ts +0 -279
- package/src/lib/delivery/token.ts +0 -24
- package/src/lib/factory/attach-client.ts +0 -123
- package/src/lib/factory/attach.ts +0 -178
- package/src/lib/factory/broker.ts +0 -187
- package/src/lib/factory/bun-commands.ts +0 -39
- package/src/lib/factory/client.ts +0 -113
- package/src/lib/factory/clone-url.ts +0 -39
- package/src/lib/factory/command.ts +0 -77
- package/src/lib/factory/credential-store.ts +0 -153
- package/src/lib/factory/frames.ts +0 -77
- package/src/lib/factory/git-auth.ts +0 -61
- package/src/lib/factory/git-credential-store.ts +0 -181
- package/src/lib/factory/ids.ts +0 -68
- package/src/lib/factory/outcomes/actions.ts +0 -130
- package/src/lib/factory/outcomes/index.ts +0 -457
- package/src/lib/factory/outcomes/lifecycle.ts +0 -212
- package/src/lib/factory/outcomes/runs.ts +0 -81
- package/src/lib/factory/prepare.ts +0 -55
- 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 -498
- package/src/lib/factory/runner/state.ts +0 -233
- package/src/lib/factory/runner/workflow.ts +0 -546
- package/src/lib/factory/runtime.ts +0 -1081
- 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/app-D9cw6szy.css +0 -2
- package/studio-dist/client/assets/artifacts-WD2ZXYrx.js +0 -1
- package/studio-dist/client/assets/button-Br0O1sXw.js +0 -1
- package/studio-dist/client/assets/combobox-DA7RAUUZ.js +0 -1
- package/studio-dist/client/assets/factory-DGS0E16C.js +0 -6
- package/studio-dist/client/assets/fields-6aXBpFhJ.js +0 -1
- package/studio-dist/client/assets/getting-started-Clde4w6P.js +0 -1
- package/studio-dist/client/assets/getting-started._topic-BiunccbT.js +0 -1
- package/studio-dist/client/assets/getting-started.index-DpiNoGw8.js +0 -1
- package/studio-dist/client/assets/graph-B_TCBVbu.js +0 -2
- package/studio-dist/client/assets/guides-Du_RtJxP.js +0 -1
- package/studio-dist/client/assets/index-Df8L1LQa.js +0 -40
- package/studio-dist/client/assets/panel-dbmCx7Mx.js +0 -1
- package/studio-dist/client/assets/react-3QStrcDO.js +0 -27
- package/studio-dist/client/assets/report-url-XRL0x1SY.js +0 -1
- package/studio-dist/client/assets/reports-r3IK7Doz.js +0 -1
- package/studio-dist/client/assets/routes-C0A5LTFc.js +0 -1
- package/studio-dist/client/assets/select-CnaMd617.js +0 -1
- package/studio-dist/client/assets/skills-CzjzHpBT.js +0 -1
- package/studio-dist/client/assets/specs-view-BnCLA0gW.js +0 -1
- package/studio-dist/client/assets/spinner-Dcm3fqK1.js +0 -1
- package/studio-dist/client/assets/steps-C0p2N1Pb.js +0 -1
- package/studio-dist/client/assets/store-Dw34catY.js +0 -1
- package/studio-dist/client/assets/studio-Cpz_HRHp.js +0 -100
- package/studio-dist/client/assets/studio-queries-ibmpFo6R.js +0 -2
- package/studio-dist/client/assets/useAnchoredPopupScrollLock-Bj-FWb8z.js +0 -1
- package/studio-dist/client/assets/useMutation-aAr2uiay.js +0 -1
- package/studio-dist/client/assets/vault-BGcxkSIY.js +0 -1
- package/studio-dist/client/assets/warnings-R1cE1rLf.js +0 -1
- package/studio-dist/client/assets/workflow-C2qTrMDH.js +0 -1
- package/studio-dist/server/assets/actions-DYSv-9VV.js +0 -60
- package/studio-dist/server/assets/artifacts-DnF9L3dZ.js +0 -216
- package/studio-dist/server/assets/factory-C7Ybg0xG.js +0 -3075
- package/studio-dist/server/assets/factory-Df5uAHjb.js +0 -116
- package/studio-dist/server/assets/react-CdqSUhaL.js +0 -89
- package/studio-dist/server/assets/report-url-BUXPcE_8.js +0 -9
- package/studio-dist/server/assets/search-BJnWLfkG.js +0 -55
- package/studio-dist/server/assets/spinner-CdwJW4VB.js +0 -20
- package/studio-dist/server/assets/store-Cs17okNG.js +0 -280
- /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,10 @@ import path from "node:path";
|
|
|
4
4
|
import type { CapabilityPlugin, RuntimeContributionsByRuntime, SetupContext } from "../plugin";
|
|
5
5
|
import type { InstallRequirement } from "../install-contract";
|
|
6
6
|
import {
|
|
7
|
+
installedVersionOutput,
|
|
7
8
|
isCommandOnPath,
|
|
8
9
|
pruneEmptyAncestors,
|
|
10
|
+
resolveCommandOnPath,
|
|
9
11
|
runCommandSilently,
|
|
10
12
|
runShellCommand,
|
|
11
13
|
} from "../utils";
|
|
@@ -13,6 +15,7 @@ import { confirm } from "../../../cli/confirm";
|
|
|
13
15
|
import { FRAMEWORK_NAME } from "../../../framework";
|
|
14
16
|
import { isDeclinedByMember, type ReadMemberChoices } from "../../../lib/member-choices";
|
|
15
17
|
import { getWrapperBinPath, withoutMateWrapperDirs } from "../../../lib/package-paths";
|
|
18
|
+
import { toolVersion, warnOnVersionDrift } from "../../../lib/tool-manifest";
|
|
16
19
|
import { resolveSecretPolicy } from "../../../runtime/policy";
|
|
17
20
|
import { isInstalledViaUvTool } from "../package-managers/uv";
|
|
18
21
|
import { stripSectionFromFile } from "../providers/agent-file-sections";
|
|
@@ -39,7 +42,7 @@ export const GRAPHIFY_STORE_SEGMENT = ".graphify";
|
|
|
39
42
|
const GRAPHIFY_SKILL_NAME = "graphify";
|
|
40
43
|
export const GRAPHIFY_OUTPUT_SUBDIR = "graphify-out";
|
|
41
44
|
|
|
42
|
-
const GRAPHIFY_INSTALL_CMD = `uv tool install graphifyy`;
|
|
45
|
+
const GRAPHIFY_INSTALL_CMD = `uv tool install graphifyy==${toolVersion("graphify")}`;
|
|
43
46
|
const GRAPHIFY_GITIGNORE_ENTRIES = [
|
|
44
47
|
"# graphify cache (contains absolute local paths)",
|
|
45
48
|
".graphify/*/graphify-out/cache/",
|
|
@@ -155,6 +158,18 @@ export interface GraphifyPluginDeps {
|
|
|
155
158
|
runCommand?: GraphifyRunCommand;
|
|
156
159
|
runProviderInstall?: GraphifyProviderInstall;
|
|
157
160
|
readMemberChoices?: ReadMemberChoices;
|
|
161
|
+
installedGraphifyVersion?: () => Promise<string | null>;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/** The real `graphify` on PATH; Mate's wrapper is skipped. */
|
|
165
|
+
function graphifyBinaryPath(): string | undefined {
|
|
166
|
+
return resolveCommandOnPath("graphify", withoutMateWrapperDirs(process.env.PATH ?? ""));
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/** What the real `graphify --version` prints, else null. */
|
|
170
|
+
async function defaultInstalledGraphifyVersion(): Promise<string | null> {
|
|
171
|
+
const binary = graphifyBinaryPath();
|
|
172
|
+
return binary ? installedVersionOutput(binary) : null;
|
|
158
173
|
}
|
|
159
174
|
|
|
160
175
|
export function createGraphifyPlugin(deps: GraphifyPluginDeps = {}): CapabilityPlugin {
|
|
@@ -206,6 +221,13 @@ export function createGraphifyPlugin(deps: GraphifyPluginDeps = {}): CapabilityP
|
|
|
206
221
|
detect: () => graphifyOnPath() || checkUvTool("graphifyy"),
|
|
207
222
|
install: () => runCommand(GRAPHIFY_INSTALL_CMD),
|
|
208
223
|
verify: () => graphifyOnPath() || checkUvTool("graphifyy"),
|
|
224
|
+
update: async () =>
|
|
225
|
+
warnOnVersionDrift(
|
|
226
|
+
"graphify",
|
|
227
|
+
await (deps.installedGraphifyVersion ?? defaultInstalledGraphifyVersion)(),
|
|
228
|
+
GRAPHIFY_INSTALL_CMD,
|
|
229
|
+
graphifyBinaryPath(),
|
|
230
|
+
),
|
|
209
231
|
},
|
|
210
232
|
],
|
|
211
233
|
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// oxlint-disable no-await-in-loop
|
|
2
|
+
import { resolveMcpServers } from "../../../lib/mcp-manager/resolve";
|
|
3
|
+
import { parseHeaderRef, type ResolvedMcpServer } from "../../../lib/mcp-manager/types";
|
|
4
|
+
import { readAudienceSelection } from "../dynamic-plugins/audiences";
|
|
5
|
+
import type { CapabilityPlugin, McpServerDescriptor } from "../plugin";
|
|
6
|
+
|
|
7
|
+
export const MCP_MANAGER_PLUGIN_ID = "mcp-manager";
|
|
8
|
+
|
|
9
|
+
/** A validated declared server as a descriptor holding references only. */
|
|
10
|
+
export function toMcpServerDescriptor({ name, server }: ResolvedMcpServer): McpServerDescriptor {
|
|
11
|
+
const envRefs = server.env?.length ? { envRefs: server.env } : {};
|
|
12
|
+
if ("command" in server) {
|
|
13
|
+
return {
|
|
14
|
+
name,
|
|
15
|
+
command: server.command,
|
|
16
|
+
...(server.args ? { args: server.args } : {}),
|
|
17
|
+
...envRefs,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
const headerRefs = Object.entries(server.headers ?? {}).flatMap(([header, value]) => {
|
|
21
|
+
const ref = parseHeaderRef(value);
|
|
22
|
+
return ref ? [[header, ref] as const] : [];
|
|
23
|
+
});
|
|
24
|
+
return {
|
|
25
|
+
name,
|
|
26
|
+
url: server.url,
|
|
27
|
+
transport: server.transport ?? "http",
|
|
28
|
+
...envRefs,
|
|
29
|
+
...(headerRefs.length > 0 ? { headerRefs: Object.fromEntries(headerRefs) } : {}),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Renders the companion's `mcpManager` servers for the audience in
|
|
35
|
+
* `MATE_AUDIENCE` into every active Agent Runtime. Enabled by the section
|
|
36
|
+
* alone, so it never appears in a setup selector.
|
|
37
|
+
*/
|
|
38
|
+
export function createMcpManagerPlugin(
|
|
39
|
+
env: Record<string, string | undefined> = process.env,
|
|
40
|
+
): CapabilityPlugin {
|
|
41
|
+
return {
|
|
42
|
+
id: MCP_MANAGER_PLUGIN_ID,
|
|
43
|
+
kind: "capability",
|
|
44
|
+
label: "MCP Manager",
|
|
45
|
+
description: "MCP servers the companion declares in framework.yaml.",
|
|
46
|
+
defaultSelected: false,
|
|
47
|
+
selectable: false,
|
|
48
|
+
isEnabled: (config) => config.mcpManager !== undefined,
|
|
49
|
+
getInstallRequirements: () => [],
|
|
50
|
+
async apply(ctx) {
|
|
51
|
+
const servers = resolveMcpServers(ctx.config, readAudienceSelection(env));
|
|
52
|
+
if (servers.length === 0) return;
|
|
53
|
+
const owners = (await ctx.mcp?.owners?.()) ?? new Map<string, string>();
|
|
54
|
+
const declared = Object.keys(ctx.config.mcpManager?.servers ?? {});
|
|
55
|
+
const clashes = declared.flatMap((name) => {
|
|
56
|
+
const owner = owners.get(name);
|
|
57
|
+
return owner ? [`"${name}" (also registered by the "${owner}" Capability)`] : [];
|
|
58
|
+
});
|
|
59
|
+
if (clashes.length > 0) {
|
|
60
|
+
const reason = `${MCP_MANAGER_PLUGIN_ID}: error: mcpManager declares MCP server ${clashes.join(", ")}; rename it in mcpManager.servers. No mcpManager server was rendered.`;
|
|
61
|
+
if (ctx.mcp?.withhold) {
|
|
62
|
+
ctx.mcp.withhold(reason);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
throw new Error(reason);
|
|
66
|
+
}
|
|
67
|
+
for (const server of servers) {
|
|
68
|
+
await ctx.mcp?.register(toMcpServerDescriptor(server));
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
async teardown() {},
|
|
72
|
+
};
|
|
73
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// oxlint-disable no-await-in-loop -- filesystem steps run in order
|
|
1
2
|
import fs from "node:fs/promises";
|
|
2
3
|
import path from "node:path";
|
|
3
4
|
|
|
@@ -10,6 +11,11 @@ import {
|
|
|
10
11
|
type RunOpenSpec,
|
|
11
12
|
} from "../../../lib/openspec-cli";
|
|
12
13
|
import { getWrapperBinPath } from "../../../lib/package-paths";
|
|
14
|
+
import {
|
|
15
|
+
DEFAULT_SCHEMA,
|
|
16
|
+
LEGACY_SCHEMA_ALIASES,
|
|
17
|
+
SHIPPED_SCHEMAS,
|
|
18
|
+
} from "../../../lib/delivery/stages";
|
|
13
19
|
import { FRAMEWORK_NAME } from "../../../framework";
|
|
14
20
|
import type { FrameworkConfig } from "../../../lib/orchestrator/types";
|
|
15
21
|
import { removeRecorded } from "../managed-output";
|
|
@@ -19,7 +25,7 @@ import type {
|
|
|
19
25
|
RuntimeContributionsByRuntime,
|
|
20
26
|
SetupContext,
|
|
21
27
|
} from "../plugin";
|
|
22
|
-
import { mergeDir, pruneEmptyAncestors } from "../utils";
|
|
28
|
+
import { mergeDir, pruneEmptyAncestors, type MergeTransform } from "../utils";
|
|
23
29
|
import { applyMateSkills, MATE_SKILLS, readSkillAuthor, teardownMateSkills } from "../mate";
|
|
24
30
|
import { getSharedSkillsDir, isSharedSkillRootActive } from "../providers/agents-skill-root";
|
|
25
31
|
import { skillIgnoreEntries } from "../mate-skill-copies";
|
|
@@ -60,8 +66,14 @@ const OPENSPEC_COMMAND_IDS = [
|
|
|
60
66
|
/** Skill roots earlier Mate versions let the OpenSpec CLI generate workflow skills into. */
|
|
61
67
|
const GENERATED_SKILL_ROOTS = [".claude", ".agents", ".opencode"] as const;
|
|
62
68
|
|
|
63
|
-
/**
|
|
64
|
-
|
|
69
|
+
/**
|
|
70
|
+
* Every Mate-owned schema folder: the shipped schemas from source and each legacy alias,
|
|
71
|
+
* generated from its schema. All are installed for availability; only one is the default.
|
|
72
|
+
*/
|
|
73
|
+
const MATE_SCHEMA_NAMES: readonly string[] = [
|
|
74
|
+
...SHIPPED_SCHEMAS,
|
|
75
|
+
...Object.keys(LEGACY_SCHEMA_ALIASES),
|
|
76
|
+
];
|
|
65
77
|
|
|
66
78
|
const MATE_SCHEMA_SOURCE_ROOT = path.join(
|
|
67
79
|
import.meta.dirname,
|
|
@@ -82,8 +94,10 @@ export const MATE_SPECS_RULE_MARKER = "[mate] ";
|
|
|
82
94
|
*/
|
|
83
95
|
export const MATE_SPECS_RULE = `${MATE_SPECS_RULE_MARKER}A main spec at openspec/specs/<capability>/spec.md MUST begin with flat frontmatter: type: spec, capability: <capability>, repository: <org/repository> (one scalar), areas: [<area>, ...] (a flat list in the delta's scope order), and tags: [openspec/spec]. Project repository and areas from the delta's paired scopes; never copy scopes, change, or delta tags onto a main spec. Delta specs under openspec/changes/<name>/specs/ keep their \`mate:delta\` comment. Full rules: openspec/mate-conventions.yaml.`;
|
|
84
96
|
|
|
85
|
-
/** What Mate writes besides its entry; anything beyond
|
|
86
|
-
const MANAGED_CONFIG_SCHEMA_ONLY =
|
|
97
|
+
/** What Mate writes besides its entry, now or as an earlier default; anything beyond is user content. */
|
|
98
|
+
const MANAGED_CONFIG_SCHEMA_ONLY: ReadonlySet<string> = new Set(
|
|
99
|
+
[DEFAULT_SCHEMA, ...Object.keys(LEGACY_SCHEMA_ALIASES)].map((schema) => `schema: ${schema}`),
|
|
100
|
+
);
|
|
87
101
|
|
|
88
102
|
/** The schema a fresh `openspec init` writes into config.yaml. */
|
|
89
103
|
const OPENSPEC_INIT_SCHEMA = "spec-driven";
|
|
@@ -196,7 +210,6 @@ async function removeGeneratedOpenSpecOutput(
|
|
|
196
210
|
await Promise.all(targets.map((target) => removeRecorded(target, "openspec", recorder)));
|
|
197
211
|
// Sequential: the parent directories share ancestors.
|
|
198
212
|
for (const dir of new Set(targets.map((target) => path.dirname(target)))) {
|
|
199
|
-
// oxlint-disable-next-line no-await-in-loop
|
|
200
213
|
await pruneEmptyAncestors(dir, companionPath);
|
|
201
214
|
}
|
|
202
215
|
}
|
|
@@ -306,13 +319,13 @@ async function removeManagedOpenSpecConfig(companionPath: string): Promise<void>
|
|
|
306
319
|
}
|
|
307
320
|
|
|
308
321
|
let remaining = content;
|
|
309
|
-
if (content.trim()
|
|
322
|
+
if (!MANAGED_CONFIG_SCHEMA_ONLY.has(content.trim())) {
|
|
310
323
|
const doc = parseDocument(content);
|
|
311
324
|
if (doc.errors.length > 0 || !removeMateSpecsRule(doc)) return;
|
|
312
325
|
remaining = doc.toString(CONFIG_TO_STRING);
|
|
313
326
|
}
|
|
314
327
|
|
|
315
|
-
if (remaining.trim()
|
|
328
|
+
if (MANAGED_CONFIG_SCHEMA_ONLY.has(remaining.trim())) {
|
|
316
329
|
await fs.rm(configPath, { force: true });
|
|
317
330
|
await pruneEmptyAncestors(path.dirname(configPath), companionPath);
|
|
318
331
|
} else {
|
|
@@ -332,7 +345,7 @@ async function ensureManagedOpenSpecConfig(companionPath: string): Promise<void>
|
|
|
332
345
|
|
|
333
346
|
if (content === undefined) {
|
|
334
347
|
await fs.mkdir(path.dirname(configPath), { recursive: true });
|
|
335
|
-
const fresh = new Document({ schema:
|
|
348
|
+
const fresh = new Document({ schema: DEFAULT_SCHEMA, rules: { specs: [MATE_SPECS_RULE] } });
|
|
336
349
|
await fs.writeFile(configPath, fresh.toString(CONFIG_TO_STRING), "utf8");
|
|
337
350
|
return;
|
|
338
351
|
}
|
|
@@ -346,12 +359,13 @@ async function ensureManagedOpenSpecConfig(companionPath: string): Promise<void>
|
|
|
346
359
|
return;
|
|
347
360
|
}
|
|
348
361
|
const ruleChanged = upsertMateSpecsRule(doc);
|
|
349
|
-
// Mate's
|
|
362
|
+
// Mate's default replaces a missing schema or the one `openspec init` writes; any other,
|
|
363
|
+
// a legacy alias included, is kept.
|
|
350
364
|
const current = isMap(doc.contents) ? doc.get("schema") : undefined;
|
|
351
365
|
const schemaChanged =
|
|
352
366
|
isMap(doc.contents) &&
|
|
353
367
|
(current === undefined || current === null || current === OPENSPEC_INIT_SCHEMA);
|
|
354
|
-
if (schemaChanged) doc.set("schema",
|
|
368
|
+
if (schemaChanged) doc.set("schema", DEFAULT_SCHEMA);
|
|
355
369
|
if (!schemaChanged && !ruleChanged) return;
|
|
356
370
|
const merged = doc.toString(CONFIG_TO_STRING);
|
|
357
371
|
if (merged !== content) await fs.writeFile(configPath, merged, "utf8");
|
|
@@ -368,19 +382,44 @@ async function teardownOpenSpecSchema(companionPath: string): Promise<void> {
|
|
|
368
382
|
await removeManagedOpenSpecConfig(companionPath);
|
|
369
383
|
}
|
|
370
384
|
|
|
385
|
+
/**
|
|
386
|
+
* Renames schema `from` → `to` in a schema file: only `schema.yaml`'s `name` and description
|
|
387
|
+
* and the templates' `schema:` frontmatter, so prose naming `from` stays.
|
|
388
|
+
*/
|
|
389
|
+
function renameSchema(from: string, to: string): MergeTransform {
|
|
390
|
+
return (fileName, content) =>
|
|
391
|
+
fileName === "schema.yaml"
|
|
392
|
+
? content
|
|
393
|
+
.replace(new RegExp(`^name: ${from}$`, "m"), `name: ${to}`)
|
|
394
|
+
.replace(/^description: /m, `description: Earlier name of ${from} - `)
|
|
395
|
+
: content.replace(new RegExp(`^schema: ${from}$`, "m"), `schema: ${to}`);
|
|
396
|
+
}
|
|
397
|
+
|
|
371
398
|
async function reconcileOpenSpecSchema(ctx: SetupContext): Promise<void> {
|
|
372
399
|
await Promise.all(
|
|
373
|
-
|
|
400
|
+
SHIPPED_SCHEMAS.map((schemaName) =>
|
|
374
401
|
mergeDir(
|
|
375
402
|
path.join(MATE_SCHEMA_SOURCE_ROOT, schemaName),
|
|
376
403
|
getMateSchemaDir(ctx.companionPath, schemaName),
|
|
377
404
|
),
|
|
378
405
|
),
|
|
379
406
|
);
|
|
380
|
-
await
|
|
381
|
-
|
|
382
|
-
|
|
407
|
+
await Promise.all(
|
|
408
|
+
Object.entries(LEGACY_SCHEMA_ALIASES).map(([alias, schemaName]) =>
|
|
409
|
+
mergeDir(
|
|
410
|
+
path.join(MATE_SCHEMA_SOURCE_ROOT, schemaName),
|
|
411
|
+
getMateSchemaDir(ctx.companionPath, alias),
|
|
412
|
+
renameSchema(schemaName, alias),
|
|
413
|
+
),
|
|
414
|
+
),
|
|
383
415
|
);
|
|
416
|
+
// Older Mate shipped an explore brief template; drop the stale copies.
|
|
417
|
+
for (const schemaName of MATE_SCHEMA_NAMES) {
|
|
418
|
+
await fs.rm(
|
|
419
|
+
path.join(getMateSchemaDir(ctx.companionPath, schemaName), "templates", "explore-brief.md"),
|
|
420
|
+
{ force: true },
|
|
421
|
+
);
|
|
422
|
+
}
|
|
384
423
|
await fs.copyFile(MATE_CONVENTIONS_SOURCE, getMateConventionsPath(ctx.companionPath));
|
|
385
424
|
|
|
386
425
|
await ensureManagedOpenSpecConfig(ctx.companionPath);
|
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import { spawnSync } from "node:child_process";
|
|
2
|
-
import fs from "node:fs";
|
|
3
1
|
import os from "node:os";
|
|
4
2
|
import path from "node:path";
|
|
5
3
|
|
|
6
4
|
import type { CapabilityPlugin, RuntimeContributionsByRuntime, SetupContext } from "../plugin";
|
|
7
5
|
import type { InstallRequirement } from "../install-contract";
|
|
6
|
+
import { hasRtkCapability } from "../../../runtime/companion-guidance";
|
|
8
7
|
import {
|
|
8
|
+
installedVersionOutput,
|
|
9
9
|
isCommandOnPath,
|
|
10
10
|
resolveCommandOnPath,
|
|
11
11
|
runShellCommand,
|
|
12
12
|
runShellCommandSilently,
|
|
13
13
|
} from "../utils";
|
|
14
14
|
import { confirm } from "../../../cli/confirm";
|
|
15
|
-
import { errorMessage } from "../../../runtime/error-message";
|
|
16
15
|
import { isDeclinedByMember, type ReadMemberChoices } from "../../../lib/member-choices";
|
|
16
|
+
import { toolVersion, warnOnVersionDrift } from "../../../lib/tool-manifest";
|
|
17
17
|
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
const RTK_VERSION = toolVersion("rtk");
|
|
19
|
+
// The release's installer with RTK_VERSION installs that release and checks its checksum;
|
|
20
|
+
// Homebrew would install the latest formula instead.
|
|
21
|
+
const RTK_INSTALL_CMD = `curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/v${RTK_VERSION}/install.sh | RTK_VERSION=v${RTK_VERSION} sh`;
|
|
21
22
|
|
|
22
23
|
const RTK_INIT_COMMANDS: Record<string, string> = {
|
|
23
24
|
claude: "rtk init -g --auto-patch",
|
|
@@ -29,52 +30,20 @@ const RTK_UNINSTALL_COMMANDS: Record<string, string> = {
|
|
|
29
30
|
opencode: "rtk init -g --uninstall --opencode",
|
|
30
31
|
};
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
function defaultIsBrewAvailable(): boolean {
|
|
37
|
-
return isCommandOnPath("brew", process.env.PATH ?? "");
|
|
33
|
+
/** Where the pinned installer puts `rtk`; it only prints a PATH hint, so a fresh install may be off PATH. */
|
|
34
|
+
function rtkInstallDir(): string {
|
|
35
|
+
return process.env.RTK_INSTALL_DIR || path.join(os.homedir(), ".local", "bin");
|
|
38
36
|
}
|
|
39
37
|
|
|
40
38
|
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
39
|
+
* True when `rtk` is on PATH or in its install directory; the latter is appended to this
|
|
40
|
+
* process's PATH, last, so its other binaries never shadow the member's.
|
|
43
41
|
*/
|
|
44
|
-
function
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
let tap: unknown;
|
|
52
|
-
try {
|
|
53
|
-
const receipt = JSON.parse(fs.readFileSync(path.join(keg, "INSTALL_RECEIPT.json"), "utf8"));
|
|
54
|
-
tap = receipt?.source?.tap;
|
|
55
|
-
} catch {
|
|
56
|
-
// no readable receipt: the formula's bare name
|
|
57
|
-
}
|
|
58
|
-
return typeof tap === "string" && tap !== "homebrew/core" ? `${tap}/rtk` : "rtk";
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/** The latest release tag, from the `/releases/latest` redirect GitHub answers without rate limit. */
|
|
62
|
-
async function defaultLatestRtkTag(): Promise<string | null> {
|
|
63
|
-
const response = await fetch("https://github.com/rtk-ai/rtk/releases/latest", {
|
|
64
|
-
redirect: "manual",
|
|
65
|
-
signal: AbortSignal.timeout(5_000),
|
|
66
|
-
});
|
|
67
|
-
return response.headers.get("location")?.match(/\/tag\/(v[\w.-]+)$/)?.[1] ?? null;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/** The version `binary --version` reports (`rtk 1.1.0`), else null. */
|
|
71
|
-
function defaultInstalledRtkVersion(binary: string): string | null {
|
|
72
|
-
const result = spawnSync(binary, ["--version"], {
|
|
73
|
-
encoding: "utf8",
|
|
74
|
-
stdio: ["ignore", "pipe", "ignore"],
|
|
75
|
-
timeout: 5_000,
|
|
76
|
-
});
|
|
77
|
-
return result.stdout?.match(/\d+\.\d+\.\d+\S*/)?.[0] ?? null;
|
|
42
|
+
function locateRtk(installDir: string): boolean {
|
|
43
|
+
if (isCommandOnPath("rtk", process.env.PATH ?? "")) return true;
|
|
44
|
+
if (!isCommandOnPath("rtk", installDir)) return false;
|
|
45
|
+
process.env.PATH = [process.env.PATH, installDir].filter(Boolean).join(path.delimiter);
|
|
46
|
+
return true;
|
|
78
47
|
}
|
|
79
48
|
|
|
80
49
|
/** The first `rtk` on PATH, as PATH names it. */
|
|
@@ -85,71 +54,55 @@ function defaultRtkBinaryPath(): string | null {
|
|
|
85
54
|
export type RtkDeps = {
|
|
86
55
|
confirm?: typeof confirm;
|
|
87
56
|
isRtkOnPath?: () => boolean;
|
|
88
|
-
|
|
57
|
+
/** Probed when `rtk` is not on PATH; defaults to the installer's target. */
|
|
58
|
+
installDir?: string;
|
|
89
59
|
runRtkInstallCmd?: (cmd: string) => Promise<void>;
|
|
90
60
|
runRtkCommandSilently?: (cmd: string) => Promise<void>;
|
|
91
61
|
readMemberChoices?: ReadMemberChoices;
|
|
92
62
|
rtkBinaryPath?: () => string | null;
|
|
93
|
-
|
|
94
|
-
latestRtkTag?: () => Promise<string | null>;
|
|
95
|
-
installedRtkVersion?: (binary: string) => string | null;
|
|
96
|
-
homeDir?: () => string;
|
|
63
|
+
installedRtkVersion?: (binary: string) => Promise<string | null>;
|
|
97
64
|
};
|
|
98
65
|
|
|
66
|
+
/**
|
|
67
|
+
* Whether this setup run ends the provider's RTK use. The uninstall edits the member's
|
|
68
|
+
* global agent config, which other companions rely on, so only such a transition may run it.
|
|
69
|
+
*/
|
|
70
|
+
function endsRtkUse(providerId: string, ctx: SetupContext): boolean {
|
|
71
|
+
const previous = ctx.previousSetup;
|
|
72
|
+
if (!previous || !hasRtkCapability(previous.config.capabilities)) return false;
|
|
73
|
+
if (!previous.activeProviders.includes(providerId)) return false;
|
|
74
|
+
const otherProviderStays =
|
|
75
|
+
hasRtkCapability(ctx.config.capabilities) &&
|
|
76
|
+
Object.keys(RTK_INIT_COMMANDS).some(
|
|
77
|
+
(id) => id !== providerId && ctx.activeProviders.includes(id),
|
|
78
|
+
);
|
|
79
|
+
return !otherProviderStays;
|
|
80
|
+
}
|
|
81
|
+
|
|
99
82
|
export function createRtkPlugin(deps: RtkDeps = {}): CapabilityPlugin {
|
|
100
83
|
const askConfirm = deps.confirm ?? confirm;
|
|
101
|
-
const checkRtkPath = deps.isRtkOnPath ??
|
|
102
|
-
const checkBrew = deps.isBrewAvailable ?? defaultIsBrewAvailable;
|
|
84
|
+
const checkRtkPath = deps.isRtkOnPath ?? (() => locateRtk(deps.installDir ?? rtkInstallDir()));
|
|
103
85
|
const runRtkInstall = deps.runRtkInstallCmd ?? runShellCommand;
|
|
104
86
|
const runSilently = deps.runRtkCommandSilently ?? runShellCommandSilently;
|
|
105
|
-
|
|
106
|
-
* The command that upgrades the `rtk` on PATH through the channel that installed it:
|
|
107
|
-
* its Homebrew formula, or, for the installer's default `~/.local/bin/rtk`, the
|
|
108
|
-
* installer of a newer release, pinned to its tag. Null for any other installation,
|
|
109
|
-
* such as Cargo's, which is left alone.
|
|
110
|
-
*/
|
|
111
|
-
const rtkUpgradeCommand = async (): Promise<string | null> => {
|
|
87
|
+
const checkRtkVersion = async (): Promise<void> => {
|
|
112
88
|
const binary = (deps.rtkBinaryPath ?? defaultRtkBinaryPath)();
|
|
113
|
-
if (!binary) return
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
const home = (deps.homeDir ?? os.homedir)();
|
|
117
|
-
if (path.resolve(binary) !== path.join(home, ".local", "bin", "rtk")) return null;
|
|
118
|
-
const tag = await (deps.latestRtkTag ?? defaultLatestRtkTag)();
|
|
119
|
-
const installed = (deps.installedRtkVersion ?? defaultInstalledRtkVersion)(binary);
|
|
120
|
-
if (!tag || tag.replace(/^v/, "") === installed) return null;
|
|
121
|
-
return `curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/${tag}/install.sh | RTK_VERSION=${tag} sh`;
|
|
89
|
+
if (!binary) return;
|
|
90
|
+
const installed = await (deps.installedRtkVersion ?? installedVersionOutput)(binary);
|
|
91
|
+
warnOnVersionDrift("rtk", installed, RTK_INSTALL_CMD, binary);
|
|
122
92
|
};
|
|
123
93
|
|
|
124
|
-
/** Best-effort, as TokenSave's: a failure warns and keeps the installed version. */
|
|
125
|
-
const upgradeRtk = async (): Promise<void> => {
|
|
126
|
-
try {
|
|
127
|
-
const command = await rtkUpgradeCommand();
|
|
128
|
-
if (command) await runSilently(command);
|
|
129
|
-
} catch (error) {
|
|
130
|
-
process.stderr.write(
|
|
131
|
-
`rtk: automatic upgrade failed: ${errorMessage(error)} - continuing with the installed version\n`,
|
|
132
|
-
);
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
const hasOtherActiveRtkProvider = (currentProviderId: string, activeProviders: string[]) =>
|
|
136
|
-
Object.keys(RTK_INIT_COMMANDS).some(
|
|
137
|
-
(providerId) => providerId !== currentProviderId && activeProviders.includes(providerId),
|
|
138
|
-
);
|
|
139
|
-
|
|
140
94
|
return {
|
|
141
95
|
id: "rtk",
|
|
142
96
|
kind: "capability",
|
|
143
97
|
label: "RTK",
|
|
144
98
|
description: "Patch supported agent providers with RTK when selected.",
|
|
145
99
|
defaultSelected: false,
|
|
146
|
-
isEnabled: (config) =>
|
|
147
|
-
(config.capabilities ?? []).some((capability) => capability.name === "rtk"),
|
|
100
|
+
isEnabled: (config) => hasRtkCapability(config.capabilities),
|
|
148
101
|
getRuntimeContributions(): RuntimeContributionsByRuntime {
|
|
149
102
|
return { claude: { permissionEntries: ["Bash(rtk:*)"] } };
|
|
150
103
|
},
|
|
151
104
|
getInstallRequirements: (): InstallRequirement[] => {
|
|
152
|
-
const command =
|
|
105
|
+
const command = RTK_INSTALL_CMD;
|
|
153
106
|
return [
|
|
154
107
|
{
|
|
155
108
|
id: "capability:rtk",
|
|
@@ -162,7 +115,7 @@ export function createRtkPlugin(deps: RtkDeps = {}): CapabilityPlugin {
|
|
|
162
115
|
detect: checkRtkPath,
|
|
163
116
|
install: () => runRtkInstall(command),
|
|
164
117
|
verify: checkRtkPath,
|
|
165
|
-
update:
|
|
118
|
+
update: checkRtkVersion,
|
|
166
119
|
},
|
|
167
120
|
];
|
|
168
121
|
},
|
|
@@ -170,7 +123,7 @@ export function createRtkPlugin(deps: RtkDeps = {}): CapabilityPlugin {
|
|
|
170
123
|
if (checkRtkPath() || ctx.mode !== "setup") return;
|
|
171
124
|
if (await isDeclinedByMember(ctx.companionPath, ["rtk"], deps.readMemberChoices)) return;
|
|
172
125
|
|
|
173
|
-
const command =
|
|
126
|
+
const command = RTK_INSTALL_CMD;
|
|
174
127
|
process.stdout.write(`rtk binary not found. To install:\n ${command}\n`);
|
|
175
128
|
if (await askConfirm("Run this install command now?")) {
|
|
176
129
|
await runRtkInstall(command);
|
|
@@ -185,7 +138,7 @@ export function createRtkPlugin(deps: RtkDeps = {}): CapabilityPlugin {
|
|
|
185
138
|
await run(RTK_INIT_COMMANDS.claude);
|
|
186
139
|
},
|
|
187
140
|
async teardown(ctx: SetupContext) {
|
|
188
|
-
if (
|
|
141
|
+
if (endsRtkUse("claude", ctx) && checkRtkPath()) {
|
|
189
142
|
await runRtkInstall(RTK_UNINSTALL_COMMANDS.claude);
|
|
190
143
|
}
|
|
191
144
|
},
|
|
@@ -197,7 +150,7 @@ export function createRtkPlugin(deps: RtkDeps = {}): CapabilityPlugin {
|
|
|
197
150
|
await run(RTK_INIT_COMMANDS.opencode);
|
|
198
151
|
},
|
|
199
152
|
async teardown(ctx: SetupContext) {
|
|
200
|
-
if (
|
|
153
|
+
if (endsRtkUse("opencode", ctx) && checkRtkPath()) {
|
|
201
154
|
await runRtkInstall(RTK_UNINSTALL_COMMANDS.opencode);
|
|
202
155
|
}
|
|
203
156
|
},
|