@prestyj/cli 5.28.0 → 5.29.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 +2 -2
- package/assets/motion/THIRD-PARTY.md +14 -19
- package/assets/motion/bin/contact-sheet.mjs +9 -3
- package/assets/motion/bin/cues.mjs +337 -0
- package/assets/motion/bin/flash-check.mjs +314 -0
- package/assets/motion/bin/fonts.mjs +17 -13
- package/assets/motion/bin/library.mjs +61 -18
- package/assets/motion/bin/motion-blur.mjs +943 -0
- package/assets/motion/bin/motion-check.mjs +366 -9
- package/assets/motion/bin/music-fit.mjs +436 -0
- package/assets/motion/bin/pdf-extract.mjs +22 -10
- package/assets/motion/bin/reference-study.mjs +346 -0
- package/assets/motion/bin/score-synth.mjs +1052 -93
- package/assets/motion/fonts/finger-paint/OFL.txt +93 -0
- package/assets/motion/fonts/finger-paint/finger-paint-normal.woff2 +0 -0
- package/assets/motion/fonts/fonts.json +56 -0
- package/assets/motion/fonts/short-stack/OFL.txt +94 -0
- package/assets/motion/fonts/short-stack/short-stack-normal.woff2 +0 -0
- package/assets/motion/fonts/sora/OFL.txt +93 -0
- package/assets/motion/fonts/sora/sora-normal.woff2 +0 -0
- package/assets/motion/fonts/specimen.jpg +0 -0
- package/assets/motion/fonts/unbounded/OFL.txt +93 -0
- package/assets/motion/fonts/unbounded/unbounded-normal.woff2 +0 -0
- package/assets/motion/library/README.md +52 -14
- package/assets/motion/library/kit/moves.js +1981 -0
- package/assets/motion/library/library.json +232 -0
- package/assets/motion/library/pieces/camera-rig/meta.json +13 -0
- package/assets/motion/library/pieces/camera-rig/piece.html +153 -0
- package/assets/motion/library/pieces/camera-rig/preview.jpg +0 -0
- package/assets/motion/library/pieces/chain-knock/meta.json +13 -0
- package/assets/motion/library/pieces/chain-knock/piece.html +195 -0
- package/assets/motion/library/pieces/chain-knock/preview.jpg +0 -0
- package/assets/motion/library/pieces/gather-to-logo/meta.json +13 -0
- package/assets/motion/library/pieces/gather-to-logo/piece.html +159 -0
- package/assets/motion/library/pieces/gather-to-logo/preview.jpg +0 -0
- package/assets/motion/library/pieces/morph-carry/meta.json +13 -0
- package/assets/motion/library/pieces/morph-carry/piece.html +173 -0
- package/assets/motion/library/pieces/morph-carry/preview.jpg +0 -0
- package/assets/motion/library/pieces/one-shape-journey/meta.json +13 -0
- package/assets/motion/library/pieces/one-shape-journey/piece.html +195 -0
- package/assets/motion/library/pieces/one-shape-journey/preview.jpg +0 -0
- package/assets/motion/library/pieces/open-from-subject/meta.json +13 -0
- package/assets/motion/library/pieces/open-from-subject/piece.html +168 -0
- package/assets/motion/library/pieces/open-from-subject/preview.jpg +0 -0
- package/assets/motion/library/pieces/request-to-result/meta.json +13 -0
- package/assets/motion/library/pieces/request-to-result/piece.html +212 -0
- package/assets/motion/library/pieces/request-to-result/preview.jpg +0 -0
- package/assets/motion/library/pieces/scale-dive/meta.json +13 -0
- package/assets/motion/library/pieces/scale-dive/piece.html +321 -0
- package/assets/motion/library/pieces/scale-dive/preview.jpg +0 -0
- package/assets/motion/library/pieces/screen-replica-steps/meta.json +13 -0
- package/assets/motion/library/pieces/screen-replica-steps/piece.html +366 -0
- package/assets/motion/library/pieces/screen-replica-steps/preview.jpg +0 -0
- package/assets/motion/library/pieces/zoom-into-card/meta.json +13 -0
- package/assets/motion/library/pieces/zoom-into-card/piece.html +179 -0
- package/assets/motion/library/pieces/zoom-into-card/preview.jpg +0 -0
- package/assets/motion/library/sheets/diagram.jpg +0 -0
- package/assets/motion/library/sheets/frame.jpg +0 -0
- package/assets/motion/library/sheets/transition.jpg +0 -0
- package/assets/motion/library/sheets/ui.jpg +0 -0
- package/assets/motion/plugin.json +1 -1
- package/assets/motion/references/build-sheet.md +206 -0
- package/assets/motion/references/runtime/determinism-rules.md +3 -3
- package/assets/motion/references/runtime/gsap-easing-and-stagger.md +28 -28
- package/assets/motion/references/runtime/gsap.md +3 -3
- package/assets/motion/references/runtime/inputs-and-assets.md +21 -16
- package/assets/motion/references/runtime/lint-validate-inspect.md +3 -3
- package/assets/motion/references/runtime/minimal-composition.md +6 -0
- package/assets/motion/references/runtime/preview-render.md +3 -3
- package/assets/motion/skills/app-walkthrough/SKILL.md +66 -0
- package/assets/motion/skills/before-after/SKILL.md +53 -0
- package/assets/motion/skills/brand-kit/SKILL.md +17 -16
- package/assets/motion/skills/dev-tool-video/SKILL.md +57 -0
- package/assets/motion/skills/launch-video/SKILL.md +62 -0
- package/assets/motion/skills/match-reference/SKILL.md +58 -0
- package/assets/motion/skills/motion/SKILL.md +167 -98
- package/assets/motion/skills/source-ingest/SKILL.md +23 -15
- package/assets/motion/skills/website-video/SKILL.md +59 -0
- package/assets/skills/bulletproof/SKILL.md +36 -11
- package/assets/skills/bulletproof/references/agent-surface.md +19 -9
- package/assets/skills/bulletproof/references/audit-protocol.md +20 -5
- package/assets/skills/bulletproof/references/platform-playbooks.md +5 -4
- package/assets/skills/bulletproof/references/provenance.md +26 -1
- package/assets/skills/bulletproof/references/secure-defaults.md +6 -5
- package/assets/skills/bulletproof/references/supply-chain.md +21 -17
- package/assets/skills/bulletproof/references/threat-landscape.md +28 -26
- package/assets/skills/bulletproof/references/verification.md +2 -0
- package/assets/skills/clarify/SKILL.md +25 -16
- package/assets/skills/code-review/SKILL.md +71 -13
- package/assets/skills/code-review/references/agent-diffs.md +27 -0
- package/assets/skills/code-review/references/tests.md +19 -0
- package/assets/skills/compliance-guard/SKILL.md +20 -5
- package/assets/skills/compliance-guard/references/artifacts.md +1 -1
- package/assets/skills/compliance-guard/references/eu-uk.md +16 -16
- package/assets/skills/compliance-guard/references/lawsuit-vectors.md +5 -5
- package/assets/skills/compliance-guard/references/provenance.md +41 -2
- package/assets/skills/compliance-guard/references/sector-gates.md +3 -3
- package/assets/skills/compliance-guard/references/security-baseline.md +2 -2
- package/assets/skills/compliance-guard/references/trigger-map.md +5 -5
- package/assets/skills/compliance-guard/references/us.md +27 -21
- package/assets/skills/durable/SKILL.md +87 -79
- package/assets/skills/durable/references/agent-db-safety.md +69 -0
- package/assets/skills/durable/references/backups-and-runtime.md +19 -12
- package/assets/skills/durable/references/migrations-and-schema.md +13 -6
- package/assets/skills/evidence-led-ui/SKILL.md +69 -127
- package/assets/skills/evidence-led-ui/references/anti-defaults.md +107 -208
- package/assets/skills/evidence-led-ui/references/direction.md +124 -0
- package/assets/skills/evidence-led-ui/references/production-contract.md +8 -0
- package/assets/skills/evidence-led-ui/references/provenance.md +24 -1
- package/assets/skills/lean/SKILL.md +90 -71
- package/assets/skills/lean/references/memory-and-processes.md +3 -2
- package/assets/skills/lean/references/playbooks.md +37 -12
- package/assets/skills/refactoring/SKILL.md +24 -3
- package/assets/skills/refactoring/references/agent-pitfalls.md +4 -1
- package/assets/skills/refactoring/references/legacy.md +21 -0
- package/assets/skills/root-cause/SKILL.md +20 -10
- package/assets/skills/shared-language/SKILL.md +16 -14
- package/assets/skills/tdd/SKILL.md +27 -15
- package/dist/app-sidecar.js +203 -47
- package/dist/app-sidecar.js.map +1 -1
- package/dist/cli.js +20 -28
- package/dist/cli.js.map +1 -1
- package/dist/core/acceptance-checks.d.ts +48 -0
- package/dist/core/acceptance-checks.js +144 -0
- package/dist/core/acceptance-checks.js.map +1 -0
- package/dist/core/agent-session.d.ts +119 -75
- package/dist/core/agent-session.js +561 -395
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/agents.d.ts +6 -5
- package/dist/core/agents.js +12 -3
- package/dist/core/agents.js.map +1 -1
- package/dist/core/ask-user.d.ts +90 -8
- package/dist/core/ask-user.js +124 -13
- package/dist/core/ask-user.js.map +1 -1
- package/dist/core/auth-providers.js +1 -1
- package/dist/core/auth-providers.js.map +1 -1
- package/dist/core/autopilot-verdict.d.ts +5 -1
- package/dist/core/autopilot-verdict.js +30 -13
- package/dist/core/autopilot-verdict.js.map +1 -1
- package/dist/core/bundled-agents.js +1 -3
- package/dist/core/bundled-agents.js.map +1 -1
- package/dist/core/cache-diagnostics.d.ts +68 -0
- package/dist/core/cache-diagnostics.js +196 -0
- package/dist/core/cache-diagnostics.js.map +1 -0
- package/dist/core/cache-expiry.d.ts +87 -0
- package/dist/core/cache-expiry.js +111 -0
- package/dist/core/cache-expiry.js.map +1 -0
- package/dist/core/compaction/compactor.js +78 -48
- package/dist/core/compaction/compactor.js.map +1 -1
- package/dist/core/compaction/plan-step-policy.d.ts +46 -0
- package/dist/core/compaction/plan-step-policy.js +57 -0
- package/dist/core/compaction/plan-step-policy.js.map +1 -0
- package/dist/core/destructive-git-guard.d.ts +90 -0
- package/dist/core/destructive-git-guard.js +871 -0
- package/dist/core/destructive-git-guard.js.map +1 -0
- package/dist/core/event-bus.d.ts +3 -0
- package/dist/core/event-bus.js +5 -0
- package/dist/core/event-bus.js.map +1 -1
- package/dist/core/fast-apply-benchmark.d.ts +1 -1
- package/dist/core/fast-apply-benchmark.js +2 -2
- package/dist/core/fast-apply-benchmark.js.map +1 -1
- package/dist/core/injection-detect.d.ts +38 -0
- package/dist/core/injection-detect.js +232 -0
- package/dist/core/injection-detect.js.map +1 -0
- package/dist/core/keep-awake.d.ts +88 -0
- package/dist/core/keep-awake.js +251 -0
- package/dist/core/keep-awake.js.map +1 -0
- package/dist/core/mcp/client.d.ts +72 -0
- package/dist/core/mcp/client.js +264 -41
- package/dist/core/mcp/client.js.map +1 -1
- package/dist/core/mcp/content.js +6 -2
- package/dist/core/mcp/content.js.map +1 -1
- package/dist/core/mcp/store.d.ts +6 -1
- package/dist/core/mcp/store.js +12 -1
- package/dist/core/mcp/store.js.map +1 -1
- package/dist/core/mcp/types.d.ts +18 -0
- package/dist/core/model-unavailable.d.ts +14 -0
- package/dist/core/model-unavailable.js +23 -0
- package/dist/core/model-unavailable.js.map +1 -0
- package/dist/core/node-debugger.d.ts +148 -0
- package/dist/core/node-debugger.js +642 -0
- package/dist/core/node-debugger.js.map +1 -0
- package/dist/core/nolan-context.d.ts +7 -5
- package/dist/core/nolan-context.js +106 -16
- package/dist/core/nolan-context.js.map +1 -1
- package/dist/core/nolan-prompt.js +24 -21
- package/dist/core/nolan-prompt.js.map +1 -1
- package/dist/core/package-threats.d.ts +18 -0
- package/dist/core/package-threats.js +168 -0
- package/dist/core/package-threats.js.map +1 -0
- package/dist/core/persistent-shell.d.ts +58 -6
- package/dist/core/persistent-shell.js +331 -49
- package/dist/core/persistent-shell.js.map +1 -1
- package/dist/core/process-manager.d.ts +14 -0
- package/dist/core/process-manager.js +61 -0
- package/dist/core/process-manager.js.map +1 -1
- package/dist/core/progress/git-xp.js +8 -14
- package/dist/core/progress/git-xp.js.map +1 -1
- package/dist/core/project-discovery.js +77 -26
- package/dist/core/project-discovery.js.map +1 -1
- package/dist/core/semantic-search-benchmark.d.ts +1 -1
- package/dist/core/semantic-search-benchmark.js +2 -2
- package/dist/core/semantic-search-benchmark.js.map +1 -1
- package/dist/core/session-history.d.ts +12 -0
- package/dist/core/session-history.js +27 -0
- package/dist/core/session-history.js.map +1 -1
- package/dist/core/session-manager.d.ts +13 -1
- package/dist/core/session-manager.js +38 -18
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/session-summary-index.d.ts +37 -0
- package/dist/core/session-summary-index.js +172 -0
- package/dist/core/session-summary-index.js.map +1 -0
- package/dist/core/settings-manager.d.ts +2 -0
- package/dist/core/settings-manager.js +10 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/shell-threats-popular-packages.d.ts +11 -0
- package/dist/core/shell-threats-popular-packages.js +675 -0
- package/dist/core/shell-threats-popular-packages.js.map +1 -0
- package/dist/core/shell-threats.d.ts +8 -0
- package/dist/core/shell-threats.js +186 -0
- package/dist/core/shell-threats.js.map +1 -0
- package/dist/core/skills.js +16 -4
- package/dist/core/skills.js.map +1 -1
- package/dist/core/stream-rules.d.ts +30 -0
- package/dist/core/stream-rules.js +151 -0
- package/dist/core/stream-rules.js.map +1 -0
- package/dist/core/subagent-manager.d.ts +23 -6
- package/dist/core/subagent-manager.js +25 -9
- package/dist/core/subagent-manager.js.map +1 -1
- package/dist/core/subagent-policy.js +1 -1
- package/dist/core/subagent-policy.js.map +1 -1
- package/dist/core/subagent-receipt.d.ts +54 -0
- package/dist/core/subagent-receipt.js +276 -0
- package/dist/core/subagent-receipt.js.map +1 -0
- package/dist/core/subagent-turn-record.d.ts +2 -0
- package/dist/core/subagent-turn-record.js.map +1 -1
- package/dist/core/test-impact.d.ts +73 -0
- package/dist/core/test-impact.js +467 -0
- package/dist/core/test-impact.js.map +1 -0
- package/dist/core/thinking-level.d.ts +1 -1
- package/dist/core/thinking-level.js +1 -1
- package/dist/core/thinking-level.js.map +1 -1
- package/dist/core/verification-gate.d.ts +2 -0
- package/dist/core/verification-gate.js +4 -0
- package/dist/core/verification-gate.js.map +1 -1
- package/dist/core/verification-snapshot.js +3 -5
- package/dist/core/verification-snapshot.js.map +1 -1
- package/dist/core/workspace-guard.d.ts +18 -7
- package/dist/core/workspace-guard.js +227 -60
- package/dist/core/workspace-guard.js.map +1 -1
- package/dist/core/worktree-setup.d.ts +23 -0
- package/dist/core/worktree-setup.js +128 -9
- package/dist/core/worktree-setup.js.map +1 -1
- package/dist/core/worktree.d.ts +20 -2
- package/dist/core/worktree.js +74 -31
- package/dist/core/worktree.js.map +1 -1
- package/dist/interactive.js +2 -1
- package/dist/interactive.js.map +1 -1
- package/dist/modes/json-mode.js +11 -2
- package/dist/modes/json-mode.js.map +1 -1
- package/dist/modes/subagent-worker-mode.d.ts +36 -1
- package/dist/modes/subagent-worker-mode.js +100 -42
- package/dist/modes/subagent-worker-mode.js.map +1 -1
- package/dist/motion-agent/motion-agent.d.ts +7 -3
- package/dist/motion-agent/motion-agent.js +6 -8
- package/dist/motion-agent/motion-agent.js.map +1 -1
- package/dist/motion-agent/motion-prompt.d.ts +1 -1
- package/dist/motion-agent/motion-prompt.js +16 -25
- package/dist/motion-agent/motion-prompt.js.map +1 -1
- package/dist/motion-agent/motion-review-session.js +1 -1
- package/dist/motion-agent/motion-review-session.js.map +1 -1
- package/dist/motion-agent/motion-review.d.ts +10 -3
- package/dist/motion-agent/motion-review.js +15 -7
- package/dist/motion-agent/motion-review.js.map +1 -1
- package/dist/motion-agent/motion-studio-context.js +1 -1
- package/dist/motion-agent/motion-studio-context.js.map +1 -1
- package/dist/system-prompt.d.ts +2 -1
- package/dist/system-prompt.js +15 -4
- package/dist/system-prompt.js.map +1 -1
- package/dist/test-support/keep-alive.d.ts +14 -0
- package/dist/test-support/keep-alive.js +17 -0
- package/dist/test-support/keep-alive.js.map +1 -0
- package/dist/tools/ask-user.js +3 -3
- package/dist/tools/ask-user.js.map +1 -1
- package/dist/tools/bash-read-evidence.d.ts +10 -0
- package/dist/tools/bash-read-evidence.js +133 -0
- package/dist/tools/bash-read-evidence.js.map +1 -0
- package/dist/tools/bash.d.ts +10 -1
- package/dist/tools/bash.js +179 -7
- package/dist/tools/bash.js.map +1 -1
- package/dist/tools/debug.d.ts +54 -0
- package/dist/tools/debug.js +233 -0
- package/dist/tools/debug.js.map +1 -0
- package/dist/tools/edit.js +13 -5
- package/dist/tools/edit.js.map +1 -1
- package/dist/tools/goals.d.ts +1 -1
- package/dist/tools/index.d.ts +25 -2
- package/dist/tools/index.js +48 -7
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/prompt-hints.js +2 -0
- package/dist/tools/prompt-hints.js.map +1 -1
- package/dist/tools/read-tracker.d.ts +35 -2
- package/dist/tools/read-tracker.js +108 -11
- package/dist/tools/read-tracker.js.map +1 -1
- package/dist/tools/read.js +39 -7
- package/dist/tools/read.js.map +1 -1
- package/dist/tools/skill.js +5 -0
- package/dist/tools/skill.js.map +1 -1
- package/dist/tools/subagent-control.js +44 -8
- package/dist/tools/subagent-control.js.map +1 -1
- package/dist/tools/subagent-shared.d.ts +48 -8
- package/dist/tools/subagent-shared.js +75 -14
- package/dist/tools/subagent-shared.js.map +1 -1
- package/dist/tools/subagent.d.ts +8 -2
- package/dist/tools/subagent.js +28 -10
- package/dist/tools/subagent.js.map +1 -1
- package/dist/tools/task-output.js +3 -2
- package/dist/tools/task-output.js.map +1 -1
- package/dist/tools/task-send.d.ts +1 -1
- package/dist/tools/task-send.js +15 -1
- package/dist/tools/task-send.js.map +1 -1
- package/dist/tools/tool-tiers.d.ts +2 -2
- package/dist/tools/tool-tiers.js +3 -2
- package/dist/tools/tool-tiers.js.map +1 -1
- package/dist/tools/truncate.d.ts +21 -0
- package/dist/tools/truncate.js +187 -0
- package/dist/tools/truncate.js.map +1 -1
- package/dist/tools/ui-adopt.js +2 -0
- package/dist/tools/ui-adopt.js.map +1 -1
- package/dist/tools/write.js +4 -3
- package/dist/tools/write.js.map +1 -1
- package/dist/ui/App.d.ts +0 -4
- package/dist/ui/App.js +5 -28
- package/dist/ui/App.js.map +1 -1
- package/dist/ui/components/ActivityIndicator.js +1 -0
- package/dist/ui/components/ActivityIndicator.js.map +1 -1
- package/dist/ui/components/Footer.js +1 -1
- package/dist/ui/components/Footer.js.map +1 -1
- package/dist/ui/hooks/useAgentLoop.d.ts +1 -8
- package/dist/ui/hooks/useAgentLoop.js +1 -119
- package/dist/ui/hooks/useAgentLoop.js.map +1 -1
- package/dist/ui/render.d.ts +2 -4
- package/dist/ui/render.js +3 -2
- package/dist/ui/render.js.map +1 -1
- package/dist/utils/git.d.ts +77 -0
- package/dist/utils/git.js +285 -21
- package/dist/utils/git.js.map +1 -1
- package/dist/utils/github-ci.js +2 -1
- package/dist/utils/github-ci.js.map +1 -1
- package/dist/utils/github.js +11 -9
- package/dist/utils/github.js.map +1 -1
- package/dist/utils/image.d.ts +14 -0
- package/dist/utils/image.js +16 -0
- package/dist/utils/image.js.map +1 -1
- package/dist/utils/process.d.ts +20 -0
- package/dist/utils/process.js +98 -0
- package/dist/utils/process.js.map +1 -1
- package/dist/utils/text.d.ts +12 -0
- package/dist/utils/text.js +11 -0
- package/dist/utils/text.js.map +1 -1
- package/package.json +6 -6
- package/assets/motion/skills/mixkit-split-text-617/SKILL.md +0 -115
- package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-480.json +0 -1
- package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-494.json +0 -1
- package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-5.json +0 -1
- package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-508.json +0 -1
- package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-6525.json +0 -1
- package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-6539.json +0 -1
- package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-6647.json +0 -1
- package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-6663.json +0 -1
- package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-6677.json +0 -1
- package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-6691.json +0 -1
- package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-6706.json +0 -1
- package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-6722.json +0 -1
- package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-6736.json +0 -1
- package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-6750.json +0 -1
- package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-6764.json +0 -1
- package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-6780.json +0 -1
- package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-6794.json +0 -1
- package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-6810.json +0 -1
- package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-6823.json +0 -1
- package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-6872.json +0 -1
- package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-6936.json +0 -1
- package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-76.json +0 -1
- package/assets/motion/skills/mixkit-split-text-617/data/manifest.json +0 -495
- package/assets/motion/skills/mixkit-split-text-617/references/RECONSTRUCTION.md +0 -201
- package/assets/motion/skills/mixkit-split-text-617/references/VERIFICATION.md +0 -107
- package/assets/motion/skills/mixkit-split-text-617/tools/inspect_motion.py +0 -130
- package/assets/motion/skills/video-qa/SKILL.md +0 -66
- package/dist/core/ideal-review-subagent.d.ts +0 -42
- package/dist/core/ideal-review-subagent.js +0 -95
- package/dist/core/ideal-review-subagent.js.map +0 -1
- package/dist/core/ideal-review.d.ts +0 -82
- package/dist/core/ideal-review.js +0 -242
- package/dist/core/ideal-review.js.map +0 -1
- package/dist/motion-agent/motion-check-tool.d.ts +0 -21
- package/dist/motion-agent/motion-check-tool.js +0 -206
- package/dist/motion-agent/motion-check-tool.js.map +0 -1
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { execFile } from "node:child_process";
|
|
2
1
|
import { createHash } from "node:crypto";
|
|
3
2
|
import fs from "node:fs/promises";
|
|
4
3
|
import { constants } from "node:fs";
|
|
5
4
|
import path from "node:path";
|
|
6
|
-
import {
|
|
7
|
-
const exec = promisify(execFile);
|
|
5
|
+
import { runBackgroundGit } from "../utils/git.js";
|
|
8
6
|
const MAX_FILES = 10_000;
|
|
9
7
|
const MAX_BYTES = 128 * 1024 * 1024;
|
|
10
8
|
const MAX_MS = 5000;
|
|
@@ -17,9 +15,9 @@ const MAX_MS = 5000;
|
|
|
17
15
|
export async function captureVerificationSnapshot(cwd, editedFiles = []) {
|
|
18
16
|
const deadline = Date.now() + MAX_MS;
|
|
19
17
|
try {
|
|
20
|
-
const git = async (args) => (await
|
|
18
|
+
const git = async (args) => (await runBackgroundGit(args, {
|
|
21
19
|
cwd,
|
|
22
|
-
|
|
20
|
+
timeoutMs: Math.max(1, deadline - Date.now()),
|
|
23
21
|
maxBuffer: 2 * 1024 * 1024,
|
|
24
22
|
})).stdout;
|
|
25
23
|
const root = await fs.realpath((await git(["rev-parse", "--show-toplevel"])).trim());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verification-snapshot.js","sourceRoot":"","sources":["../../src/core/verification-snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"verification-snapshot.js","sourceRoot":"","s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AAS,CAAC;gBACT,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;YACvB,CAAC;QACH,CAAC;QACD,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,MAAM,IAAI,EAAE,CAAC;YAClF,OAAO,IAAI,CAAC;QACd,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
* allow-listed roots are blocked with an instructive tool error unless the
|
|
6
6
|
* user opted in via the `allowOutsideWorkspaceWrites` setting. The bash tool
|
|
7
7
|
* additionally refuses a tiny set of unambiguous filesystem disasters
|
|
8
|
-
* (recursive
|
|
9
|
-
* root, and mirror force-pushes) until the user
|
|
8
|
+
* (recursive removal of /, ~, $HOME, the workspace root or anything that
|
|
9
|
+
* contains them, a bare drive root, and mirror force-pushes) until the user
|
|
10
|
+
* explicitly confirms.
|
|
10
11
|
*
|
|
11
12
|
* Deliberately narrow: ordinary `rm -rf node_modules`, `git reset --hard`,
|
|
12
13
|
* etc. stay instructional (ask-first at the prompt level), exactly as today.
|
|
@@ -33,13 +34,23 @@ export interface WriteGuardResult {
|
|
|
33
34
|
*/
|
|
34
35
|
export declare function resolveWriteGuard(cwd: string, resolvedPath: string, settings?: WriteGuardSettings): WriteGuardResult;
|
|
35
36
|
/**
|
|
36
|
-
* Match only the unambiguous disasters
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
37
|
+
* Match only the unambiguous disasters, wherever they sit in the command —
|
|
38
|
+
* after `;`/`&&`/`||`/pipes, inside `if`/`for`/`while`/`{ }`/`( )`, behind
|
|
39
|
+
* wrappers (`sudo`, `env`, `timeout`, `nohup`, `nice`, `exec`, `time`,
|
|
40
|
+
* `xargs`, …), inside `bash -c`/`eval`/`pwsh -c`, and after a `cd`:
|
|
41
|
+
* - recursive `rm` (any flag spelling, any path form of the command) of a
|
|
42
|
+
* filesystem root, `~`/`$HOME`, the workspace root, a directory containing
|
|
43
|
+
* either, or the whole contents of one (`/*`, `cd ~ && rm -rf *`)
|
|
44
|
+
* - the same through PowerShell `Remove-Item -Recurse` and cmd `rd /s`
|
|
45
|
+
* - `find` deleting from root/home, or from the workspace with no filter
|
|
40
46
|
* - `git push --force --mirror` (mirror force-push rewrites every ref)
|
|
41
47
|
*
|
|
42
48
|
* Returns an error string telling the model to get explicit user confirmation,
|
|
43
|
-
* or null when the command is not catastrophic.
|
|
49
|
+
* or null when the command is not catastrophic. Pure: nothing is executed.
|
|
50
|
+
*
|
|
51
|
+
* Backslashes are read both ways: as bash escapes, and literally, as cmd.exe
|
|
52
|
+
* and PowerShell (the Windows fallbacks) read them, where `C:\Users\me` is a
|
|
53
|
+
* path rather than `C:Usersme`. Either reading hitting a protected directory
|
|
54
|
+
* blocks the command.
|
|
44
55
|
*/
|
|
45
56
|
export declare function isCatastrophicCommand(command: string, cwd: string): string | null;
|
|
@@ -2,6 +2,7 @@ import { realpathSync } from "node:fs";
|
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { getAppPaths } from "../config.js";
|
|
5
|
+
import { commandName, expandShellPath, walkShell, } from "./destructive-git-guard.js";
|
|
5
6
|
import { getTempRoots } from "./temp-paths.js";
|
|
6
7
|
/** True when `target` is `root` or contained within it. */
|
|
7
8
|
function isWithin(root, target) {
|
|
@@ -87,81 +88,247 @@ export function resolveWriteGuard(cwd, resolvedPath, settings) {
|
|
|
87
88
|
};
|
|
88
89
|
}
|
|
89
90
|
// ── Catastrophic command guard ─────────────────────────────
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
91
|
+
const CONFIRM_NOTE = "This command is irreversible and destroys data far beyond the workspace. " +
|
|
92
|
+
"Get explicit user confirmation first, then re-run it quoting the user's words " +
|
|
93
|
+
"authorizing it.";
|
|
94
|
+
/** Commands the guard inspects. `echo`/`printf` feed `… | xargs rm`. */
|
|
95
|
+
const INSPECTED = new Set([
|
|
96
|
+
"rm",
|
|
97
|
+
"rd",
|
|
98
|
+
"rmdir",
|
|
99
|
+
"del",
|
|
100
|
+
"erase",
|
|
101
|
+
"remove-item",
|
|
102
|
+
"ri",
|
|
103
|
+
"find",
|
|
104
|
+
"git",
|
|
105
|
+
"echo",
|
|
106
|
+
"printf",
|
|
107
|
+
]);
|
|
108
|
+
/** The directory a whole-contents glob empties: `X/*`, `X/.*` → X; `*`, `.*` → `.`. */
|
|
109
|
+
function globParent(target) {
|
|
110
|
+
if (target === "*" || target === ".*")
|
|
111
|
+
return ".";
|
|
112
|
+
const match = /^(.*)[\\/]\.?\*$/.exec(target);
|
|
113
|
+
if (!match)
|
|
114
|
+
return target;
|
|
115
|
+
return match[1] === "" ? "/" : (match[1] ?? target);
|
|
99
116
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
if (
|
|
117
|
+
function resolveTarget(target, runCwd) {
|
|
118
|
+
return path.resolve(runCwd, expandShellPath(target, runCwd));
|
|
119
|
+
}
|
|
120
|
+
/** A filesystem root (`/`, `C:\`), including a bare drive spec as written. */
|
|
121
|
+
function isRoot(target, resolved) {
|
|
122
|
+
return /^[A-Za-z]:[\\/]?$/.test(target) || resolved === path.parse(resolved).root;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Recursive removal of `rawTarget` is never acceptable without confirmation
|
|
126
|
+
* when it is a filesystem root, the home directory, the workspace root, or a
|
|
127
|
+
* directory containing either of the last two. `runCwd` is where the command
|
|
128
|
+
* runs (after any `cd`); `workspace` is the session's project root.
|
|
129
|
+
*/
|
|
130
|
+
function isCatastrophicRemovalTarget(rawTarget, runCwd, workspace) {
|
|
131
|
+
const target = globParent(rawTarget);
|
|
132
|
+
const resolved = resolveTarget(target, runCwd);
|
|
133
|
+
if (isRoot(target, resolved))
|
|
117
134
|
return true;
|
|
118
|
-
return
|
|
135
|
+
return [os.homedir(), workspace].some((protectedDir) => isWithin(resolved, path.resolve(protectedDir)));
|
|
136
|
+
}
|
|
137
|
+
/** `rm`: recursive flag in any spelling (`-r`, `-R`, `-rf`, `--recursive`, `-Recurse`) and operands. */
|
|
138
|
+
function parseRm(args) {
|
|
139
|
+
let recursive = false;
|
|
140
|
+
const targets = [];
|
|
141
|
+
let options = true;
|
|
142
|
+
for (const arg of args) {
|
|
143
|
+
if (options && arg === "--") {
|
|
144
|
+
options = false;
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
if (options && arg.startsWith("--") && arg.length > 2) {
|
|
148
|
+
if ("--recursive".startsWith(arg) && arg.length >= 3)
|
|
149
|
+
recursive = true;
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
if (options && /^-[A-Za-z]+$/.test(arg)) {
|
|
153
|
+
if (/[rR]/.test(arg))
|
|
154
|
+
recursive = true;
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
targets.push(arg);
|
|
158
|
+
}
|
|
159
|
+
return { recursive, targets };
|
|
160
|
+
}
|
|
161
|
+
const PS_PATH_PARAMS = /^-(?:path|literalpath|lp|pspath)$/i;
|
|
162
|
+
const PS_VALUE_PARAMS = /^-(?:filter|include|exclude|credential|stream)$/i;
|
|
163
|
+
const PS_RECURSE = /^-r(?:e(?:c(?:u(?:r(?:s(?:e)?)?)?)?)?)?$/i;
|
|
164
|
+
/** PowerShell `Remove-Item` (alias `ri`): `-Recurse` plus `-Path`/positional targets. */
|
|
165
|
+
function parseRemoveItem(args) {
|
|
166
|
+
const targets = [];
|
|
167
|
+
let recursive = false;
|
|
168
|
+
for (let i = 0; i < args.length; i += 1) {
|
|
169
|
+
const arg = args[i] ?? "";
|
|
170
|
+
if (PS_RECURSE.test(arg))
|
|
171
|
+
recursive = true;
|
|
172
|
+
else if (PS_PATH_PARAMS.test(arg)) {
|
|
173
|
+
if (args[i + 1] !== undefined)
|
|
174
|
+
targets.push(args[i + 1] ?? "");
|
|
175
|
+
i += 1;
|
|
176
|
+
}
|
|
177
|
+
else if (PS_VALUE_PARAMS.test(arg))
|
|
178
|
+
i += 1;
|
|
179
|
+
else if (!arg.startsWith("-"))
|
|
180
|
+
targets.push(arg);
|
|
181
|
+
}
|
|
182
|
+
return { recursive, targets };
|
|
183
|
+
}
|
|
184
|
+
/** cmd.exe `rd /s`, `rmdir /s`, `del /s`, `erase /s`. */
|
|
185
|
+
function parseCmdRemove(args) {
|
|
186
|
+
return {
|
|
187
|
+
recursive: args.some((a) => /^\/s$/i.test(a)),
|
|
188
|
+
targets: args.filter((a) => !/^\/[A-Za-z]$/.test(a)),
|
|
189
|
+
};
|
|
119
190
|
}
|
|
191
|
+
/** find predicates that do not narrow which files match. */
|
|
192
|
+
const FIND_NON_FILTERS = new Set([
|
|
193
|
+
"-delete",
|
|
194
|
+
"-depth",
|
|
195
|
+
"-d",
|
|
196
|
+
"-mindepth",
|
|
197
|
+
"-maxdepth",
|
|
198
|
+
"-xdev",
|
|
199
|
+
"-mount",
|
|
200
|
+
"-print",
|
|
201
|
+
"-print0",
|
|
202
|
+
"-follow",
|
|
203
|
+
"-noleaf",
|
|
204
|
+
"-ignore_readdir_race",
|
|
205
|
+
]);
|
|
206
|
+
const FIND_EXEC = /^-(?:exec|execdir|ok|okdir)$/;
|
|
207
|
+
const DELETERS = new Set(["rm", "rmdir", "unlink", "shred"]);
|
|
120
208
|
/**
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
|
|
209
|
+
* `find START… -delete` or `-exec rm …`. Blocks when a start is a root, home,
|
|
210
|
+
* or contains home — always; and when it is (or contains) the workspace with
|
|
211
|
+
* no narrowing test (`find . -name '*.log' -delete` is ordinary cleanup).
|
|
212
|
+
*/
|
|
213
|
+
function checkFind(call, workspace) {
|
|
214
|
+
const { args } = call;
|
|
215
|
+
let i = 0;
|
|
216
|
+
while (i < args.length && /^-(?:[HLP]|O\d)$/.test(args[i] ?? ""))
|
|
217
|
+
i += 1;
|
|
218
|
+
const starts = [];
|
|
219
|
+
while (i < args.length && !/^[-(!]/.test(args[i] ?? "")) {
|
|
220
|
+
starts.push(args[i] ?? "");
|
|
221
|
+
i += 1;
|
|
222
|
+
}
|
|
223
|
+
let deletes = false;
|
|
224
|
+
let filtered = false;
|
|
225
|
+
const rest = args.slice(i);
|
|
226
|
+
for (let j = 0; j < rest.length; j += 1) {
|
|
227
|
+
const arg = rest[j] ?? "";
|
|
228
|
+
if (arg === "-delete")
|
|
229
|
+
deletes = true;
|
|
230
|
+
if (FIND_EXEC.test(arg)) {
|
|
231
|
+
if (DELETERS.has(commandName(rest[j + 1] ?? "")))
|
|
232
|
+
deletes = true;
|
|
233
|
+
// Skip the exec'd command up to its `;` / `+` terminator.
|
|
234
|
+
while (j + 1 < rest.length && rest[j + 1] !== ";" && rest[j + 1] !== "+")
|
|
235
|
+
j += 1;
|
|
236
|
+
j += 1;
|
|
237
|
+
continue;
|
|
238
|
+
}
|
|
239
|
+
if ((arg.startsWith("-") && !FIND_NON_FILTERS.has(arg)) || arg === "!" || arg === "(")
|
|
240
|
+
filtered = true;
|
|
241
|
+
}
|
|
242
|
+
if (!deletes)
|
|
243
|
+
return null;
|
|
244
|
+
for (const start of starts.length > 0 ? starts : ["."]) {
|
|
245
|
+
const resolved = resolveTarget(start, call.cwd);
|
|
246
|
+
const severe = isRoot(start, resolved) || isWithin(resolved, path.resolve(os.homedir()));
|
|
247
|
+
const wipesWorkspace = !filtered && isWithin(resolved, path.resolve(workspace));
|
|
248
|
+
if (severe || wipesWorkspace) {
|
|
249
|
+
return `Refusing to run: find deletes everything under ${start}. ${CONFIRM_NOTE}`;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return null;
|
|
253
|
+
}
|
|
254
|
+
/** `git push --force --mirror` (either order; `-f` counts as `--force`). */
|
|
255
|
+
function isMirrorForcePush(args) {
|
|
256
|
+
const push = args.indexOf("push");
|
|
257
|
+
if (push === -1)
|
|
258
|
+
return false;
|
|
259
|
+
const rest = args.slice(push + 1);
|
|
260
|
+
return (rest.includes("--mirror") &&
|
|
261
|
+
(rest.includes("--force") || rest.some((a) => /^-[A-Za-z]*f[A-Za-z]*$/.test(a))));
|
|
262
|
+
}
|
|
263
|
+
/** Operands an `echo`/`printf` would hand to a following `| xargs`. */
|
|
264
|
+
function echoedOperands(call) {
|
|
265
|
+
if (!call || (call.name !== "echo" && call.name !== "printf"))
|
|
266
|
+
return [];
|
|
267
|
+
return call.args.filter((a) => !/^-[neE]+$/.test(a));
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Match only the unambiguous disasters, wherever they sit in the command —
|
|
271
|
+
* after `;`/`&&`/`||`/pipes, inside `if`/`for`/`while`/`{ }`/`( )`, behind
|
|
272
|
+
* wrappers (`sudo`, `env`, `timeout`, `nohup`, `nice`, `exec`, `time`,
|
|
273
|
+
* `xargs`, …), inside `bash -c`/`eval`/`pwsh -c`, and after a `cd`:
|
|
274
|
+
* - recursive `rm` (any flag spelling, any path form of the command) of a
|
|
275
|
+
* filesystem root, `~`/`$HOME`, the workspace root, a directory containing
|
|
276
|
+
* either, or the whole contents of one (`/*`, `cd ~ && rm -rf *`)
|
|
277
|
+
* - the same through PowerShell `Remove-Item -Recurse` and cmd `rd /s`
|
|
278
|
+
* - `find` deleting from root/home, or from the workspace with no filter
|
|
125
279
|
* - `git push --force --mirror` (mirror force-push rewrites every ref)
|
|
126
280
|
*
|
|
127
281
|
* Returns an error string telling the model to get explicit user confirmation,
|
|
128
|
-
* or null when the command is not catastrophic.
|
|
282
|
+
* or null when the command is not catastrophic. Pure: nothing is executed.
|
|
283
|
+
*
|
|
284
|
+
* Backslashes are read both ways: as bash escapes, and literally, as cmd.exe
|
|
285
|
+
* and PowerShell (the Windows fallbacks) read them, where `C:\Users\me` is a
|
|
286
|
+
* path rather than `C:Usersme`. Either reading hitting a protected directory
|
|
287
|
+
* blocks the command.
|
|
129
288
|
*/
|
|
130
289
|
export function isCatastrophicCommand(command, cwd) {
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}
|
|
290
|
+
const readings = command.includes("\\") ? [command, command.replaceAll("\\", "\\\\")] : [command];
|
|
291
|
+
for (const reading of readings) {
|
|
292
|
+
const blocked = checkCalls(walkShell(reading, cwd, (name) => INSPECTED.has(name.toLowerCase())), cwd);
|
|
293
|
+
if (blocked)
|
|
294
|
+
return blocked;
|
|
295
|
+
}
|
|
296
|
+
return null;
|
|
297
|
+
}
|
|
298
|
+
function checkCalls(calls, cwd) {
|
|
299
|
+
for (const [index, call] of calls.entries()) {
|
|
300
|
+
const name = call.name.toLowerCase();
|
|
301
|
+
if (name === "git") {
|
|
302
|
+
if (isMirrorForcePush(call.args)) {
|
|
303
|
+
return `Refusing to run: mirror force-push rewrites every ref on the remote. ${CONFIRM_NOTE}`;
|
|
146
304
|
}
|
|
305
|
+
continue;
|
|
147
306
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
307
|
+
if (name === "find") {
|
|
308
|
+
const blocked = checkFind(call, cwd);
|
|
309
|
+
if (blocked)
|
|
310
|
+
return blocked;
|
|
311
|
+
continue;
|
|
312
|
+
}
|
|
313
|
+
const parsed = name === "rm"
|
|
314
|
+
? parseRm(call.args)
|
|
315
|
+
: name === "remove-item" || name === "ri"
|
|
316
|
+
? parseRemoveItem(call.args)
|
|
317
|
+
: name === "rd" || name === "rmdir" || name === "del" || name === "erase"
|
|
318
|
+
? parseCmdRemove(call.args)
|
|
319
|
+
: null;
|
|
320
|
+
if (!parsed?.recursive)
|
|
321
|
+
continue;
|
|
322
|
+
// `echo ~ | xargs rm -rf`: the operands arrive on stdin from the echo.
|
|
323
|
+
const targets = call.viaXargs && parsed.targets.length === 0
|
|
324
|
+
? echoedOperands(calls[index - 1])
|
|
325
|
+
: parsed.targets;
|
|
153
326
|
for (const target of targets) {
|
|
154
|
-
if (isCatastrophicRemovalTarget(target, cwd)) {
|
|
155
|
-
return `Refusing to run: recursive removal of ${
|
|
327
|
+
if (isCatastrophicRemovalTarget(target, call.cwd, cwd)) {
|
|
328
|
+
return `Refusing to run: recursive removal of ${target}. ${CONFIRM_NOTE}`;
|
|
156
329
|
}
|
|
157
330
|
}
|
|
158
331
|
}
|
|
159
|
-
// git push --force --mirror (in either order; -f counts as --force)
|
|
160
|
-
if (/(?:^|[;&|]\s*)git\s+push\b/.test(command) &&
|
|
161
|
-
/\s--mirror\b/.test(command) &&
|
|
162
|
-
/\s(?:--force\b|-f\b)/.test(command)) {
|
|
163
|
-
return `Refusing to run: mirror force-push rewrites every ref on the remote. ${confirmNote}`;
|
|
164
|
-
}
|
|
165
332
|
return null;
|
|
166
333
|
}
|
|
167
334
|
//# sourceMappingURL=workspace-guard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-guard.js","sourceRoot":"","sources":["../../src/core/workspace-guard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,i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AAI,IAAI,KAAK,OAAO,IAAI,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,OAAO;oBACvE,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC;oBAC3B,CAAC,CAAC,IAAI,CAAC;QACf,IAAI,CAAC,MAAM,EAAE,SAAS;YAAE,SAAS;QACjC,uEAAuE;QACvE,MAAM,OAAO,GACX,IAAI,CAAC,QAAQ,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC;YAC1C,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;YAClC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;QACrB,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,IAAI,2BAA2B,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;gBACvD,OAAO,yCAAyC,MAAM,KAAK,YAAY,EAAE,CAAC;YAC5E,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -31,6 +31,29 @@ export interface InstallResult {
|
|
|
31
31
|
/** Why it failed, trimmed to the tail that names the cause. Set when !ok. */
|
|
32
32
|
message?: string;
|
|
33
33
|
}
|
|
34
|
+
/** How to actually start an install command on this machine. */
|
|
35
|
+
export interface InstallLaunch {
|
|
36
|
+
command: string;
|
|
37
|
+
args: string[];
|
|
38
|
+
/** Run through the system shell (Windows `.cmd`/`.bat` shims only). */
|
|
39
|
+
shell: boolean;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Turn an install command into something the OS can start, or null when the
|
|
43
|
+
* tool is not installed.
|
|
44
|
+
*
|
|
45
|
+
* Off Windows this is the command as-is. On Windows, a shell-less spawn of a
|
|
46
|
+
* bare `npm` fails with ENOENT (no PATHEXT lookup), and since CVE-2024-27980
|
|
47
|
+
* Node refuses to spawn `npm.cmd` without a shell at all. So:
|
|
48
|
+
* - npm runs as `node <npm-cli.js>`, the same "never the shim, always the
|
|
49
|
+
* real script" route the MCP launcher uses (no shell involved);
|
|
50
|
+
* - a tool that resolves to a real `.exe` (bun, uv) runs directly;
|
|
51
|
+
* - a tool that only exists as a `.cmd`/`.bat` shim (pnpm, yarn via npm or
|
|
52
|
+
* corepack) runs through `cmd.exe`. That is safe HERE because the whole
|
|
53
|
+
* command line comes from the fixed table in `detectInstallCommands` — the
|
|
54
|
+
* repo path travels as `cwd`, never as text the shell parses.
|
|
55
|
+
*/
|
|
56
|
+
export declare function resolveInstallLaunch(cmd: InstallCommand, env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform, exists?: (p: string) => boolean): InstallLaunch | null;
|
|
34
57
|
export interface WorktreePreparation {
|
|
35
58
|
/** Repo-relative ignored config files copied into the copy. */
|
|
36
59
|
carried: string[];
|