@dsmm/dsmm 0.1.9 → 0.2.2
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/README.md +46 -58
- package/agent-presets/dsmm-builder/agent.cordis.yml +91 -186
- package/agent-presets/dsmm-builder/preset.yml +1 -1
- package/agent-presets/dsmm-clarifier/agent.cordis.yml +120 -17
- package/agent-presets/dsmm-clarifier/preset.yml +1 -1
- package/agent-presets/dsmm-code-search/agent.cordis.yml +72 -17
- package/agent-presets/dsmm-code-search/preset.yml +1 -1
- package/agent-presets/dsmm-coding/agent.cordis.yml +169 -0
- package/agent-presets/dsmm-coding/preset.yml +3 -0
- package/agent-presets/dsmm-complex/agent.cordis.yml +154 -0
- package/agent-presets/dsmm-complex/preset.yml +3 -0
- package/agent-presets/dsmm-creative/agent.cordis.yml +122 -15
- package/agent-presets/dsmm-creative/preset.yml +1 -1
- package/agent-presets/dsmm-cross-cutting/agent.cordis.yml +179 -0
- package/agent-presets/dsmm-cross-cutting/preset.yml +3 -0
- package/agent-presets/dsmm-deep/agent.cordis.yml +189 -0
- package/agent-presets/dsmm-deep/preset.yml +3 -0
- package/agent-presets/dsmm-doc-search/agent.cordis.yml +72 -17
- package/agent-presets/dsmm-doc-search/preset.yml +1 -1
- package/agent-presets/dsmm-documenting/agent.cordis.yml +168 -0
- package/agent-presets/dsmm-documenting/preset.yml +3 -0
- package/agent-presets/dsmm-frontend/agent.cordis.yml +161 -0
- package/agent-presets/dsmm-frontend/preset.yml +3 -0
- package/agent-presets/dsmm-hard-reasoning/agent.cordis.yml +153 -0
- package/agent-presets/dsmm-hard-reasoning/preset.yml +3 -0
- package/agent-presets/dsmm-media-reader/agent.cordis.yml +72 -17
- package/agent-presets/dsmm-media-reader/preset.yml +1 -1
- package/agent-presets/dsmm-normal-task/agent.cordis.yml +127 -0
- package/agent-presets/dsmm-normal-task/preset.yml +3 -0
- package/agent-presets/dsmm-oracle/agent.cordis.yml +109 -15
- package/agent-presets/dsmm-oracle/preset.yml +1 -1
- package/agent-presets/dsmm-oracle-2nd/agent.cordis.yml +109 -15
- package/agent-presets/dsmm-oracle-2nd/preset.yml +1 -1
- package/agent-presets/dsmm-orchestrator/agent.cordis.yml +174 -190
- package/agent-presets/dsmm-orchestrator/preset.yml +1 -1
- package/agent-presets/dsmm-plan-critic/agent.cordis.yml +102 -16
- package/agent-presets/dsmm-plan-critic/preset.yml +1 -1
- package/agent-presets/dsmm-planner/agent.cordis.yml +134 -15
- package/agent-presets/dsmm-planner/preset.yml +1 -1
- package/agent-presets/dsmm-quick/agent.cordis.yml +132 -0
- package/agent-presets/dsmm-quick/preset.yml +3 -0
- package/agent-presets/dsmm-research/agent.cordis.yml +156 -0
- package/agent-presets/dsmm-research/preset.yml +3 -0
- package/agent-presets/dsmm-reviewer/agent.cordis.yml +108 -16
- package/agent-presets/dsmm-reviewer/preset.yml +1 -1
- package/cordis.patch.yml +1 -5
- package/docs/agent-presets.md +48 -15
- package/docs/compatibility.md +58 -68
- package/docs/deferred-native-approval-risk.md +19 -0
- package/docs/design.md +43 -2
- package/docs/lsp.md +12 -12
- package/docs/migration-from-ocmm.md +10 -2
- package/docs/model-routing.md +84 -59
- package/docs/native-permissions.md +35 -0
- package/docs/profiles.md +43 -64
- package/docs/releasing.md +159 -8
- package/docs/roadmap.md +77 -17
- package/docs/runtime-recovery.md +12 -0
- package/docs/safety-guards.md +7 -3
- package/docs/settings-status.md +46 -40
- package/docs/skill-sync.md +89 -14
- package/lib/child-admission-contract.d.ts +37 -0
- package/lib/child-admission-contract.js +2 -0
- package/lib/child-admission.d.ts +42 -0
- package/lib/child-admission.js +162 -0
- package/lib/child-capture.d.ts +81 -0
- package/lib/child-capture.js +203 -0
- package/lib/child-evidence.d.ts +17 -0
- package/lib/child-evidence.js +43 -0
- package/lib/client/ChildrenPanel.d.ts +43 -0
- package/lib/client/ChildrenPanel.js +82 -0
- package/lib/client/DeploymentPage.d.ts +18 -0
- package/lib/client/DeploymentPage.js +127 -0
- package/lib/client/EditableChoice.d.ts +17 -0
- package/lib/client/EditableChoice.js +49 -0
- package/lib/client/PermissionsPanel.d.ts +14 -0
- package/lib/client/PermissionsPanel.js +46 -0
- package/lib/client/ProfilesSection.js +32 -15
- package/lib/client/RoleAvailability.d.ts +7 -0
- package/lib/client/RoleAvailability.js +19 -0
- package/lib/client/SessionProfiles.js +27 -9
- package/lib/client/StructuredEditor.js +15 -7
- package/lib/client/children-controller.d.ts +98 -0
- package/lib/client/children-controller.js +296 -0
- package/lib/client/children-locales.d.ts +367 -0
- package/lib/client/children-locales.js +69 -0
- package/lib/client/controller.d.ts +6 -1
- package/lib/client/controller.js +14 -8
- package/lib/client/deployment-controller.d.ts +50 -0
- package/lib/client/deployment-controller.js +193 -0
- package/lib/client/deployment-data.d.ts +17 -0
- package/lib/client/deployment-data.js +138 -0
- package/lib/client/deployment-locales.d.ts +70 -0
- package/lib/client/deployment-locales.js +81 -0
- package/lib/client/diagnostics.d.ts +14 -0
- package/lib/client/diagnostics.js +53 -0
- package/lib/client/index.d.ts +4 -0
- package/lib/client/index.js +145 -1
- package/lib/client/locales.d.ts +58 -0
- package/lib/client/locales.js +38 -18
- package/lib/client/permission-client.d.ts +16 -0
- package/lib/client/permission-client.js +38 -0
- package/lib/client/permission-controller.d.ts +62 -0
- package/lib/client/permission-controller.js +149 -0
- package/lib/client/permission-locales.d.ts +114 -0
- package/lib/client/permission-locales.js +75 -0
- package/lib/client/plugins-contract.d.ts +27 -0
- package/lib/client/plugins-contract.js +2 -0
- package/lib/client/session-labels.js +4 -4
- package/lib/client/structured.js +19 -5
- package/lib/client/styles.d.ts +1 -1
- package/lib/client/styles.js +36 -0
- package/lib/client.js +6724 -1604
- package/lib/commands.js +3 -0
- package/lib/config-file-store.d.ts +23 -0
- package/lib/config-file-store.js +67 -0
- package/lib/core-permission-authority.d.ts +18 -0
- package/lib/core-permission-authority.js +255 -0
- package/lib/core-permissions.d.ts +8 -0
- package/lib/core-permissions.js +33 -0
- package/lib/delivery-authority.d.ts +68 -0
- package/lib/delivery-authority.js +260 -0
- package/lib/deployment-config.d.ts +60 -0
- package/lib/deployment-config.js +205 -0
- package/lib/deployment-permission-rules.d.ts +55 -0
- package/lib/deployment-permission-rules.js +306 -0
- package/lib/dsh-home.d.ts +3 -0
- package/lib/dsh-home.js +10 -0
- package/lib/dsh-types.d.ts +22 -69
- package/lib/guards.d.ts +3 -2
- package/lib/guards.js +44 -6
- package/lib/host-llm-startup.d.ts +41 -0
- package/lib/host-llm-startup.js +65 -0
- package/lib/host-llm.d.ts +92 -0
- package/lib/host-llm.js +325 -0
- package/lib/index.d.ts +23 -5
- package/lib/index.js +383 -40
- package/lib/legacy-child-policy.d.ts +51 -0
- package/lib/legacy-child-policy.js +123 -0
- package/lib/legacy-read-composition.d.ts +20 -0
- package/lib/legacy-read-composition.js +144 -0
- package/lib/legacy-read-contracts.d.ts +157 -0
- package/lib/legacy-read-contracts.js +39 -0
- package/lib/legacy-read-host.d.ts +19 -0
- package/lib/legacy-read-host.js +67 -0
- package/lib/legacy-read-integration.d.ts +121 -0
- package/lib/legacy-read-integration.js +522 -0
- package/lib/legacy-read-proxy.d.ts +26 -0
- package/lib/legacy-read-proxy.js +237 -0
- package/lib/live-pi-ai-owner.d.ts +18 -0
- package/lib/live-pi-ai-owner.js +144 -0
- package/lib/llm-runtime.d.ts +11 -0
- package/lib/llm-runtime.js +21 -0
- package/lib/lsp.d.ts +13 -0
- package/lib/lsp.js +60 -0
- package/lib/managed-settings.d.ts +5 -0
- package/lib/managed-settings.js +14 -0
- package/lib/mode.js +42 -47
- package/lib/model-parameter-policy.d.ts +11 -0
- package/lib/model-parameter-policy.js +27 -0
- package/lib/model-routing.js +33 -19
- package/lib/modules.d.ts +35 -0
- package/lib/modules.js +37 -0
- package/lib/native-child-evidence.d.ts +42 -0
- package/lib/native-child-evidence.js +133 -0
- package/lib/native-pi-ai-wire.d.ts +37 -0
- package/lib/native-pi-ai-wire.js +261 -0
- package/lib/native-scope.d.ts +9 -0
- package/lib/native-scope.js +20 -0
- package/lib/permission-bash.d.ts +6 -0
- package/lib/permission-bash.js +7 -0
- package/lib/permission-control.d.ts +73 -0
- package/lib/permission-control.js +205 -0
- package/lib/permission-controller.d.ts +68 -0
- package/lib/permission-controller.js +317 -0
- package/lib/permission-errors.d.ts +7 -0
- package/lib/permission-errors.js +21 -0
- package/lib/permission-fs-search.d.ts +5 -0
- package/lib/permission-fs-search.js +7 -0
- package/lib/permission-fs.d.ts +5 -0
- package/lib/permission-fs.js +7 -0
- package/lib/permission-native-access.d.ts +11 -0
- package/lib/permission-native-access.js +6 -0
- package/lib/permission-native-command.d.ts +10 -0
- package/lib/permission-native-command.js +93 -0
- package/lib/permission-native-rules.d.ts +75 -0
- package/lib/permission-native-rules.js +278 -0
- package/lib/permission-pwsh.d.ts +6 -0
- package/lib/permission-pwsh.js +7 -0
- package/lib/permission-remote.d.ts +26 -0
- package/lib/permission-remote.js +53 -0
- package/lib/permission-rpc.d.ts +29 -0
- package/lib/permission-rpc.js +152 -0
- package/lib/permission-rules.d.ts +115 -0
- package/lib/permission-rules.js +256 -0
- package/lib/permission-settings.d.ts +45 -0
- package/lib/permission-settings.js +48 -0
- package/lib/permission-shell.d.ts +38 -0
- package/lib/permission-shell.js +150 -0
- package/lib/permission-web.d.ts +5 -0
- package/lib/permission-web.js +7 -0
- package/lib/plan-validation.js +6 -44
- package/lib/preset-materializer.js +2 -0
- package/lib/preset-registry.d.ts +1 -1
- package/lib/preset-registry.js +38 -24
- package/lib/preset-skills.d.ts +4 -1
- package/lib/preset-skills.js +60 -19
- package/lib/profile-diagnostics.d.ts +45 -0
- package/lib/profile-diagnostics.js +148 -0
- package/lib/profile-locale.d.ts +3 -0
- package/lib/profile-locale.js +2 -0
- package/lib/profile-remote.d.ts +22 -0
- package/lib/profile-remote.js +344 -27
- package/lib/profile-rpc.d.ts +25 -1
- package/lib/profile-rpc.js +143 -3
- package/lib/profile-runtime.d.ts +63 -0
- package/lib/profile-runtime.js +496 -77
- package/lib/profile-store.d.ts +56 -1
- package/lib/profile-store.js +377 -111
- package/lib/profile-types.d.ts +125 -1
- package/lib/profile-types.js +1 -0
- package/lib/profiles.d.ts +16 -2
- package/lib/profiles.js +156 -79
- package/lib/prompt-content.d.ts +25 -0
- package/lib/prompt-content.js +27 -0
- package/lib/prompts.d.ts +45 -4
- package/lib/prompts.js +157 -43
- package/lib/recovery-policy.js +20 -7
- package/lib/role-control-remote.d.ts +38 -0
- package/lib/role-control-remote.js +211 -0
- package/lib/role-control-rpc.d.ts +51 -0
- package/lib/role-control-rpc.js +377 -0
- package/lib/role-control-types.d.ts +92 -0
- package/lib/role-control-types.js +8 -0
- package/lib/role-invocation.d.ts +47 -0
- package/lib/role-invocation.js +135 -0
- package/lib/role-llm-runtime.d.ts +17 -0
- package/lib/role-llm-runtime.js +62 -0
- package/lib/role-llm.d.ts +31 -0
- package/lib/role-llm.js +66 -0
- package/lib/role-policy.d.ts +92 -0
- package/lib/role-policy.js +601 -0
- package/lib/role-providers.d.ts +7 -3
- package/lib/role-providers.js +74 -46
- package/lib/role-routing.d.ts +11 -2
- package/lib/role-routing.js +42 -25
- package/lib/role-runs.d.ts +135 -0
- package/lib/role-runs.js +304 -0
- package/lib/role-subagents.d.ts +63 -4
- package/lib/role-subagents.js +299 -47
- package/lib/roles.d.ts +20 -9
- package/lib/roles.js +87 -216
- package/lib/route-json.d.ts +19 -0
- package/lib/route-json.js +129 -0
- package/lib/routing-policy.d.ts +2 -0
- package/lib/routing-policy.js +12 -2
- package/lib/runtime-integration.d.ts +112 -0
- package/lib/runtime-integration.js +784 -0
- package/lib/runtime-recovery.js +34 -13
- package/lib/session-scope.js +2 -0
- package/lib/settings.d.ts +116 -14
- package/lib/settings.js +455 -149
- package/lib/skills.d.ts +24 -9
- package/lib/skills.js +114 -35
- package/lib/state.d.ts +10 -6
- package/lib/state.js +48 -49
- package/lib/status.d.ts +35 -1
- package/lib/status.js +58 -17
- package/lib/subagent-runtime.d.ts +45 -0
- package/lib/subagent-runtime.js +131 -0
- package/locale/en.json +2 -2
- package/locale/zh.json +2 -2
- package/package.json +112 -45
- package/patches/subagent-runtime.yml +15 -0
- package/prompts/deepseek-flash.md +1 -1
- package/prompts/deepseek-v4-pro.md +2 -2
- package/prompts/deepwork.md +153 -20
- package/prompts/source/agents/clarifier.md +47 -0
- package/prompts/source/agents/orchestrator.md +72 -0
- package/prompts/source/agents/plan-critic.md +29 -0
- package/prompts/source/agents/planner.md +21 -0
- package/prompts/source/agents/reviewer.md +23 -0
- package/prompts/source/catalog.json +548 -0
- package/prompts/source/category/coding.md +46 -0
- package/prompts/source/category/complex.md +29 -0
- package/prompts/source/category/creative.md +40 -0
- package/prompts/source/category/cross-cutting.md +54 -0
- package/prompts/source/category/deep.md +64 -0
- package/prompts/source/category/documenting.md +68 -0
- package/prompts/source/category/frontend.md +38 -0
- package/prompts/source/category/hard-reasoning.md +53 -0
- package/prompts/source/category/normal-task.md +27 -0
- package/prompts/source/category/quick.md +34 -0
- package/prompts/source/category/research.md +58 -0
- package/prompts/source/deepwork/claude-opus-5.md +28 -0
- package/prompts/source/deepwork/codex.md +9 -0
- package/prompts/source/deepwork/default.md +136 -0
- package/prompts/source/deepwork/gemini.md +191 -0
- package/prompts/source/deepwork/glm.md +263 -0
- package/prompts/source/deepwork/gpt.md +49 -0
- package/prompts/source/deepwork/kimi-k27.md +13 -0
- package/prompts/source/deepwork/planner.md +44 -0
- package/prompts/source/deepwork/swe-2.md +13 -0
- package/prompts/source/manifest.json +3233 -0
- package/prompts/source/shared/dsh-host-contract.md +8 -0
- package/prompts/source/shared/locale.md +8 -0
- package/prompts/source/shared/shell-safety.md +7 -0
- package/prompts/source/terminal/builder.md +13 -0
- package/prompts/source/terminal/clarifier.md +41 -0
- package/prompts/source/terminal/code-search.md +39 -0
- package/prompts/source/terminal/coding.md +41 -0
- package/prompts/source/terminal/complex.md +43 -0
- package/prompts/source/terminal/creative.md +41 -0
- package/prompts/source/terminal/cross-cutting.md +43 -0
- package/prompts/source/terminal/deep.md +43 -0
- package/prompts/source/terminal/doc-search.md +39 -0
- package/prompts/source/terminal/documenting.md +41 -0
- package/prompts/source/terminal/frontend.md +41 -0
- package/prompts/source/terminal/hard-reasoning.md +41 -0
- package/prompts/source/terminal/media-reader.md +39 -0
- package/prompts/source/terminal/normal-task.md +41 -0
- package/prompts/source/terminal/oracle-2nd.md +53 -0
- package/prompts/source/terminal/oracle.md +53 -0
- package/prompts/source/terminal/orchestrator.md +26 -0
- package/prompts/source/terminal/plan-critic.md +41 -0
- package/prompts/source/terminal/planner.md +42 -0
- package/prompts/source/terminal/quick.md +39 -0
- package/prompts/source/terminal/research.md +39 -0
- package/prompts/source/terminal/reviewer.md +53 -0
- package/scripts/cold-profile-composition.mjs +329 -0
- package/scripts/cold-profile-sources.mjs +238 -0
- package/scripts/migrate-cold-profile.mjs +315 -0
- package/skills/ast-grep/LICENSE +21 -0
- package/skills/ast-grep/README.md +138 -0
- package/skills/ast-grep/SKILL.md +287 -0
- package/skills/ast-grep/SOURCE +1 -0
- package/skills/ast-grep/install.ps1 +235 -0
- package/skills/ast-grep/install.sh +286 -0
- package/skills/ast-grep/references/cli.md +233 -0
- package/skills/ast-grep/references/install.md +168 -0
- package/skills/ast-grep/references/patterns.md +149 -0
- package/skills/ast-grep/references/pitfalls.md +305 -0
- package/skills/ast-grep/references/recipes.md +404 -0
- package/skills/ast-grep/references/sgconfig.md +250 -0
- package/skills/ast-grep/references/yaml-rules.md +511 -0
- package/skills/ast-grep/scripts/ast_grep_helper.py +760 -0
- package/skills/ast-grep/tests/smoke.ps1 +129 -0
- package/skills/ast-grep/tests/smoke.sh +212 -0
- package/skills/ast-grep/tests/test_resolver.py +154 -0
- package/skills/brainstorming/SKILL.md +123 -9
- package/skills/coding-agent-sessions/LICENSE-UPSTREAM.md +82 -0
- package/skills/coding-agent-sessions/NOTICE.md +24 -0
- package/skills/coding-agent-sessions/SKILL.md +147 -0
- package/skills/coding-agent-sessions/agents/openai.yaml +4 -0
- package/skills/coding-agent-sessions/pyrightconfig.json +5 -0
- package/skills/coding-agent-sessions/references/all-platforms.md +77 -0
- package/skills/coding-agent-sessions/references/claude.md +34 -0
- package/skills/coding-agent-sessions/references/codex.md +32 -0
- package/skills/coding-agent-sessions/references/opencode.md +45 -0
- package/skills/coding-agent-sessions/references/senpi.md +29 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/__init__.py +1 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/aside_scanner.py +140 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/claude.py +66 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/cli.py +283 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/codex.py +105 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/file_scanners.py +275 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/jsonio.py +55 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/kiro_scanner.py +91 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/opencode.py +289 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/pi_family.py +46 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/scanners.py +104 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/sqlite_optional_scanners.py +203 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/sqlite_scanners.py +177 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/timeparse.py +51 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/transcript.py +149 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/types.py +57 -0
- package/skills/coding-agent-sessions/scripts/find-agent-sessions.py +19 -0
- package/skills/coding-agent-sessions/scripts/tests/test_agent_sessions.py +322 -0
- package/skills/coding-agent-sessions/scripts/tests/test_aside_scanner.py +131 -0
- package/skills/coding-agent-sessions/scripts/tests/test_cli_contract.py +126 -0
- package/skills/coding-agent-sessions/scripts/tests/test_extended_scanners.py +262 -0
- package/skills/coding-agent-sessions/scripts/tests/test_optional_sqlite_scanners.py +79 -0
- package/skills/coding-agent-sessions/scripts/tests/test_pi_family_scanners.py +130 -0
- package/skills/debugging/SKILL.md +130 -4
- package/skills/debugging/references/logging.md +2 -0
- package/skills/debugging/references/methodology/00-setup.md +16 -62
- package/skills/debugging/references/methodology/02-investigate.md +11 -5
- package/skills/debugging/references/methodology/03-flaky-triage.md +6 -4
- package/skills/debugging/references/methodology/04-hard-reasoning-escalation.md +6 -16
- package/skills/debugging/references/methodology/05-escalate.md +2 -0
- package/skills/debugging/references/methodology/06-fix.md +8 -6
- package/skills/debugging/references/methodology/08-qa.md +7 -5
- package/skills/debugging/references/methodology/09-cleanup.md +16 -152
- package/skills/debugging/references/methodology/partial-runtime-evidence.md +7 -18
- package/skills/debugging/references/runtimes/bundled-js-binary.md +3 -16
- package/skills/debugging/references/runtimes/go.md +2 -0
- package/skills/debugging/references/runtimes/native-binary.md +11 -54
- package/skills/debugging/references/runtimes/node.md +6 -15
- package/skills/debugging/references/runtimes/python.md +5 -15
- package/skills/debugging/references/runtimes/rust.md +4 -18
- package/skills/debugging/references/scripts/dap.test.mjs +539 -0
- package/skills/debugging/references/scripts/fixture-adapter.mjs +164 -0
- package/skills/debugging/references/tools/dap.md +4 -2
- package/skills/debugging/references/tools/ghidra.md +6 -15
- package/skills/debugging/references/tools/playwright-cli.md +5 -15
- package/skills/debugging/references/tools/pwndbg.md +2 -0
- package/skills/debugging/references/tools/pwntools.md +6 -16
- package/skills/dispatching-parallel-agents/SKILL.md +96 -7
- package/skills/frontend/.frontend-materialized.json +856 -0
- package/skills/frontend/ATTRIBUTION.md +37 -0
- package/skills/frontend/LICENSE-Apache-2.0.txt +201 -0
- package/skills/frontend/LICENSE-taste-skill.txt +21 -0
- package/skills/frontend/LICENSE-ui-ux-pro-max.txt +21 -0
- package/skills/frontend/SKILL.md +145 -0
- package/skills/frontend/references/design/README.md +256 -0
- package/skills/frontend/references/design/_INDEX.md +206 -0
- package/skills/frontend/references/design/airbnb.md +393 -0
- package/skills/frontend/references/design/airtable.md +92 -0
- package/skills/frontend/references/design/apple.md +250 -0
- package/skills/frontend/references/design/aside.md +211 -0
- package/skills/frontend/references/design/binance.md +348 -0
- package/skills/frontend/references/design/bmw.md +183 -0
- package/skills/frontend/references/design/brutalist-skill.md +92 -0
- package/skills/frontend/references/design/bugatti.md +271 -0
- package/skills/frontend/references/design/cal.md +262 -0
- package/skills/frontend/references/design/claude.md +315 -0
- package/skills/frontend/references/design/clay.md +307 -0
- package/skills/frontend/references/design/clickhouse.md +284 -0
- package/skills/frontend/references/design/clone-from-url.md +69 -0
- package/skills/frontend/references/design/cohere.md +269 -0
- package/skills/frontend/references/design/coinbase.md +132 -0
- package/skills/frontend/references/design/composio.md +310 -0
- package/skills/frontend/references/design/cursor.md +312 -0
- package/skills/frontend/references/design/design-system-architecture.md +250 -0
- package/skills/frontend/references/design/elevenlabs.md +268 -0
- package/skills/frontend/references/design/expo.md +284 -0
- package/skills/frontend/references/design/ferrari.md +317 -0
- package/skills/frontend/references/design/figma.md +223 -0
- package/skills/frontend/references/design/framer.md +249 -0
- package/skills/frontend/references/design/gpt-tasteskill.md +74 -0
- package/skills/frontend/references/design/hashicorp.md +281 -0
- package/skills/frontend/references/design/ibm.md +335 -0
- package/skills/frontend/references/design/image-to-code-skill.md +1228 -0
- package/skills/frontend/references/design/imagegen-brandkit.md +798 -0
- package/skills/frontend/references/design/imagegen-frontend-mobile.md +1465 -0
- package/skills/frontend/references/design/imagegen-frontend-web.md +987 -0
- package/skills/frontend/references/design/interaction-skill.md +52 -0
- package/skills/frontend/references/design/intercom.md +149 -0
- package/skills/frontend/references/design/kraken.md +128 -0
- package/skills/frontend/references/design/lamborghini.md +291 -0
- package/skills/frontend/references/design/linear.app.md +370 -0
- package/skills/frontend/references/design/lovable.md +301 -0
- package/skills/frontend/references/design/mastercard.md +368 -0
- package/skills/frontend/references/design/meta.md +369 -0
- package/skills/frontend/references/design/minimalist-skill.md +85 -0
- package/skills/frontend/references/design/minimax.md +260 -0
- package/skills/frontend/references/design/mintlify.md +329 -0
- package/skills/frontend/references/design/miro.md +111 -0
- package/skills/frontend/references/design/mistral.ai.md +264 -0
- package/skills/frontend/references/design/mongodb.md +269 -0
- package/skills/frontend/references/design/nike.md +366 -0
- package/skills/frontend/references/design/notion.md +312 -0
- package/skills/frontend/references/design/nvidia.md +296 -0
- package/skills/frontend/references/design/ollama.md +270 -0
- package/skills/frontend/references/design/opencode.ai.md +284 -0
- package/skills/frontend/references/design/output-skill.md +49 -0
- package/skills/frontend/references/design/pinterest.md +233 -0
- package/skills/frontend/references/design/playstation.md +367 -0
- package/skills/frontend/references/design/posthog.md +259 -0
- package/skills/frontend/references/design/raycast.md +271 -0
- package/skills/frontend/references/design/react-dev-tooling-skill.md +232 -0
- package/skills/frontend/references/design/redesign-skill.md +178 -0
- package/skills/frontend/references/design/renault.md +314 -0
- package/skills/frontend/references/design/replicate.md +264 -0
- package/skills/frontend/references/design/resend.md +306 -0
- package/skills/frontend/references/design/revolut.md +188 -0
- package/skills/frontend/references/design/runwayml.md +247 -0
- package/skills/frontend/references/design/sanity.md +360 -0
- package/skills/frontend/references/design/sentry.md +265 -0
- package/skills/frontend/references/design/shopify.md +353 -0
- package/skills/frontend/references/design/soft-skill.md +98 -0
- package/skills/frontend/references/design/spacex.md +197 -0
- package/skills/frontend/references/design/spotify.md +249 -0
- package/skills/frontend/references/design/starbucks.md +583 -0
- package/skills/frontend/references/design/stitch-design-example.md +121 -0
- package/skills/frontend/references/design/stitch-skill.md +184 -0
- package/skills/frontend/references/design/stripe.md +325 -0
- package/skills/frontend/references/design/supabase.md +258 -0
- package/skills/frontend/references/design/superhuman.md +255 -0
- package/skills/frontend/references/design/taste-skill.md +1206 -0
- package/skills/frontend/references/design/tesla.md +289 -0
- package/skills/frontend/references/design/theverge.md +342 -0
- package/skills/frontend/references/design/together.ai.md +266 -0
- package/skills/frontend/references/design/uber.md +298 -0
- package/skills/frontend/references/design/vercel.md +313 -0
- package/skills/frontend/references/design/vodafone.md +426 -0
- package/skills/frontend/references/design/voltagent.md +326 -0
- package/skills/frontend/references/design/warp.md +256 -0
- package/skills/frontend/references/design/webflow.md +95 -0
- package/skills/frontend/references/design/wired.md +281 -0
- package/skills/frontend/references/design/wise.md +176 -0
- package/skills/frontend/references/design/x.ai.md +260 -0
- package/skills/frontend/references/design/zapier.md +331 -0
- package/skills/frontend/references/perfection/README.md +264 -0
- package/skills/frontend/references/perfection/react-perf-tooling.md +234 -0
- package/skills/frontend/references/ui-ux-db/README.md +659 -0
- package/skills/frontend/references/ui-ux-db/data/app-interface.csv +31 -0
- package/skills/frontend/references/ui-ux-db/data/charts.csv +26 -0
- package/skills/frontend/references/ui-ux-db/data/colors.csv +162 -0
- package/skills/frontend/references/ui-ux-db/data/google-fonts.csv +1924 -0
- package/skills/frontend/references/ui-ux-db/data/icons.csv +106 -0
- package/skills/frontend/references/ui-ux-db/data/landing.csv +35 -0
- package/skills/frontend/references/ui-ux-db/data/products.csv +162 -0
- package/skills/frontend/references/ui-ux-db/data/react-performance.csv +45 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/angular.csv +51 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/astro.csv +54 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/flutter.csv +53 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/html-tailwind.csv +56 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/jetpack-compose.csv +53 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/laravel.csv +51 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/nextjs.csv +53 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/nuxt-ui.csv +51 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/nuxtjs.csv +59 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/react-native.csv +52 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/react.csv +54 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/shadcn.csv +61 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/svelte.csv +54 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/swiftui.csv +51 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/threejs.csv +54 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/vue.csv +50 -0
- package/skills/frontend/references/ui-ux-db/data/styles.csv +85 -0
- package/skills/frontend/references/ui-ux-db/data/typography.csv +74 -0
- package/skills/frontend/references/ui-ux-db/data/ui-reasoning.csv +162 -0
- package/skills/frontend/references/ui-ux-db/data/ux-guidelines.csv +100 -0
- package/skills/frontend/references/ui-ux-db/data/web-interface.csv +31 -0
- package/skills/frontend/references/ui-ux-db/scripts/core.py +262 -0
- package/skills/frontend/references/ui-ux-db/scripts/design_system.py +1148 -0
- package/skills/frontend/references/ui-ux-db/scripts/search.py +114 -0
- package/skills/frontend/scripts/perfection/lighthouse-audit.py +201 -0
- package/skills/git-master/SKILL.md +115 -0
- package/skills/git-master/agents/openai.yaml +13 -0
- package/skills/init-deep/SKILL.md +282 -0
- package/skills/receiving-code-review/SKILL.md +117 -7
- package/skills/remove-ai-slops/SKILL.md +160 -8
- package/skills/requesting-code-review/SKILL.md +98 -3
- package/skills/requesting-code-review/code-reviewer.md +59 -0
- package/skills/subagent-driven-development/SKILL.md +179 -6
- package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +23 -0
- package/skills/subagent-driven-development/implementer-prompt.md +87 -0
- package/skills/subagent-driven-development/spec-reviewer-prompt.md +37 -0
- package/skills/using-git-worktrees/SKILL.md +144 -0
- package/skills/writing-plans/SKILL.md +126 -7
- package/skills/writing-plans/plan-document-reviewer-prompt.md +47 -0
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { lstatSync, readFileSync } from "node:fs";
|
|
3
|
+
import { mkdir, open } from "node:fs/promises";
|
|
4
|
+
import { basename, dirname, isAbsolute, join, parse, resolve } from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { BASE_BUNDLE, MODULE_REPLACEMENTS, inspectColdComposition } from "./cold-profile-composition.mjs";
|
|
7
|
+
import {
|
|
8
|
+
ColdProfileMigrationError, bundleToken, digest, jsonDocument, loadColdProfileSdk,
|
|
9
|
+
plainPath, refuse, replaceBundleToken,
|
|
10
|
+
} from "./cold-profile-sources.mjs";
|
|
11
|
+
|
|
12
|
+
export { ColdProfileMigrationError, loadColdProfileSdk };
|
|
13
|
+
const RECEIPT = ".dsmm-cold-profile.json";
|
|
14
|
+
const PROJECTION_PREFIX = "@dsmm/cold-base-";
|
|
15
|
+
const ownName = name => typeof name === "string" && /^@dsmm\/cold-base-[0-9a-f-]{36}$/.test(name);
|
|
16
|
+
|
|
17
|
+
function normalizeOptions(input) {
|
|
18
|
+
if (!input || !["dsh-tui", "desktop"].includes(input.target)) refuse("EXPLICIT_TARGET_REQUIRED");
|
|
19
|
+
for (const key of ["profileDir", "installAnchor", "home"]) {
|
|
20
|
+
if (typeof input[key] !== "string" || !isAbsolute(input[key])) refuse("EXPLICIT_ABSOLUTE_SCOPE_REQUIRED");
|
|
21
|
+
}
|
|
22
|
+
const profileDir = plainPath(resolve(input.profileDir));
|
|
23
|
+
const home = plainPath(resolve(input.home));
|
|
24
|
+
if (profileDir === parse(profileDir).root || home === parse(home).root || profileDir === home) refuse("INVALID_DIRECTORY_SCOPE");
|
|
25
|
+
if (!lstatSync(profileDir).isDirectory() || !lstatSync(home).isDirectory()) refuse("INVALID_DIRECTORY_SCOPE");
|
|
26
|
+
const overlays = input.overlays ?? [];
|
|
27
|
+
const sourceRoots = input.sourceRoots ?? [profileDir, home];
|
|
28
|
+
if (!Array.isArray(overlays) || !Array.isArray(sourceRoots) || ![...overlays, ...sourceRoots].every(value => typeof value === "string" && isAbsolute(value))) refuse("EXPLICIT_ABSOLUTE_SCOPE_REQUIRED");
|
|
29
|
+
if (input.rootConfig !== undefined && (typeof input.rootConfig !== "string" || !isAbsolute(input.rootConfig))) refuse("EXPLICIT_ABSOLUTE_SCOPE_REQUIRED");
|
|
30
|
+
if (input.migrateShell !== undefined && typeof input.migrateShell !== "boolean") refuse("INVALID_SHELL_OPTION");
|
|
31
|
+
if (input.migrateSubagent !== undefined && typeof input.migrateSubagent !== "boolean") refuse("INVALID_SUBAGENT_OPTION");
|
|
32
|
+
if (input.migrateSessionPersistence !== undefined && typeof input.migrateSessionPersistence !== "boolean") refuse("INVALID_SESSION_PERSISTENCE_OPTION");
|
|
33
|
+
return {
|
|
34
|
+
target: input.target, profileDir, home, installAnchor: resolve(input.installAnchor),
|
|
35
|
+
overlays: overlays.map(filename => plainPath(resolve(filename))),
|
|
36
|
+
sourceRoots: [...new Set(sourceRoots.map(filename => plainPath(resolve(filename))))],
|
|
37
|
+
migrateShell: input.migrateShell ?? true,
|
|
38
|
+
migrateSubagent: input.migrateSubagent ?? false,
|
|
39
|
+
migrateSessionPersistence: input.migrateSessionPersistence ?? false,
|
|
40
|
+
...(input.rootConfig ? { rootConfig: plainPath(resolve(input.rootConfig)) } : {}),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function projectionDir(options, name) {
|
|
45
|
+
if (!ownName(name)) refuse("INVALID_PROJECTION_IDENTITY");
|
|
46
|
+
return plainPath(join(options.profileDir, "node_modules", "@dsmm", basename(name)), { missing: true });
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function activeReceipt(options) {
|
|
50
|
+
const text = readFileSync(join(options.profileDir, "package.json"), "utf8");
|
|
51
|
+
const bundles = jsonDocument(text).value.dsh?.profile?.bundles;
|
|
52
|
+
if (!Array.isArray(bundles)) refuse("INVALID_BUNDLES");
|
|
53
|
+
const owned = bundles.filter(name => typeof name === "string" && name.startsWith(PROJECTION_PREFIX));
|
|
54
|
+
if (owned.length === 0) return undefined;
|
|
55
|
+
if (owned.length !== 1 || bundles.includes(BASE_BUNDLE)) refuse("AMBIGUOUS_PROJECTION");
|
|
56
|
+
return readReceipt(options, owned[0]);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function readReceipt(options, name) {
|
|
60
|
+
const dir = projectionDir(options, name);
|
|
61
|
+
const receiptPath = plainPath(join(dir, RECEIPT));
|
|
62
|
+
const receipt = jsonDocument(readFileSync(receiptPath, "utf8")).value;
|
|
63
|
+
if (receipt.version !== 1 || receipt.projectionName !== name || receipt.profileDir !== options.profileDir ||
|
|
64
|
+
receipt.target !== options.target || receipt.home !== options.home || receipt.installAnchor !== options.installAnchor ||
|
|
65
|
+
receipt.migrateShell !== options.migrateShell || receipt.migrateSubagent !== options.migrateSubagent || !Number.isSafeInteger(receipt.slot) || receipt.slot < 0 ||
|
|
66
|
+
receipt.migrateSessionPersistence !== options.migrateSessionPersistence ||
|
|
67
|
+
!Array.isArray(receipt.changes) || !Array.isArray(receipt.outputs) ||
|
|
68
|
+
receipt.outputs.length !== 2 || receipt.outputs[0].name !== "package.json" || receipt.outputs[1].name !== "cordis.patch.yml" ||
|
|
69
|
+
receipt.originalLiteral === undefined || JSON.parse(receipt.originalLiteral) !== BASE_BUNDLE ||
|
|
70
|
+
![receipt.sourceRevision, receipt.beforeHash, receipt.afterHash, ...receipt.outputs.map(output => output.hash)].every(hash => typeof hash === "string" && /^[a-f0-9]{64}$/.test(hash))) refuse("INVALID_RECEIPT");
|
|
71
|
+
if (receipt.changes.length < 2 || receipt.changes.length > Object.keys(MODULE_REPLACEMENTS).length ||
|
|
72
|
+
new Set(receipt.changes.map(change => change.id)).size !== receipt.changes.length ||
|
|
73
|
+
!receipt.changes.some(change => change.id === "llm" && change.original === "@deepseek-ai/dsh-llm") ||
|
|
74
|
+
!receipt.changes.some(change => change.id === "settings" && change.original === "@deepseek-ai/dsh-settings") ||
|
|
75
|
+
receipt.changes.some(change => change.original === "@deepseek-ai/dsh-subagent") !== options.migrateSubagent ||
|
|
76
|
+
receipt.changes.some(change => change.original === "@deepseek-ai/dsh-subagent" && change.id !== "subagent") ||
|
|
77
|
+
receipt.changes.some(change => change.original === "@deepseek-ai/dsh-session-persistence-jsonl") !== options.migrateSessionPersistence ||
|
|
78
|
+
receipt.changes.some(change => change.original === "@deepseek-ai/dsh-session-persistence-jsonl" && change.id !== "session-persistence-jsonl") ||
|
|
79
|
+
!receipt.changes.every(change => typeof change.id === "string" && Object.hasOwn(MODULE_REPLACEMENTS, change.original) && change.replacement === MODULE_REPLACEMENTS[change.original])) refuse("INVALID_RECEIPT");
|
|
80
|
+
for (const output of receipt.outputs) {
|
|
81
|
+
const filename = plainPath(join(dir, output.name));
|
|
82
|
+
if (digest(readFileSync(filename)) !== output.hash) refuse("OWNED_OUTPUT_CONFLICT");
|
|
83
|
+
}
|
|
84
|
+
return receipt;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function summary(inspection, receipt) {
|
|
88
|
+
return {
|
|
89
|
+
status: receipt ? "already-applied" : "planned", revision: inspection.revision,
|
|
90
|
+
target: receipt?.target, slot: inspection.slot,
|
|
91
|
+
changes: inspection.changes, nativeToolSelection: inspection.nativeToolSelection,
|
|
92
|
+
...(receipt ? { projectionName: receipt.projectionName } : {}),
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** Read-only. Returned revision binds all effective composition sources and explicit launch inputs. */
|
|
97
|
+
async function planMigration(input) {
|
|
98
|
+
const options = normalizeOptions(input);
|
|
99
|
+
const sdk = await loadColdProfileSdk(options.installAnchor);
|
|
100
|
+
const receipt = activeReceipt(options);
|
|
101
|
+
const inspection = await inspectColdComposition(options, sdk, { receipt });
|
|
102
|
+
return { ...summary(inspection, receipt), target: options.target };
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
async function safeOperation(operation) {
|
|
106
|
+
try { return await operation(); } catch (error) {
|
|
107
|
+
if (error instanceof ColdProfileMigrationError) throw error;
|
|
108
|
+
throw new ColdProfileMigrationError("SOURCE_OR_IO_FAILURE");
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export const planColdProfileMigration = input => safeOperation(() => planMigration(input));
|
|
113
|
+
|
|
114
|
+
async function exclusiveFile(filename, text) {
|
|
115
|
+
const file = await open(filename, "wx", 0o600);
|
|
116
|
+
try {
|
|
117
|
+
await file.writeFile(text);
|
|
118
|
+
await file.sync();
|
|
119
|
+
} finally {
|
|
120
|
+
await file.close();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function requireRevision(inspection, expectedRevision) {
|
|
125
|
+
if (typeof expectedRevision !== "string" || !/^[a-f0-9]{64}$/.test(expectedRevision)) refuse("EXPECTED_REVISION_REQUIRED");
|
|
126
|
+
if (inspection.revision !== expectedRevision) refuse("SOURCE_CONFLICT");
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
async function prepareProjection(options, sdk, inspection) {
|
|
130
|
+
const projectionName = `${PROJECTION_PREFIX}${randomUUID()}`;
|
|
131
|
+
const dir = projectionDir(options, projectionName);
|
|
132
|
+
const patch = sdk.yaml.dump(inspection.projected, { schema: sdk.include.entryListSchema, noRefs: true, lineWidth: -1 });
|
|
133
|
+
const packageText = JSON.stringify({
|
|
134
|
+
name: projectionName, version: "1.0.0", private: true,
|
|
135
|
+
dsh: { bundle: { patch: "./cordis.patch.yml" } },
|
|
136
|
+
}, null, 2) + "\n";
|
|
137
|
+
const newText = replaceBundleToken(inspection.manifestText, inspection.slot, projectionName);
|
|
138
|
+
const transaction = {
|
|
139
|
+
version: 1, projectionName, profileDir: options.profileDir, target: options.target,
|
|
140
|
+
home: options.home, installAnchor: options.installAnchor, migrateShell: options.migrateShell, migrateSubagent: options.migrateSubagent,
|
|
141
|
+
migrateSessionPersistence: options.migrateSessionPersistence,
|
|
142
|
+
slot: inspection.slot, originalLiteral: bundleToken(inspection.manifestText, inspection.slot).literal,
|
|
143
|
+
sourceRevision: inspection.revision,
|
|
144
|
+
beforeHash: digest(inspection.manifestText), afterHash: digest(newText), changes: inspection.changes,
|
|
145
|
+
outputs: [{ name: "package.json", hash: digest(packageText) }, { name: "cordis.patch.yml", hash: digest(patch) }],
|
|
146
|
+
};
|
|
147
|
+
await mkdir(dirname(dir), { recursive: true });
|
|
148
|
+
plainPath(dirname(dir));
|
|
149
|
+
await mkdir(dir);
|
|
150
|
+
try {
|
|
151
|
+
await exclusiveFile(join(dir, "package.json"), packageText);
|
|
152
|
+
await exclusiveFile(join(dir, "cordis.patch.yml"), patch);
|
|
153
|
+
await exclusiveFile(join(dir, RECEIPT), JSON.stringify(transaction, null, 2) + "\n");
|
|
154
|
+
readReceipt(options, projectionName);
|
|
155
|
+
const serialized = sdk.boot.loadOverlayPatches("dsmm-cold-profile", join(dir, "cordis.patch.yml"));
|
|
156
|
+
if (JSON.stringify(serialized) !== JSON.stringify(inspection.projected)) refuse("PROJECTION_ROUNDTRIP_FAILED");
|
|
157
|
+
inspection.readset.assertCurrent();
|
|
158
|
+
return transaction;
|
|
159
|
+
} catch (error) {
|
|
160
|
+
const safe = error instanceof ColdProfileMigrationError ? error : new ColdProfileMigrationError("PREPARATION_FAILED");
|
|
161
|
+
safe.projectionName = projectionName;
|
|
162
|
+
throw safe;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
async function prepareMigration(input) {
|
|
167
|
+
const options = normalizeOptions(input);
|
|
168
|
+
const sdk = await loadColdProfileSdk(options.installAnchor);
|
|
169
|
+
const manifestPath = join(options.profileDir, "package.json");
|
|
170
|
+
plainPath(`${manifestPath}.lock`, { missing: true });
|
|
171
|
+
return sdk.atomic.withFileLock(manifestPath, async () => {
|
|
172
|
+
const active = activeReceipt(options);
|
|
173
|
+
const inspection = await inspectColdComposition(options, sdk, { receipt: active });
|
|
174
|
+
requireRevision(inspection, input.expectedRevision);
|
|
175
|
+
if (active) return { ...summary(inspection, active), target: options.target };
|
|
176
|
+
const receipt = await prepareProjection(options, sdk, inspection);
|
|
177
|
+
return { status: "prepared", projectionName: receipt.projectionName, revision: inspection.revision, nativeToolSelection: inspection.nativeToolSelection };
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/** Prepare immutable, unreferenced outputs; interruption cannot affect the current boot composition. */
|
|
182
|
+
export const prepareColdProfileMigration = input => safeOperation(() => prepareMigration(input));
|
|
183
|
+
|
|
184
|
+
async function applyMigration(input) {
|
|
185
|
+
const options = normalizeOptions(input);
|
|
186
|
+
if (input.sourceWriteExclusion !== true) refuse("COLD_SOURCE_WRITE_EXCLUSION_REQUIRED");
|
|
187
|
+
const sdk = await loadColdProfileSdk(options.installAnchor);
|
|
188
|
+
const manifestPath = join(options.profileDir, "package.json");
|
|
189
|
+
plainPath(`${manifestPath}.lock`, { missing: true });
|
|
190
|
+
return sdk.atomic.withFileLock(manifestPath, async () => {
|
|
191
|
+
const receipt = activeReceipt(options);
|
|
192
|
+
const inspection = await inspectColdComposition(options, sdk, { receipt });
|
|
193
|
+
requireRevision(inspection, input.expectedRevision);
|
|
194
|
+
if (receipt) return { ...summary(inspection, receipt), target: options.target };
|
|
195
|
+
const transaction = input.projectionName ? readReceipt(options, input.projectionName) : await prepareProjection(options, sdk, inspection);
|
|
196
|
+
if (transaction.sourceRevision !== inspection.revision || transaction.beforeHash !== digest(inspection.manifestText)) refuse("SOURCE_CONFLICT");
|
|
197
|
+
const projectionName = transaction.projectionName;
|
|
198
|
+
const newText = replaceBundleToken(inspection.manifestText, inspection.slot, projectionName);
|
|
199
|
+
if (digest(newText) !== transaction.afterHash) refuse("INVALID_RECEIPT");
|
|
200
|
+
const current = await inspectColdComposition(options, sdk);
|
|
201
|
+
requireRevision(current, input.expectedRevision);
|
|
202
|
+
inspection.readset.assertCurrent();
|
|
203
|
+
readReceipt(options, projectionName);
|
|
204
|
+
if (resolve(sdk.boot.resolveBundleDir("dsmm-cold-profile", projectionName, options.installAnchor, options.profileDir)) !== projectionDir(options, projectionName)) refuse("PROJECTION_RESOLUTION_CONFLICT");
|
|
205
|
+
plainPath(manifestPath);
|
|
206
|
+
await sdk.atomic.writeFileAtomic(manifestPath, newText, { mode: lstatSync(manifestPath).mode & 0o777 });
|
|
207
|
+
return { status: "applied", target: options.target, projectionName, previousRevision: inspection.revision, nativeToolSelection: inspection.nativeToolSelection };
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Requires cold-source write exclusion. Manual editors and non-locking SDK HMR
|
|
213
|
+
* writers must be quiescent across final CAS/rename; the SDK manifest lock
|
|
214
|
+
* coordinates cooperating installers. Conditional rename against arbitrary
|
|
215
|
+
* editors is not a filesystem capability.
|
|
216
|
+
*/
|
|
217
|
+
export const applyColdProfileMigration = input => safeOperation(() => applyMigration(input));
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Inspect an exact transaction's recoverability. No directory scan and no profile backup.
|
|
221
|
+
* A prepared, unreferenced package is safe to leave in place and can be retired explicitly.
|
|
222
|
+
*/
|
|
223
|
+
async function planRecovery(input) {
|
|
224
|
+
const options = normalizeOptions(input);
|
|
225
|
+
const sdk = await loadColdProfileSdk(options.installAnchor);
|
|
226
|
+
const receipt = readReceipt(options, input.projectionName);
|
|
227
|
+
const text = readFileSync(plainPath(join(options.profileDir, "package.json")), "utf8");
|
|
228
|
+
const hash = digest(text);
|
|
229
|
+
if (hash !== receipt.beforeHash && hash !== receipt.afterHash) refuse("RECOVERY_CONFLICT");
|
|
230
|
+
const applied = hash === receipt.afterHash;
|
|
231
|
+
if (applied && JSON.parse(bundleToken(text, receipt.slot).literal) !== receipt.projectionName) refuse("RECOVERY_CONFLICT");
|
|
232
|
+
const inspection = await inspectColdComposition(options, sdk, { receipt: applied ? receipt : undefined });
|
|
233
|
+
return { status: applied ? "rollback-planned" : "unreferenced", revision: inspection.revision, projectionName: receipt.projectionName };
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export const planColdProfileRecovery = input => safeOperation(() => planRecovery(input));
|
|
237
|
+
|
|
238
|
+
/** Restore only the original reference token, and only against the current expected source revision. */
|
|
239
|
+
async function recoverMigration(input) {
|
|
240
|
+
const options = normalizeOptions(input);
|
|
241
|
+
if (input.sourceWriteExclusion !== true) refuse("COLD_SOURCE_WRITE_EXCLUSION_REQUIRED");
|
|
242
|
+
const sdk = await loadColdProfileSdk(options.installAnchor);
|
|
243
|
+
const manifestPath = join(options.profileDir, "package.json");
|
|
244
|
+
plainPath(`${manifestPath}.lock`, { missing: true });
|
|
245
|
+
return sdk.atomic.withFileLock(manifestPath, async () => {
|
|
246
|
+
const recovery = await planColdProfileRecovery(input);
|
|
247
|
+
if (recovery.revision !== input.expectedRevision) refuse("SOURCE_CONFLICT");
|
|
248
|
+
const receipt = readReceipt(options, input.projectionName);
|
|
249
|
+
const text = readFileSync(manifestPath, "utf8");
|
|
250
|
+
if (recovery.status === "rollback-planned") {
|
|
251
|
+
if (digest(text) !== receipt.afterHash) refuse("RECOVERY_CONFLICT");
|
|
252
|
+
const token = bundleToken(text, receipt.slot);
|
|
253
|
+
const original = text.slice(0, token.offset) + receipt.originalLiteral + text.slice(token.offset + token.length);
|
|
254
|
+
if (digest(original) !== receipt.beforeHash) refuse("RECOVERY_CONFLICT");
|
|
255
|
+
const inspection = await inspectColdComposition(options, sdk, { receipt });
|
|
256
|
+
requireRevision(inspection, input.expectedRevision);
|
|
257
|
+
inspection.readset.assertCurrent();
|
|
258
|
+
await sdk.atomic.writeFileAtomic(manifestPath, original, { mode: lstatSync(manifestPath).mode & 0o777 });
|
|
259
|
+
}
|
|
260
|
+
// Keep immutable outputs and receipt for idempotent recovery; they are no longer referenced.
|
|
261
|
+
return { status: "recovered", projectionName: receipt.projectionName };
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export const recoverColdProfileMigration = input => safeOperation(() => recoverMigration(input));
|
|
266
|
+
|
|
267
|
+
export async function coldProfileMigrationCli(argv) {
|
|
268
|
+
const [command, ...args] = argv;
|
|
269
|
+
const values = {};
|
|
270
|
+
const overlays = [];
|
|
271
|
+
const sourceRoots = [];
|
|
272
|
+
const flags = new Set(["--no-shell", "--migrate-subagent", "--migrate-session-persistence", "--source-write-exclusion"]);
|
|
273
|
+
const names = {
|
|
274
|
+
"--profile-dir": "profileDir", "--install-anchor": "installAnchor", "--home": "home",
|
|
275
|
+
"--target": "target", "--expected-revision": "expectedRevision", "--projection-name": "projectionName",
|
|
276
|
+
"--root-config": "rootConfig",
|
|
277
|
+
};
|
|
278
|
+
for (let index = 0; index < args.length; index++) {
|
|
279
|
+
const flag = args[index];
|
|
280
|
+
if (flags.has(flag)) {
|
|
281
|
+
if (Object.hasOwn(values, flag)) refuse("INVALID_ARGUMENTS");
|
|
282
|
+
values[flag] = true;
|
|
283
|
+
} else if (flag === "--patch" || flag === "--source-root" || Object.hasOwn(names, flag)) {
|
|
284
|
+
const value = args[++index];
|
|
285
|
+
if (!value || value.startsWith("--")) refuse("INVALID_ARGUMENTS");
|
|
286
|
+
if (flag === "--patch") overlays.push(value);
|
|
287
|
+
else if (flag === "--source-root") sourceRoots.push(value);
|
|
288
|
+
else {
|
|
289
|
+
if (Object.hasOwn(values, names[flag])) refuse("INVALID_ARGUMENTS");
|
|
290
|
+
values[names[flag]] = value;
|
|
291
|
+
}
|
|
292
|
+
} else refuse("INVALID_ARGUMENTS");
|
|
293
|
+
}
|
|
294
|
+
const input = {
|
|
295
|
+
...values, overlays, migrateShell: !values["--no-shell"], migrateSubagent: !!values["--migrate-subagent"],
|
|
296
|
+
migrateSessionPersistence: !!values["--migrate-session-persistence"], sourceWriteExclusion: !!values["--source-write-exclusion"],
|
|
297
|
+
};
|
|
298
|
+
if (sourceRoots.length) input.sourceRoots = sourceRoots;
|
|
299
|
+
const commands = {
|
|
300
|
+
plan: planColdProfileMigration, prepare: prepareColdProfileMigration, apply: applyColdProfileMigration,
|
|
301
|
+
"plan-recover": planColdProfileRecovery, recover: recoverColdProfileMigration,
|
|
302
|
+
};
|
|
303
|
+
if (!Object.hasOwn(commands, command)) refuse("INVALID_COMMAND");
|
|
304
|
+
return commands[command](input);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
|
308
|
+
try {
|
|
309
|
+
console.log(JSON.stringify(await coldProfileMigrationCli(process.argv.slice(2))));
|
|
310
|
+
} catch (error) {
|
|
311
|
+
// SDK/YAML/filesystem diagnostics can contain configuration values: never echo them.
|
|
312
|
+
console.error(JSON.stringify({ status: "refused", code: error instanceof ColdProfileMigrationError ? error.code : "SOURCE_OR_IO_FAILURE", ...(error.projectionName ? { projectionName: error.projectionName } : {}) }));
|
|
313
|
+
process.exitCode = 1;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Yeongyu Kim
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
> DSH adapter boundary: resolve this resource from the loaded skill's directory resourceBase. Examples are not authority: installation/download/login, private state, Git writes and destructive operations need exact explicit authorization. Use only tools and native roles actually exposed in the current catalog and allowed by the caller; otherwise use a real direct fallback or report the limitation. Translate shell examples to the active runtime.
|
|
2
|
+
|
|
3
|
+
# ast-grep-skill
|
|
4
|
+
|
|
5
|
+
LLM-neutral skill for **AST-aware search and rewrite** across 25 languages. Wraps the [`ast-grep`](https://ast-grep.github.io/) (`sg`) CLI with offline pattern validation, the two-pass write trick, binary auto-resolution, and a per-OS installer.
|
|
6
|
+
|
|
7
|
+
Same shape as [`web-fetch`](https://github.com/code-yeongyu/web-fetch) and [`web-search`](https://github.com/code-yeongyu/web-search), packaged as a standalone skill that any Bash-capable agent (Claude Code, OpenCode, pi, hermes, openclaw) can load.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
git clone https://github.com/code-yeongyu/ast-grep-skill ~/.agents/skills/ast-grep
|
|
13
|
+
bash ~/.agents/skills/ast-grep/install.sh # installs the ast-grep binary
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
That is it. The wrapper script is single-file Python 3 stdlib; no `pip install` needed. The installer tries `brew` → `npm` → `cargo` → `pip` → `nix` → `mise` → GitHub release in priority order, picks the first that works, and falls back to a cached binary at `<skill>/bin/sg`.
|
|
17
|
+
|
|
18
|
+
### Symlink for active development
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
ln -s /path/to/your/clone ~/.agents/skills/ast-grep
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Other agents
|
|
25
|
+
|
|
26
|
+
- **Claude Code / OpenCode**: drop the directory under `~/.agents/skills/` (or `~/.config/opencode/skills/`) and the skill auto-registers via the `name` + `description` in `SKILL.md` frontmatter.
|
|
27
|
+
- **pi (`~/.senpi/agent`)**: not a `pi` extension — this is a skill. Pi consumes skills via `~/.agents/skills/` symlinks; the actual `pi-ast-grep` extension is at <https://github.com/code-yeongyu/pi-extensions>.
|
|
28
|
+
- **Direct CLI use**: `python3 ~/.agents/skills/ast-grep/scripts/ast_grep_helper.py <subcommand>`.
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# Search by AST pattern (the helper validates patterns offline first)
|
|
34
|
+
python3 scripts/ast_grep_helper.py search 'console.log($MSG)' --lang ts src/
|
|
35
|
+
|
|
36
|
+
# Rewrite (dry-run preview by default)
|
|
37
|
+
python3 scripts/ast_grep_helper.py replace 'console.log($MSG)' 'logger.info($MSG)' --lang ts src/
|
|
38
|
+
|
|
39
|
+
# Apply the rewrite (two-pass: preview JSON + then --update-all)
|
|
40
|
+
python3 scripts/ast_grep_helper.py replace 'console.log($MSG)' 'logger.info($MSG)' --lang ts src/ --apply
|
|
41
|
+
|
|
42
|
+
# Run YAML lint rules from sgconfig.yml
|
|
43
|
+
python3 scripts/ast_grep_helper.py scan src/
|
|
44
|
+
|
|
45
|
+
# Validate a pattern OFFLINE (no sg call, no filesystem)
|
|
46
|
+
python3 scripts/ast_grep_helper.py validate '\w+' --lang ts
|
|
47
|
+
# → exit 2: regex \w not supported. Use $VAR for identifiers.
|
|
48
|
+
|
|
49
|
+
# Doctor: check ast-grep binary availability
|
|
50
|
+
python3 scripts/ast_grep_helper.py doctor
|
|
51
|
+
|
|
52
|
+
# List 25 supported languages
|
|
53
|
+
python3 scripts/ast_grep_helper.py langs
|
|
54
|
+
|
|
55
|
+
# Install / re-install the ast-grep binary
|
|
56
|
+
python3 scripts/ast_grep_helper.py install
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
See [SKILL.md](./SKILL.md) for full agent-facing usage and the [`references/`](./references/) directory for deep dives.
|
|
60
|
+
|
|
61
|
+
## Project layout
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
ast-grep-skill/
|
|
65
|
+
├── SKILL.md agent-facing skill (loaded by Claude Code, OpenCode, pi, etc.)
|
|
66
|
+
├── README.md this file
|
|
67
|
+
├── LICENSE MIT
|
|
68
|
+
├── install.sh POSIX installer (macOS / Linux / WSL / Git Bash)
|
|
69
|
+
├── install.ps1 Windows PowerShell installer
|
|
70
|
+
├── scripts/
|
|
71
|
+
│ └── ast_grep_helper.py single-file Python 3 stdlib wrapper
|
|
72
|
+
├── references/
|
|
73
|
+
│ ├── install.md per-OS install methods + manual fallback
|
|
74
|
+
│ ├── patterns.md meta-variables ($VAR, $$$) and pattern syntax
|
|
75
|
+
│ ├── pitfalls.md regex anti-patterns + language-specific traps
|
|
76
|
+
│ ├── recipes.md copy-paste patterns by language (TS/JS/Py/Go/Rust/...)
|
|
77
|
+
│ ├── cli.md sg run / scan / test / new / lsp reference
|
|
78
|
+
│ ├── yaml-rules.md YAML rule schema (atomic / relational / composite / transform / fix)
|
|
79
|
+
│ └── sgconfig.md project configuration (ruleDirs, testConfigs, utilDirs)
|
|
80
|
+
├── tests/
|
|
81
|
+
│ ├── smoke.sh POSIX self-test
|
|
82
|
+
│ └── smoke.ps1 PowerShell self-test (Windows CI)
|
|
83
|
+
└── .github/workflows/ci.yml matrix CI: macos / ubuntu / windows × py 3.9-3.13
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## What it does
|
|
87
|
+
|
|
88
|
+
1. **Wraps `sg`** with a single Python 3 stdlib script that works the same on macOS, Linux, Windows, WSL, Git Bash.
|
|
89
|
+
2. **Validates patterns offline** before calling `sg` — catches the regex-misuse class of mistakes (`\w`, `.*`, `|`, `[a-z]`) plus language-specific traps (Python trailing colons, JS/Go/Rust missing function bodies).
|
|
90
|
+
3. **Resolves the binary** through 6 candidate paths: cached → PATH (with Linux `setgroups` collision detection) → Homebrew. Falls through to a clear install hint with copy-paste commands.
|
|
91
|
+
4. **Runs the two-pass write trick** when applying rewrites — `sg run` silently ignores `--update-all` when `--json` is set, so `replace --apply` runs two invocations: pass 1 collects JSON matches, pass 2 mutates files.
|
|
92
|
+
5. **Ships per-OS installers** that try every reasonable package manager and fall back to a GitHub release tarball.
|
|
93
|
+
6. **Documents the failure modes** the model will hit (regex misuse, incomplete patterns, `--update-all` + `--json` trap, scope/type questions ast-grep can't answer) in `references/pitfalls.md`.
|
|
94
|
+
|
|
95
|
+
## What it does NOT do
|
|
96
|
+
|
|
97
|
+
- No type inference, scope analysis, or data flow. ast-grep is a structural matcher; for type-aware questions use TypeScript LSP, Pyright, Semgrep with type inference, or CodeQL.
|
|
98
|
+
- No multi-repo federation. Run the helper once per repo.
|
|
99
|
+
- No automatic `sgconfig.yml` discovery — it does what `sg scan` does (walk up from cwd looking for one).
|
|
100
|
+
- No JS/Python rewriter authoring environment — for that, write YAML rules and use `sg test` for snapshot testing (see [`references/yaml-rules.md`](./references/yaml-rules.md)).
|
|
101
|
+
|
|
102
|
+
## Limits
|
|
103
|
+
|
|
104
|
+
- 5-minute timeout per `sg` invocation (configurable in the helper).
|
|
105
|
+
- ast-grep itself supports 25 languages out-of-the-box. For anything else, use [`customLanguages`](./references/sgconfig.md#customlanguages-experimental) in `sgconfig.yml`.
|
|
106
|
+
- Pattern hint detection is heuristic; pass `--force` to skip validation when you know the pattern is correct.
|
|
107
|
+
|
|
108
|
+
## Requirements
|
|
109
|
+
|
|
110
|
+
- Python ≥ 3.9 (stdlib only — no pip install).
|
|
111
|
+
- `ast-grep` binary, installed via `install.sh` / `install.ps1` or one of:
|
|
112
|
+
- `brew install ast-grep` (macOS / linuxbrew)
|
|
113
|
+
- `npm install -g @ast-grep/cli` (any OS with Node)
|
|
114
|
+
- `cargo install ast-grep --locked` (any OS with Rust)
|
|
115
|
+
- `pip install ast-grep-cli` (any OS with Python)
|
|
116
|
+
- `scoop install main/ast-grep` (Windows)
|
|
117
|
+
|
|
118
|
+
For older systems and Windows-specific setup, see [`references/install.md`](./references/install.md).
|
|
119
|
+
|
|
120
|
+
## Testing
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
bash tests/smoke.sh # POSIX (macOS / Linux / WSL / Git Bash)
|
|
124
|
+
pwsh tests/smoke.ps1 # Windows (PowerShell 5.1+ or 7+)
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
CI runs the matrix on every push: `{macos-latest, ubuntu-latest, ubuntu-22.04, windows-latest}` × `{Python 3.9, 3.10, 3.11, 3.12, 3.13}` plus a syntax-floor check on Python 3.9 and 3.10.
|
|
128
|
+
|
|
129
|
+
## License
|
|
130
|
+
|
|
131
|
+
[MIT](./LICENSE).
|
|
132
|
+
|
|
133
|
+
## Acknowledgments
|
|
134
|
+
|
|
135
|
+
- Upstream ast-grep tool implementation - this skill is a port of its pattern-hint detection and two-pass-write strategy.
|
|
136
|
+
- [`pi-extensions/pi-ast-grep`](https://github.com/code-yeongyu/pi-extensions) — sibling Node port; the helper's binary-resolution cascade is modelled on it.
|
|
137
|
+
- [ast-grep](https://github.com/ast-grep/ast-grep) — the CLI. All structural matching power comes from it.
|
|
138
|
+
- [Anthropic skills](https://docs.anthropic.com/en/docs/claude-code/skills) — the `SKILL.md` + `references/` packaging convention.
|