@uniqbit/mate-core 0.18.5 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/claude-capability-plugins/companion-mentions/.claude-plugin/marketplace.json +14 -0
- package/claude-capability-plugins/companion-mentions/.claude-plugin/plugin.json +8 -0
- package/claude-capability-plugins/companion-mentions/hooks/companion.ts +457 -0
- package/claude-capability-plugins/companion-mentions/hooks/hooks.json +1 -0
- package/claude-capability-plugins/companion-mentions/hooks/register.ts +403 -0
- package/claude-plugin/hooks/companion-instructions.mjs +9 -0
- package/claude-plugin/hooks/hooks.json +50 -2
- 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/tokensave-route.mjs +52 -0
- package/opencode-plugin/src/server.ts +25 -3
- package/opencode-plugin/src/tui.tsx +3 -1
- package/opencode-plugin/tui.tsx +4 -1
- package/package.json +53 -15
- package/src/brand/art.generated.ts +69 -0
- package/src/brand/index.ts +12 -0
- package/src/brand/palette.ts +19 -0
- package/src/brand/svg.generated.ts +8 -0
- package/src/brand/terminal.ts +88 -0
- package/src/brand/types.ts +33 -0
- package/src/cli/commands/artifact/apply-context.ts +275 -0
- package/src/cli/commands/artifact/artifact.ts +12 -0
- package/src/cli/commands/artifact/delivery/archive.ts +125 -0
- package/src/cli/commands/artifact/delivery/branch-flags.ts +55 -0
- package/src/cli/commands/artifact/delivery/environment.ts +147 -0
- package/src/cli/commands/artifact/delivery/link.ts +210 -0
- package/src/cli/commands/artifact/delivery/output.ts +104 -0
- package/src/cli/commands/artifact/finish/command.ts +83 -8
- package/src/cli/commands/artifact/finish/engine.ts +91 -14
- package/src/cli/commands/artifact/finish/finisher.ts +10 -0
- package/src/cli/commands/artifact/finish/git.ts +132 -19
- package/src/cli/commands/artifact/finish/openspec.ts +180 -138
- package/src/cli/commands/artifact/finish/secret-scan.ts +43 -0
- package/src/cli/commands/artifact/finish/worktree-cleanup.ts +92 -0
- package/src/cli/commands/artifact/pending/command.ts +31 -3
- package/src/cli/commands/artifact/pending/discovery.ts +21 -57
- package/src/cli/commands/cap/graphify.ts +52 -3
- package/src/cli/commands/cap/index-cmd.ts +71 -15
- package/src/cli/commands/cap/openspec.ts +13 -25
- package/src/cli/commands/cap/tokensave.ts +7 -5
- package/src/cli/commands/companion/companion.ts +1 -1
- package/src/cli/commands/companion/link.ts +50 -5
- package/src/cli/commands/companion/open.ts +101 -51
- package/src/cli/commands/companion/sync.ts +10 -0
- package/src/cli/commands/companion/tui.ts +17 -7
- package/src/cli/commands/companion/update.ts +144 -66
- package/src/cli/commands/doctor.ts +317 -7
- package/src/cli/commands/factory/factory.ts +311 -0
- package/src/cli/commands/install.ts +180 -45
- package/src/cli/commands/launch/claude.ts +2 -0
- package/src/cli/commands/launch/shared.ts +48 -16
- package/src/cli/commands/plugin/install.ts +36 -15
- package/src/cli/commands/plugin/plugin.ts +3 -2
- package/src/cli/commands/report/adapter.ts +11 -2
- package/src/cli/commands/report/contract.ts +21 -0
- package/src/cli/commands/report/highlight.ts +34 -4
- package/src/cli/commands/report/index.ts +186 -171
- package/src/cli/commands/report/markdown.ts +105 -0
- package/src/cli/commands/report/palette.ts +118 -0
- package/src/cli/commands/report/renderer.ts +456 -153
- package/src/cli/commands/report/types.ts +16 -0
- package/src/cli/commands/session/context.ts +102 -0
- package/src/cli/commands/session/prepare.ts +32 -4
- package/src/cli/commands/session/registry.ts +90 -0
- package/src/cli/commands/setup.ts +50 -24
- package/src/cli/commands/shared/companion-selection.ts +3 -1
- package/src/cli/commands/studio/access.ts +6 -14
- package/src/cli/commands/studio/areas.ts +112 -33
- package/src/cli/commands/studio/companion-add.ts +87 -0
- package/src/cli/commands/studio/companion-removal.ts +86 -0
- package/src/cli/commands/studio/factory-credential.ts +35 -0
- package/src/cli/commands/studio/factory-git-tokens.ts +40 -0
- package/src/cli/commands/studio/factory-relay.ts +18 -0
- package/src/cli/commands/studio/graph-model.ts +61 -0
- package/src/cli/commands/studio/graph.ts +336 -0
- package/src/cli/commands/studio/index.ts +33 -6
- package/src/cli/commands/studio/mate-inventory.ts +1 -1
- package/src/cli/commands/studio/openspec-cli.ts +10 -58
- package/src/cli/commands/studio/payload.ts +292 -20
- package/src/cli/commands/studio/repository-add.ts +116 -0
- package/src/cli/commands/studio/routes.ts +47 -6
- package/src/cli/commands/studio/selection.ts +170 -17
- package/src/cli/commands/studio/server.ts +552 -327
- package/src/cli/commands/studio/services.ts +120 -0
- package/src/cli/commands/studio/skill-files.ts +133 -0
- package/src/cli/commands/studio/studio-app.ts +67 -0
- package/src/cli/commands/studio/terminal-assets.ts +21 -33
- package/src/cli/commands/studio/terminal.ts +128 -16
- package/src/cli/commands/studio/vault.ts +218 -44
- package/src/cli/commands/studio/views/model.ts +13 -0
- package/src/cli/commands/studio/views/vault/markdown-tree.ts +599 -0
- package/src/cli/commands/studio/views/vault/view.ts +185 -0
- package/src/cli/commands/studio/workset-session.ts +164 -0
- package/src/cli/commands/unwrap.ts +19 -0
- package/src/cli/commands/update.ts +55 -9
- 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/working/cleanup.ts +83 -18
- package/src/cli/commands/working/link.ts +76 -0
- package/src/cli/commands/working/working.ts +10 -0
- package/src/cli/commands/working/worktree.ts +547 -0
- package/src/cli/commands/wrap.ts +38 -20
- package/src/cli/companion-link-wizard.tsx +2 -0
- package/src/cli/companion-selector.tsx +2 -0
- package/src/cli/confirm.ts +2 -0
- package/src/cli/install-plan.tsx +127 -160
- package/src/cli/launch-selector.tsx +2 -0
- package/src/cli/main.ts +48 -5
- package/src/cli/parse-flags.ts +32 -6
- package/src/cli/repo-list-table.tsx +2 -0
- package/src/cli/setup-selector.tsx +86 -151
- package/src/cli/usage.ts +20 -1
- package/src/create-mate.ts +5 -4
- package/src/hooks/companion-instructions.ts +198 -0
- package/src/hooks/hook-io.ts +78 -0
- package/src/hooks/rtk-worktree-git.ts +48 -0
- package/src/hooks/session-banner.ts +24 -30
- package/src/hooks/session-end.ts +10 -0
- package/src/hooks/session-guidance.ts +18 -22
- package/src/hooks/session-prepare.ts +137 -34
- package/src/hooks/session-register.ts +199 -0
- package/src/hooks/tokensave-route.ts +30 -0
- package/src/hooks/validate-artifact-path.ts +121 -25
- package/src/index.ts +4 -0
- package/src/lib/apply-context/fingerprint.ts +174 -0
- package/src/lib/apply-context/protocol.ts +193 -0
- package/src/lib/change-layout.ts +154 -0
- package/src/lib/components/confirm-prompt.tsx +21 -9
- package/src/lib/components/select-menu.tsx +10 -3
- package/src/lib/components/spinner.tsx +4 -2
- package/src/lib/components/startup-progress.tsx +227 -41
- package/src/lib/components/text-input-display.tsx +2 -0
- package/src/lib/components/wizard-footer.tsx +2 -0
- package/src/lib/components/wizard-header.tsx +16 -12
- package/src/lib/context-mode-package.ts +24 -11
- package/src/lib/delivery/archive-change.ts +165 -0
- package/src/lib/delivery/branch-template.ts +122 -0
- package/src/lib/delivery/branches.ts +152 -0
- package/src/lib/delivery/checkout.ts +102 -0
- package/src/lib/delivery/environment.ts +37 -0
- package/src/lib/delivery/forge.ts +279 -0
- package/src/lib/delivery/merge-git.ts +273 -0
- package/src/lib/delivery/overlap.ts +209 -0
- package/src/lib/delivery/record-delivery.ts +392 -0
- package/src/lib/delivery/record.ts +417 -0
- package/src/lib/delivery/refresh.ts +288 -0
- package/src/lib/delivery/repository-access.ts +141 -0
- package/src/lib/delivery/resolve-branch.ts +430 -0
- package/src/lib/delivery/stages.ts +111 -0
- package/src/lib/delivery/token.ts +24 -0
- package/src/lib/factory/attach-client.ts +123 -0
- package/src/lib/factory/attach.ts +178 -0
- package/src/lib/factory/broker.ts +187 -0
- package/src/lib/factory/bun-commands.ts +39 -0
- package/src/lib/factory/client.ts +113 -0
- package/src/lib/factory/clone-url.ts +39 -0
- package/src/lib/factory/command.ts +77 -0
- package/src/lib/factory/credential-store.ts +153 -0
- package/src/lib/factory/frames.ts +77 -0
- package/src/lib/factory/git-auth.ts +61 -0
- package/src/lib/factory/git-credential-store.ts +181 -0
- package/src/lib/factory/ids.ts +68 -0
- package/src/lib/factory/keyed-serial.ts +27 -0
- package/src/lib/factory/outcomes/actions.ts +130 -0
- package/src/lib/factory/outcomes/index.ts +457 -0
- package/src/lib/factory/outcomes/lifecycle.ts +212 -0
- package/src/lib/factory/outcomes/runs.ts +81 -0
- package/src/lib/factory/outcomes/sessions.ts +60 -0
- package/src/lib/factory/prepare.ts +55 -0
- package/src/lib/factory/pty.ts +103 -0
- package/src/lib/factory/runner/companion-context.ts +178 -0
- package/src/lib/factory/runner/control.ts +92 -0
- package/src/lib/factory/runner/harness-agent.ts +250 -0
- package/src/lib/factory/runner/live.ts +159 -0
- package/src/lib/factory/runner/questions.ts +22 -0
- package/src/lib/factory/runner/rank.ts +26 -0
- package/src/lib/factory/runner/run-policy.ts +12 -0
- package/src/lib/factory/runner/run.ts +199 -0
- package/src/lib/factory/runner/scheduler.ts +498 -0
- package/src/lib/factory/runner/state.ts +233 -0
- package/src/lib/factory/runner/workflow.ts +546 -0
- package/src/lib/factory/runtime.ts +1081 -0
- package/src/lib/factory/sandbox.ts +292 -0
- package/src/lib/factory/worktree-branch.ts +17 -0
- package/src/lib/frontmatter.ts +18 -0
- package/src/lib/install.ts +66 -14
- package/src/lib/live-progress.ts +36 -0
- package/src/lib/member-choices.ts +67 -0
- package/src/lib/opencode-plugin-package.ts +5 -5
- package/src/lib/opencode-server.ts +238 -0
- package/src/lib/openspec-cli.ts +116 -0
- package/src/lib/openspec-scopes.ts +86 -0
- package/src/lib/orchestrator/adapters/base.ts +55 -22
- package/src/lib/orchestrator/adapters/claude-args.ts +50 -0
- package/src/lib/orchestrator/adapters/claude.ts +201 -43
- package/src/lib/orchestrator/adapters/opencode.ts +55 -2
- package/src/lib/orchestrator/checkout-adoption.ts +125 -0
- package/src/lib/orchestrator/companion-hub.ts +6 -1
- package/src/lib/orchestrator/companion-registry-store.ts +6 -2
- package/src/lib/orchestrator/config-store.ts +3 -2
- package/src/lib/orchestrator/editor.ts +32 -26
- package/src/lib/orchestrator/engine-floor.ts +48 -0
- package/src/lib/orchestrator/framework-context.ts +26 -14
- package/src/lib/orchestrator/global-config-store.ts +11 -0
- package/src/lib/orchestrator/launcher.ts +49 -3
- package/src/lib/orchestrator/openspec-store.ts +14 -54
- package/src/lib/orchestrator/projection-claude-commands.ts +36 -0
- package/src/lib/orchestrator/projection-claude-entry.ts +42 -21
- package/src/lib/orchestrator/projection-claude-links.ts +230 -0
- package/src/lib/orchestrator/projection-claude-skills.ts +39 -131
- package/src/lib/orchestrator/projection-companion-link.ts +12 -1
- package/src/lib/orchestrator/projection-entries.ts +121 -51
- package/src/lib/orchestrator/projection-opencode-copies.ts +93 -32
- package/src/lib/orchestrator/projection-openspec-store.ts +54 -9
- package/src/lib/orchestrator/projection-runtime-documents.ts +81 -49
- package/src/lib/orchestrator/projection-types.ts +63 -1
- package/src/lib/orchestrator/refresh-working-claude-links.ts +89 -0
- 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 +73 -0
- package/src/lib/orchestrator/session-prepare.ts +87 -12
- package/src/lib/orchestrator/setup-compatibilities.ts +56 -70
- package/src/lib/orchestrator/types.ts +16 -2
- package/src/lib/orchestrator/umbrella-checkouts.ts +102 -0
- package/src/lib/orchestrator/working-repo-projection.ts +73 -10
- package/src/lib/orchestrator/workspace-document.ts +105 -0
- package/src/lib/orchestrator/workspace-inventory.ts +5 -1
- package/src/lib/orchestrator/wrap-pass.ts +23 -1
- package/src/lib/package-paths.ts +37 -0
- package/src/lib/public-npm.ts +105 -43
- package/src/lib/runtime-directory-refresh.ts +17 -1
- package/src/lib/session-attribution.ts +52 -0
- package/src/lib/session-state.ts +355 -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/workset/factory-local.ts +157 -0
- package/src/lib/workset/record.ts +547 -0
- package/src/lib/workset/repositories.ts +148 -0
- package/src/lib/workset/stage.ts +148 -0
- package/src/lib/workset/stages.ts +113 -0
- package/src/lib/workset/worktree-include.ts +161 -0
- package/src/lib/workset/worktree-index.ts +120 -0
- package/src/lib/workset/worktree.ts +1388 -0
- package/src/opencode/background-server.ts +145 -0
- package/src/opencode/companion-hooks.ts +151 -9
- package/src/opencode/companion-policy.ts +54 -22
- package/src/opencode/enter-worktree.ts +320 -0
- package/src/opencode/projected-guidance.ts +6 -2
- package/src/opencode/session-prepare.ts +2 -1
- package/src/opencode/session-register.ts +176 -0
- package/src/opencode/tui.tsx +24 -27
- package/src/plugins.ts +1 -0
- package/src/runtime/artifact-refusal.ts +63 -0
- package/src/runtime/claude-bg-isolation.ts +138 -0
- package/src/runtime/claude-delivery-plan.ts +121 -11
- package/src/runtime/commit-attribution-guard.ts +181 -0
- package/src/runtime/companion-git.ts +62 -12
- package/src/runtime/companion-guidance.ts +37 -12
- package/src/runtime/companion-instructions.ts +340 -0
- package/src/runtime/companion-lock.ts +30 -7
- package/src/runtime/current-branch.ts +24 -0
- package/src/runtime/entered-worktree.ts +24 -0
- package/src/runtime/env.ts +59 -8
- package/src/runtime/error-message.ts +4 -0
- package/src/runtime/git-layout.ts +366 -0
- package/src/runtime/git-tracked.ts +60 -0
- package/src/runtime/index.ts +29 -0
- package/src/runtime/launch-env-guard.ts +65 -0
- package/src/runtime/managed-block.ts +117 -0
- package/src/runtime/markdown-scan.ts +266 -0
- package/src/runtime/opencode-server-record.ts +136 -0
- package/src/runtime/physical-path.ts +111 -0
- package/src/runtime/policy.ts +50 -2
- package/src/runtime/projected-flag.ts +7 -0
- package/src/runtime/projected-guidance.ts +1 -0
- package/src/runtime/projection.ts +40 -6
- 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-directory.ts +5 -0
- package/src/runtime/runtime-document-manifest.ts +290 -29
- package/src/runtime/runtime-document-manifest.typecheck.ts +10 -0
- package/src/runtime/secret-guard.ts +169 -0
- package/src/runtime/secret-patterns.ts +397 -0
- package/src/runtime/secret-policy-weakening.ts +122 -0
- package/src/runtime/secret-scan.ts +90 -0
- package/src/runtime/serving-claude-wrap.ts +41 -0
- package/src/runtime/session-context.ts +99 -0
- package/src/runtime/session-kind.ts +13 -0
- package/src/runtime/session-registry.ts +434 -0
- package/src/runtime/shell-heredoc.ts +81 -0
- package/src/runtime/tokensave-route.ts +157 -0
- package/src/runtime/umbrella-folder.ts +56 -0
- package/src/runtime/wrap-state.ts +80 -15
- package/src/runtime/write-atomic.ts +64 -0
- package/src/studio.ts +163 -0
- package/src/templates/capabilities/openspec-cap/mate-minimal/schema.yaml +14 -10
- package/src/templates/capabilities/openspec-cap/mate-minimal/templates/spec.md +3 -5
- package/src/templates/capabilities/openspec-cap/mate-v1/schema.yaml +18 -102
- package/src/templates/capabilities/openspec-cap/mate-v1/templates/spec.md +3 -5
- package/src/templates/capabilities/openspec-cap/openspec-conventions.yaml +20 -14
- package/src/templates/mate-skills/THIRD-PARTY-NOTICES.md +40 -0
- package/src/templates/mate-skills/agents/mate-apply-change/SKILL.md +217 -0
- package/src/templates/mate-skills/agents/mate-apply-change/references/mate-compact-apply.md +47 -0
- package/src/templates/mate-skills/agents/mate-apply-change/references/openspec-apply-change.md +200 -0
- package/src/templates/mate-skills/agents/mate-archive-change/SKILL.md +81 -0
- package/src/templates/mate-skills/agents/{mate-openspec-backfill → mate-backfill-spec}/SKILL.md +11 -4
- package/src/templates/mate-skills/agents/mate-clarify-intent/SKILL.md +110 -0
- package/src/templates/mate-skills/agents/mate-explore-change/SKILL.md +70 -0
- package/src/templates/mate-skills/agents/mate-explore-change/references/openspec-explore.md +350 -0
- package/src/templates/mate-skills/agents/mate-grill-me/SKILL.md +11 -4
- package/src/templates/mate-skills/agents/mate-grill-with-docs/SKILL.md +2 -2
- package/src/templates/mate-skills/agents/mate-interview-me/SKILL.md +12 -5
- package/src/templates/mate-skills/agents/mate-propose-change/SKILL.md +106 -0
- package/src/templates/mate-skills/agents/mate-propose-change/references/mate-revise.md +45 -0
- package/src/templates/mate-skills/agents/mate-propose-change/references/openspec-propose.md +169 -0
- package/src/templates/mate-skills/agents/mate-propose-change/references/openspec-update-change.md +103 -0
- package/src/templates/mate-skills/agents/mate-publish-artifact/SKILL.md +271 -0
- package/src/templates/mate-skills/{claude/mate-artifact-publish → agents/mate-publish-artifact}/references/openspec.md +8 -5
- package/src/templates/mate-skills/agents/mate-show-me/SKILL.md +105 -20
- package/src/templates/mate-skills/agents/mate-simplify-code/SKILL.md +91 -68
- package/src/templates/mate-skills/claude/mate-apply-change/SKILL.md +217 -0
- package/src/templates/mate-skills/claude/mate-apply-change/references/mate-compact-apply.md +47 -0
- package/src/templates/mate-skills/claude/mate-apply-change/references/openspec-apply-change.md +200 -0
- package/src/templates/mate-skills/claude/mate-archive-change/SKILL.md +81 -0
- package/src/templates/mate-skills/claude/{mate-openspec-backfill → mate-backfill-spec}/SKILL.md +11 -4
- package/src/templates/mate-skills/claude/mate-clarify-intent/SKILL.md +110 -0
- package/src/templates/mate-skills/claude/mate-explore-change/SKILL.md +70 -0
- package/src/templates/mate-skills/claude/mate-explore-change/references/openspec-explore.md +350 -0
- package/src/templates/mate-skills/claude/mate-grill-me/SKILL.md +11 -4
- package/src/templates/mate-skills/claude/mate-grill-with-docs/SKILL.md +2 -2
- package/src/templates/mate-skills/claude/mate-interview-me/SKILL.md +12 -5
- package/src/templates/mate-skills/claude/mate-propose-change/SKILL.md +106 -0
- package/src/templates/mate-skills/claude/mate-propose-change/references/mate-revise.md +45 -0
- package/src/templates/mate-skills/claude/mate-propose-change/references/openspec-propose.md +169 -0
- package/src/templates/mate-skills/claude/mate-propose-change/references/openspec-update-change.md +103 -0
- package/src/templates/mate-skills/claude/mate-publish-artifact/SKILL.md +271 -0
- package/src/templates/mate-skills/{agents/mate-artifact-publish → claude/mate-publish-artifact}/references/openspec.md +8 -5
- package/src/templates/mate-skills/claude/mate-show-me/SKILL.md +105 -20
- package/src/templates/mate-skills/claude/mate-simplify-code/SKILL.md +91 -68
- package/src/templates/mate-skills/openspec-references.ts +142 -0
- package/src/templates/root/TEMPLATE_AGENTS.md +2 -2
- package/src/tools/setup/__snapshots__/runtime-surface-golden.test.ts.snap +4581 -397
- package/src/tools/setup/capabilities/companion-mentions.ts +27 -0
- package/src/tools/setup/capabilities/context-mode.ts +56 -7
- package/src/tools/setup/capabilities/graphify-gate.ts +31 -0
- package/src/tools/setup/capabilities/graphify-secrets.ts +243 -0
- package/src/tools/setup/capabilities/graphify.ts +46 -7
- package/src/tools/setup/capabilities/openspec.ts +163 -272
- package/src/tools/setup/capabilities/react-doctor.ts +8 -1
- package/src/tools/setup/capabilities/rtk.ts +97 -1
- package/src/tools/setup/capabilities/tokensave.ts +113 -71
- package/src/tools/setup/context-services.ts +9 -17
- package/src/tools/setup/dynamic-plugins/audiences.ts +65 -21
- package/src/tools/setup/dynamic-plugins/frozen.ts +32 -13
- package/src/tools/setup/dynamic-plugins/hydrate.ts +8 -7
- package/src/tools/setup/dynamic-plugins/install.ts +46 -48
- 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 +100 -23
- package/src/tools/setup/install-contract.ts +8 -0
- package/src/tools/setup/managed-output.ts +51 -0
- package/src/tools/setup/mate-skill-copies.ts +51 -0
- package/src/tools/setup/mate.ts +88 -13
- package/src/tools/setup/package-managers/uv.ts +73 -11
- package/src/tools/setup/plugin.ts +40 -0
- package/src/tools/setup/plugins/gitignore.ts +15 -9
- package/src/tools/setup/plugins/guidance.ts +7 -4
- package/src/tools/setup/providers/agent-file-sections.ts +4 -2
- package/src/tools/setup/providers/claude-attribution.ts +65 -0
- package/src/tools/setup/providers/claude-plugin-folders.ts +625 -0
- package/src/tools/setup/providers/claude-plugin-hooks.ts +89 -19
- package/src/tools/setup/providers/claude-worktree-plugins.ts +122 -0
- package/src/tools/setup/providers/claude.ts +332 -8
- package/src/tools/setup/providers/opencode.ts +180 -1
- package/src/tools/setup/utils.ts +22 -6
- package/src/tools/setup/working-repo-cleanup.ts +30 -2
- package/src/tools/setup/working-repo-local-state.ts +252 -75
- package/src/tools/setup.ts +196 -28
- package/studio-dist/client/assets/app-D9cw6szy.css +2 -0
- package/studio-dist/client/assets/artifacts-WD2ZXYrx.js +1 -0
- package/studio-dist/client/assets/button-Br0O1sXw.js +1 -0
- package/studio-dist/client/assets/combobox-DA7RAUUZ.js +1 -0
- package/studio-dist/client/assets/companion-view-CrabvxS8.js +1 -0
- package/studio-dist/client/assets/dist-Dm7MtyHc.js +5 -0
- package/studio-dist/client/assets/factory-DGS0E16C.js +6 -0
- package/studio-dist/client/assets/fields-6aXBpFhJ.js +1 -0
- package/studio-dist/client/assets/getting-started-Clde4w6P.js +1 -0
- package/studio-dist/client/assets/getting-started-D6kgWwWZ.js +1 -0
- package/studio-dist/client/assets/getting-started._topic-BiunccbT.js +1 -0
- package/studio-dist/client/assets/getting-started.index-DpiNoGw8.js +1 -0
- package/studio-dist/client/assets/graph-B_TCBVbu.js +2 -0
- package/studio-dist/client/assets/graph-canvas-Ba37Y5AE.js +3242 -0
- package/studio-dist/client/assets/guides-Du_RtJxP.js +1 -0
- package/studio-dist/client/assets/index-Df8L1LQa.js +40 -0
- package/studio-dist/client/assets/jsx-runtime-MZURdZre.js +1 -0
- package/studio-dist/client/assets/markdown-view-BOX6x0rL.js +1 -0
- package/studio-dist/client/assets/panel-dbmCx7Mx.js +1 -0
- package/studio-dist/client/assets/preload-helper-BLdHbfdN.js +1 -0
- package/studio-dist/client/assets/queries-RvHeXY12.js +1 -0
- package/studio-dist/client/assets/react-3QStrcDO.js +27 -0
- package/studio-dist/client/assets/report-url-XRL0x1SY.js +1 -0
- package/studio-dist/client/assets/reports-r3IK7Doz.js +1 -0
- package/studio-dist/client/assets/routes-C0A5LTFc.js +1 -0
- package/studio-dist/client/assets/select-CnaMd617.js +1 -0
- package/studio-dist/client/assets/skills-CzjzHpBT.js +1 -0
- package/studio-dist/client/assets/specs-B0ldF_6J.js +1 -0
- package/studio-dist/client/assets/specs-view-BnCLA0gW.js +1 -0
- package/studio-dist/client/assets/spinner-Dcm3fqK1.js +1 -0
- package/studio-dist/client/assets/steps-C0p2N1Pb.js +1 -0
- package/studio-dist/client/assets/store-Dw34catY.js +1 -0
- package/studio-dist/client/assets/studio-Cpz_HRHp.js +100 -0
- package/studio-dist/client/assets/studio-queries-ibmpFo6R.js +2 -0
- package/studio-dist/client/assets/terminal-eU5fzQzv.css +1 -0
- package/studio-dist/client/assets/usage-C2QJ_0IZ.js +55 -0
- package/studio-dist/client/assets/useAnchoredPopupScrollLock-Bj-FWb8z.js +1 -0
- package/studio-dist/client/assets/useMutation-aAr2uiay.js +1 -0
- package/studio-dist/client/assets/useSelector-AYcH7lB0.js +2 -0
- package/studio-dist/client/assets/vault-BGcxkSIY.js +1 -0
- package/studio-dist/client/assets/warnings-R1cE1rLf.js +1 -0
- package/studio-dist/client/assets/wasm-inline-C2en61B5.js +1 -0
- package/studio-dist/client/assets/workflow-C2qTrMDH.js +1 -0
- package/studio-dist/server/assets/__23tanstack-start-server-fn-resolver-Bn896ZYj.js +122 -0
- package/studio-dist/server/assets/_tanstack-start-manifest_v.js +162 -0
- package/studio-dist/server/assets/actions-D8erOphH.js +44 -0
- package/studio-dist/server/assets/actions-DYSv-9VV.js +60 -0
- package/studio-dist/server/assets/artifacts-DnF9L3dZ.js +216 -0
- package/studio-dist/server/assets/button-CgOIVdmD.js +10240 -0
- package/studio-dist/server/assets/combobox-DV_s9W0s.js +483 -0
- package/studio-dist/server/assets/companion-view-BKVXD3TO.js +39 -0
- package/studio-dist/server/assets/companions-C7fctnU9.js +31 -0
- package/studio-dist/server/assets/createServerRpc-bFKFpGFG.js +11 -0
- package/studio-dist/server/assets/dist-DpJWKyCm.js +5582 -0
- package/studio-dist/server/assets/empty-plugin-adapters-Cipd4ZH4.js +4 -0
- package/studio-dist/server/assets/factory-C7Ybg0xG.js +3075 -0
- package/studio-dist/server/assets/factory-Df5uAHjb.js +116 -0
- package/studio-dist/server/assets/fields-BbieQTD0.js +1190 -0
- package/studio-dist/server/assets/getting-started-B136TP57.js +4 -0
- package/studio-dist/server/assets/getting-started-CRxMWorQ.js +67 -0
- package/studio-dist/server/assets/getting-started._topic-DJKQAzYl.js +13 -0
- package/studio-dist/server/assets/getting-started.index-D84gec1t.js +13 -0
- package/studio-dist/server/assets/graph-CSje3029.js +801 -0
- package/studio-dist/server/assets/graph-DDZzXM1L.js +16 -0
- package/studio-dist/server/assets/graph-canvas-22bWB5-2.js +21066 -0
- package/studio-dist/server/assets/graph-wire-BdSUx0G5.js +58 -0
- package/studio-dist/server/assets/guides-D9dk1Frq.js +13 -0
- package/studio-dist/server/assets/guides-IE-19POz.js +5 -0
- package/studio-dist/server/assets/guides.server-vcYRY5wx.js +66 -0
- package/studio-dist/server/assets/jsx-runtime-Bt0s0YKS.js +451 -0
- package/studio-dist/server/assets/markdown-view-BR8dJ7aR.js +105 -0
- package/studio-dist/server/assets/model-PyPALjii.js +18 -0
- package/studio-dist/server/assets/panel-BR_t9iMM.js +169 -0
- package/studio-dist/server/assets/queries-DWoTin-q.js +32 -0
- package/studio-dist/server/assets/react-CdqSUhaL.js +89 -0
- package/studio-dist/server/assets/redirect-BaZ_QyqF.js +39 -0
- package/studio-dist/server/assets/report-url-BUXPcE_8.js +9 -0
- package/studio-dist/server/assets/reports-CQ9qQ1-n.js +141 -0
- package/studio-dist/server/assets/reports-dYDEoBeq.js +18 -0
- package/studio-dist/server/assets/router-DkRHNTpE.js +11638 -0
- package/studio-dist/server/assets/routes-B6GfOew4.js +473 -0
- package/studio-dist/server/assets/search-BJnWLfkG.js +55 -0
- package/studio-dist/server/assets/select-Af7Wibii.js +1609 -0
- package/studio-dist/server/assets/shell-Hq-hXgnT.js +53 -0
- package/studio-dist/server/assets/skills-B7nEuVbx.js +267 -0
- package/studio-dist/server/assets/skills-B_YYL7q8.js +28 -0
- package/studio-dist/server/assets/specs-BpLUFntA.js +51 -0
- package/studio-dist/server/assets/specs-view-0peMVd22.js +426 -0
- package/studio-dist/server/assets/spinner-CdwJW4VB.js +20 -0
- package/studio-dist/server/assets/start-h3ICWwd2.js +36 -0
- package/studio-dist/server/assets/steps-D56DApvK.js +181 -0
- package/studio-dist/server/assets/store-Cs17okNG.js +280 -0
- package/studio-dist/server/assets/studio-CAcKp3bM.js +10340 -0
- package/studio-dist/server/assets/studio-queries-BtRGzDdh.js +1451 -0
- package/studio-dist/server/assets/usage-COdjd1gD.js +25570 -0
- package/studio-dist/server/assets/usage-f6pqE1tm.js +24 -0
- package/studio-dist/server/assets/useAnchoredPopupScrollLock-DlBKHRw7.js +756 -0
- package/studio-dist/server/assets/useMutation-DzTZGenE.js +690 -0
- package/studio-dist/server/assets/useSelector-DUmCUXAs.js +3387 -0
- package/studio-dist/server/assets/utils-C9CX1kcy.js +221 -0
- package/studio-dist/server/assets/vault-BDuIUq0F.js +1035 -0
- package/studio-dist/server/assets/vault-BVLp6zu3.js +85 -0
- package/studio-dist/server/assets/views-flRUr21z.js +80 -0
- package/studio-dist/server/assets/warnings-CDy9pdgL.js +24 -0
- package/studio-dist/server/assets/wasm-inline-CNeBKGwC.js +3 -0
- package/studio-dist/server/assets/workflow-D9GKI2EV.js +680 -0
- package/studio-dist/server/server.js +16640 -0
- package/wrappers/bin/graphify +52 -4
- package/wrappers/bin/openspec +33 -9
- package/wrappers/lib/graphify-gate.mjs +8 -0
- package/src/cli/commands/report/collector.ts +0 -288
- package/src/cli/commands/studio/views/client.ts +0 -654
- package/src/cli/commands/studio/views/companion-picker.tsx +0 -95
- package/src/cli/commands/studio/views/companion-selector.tsx +0 -94
- package/src/cli/commands/studio/views/dashboard/changes.tsx +0 -107
- package/src/cli/commands/studio/views/dashboard/index.tsx +0 -19
- package/src/cli/commands/studio/views/document.tsx +0 -842
- package/src/cli/commands/studio/views/error.tsx +0 -20
- package/src/cli/commands/studio/views/reports/index.tsx +0 -49
- package/src/cli/commands/studio/views/selection-fields.tsx +0 -14
- package/src/cli/commands/studio/views/skills/index.tsx +0 -87
- package/src/cli/commands/studio/views/specs/index.tsx +0 -157
- package/src/cli/commands/studio/views/styles.ts +0 -519
- package/src/cli/commands/studio/views/terminal.tsx +0 -484
- package/src/cli/commands/studio/views/vault/state.ts +0 -43
- package/src/cli/commands/studio/views/warnings.tsx +0 -21
- package/src/cli/commands/studio/views/workflow/index.tsx +0 -21
- package/src/cli/commands/studio/views/workflow/steps.ts +0 -337
- package/src/cli/commands/studio/views/workflow/transcript.tsx +0 -190
- package/src/lib/components/theme.ts +0 -2
- package/src/templates/mate-skills/agents/mate-artifact-publish/SKILL.md +0 -185
- package/src/templates/mate-skills/claude/mate-artifact-publish/SKILL.md +0 -185
- package/src/tools/setup/git-utils.ts +0 -30
- package/src/tools/setup/runtime-documents.ts +0 -291
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
|
|
5
|
+
import { checkoutRootOf, isSameClone, readGitLayout } from "./git-layout";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Routes tokensave tool calls to a linked worktree's own index. The MCP server
|
|
9
|
+
* stays bound to the checkout the session started in, which may itself be a
|
|
10
|
+
* linked worktree; a per-call `graph_root` is tokensave's own way to query
|
|
11
|
+
* another initialised project, read-only. tokensave rejects a `graph_root`
|
|
12
|
+
* naming the served project, so that checkout is never routed.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/** The tokensave store's database, relative to a checkout root. */
|
|
16
|
+
export const TOKENSAVE_DB = path.join(".tokensave", "tokensave.db");
|
|
17
|
+
|
|
18
|
+
/** Touched when routing last synced a worktree's index; its mtime throttles the next sync. */
|
|
19
|
+
export const ROUTE_SYNC_MARKER = path.join(".tokensave", "mate-route-synced");
|
|
20
|
+
|
|
21
|
+
/** At most one routed sync per worktree in this window. */
|
|
22
|
+
const SYNC_INTERVAL_MS = 30_000;
|
|
23
|
+
const SYNC_TIMEOUT_MS = 10_000;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Graph query tools that take `graph_root`. Edit, git, memory, branch and
|
|
27
|
+
* config tools do not: they keep acting on the served checkout.
|
|
28
|
+
*/
|
|
29
|
+
const GRAPH_ROOT_TOOLS = new Set([
|
|
30
|
+
"annotations",
|
|
31
|
+
"ambiguous_calls",
|
|
32
|
+
"body",
|
|
33
|
+
"by_qualified_name",
|
|
34
|
+
"call_chain",
|
|
35
|
+
"callees",
|
|
36
|
+
"callers",
|
|
37
|
+
"callers_for",
|
|
38
|
+
"circular",
|
|
39
|
+
"complexity",
|
|
40
|
+
"constructors",
|
|
41
|
+
"context",
|
|
42
|
+
"coupling",
|
|
43
|
+
"dead_code",
|
|
44
|
+
"dependency_depth",
|
|
45
|
+
"derives",
|
|
46
|
+
"distribution",
|
|
47
|
+
"doc",
|
|
48
|
+
"doc_coverage",
|
|
49
|
+
"dsm",
|
|
50
|
+
"entities",
|
|
51
|
+
"field_sites",
|
|
52
|
+
"file_dependents",
|
|
53
|
+
"files",
|
|
54
|
+
"find_exact_symbol",
|
|
55
|
+
"gini",
|
|
56
|
+
"god_class",
|
|
57
|
+
"health",
|
|
58
|
+
"hotspots",
|
|
59
|
+
"impact",
|
|
60
|
+
"implementations",
|
|
61
|
+
"impls",
|
|
62
|
+
"imports",
|
|
63
|
+
"inheritance_depth",
|
|
64
|
+
"largest",
|
|
65
|
+
"module_api",
|
|
66
|
+
"node",
|
|
67
|
+
"rank",
|
|
68
|
+
"read",
|
|
69
|
+
"recursion",
|
|
70
|
+
"search",
|
|
71
|
+
"signature",
|
|
72
|
+
"signature_search",
|
|
73
|
+
"similar",
|
|
74
|
+
"status",
|
|
75
|
+
"test_coverage",
|
|
76
|
+
"test_map",
|
|
77
|
+
"test_risk",
|
|
78
|
+
"todos",
|
|
79
|
+
"type_hierarchy",
|
|
80
|
+
"unsafe_patterns",
|
|
81
|
+
"unused_imports",
|
|
82
|
+
]);
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* True for a tokensave graph query that takes `graph_root`, by the name Claude
|
|
86
|
+
* (`mcp__tokensave__tokensave_<tool>`) or OpenCode (`tokensave_tokensave_<tool>`) gives it.
|
|
87
|
+
*/
|
|
88
|
+
export function isRoutableTokensaveTool(tool: string): boolean {
|
|
89
|
+
const match = /^(?:mcp__tokensave__|tokensave_)tokensave_([a-z_]+)$/.exec(tool);
|
|
90
|
+
return match !== null && GRAPH_ROOT_TOOLS.has(match[1]!);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface RouteDeps {
|
|
94
|
+
/** Brings the worktree's index up to date; the default runs `tokensave sync`, throttled. */
|
|
95
|
+
refresh?: (root: string) => void;
|
|
96
|
+
/** The session's start directory: its checkout is the one the MCP server serves. */
|
|
97
|
+
servedDirectory?: string;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Runs `tokensave sync` in `root` unless it ran within {@link SYNC_INTERVAL_MS}. Nothing
|
|
102
|
+
* else keeps a worktree's index fresh: the MCP server watches only the served checkout.
|
|
103
|
+
* Bounded and silent; a failure leaves the index as it was.
|
|
104
|
+
*/
|
|
105
|
+
export function refreshWorktreeIndex(root: string): void {
|
|
106
|
+
const marker = path.join(root, ROUTE_SYNC_MARKER);
|
|
107
|
+
const last = fs.statSync(marker, { throwIfNoEntry: false })?.mtimeMs ?? 0;
|
|
108
|
+
if (Date.now() - last < SYNC_INTERVAL_MS) return;
|
|
109
|
+
// Touched first, so a failing or slow sync is not retried on every call.
|
|
110
|
+
fs.writeFileSync(marker, "");
|
|
111
|
+
spawnSync("tokensave", ["sync"], { cwd: root, stdio: "ignore", timeout: SYNC_TIMEOUT_MS });
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* `input` with `graph_root` set to the linked worktree containing `directory`,
|
|
116
|
+
* when `tool` takes `graph_root`, `input` names none, the worktree holds a
|
|
117
|
+
* tokensave index and is not the served checkout; the index is refreshed
|
|
118
|
+
* first. Otherwise, and on any error, `undefined`: the call passes unchanged.
|
|
119
|
+
*/
|
|
120
|
+
export function routeTokensaveInput(
|
|
121
|
+
tool: string,
|
|
122
|
+
directory: string,
|
|
123
|
+
input: unknown,
|
|
124
|
+
deps: RouteDeps = {},
|
|
125
|
+
): Record<string, unknown> | undefined {
|
|
126
|
+
try {
|
|
127
|
+
if (!isRoutableTokensaveTool(tool)) return undefined;
|
|
128
|
+
// A tool with no arguments sends none; anything else must be an arguments object.
|
|
129
|
+
const given = input === undefined ? {} : input;
|
|
130
|
+
if (given === null || typeof given !== "object" || Array.isArray(given)) return undefined;
|
|
131
|
+
const args = given as Record<string, unknown>;
|
|
132
|
+
if (args.graph_root !== undefined && args.graph_root !== null) return undefined;
|
|
133
|
+
const root = checkoutRootOf(directory);
|
|
134
|
+
if (!root || readGitLayout(root)?.kind !== "linked") return undefined;
|
|
135
|
+
if (!fs.statSync(path.join(root, TOKENSAVE_DB), { throwIfNoEntry: false })?.isFile())
|
|
136
|
+
return undefined;
|
|
137
|
+
if (deps.servedDirectory && checkoutRootOf(deps.servedDirectory) === root) return undefined;
|
|
138
|
+
try {
|
|
139
|
+
(deps.refresh ?? refreshWorktreeIndex)(root);
|
|
140
|
+
} catch {
|
|
141
|
+
// A stale index still answers better than the main checkout's.
|
|
142
|
+
}
|
|
143
|
+
return { ...args, graph_root: root };
|
|
144
|
+
} catch {
|
|
145
|
+
return undefined;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* The checkout a tokensave index command acts on: the one containing `cwd`
|
|
151
|
+
* when it belongs to the Working Repository's clone, so a session moved into a
|
|
152
|
+
* worktree indexes the worktree whatever `MATE_REPO_PATH` names; else `repoPath`.
|
|
153
|
+
*/
|
|
154
|
+
export function tokensaveCheckout(cwd: string, repoPath: string): string {
|
|
155
|
+
const root = checkoutRootOf(cwd);
|
|
156
|
+
return root && isSameClone(root, repoPath) ? root : repoPath;
|
|
157
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
|
|
4
|
+
import { readGitLayout } from "./git-layout";
|
|
5
|
+
import { mirroredUmbrellaOf, repoLocalRegistryPath } from "./repo-local";
|
|
6
|
+
|
|
7
|
+
export { mirroredUmbrellaOf } from "./repo-local";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Umbrella folders from files alone: synchronous, no `git` process, so hooks and the
|
|
11
|
+
* OpenCode plugin can ask. `lib/orchestrator/umbrella-checkouts` re-exports these.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/** Direct child folders of `folder` with a Git layout and no Repository Link of their own, in name order. */
|
|
15
|
+
export function umbrellaChildFolders(folder: string): string[] {
|
|
16
|
+
let listed: fs.Dirent[];
|
|
17
|
+
try {
|
|
18
|
+
listed = fs.readdirSync(folder, { withFileTypes: true });
|
|
19
|
+
} catch {
|
|
20
|
+
return [];
|
|
21
|
+
}
|
|
22
|
+
return listed
|
|
23
|
+
.filter((entry) => entry.isDirectory() && !entry.name.startsWith("."))
|
|
24
|
+
.map((entry) => path.join(folder, entry.name))
|
|
25
|
+
.filter((child) => readGitLayout(child) !== null && !isFile(repoLocalRegistryPath(child)))
|
|
26
|
+
.toSorted();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function isFile(candidate: string): boolean {
|
|
30
|
+
return fs.statSync(candidate, { throwIfNoEntry: false })?.isFile() ?? false;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The linked Umbrella Repository or mirrored umbrella worktree holding `dir`: the nearest
|
|
35
|
+
* ancestor-or-self with a Repository Link, no Git layout, and a direct child Git checkout.
|
|
36
|
+
* Null inside a Git checkout, even one in an umbrella, and when the nearest link is no
|
|
37
|
+
* umbrella's.
|
|
38
|
+
*/
|
|
39
|
+
export function umbrellaFolderOf(dir: string): string | null {
|
|
40
|
+
let current = path.resolve(dir);
|
|
41
|
+
for (;;) {
|
|
42
|
+
if (readGitLayout(current)) return null;
|
|
43
|
+
if (isFile(repoLocalRegistryPath(current))) {
|
|
44
|
+
return umbrellaChildFolders(current).length > 0 ? current : null;
|
|
45
|
+
}
|
|
46
|
+
const parent = path.dirname(current);
|
|
47
|
+
if (parent === current) return null;
|
|
48
|
+
current = parent;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** The Umbrella Repository whose mirrored worktree the umbrella folder `folder` is; else null. */
|
|
53
|
+
export function umbrellaMirroredBy(folder: string): string | null {
|
|
54
|
+
const umbrella = mirroredUmbrellaOf(folder);
|
|
55
|
+
return umbrella && umbrellaFolderOf(umbrella) === umbrella ? umbrella : null;
|
|
56
|
+
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
|
|
3
1
|
import { hookGroupKey, type ClaudeHookGroup } from "./claude-hook-group";
|
|
4
2
|
import {
|
|
5
3
|
CLAUDE_SETTINGS_DOCUMENT,
|
|
@@ -9,10 +7,11 @@ import {
|
|
|
9
7
|
copies,
|
|
10
8
|
documents,
|
|
11
9
|
links,
|
|
12
|
-
|
|
10
|
+
recordedMapEntries,
|
|
13
11
|
parseManifest,
|
|
14
12
|
parseManifestStrict,
|
|
15
13
|
readManifestText,
|
|
14
|
+
readManifestTextSync,
|
|
16
15
|
recordedListValues,
|
|
17
16
|
recordedMapKeys,
|
|
18
17
|
type Manifest,
|
|
@@ -21,17 +20,28 @@ import {
|
|
|
21
20
|
|
|
22
21
|
/**
|
|
23
22
|
* Wrap State: the one read model over the runtime document manifest for "which
|
|
24
|
-
* runtimes are wrapped" and "which Claude hook groups
|
|
23
|
+
* runtimes are wrapped" and "which Claude hook groups and plugin folders does
|
|
24
|
+
* the wrap carry".
|
|
25
25
|
* Mate's own plugin groups are not folded in; `isMateGuardHookGroup` owns those.
|
|
26
26
|
*/
|
|
27
27
|
export interface WrapState {
|
|
28
28
|
readonly runtimes: ReadonlySet<WrapRuntime>;
|
|
29
29
|
readonly carriedClaudeHookGroups: readonly ClaudeHookGroup[];
|
|
30
30
|
carriesClaudeHookGroup(group: ClaudeHookGroup): boolean;
|
|
31
|
+
/** Capability plugin IDs and directory marketplaces the Wrap recorded. */
|
|
32
|
+
readonly carriedClaudePlugins: readonly WrappedClaudePlugin[];
|
|
33
|
+
/** Capability plugin folders the wrap enables through a `directory` marketplace, as recorded. */
|
|
34
|
+
readonly carriedClaudePluginDirectories: readonly string[];
|
|
31
35
|
/** MCP server names the wrap declared in `.opencode/opencode.json`; user servers are not listed. */
|
|
32
36
|
readonly openCodeMcpServers: readonly string[];
|
|
33
37
|
}
|
|
34
38
|
|
|
39
|
+
export interface WrappedClaudePlugin {
|
|
40
|
+
readonly id: string;
|
|
41
|
+
readonly marketplace: string;
|
|
42
|
+
readonly directory: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
35
45
|
export const WRAP_RUNTIMES: readonly WrapRuntime[] = ["claude", "opencode"];
|
|
36
46
|
|
|
37
47
|
/** Wrapped for a runtime: a document, a copy or a link is recorded for it. */
|
|
@@ -43,19 +53,49 @@ function wrappedFor(manifest: Manifest, runtime: WrapRuntime): boolean {
|
|
|
43
53
|
);
|
|
44
54
|
}
|
|
45
55
|
|
|
46
|
-
|
|
56
|
+
/**
|
|
57
|
+
* Each enabled plugin of a recorded `directory` marketplace: a marketplace
|
|
58
|
+
* without an enabled plugin loads nothing.
|
|
59
|
+
*/
|
|
60
|
+
function carriedPlugins(manifest: Manifest): WrappedClaudePlugin[] {
|
|
61
|
+
const marketplaces = recordedMapEntries(manifest, CLAUDE_SETTINGS_DOCUMENT, [
|
|
62
|
+
"extraKnownMarketplaces",
|
|
63
|
+
]);
|
|
64
|
+
const enabled = recordedMapEntries(manifest, CLAUDE_SETTINGS_DOCUMENT, ["enabledPlugins"]);
|
|
65
|
+
return Object.entries(marketplaces).flatMap(([marketplace, entry]) => {
|
|
66
|
+
const source = isRecord(entry) ? entry.source : undefined;
|
|
67
|
+
if (!isRecord(source) || source.source !== "directory" || typeof source.path !== "string") {
|
|
68
|
+
return [];
|
|
69
|
+
}
|
|
70
|
+
const directory = source.path;
|
|
71
|
+
return Object.entries(enabled)
|
|
72
|
+
.filter(([id, value]) => value === true && id.slice(id.lastIndexOf("@") + 1) === marketplace)
|
|
73
|
+
.map(([id]) => ({ id, marketplace, directory }));
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
47
78
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
48
79
|
}
|
|
49
80
|
|
|
81
|
+
function isHookGroup(value: unknown): value is ClaudeHookGroup {
|
|
82
|
+
return isRecord(value);
|
|
83
|
+
}
|
|
84
|
+
|
|
50
85
|
export function wrapStateOf(manifest: Manifest): WrapState {
|
|
51
86
|
const carried = recordedListValues(manifest, CLAUDE_SETTINGS_DOCUMENT, ["hooks"]).filter(
|
|
52
87
|
isHookGroup,
|
|
53
88
|
);
|
|
54
89
|
const carriedKeys = new Set(carried.map(hookGroupKey));
|
|
90
|
+
const plugins = carriedPlugins(manifest);
|
|
55
91
|
return {
|
|
56
92
|
runtimes: new Set(WRAP_RUNTIMES.filter((runtime) => wrappedFor(manifest, runtime))),
|
|
57
93
|
carriedClaudeHookGroups: carried,
|
|
58
94
|
carriesClaudeHookGroup: (group) => carriedKeys.has(hookGroupKey(group)),
|
|
95
|
+
carriedClaudePlugins: plugins,
|
|
96
|
+
carriedClaudePluginDirectories: [
|
|
97
|
+
...new Map(plugins.map(({ marketplace, directory }) => [marketplace, directory])).values(),
|
|
98
|
+
],
|
|
59
99
|
openCodeMcpServers: recordedMapKeys(
|
|
60
100
|
manifest,
|
|
61
101
|
OPENCODE_CONFIG_DOCUMENT,
|
|
@@ -64,21 +104,46 @@ export function wrapStateOf(manifest: Manifest): WrapState {
|
|
|
64
104
|
};
|
|
65
105
|
}
|
|
66
106
|
|
|
107
|
+
/**
|
|
108
|
+
* A Checkout's own wrap state joined with the Claude wrap that serves it
|
|
109
|
+
* (design Decision 12): Claude Code loads both settings files, so a launch
|
|
110
|
+
* leaves to them every hook group and plugin either carries. Everything else
|
|
111
|
+
* stays the Checkout's own.
|
|
112
|
+
*/
|
|
113
|
+
export function joinedClaudeWrapState(own: WrapState, serving: WrapState): WrapState {
|
|
114
|
+
const groups = [
|
|
115
|
+
...own.carriedClaudeHookGroups,
|
|
116
|
+
...serving.carriedClaudeHookGroups.filter((group) => !own.carriesClaudeHookGroup(group)),
|
|
117
|
+
];
|
|
118
|
+
const keys = new Set(groups.map(hookGroupKey));
|
|
119
|
+
const ownPlugins = new Set(own.carriedClaudePlugins.map((plugin) => plugin.id));
|
|
120
|
+
return {
|
|
121
|
+
...own,
|
|
122
|
+
runtimes: serving.runtimes.has("claude") ? new Set([...own.runtimes, "claude"]) : own.runtimes,
|
|
123
|
+
carriedClaudeHookGroups: groups,
|
|
124
|
+
carriesClaudeHookGroup: (group) => keys.has(hookGroupKey(group)),
|
|
125
|
+
carriedClaudePlugins: [
|
|
126
|
+
...own.carriedClaudePlugins,
|
|
127
|
+
...serving.carriedClaudePlugins.filter((plugin) => !ownPlugins.has(plugin.id)),
|
|
128
|
+
],
|
|
129
|
+
carriedClaudePluginDirectories: [
|
|
130
|
+
...new Set([
|
|
131
|
+
...own.carriedClaudePluginDirectories,
|
|
132
|
+
...serving.carriedClaudePluginDirectories,
|
|
133
|
+
]),
|
|
134
|
+
],
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
67
138
|
/** Where no Projection Root resolves: nothing is wrapped. */
|
|
68
139
|
export const NOT_WRAPPED: WrapState = wrapStateOf(EMPTY_MANIFEST);
|
|
69
140
|
|
|
70
141
|
/**
|
|
71
|
-
* Lenient, for session-start readers that must never fail: an absent
|
|
72
|
-
* unreadable manifest reads as not wrapped.
|
|
142
|
+
* Lenient, for session-start readers that must never fail: an absent,
|
|
143
|
+
* unreadable or Git-tracked manifest reads as not wrapped.
|
|
73
144
|
*/
|
|
74
145
|
export function readWrapStateSync(repoPath: string): WrapState {
|
|
75
|
-
|
|
76
|
-
try {
|
|
77
|
-
raw = fs.readFileSync(manifestPath(repoPath), "utf8");
|
|
78
|
-
} catch {
|
|
79
|
-
/* absent or unreadable: not wrapped */
|
|
80
|
-
}
|
|
81
|
-
return wrapStateOf(parseManifest(raw));
|
|
146
|
+
return wrapStateOf(parseManifest(readManifestTextSync(repoPath), repoPath));
|
|
82
147
|
}
|
|
83
148
|
|
|
84
149
|
/**
|
|
@@ -86,5 +151,5 @@ export function readWrapStateSync(repoPath: string): WrapState {
|
|
|
86
151
|
* throws, so a rewrite never strips wrap-placed content it could not see.
|
|
87
152
|
*/
|
|
88
153
|
export async function readWrapState(repoPath: string): Promise<WrapState> {
|
|
89
|
-
return wrapStateOf(parseManifestStrict(await readManifestText(repoPath)));
|
|
154
|
+
return wrapStateOf(parseManifestStrict(await readManifestText(repoPath), repoPath));
|
|
90
155
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
// oxlint-disable no-await-in-loop
|
|
1
2
|
import crypto from "node:crypto";
|
|
2
3
|
import fs from "node:fs/promises";
|
|
4
|
+
import path from "node:path";
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* Writes via a sibling temp file + `fs.rename()` so an interrupted write cannot
|
|
@@ -11,17 +13,79 @@ export async function writeAtomic(
|
|
|
11
13
|
target: string,
|
|
12
14
|
contents: string | Buffer,
|
|
13
15
|
mode?: number,
|
|
16
|
+
): Promise<void> {
|
|
17
|
+
await replaceViaTemp(target, contents, mode, false);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** `exactMode`: chmod past the umask, so a replaced file keeps the mode it had. */
|
|
21
|
+
async function replaceViaTemp(
|
|
22
|
+
target: string,
|
|
23
|
+
contents: string | Buffer,
|
|
24
|
+
mode: number | undefined,
|
|
25
|
+
exactMode: boolean,
|
|
14
26
|
): Promise<void> {
|
|
15
27
|
const tempPath = `${target}.${crypto.randomUUID()}.tmp`;
|
|
16
28
|
try {
|
|
29
|
+
/** Created with the mode, so private contents are never readable at a wider one. */
|
|
17
30
|
await fs.writeFile(
|
|
18
31
|
tempPath,
|
|
19
32
|
contents,
|
|
20
33
|
mode === undefined ? "utf8" : { encoding: "utf8", mode },
|
|
21
34
|
);
|
|
35
|
+
if (exactMode && mode !== undefined) await fs.chmod(tempPath, mode);
|
|
22
36
|
await fs.rename(tempPath, target);
|
|
23
37
|
} catch (error) {
|
|
24
38
|
await fs.rm(tempPath, { force: true }).catch(() => {});
|
|
25
39
|
throw error;
|
|
26
40
|
}
|
|
27
41
|
}
|
|
42
|
+
|
|
43
|
+
const MAX_LINK_HOPS = 40;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Follows a symlink chain to its end, which may not exist yet: a dangling link names where to create.
|
|
47
|
+
* Link text is never normalized lexically: `..` after a directory symlink means the real parent.
|
|
48
|
+
*/
|
|
49
|
+
async function resolveLinkEnd(filePath: string): Promise<string> {
|
|
50
|
+
let current = filePath;
|
|
51
|
+
for (let hop = 0; hop < MAX_LINK_HOPS; hop++) {
|
|
52
|
+
const parent = await fs.realpath(path.dirname(current));
|
|
53
|
+
const entry = path.join(parent, path.basename(current));
|
|
54
|
+
const link = await fs.readlink(entry).catch((error: NodeJS.ErrnoException) => {
|
|
55
|
+
if (error.code === "ENOENT" || error.code === "EINVAL") return null;
|
|
56
|
+
throw error;
|
|
57
|
+
});
|
|
58
|
+
if (link === null) return entry;
|
|
59
|
+
current = path.isAbsolute(link) ? link : `${parent}${path.sep}${link}`;
|
|
60
|
+
}
|
|
61
|
+
throw Object.assign(new Error(`too many levels of symbolic links: ${filePath}`), {
|
|
62
|
+
code: "ELOOP",
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* As `writeAtomic`, through a symlink: the link stays and its target is
|
|
68
|
+
* replaced, or created when the link dangles. An existing file keeps its mode.
|
|
69
|
+
* A read-only file is refused, as a plain write would refuse it. A hardlinked
|
|
70
|
+
* file is written in place: replacing it would split it from its other links.
|
|
71
|
+
*/
|
|
72
|
+
export async function writeAtomicThroughLink(
|
|
73
|
+
filePath: string,
|
|
74
|
+
contents: string | Buffer,
|
|
75
|
+
): Promise<void> {
|
|
76
|
+
const target = await resolveLinkEnd(filePath);
|
|
77
|
+
const existing = await fs.stat(target).catch(() => null);
|
|
78
|
+
if (existing && existing.nlink > 1) return fs.writeFile(target, contents, "utf8");
|
|
79
|
+
if (existing) await fs.access(target, fs.constants.W_OK);
|
|
80
|
+
await replaceViaTemp(target, contents, existing ? existing.mode & 0o7777 : undefined, true);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Deletes a file its writer left without content. A symlink stays: deleting it
|
|
85
|
+
* would leave the old text in its target, so the target is emptied instead.
|
|
86
|
+
*/
|
|
87
|
+
export async function removeEmptiedFile(filePath: string): Promise<void> {
|
|
88
|
+
const entry = await fs.lstat(filePath);
|
|
89
|
+
if (entry.isSymbolicLink()) await writeAtomicThroughLink(filePath, "");
|
|
90
|
+
else await fs.unlink(filePath);
|
|
91
|
+
}
|
package/src/studio.ts
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What Studio's application (`@uniqbit/mate-studio`) may use from Mate Core: the
|
|
3
|
+
* services contract it receives as request context and the view model types.
|
|
4
|
+
*/
|
|
5
|
+
export type {
|
|
6
|
+
CompanionAddInput,
|
|
7
|
+
CompanionAddResult,
|
|
8
|
+
RepositoryAddInput,
|
|
9
|
+
RepositoryAddResult,
|
|
10
|
+
StudioFormField,
|
|
11
|
+
StudioRequestContext,
|
|
12
|
+
StudioServices,
|
|
13
|
+
} from "./cli/commands/studio/services";
|
|
14
|
+
export {
|
|
15
|
+
formatCollectedAt,
|
|
16
|
+
healthNote,
|
|
17
|
+
type StudioPage,
|
|
18
|
+
type StudioReportSummary,
|
|
19
|
+
type StudioVaultPage,
|
|
20
|
+
} from "./cli/commands/studio/views/model";
|
|
21
|
+
export type {
|
|
22
|
+
StudioChange,
|
|
23
|
+
StudioCompanionPayload,
|
|
24
|
+
StudioShippedChange,
|
|
25
|
+
StudioSpec,
|
|
26
|
+
StudioSpecScope,
|
|
27
|
+
StudioWorkset,
|
|
28
|
+
} from "./cli/commands/studio/payload";
|
|
29
|
+
export type { FactoryRunView } from "./lib/factory/outcomes/runs";
|
|
30
|
+
export {
|
|
31
|
+
archivedArtifactPath,
|
|
32
|
+
canonicalSpecPath,
|
|
33
|
+
capabilityNodeId,
|
|
34
|
+
GRAPH_ARTIFACTS,
|
|
35
|
+
GRAPH_EDGE_KINDS,
|
|
36
|
+
GRAPH_EDGE_STRIDE,
|
|
37
|
+
ROOT_AREA_LABEL,
|
|
38
|
+
type StudioGraphArchive,
|
|
39
|
+
type StudioGraphEdgeKind,
|
|
40
|
+
type StudioGraphNode,
|
|
41
|
+
type StudioGraphNodeKind,
|
|
42
|
+
type StudioSpecGraph,
|
|
43
|
+
} from "./cli/commands/studio/graph-model";
|
|
44
|
+
|
|
45
|
+
export {
|
|
46
|
+
CHANGE_PLACEHOLDER,
|
|
47
|
+
COMPANION_DIGEST_PATTERN,
|
|
48
|
+
COMPANION_PARAM,
|
|
49
|
+
companionDigest,
|
|
50
|
+
effectiveMode,
|
|
51
|
+
IDEA_PLACEHOLDER,
|
|
52
|
+
LANDING_VIEW,
|
|
53
|
+
LEGACY_ROLE_MODES,
|
|
54
|
+
LEGACY_ROLE_PARAM,
|
|
55
|
+
MODE_VIEWS,
|
|
56
|
+
modePolicy,
|
|
57
|
+
NODE_PARAM,
|
|
58
|
+
openFile,
|
|
59
|
+
openFolder,
|
|
60
|
+
parse as parseSelection,
|
|
61
|
+
requestedMode,
|
|
62
|
+
resolveCompanion,
|
|
63
|
+
SHARED_VIEWS,
|
|
64
|
+
STUDIO_MODE_PARAM,
|
|
65
|
+
STUDIO_MODES,
|
|
66
|
+
STUDIO_PROFILES,
|
|
67
|
+
switchCompanion,
|
|
68
|
+
switchMode,
|
|
69
|
+
switchView,
|
|
70
|
+
toHref,
|
|
71
|
+
VIEW_PARAM,
|
|
72
|
+
viewsFor,
|
|
73
|
+
type StudioMode,
|
|
74
|
+
type StudioModePolicy,
|
|
75
|
+
type StudioProfile,
|
|
76
|
+
type StudioSelection,
|
|
77
|
+
type StudioView,
|
|
78
|
+
} from "./cli/commands/studio/selection";
|
|
79
|
+
export { BRAND_SVGS } from "./brand/svg.generated";
|
|
80
|
+
export {
|
|
81
|
+
FACTORY_CREDENTIAL_ROUTE,
|
|
82
|
+
FACTORY_GIT_TOKENS_ROUTE,
|
|
83
|
+
factoryLogRoute,
|
|
84
|
+
factoryLogStreamRoute,
|
|
85
|
+
REPORT_VIEW_PREFIX,
|
|
86
|
+
STUDIO_EVENTS_ROUTE,
|
|
87
|
+
TERMINAL_SESSIONS_END_ROUTE,
|
|
88
|
+
TERMINAL_SESSIONS_ROUTE,
|
|
89
|
+
TERMINAL_SOCKET_ROUTE,
|
|
90
|
+
TERMINAL_WASM,
|
|
91
|
+
type StudioEvent,
|
|
92
|
+
} from "./cli/commands/studio/routes";
|
|
93
|
+
export type { CredentialKind, CredentialStatus } from "./lib/factory/credential-store";
|
|
94
|
+
export type { GitTokenStatus } from "./lib/factory/git-credential-store";
|
|
95
|
+
export { type AgentQuestion, questionsOf } from "./lib/factory/runner/questions";
|
|
96
|
+
export {
|
|
97
|
+
isOutcomeAction,
|
|
98
|
+
OUTCOME_ACTIONS,
|
|
99
|
+
outcomeActions,
|
|
100
|
+
outcomeRefusal,
|
|
101
|
+
type OutcomeAction,
|
|
102
|
+
type OutcomeCompanionFacts,
|
|
103
|
+
type OutcomeFacts,
|
|
104
|
+
type OutcomeRunFacts,
|
|
105
|
+
} from "./lib/factory/outcomes/actions";
|
|
106
|
+
export type { TerminalAgent } from "./cli/commands/studio/terminal";
|
|
107
|
+
export type {
|
|
108
|
+
VaultEntry,
|
|
109
|
+
VaultOpenFile,
|
|
110
|
+
VaultView,
|
|
111
|
+
VaultViewRequest,
|
|
112
|
+
} from "./cli/commands/studio/views/vault/view";
|
|
113
|
+
export type {
|
|
114
|
+
MdAttributes,
|
|
115
|
+
MdElement,
|
|
116
|
+
MdNode,
|
|
117
|
+
MdTag,
|
|
118
|
+
} from "./cli/commands/studio/views/vault/markdown-tree";
|
|
119
|
+
export { guideTree } from "./cli/commands/studio/views/vault/markdown-tree";
|
|
120
|
+
export type { VaultConflict, VaultSaved } from "./cli/commands/studio/vault";
|
|
121
|
+
export type { StudioInventory, StudioInventoryCompanion } from "./cli/commands/studio/inventory";
|
|
122
|
+
export type { StudioSkillInventory } from "./cli/commands/studio/mate-inventory";
|
|
123
|
+
export type { SkillAgent, SkillFileEntry, SkillPreview } from "./cli/commands/studio/skill-files";
|
|
124
|
+
export type { StoredReport } from "./cli/commands/studio/reports";
|
|
125
|
+
export type { UsageRequest } from "./lib/usage/cache";
|
|
126
|
+
export type {
|
|
127
|
+
CompanionUsageSnapshot,
|
|
128
|
+
UsageBreakdown,
|
|
129
|
+
UsageCost,
|
|
130
|
+
UsageCoverage,
|
|
131
|
+
UsageDaily,
|
|
132
|
+
UsageMetrics,
|
|
133
|
+
UsageRepository,
|
|
134
|
+
UsageResponse,
|
|
135
|
+
UsageSource,
|
|
136
|
+
UsageSourceName,
|
|
137
|
+
UsageWindow,
|
|
138
|
+
} from "./lib/usage/types";
|
|
139
|
+
export {
|
|
140
|
+
findAction,
|
|
141
|
+
SUBJECT_PATTERN,
|
|
142
|
+
specActionOffers,
|
|
143
|
+
type SpecActionOffer,
|
|
144
|
+
} from "./cli/commands/studio/actions";
|
|
145
|
+
export { compareRanked, rankOf } from "./lib/factory/runner/rank";
|
|
146
|
+
export type { Situation } from "./lib/factory/runner/state";
|
|
147
|
+
export { WORKSET_STAGE_ORDER, type WorksetStageId } from "./lib/workset/stage";
|
|
148
|
+
export {
|
|
149
|
+
DEFAULT_SCHEMA,
|
|
150
|
+
deliveryPath,
|
|
151
|
+
isMateSchema,
|
|
152
|
+
SCHEMA_ARTIFACTS,
|
|
153
|
+
type DeliveryStage,
|
|
154
|
+
type MateSchema,
|
|
155
|
+
type SkillStageId,
|
|
156
|
+
} from "./lib/delivery/stages";
|
|
157
|
+
export type { WorkflowTopology } from "./cli/commands/studio/topology";
|
|
158
|
+
export {
|
|
159
|
+
contrastRatio,
|
|
160
|
+
DARK_PALETTE,
|
|
161
|
+
LIGHT_PALETTE,
|
|
162
|
+
type ReportPalette,
|
|
163
|
+
} from "./cli/commands/report/palette";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
name: mate-minimal
|
|
2
|
-
version:
|
|
2
|
+
version: 5
|
|
3
3
|
description: Mate's short OpenSpec workflow for one-Area, low-risk changes - specs → tasks
|
|
4
4
|
artifacts:
|
|
5
5
|
- id: specs
|
|
@@ -12,7 +12,9 @@ artifacts:
|
|
|
12
12
|
data migration, public API change, breaking behavior, or cross-cutting design decision.
|
|
13
13
|
Use mate-v1 if any gate item is false or uncertain.
|
|
14
14
|
|
|
15
|
-
Read `openspec/mate-conventions.yaml
|
|
15
|
+
Read only the `rules` and `spec_rules` sections of `openspec/mate-conventions.yaml`: find the
|
|
16
|
+
top-level key lines first, never fixed line numbers; if you cannot select a section safely,
|
|
17
|
+
read the whole file. Create one delta spec
|
|
16
18
|
per affected capability under `specs/<capability>/spec.md`, using a kebab-case capability
|
|
17
19
|
name. Never place specs under an Area folder.
|
|
18
20
|
|
|
@@ -27,11 +29,12 @@ artifacts:
|
|
|
27
29
|
include **Reason** and **Migration**.
|
|
28
30
|
|
|
29
31
|
Every user story carries an **Area:** marker naming the Areas it binds, using values from
|
|
30
|
-
the
|
|
32
|
+
the `scopes` in the spec's `mate:delta` comment - always, even when there is only one Area.
|
|
31
33
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
`
|
|
34
|
+
Start each spec file with the template's `<!-- mate:delta` comment on its very first line, not
|
|
35
|
+
YAML frontmatter, with actual values and paired `scopes`. Between
|
|
36
|
+
the comment and the first `## ` section, put nothing but blank lines and at most one `# `
|
|
37
|
+
title line, or `openspec validate --strict` reports the text archive would drop.
|
|
35
38
|
requires: []
|
|
36
39
|
- id: tasks
|
|
37
40
|
generates: tasks.md
|
|
@@ -39,13 +42,14 @@ artifacts:
|
|
|
39
42
|
template: tasks.md
|
|
40
43
|
instruction: |
|
|
41
44
|
Create a flat implementation checklist that satisfies the delta specs. Keep it short: this
|
|
42
|
-
profile uses the shared `/
|
|
45
|
+
profile uses the shared `/mate-explore-change` and `/mate-propose-change` planning steps but
|
|
43
46
|
intentionally writes no explore, proposal, or design artifact.
|
|
44
47
|
|
|
45
48
|
Number tasks `N.M` and group them under `## N. <group>` headers so apply tracking can address them individually.
|
|
46
|
-
Read
|
|
49
|
+
Read only the `rules`, `skill_tagging`, and `verification` sections of `openspec/mate-conventions.yaml`
|
|
50
|
+
(same selection rule as above) and preserve its scope rules.
|
|
47
51
|
|
|
48
|
-
**Obsidian**:
|
|
52
|
+
**Obsidian**: Start with the template's frontmatter and `## References` section, replacing placeholders with real values.
|
|
49
53
|
requires:
|
|
50
54
|
- specs
|
|
51
55
|
apply:
|
|
@@ -55,4 +59,4 @@ apply:
|
|
|
55
59
|
instruction: |
|
|
56
60
|
Read the delta specs and work through pending tasks only within the affected Areas. Mark complete as you go.
|
|
57
61
|
Pause if you hit blockers or need clarification.
|
|
58
|
-
Before reporting the change complete, follow the verification rules in `openspec/mate-conventions.yaml`.
|
|
62
|
+
Before reporting the change complete, follow the verification rules in the `verification` section of `openspec/mate-conventions.yaml`.
|