@dsmm/dsmm 0.1.9 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -24
- package/agent-presets/dsmm-builder/agent.cordis.yml +1949 -39
- package/agent-presets/dsmm-builder/preset.yml +1 -1
- package/agent-presets/dsmm-clarifier/agent.cordis.yml +436 -14
- package/agent-presets/dsmm-clarifier/preset.yml +1 -1
- package/agent-presets/dsmm-code-search/agent.cordis.yml +56 -14
- package/agent-presets/dsmm-code-search/preset.yml +1 -1
- package/agent-presets/dsmm-coding/agent.cordis.yml +588 -0
- package/agent-presets/dsmm-coding/preset.yml +3 -0
- package/agent-presets/dsmm-complex/agent.cordis.yml +1140 -0
- package/agent-presets/dsmm-complex/preset.yml +3 -0
- package/agent-presets/dsmm-creative/agent.cordis.yml +536 -12
- package/agent-presets/dsmm-creative/preset.yml +1 -1
- package/agent-presets/dsmm-cross-cutting/agent.cordis.yml +1163 -0
- package/agent-presets/dsmm-cross-cutting/preset.yml +3 -0
- package/agent-presets/dsmm-deep/agent.cordis.yml +1173 -0
- package/agent-presets/dsmm-deep/preset.yml +3 -0
- package/agent-presets/dsmm-doc-search/agent.cordis.yml +56 -14
- package/agent-presets/dsmm-doc-search/preset.yml +1 -1
- package/agent-presets/dsmm-documenting/agent.cordis.yml +581 -0
- package/agent-presets/dsmm-documenting/preset.yml +3 -0
- package/agent-presets/dsmm-frontend/agent.cordis.yml +580 -0
- package/agent-presets/dsmm-frontend/preset.yml +3 -0
- package/agent-presets/dsmm-hard-reasoning/agent.cordis.yml +572 -0
- package/agent-presets/dsmm-hard-reasoning/preset.yml +3 -0
- package/agent-presets/dsmm-media-reader/agent.cordis.yml +56 -14
- package/agent-presets/dsmm-media-reader/preset.yml +1 -1
- package/agent-presets/dsmm-normal-task/agent.cordis.yml +546 -0
- package/agent-presets/dsmm-normal-task/preset.yml +3 -0
- package/agent-presets/dsmm-oracle/agent.cordis.yml +421 -12
- package/agent-presets/dsmm-oracle/preset.yml +1 -1
- package/agent-presets/dsmm-oracle-2nd/agent.cordis.yml +421 -12
- package/agent-presets/dsmm-oracle-2nd/preset.yml +1 -1
- package/agent-presets/dsmm-orchestrator/agent.cordis.yml +2023 -43
- package/agent-presets/dsmm-orchestrator/preset.yml +1 -1
- package/agent-presets/dsmm-plan-critic/agent.cordis.yml +416 -13
- package/agent-presets/dsmm-plan-critic/preset.yml +1 -1
- package/agent-presets/dsmm-planner/agent.cordis.yml +462 -13
- package/agent-presets/dsmm-planner/preset.yml +1 -1
- package/agent-presets/dsmm-quick/agent.cordis.yml +119 -0
- package/agent-presets/dsmm-quick/preset.yml +3 -0
- package/agent-presets/dsmm-research/agent.cordis.yml +141 -0
- package/agent-presets/dsmm-research/preset.yml +3 -0
- package/agent-presets/dsmm-reviewer/agent.cordis.yml +420 -13
- package/agent-presets/dsmm-reviewer/preset.yml +1 -1
- package/cordis.patch.yml +1 -5
- package/docs/agent-presets.md +64 -15
- package/docs/compatibility.md +61 -13
- package/docs/design.md +41 -0
- package/docs/lsp.md +12 -2
- package/docs/migration-from-ocmm.md +8 -0
- package/docs/profiles.md +41 -15
- package/docs/releasing.md +78 -8
- package/docs/roadmap.md +6 -0
- package/docs/runtime-recovery.md +12 -0
- package/docs/safety-guards.md +7 -3
- package/docs/settings-status.md +148 -7
- package/docs/skill-sync.md +52 -14
- package/lib/client/DeploymentPage.d.ts +18 -0
- package/lib/client/DeploymentPage.js +120 -0
- package/lib/client/ProfilesSection.js +4 -2
- package/lib/client/deployment-controller.d.ts +50 -0
- package/lib/client/deployment-controller.js +193 -0
- package/lib/client/deployment-data.d.ts +16 -0
- package/lib/client/deployment-data.js +109 -0
- package/lib/client/deployment-locales.d.ts +66 -0
- package/lib/client/deployment-locales.js +72 -0
- package/lib/client/index.js +50 -0
- package/lib/client/locales.d.ts +4 -0
- package/lib/client/locales.js +4 -2
- package/lib/client/plugins-contract.d.ts +27 -0
- package/lib/client/plugins-contract.js +2 -0
- package/lib/client/styles.d.ts +1 -1
- package/lib/client/styles.js +16 -0
- package/lib/client.js +1048 -29
- 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/deployment-config.d.ts +37 -0
- package/lib/deployment-config.js +184 -0
- package/lib/dsh-home.d.ts +3 -0
- package/lib/dsh-home.js +10 -0
- package/lib/dsh-types.d.ts +12 -65
- package/lib/guards.d.ts +2 -1
- package/lib/guards.js +19 -2
- package/lib/index.d.ts +8 -1
- package/lib/index.js +115 -25
- package/lib/lsp.d.ts +13 -0
- package/lib/lsp.js +60 -0
- package/lib/mode.js +42 -47
- package/lib/model-routing.js +5 -2
- package/lib/modules.d.ts +27 -0
- package/lib/modules.js +21 -0
- package/lib/native-scope.d.ts +9 -0
- package/lib/native-scope.js +20 -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 +7 -4
- package/lib/preset-skills.d.ts +4 -1
- package/lib/preset-skills.js +60 -19
- package/lib/profile-remote.d.ts +14 -0
- package/lib/profile-remote.js +197 -4
- package/lib/profile-rpc.d.ts +24 -1
- package/lib/profile-rpc.js +139 -1
- package/lib/profile-runtime.d.ts +24 -0
- package/lib/profile-runtime.js +177 -33
- package/lib/profile-store.d.ts +45 -1
- package/lib/profile-store.js +236 -102
- package/lib/profile-types.d.ts +55 -0
- package/lib/prompt-content.d.ts +25 -0
- package/lib/prompt-content.js +27 -0
- package/lib/prompts.d.ts +8 -2
- package/lib/prompts.js +46 -34
- package/lib/role-policy.d.ts +51 -0
- package/lib/role-policy.js +224 -0
- package/lib/role-providers.d.ts +6 -2
- package/lib/role-providers.js +72 -39
- package/lib/role-subagents.d.ts +6 -2
- package/lib/role-subagents.js +187 -48
- package/lib/roles.d.ts +16 -4
- package/lib/roles.js +86 -186
- package/lib/runtime-recovery.js +16 -5
- package/lib/session-scope.js +2 -0
- package/lib/settings.d.ts +69 -1
- package/lib/settings.js +262 -91
- 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 +25 -0
- package/lib/status.js +47 -9
- package/locale/en.json +2 -2
- package/locale/zh.json +2 -2
- package/package.json +19 -2
- package/prompts/deepwork.md +144 -20
- package/prompts/source/agents/clarifier.md +45 -0
- package/prompts/source/agents/orchestrator.md +63 -0
- package/prompts/source/agents/plan-critic.md +25 -0
- package/prompts/source/agents/planner.md +19 -0
- package/prompts/source/agents/reviewer.md +17 -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 +38 -0
- package/prompts/source/category/cross-cutting.md +52 -0
- package/prompts/source/category/deep.md +62 -0
- package/prompts/source/category/documenting.md +62 -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 +56 -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 +129 -0
- package/prompts/source/deepwork/gemini.md +184 -0
- package/prompts/source/deepwork/glm.md +256 -0
- package/prompts/source/deepwork/gpt.md +43 -0
- package/prompts/source/deepwork/kimi-k27.md +13 -0
- package/prompts/source/deepwork/planner.md +41 -0
- package/prompts/source/deepwork/swe-2.md +13 -0
- package/prompts/source/manifest.json +3118 -0
- package/prompts/source/shared/dsh-host-contract.md +6 -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/skills/ast-grep/LICENSE +21 -0
- package/skills/ast-grep/README.md +138 -0
- package/skills/ast-grep/SKILL.md +284 -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 +102 -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 +144 -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 +125 -4
- package/skills/debugging/references/logging.md +2 -0
- package/skills/debugging/references/methodology/00-setup.md +2 -0
- package/skills/debugging/references/methodology/02-investigate.md +8 -2
- package/skills/debugging/references/methodology/03-flaky-triage.md +3 -1
- package/skills/debugging/references/methodology/04-hard-reasoning-escalation.md +4 -2
- package/skills/debugging/references/methodology/05-escalate.md +2 -0
- package/skills/debugging/references/methodology/06-fix.md +2 -0
- package/skills/debugging/references/methodology/08-qa.md +2 -0
- package/skills/debugging/references/methodology/09-cleanup.md +2 -0
- package/skills/debugging/references/methodology/partial-runtime-evidence.md +4 -2
- package/skills/debugging/references/runtimes/bundled-js-binary.md +2 -0
- package/skills/debugging/references/runtimes/go.md +2 -0
- package/skills/debugging/references/runtimes/native-binary.md +2 -0
- package/skills/debugging/references/runtimes/node.md +2 -0
- package/skills/debugging/references/runtimes/python.md +2 -0
- package/skills/debugging/references/runtimes/rust.md +2 -0
- 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 +3 -1
- package/skills/debugging/references/tools/ghidra.md +2 -0
- package/skills/debugging/references/tools/playwright-cli.md +2 -0
- package/skills/debugging/references/tools/pwndbg.md +2 -0
- package/skills/debugging/references/tools/pwntools.md +2 -0
- package/skills/dispatching-parallel-agents/SKILL.md +94 -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 +142 -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 +112 -0
- package/skills/git-master/agents/openai.yaml +13 -0
- package/skills/init-deep/SKILL.md +279 -0
- package/skills/receiving-code-review/SKILL.md +112 -7
- package/skills/remove-ai-slops/SKILL.md +159 -8
- package/skills/requesting-code-review/SKILL.md +96 -3
- package/skills/requesting-code-review/code-reviewer.md +47 -0
- package/skills/subagent-driven-development/SKILL.md +176 -6
- package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +23 -0
- package/skills/subagent-driven-development/implementer-prompt.md +69 -0
- package/skills/subagent-driven-development/spec-reviewer-prompt.md +32 -0
- package/skills/using-git-worktrees/SKILL.md +141 -0
- package/skills/writing-plans/SKILL.md +121 -7
- package/skills/writing-plans/plan-document-reviewer-prompt.md +38 -0
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ast-grep
|
|
3
|
+
description: "Use ast-grep (sg) only when the task explicitly requires exact syntax-tree matching or a deterministic codemod that simpler rg/LSP lookup cannot express reliably. Examples: rewrite a specific call/import shape, strip `as any`, find empty catch blocks, or scan/apply YAML rules. Do not trigger for ordinary repository discovery, symbol navigation, text search, or one-off lookups that rg/LSP can answer."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## DSH resource and authority contract
|
|
7
|
+
|
|
8
|
+
This is a full OCMM source adaptation for DSH 0.2.0-rc.2, not an OpenCode or Codex runtime. Source product names in transcript formats, examples, paths and attribution remain descriptive; they are not a host switch.
|
|
9
|
+
|
|
10
|
+
- Load this skill through the native skill tool only when its trigger matches. Resolve every relative reference/script/asset from the directory resourceBase returned with this skill, not from the project cwd or an OCMM checkout. Use available read/glob/grep to inspect resources; use write/edit and the active bash or pwsh only within the actual role and host permissions.
|
|
11
|
+
- External documentation uses actual web_search/web_fetch or an available documentation service. Context7, GitHub MCP, browser, image and LSP tools are optional catalog capabilities, not bundled calls. Use a real available equivalent or report unavailable evidence; never invent an MCP, Task, todo or compression API.
|
|
12
|
+
- Source role names are logical assignments: code-search/explore maps to dsmm-code-search, and other canonical roles/categories map to dsmm-<name>. Dispatch only through the actual role-specific native subagent tool in the current catalog, within the caller's effective policy, depth and authority. No generated file, metadata row or template proves callability. A missing permitted role is a blocker for a required formal stage, not permission to invent it or bypass planning.
|
|
13
|
+
- Templates describe assignment content, not a callable argument schema. Native continuation, background, message/interrupt and result handling are used only when actually exposed and supported; do not send task_id, subagent_type or guessed timeout fields. Otherwise perform permitted direct work or return the dependency to the stage owner.
|
|
14
|
+
- Use a concise response or an authorized project plan for tracking when no native tracking tool is exposed. Compression is unavailable unless a real tool is exposed; do not simulate it. Role responsibilities, explicit-off common/skill visibility, and the terminal delegation contract override broader examples in a resource.
|
|
15
|
+
- Installation, package-manager bootstrap, downloads, authentication/login, credential/profile access, Git writes and destructive actions require explicit authorization for the exact action. Reference commands are not automatic operations. Worktree consent does not authorize dependency installation or later branch deletion. Read before changing an existing file; preserve unrelated user work. Never silently restore/reset a working tree to repair a failed cleanup.
|
|
16
|
+
- Browser/debug QA uses run-owned isolated state, no imported credentials or browser profile, and only already available software unless separately authorized. Keep commands in the active shell dialect. Report unverified surfaces honestly.
|
|
17
|
+
|
|
18
|
+
# ast-grep
|
|
19
|
+
|
|
20
|
+
`sg` (also installed as `ast-grep`) is a specialized **AST-aware search and rewrite tool** across 25 languages. It treats your pattern as code, parses it the same way it parses your project, and matches structurally. It is an escalation for exact syntax-tree questions and deterministic codemods, not a default repository-discovery tool.
|
|
21
|
+
|
|
22
|
+
This skill ships a Python wrapper at `scripts/ast_grep_helper.py` and platform install scripts at `install.sh` (POSIX) and `install.ps1` (Windows). The helper adds offline pattern validation, the two-pass write trick, and binary auto-resolution. Use it as the entry point after the task has met this skill's narrow trigger.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## When to use this skill
|
|
27
|
+
|
|
28
|
+
Use it only when the answer or rewrite depends on an **exact syntax-tree shape**, and simpler text search or LSP navigation cannot express the requirement reliably:
|
|
29
|
+
|
|
30
|
+
- "Find every function that takes a `Request` parameter."
|
|
31
|
+
- "Rewrite every `console.log(x)` to `logger.info(x)`."
|
|
32
|
+
- "Strip every `as any` cast."
|
|
33
|
+
- "Replace `require(...)` with `import` across the repo."
|
|
34
|
+
- "Find empty catch blocks."
|
|
35
|
+
- "Migrate `Optional[X]` to `X | None`."
|
|
36
|
+
- "Apply this codemod across these 200 files."
|
|
37
|
+
- "Run our YAML lint rules and surface violations."
|
|
38
|
+
|
|
39
|
+
Use LSP for symbols, references, definitions, types, and diagnostics. Use plain `grep` / `rg` for strings, comments, license headers, file names, identifier text, and regex-style searches. When in doubt, start with those simpler tools and do not load this skill unless exact AST shape becomes necessary.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Three things the agent must internalize
|
|
44
|
+
|
|
45
|
+
### 1. ast-grep is NOT regex
|
|
46
|
+
|
|
47
|
+
The wildcards are `$VAR` (one AST node) and `$$$` (zero or more nodes). Regex syntax fails silently:
|
|
48
|
+
|
|
49
|
+
| You wrote | What ast-grep saw | What you wanted |
|
|
50
|
+
|---|---|---|
|
|
51
|
+
| `foo\|bar` | bitwise-or of `foo` and `bar` | run two separate searches |
|
|
52
|
+
| `.*foo` | not parseable | `$$$ foo` (if `$$$` is a list of nodes) or use `rg` |
|
|
53
|
+
| `\w+` | not parseable | `$VAR` to capture any identifier |
|
|
54
|
+
| `[a-z]` | character class, not parseable | switch to `rg` |
|
|
55
|
+
|
|
56
|
+
The full anti-pattern table is in `references/pitfalls.md` §1. The helper's `validate` subcommand catches these mechanically — call it before debugging "no matches" by hand.
|
|
57
|
+
|
|
58
|
+
### 2. Patterns must be valid code
|
|
59
|
+
|
|
60
|
+
The pattern itself must parse. `def $FN($$$):` fails because the trailing `:` makes it incomplete; use `def $FN($$$)`. `function $NAME` without params/body fails; use `function $NAME($$$) { $$$ }`. Full table per language in `references/pitfalls.md` §2.
|
|
61
|
+
|
|
62
|
+
### 3. `--update-all` and `--json` are mutually exclusive (silently)
|
|
63
|
+
|
|
64
|
+
This is the single biggest gotcha when scripting. `sg run -p P -r R --json --update-all` returns the JSON but **does not mutate files**. To both preview AND apply, run **two passes**:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
sg run -p P -r R --json=compact . # pass 1: see what would change
|
|
68
|
+
sg run -p P -r R --update-all . # pass 2: actually apply
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
The helper does this automatically when you call `replace --apply`. Read `references/pitfalls.md` §9.
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## The helper script — `scripts/ast_grep_helper.py`
|
|
76
|
+
|
|
77
|
+
A single-file Python 3 stdlib wrapper. Same on every OS. The agent's default entry point.
|
|
78
|
+
|
|
79
|
+
### `search` — find all matches of a pattern
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
python3 scripts/ast_grep_helper.py search 'console.log($MSG)' --lang ts src/
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Validates the pattern offline first. If the pattern looks like regex (`\w`, `.*`, `|`, etc.) the helper exits with a hint and never calls `sg` — saves a round-trip. Pass `--force` to skip validation.
|
|
86
|
+
|
|
87
|
+
Flags:
|
|
88
|
+
- `--lang ts` (or any of the 25 languages; aliases like `js`, `py`, `rs`, `kt` accepted)
|
|
89
|
+
- `--globs '!**/*.test.ts'` (repeatable; prefix `!` to exclude)
|
|
90
|
+
- `-C 3` (context lines)
|
|
91
|
+
- `--json-out` (raw JSON instead of human format)
|
|
92
|
+
|
|
93
|
+
### `replace` — rewrite by pattern, dry-run by default
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
# Dry-run preview (default — no files mutated)
|
|
97
|
+
python3 scripts/ast_grep_helper.py replace 'console.log($MSG)' 'logger.info($MSG)' --lang ts src/
|
|
98
|
+
|
|
99
|
+
# Actually apply
|
|
100
|
+
python3 scripts/ast_grep_helper.py replace 'console.log($MSG)' 'logger.info($MSG)' --lang ts src/ --apply
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
The helper:
|
|
104
|
+
1. Validates both `pattern` and `rewrite` for hint-detectable mistakes.
|
|
105
|
+
2. Runs pass 1 with `--json=compact` to collect matches and show a preview.
|
|
106
|
+
3. If `--apply` is set, runs pass 2 with `--update-all` to mutate files.
|
|
107
|
+
|
|
108
|
+
### `scan` — run YAML rules
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# Discover sgconfig.yml from cwd and run all rules
|
|
112
|
+
python3 scripts/ast_grep_helper.py scan src/
|
|
113
|
+
|
|
114
|
+
# Run a single rule file
|
|
115
|
+
python3 scripts/ast_grep_helper.py scan -r rules/no-console.yml src/
|
|
116
|
+
|
|
117
|
+
# Apply auto-fixes
|
|
118
|
+
python3 scripts/ast_grep_helper.py scan -U src/
|
|
119
|
+
|
|
120
|
+
# CI-friendly GitHub annotations
|
|
121
|
+
python3 scripts/ast_grep_helper.py scan --report-style short src/
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### `validate` — offline pattern check (no `sg` call)
|
|
125
|
+
|
|
126
|
+
Useful for CI lints, pre-commit hooks, and quick sanity checks:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
python3 scripts/ast_grep_helper.py validate '\w+' --lang ts
|
|
130
|
+
# → exit 2: regex \w not supported. Use $VAR for identifiers.
|
|
131
|
+
|
|
132
|
+
python3 scripts/ast_grep_helper.py validate 'console.log($MSG)' --lang ts
|
|
133
|
+
# → exit 0: pattern looks plausible for ast-grep.
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### `langs` / `doctor` / `install`
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
python3 scripts/ast_grep_helper.py langs # list 25 supported languages and aliases
|
|
140
|
+
python3 scripts/ast_grep_helper.py doctor # check ast-grep binary availability
|
|
141
|
+
python3 scripts/ast_grep_helper.py install # delegate to install.sh / install.ps1
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
`new` and `test` subcommands proxy directly to `sg new` and `sg test`.
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Direct `sg` use (when the helper isn't enough)
|
|
149
|
+
|
|
150
|
+
The helper is opinionated. For full control, drop to `sg`. The skill ships a CLI cheat sheet in `references/cli.md`. The minimal idioms:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# Search
|
|
154
|
+
sg run -p 'console.log($MSG)' --lang ts src/
|
|
155
|
+
|
|
156
|
+
# Search with JSON for scripting
|
|
157
|
+
sg run -p 'console.log($MSG)' --lang ts --json=compact src/ | jq '.[] | .file'
|
|
158
|
+
|
|
159
|
+
# Rewrite, dry-run
|
|
160
|
+
sg run -p 'console.log($MSG)' -r 'logger.info($MSG)' --lang ts --json=compact src/
|
|
161
|
+
|
|
162
|
+
# Rewrite, apply
|
|
163
|
+
sg run -p 'console.log($MSG)' -r 'logger.info($MSG)' --lang ts --update-all src/
|
|
164
|
+
|
|
165
|
+
# Pattern from stdin (great for ad-hoc experiments)
|
|
166
|
+
echo 'console.log("hi")' | sg run -p 'console.log($MSG)' --lang js --stdin
|
|
167
|
+
|
|
168
|
+
# Debug a pattern that returns 0 matches
|
|
169
|
+
sg run -p '<your pattern>' --lang <lang> --debug-query=ast --stdin <<< '<sample-code>'
|
|
170
|
+
|
|
171
|
+
# Run YAML rules
|
|
172
|
+
sg scan src/
|
|
173
|
+
|
|
174
|
+
# Inline YAML rule (one-off)
|
|
175
|
+
sg scan --inline-rules '
|
|
176
|
+
id: no-todo
|
|
177
|
+
language: TypeScript
|
|
178
|
+
severity: warning
|
|
179
|
+
rule: { pattern: TODO }' src/
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
When using `sg` directly in a shell, **always single-quote patterns** so `$VAR` is not expanded by the shell.
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Decision tree — what to use, when
|
|
187
|
+
|
|
188
|
+
```
|
|
189
|
+
USER asks for "find/rewrite/codemod"
|
|
190
|
+
│
|
|
191
|
+
├─ structural pattern (function shape, call, class, import, control flow)
|
|
192
|
+
│ └→ ast-grep (this skill)
|
|
193
|
+
│
|
|
194
|
+
├─ text pattern (regex, alternation, character classes, file names)
|
|
195
|
+
│ └→ rg / grep
|
|
196
|
+
│
|
|
197
|
+
├─ semantic question (what variable does this refer to? does this throw?)
|
|
198
|
+
│ └→ LSP tools, TypeScript compiler, Pyright, Semgrep with type inference
|
|
199
|
+
│
|
|
200
|
+
└─ multiple repos / federated search
|
|
201
|
+
└→ a search engine + then ast-grep / rg / LSP per-repo
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
The words "find all" or "every" do not by themselves trigger ast-grep. Use it only when the target is an exact syntactic shape and simpler search cannot reliably distinguish it; use rg when the target is text (string content, comment, license header, file name, identifier substring).
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## Always run dry-run first when rewriting
|
|
209
|
+
|
|
210
|
+
A bad pattern silently rewrites the wrong thing. The helper's `replace` defaults to dry-run for this reason. The flow is:
|
|
211
|
+
|
|
212
|
+
1. Search to confirm matches: `helper search '<pattern>' --lang X .`
|
|
213
|
+
2. Dry-run rewrite: `helper replace '<pattern>' '<rewrite>' --lang X .` (no `--apply`)
|
|
214
|
+
3. Inspect the dry-run summary: number of matches, files affected, the per-location preview.
|
|
215
|
+
4. If wrong: refine pattern, go back to step 1.
|
|
216
|
+
5. If right: `helper replace '<pattern>' '<rewrite>' --lang X . --apply`.
|
|
217
|
+
|
|
218
|
+
Never apply a rewrite that you have not first dry-run.
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## When `sg` returns 0 matches but you know the code is there
|
|
223
|
+
|
|
224
|
+
In priority order:
|
|
225
|
+
|
|
226
|
+
1. **Run `helper validate '<pattern>' --lang <lang>`** — catches regex misuse, missing function bodies, Python trailing colons.
|
|
227
|
+
2. **Check `--lang`** — `sg` infers from extension; if you pass a `.tsx` file with `--lang ts` (not `tsx`), JSX won't parse.
|
|
228
|
+
3. **Inspect the parsed pattern**: `sg run -p '<pattern>' --lang <lang> --debug-query=ast --stdin <<< '<sample>'`. If it shows `ERROR` nodes, the pattern is malformed.
|
|
229
|
+
4. **Check the AST of the target file**: `sg run -p '$_' --lang <lang> --debug-query=cst path/to/file | head -40` — find the `kind` you're trying to match.
|
|
230
|
+
5. **Try the playground**: <https://ast-grep.github.io/playground.html> — paste code + pattern, see what's happening.
|
|
231
|
+
|
|
232
|
+
Do not blindly retry with variations. Each failure has a reason; surface it.
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
## When to use YAML rules vs inline `-p` patterns
|
|
237
|
+
|
|
238
|
+
**Use inline `-p`** when:
|
|
239
|
+
- One-off ad-hoc query.
|
|
240
|
+
- The pattern is simple (no constraints, no fix template).
|
|
241
|
+
- You're exploring.
|
|
242
|
+
|
|
243
|
+
**Use YAML rules** (file under `rules/`, run via `sg scan`) when:
|
|
244
|
+
- The pattern is reused (lint rule, codemod that runs in CI).
|
|
245
|
+
- You need `constraints`, `transform`, complex `inside`/`has`, or composite logic.
|
|
246
|
+
- You want auto-fix (`fix:` field).
|
|
247
|
+
- You want to test the rule (snapshot tests via `sg test`).
|
|
248
|
+
|
|
249
|
+
The full YAML rule schema is in `references/yaml-rules.md`. Project setup (`sgconfig.yml`, `ruleDirs`, `utilDirs`) is in `references/sgconfig.md`.
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
## Output discipline
|
|
254
|
+
|
|
255
|
+
- `sg run --json=compact` produces an array of match objects: `{ file, range: {start, end}, text, replacement?, lines, language, ... }`. Pipe through `jq` for further processing.
|
|
256
|
+
- Without `--json`, `sg` produces human-readable colored output suitable for terminals.
|
|
257
|
+
- The helper's default output is human-readable (file:line:column + match preview). Pass `--json-out` for raw JSON.
|
|
258
|
+
- The helper's `replace` always summarizes: number of matches, number of files, per-location preview.
|
|
259
|
+
|
|
260
|
+
When summarizing for the user, **always include the count of files affected**, not just the count of matches. Users care about blast radius.
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## Required reading (in order of priority)
|
|
265
|
+
|
|
266
|
+
1. `references/patterns.md` — meta-variables, naming rules, strictness levels. Read when you're unsure why a pattern doesn't match.
|
|
267
|
+
2. `references/pitfalls.md` — the failure-mode field guide. Read when 0 matches surprises you.
|
|
268
|
+
3. `references/recipes.md` — copy-paste patterns by language. Read first when you start a new task.
|
|
269
|
+
4. `references/cli.md` — `sg run`, `sg scan`, `sg test`, `sg new`, `sg lsp`. Read when the helper isn't enough.
|
|
270
|
+
5. `references/yaml-rules.md` — YAML rule schema. Read when you outgrow inline patterns.
|
|
271
|
+
6. `references/sgconfig.md` — project-level configuration. Read when you set up `sg scan` for a real project.
|
|
272
|
+
7. `references/install.md` — per-OS install methods. Read only if `install.sh` / `install.ps1` fail.
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
## Invariants (do not break)
|
|
277
|
+
|
|
278
|
+
- **Validate before searching.** When emitting a pattern programmatically, call `helper validate` first. It catches the regex-misuse class of mistakes that account for ~70% of "0 matches" debug sessions.
|
|
279
|
+
- **Dry-run before applying.** Never run `sg run -r ... --update-all` without first inspecting the matches. The helper's `replace` enforces this by default.
|
|
280
|
+
- **Two-pass writes.** When using `sg` directly to both preview and apply, run two invocations — `--json` ignores `--update-all`.
|
|
281
|
+
- **Single-quote patterns in shell.** `'$VAR'` not `"$VAR"`. The shell expands `$VAR` to the empty string in double quotes, breaking the pattern.
|
|
282
|
+
- **Pattern is code, not regex.** When the pattern would need `|`, `.*`, `\w`, or `[a-z]`, switch to `rg` instead. Don't try to force ast-grep into a regex shape.
|
|
283
|
+
- **`--lang` is required for stdin.** When piping with `--stdin`, set `--lang` explicitly; `sg` cannot infer from extension.
|
|
284
|
+
- **Linux: prefer `ast-grep` over `sg`** because `sg` collides with `setgroups`. The helper handles this; if you call `sg` directly, alias it: `alias sg=ast-grep`.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
upstream: https://github.com/code-yeongyu/ast-grep-skill @ 3148c69; fallback binary pin synced to ast-grep 0.45.0 for ocmm 0.6.11. Vendored as a sync; do not fork-drift.
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
#Requires -Version 5.1
|
|
2
|
+
<#
|
|
3
|
+
.SYNOPSIS
|
|
4
|
+
Install the ast-grep binary on Windows.
|
|
5
|
+
|
|
6
|
+
.DESCRIPTION
|
|
7
|
+
Tries package managers in priority order, then falls back to downloading a
|
|
8
|
+
pinned release zip from GitHub into <skill_root>/bin/sg.exe.
|
|
9
|
+
|
|
10
|
+
Order:
|
|
11
|
+
1. Already installed? -> nothing to do
|
|
12
|
+
2. Scoop (most common Windows dev tool installer)
|
|
13
|
+
3. Winget (Microsoft built-in)
|
|
14
|
+
4. Chocolatey (choco)
|
|
15
|
+
5. npm (@ast-grep/cli)
|
|
16
|
+
6. cargo binstall / cargo install
|
|
17
|
+
7. pip (ast-grep-cli)
|
|
18
|
+
8. GitHub release zip -> <skill_root>/bin/sg.exe
|
|
19
|
+
|
|
20
|
+
.PARAMETER Method
|
|
21
|
+
Force one method: scoop | winget | choco | npm | cargo | pip | github
|
|
22
|
+
|
|
23
|
+
.PARAMETER Version
|
|
24
|
+
Pin a specific version when downloading from GitHub. Default: 0.45.0
|
|
25
|
+
|
|
26
|
+
.PARAMETER NoFallback
|
|
27
|
+
Don't fall back to GitHub zip; fail if all package managers miss
|
|
28
|
+
|
|
29
|
+
.PARAMETER Quiet
|
|
30
|
+
Suppress non-error output
|
|
31
|
+
|
|
32
|
+
.EXAMPLE
|
|
33
|
+
.\install.ps1
|
|
34
|
+
.\install.ps1 -Method scoop
|
|
35
|
+
.\install.ps1 -Version 0.42.0 -Method github
|
|
36
|
+
#>
|
|
37
|
+
|
|
38
|
+
param(
|
|
39
|
+
[string]$Method = "",
|
|
40
|
+
[string]$Version = "0.45.0",
|
|
41
|
+
[switch]$NoFallback,
|
|
42
|
+
[switch]$Quiet
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
$ErrorActionPreference = 'Stop'
|
|
46
|
+
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
47
|
+
$CacheBinDir = if ($env:OCMM_AST_GREP_BIN_DIR) { $env:OCMM_AST_GREP_BIN_DIR } else { Join-Path $ScriptDir "bin" }
|
|
48
|
+
|
|
49
|
+
function Log([string]$msg) {
|
|
50
|
+
if (-not $Quiet) {
|
|
51
|
+
[Console]::Error.WriteLine("[install.ps1] $msg")
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function Err([string]$msg) {
|
|
56
|
+
[Console]::Error.WriteLine("[install.ps1] error: $msg")
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function Has-Cmd([string]$name) {
|
|
60
|
+
$null -ne (Get-Command $name -ErrorAction SilentlyContinue)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function Test-AstGrep {
|
|
64
|
+
if (Has-Cmd 'ast-grep') { return $true }
|
|
65
|
+
if (Has-Cmd 'sg') { return $true }
|
|
66
|
+
if (Test-Path (Join-Path $CacheBinDir 'sg.exe')) { return $true }
|
|
67
|
+
if (Test-Path (Join-Path $CacheBinDir 'ast-grep.exe')) { return $true }
|
|
68
|
+
return $false
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (-not $Method -and (Test-AstGrep)) {
|
|
72
|
+
Log "ast-grep already installed"
|
|
73
|
+
exit 0
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function Detect-Arch {
|
|
77
|
+
$a = $env:PROCESSOR_ARCHITECTURE
|
|
78
|
+
switch -Wildcard ($a) {
|
|
79
|
+
'AMD64' { return 'x86_64' }
|
|
80
|
+
'ARM64' { return 'aarch64' }
|
|
81
|
+
default { return 'unknown' }
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
$Arch = Detect-Arch
|
|
86
|
+
|
|
87
|
+
function Try-Scoop {
|
|
88
|
+
if (-not (Has-Cmd 'scoop')) { return $false }
|
|
89
|
+
Log "trying: scoop install main/ast-grep"
|
|
90
|
+
try { scoop install main/ast-grep; return $LASTEXITCODE -eq 0 }
|
|
91
|
+
catch { return $false }
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function Try-Winget {
|
|
95
|
+
if (-not (Has-Cmd 'winget')) { return $false }
|
|
96
|
+
Log "trying: winget install --id ast-grep.ast-grep"
|
|
97
|
+
try { winget install --id ast-grep.ast-grep --silent --accept-package-agreements --accept-source-agreements; return $LASTEXITCODE -eq 0 }
|
|
98
|
+
catch { return $false }
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function Try-Choco {
|
|
102
|
+
if (-not (Has-Cmd 'choco')) { return $false }
|
|
103
|
+
Log "trying: choco install ast-grep -y"
|
|
104
|
+
try { choco install ast-grep -y; return $LASTEXITCODE -eq 0 }
|
|
105
|
+
catch { return $false }
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function Try-Npm {
|
|
109
|
+
if (-not (Has-Cmd 'npm')) { return $false }
|
|
110
|
+
Log "trying: npm install -g @ast-grep/cli"
|
|
111
|
+
try { npm install -g '@ast-grep/cli'; return $LASTEXITCODE -eq 0 }
|
|
112
|
+
catch { return $false }
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function Try-Cargo {
|
|
116
|
+
if (Has-Cmd 'cargo-binstall') {
|
|
117
|
+
Log "trying: cargo binstall -y ast-grep"
|
|
118
|
+
try { cargo binstall -y ast-grep; if ($LASTEXITCODE -eq 0) { return $true } } catch {}
|
|
119
|
+
}
|
|
120
|
+
if (-not (Has-Cmd 'cargo')) { return $false }
|
|
121
|
+
Log "trying: cargo install ast-grep --locked"
|
|
122
|
+
try { cargo install ast-grep --locked; return $LASTEXITCODE -eq 0 }
|
|
123
|
+
catch { return $false }
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function Try-Pip {
|
|
127
|
+
$pip = $null
|
|
128
|
+
foreach ($p in 'pip3','pip','py') {
|
|
129
|
+
if (Has-Cmd $p) { $pip = $p; break }
|
|
130
|
+
}
|
|
131
|
+
if (-not $pip) { return $false }
|
|
132
|
+
Log "trying: $pip install --user ast-grep-cli"
|
|
133
|
+
try {
|
|
134
|
+
if ($pip -eq 'py') { py -m pip install --user ast-grep-cli }
|
|
135
|
+
else { & $pip install --user ast-grep-cli }
|
|
136
|
+
return $LASTEXITCODE -eq 0
|
|
137
|
+
} catch { return $false }
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function Triple-For-Windows {
|
|
141
|
+
switch ($Arch) {
|
|
142
|
+
'x86_64' { return 'x86_64-pc-windows-msvc' }
|
|
143
|
+
'aarch64' { return 'aarch64-pc-windows-msvc' }
|
|
144
|
+
default { return '' }
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function Try-Github {
|
|
149
|
+
$triple = Triple-For-Windows
|
|
150
|
+
if (-not $triple) {
|
|
151
|
+
Err "no GitHub release asset for arch $Arch"
|
|
152
|
+
return $false
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
$asset = "app-$triple.zip"
|
|
156
|
+
$url = "https://github.com/ast-grep/ast-grep/releases/download/$Version/$asset"
|
|
157
|
+
$tmp = Join-Path $env:TEMP ("ast-grep-install-" + [guid]::NewGuid().ToString('N').Substring(0,8))
|
|
158
|
+
New-Item -ItemType Directory -Path $tmp -Force | Out-Null
|
|
159
|
+
try {
|
|
160
|
+
Log "downloading $url"
|
|
161
|
+
Invoke-WebRequest -Uri $url -OutFile (Join-Path $tmp $asset) -UseBasicParsing
|
|
162
|
+
Expand-Archive -Path (Join-Path $tmp $asset) -DestinationPath (Join-Path $tmp 'extract') -Force
|
|
163
|
+
|
|
164
|
+
New-Item -ItemType Directory -Path $CacheBinDir -Force | Out-Null
|
|
165
|
+
|
|
166
|
+
$candidates = @(
|
|
167
|
+
(Join-Path $tmp 'extract/ast-grep.exe'),
|
|
168
|
+
(Join-Path $tmp 'extract/sg.exe')
|
|
169
|
+
)
|
|
170
|
+
$src = $null
|
|
171
|
+
foreach ($c in $candidates) {
|
|
172
|
+
if (Test-Path $c) { $src = $c; break }
|
|
173
|
+
}
|
|
174
|
+
if (-not $src) {
|
|
175
|
+
Err "no ast-grep.exe or sg.exe found inside $asset"
|
|
176
|
+
return $false
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
$dest = Join-Path $CacheBinDir 'sg.exe'
|
|
180
|
+
Copy-Item -Path $src -Destination $dest -Force
|
|
181
|
+
Log "installed cached binary: $dest"
|
|
182
|
+
Log "verify: & '$dest' --version"
|
|
183
|
+
Log ""
|
|
184
|
+
Log "Add to PATH for direct sg use:"
|
|
185
|
+
Log " `$env:Path = '$CacheBinDir;' + `$env:Path"
|
|
186
|
+
return $true
|
|
187
|
+
} finally {
|
|
188
|
+
Remove-Item -Recurse -Force $tmp -ErrorAction SilentlyContinue
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function Run-Method([string]$m) {
|
|
193
|
+
switch ($m) {
|
|
194
|
+
'scoop' { return Try-Scoop }
|
|
195
|
+
'winget' { return Try-Winget }
|
|
196
|
+
'choco' { return Try-Choco }
|
|
197
|
+
'npm' { return Try-Npm }
|
|
198
|
+
'cargo' { return Try-Cargo }
|
|
199
|
+
'pip' { return Try-Pip }
|
|
200
|
+
'github' { return Try-Github }
|
|
201
|
+
default { Err "unknown method: $m"; return $false }
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
if ($Method) {
|
|
206
|
+
if (Run-Method $Method) { exit 0 }
|
|
207
|
+
Err "method '$Method' failed"
|
|
208
|
+
exit 2
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
$methods = @('scoop', 'winget', 'choco', 'npm', 'cargo', 'pip')
|
|
212
|
+
foreach ($m in $methods) {
|
|
213
|
+
if (Run-Method $m) {
|
|
214
|
+
Log "installed via $m"
|
|
215
|
+
exit 0
|
|
216
|
+
}
|
|
217
|
+
Log "$m unavailable or failed; trying next"
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
if (-not $NoFallback) {
|
|
221
|
+
Log "all package managers failed; falling back to GitHub release"
|
|
222
|
+
if (Try-Github) { exit 0 }
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
Err "all install methods failed."
|
|
226
|
+
Err ""
|
|
227
|
+
Err "Manual options:"
|
|
228
|
+
Err " scoop install main/ast-grep # Scoop"
|
|
229
|
+
Err " winget install --id ast-grep.ast-grep # Winget"
|
|
230
|
+
Err " choco install ast-grep # Chocolatey"
|
|
231
|
+
Err " npm install -g @ast-grep/cli # any OS with Node"
|
|
232
|
+
Err " cargo install ast-grep --locked # any OS with Rust"
|
|
233
|
+
Err " pip install ast-grep-cli # any OS with Python"
|
|
234
|
+
Err " https://github.com/ast-grep/ast-grep/releases # manual binary"
|
|
235
|
+
exit 2
|