@uniqbit/mate-core 1.0.0-canary.5 → 1.0.0-canary.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/claude-capability-plugins/companion-mentions/.claude-plugin/plugin.json +1 -1
- package/claude-capability-plugins/companion-mentions/hooks/register.ts +1 -1
- package/claude-plugin/hooks/hooks.json +41 -1
- package/claude-plugin/hooks/rtk-worktree-git.mjs +58 -0
- package/claude-plugin/hooks/workflow-turn.mjs +68 -0
- package/opencode-plugin/src/companion.ts +6 -0
- package/opencode-plugin/src/server.ts +33 -2
- package/package.json +5 -2
- package/src/cli/commands/artifact/apply-context.ts +1 -0
- package/src/cli/commands/artifact/artifact.ts +16 -0
- package/src/cli/commands/artifact/delivery/archive.ts +37 -112
- package/src/cli/commands/artifact/delivery/branch-flags.ts +19 -1
- package/src/cli/commands/artifact/delivery/environment.ts +32 -72
- package/src/cli/commands/artifact/delivery/link.ts +53 -34
- package/src/cli/commands/artifact/delivery/output.ts +25 -4
- package/src/cli/commands/artifact/delivery/resolve.ts +101 -0
- package/src/cli/commands/artifact/delivery/submit.ts +164 -0
- package/src/cli/commands/artifact/delivery/take.ts +45 -0
- package/src/cli/commands/artifact/extract-repo-name.ts +1 -1
- package/src/cli/commands/artifact/finish/command.ts +455 -43
- package/src/cli/commands/artifact/finish/engine.ts +79 -61
- package/src/cli/commands/artifact/finish/finisher.ts +5 -12
- package/src/cli/commands/artifact/finish/git.ts +9 -10
- package/src/cli/commands/artifact/finish/openspec.ts +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 +119 -6
- package/src/cli/commands/artifact/pending/discovery.ts +7 -11
- package/src/cli/commands/artifact/project/command.ts +60 -0
- package/src/cli/commands/companion/list.ts +70 -14
- package/src/cli/commands/companion/sync.ts +18 -0
- package/src/cli/commands/companion/update.ts +4 -19
- package/src/cli/commands/doctor.ts +51 -0
- package/src/cli/commands/friction.ts +558 -0
- package/src/cli/commands/install.ts +48 -36
- package/src/cli/commands/launch/claude.ts +2 -0
- package/src/cli/commands/launch/shared.ts +33 -6
- package/src/cli/commands/plugin/install.ts +27 -11
- package/src/cli/commands/report/index.ts +180 -184
- package/src/cli/commands/report/markdown.ts +67 -72
- package/src/cli/commands/shared/companion-selection.ts +3 -1
- package/src/cli/commands/studio/access.ts +6 -14
- package/src/cli/commands/studio/areas.ts +112 -33
- package/src/cli/commands/studio/companion-add.ts +72 -0
- package/src/cli/commands/studio/companion-removal.ts +15 -8
- package/src/cli/commands/studio/connection.ts +53 -0
- package/src/cli/commands/studio/graph-model.ts +61 -0
- package/src/cli/commands/studio/graph.ts +336 -0
- package/src/cli/commands/studio/index.ts +4 -4
- package/src/{lib/factory/outcomes/sessions.ts → cli/commands/studio/live-sessions.ts} +26 -2
- package/src/cli/commands/studio/payload.ts +214 -32
- package/src/cli/commands/studio/reports.ts +19 -18
- package/src/cli/commands/studio/routes.ts +8 -18
- package/src/cli/commands/studio/selection.ts +21 -5
- package/src/cli/commands/studio/server.ts +322 -191
- package/src/cli/commands/studio/service-host.ts +266 -0
- package/src/cli/commands/studio/services.ts +59 -16
- package/src/cli/commands/studio/studio-app.ts +1 -0
- package/src/cli/commands/studio/terminal.ts +45 -3
- package/src/cli/commands/studio/vault.ts +41 -40
- package/src/cli/commands/studio/views/model.ts +1 -9
- package/src/cli/commands/studio/views/vault/markdown-tree.ts +90 -8
- package/src/cli/commands/triage.ts +151 -0
- package/src/cli/commands/unwrap.ts +3 -0
- package/src/cli/commands/update.ts +2 -0
- package/src/cli/commands/vscode/release-vsix.json +4 -0
- package/src/cli/commands/vscode/setup.ts +71 -13
- package/src/cli/commands/vscode/vsix.ts +48 -7
- package/src/cli/commands/workflow/workflow.ts +516 -0
- package/src/cli/commands/working/cleanup.ts +40 -8
- package/src/cli/commands/working/worktree.ts +176 -35
- package/src/cli/main.ts +61 -10
- package/src/cli/plugin-commands.ts +6 -1
- package/src/cli/repo-list-table.tsx +73 -37
- package/src/cli/usage.ts +29 -8
- package/src/create-mate.ts +11 -5
- package/src/distribution.ts +2 -0
- package/src/factory-host.ts +69 -0
- package/src/hooks/companion-instructions.ts +19 -8
- package/src/hooks/hook-io.ts +3 -1
- package/src/hooks/rtk-worktree-git.ts +48 -0
- package/src/hooks/session-banner.ts +25 -0
- package/src/hooks/validate-artifact-path.ts +108 -26
- package/src/hooks/workflow-turn.ts +219 -0
- package/src/lib/apply-context/fingerprint.ts +2 -1
- package/src/lib/apply-context/protocol.ts +2 -2
- package/src/lib/artifact-trailer.ts +27 -0
- package/src/lib/change-layout.ts +83 -38
- package/src/lib/delivery/branch-template.ts +114 -0
- package/src/lib/delivery/branches.ts +21 -16
- package/src/lib/delivery/checkout.ts +103 -0
- package/src/lib/delivery/environment.ts +131 -7
- package/src/lib/delivery/merge-git.ts +282 -26
- package/src/lib/delivery/overlap.ts +68 -16
- package/src/lib/delivery/record-delivery.ts +178 -37
- package/src/lib/delivery/record.ts +201 -27
- package/src/lib/delivery/refresh.ts +212 -151
- package/src/lib/delivery/remote.ts +66 -0
- package/src/lib/delivery/repository-access.ts +19 -60
- package/src/lib/delivery/resolve-branch.ts +157 -110
- package/src/lib/delivery/stages.ts +83 -50
- package/src/lib/delivery/staging/apply-chain.ts +164 -0
- package/src/lib/delivery/staging/artifact-type.ts +101 -0
- package/src/lib/delivery/staging/declared-type.ts +277 -0
- package/src/lib/delivery/staging/naming.ts +64 -0
- package/src/lib/delivery/staging/openspec-type.ts +135 -0
- package/src/lib/delivery/staging/pending-edit.ts +291 -0
- package/src/lib/delivery/staging/pending.ts +780 -0
- package/src/lib/delivery/staging/project.ts +373 -0
- package/src/lib/delivery/staging/publish.ts +1024 -0
- package/src/lib/delivery/staging/refs.ts +258 -0
- package/src/lib/delivery/staging/registry.ts +73 -0
- package/src/lib/delivery/staging/replay.ts +308 -0
- package/src/lib/delivery/staging/requirement-blocks.ts +10 -0
- package/src/lib/delivery/staging/resolve.ts +264 -0
- package/src/lib/delivery/staging/settle-linked.ts +290 -0
- package/src/lib/delivery/staging/submit.ts +929 -0
- package/src/lib/delivery/staging/worktree.ts +130 -0
- package/src/lib/delivery/submit-change.ts +443 -0
- package/src/lib/friction/describe.ts +42 -0
- package/src/lib/friction/fields.ts +60 -0
- package/src/lib/friction/mark.ts +156 -0
- package/src/lib/friction/view/model.ts +67 -0
- package/src/lib/friction/view/read.ts +136 -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/openspec-canonical-frontmatter.ts +159 -0
- 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/companion-hub.ts +6 -1
- package/src/lib/orchestrator/engine-floor.ts +48 -0
- package/src/lib/orchestrator/framework-context.ts +15 -1
- package/src/lib/orchestrator/launcher.ts +34 -1
- package/src/lib/orchestrator/projection-claude-commands.ts +2 -2
- package/src/lib/orchestrator/projection-claude-entry.ts +42 -21
- package/src/lib/orchestrator/projection-claude-links.ts +33 -8
- package/src/lib/orchestrator/projection-claude-skills.ts +2 -2
- package/src/lib/orchestrator/projection-entries.ts +22 -18
- package/src/lib/orchestrator/projection-opencode-copies.ts +65 -21
- package/src/lib/orchestrator/projection-runtime-documents.ts +66 -43
- package/src/lib/orchestrator/projection-types.ts +28 -1
- package/src/lib/orchestrator/refresh-working-claude-links.ts +4 -1
- package/src/lib/orchestrator/root-context.ts +23 -6
- package/src/lib/orchestrator/session-prepare.ts +17 -2
- package/src/lib/orchestrator/setup-compatibilities.ts +1 -1
- package/src/lib/orchestrator/types.ts +4 -0
- package/src/lib/orchestrator/umbrella-checkouts.ts +102 -0
- package/src/lib/orchestrator/working-repo-projection.ts +24 -4
- package/src/lib/orchestrator/wrap-pass.ts +1 -0
- package/src/lib/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/public-npm.ts +95 -50
- package/src/lib/session-attribution.ts +3 -7
- package/src/lib/session-state.ts +74 -3
- package/src/lib/triage/context.ts +186 -0
- package/src/lib/triage/launch.ts +52 -0
- package/src/lib/triage/prepare.ts +97 -0
- package/src/lib/triage/session.ts +126 -0
- package/src/lib/update-checker.ts +7 -1
- package/src/lib/usage/aggregate.ts +202 -0
- package/src/lib/usage/cache.ts +87 -0
- package/src/lib/usage/claude-pricing.ts +71 -0
- package/src/lib/usage/claude.ts +189 -0
- package/src/lib/usage/collect.ts +56 -0
- package/src/lib/usage/opencode.ts +188 -0
- package/src/lib/usage/records.ts +80 -0
- package/src/lib/usage/rtk-database.ts +72 -0
- package/src/lib/usage/savings.ts +209 -0
- package/src/lib/usage/scope.ts +182 -0
- package/src/lib/usage/source.ts +102 -0
- package/src/lib/usage/types.ts +143 -0
- package/src/lib/usage/window.ts +37 -0
- package/src/lib/workflow/declaration.ts +6 -0
- package/src/lib/workflow/handoff.ts +90 -0
- package/src/lib/workflow/hook-trust.ts +108 -0
- package/src/lib/workflow/position.ts +524 -0
- package/src/lib/workflow/report.ts +79 -0
- package/src/lib/workflow/work.ts +106 -0
- package/src/lib/workset/factory-local.ts +157 -0
- package/src/lib/workset/record.ts +25 -11
- package/src/lib/workset/repositories.ts +118 -25
- package/src/lib/workset/stage.ts +4 -2
- package/src/lib/workset/stages.ts +64 -4
- package/src/lib/workset/worktree-include.ts +161 -0
- package/src/lib/workset/worktree-index.ts +6 -2
- package/src/lib/workset/worktree.ts +622 -114
- package/src/opencode/companion-hooks.ts +105 -18
- package/src/opencode/companion-policy.ts +18 -5
- package/src/opencode/enter-worktree.ts +254 -6
- package/src/opencode/projected-guidance.ts +7 -2
- package/src/opencode/session-register.ts +2 -2
- package/src/opencode/turn-hook.ts +241 -0
- package/src/playbooks/companion-guidance.ts +7 -4
- package/src/plugin-api.ts +47 -0
- package/src/runtime/artifact-trailers.ts +63 -0
- package/src/runtime/claude-bg-isolation.ts +138 -0
- package/src/runtime/claude-hook-group.ts +2 -0
- package/src/runtime/command-friction.ts +97 -0
- package/src/runtime/companion-git-state.ts +155 -10
- package/src/runtime/companion-git.ts +96 -13
- package/src/runtime/companion-guidance.ts +136 -20
- package/src/runtime/companion-instructions.ts +1 -1
- package/src/runtime/companion-sync.ts +109 -21
- package/src/runtime/current-branch.ts +16 -2
- package/src/runtime/entered-worktree.ts +24 -0
- package/src/runtime/env-names.ts +2 -2
- package/src/runtime/env.ts +7 -6
- package/src/runtime/forge-remote.ts +48 -0
- package/src/runtime/friction-fingerprint.ts +35 -0
- package/src/runtime/friction-log.ts +352 -0
- package/src/runtime/friction-recorder.ts +199 -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 +60 -0
- 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/repo-destination.ts +72 -0
- package/src/runtime/repo-local.ts +25 -3
- package/src/runtime/rtk-git-guard.ts +66 -0
- package/src/runtime/runtime-document-manifest.ts +229 -19
- package/src/runtime/runtime-document-manifest.typecheck.ts +10 -0
- package/src/runtime/secret-guard.ts +9 -2
- package/src/runtime/secret-patterns.ts +3 -2
- package/src/runtime/secret-policy-weakening.ts +122 -0
- package/src/runtime/secret-values.ts +16 -0
- package/src/runtime/serving-claude-wrap.ts +15 -2
- 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 +84 -0
- package/src/runtime/workflow/change-folders.ts +66 -0
- package/src/runtime/workflow/declaration.ts +720 -0
- package/src/runtime/workflow/globs.ts +85 -0
- package/src/runtime/workflow/next-handoff-process.ts +99 -0
- package/src/runtime/workflow/turn.ts +309 -0
- package/src/runtime/workflow/workflow.ts +262 -0
- package/src/runtime/wrap-state.ts +5 -13
- package/src/studio.ts +112 -19
- package/src/templates/capabilities/openspec-cap/{mate-v1 → mate-full}/schema.yaml +3 -3
- package/src/templates/capabilities/openspec-cap/{mate-v1 → mate-full}/templates/design.md +1 -1
- package/src/templates/capabilities/openspec-cap/{mate-v1 → mate-full}/templates/proposal.md +1 -1
- package/src/templates/capabilities/openspec-cap/{mate-v1 → mate-full}/templates/tasks.md +1 -1
- package/src/templates/capabilities/openspec-cap/mate-minimal/schema.yaml +3 -3
- package/src/templates/mate-skills/agents/mate-apply-change/SKILL.md +103 -30
- package/src/templates/mate-skills/agents/mate-apply-change/references/openspec-apply-change.md +1 -1
- package/src/templates/mate-skills/agents/mate-archive-change/SKILL.md +7 -70
- package/src/templates/mate-skills/agents/mate-clarify-intent/SKILL.md +13 -7
- package/src/templates/mate-skills/agents/mate-domain-modeling/SKILL.md +10 -0
- package/src/templates/mate-skills/agents/mate-explore-change/SKILL.md +46 -14
- package/src/templates/mate-skills/agents/mate-propose-change/SKILL.md +50 -31
- 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 +114 -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 +11 -5
- package/src/templates/mate-skills/agents/mate-simplify-code/SKILL.md +16 -6
- package/src/templates/mate-skills/agents/mate-submit-change/SKILL.md +114 -0
- package/src/templates/mate-skills/claude/mate-apply-change/SKILL.md +103 -30
- package/src/templates/mate-skills/claude/mate-apply-change/references/openspec-apply-change.md +1 -1
- package/src/templates/mate-skills/claude/mate-archive-change/SKILL.md +7 -70
- package/src/templates/mate-skills/claude/mate-clarify-intent/SKILL.md +13 -7
- package/src/templates/mate-skills/claude/mate-domain-modeling/SKILL.md +10 -0
- package/src/templates/mate-skills/claude/mate-explore-change/SKILL.md +46 -14
- package/src/templates/mate-skills/claude/mate-propose-change/SKILL.md +50 -31
- 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 +114 -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 +11 -5
- package/src/templates/mate-skills/claude/mate-simplify-code/SKILL.md +16 -6
- package/src/templates/mate-skills/claude/mate-submit-change/SKILL.md +114 -0
- package/src/templates/mate-skills/openspec-references.ts +3 -2
- package/src/templates/triage/PLAYBOOK.md +112 -0
- package/src/tools/setup/__snapshots__/runtime-surface-golden.test.ts.snap +912 -139
- package/src/tools/setup/capabilities/openspec.ts +54 -15
- package/src/tools/setup/capabilities/rtk.ts +113 -9
- package/src/tools/setup/capabilities/tokensave.ts +3 -2
- package/src/tools/setup/dynamic-plugins/api.ts +38 -0
- package/src/tools/setup/dynamic-plugins/audiences.ts +65 -21
- package/src/tools/setup/dynamic-plugins/frozen.ts +32 -13
- package/src/tools/setup/dynamic-plugins/host.ts +2 -32
- package/src/tools/setup/dynamic-plugins/hydrate.ts +4 -4
- package/src/tools/setup/dynamic-plugins/install.ts +24 -22
- package/src/tools/setup/dynamic-plugins/loader.ts +11 -7
- package/src/tools/setup/dynamic-plugins/paths.ts +30 -10
- package/src/tools/setup/dynamic-plugins/verify.ts +10 -7
- package/src/tools/setup/dynamic-plugins/workspaces.ts +153 -0
- package/src/tools/setup/engine.ts +20 -1
- package/src/tools/setup/mate.ts +5 -3
- package/src/tools/setup/package-managers/bun.ts +8 -8
- package/src/tools/setup/plugin.ts +14 -1
- package/src/tools/setup/plugins/gitignore.ts +15 -9
- package/src/tools/setup/plugins/guidance.ts +4 -2
- package/src/tools/setup/providers/claude-plugin-hooks.ts +30 -0
- package/src/tools/setup/providers/claude.ts +43 -6
- package/src/tools/setup/service-registry.ts +69 -0
- package/src/tools/setup/service.ts +237 -0
- package/src/tools/setup/utils.ts +28 -5
- package/src/tools/setup/working-repo-cleanup.ts +2 -2
- package/src/tools/setup/working-repo-local-state.ts +2 -0
- package/src/tools/setup.ts +41 -16
- package/studio-dist/client/assets/app-aIwDxf48.css +2 -0
- package/studio-dist/client/assets/button-CX0sWAJl.js +1 -0
- package/studio-dist/client/assets/combobox-BmA8RjOc.js +1 -0
- package/studio-dist/client/assets/companion-view-DINdPF-b.js +1 -0
- package/studio-dist/client/assets/fields-BobQ7zRF.js +1 -0
- package/studio-dist/client/assets/friction-YdYd3zaz.js +1 -0
- package/studio-dist/client/assets/getting-started-CY7NEtTw.js +1 -0
- package/studio-dist/client/assets/getting-started-djaQeWlu.js +1 -0
- package/studio-dist/client/assets/getting-started._topic-DVB8e5R9.js +1 -0
- package/studio-dist/client/assets/getting-started.index-DQvLHEr1.js +1 -0
- package/studio-dist/client/assets/graph-DbNnR884.js +2 -0
- package/studio-dist/client/assets/graph-canvas-DIcAqwtK.js +3242 -0
- package/studio-dist/client/assets/guides-D6T6W_jV.js +1 -0
- package/studio-dist/client/assets/index-CysBCSxM.js +40 -0
- package/studio-dist/client/assets/jsx-runtime-MZURdZre.js +1 -0
- package/studio-dist/client/assets/markdown-view-jMiaBTSO.js +1 -0
- package/studio-dist/client/assets/panel-Csr49lBo.js +1 -0
- package/studio-dist/client/assets/plugins._service._view-CEA_CcPe.js +1 -0
- package/studio-dist/client/assets/{prepaint-CwSrpdFA.js → prepaint-CKsXyJOR.js} +3 -3
- package/studio-dist/client/assets/queries-Dfp5deWj.js +1 -0
- package/studio-dist/client/assets/react-BYUSgtBs.js +1 -0
- package/studio-dist/client/assets/reports-CLdgxxkg.js +1 -0
- package/studio-dist/client/assets/routes-DGilWbDE.js +1 -0
- package/studio-dist/client/assets/search-CXosfvYh.js +1 -0
- package/studio-dist/client/assets/select-DdebbX7K.js +1 -0
- package/studio-dist/client/assets/skills-C3zNkU8g.js +1 -0
- package/studio-dist/client/assets/specs-Dl8HfGlU.js +1 -0
- package/studio-dist/client/assets/specs-view-B_n0Pekv.js +1 -0
- package/studio-dist/client/assets/steps-CKUno4lh.js +1 -0
- package/studio-dist/client/assets/store-DyXbi6o9.js +1 -0
- package/studio-dist/client/assets/studio-0ueISxwP.js +100 -0
- package/studio-dist/client/assets/studio-queries-BflKt9va.js +2 -0
- package/studio-dist/client/assets/usage-Blcl8kA_.js +55 -0
- package/studio-dist/client/assets/useAnchoredPopupScrollLock-BBXJpX5L.js +1 -0
- package/studio-dist/client/assets/useBaseQuery-C2cjmeH2.js +1 -0
- package/studio-dist/client/assets/useMutation-DI6LbvVa.js +1 -0
- package/studio-dist/client/assets/useSelector-AYcH7lB0.js +2 -0
- package/studio-dist/client/assets/vault-Cb9DmM1i.js +1 -0
- package/studio-dist/client/assets/warnings-B-rvoW8q.js +1 -0
- package/studio-dist/client/assets/workflow-DN5T19jd.js +1 -0
- package/studio-dist/server/assets/__23tanstack-start-server-fn-resolver-JoHQ5ihx.js +122 -0
- package/studio-dist/server/assets/_tanstack-start-manifest_v.js +100 -39
- package/studio-dist/server/assets/{button-CIJqAhni.js → button-B7e1fRyW.js} +63 -3574
- package/studio-dist/server/assets/combobox--S_OmUfh.js +483 -0
- package/studio-dist/server/assets/{companion-view-DISASvdJ.js → companion-view-D-vGM55e.js} +3 -3
- package/studio-dist/server/assets/companions-Dr6IpNAb.js +31 -0
- package/studio-dist/server/assets/{createServerRpc-tK2lE9R2.js → createServerRpc-bFKFpGFG.js} +1 -1
- package/studio-dist/server/assets/fields-B4qM2ZwC.js +1190 -0
- package/studio-dist/server/assets/friction-CWOTjpCV.js +62 -0
- package/studio-dist/server/assets/friction-sLxaWY-H.js +903 -0
- package/studio-dist/server/assets/getting-started-B136TP57.js +4 -0
- package/studio-dist/server/assets/getting-started-Cq5Pcnsr.js +67 -0
- package/studio-dist/server/assets/getting-started._topic-CmWdl3u3.js +13 -0
- package/studio-dist/server/assets/getting-started.index-AB8xpTFY.js +13 -0
- package/studio-dist/server/assets/graph-B11ITte0.js +16 -0
- package/studio-dist/server/assets/graph-C_Hn-Wf_.js +800 -0
- package/studio-dist/server/assets/graph-canvas-BthrSmPS.js +21066 -0
- package/studio-dist/server/assets/graph-wire-BdSUx0G5.js +58 -0
- package/studio-dist/server/assets/guides-B8HdeK_C.js +13 -0
- package/studio-dist/server/assets/guides-BVQ4pt5B.js +5 -0
- package/studio-dist/server/assets/guides.server-DqFQAStf.js +66 -0
- package/studio-dist/server/assets/jsx-runtime-Bt0s0YKS.js +451 -0
- package/studio-dist/server/assets/{markdown-view-Bn7xPdks.js → markdown-view-rwiiVcPC.js} +28 -9
- package/studio-dist/server/assets/{panel-3Jmn4awF.js → panel-CUxRIpYL.js} +5 -5
- package/studio-dist/server/assets/plugins._service._view-BSvGnlhU.js +94 -0
- package/studio-dist/server/assets/{prepaint-DJfTQ_VH.js → prepaint-B28ClcPN.js} +1 -1
- package/studio-dist/server/assets/queries-S_Pl90IG.js +32 -0
- package/studio-dist/server/assets/{react-Ce6dj15C.js → react-CiBZPDs8.js} +3 -4
- package/studio-dist/server/assets/redirect-BaZ_QyqF.js +39 -0
- package/studio-dist/server/assets/{reports-C06RXVE2.js → reports-B9k98oE6.js} +3 -3
- package/studio-dist/server/assets/{reports-D6YMqhnO.js → reports-CJpAItPk.js} +14 -10
- package/studio-dist/server/assets/{router-C8MGqlAY.js → router-DF0etoNa.js} +1322 -3127
- package/studio-dist/server/assets/{routes-BcFgvqf7.js → routes-6ylCLkyg.js} +221 -76
- package/studio-dist/server/assets/search-b-yQesv3.js +78 -0
- package/studio-dist/server/assets/select-CjuKScan.js +1609 -0
- package/studio-dist/server/assets/{shell-DS3wUexh.js → shell-DLkP7wG9.js} +15 -6
- package/studio-dist/server/assets/{skills-CtrBAtX3.js → skills-DGg0mWDM.js} +3 -3
- package/studio-dist/server/assets/{skills-BEnOxiDl.js → skills-zeU80A9S.js} +8 -8
- package/studio-dist/server/assets/specs-DDBNT_v1.js +51 -0
- package/studio-dist/server/assets/specs-view-exvmWdg0.js +425 -0
- package/studio-dist/server/assets/{steps-Dq_CwY_s.js → steps-D1tYAyWZ.js} +88 -45
- package/studio-dist/server/assets/store-kS7zk0Hr.js +93 -0
- package/studio-dist/server/assets/studio-qRvQjRpz.js +10482 -0
- package/studio-dist/server/assets/studio-queries-qOXOYoPt.js +1393 -0
- package/studio-dist/server/assets/usage-C2um7YiV.js +25553 -0
- package/studio-dist/server/assets/usage-Cwle9-xY.js +24 -0
- package/studio-dist/server/assets/useAnchoredPopupScrollLock-kQBB3y_b.js +756 -0
- package/studio-dist/server/assets/useBaseQuery--iH3rd-T.js +2051 -0
- package/studio-dist/server/assets/useMutation-C-WO6hCM.js +690 -0
- package/studio-dist/server/assets/{__23tanstack-start-server-fn-resolver-M2GBs8s3.js → useSelector-DUmCUXAs.js} +4 -668
- package/studio-dist/server/assets/{vault-Fvxt2Tzl.js → vault-B8vgVIH9.js} +10 -7
- package/studio-dist/server/assets/{vault-BmWnryh3.js → vault-CEBBRLMb.js} +3 -3
- package/studio-dist/server/assets/{views-BgYa-za2.js → views-UgO0Qz_g.js} +9 -6
- package/studio-dist/server/assets/{warnings-DzR6fyZh.js → warnings-BxK4VfV5.js} +2 -2
- package/studio-dist/server/assets/{delivery-path-C29fBynY.js → workflow-BrTK632u.js} +152 -120
- package/studio-dist/server/server.js +582 -8
- package/src/cli/commands/factory/factory.ts +0 -301
- package/src/cli/commands/report/collector.ts +0 -288
- package/src/cli/commands/studio/factory-credential.ts +0 -49
- package/src/cli/commands/studio/workset-session.ts +0 -131
- package/src/lib/delivery/archive-change.ts +0 -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 -113
- package/src/lib/factory/attach.ts +0 -178
- package/src/lib/factory/broker.ts +0 -190
- package/src/lib/factory/bun-commands.ts +0 -39
- package/src/lib/factory/client.ts +0 -92
- package/src/lib/factory/command.ts +0 -61
- package/src/lib/factory/credential-store.ts +0 -153
- package/src/lib/factory/frames.ts +0 -77
- package/src/lib/factory/ids.ts +0 -58
- package/src/lib/factory/outcomes/actions.ts +0 -114
- package/src/lib/factory/outcomes/index.ts +0 -391
- package/src/lib/factory/outcomes/lifecycle.ts +0 -205
- package/src/lib/factory/outcomes/runs.ts +0 -81
- package/src/lib/factory/prepare.ts +0 -49
- package/src/lib/factory/pty.ts +0 -103
- package/src/lib/factory/runner/companion-context.ts +0 -178
- package/src/lib/factory/runner/control.ts +0 -92
- package/src/lib/factory/runner/harness-agent.ts +0 -250
- package/src/lib/factory/runner/live.ts +0 -159
- package/src/lib/factory/runner/questions.ts +0 -22
- package/src/lib/factory/runner/rank.ts +0 -26
- package/src/lib/factory/runner/run-policy.ts +0 -12
- package/src/lib/factory/runner/run.ts +0 -199
- package/src/lib/factory/runner/scheduler.ts +0 -416
- package/src/lib/factory/runner/state.ts +0 -233
- package/src/lib/factory/runner/workflow.ts +0 -542
- package/src/lib/factory/runtime.ts +0 -981
- 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-CdPiFv59.css +0 -2
- package/studio-dist/client/assets/button-BIIHE0EQ.js +0 -3
- package/studio-dist/client/assets/companion-view-DM6YyXaR.js +0 -1
- package/studio-dist/client/assets/delivery-path-DELxj0Av.js +0 -1
- package/studio-dist/client/assets/factory-BZy0E8ty.js +0 -4
- package/studio-dist/client/assets/index-B3wkMzjA.js +0 -40
- package/studio-dist/client/assets/markdown-view-pQ2Qp_i5.js +0 -1
- package/studio-dist/client/assets/panel-CbajlC3p.js +0 -1
- package/studio-dist/client/assets/react-CN2GSx7x.js +0 -1
- package/studio-dist/client/assets/reports-DllhYQ5_.js +0 -1
- package/studio-dist/client/assets/rolldown-runtime-WkwZ5CU-.js +0 -1
- package/studio-dist/client/assets/routes-COm-G3mK.js +0 -1
- package/studio-dist/client/assets/skills-DmWAy-jZ.js +0 -1
- package/studio-dist/client/assets/specs-BG3Wi3ln.js +0 -1
- package/studio-dist/client/assets/steps-DFsH3Neu.js +0 -1
- package/studio-dist/client/assets/vault-B2q1nBY5.js +0 -1
- package/studio-dist/client/assets/warnings-BSXIyuSQ.js +0 -1
- package/studio-dist/client/assets/workflow-DlsQD6Hc.js +0 -1
- package/studio-dist/server/assets/actions-Bvgj9eb8.js +0 -54
- package/studio-dist/server/assets/companions-BYbHWKOZ.js +0 -15
- package/studio-dist/server/assets/createServerFn-F5sAOF8V.js +0 -459
- package/studio-dist/server/assets/factory-DGPmNGbo.js +0 -69
- package/studio-dist/server/assets/factory-DUTa0eDs.js +0 -2172
- package/studio-dist/server/assets/rolldown-runtime-DYf_mQCB.js +0 -34
- package/studio-dist/server/assets/search-JAKurDNh.js +0 -36
- package/studio-dist/server/assets/specs-C8rv34-5.js +0 -211
- package/studio-dist/server/assets/studio-BeltxxKt.js +0 -216
- package/studio-dist/server/assets/workflow-liRYecHk.js +0 -73
- /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
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import crypto from "node:crypto";
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
3
|
import fs from "node:fs/promises";
|
|
4
|
+
import os from "node:os";
|
|
4
5
|
import path from "node:path";
|
|
6
|
+
import { which } from "bun";
|
|
5
7
|
|
|
6
8
|
import { FRAMEWORK_NAME } from "../../../framework";
|
|
7
9
|
import { buildCompanionGuidance } from "../../../playbooks/companion-guidance";
|
|
@@ -12,9 +14,11 @@ import {
|
|
|
12
14
|
} from "../../../runtime/claude-delivery-plan";
|
|
13
15
|
import { hookGroupKey, type ClaudeHookGroup } from "../../../runtime/claude-hook-group";
|
|
14
16
|
import { MATE_ENV } from "../../../runtime/env-names";
|
|
17
|
+
import { readFrictionSwitch } from "../../../runtime/friction-switch";
|
|
15
18
|
import { SESSION_ORIGIN_ENV } from "../../../runtime/session-registry";
|
|
16
19
|
import { resolveSecretPolicy } from "../../../runtime/policy";
|
|
17
20
|
import { managedSessionKind } from "../../../runtime/session-kind";
|
|
21
|
+
import { umbrellaChildrenBlock } from "../../../runtime/umbrella-children";
|
|
18
22
|
import { NOT_WRAPPED } from "../../../runtime/wrap-state";
|
|
19
23
|
import { writeAtomic } from "../../../runtime/write-atomic";
|
|
20
24
|
import {
|
|
@@ -272,7 +276,12 @@ export class ClaudeAdapter extends LaunchAdapter<ClaudeLaunchContext> {
|
|
|
272
276
|
|
|
273
277
|
async prepareLaunch(context: ClaudeLaunchContext, args: string[]): Promise<PreparedLaunch> {
|
|
274
278
|
const launch = await super.prepareLaunch(context, args);
|
|
275
|
-
|
|
279
|
+
const prepared = isBackgroundLaunch(args) ? await backgroundLaunch(context, launch) : launch;
|
|
280
|
+
if (process.platform === "win32" && !which("claude", { PATH: prepared.env.PATH ?? "" })) {
|
|
281
|
+
const nativeClaude = path.join(os.homedir(), ".local", "bin", "claude.exe");
|
|
282
|
+
if (existsSync(nativeClaude)) return { ...prepared, command: nativeClaude };
|
|
283
|
+
}
|
|
284
|
+
return prepared;
|
|
276
285
|
}
|
|
277
286
|
|
|
278
287
|
/** A failed Claude wrap pass names the entry that failed. */
|
|
@@ -302,7 +311,8 @@ export class ClaudeAdapter extends LaunchAdapter<ClaudeLaunchContext> {
|
|
|
302
311
|
/**
|
|
303
312
|
* Plan in, flags out; decides nothing. `--append-system-prompt` is
|
|
304
313
|
* unconditional: no settings document can carry it. It holds the Agent
|
|
305
|
-
* Guidance
|
|
314
|
+
* Guidance and, in an Umbrella Repository, the children block read from the
|
|
315
|
+
* folder at each call; the Companion Instructions come from the wrap's session hook.
|
|
306
316
|
* `--plugin-dir` passes the folders `launchPluginFolders` names, from the
|
|
307
317
|
* running install's bundled plugin.
|
|
308
318
|
*/
|
|
@@ -322,12 +332,16 @@ export class ClaudeAdapter extends LaunchAdapter<ClaudeLaunchContext> {
|
|
|
322
332
|
const mcpConfigArgs =
|
|
323
333
|
plan.mcp === "mcp-config" && mcpConfigPath ? ["--mcp-config", mcpConfigPath] : [];
|
|
324
334
|
|
|
325
|
-
const guidance = buildCompanionGuidance(
|
|
326
|
-
...context,
|
|
327
|
-
|
|
328
|
-
|
|
335
|
+
const guidance = buildCompanionGuidance(
|
|
336
|
+
{ ...context, secretGuardrails: resolveSecretPolicy(context.companionPath).guardrails },
|
|
337
|
+
{ friction: readFrictionSwitch() },
|
|
338
|
+
);
|
|
339
|
+
const children = context.repository ? umbrellaChildrenBlock(context.repository.path) : "";
|
|
329
340
|
const { args: passthrough, prompts, boundary } = liftAppendedPrompts(args);
|
|
330
|
-
const promptArgs = [
|
|
341
|
+
const promptArgs = [
|
|
342
|
+
APPEND_PROMPT_FLAG,
|
|
343
|
+
[guidance, children, ...prompts].filter(Boolean).join("\n\n"),
|
|
344
|
+
];
|
|
331
345
|
const launchArgs = [...settingsArgs, ...mcpConfigArgs, ...pluginDirArgs];
|
|
332
346
|
|
|
333
347
|
if (boundary === undefined) {
|
|
@@ -5,6 +5,7 @@ const fs = await import("node:fs/promises");
|
|
|
5
5
|
const path = await import("node:path");
|
|
6
6
|
|
|
7
7
|
import { MATE_ENV } from "../../../runtime/env";
|
|
8
|
+
import { readFrictionSwitch } from "../../../runtime/friction-switch";
|
|
8
9
|
import { SESSION_ORIGIN_ENV } from "../../../runtime/session-registry";
|
|
9
10
|
import { mainCheckoutOf } from "../../../runtime/git-layout";
|
|
10
11
|
import { OPENCODE_PASSWORD } from "../../../runtime/opencode-server-record";
|
|
@@ -14,6 +15,7 @@ import { resolveSecretPolicy } from "../../../runtime/policy";
|
|
|
14
15
|
import { ensureOpenCodeServer } from "../../opencode-server";
|
|
15
16
|
import { validateOpenCodePluginAssets } from "../../package-paths";
|
|
16
17
|
import { readOpenCodeConfig } from "../../../tools/setup/providers/opencode-format";
|
|
18
|
+
import { declaredGuidance } from "../../../runtime/companion-guidance";
|
|
17
19
|
import { buildOpenCodeGuidance } from "../opencode-guidance";
|
|
18
20
|
import type { PrepareResult } from "../session-prepare";
|
|
19
21
|
import { LaunchPreflightError } from "../types";
|
|
@@ -171,6 +173,8 @@ export class OpenCodeAdapter extends LaunchAdapter {
|
|
|
171
173
|
return buildOpenCodeGuidance(context.capabilities, {
|
|
172
174
|
companionScoped: !context.repository,
|
|
173
175
|
secretGuardrails: resolveSecretPolicy(context.companionPath).guardrails,
|
|
176
|
+
friction: readFrictionSwitch(),
|
|
177
|
+
...declaredGuidance(context.companionPath),
|
|
174
178
|
});
|
|
175
179
|
}
|
|
176
180
|
|
|
@@ -12,8 +12,19 @@ import {
|
|
|
12
12
|
type UpstreamTarget,
|
|
13
13
|
} from "../../runtime/companion-git";
|
|
14
14
|
import { recordCompanionSync } from "../../runtime/companion-git-state";
|
|
15
|
+
import { errorMessage } from "../../runtime/error-message";
|
|
15
16
|
import { withCompanionLock, type CompanionLockOptions } from "../../runtime/companion-lock";
|
|
17
|
+
import { inboxRefspec, trackingRefs } from "../../runtime/pending-records";
|
|
18
|
+
import {
|
|
19
|
+
discardSubmittedArrivals,
|
|
20
|
+
editedAfterSubmitWarning,
|
|
21
|
+
planSubmittedArrivals,
|
|
22
|
+
type SubmittedArrivals,
|
|
23
|
+
type SubmittedLayout,
|
|
24
|
+
} from "../../runtime/submitted-arrivals";
|
|
16
25
|
import { FRAMEWORK_NAME } from "../../framework";
|
|
26
|
+
import { artifactTypes, defaultArtifactType } from "../delivery/staging/registry";
|
|
27
|
+
import { loadWorkflow } from "../workflow/declaration";
|
|
17
28
|
import { LaunchPreflightError } from "./types";
|
|
18
29
|
|
|
19
30
|
type GitCommandResult = GitResult;
|
|
@@ -23,12 +34,45 @@ export { describeGitFailure };
|
|
|
23
34
|
export interface CompanionGitSyncOptions {
|
|
24
35
|
/** Environment Git runs with. */
|
|
25
36
|
env?: Record<string, string | undefined>;
|
|
37
|
+
/** Home of Mate's local companion state; `HOME` by default. */
|
|
38
|
+
stateHome?: string;
|
|
26
39
|
}
|
|
27
40
|
|
|
28
41
|
export interface CompanionGitSyncResult {
|
|
29
42
|
skipped: boolean;
|
|
30
43
|
changed: boolean;
|
|
31
44
|
companionPath: string;
|
|
45
|
+
/** Submitted change folders discarded because their upstream copy or archive arrived. */
|
|
46
|
+
discarded?: string[];
|
|
47
|
+
/** Operator warnings, such as a submitted folder edited after submit. */
|
|
48
|
+
warnings?: string[];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* The folders of the companion's artifact types, as the arrival check reads them: the built-in
|
|
53
|
+
* type's, then those its workflow declares. An invalid declaration leaves the built-in type.
|
|
54
|
+
*/
|
|
55
|
+
async function submittedLayouts(companionPath: string): Promise<SubmittedLayout[]> {
|
|
56
|
+
const verdict = await loadWorkflow(companionPath).catch(() => null);
|
|
57
|
+
const types = verdict?.ok ? artifactTypes(undefined, verdict.workflow) : [defaultArtifactType()];
|
|
58
|
+
return types.map((type) => ({
|
|
59
|
+
source: type.source,
|
|
60
|
+
...(type.archiveRoot === undefined
|
|
61
|
+
? { trailer: type.name }
|
|
62
|
+
: { archiveRoot: type.archiveRoot }),
|
|
63
|
+
recordName: (id) => (type.isRecordId(id) ? type.recordName(id) : null),
|
|
64
|
+
}));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** The arrivals of every layout as one plan; a folder belongs to one layout. */
|
|
68
|
+
function mergeArrivals(plans: readonly SubmittedArrivals[]): SubmittedArrivals {
|
|
69
|
+
return {
|
|
70
|
+
discard: plans.flatMap((plan) => plan.discard),
|
|
71
|
+
discardFiles: Object.assign({}, ...plans.map((plan) => plan.discardFiles)),
|
|
72
|
+
committed: Object.assign({}, ...plans.map((plan) => plan.committed)),
|
|
73
|
+
edited: plans.flatMap((plan) => plan.edited),
|
|
74
|
+
forget: plans.flatMap((plan) => plan.forget),
|
|
75
|
+
};
|
|
32
76
|
}
|
|
33
77
|
|
|
34
78
|
export class CompanionGitSyncError extends LaunchPreflightError {
|
|
@@ -95,17 +139,7 @@ export class CompanionGitSync {
|
|
|
95
139
|
}
|
|
96
140
|
|
|
97
141
|
await this.assertNoUnfinishedOperation(companionPath);
|
|
98
|
-
const
|
|
99
|
-
this.resolveSyncTarget(companionPath),
|
|
100
|
-
this.command(companionPath, ["status", "--porcelain=v1", "--untracked-files=all"]),
|
|
101
|
-
]);
|
|
102
|
-
if (before.status !== 0) {
|
|
103
|
-
throw this.failure(
|
|
104
|
-
companionPath,
|
|
105
|
-
`Unable to inspect the working tree: ${this.detail(before)}`,
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
const dirty = outputLines(before.stdout).length > 0;
|
|
142
|
+
const target = await this.resolveSyncTarget(companionPath);
|
|
109
143
|
|
|
110
144
|
const fetch = await this.fetch(companionPath, target, interactiveGit);
|
|
111
145
|
if (fetch.status !== 0) {
|
|
@@ -130,6 +164,62 @@ export class CompanionGitSync {
|
|
|
130
164
|
);
|
|
131
165
|
}
|
|
132
166
|
|
|
167
|
+
const localGit = companionGit(companionPath, { prompt: "never", env: this.options.env });
|
|
168
|
+
// Read-only plans, one per type: read together.
|
|
169
|
+
const plans = await Promise.all(
|
|
170
|
+
(await submittedLayouts(companionPath)).map((layout) =>
|
|
171
|
+
planSubmittedArrivals(localGit, companionPath, target.ref, layout, this.options.stateHome),
|
|
172
|
+
),
|
|
173
|
+
);
|
|
174
|
+
const arrivals = mergeArrivals(plans);
|
|
175
|
+
const discarded = await discardSubmittedArrivals(
|
|
176
|
+
localGit,
|
|
177
|
+
companionPath,
|
|
178
|
+
arrivals,
|
|
179
|
+
this.options.stateHome,
|
|
180
|
+
);
|
|
181
|
+
const warnings = arrivals.edited.map(editedAfterSubmitWarning);
|
|
182
|
+
|
|
183
|
+
const before = await this.command(companionPath, [
|
|
184
|
+
"status",
|
|
185
|
+
"--porcelain=v1",
|
|
186
|
+
"--untracked-files=all",
|
|
187
|
+
]);
|
|
188
|
+
if (before.status !== 0) {
|
|
189
|
+
const lost = await restoreFailure(discarded);
|
|
190
|
+
const failure = this.failure(
|
|
191
|
+
companionPath,
|
|
192
|
+
`Unable to inspect the working tree: ${this.detail(before)}`,
|
|
193
|
+
);
|
|
194
|
+
throw withRestoreNote(companionPath, failure, lost);
|
|
195
|
+
}
|
|
196
|
+
const dirty = outputLines(before.stdout).length > 0;
|
|
197
|
+
|
|
198
|
+
let result: CompanionGitSyncResult;
|
|
199
|
+
try {
|
|
200
|
+
result = await this.mergeUpstream(
|
|
201
|
+
companionPath,
|
|
202
|
+
target,
|
|
203
|
+
dirty,
|
|
204
|
+
discarded.discarded,
|
|
205
|
+
warnings,
|
|
206
|
+
);
|
|
207
|
+
} catch (error) {
|
|
208
|
+
// A file the merge brought stays; only paths still missing get their submitted copy back.
|
|
209
|
+
const lost = await restoreFailure(discarded);
|
|
210
|
+
throw withRestoreNote(companionPath, error, lost);
|
|
211
|
+
}
|
|
212
|
+
await discarded.commit();
|
|
213
|
+
return result;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
private async mergeUpstream(
|
|
217
|
+
companionPath: string,
|
|
218
|
+
target: SyncTarget,
|
|
219
|
+
dirty: boolean,
|
|
220
|
+
discarded: string[],
|
|
221
|
+
warnings: string[],
|
|
222
|
+
): Promise<CompanionGitSyncResult> {
|
|
133
223
|
let stashRef: string | undefined;
|
|
134
224
|
if (dirty) {
|
|
135
225
|
const stash = await this.command(companionPath, [
|
|
@@ -176,19 +266,34 @@ export class CompanionGitSync {
|
|
|
176
266
|
skipped: false,
|
|
177
267
|
changed: headBefore.stdout.trim() !== headAfter.stdout.trim(),
|
|
178
268
|
companionPath,
|
|
269
|
+
...(discarded.length > 0 ? { discarded } : {}),
|
|
270
|
+
...(warnings.length > 0 ? { warnings } : {}),
|
|
179
271
|
};
|
|
180
272
|
}
|
|
181
273
|
|
|
182
|
-
/**
|
|
183
|
-
|
|
274
|
+
/**
|
|
275
|
+
* Only this fetch may prompt, and only when the caller is interactive. The inbox rides along
|
|
276
|
+
* for the pending count.
|
|
277
|
+
*/
|
|
278
|
+
private async fetch(
|
|
184
279
|
companionPath: string,
|
|
185
280
|
target: SyncTarget,
|
|
186
281
|
interactiveGit: boolean,
|
|
187
282
|
): Promise<GitCommandResult> {
|
|
188
|
-
|
|
283
|
+
const git = companionGit(companionPath, {
|
|
189
284
|
prompt: interactiveGit ? "if-terminal" : "never",
|
|
190
285
|
env: this.options.env,
|
|
191
|
-
})
|
|
286
|
+
});
|
|
287
|
+
const fetched = await git.fetch([target.remote, target.branch, inboxRefspec(target.remote)]);
|
|
288
|
+
if (fetched.status !== 0) return fetched;
|
|
289
|
+
// Publication lands on the default branch; a checkout tracking another branch fetches it too.
|
|
290
|
+
const prefix = `refs/remotes/${target.remote}/`;
|
|
291
|
+
const defaultRef = (await trackingRefs(companionPath))?.defaultRef;
|
|
292
|
+
if (defaultRef?.startsWith(prefix) && defaultRef !== `${prefix}${target.branch}`) {
|
|
293
|
+
const branch = defaultRef.slice(prefix.length);
|
|
294
|
+
await git.fetch([target.remote, `+refs/heads/${branch}:${defaultRef}`]);
|
|
295
|
+
}
|
|
296
|
+
return fetched;
|
|
192
297
|
}
|
|
193
298
|
|
|
194
299
|
private async mergeAndRestore(
|
|
@@ -260,10 +365,18 @@ export class CompanionGitSync {
|
|
|
260
365
|
}
|
|
261
366
|
|
|
262
367
|
// Keep the stash if dropping it fails; it remains a recoverable backup.
|
|
263
|
-
await this.
|
|
368
|
+
await this.dropStash(companionPath, stashRef);
|
|
264
369
|
}
|
|
265
370
|
}
|
|
266
371
|
|
|
372
|
+
/** Drops the stash entry holding commit `stashRef`: `git stash drop` takes no commit id. */
|
|
373
|
+
private async dropStash(companionPath: string, stashRef: string): Promise<void> {
|
|
374
|
+
const listed = await this.command(companionPath, ["stash", "list", "--format=%H"]);
|
|
375
|
+
if (listed.status !== 0) return;
|
|
376
|
+
const index = outputLines(listed.stdout).indexOf(stashRef);
|
|
377
|
+
if (index >= 0) await this.command(companionPath, ["stash", "drop", "-q", `stash@{${index}}`]);
|
|
378
|
+
}
|
|
379
|
+
|
|
267
380
|
private async assertSafeCompanionRoot(
|
|
268
381
|
companionPath: string,
|
|
269
382
|
workingRepoPath?: string,
|
|
@@ -429,6 +542,29 @@ export class CompanionGitSync {
|
|
|
429
542
|
}
|
|
430
543
|
}
|
|
431
544
|
|
|
545
|
+
/** Puts discarded submitted files back; a failure, naming where they are kept, is returned. */
|
|
546
|
+
async function restoreFailure(discarded: { restore: () => Promise<void> }): Promise<string | null> {
|
|
547
|
+
return discarded.restore().then(
|
|
548
|
+
() => null,
|
|
549
|
+
(error: unknown) => `Putting back discarded submitted folders failed: ${errorMessage(error)}.`,
|
|
550
|
+
);
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
/** `error`, its reason extended by `note` when restoring failed too. */
|
|
554
|
+
function withRestoreNote(companionPath: string, error: unknown, note: string | null): unknown {
|
|
555
|
+
if (!note) return error;
|
|
556
|
+
if (error instanceof CompanionGitSyncError) {
|
|
557
|
+
return new CompanionGitSyncError(
|
|
558
|
+
companionPath,
|
|
559
|
+
`${error.reason} ${note}`,
|
|
560
|
+
error.conflictingPaths,
|
|
561
|
+
error.recovery,
|
|
562
|
+
error.stashRef,
|
|
563
|
+
);
|
|
564
|
+
}
|
|
565
|
+
return new CompanionGitSyncError(companionPath, `${errorMessage(error)} ${note}`);
|
|
566
|
+
}
|
|
567
|
+
|
|
432
568
|
/**
|
|
433
569
|
* An attended operation waits for whoever holds the companion lock, however
|
|
434
570
|
* long: the holder may be an operator answering a merge conflict. The line
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
type PluginInstallResult,
|
|
15
15
|
} from "../../tools/setup/dynamic-plugins/install";
|
|
16
16
|
import { hydrateDynamicPlugins } from "../../tools/setup/dynamic-plugins/hydrate";
|
|
17
|
+
import { dynamicPluginsWorkspaceRoot } from "../../tools/setup/dynamic-plugins/paths";
|
|
17
18
|
import { applySetupCompatibilities } from "../../tools/setup";
|
|
18
19
|
import { findRepoLocalRegistryFile } from "./repository-link";
|
|
19
20
|
import { companionGit, describeGitFailure, type CompanionGit } from "../../runtime/companion-git";
|
|
@@ -350,7 +351,11 @@ export async function updateHubPlugins(
|
|
|
350
351
|
const resolvedHubPath = path.resolve(hubPath);
|
|
351
352
|
const results =
|
|
352
353
|
declarations.length > 0
|
|
353
|
-
? await installDeclaredPlugins(
|
|
354
|
+
? await installDeclaredPlugins(
|
|
355
|
+
dynamicPluginsWorkspaceRoot(resolvedHubPath),
|
|
356
|
+
declarations,
|
|
357
|
+
deps.installDeps,
|
|
358
|
+
)
|
|
354
359
|
: [];
|
|
355
360
|
if (declarations.length > 0) {
|
|
356
361
|
await (deps.hydrate ?? hydrateDynamicPlugins)({ companionPath: resolvedHubPath });
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
|
|
3
|
+
import semver from "semver";
|
|
4
|
+
|
|
5
|
+
import { FRAMEWORK_NAME } from "../../framework";
|
|
6
|
+
import { YamlFileStore } from "./yaml-file-store";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Raw view of `framework.yaml`: `ConfigStore.load()` merges defaults, so saving
|
|
10
|
+
* its result would add keys the companion never declared.
|
|
11
|
+
*/
|
|
12
|
+
class RawFrameworkConfigStore extends YamlFileStore<Record<string, unknown>> {
|
|
13
|
+
protected onMissing(): Promise<Record<string, unknown>> {
|
|
14
|
+
return Promise.resolve({});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function rawStore(companionPath: string): RawFrameworkConfigStore {
|
|
19
|
+
return new RawFrameworkConfigStore(
|
|
20
|
+
path.join(companionPath, `.${FRAMEWORK_NAME}`, "config", "framework.yaml"),
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Sets `engines.mate` to `range`. Returns true when the file was rewritten. */
|
|
25
|
+
export async function writeEngineFloor(companionPath: string, range: string): Promise<boolean> {
|
|
26
|
+
const store = rawStore(companionPath);
|
|
27
|
+
const raw = (await store.load()) ?? {};
|
|
28
|
+
const engines = (raw.engines ?? {}) as Record<string, string>;
|
|
29
|
+
if (engines[FRAMEWORK_NAME] === range) return false;
|
|
30
|
+
await store.save({ ...raw, engines: { ...engines, [FRAMEWORK_NAME]: range } });
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Raises `engines.mate` to `>=version` when it is absent or admits a lower
|
|
36
|
+
* version; a floor already at or above it, or a range that does not parse,
|
|
37
|
+
* is left alone. Returns true when the file was rewritten.
|
|
38
|
+
*/
|
|
39
|
+
export async function raiseEngineFloor(companionPath: string, version: string): Promise<boolean> {
|
|
40
|
+
const raw = (await rawStore(companionPath).load()) ?? {};
|
|
41
|
+
const current = ((raw.engines ?? {}) as Record<string, unknown>)[FRAMEWORK_NAME];
|
|
42
|
+
if (typeof current === "string") {
|
|
43
|
+
if (semver.validRange(current) === null) return false;
|
|
44
|
+
const lowest = semver.minVersion(current);
|
|
45
|
+
if (lowest && semver.gte(lowest, version)) return false;
|
|
46
|
+
}
|
|
47
|
+
return writeEngineFloor(companionPath, `>=${version}`);
|
|
48
|
+
}
|
|
@@ -74,6 +74,14 @@ function makeContext(
|
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
/** The context of a companion already resolved, e.g. by a launch, with its Working Repository. */
|
|
78
|
+
export function companionContext(
|
|
79
|
+
companionPath: string,
|
|
80
|
+
repository?: LinkedRepository,
|
|
81
|
+
): FrameworkContext {
|
|
82
|
+
return makeContext(companionPath, "working-repo", repository);
|
|
83
|
+
}
|
|
84
|
+
|
|
77
85
|
function isStrictChildPath(parentPath: string, candidatePath: string): boolean {
|
|
78
86
|
const relative = path.relative(parentPath, candidatePath);
|
|
79
87
|
return relative !== "" && !relative.startsWith(".." + path.sep) && !path.isAbsolute(relative);
|
|
@@ -159,9 +167,11 @@ async function withResolvedHub(context: FrameworkContext): Promise<FrameworkCont
|
|
|
159
167
|
// 1. MATE_ARTIFACT_PATH env var (agent-launched sessions)
|
|
160
168
|
// 2. CompanionResolver — cwd inside a linked working repo
|
|
161
169
|
// 3. Local .mate/config/framework.yaml in cwd (cwd is the companion itself)
|
|
170
|
+
// `write: false` skips the resolver's self-heal and stale-pointer prune, for read-only callers.
|
|
162
171
|
export async function resolveFrameworkContext(
|
|
163
172
|
cwd: string,
|
|
164
173
|
globalConfigStore = new GlobalConfigStore(),
|
|
174
|
+
options: { write?: boolean } = {},
|
|
165
175
|
): Promise<FrameworkContext> {
|
|
166
176
|
const envCompanionPath = process.env.MATE_ARTIFACT_PATH;
|
|
167
177
|
if (envCompanionPath) {
|
|
@@ -171,7 +181,11 @@ export async function resolveFrameworkContext(
|
|
|
171
181
|
);
|
|
172
182
|
}
|
|
173
183
|
|
|
174
|
-
const
|
|
184
|
+
const write = options.write !== false;
|
|
185
|
+
const { match } = await new CompanionResolver(globalConfigStore).resolveWithDiagnostics(cwd, {
|
|
186
|
+
logFailures: write,
|
|
187
|
+
write,
|
|
188
|
+
});
|
|
175
189
|
if (match) {
|
|
176
190
|
return withResolvedHub(
|
|
177
191
|
makeContext(
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
// oxlint-disable no-underscore-dangle
|
|
2
2
|
import { FRAMEWORK_NAME } from "../../framework";
|
|
3
|
+
import { companionGit, GIT_QUERY_TIMEOUT_MS } from "../../runtime/companion-git";
|
|
4
|
+
import { companionFrameworkConfigPath, resolveSecretPolicy } from "../../runtime/policy";
|
|
5
|
+
import {
|
|
6
|
+
secretPolicyOfConfigText,
|
|
7
|
+
secretPolicyWeakenings,
|
|
8
|
+
} from "../../runtime/secret-policy-weakening";
|
|
3
9
|
import type { AdapterContext, LaunchAdapter } from "./adapters/base";
|
|
4
10
|
import { ClaudeAdapter } from "./adapters/claude";
|
|
5
11
|
import { OpenCodeAdapter } from "./adapters/opencode";
|
|
@@ -41,8 +47,34 @@ interface ResolvedLaunchState {
|
|
|
41
47
|
|
|
42
48
|
export const launcherDeps = {
|
|
43
49
|
prepareSession,
|
|
50
|
+
/** The companion's `HEAD` version of `framework.yaml`; null when Git cannot answer. Local only. */
|
|
51
|
+
readCommittedFrameworkConfig: async (companionPath: string): Promise<string | null> => {
|
|
52
|
+
const git = companionGit(companionPath, {
|
|
53
|
+
prompt: "never",
|
|
54
|
+
commandCapMs: GIT_QUERY_TIMEOUT_MS,
|
|
55
|
+
});
|
|
56
|
+
const shown = await git.run(["show", `HEAD:./.${FRAMEWORK_NAME}/config/framework.yaml`]);
|
|
57
|
+
return shown.status === 0 ? shown.stdout : null;
|
|
58
|
+
},
|
|
44
59
|
};
|
|
45
60
|
|
|
61
|
+
/**
|
|
62
|
+
* Warns, never blocks, when the working tree's secret policy is weaker than the
|
|
63
|
+
* committed one: a shell edit the guard does not see shows up at the next launch.
|
|
64
|
+
*/
|
|
65
|
+
async function warnOnLoosenedSecretPolicy(companionPath: string): Promise<void> {
|
|
66
|
+
const committedText = await launcherDeps
|
|
67
|
+
.readCommittedFrameworkConfig(companionPath)
|
|
68
|
+
.catch(() => null);
|
|
69
|
+
const committed = committedText === null ? null : secretPolicyOfConfigText(committedText);
|
|
70
|
+
if (!committed) return;
|
|
71
|
+
const weakenings = secretPolicyWeakenings(committed, resolveSecretPolicy(companionPath));
|
|
72
|
+
if (weakenings.length === 0) return;
|
|
73
|
+
console.error(
|
|
74
|
+
`${FRAMEWORK_NAME}: warning: ${companionFrameworkConfigPath(companionPath)} loosens the committed secret policy (${weakenings.join("; ")}); only the user should loosen it.`,
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
46
78
|
/** The wrap notice is informational: `process.stderr.write`, since Bun renders `console.error` red. */
|
|
47
79
|
function report(result: PrepareResult): void {
|
|
48
80
|
const wrapped = result.steps.find((step) => step.step === "working-target");
|
|
@@ -100,8 +132,9 @@ export class FrameworkLauncher {
|
|
|
100
132
|
config: state.config,
|
|
101
133
|
skipGit: state.skipGit,
|
|
102
134
|
});
|
|
103
|
-
report(prepared);
|
|
135
|
+
if (!request.quiet) report(prepared);
|
|
104
136
|
if (!prepared.ok) throw state.adapter.launchFailure(prepared);
|
|
137
|
+
await warnOnLoosenedSecretPolicy(state.companionPath);
|
|
105
138
|
const adapterContext = await state.adapter.planLaunch(this.makeAdapterContext(state), prepared);
|
|
106
139
|
await state.adapter.validateLaunch(adapterContext);
|
|
107
140
|
|
|
@@ -24,13 +24,13 @@ export function reconcileWorkingRepoClaudeCommandLinks(
|
|
|
24
24
|
companionPath: string | null,
|
|
25
25
|
enabled: boolean,
|
|
26
26
|
registeredCompanionPaths: string[] = [],
|
|
27
|
-
):
|
|
27
|
+
): ReturnType<typeof reconcileClaudeLinks> {
|
|
28
28
|
return reconcileClaudeLinks(COMMANDS, repoPath, companionPath, enabled, registeredCompanionPaths);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export function removeWorkingRepoClaudeCommandLinks(
|
|
32
32
|
repoPath: string,
|
|
33
33
|
registeredCompanionPaths: string[] = [],
|
|
34
|
-
):
|
|
34
|
+
): ReturnType<typeof removeClaudeLinks> {
|
|
35
35
|
return removeClaudeLinks(COMMANDS, repoPath, registeredCompanionPaths);
|
|
36
36
|
}
|
|
@@ -11,9 +11,17 @@ import {
|
|
|
11
11
|
type ClaudeSettings,
|
|
12
12
|
} from "../../tools/setup/providers/claude-format";
|
|
13
13
|
import { isMateGuardHookGroup } from "../../tools/setup/providers/claude-plugin-hooks";
|
|
14
|
+
import { repoDestination } from "../../runtime/repo-destination";
|
|
15
|
+
import { CLAUDE_SETTINGS_DOCUMENT } from "../../runtime/runtime-document-manifest";
|
|
14
16
|
import { readWrapState, type WrapState } from "../../runtime/wrap-state";
|
|
17
|
+
import { writeAtomic } from "../../runtime/write-atomic";
|
|
15
18
|
import { pruneEmptyAncestors } from "../../tools/setup/utils";
|
|
16
19
|
import { GlobalConfigStore } from "./global-config-store";
|
|
20
|
+
import {
|
|
21
|
+
removalWithWarnings,
|
|
22
|
+
type ProjectionRemovalReport,
|
|
23
|
+
type ProjectionWriteReport,
|
|
24
|
+
} from "./projection-types";
|
|
17
25
|
|
|
18
26
|
/**
|
|
19
27
|
* The working-repo half of the Claude Runtime Surface, as one Managed Projection
|
|
@@ -25,12 +33,19 @@ import { GlobalConfigStore } from "./global-config-store";
|
|
|
25
33
|
export const CLAUDE_WORKING_SETTINGS_PATH = path.join(".claude", "settings.local.json");
|
|
26
34
|
export const LEGACY_TOKENSAVE_CLAUDE_MD_PATH = "CLAUDE.md";
|
|
27
35
|
|
|
28
|
-
|
|
29
|
-
|
|
36
|
+
/** Inside the repository with no symlinked `.claude`, or the warning that refuses it. */
|
|
37
|
+
function settingsPath(repoPath: string): { path: string; root: string } | { warning: string } {
|
|
38
|
+
return repoDestination(repoPath, CLAUDE_SETTINGS_DOCUMENT);
|
|
30
39
|
}
|
|
31
40
|
|
|
32
|
-
|
|
33
|
-
|
|
41
|
+
/** A symlinked `CLAUDE.md` is another file's, the user's global one included: read as absent. */
|
|
42
|
+
async function readClaudeMd(repoPath: string): Promise<{ path: string; content: string } | null> {
|
|
43
|
+
const destination = repoDestination(repoPath, LEGACY_TOKENSAVE_CLAUDE_MD_PATH);
|
|
44
|
+
if ("warning" in destination) return null;
|
|
45
|
+
const stat = await fs.lstat(destination.path).catch(() => null);
|
|
46
|
+
if (!stat?.isFile()) return null;
|
|
47
|
+
const content = await readRaw(destination.path);
|
|
48
|
+
return content === null ? null : { path: destination.path, content };
|
|
34
49
|
}
|
|
35
50
|
|
|
36
51
|
async function readRaw(filePath: string): Promise<string | null> {
|
|
@@ -86,8 +101,10 @@ export async function syncWorkingRepoClaudeAdditionalDirectories(
|
|
|
86
101
|
repoPath: string,
|
|
87
102
|
companionPath: string,
|
|
88
103
|
globalConfigStore: GlobalConfigStore = new GlobalConfigStore(),
|
|
89
|
-
): Promise<"written" | "current"> {
|
|
90
|
-
const
|
|
104
|
+
): Promise<"written" | "current" | ProjectionWriteReport> {
|
|
105
|
+
const destination = settingsPath(repoPath);
|
|
106
|
+
if ("warning" in destination) return { state: "skipped", warnings: [destination.warning] };
|
|
107
|
+
const target = destination.path;
|
|
91
108
|
const raw = await readRaw(target);
|
|
92
109
|
const existing = withoutForeignManagedHookGroups(
|
|
93
110
|
parseSettings(raw),
|
|
@@ -125,7 +142,8 @@ export async function syncWorkingRepoClaudeAdditionalDirectories(
|
|
|
125
142
|
if (next === raw) return "current";
|
|
126
143
|
|
|
127
144
|
await fs.mkdir(path.dirname(target), { recursive: true });
|
|
128
|
-
|
|
145
|
+
/** A rename replaces a symlinked leaf instead of writing through it. */
|
|
146
|
+
await writeAtomic(target, next);
|
|
129
147
|
return "written";
|
|
130
148
|
}
|
|
131
149
|
|
|
@@ -137,8 +155,10 @@ export async function syncWorkingRepoClaudeAdditionalDirectories(
|
|
|
137
155
|
export async function removeWorkingRepoClaudeSettings(
|
|
138
156
|
repoPath: string,
|
|
139
157
|
registeredCompanionPaths: string[] = [],
|
|
140
|
-
): Promise<"removed" | "absent"> {
|
|
141
|
-
const
|
|
158
|
+
): Promise<"removed" | "absent" | ProjectionRemovalReport> {
|
|
159
|
+
const destination = settingsPath(repoPath);
|
|
160
|
+
if ("warning" in destination) return removalWithWarnings("absent", [destination.warning]);
|
|
161
|
+
const target = destination.path;
|
|
142
162
|
const raw = await readRaw(target);
|
|
143
163
|
if (raw === null) return "absent";
|
|
144
164
|
|
|
@@ -168,16 +188,18 @@ export async function removeWorkingRepoClaudeSettings(
|
|
|
168
188
|
if (JSON.stringify(settings) === JSON.stringify(existing)) return "absent";
|
|
169
189
|
if (Object.keys(settings).length === 0) {
|
|
170
190
|
await fs.unlink(target);
|
|
171
|
-
await pruneEmptyAncestors(path.dirname(target),
|
|
191
|
+
await pruneEmptyAncestors(path.dirname(target), destination.root);
|
|
172
192
|
return "removed";
|
|
173
193
|
}
|
|
174
|
-
await
|
|
194
|
+
await writeAtomic(target, serializeClaudeSettings(settings));
|
|
175
195
|
return "removed";
|
|
176
196
|
}
|
|
177
197
|
|
|
178
198
|
/** Present when Mate's own key is in the document, not merely when it exists. */
|
|
179
199
|
export async function workingRepoClaudeSettingsPresent(repoPath: string): Promise<boolean> {
|
|
180
|
-
const
|
|
200
|
+
const destination = settingsPath(repoPath);
|
|
201
|
+
if ("warning" in destination) return false;
|
|
202
|
+
const settings = parseSettings(await readRaw(destination.path));
|
|
181
203
|
return Array.isArray(settings.permissions?.additionalDirectories);
|
|
182
204
|
}
|
|
183
205
|
|
|
@@ -189,21 +211,20 @@ export async function workingRepoClaudeSettingsPresent(repoPath: string): Promis
|
|
|
189
211
|
export async function stripTokensaveClaudeMdAppend(
|
|
190
212
|
repoPath: string,
|
|
191
213
|
): Promise<"removed" | "absent"> {
|
|
192
|
-
const
|
|
193
|
-
|
|
194
|
-
if (content === null) return "absent";
|
|
214
|
+
const claudeMd = await readClaudeMd(repoPath);
|
|
215
|
+
if (claudeMd === null) return "absent";
|
|
195
216
|
|
|
196
|
-
const stripped = cutFromMarker(content, TOKENSAVE_CLAUDE_MD_MARKER);
|
|
197
|
-
if (stripped === content) return "absent";
|
|
217
|
+
const stripped = cutFromMarker(claudeMd.content, TOKENSAVE_CLAUDE_MD_MARKER);
|
|
218
|
+
if (stripped === claudeMd.content) return "absent";
|
|
198
219
|
if (stripped.length > 0) {
|
|
199
|
-
await
|
|
220
|
+
await writeAtomic(claudeMd.path, stripped);
|
|
200
221
|
} else {
|
|
201
|
-
await fs.unlink(
|
|
222
|
+
await fs.unlink(claudeMd.path);
|
|
202
223
|
}
|
|
203
224
|
return "removed";
|
|
204
225
|
}
|
|
205
226
|
|
|
206
227
|
export async function legacyTokensaveClaudeMdPresent(repoPath: string): Promise<boolean> {
|
|
207
|
-
const
|
|
208
|
-
return
|
|
228
|
+
const claudeMd = await readClaudeMd(repoPath);
|
|
229
|
+
return claudeMd !== null && claudeMd.content.includes(TOKENSAVE_CLAUDE_MD_MARKER);
|
|
209
230
|
}
|