@openclaw/tokenjuice 2026.5.28
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 +35 -0
- package/dist/index.js +13 -0
- package/dist/runtime-api.js +2 -0
- package/dist/tool-result-middleware.js +34 -0
- package/node_modules/tokenjuice/LICENSE +21 -0
- package/node_modules/tokenjuice/README.md +311 -0
- package/node_modules/tokenjuice/SECURITY.md +50 -0
- package/node_modules/tokenjuice/dist/cli/doctor-output.d.ts +2 -0
- package/node_modules/tokenjuice/dist/cli/doctor-output.js +92 -0
- package/node_modules/tokenjuice/dist/cli/install-output.d.ts +5 -0
- package/node_modules/tokenjuice/dist/cli/install-output.js +11 -0
- package/node_modules/tokenjuice/dist/cli/main.d.ts +34 -0
- package/node_modules/tokenjuice/dist/cli/main.js +6614 -0
- package/node_modules/tokenjuice/dist/core/analysis.d.ts +88 -0
- package/node_modules/tokenjuice/dist/core/analysis.js +313 -0
- package/node_modules/tokenjuice/dist/core/artifacts.d.ts +9 -0
- package/node_modules/tokenjuice/dist/core/artifacts.js +210 -0
- package/node_modules/tokenjuice/dist/core/builtin-rules.generated.d.ts +2 -0
- package/node_modules/tokenjuice/dist/core/builtin-rules.generated.js +262 -0
- package/node_modules/tokenjuice/dist/core/classify.d.ts +18 -0
- package/node_modules/tokenjuice/dist/core/classify.js +181 -0
- package/node_modules/tokenjuice/dist/core/cli-client.d.ts +2 -0
- package/node_modules/tokenjuice/dist/core/cli-client.js +127 -0
- package/node_modules/tokenjuice/dist/core/command-identity.d.ts +9 -0
- package/node_modules/tokenjuice/dist/core/command-identity.js +201 -0
- package/node_modules/tokenjuice/dist/core/command-match.d.ts +16 -0
- package/node_modules/tokenjuice/dist/core/command-match.js +443 -0
- package/node_modules/tokenjuice/dist/core/command-shell.d.ts +18 -0
- package/node_modules/tokenjuice/dist/core/command-shell.js +291 -0
- package/node_modules/tokenjuice/dist/core/command.d.ts +5 -0
- package/node_modules/tokenjuice/dist/core/command.js +4 -0
- package/node_modules/tokenjuice/dist/core/compaction-metadata.d.ts +10 -0
- package/node_modules/tokenjuice/dist/core/compaction-metadata.js +28 -0
- package/node_modules/tokenjuice/dist/core/env.d.ts +1 -0
- package/node_modules/tokenjuice/dist/core/env.js +5 -0
- package/node_modules/tokenjuice/dist/core/execution-input.d.ts +2 -0
- package/node_modules/tokenjuice/dist/core/execution-input.js +51 -0
- package/node_modules/tokenjuice/dist/core/fixtures.d.ts +14 -0
- package/node_modules/tokenjuice/dist/core/fixtures.js +190 -0
- package/node_modules/tokenjuice/dist/core/github-actions-summary.d.ts +6 -0
- package/node_modules/tokenjuice/dist/core/github-actions-summary.js +105 -0
- package/node_modules/tokenjuice/dist/core/integrations/compact-bash-result.d.ts +33 -0
- package/node_modules/tokenjuice/dist/core/integrations/compact-bash-result.js +85 -0
- package/node_modules/tokenjuice/dist/core/integrations/rewrite-policy.d.ts +8 -0
- package/node_modules/tokenjuice/dist/core/integrations/rewrite-policy.js +25 -0
- package/node_modules/tokenjuice/dist/core/inventory-safety.d.ts +11 -0
- package/node_modules/tokenjuice/dist/core/inventory-safety.js +347 -0
- package/node_modules/tokenjuice/dist/core/json-protocol.d.ts +2 -0
- package/node_modules/tokenjuice/dist/core/json-protocol.js +131 -0
- package/node_modules/tokenjuice/dist/core/reduce-formatters.d.ts +15 -0
- package/node_modules/tokenjuice/dist/core/reduce-formatters.js +611 -0
- package/node_modules/tokenjuice/dist/core/reduce-inspection-summary.d.ts +9 -0
- package/node_modules/tokenjuice/dist/core/reduce-inspection-summary.js +125 -0
- package/node_modules/tokenjuice/dist/core/reduce-utils.d.ts +12 -0
- package/node_modules/tokenjuice/dist/core/reduce-utils.js +117 -0
- package/node_modules/tokenjuice/dist/core/reduce.d.ts +5 -0
- package/node_modules/tokenjuice/dist/core/reduce.js +511 -0
- package/node_modules/tokenjuice/dist/core/rules.d.ts +22 -0
- package/node_modules/tokenjuice/dist/core/rules.js +265 -0
- package/node_modules/tokenjuice/dist/core/source.d.ts +6 -0
- package/node_modules/tokenjuice/dist/core/source.js +113 -0
- package/node_modules/tokenjuice/dist/core/text.d.ts +23 -0
- package/node_modules/tokenjuice/dist/core/text.js +204 -0
- package/node_modules/tokenjuice/dist/core/time.d.ts +2 -0
- package/node_modules/tokenjuice/dist/core/time.js +82 -0
- package/node_modules/tokenjuice/dist/core/validate-rules.d.ts +10 -0
- package/node_modules/tokenjuice/dist/core/validate-rules.js +198 -0
- package/node_modules/tokenjuice/dist/core/wrap.d.ts +2 -0
- package/node_modules/tokenjuice/dist/core/wrap.js +104 -0
- package/node_modules/tokenjuice/dist/hosts/adal/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/adal/index.js +157 -0
- package/node_modules/tokenjuice/dist/hosts/aether/index.d.ts +30 -0
- package/node_modules/tokenjuice/dist/hosts/aether/index.js +671 -0
- package/node_modules/tokenjuice/dist/hosts/agent-layer/index.d.ts +25 -0
- package/node_modules/tokenjuice/dist/hosts/agent-layer/index.js +173 -0
- package/node_modules/tokenjuice/dist/hosts/agentinit/index.d.ts +27 -0
- package/node_modules/tokenjuice/dist/hosts/agentinit/index.js +252 -0
- package/node_modules/tokenjuice/dist/hosts/agentlink/index.d.ts +26 -0
- package/node_modules/tokenjuice/dist/hosts/agentlink/index.js +310 -0
- package/node_modules/tokenjuice/dist/hosts/agentloom/index.d.ts +24 -0
- package/node_modules/tokenjuice/dist/hosts/agentloom/index.js +161 -0
- package/node_modules/tokenjuice/dist/hosts/agents-cli/index.d.ts +26 -0
- package/node_modules/tokenjuice/dist/hosts/agents-cli/index.js +136 -0
- package/node_modules/tokenjuice/dist/hosts/agents-md/index.d.ts +24 -0
- package/node_modules/tokenjuice/dist/hosts/agents-md/index.js +240 -0
- package/node_modules/tokenjuice/dist/hosts/agentsge/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/agentsge/index.js +119 -0
- package/node_modules/tokenjuice/dist/hosts/agentsmesh/index.d.ts +26 -0
- package/node_modules/tokenjuice/dist/hosts/agentsmesh/index.js +337 -0
- package/node_modules/tokenjuice/dist/hosts/ai-memory-protocol/index.d.ts +24 -0
- package/node_modules/tokenjuice/dist/hosts/ai-memory-protocol/index.js +392 -0
- package/node_modules/tokenjuice/dist/hosts/aictl/index.d.ts +24 -0
- package/node_modules/tokenjuice/dist/hosts/aictl/index.js +271 -0
- package/node_modules/tokenjuice/dist/hosts/aider/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/aider/index.js +79 -0
- package/node_modules/tokenjuice/dist/hosts/amazon-q/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/amazon-q/index.js +169 -0
- package/node_modules/tokenjuice/dist/hosts/amp/index.d.ts +26 -0
- package/node_modules/tokenjuice/dist/hosts/amp/index.js +306 -0
- package/node_modules/tokenjuice/dist/hosts/antigravity/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/antigravity/index.js +172 -0
- package/node_modules/tokenjuice/dist/hosts/anywhere-agents/index.d.ts +26 -0
- package/node_modules/tokenjuice/dist/hosts/anywhere-agents/index.js +260 -0
- package/node_modules/tokenjuice/dist/hosts/augment/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/augment/index.js +171 -0
- package/node_modules/tokenjuice/dist/hosts/avante/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/avante/index.js +68 -0
- package/node_modules/tokenjuice/dist/hosts/baz/index.d.ts +25 -0
- package/node_modules/tokenjuice/dist/hosts/baz/index.js +286 -0
- package/node_modules/tokenjuice/dist/hosts/bito/index.d.ts +28 -0
- package/node_modules/tokenjuice/dist/hosts/bito/index.js +363 -0
- package/node_modules/tokenjuice/dist/hosts/blackbox/index.d.ts +25 -0
- package/node_modules/tokenjuice/dist/hosts/blackbox/index.js +305 -0
- package/node_modules/tokenjuice/dist/hosts/blocks/index.d.ts +25 -0
- package/node_modules/tokenjuice/dist/hosts/blocks/index.js +317 -0
- package/node_modules/tokenjuice/dist/hosts/bob/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/bob/index.js +155 -0
- package/node_modules/tokenjuice/dist/hosts/builder/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/builder/index.js +177 -0
- package/node_modules/tokenjuice/dist/hosts/charlie/index.d.ts +25 -0
- package/node_modules/tokenjuice/dist/hosts/charlie/index.js +275 -0
- package/node_modules/tokenjuice/dist/hosts/claude-code/index.d.ts +30 -0
- package/node_modules/tokenjuice/dist/hosts/claude-code/index.js +364 -0
- package/node_modules/tokenjuice/dist/hosts/clawdbot/index.d.ts +25 -0
- package/node_modules/tokenjuice/dist/hosts/clawdbot/index.js +320 -0
- package/node_modules/tokenjuice/dist/hosts/cline/index.d.ts +27 -0
- package/node_modules/tokenjuice/dist/hosts/cline/index.js +156 -0
- package/node_modules/tokenjuice/dist/hosts/codeant/index.d.ts +25 -0
- package/node_modules/tokenjuice/dist/hosts/codeant/index.js +370 -0
- package/node_modules/tokenjuice/dist/hosts/codebuddy/index.d.ts +29 -0
- package/node_modules/tokenjuice/dist/hosts/codebuddy/index.js +379 -0
- package/node_modules/tokenjuice/dist/hosts/codebuff/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/codebuff/index.js +155 -0
- package/node_modules/tokenjuice/dist/hosts/codegen/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/codegen/index.js +155 -0
- package/node_modules/tokenjuice/dist/hosts/coder-agents/index.d.ts +24 -0
- package/node_modules/tokenjuice/dist/hosts/coder-agents/index.js +339 -0
- package/node_modules/tokenjuice/dist/hosts/coderabbit/index.d.ts +25 -0
- package/node_modules/tokenjuice/dist/hosts/coderabbit/index.js +599 -0
- package/node_modules/tokenjuice/dist/hosts/codex/index.d.ts +93 -0
- package/node_modules/tokenjuice/dist/hosts/codex/index.js +945 -0
- package/node_modules/tokenjuice/dist/hosts/command-code/index.d.ts +29 -0
- package/node_modules/tokenjuice/dist/hosts/command-code/index.js +366 -0
- package/node_modules/tokenjuice/dist/hosts/continue/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/continue/index.js +81 -0
- package/node_modules/tokenjuice/dist/hosts/copilot-agent/index.d.ts +29 -0
- package/node_modules/tokenjuice/dist/hosts/copilot-agent/index.js +497 -0
- package/node_modules/tokenjuice/dist/hosts/copilot-cli/index.d.ts +31 -0
- package/node_modules/tokenjuice/dist/hosts/copilot-cli/index.js +428 -0
- package/node_modules/tokenjuice/dist/hosts/crush/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/crush/index.js +135 -0
- package/node_modules/tokenjuice/dist/hosts/cursor/index.d.ts +30 -0
- package/node_modules/tokenjuice/dist/hosts/cursor/index.js +293 -0
- package/node_modules/tokenjuice/dist/hosts/deepagents/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/deepagents/index.js +157 -0
- package/node_modules/tokenjuice/dist/hosts/devin/index.d.ts +31 -0
- package/node_modules/tokenjuice/dist/hosts/devin/index.js +283 -0
- package/node_modules/tokenjuice/dist/hosts/docker-agent/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/docker-agent/index.js +206 -0
- package/node_modules/tokenjuice/dist/hosts/dot-agents/index.d.ts +26 -0
- package/node_modules/tokenjuice/dist/hosts/dot-agents/index.js +171 -0
- package/node_modules/tokenjuice/dist/hosts/droid/index.d.ts +26 -0
- package/node_modules/tokenjuice/dist/hosts/droid/index.js +313 -0
- package/node_modules/tokenjuice/dist/hosts/eca/index.d.ts +24 -0
- package/node_modules/tokenjuice/dist/hosts/eca/index.js +347 -0
- package/node_modules/tokenjuice/dist/hosts/elyra/index.d.ts +24 -0
- package/node_modules/tokenjuice/dist/hosts/elyra/index.js +382 -0
- package/node_modules/tokenjuice/dist/hosts/firebase-studio/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/firebase-studio/index.js +155 -0
- package/node_modules/tokenjuice/dist/hosts/forgecode/index.d.ts +24 -0
- package/node_modules/tokenjuice/dist/hosts/forgecode/index.js +273 -0
- package/node_modules/tokenjuice/dist/hosts/gemini-cli/index.d.ts +26 -0
- package/node_modules/tokenjuice/dist/hosts/gemini-cli/index.js +234 -0
- package/node_modules/tokenjuice/dist/hosts/gitlab-duo/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/gitlab-duo/index.js +155 -0
- package/node_modules/tokenjuice/dist/hosts/goose/index.d.ts +26 -0
- package/node_modules/tokenjuice/dist/hosts/goose/index.js +288 -0
- package/node_modules/tokenjuice/dist/hosts/gptme/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/gptme/index.js +155 -0
- package/node_modules/tokenjuice/dist/hosts/greptile/index.d.ts +25 -0
- package/node_modules/tokenjuice/dist/hosts/greptile/index.js +299 -0
- package/node_modules/tokenjuice/dist/hosts/grok-build/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/grok-build/index.js +155 -0
- package/node_modules/tokenjuice/dist/hosts/grok-cli/index.d.ts +26 -0
- package/node_modules/tokenjuice/dist/hosts/grok-cli/index.js +262 -0
- package/node_modules/tokenjuice/dist/hosts/jean2/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/jean2/index.js +155 -0
- package/node_modules/tokenjuice/dist/hosts/jetbrains-ai/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/jetbrains-ai/index.js +202 -0
- package/node_modules/tokenjuice/dist/hosts/jules/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/jules/index.js +155 -0
- package/node_modules/tokenjuice/dist/hosts/junie/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/junie/index.js +68 -0
- package/node_modules/tokenjuice/dist/hosts/kilo/index.d.ts +30 -0
- package/node_modules/tokenjuice/dist/hosts/kilo/index.js +497 -0
- package/node_modules/tokenjuice/dist/hosts/kimi/index.d.ts +29 -0
- package/node_modules/tokenjuice/dist/hosts/kimi/index.js +255 -0
- package/node_modules/tokenjuice/dist/hosts/kiro/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/kiro/index.js +116 -0
- package/node_modules/tokenjuice/dist/hosts/knowns/index.d.ts +24 -0
- package/node_modules/tokenjuice/dist/hosts/knowns/index.js +273 -0
- package/node_modules/tokenjuice/dist/hosts/leanctl/index.d.ts +24 -0
- package/node_modules/tokenjuice/dist/hosts/leanctl/index.js +317 -0
- package/node_modules/tokenjuice/dist/hosts/localcode/index.d.ts +31 -0
- package/node_modules/tokenjuice/dist/hosts/localcode/index.js +539 -0
- package/node_modules/tokenjuice/dist/hosts/mcp-agent/index.d.ts +24 -0
- package/node_modules/tokenjuice/dist/hosts/mcp-agent/index.js +302 -0
- package/node_modules/tokenjuice/dist/hosts/mini-swe-agent/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/mini-swe-agent/index.js +226 -0
- package/node_modules/tokenjuice/dist/hosts/mistral-vibe/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/mistral-vibe/index.js +155 -0
- package/node_modules/tokenjuice/dist/hosts/mux/index.d.ts +28 -0
- package/node_modules/tokenjuice/dist/hosts/mux/index.js +411 -0
- package/node_modules/tokenjuice/dist/hosts/novakit/index.d.ts +24 -0
- package/node_modules/tokenjuice/dist/hosts/novakit/index.js +273 -0
- package/node_modules/tokenjuice/dist/hosts/ona/index.d.ts +41 -0
- package/node_modules/tokenjuice/dist/hosts/ona/index.js +596 -0
- package/node_modules/tokenjuice/dist/hosts/open-interpreter/index.d.ts +26 -0
- package/node_modules/tokenjuice/dist/hosts/open-interpreter/index.js +348 -0
- package/node_modules/tokenjuice/dist/hosts/openclaw/extension.d.ts +8 -0
- package/node_modules/tokenjuice/dist/hosts/openclaw/extension.js +104 -0
- package/node_modules/tokenjuice/dist/hosts/openclaw/index.d.ts +1 -0
- package/node_modules/tokenjuice/dist/hosts/openclaw/index.js +1 -0
- package/node_modules/tokenjuice/dist/hosts/opencode/extension/runtime.d.ts +17 -0
- package/node_modules/tokenjuice/dist/hosts/opencode/extension/runtime.js +9094 -0
- package/node_modules/tokenjuice/dist/hosts/opencode/index.d.ts +21 -0
- package/node_modules/tokenjuice/dist/hosts/opencode/index.js +163 -0
- package/node_modules/tokenjuice/dist/hosts/openhands/index.d.ts +28 -0
- package/node_modules/tokenjuice/dist/hosts/openhands/index.js +211 -0
- package/node_modules/tokenjuice/dist/hosts/openwebui/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/openwebui/index.js +245 -0
- package/node_modules/tokenjuice/dist/hosts/pi/extension/pi-types.d.ts +79 -0
- package/node_modules/tokenjuice/dist/hosts/pi/extension/pi-types.js +3 -0
- package/node_modules/tokenjuice/dist/hosts/pi/extension/runtime.d.ts +5 -0
- package/node_modules/tokenjuice/dist/hosts/pi/extension/runtime.js +9372 -0
- package/node_modules/tokenjuice/dist/hosts/pi/extension/settings.d.ts +1 -0
- package/node_modules/tokenjuice/dist/hosts/pi/extension/settings.js +26 -0
- package/node_modules/tokenjuice/dist/hosts/pi/extension/status-panel.d.ts +3 -0
- package/node_modules/tokenjuice/dist/hosts/pi/extension/status-panel.js +72 -0
- package/node_modules/tokenjuice/dist/hosts/pi/extension/status.d.ts +20 -0
- package/node_modules/tokenjuice/dist/hosts/pi/extension/status.js +58 -0
- package/node_modules/tokenjuice/dist/hosts/pi/extension/tool-result.d.ts +4 -0
- package/node_modules/tokenjuice/dist/hosts/pi/extension/tool-result.js +24 -0
- package/node_modules/tokenjuice/dist/hosts/pi/extension/utils.d.ts +1 -0
- package/node_modules/tokenjuice/dist/hosts/pi/extension/utils.js +6 -0
- package/node_modules/tokenjuice/dist/hosts/pi/index.d.ts +26 -0
- package/node_modules/tokenjuice/dist/hosts/pi/index.js +228 -0
- package/node_modules/tokenjuice/dist/hosts/pi-go/index.d.ts +24 -0
- package/node_modules/tokenjuice/dist/hosts/pi-go/index.js +352 -0
- package/node_modules/tokenjuice/dist/hosts/plandex/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/plandex/index.js +164 -0
- package/node_modules/tokenjuice/dist/hosts/qoder/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/qoder/index.js +155 -0
- package/node_modules/tokenjuice/dist/hosts/qodo/index.d.ts +24 -0
- package/node_modules/tokenjuice/dist/hosts/qodo/index.js +584 -0
- package/node_modules/tokenjuice/dist/hosts/qwen-code/index.d.ts +28 -0
- package/node_modules/tokenjuice/dist/hosts/qwen-code/index.js +276 -0
- package/node_modules/tokenjuice/dist/hosts/replit/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/replit/index.js +155 -0
- package/node_modules/tokenjuice/dist/hosts/roo/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/roo/index.js +101 -0
- package/node_modules/tokenjuice/dist/hosts/rovo/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/rovo/index.js +155 -0
- package/node_modules/tokenjuice/dist/hosts/ruler/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/ruler/index.js +157 -0
- package/node_modules/tokenjuice/dist/hosts/shared/hook-command-doctor.d.ts +19 -0
- package/node_modules/tokenjuice/dist/hosts/shared/hook-command-doctor.js +32 -0
- package/node_modules/tokenjuice/dist/hosts/shared/hook-command.d.ts +5 -0
- package/node_modules/tokenjuice/dist/hosts/shared/hook-command.js +94 -0
- package/node_modules/tokenjuice/dist/hosts/shared/hook-doctor.d.ts +212 -0
- package/node_modules/tokenjuice/dist/hosts/shared/hook-doctor.js +270 -0
- package/node_modules/tokenjuice/dist/hosts/shared/hook-output.d.ts +4 -0
- package/node_modules/tokenjuice/dist/hosts/shared/hook-output.js +15 -0
- package/node_modules/tokenjuice/dist/hosts/shared/hooks-json-file.d.ts +18 -0
- package/node_modules/tokenjuice/dist/hosts/shared/hooks-json-file.js +108 -0
- package/node_modules/tokenjuice/dist/hosts/shared/host-command.d.ts +10 -0
- package/node_modules/tokenjuice/dist/hosts/shared/host-command.js +70 -0
- package/node_modules/tokenjuice/dist/hosts/shared/instruction-doctor.d.ts +16 -0
- package/node_modules/tokenjuice/dist/hosts/shared/instruction-doctor.js +13 -0
- package/node_modules/tokenjuice/dist/hosts/shared/instruction-file.d.ts +29 -0
- package/node_modules/tokenjuice/dist/hosts/shared/instruction-file.js +121 -0
- package/node_modules/tokenjuice/dist/hosts/shared/instruction-guidance.d.ts +7 -0
- package/node_modules/tokenjuice/dist/hosts/shared/instruction-guidance.js +12 -0
- package/node_modules/tokenjuice/dist/hosts/shared/marker-instructions.d.ts +32 -0
- package/node_modules/tokenjuice/dist/hosts/shared/marker-instructions.js +100 -0
- package/node_modules/tokenjuice/dist/hosts/shared/pre-tool-wrap.d.ts +91 -0
- package/node_modules/tokenjuice/dist/hosts/shared/pre-tool-wrap.js +186 -0
- package/node_modules/tokenjuice/dist/hosts/shared/tool-result.d.ts +15 -0
- package/node_modules/tokenjuice/dist/hosts/shared/tool-result.js +52 -0
- package/node_modules/tokenjuice/dist/hosts/stagewise/index.d.ts +25 -0
- package/node_modules/tokenjuice/dist/hosts/stagewise/index.js +468 -0
- package/node_modules/tokenjuice/dist/hosts/swe-agent/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/swe-agent/index.js +223 -0
- package/node_modules/tokenjuice/dist/hosts/tabby/index.d.ts +24 -0
- package/node_modules/tokenjuice/dist/hosts/tabby/index.js +469 -0
- package/node_modules/tokenjuice/dist/hosts/tabnine/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/tabnine/index.js +155 -0
- package/node_modules/tokenjuice/dist/hosts/trae/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/trae/index.js +155 -0
- package/node_modules/tokenjuice/dist/hosts/uipath/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/uipath/index.js +155 -0
- package/node_modules/tokenjuice/dist/hosts/vscode-copilot/index.d.ts +32 -0
- package/node_modules/tokenjuice/dist/hosts/vscode-copilot/index.js +416 -0
- package/node_modules/tokenjuice/dist/hosts/warp/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/warp/index.js +181 -0
- package/node_modules/tokenjuice/dist/hosts/windsurf/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/windsurf/index.js +99 -0
- package/node_modules/tokenjuice/dist/hosts/zed/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/zed/index.js +68 -0
- package/node_modules/tokenjuice/dist/hosts/zencoder/index.d.ts +23 -0
- package/node_modules/tokenjuice/dist/hosts/zencoder/index.js +227 -0
- package/node_modules/tokenjuice/dist/index.d.ts +214 -0
- package/node_modules/tokenjuice/dist/index.js +113 -0
- package/node_modules/tokenjuice/dist/rules/archive/tar.json +30 -0
- package/node_modules/tokenjuice/dist/rules/archive/unzip.json +30 -0
- package/node_modules/tokenjuice/dist/rules/archive/zip.json +30 -0
- package/node_modules/tokenjuice/dist/rules/build/cmake.json +35 -0
- package/node_modules/tokenjuice/dist/rules/build/dotnet.json +36 -0
- package/node_modules/tokenjuice/dist/rules/build/esbuild.json +35 -0
- package/node_modules/tokenjuice/dist/rules/build/go-build.json +31 -0
- package/node_modules/tokenjuice/dist/rules/build/gradle.json +35 -0
- package/node_modules/tokenjuice/dist/rules/build/maven.json +35 -0
- package/node_modules/tokenjuice/dist/rules/build/msbuild.json +35 -0
- package/node_modules/tokenjuice/dist/rules/build/pnpm-build.json +44 -0
- package/node_modules/tokenjuice/dist/rules/build/swift-build.json +56 -0
- package/node_modules/tokenjuice/dist/rules/build/tsc.json +74 -0
- package/node_modules/tokenjuice/dist/rules/build/tsdown.json +35 -0
- package/node_modules/tokenjuice/dist/rules/build/vite.json +42 -0
- package/node_modules/tokenjuice/dist/rules/build/webpack.json +51 -0
- package/node_modules/tokenjuice/dist/rules/build/xcodebuild.json +80 -0
- package/node_modules/tokenjuice/dist/rules/cloud/aws.json +30 -0
- package/node_modules/tokenjuice/dist/rules/cloud/az.json +30 -0
- package/node_modules/tokenjuice/dist/rules/cloud/flyctl.json +30 -0
- package/node_modules/tokenjuice/dist/rules/cloud/gcloud.json +30 -0
- package/node_modules/tokenjuice/dist/rules/cloud/gh.json +30 -0
- package/node_modules/tokenjuice/dist/rules/cloud/vercel.json +30 -0
- package/node_modules/tokenjuice/dist/rules/database/mongosh.json +30 -0
- package/node_modules/tokenjuice/dist/rules/database/mysql.json +30 -0
- package/node_modules/tokenjuice/dist/rules/database/psql.json +30 -0
- package/node_modules/tokenjuice/dist/rules/database/redis-cli.json +30 -0
- package/node_modules/tokenjuice/dist/rules/database/sqlite3.json +30 -0
- package/node_modules/tokenjuice/dist/rules/devops/docker-build.json +53 -0
- package/node_modules/tokenjuice/dist/rules/devops/docker-compose.json +44 -0
- package/node_modules/tokenjuice/dist/rules/devops/docker-images.json +30 -0
- package/node_modules/tokenjuice/dist/rules/devops/docker-logs.json +43 -0
- package/node_modules/tokenjuice/dist/rules/devops/docker-ps.json +30 -0
- package/node_modules/tokenjuice/dist/rules/devops/helm.json +35 -0
- package/node_modules/tokenjuice/dist/rules/devops/kubectl-describe.json +45 -0
- package/node_modules/tokenjuice/dist/rules/devops/kubectl-get.json +35 -0
- package/node_modules/tokenjuice/dist/rules/devops/kubectl-logs.json +43 -0
- package/node_modules/tokenjuice/dist/rules/devops/pulumi.json +35 -0
- package/node_modules/tokenjuice/dist/rules/devops/terraform.json +35 -0
- package/node_modules/tokenjuice/dist/rules/devops/terragrunt.json +35 -0
- package/node_modules/tokenjuice/dist/rules/filesystem/fd.json +33 -0
- package/node_modules/tokenjuice/dist/rules/filesystem/find.json +42 -0
- package/node_modules/tokenjuice/dist/rules/filesystem/git-ls-files.json +35 -0
- package/node_modules/tokenjuice/dist/rules/filesystem/ls.json +29 -0
- package/node_modules/tokenjuice/dist/rules/filesystem/rg-files.json +34 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/archive/tar.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/archive/unzip.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/archive/zip.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/build/cmake.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/build/dotnet.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/build/esbuild.fixture.json +15 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/build/go-build.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/build/gradle.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/build/maven.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/build/msbuild.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/build/pnpm-build-failure.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/build/pnpm-build.fixture.json +18 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/build/swift-build.fixture.json +29 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/build/tsc.fixture.json +15 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/build/tsdown.fixture.json +15 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/build/vite.fixture.json +15 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/build/webpack.fixture.json +20 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/build/xcodebuild.fixture.json +27 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/cloud/aws.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/cloud/az.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/cloud/flyctl.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/cloud/gcloud.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/cloud/gh.fixture.json +17 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/cloud/vercel.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/database/mongosh.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/database/mysql.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/database/psql.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/database/redis-cli.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/database/sqlite3.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/devops/docker-build.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/devops/docker-compose.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/devops/docker-images.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/devops/docker-logs.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/devops/docker-ps.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/devops/helm.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/devops/kubectl-describe.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/devops/kubectl-get.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/devops/kubectl-logs.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/devops/pulumi.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/devops/terraform.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/devops/terragrunt.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/filesystem/fd.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/filesystem/find.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/filesystem/git-ls-files.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/filesystem/ls.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/filesystem/rg-files.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/generic/fallback.fixture.json +15 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/generic/help.fixture.json +17 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/git/branch.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/git/diff-name-only.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/git/diff-stat.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/git/diff.fixture.json +26 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/git/log-oneline.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/git/remote-v.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/git/show.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/git/stash-list.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/git/status.fixture.json +17 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/git/worktree-list.fixture.json +17 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/install/bun-install-up-to-date.fixture.json +19 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/install/bun-install.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/install/npm-ci-up-to-date.fixture.json +19 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/install/npm-ci.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/install/npm-install-up-to-date.fixture.json +19 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/install/npm-install.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/install/pnpm-install-up-to-date.fixture.json +19 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/install/pnpm-install.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/install/yarn-install-up-to-date.fixture.json +19 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/install/yarn-install.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/lint/biome.fixture.json +15 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/lint/eslint.fixture.json +15 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/lint/oxlint.fixture.json +15 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/lint/prettier-check.fixture.json +15 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/media/ffmpeg.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/media/mediainfo.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/network/curl.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/network/dig.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/network/nslookup.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/network/ping.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/network/ssh.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/network/traceroute.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/network/wget.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/observability/free.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/observability/htop.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/observability/iostat.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/observability/top.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/observability/vmstat.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/openclaw/sessions-history.fixture.json +33 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/package/apt-install.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/package/apt-upgrade.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/package/brew-install.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/package/brew-upgrade.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/package/composer.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/package/dnf-install.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/package/fnm.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/package/npm-ls.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/package/yum-install.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/search/git-grep.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/search/grep.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/search/rg.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/service/journalctl.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/service/launchctl.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/service/lsof.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/service/netstat.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/service/pm2.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/service/service.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/service/ss.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/service/systemctl-status.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/system/df.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/system/du.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/system/file.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/system/ps.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/task/env.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/task/just.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/task/make.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/task/mise.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/task/node.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/task/php.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/task/python.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/task/ruby.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/task/uv.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/tests/bun-test.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/tests/cargo-test.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/tests/go-test.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/tests/jest.fixture.json +15 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/tests/mocha.fixture.json +15 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/tests/npm-test.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/tests/playwright.fixture.json +15 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/tests/pnpm-test.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/tests/pytest.fixture.json +19 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/tests/rspec.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/tests/swift-test.fixture.json +30 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/tests/vitest.fixture.json +15 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/tests/yarn-test.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/text/wc.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/transfer/rsync.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/fixtures/transfer/scp.fixture.json +16 -0
- package/node_modules/tokenjuice/dist/rules/generic/fallback.json +32 -0
- package/node_modules/tokenjuice/dist/rules/generic/help.json +25 -0
- package/node_modules/tokenjuice/dist/rules/git/branch.json +29 -0
- package/node_modules/tokenjuice/dist/rules/git/diff-name-only.json +29 -0
- package/node_modules/tokenjuice/dist/rules/git/diff-stat.json +37 -0
- package/node_modules/tokenjuice/dist/rules/git/diff.json +65 -0
- package/node_modules/tokenjuice/dist/rules/git/log-oneline.json +30 -0
- package/node_modules/tokenjuice/dist/rules/git/remote-v.json +29 -0
- package/node_modules/tokenjuice/dist/rules/git/show.json +50 -0
- package/node_modules/tokenjuice/dist/rules/git/stash-list.json +30 -0
- package/node_modules/tokenjuice/dist/rules/git/status.json +54 -0
- package/node_modules/tokenjuice/dist/rules/git/worktree-list.json +31 -0
- package/node_modules/tokenjuice/dist/rules/install/bun-install.json +43 -0
- package/node_modules/tokenjuice/dist/rules/install/npm-ci.json +49 -0
- package/node_modules/tokenjuice/dist/rules/install/npm-install.json +49 -0
- package/node_modules/tokenjuice/dist/rules/install/pnpm-install.json +43 -0
- package/node_modules/tokenjuice/dist/rules/install/yarn-install.json +42 -0
- package/node_modules/tokenjuice/dist/rules/lint/biome.json +35 -0
- package/node_modules/tokenjuice/dist/rules/lint/eslint.json +45 -0
- package/node_modules/tokenjuice/dist/rules/lint/oxlint.json +35 -0
- package/node_modules/tokenjuice/dist/rules/lint/prettier-check.json +34 -0
- package/node_modules/tokenjuice/dist/rules/media/ffmpeg.json +30 -0
- package/node_modules/tokenjuice/dist/rules/media/mediainfo.json +30 -0
- package/node_modules/tokenjuice/dist/rules/network/curl.json +30 -0
- package/node_modules/tokenjuice/dist/rules/network/dig.json +30 -0
- package/node_modules/tokenjuice/dist/rules/network/nslookup.json +30 -0
- package/node_modules/tokenjuice/dist/rules/network/ping.json +35 -0
- package/node_modules/tokenjuice/dist/rules/network/ssh.json +30 -0
- package/node_modules/tokenjuice/dist/rules/network/traceroute.json +30 -0
- package/node_modules/tokenjuice/dist/rules/network/wget.json +30 -0
- package/node_modules/tokenjuice/dist/rules/observability/free.json +30 -0
- package/node_modules/tokenjuice/dist/rules/observability/htop.json +30 -0
- package/node_modules/tokenjuice/dist/rules/observability/iostat.json +30 -0
- package/node_modules/tokenjuice/dist/rules/observability/top.json +30 -0
- package/node_modules/tokenjuice/dist/rules/observability/vmstat.json +30 -0
- package/node_modules/tokenjuice/dist/rules/openclaw/sessions-history.json +59 -0
- package/node_modules/tokenjuice/dist/rules/package/apt-install.json +36 -0
- package/node_modules/tokenjuice/dist/rules/package/apt-upgrade.json +36 -0
- package/node_modules/tokenjuice/dist/rules/package/brew-install.json +31 -0
- package/node_modules/tokenjuice/dist/rules/package/brew-upgrade.json +31 -0
- package/node_modules/tokenjuice/dist/rules/package/composer.json +35 -0
- package/node_modules/tokenjuice/dist/rules/package/dnf-install.json +31 -0
- package/node_modules/tokenjuice/dist/rules/package/fnm.json +35 -0
- package/node_modules/tokenjuice/dist/rules/package/npm-ls.json +31 -0
- package/node_modules/tokenjuice/dist/rules/package/yum-install.json +31 -0
- package/node_modules/tokenjuice/dist/rules/search/git-grep.json +30 -0
- package/node_modules/tokenjuice/dist/rules/search/grep.json +38 -0
- package/node_modules/tokenjuice/dist/rules/search/rg.json +38 -0
- package/node_modules/tokenjuice/dist/rules/service/journalctl.json +42 -0
- package/node_modules/tokenjuice/dist/rules/service/launchctl.json +41 -0
- package/node_modules/tokenjuice/dist/rules/service/lsof.json +29 -0
- package/node_modules/tokenjuice/dist/rules/service/netstat.json +29 -0
- package/node_modules/tokenjuice/dist/rules/service/pm2.json +35 -0
- package/node_modules/tokenjuice/dist/rules/service/service.json +46 -0
- package/node_modules/tokenjuice/dist/rules/service/ss.json +29 -0
- package/node_modules/tokenjuice/dist/rules/service/systemctl-status.json +45 -0
- package/node_modules/tokenjuice/dist/rules/system/df.json +29 -0
- package/node_modules/tokenjuice/dist/rules/system/du.json +29 -0
- package/node_modules/tokenjuice/dist/rules/system/file.json +30 -0
- package/node_modules/tokenjuice/dist/rules/system/ps.json +29 -0
- package/node_modules/tokenjuice/dist/rules/task/env.json +31 -0
- package/node_modules/tokenjuice/dist/rules/task/just.json +30 -0
- package/node_modules/tokenjuice/dist/rules/task/make.json +30 -0
- package/node_modules/tokenjuice/dist/rules/task/mise.json +35 -0
- package/node_modules/tokenjuice/dist/rules/task/node.json +30 -0
- package/node_modules/tokenjuice/dist/rules/task/php.json +30 -0
- package/node_modules/tokenjuice/dist/rules/task/python.json +30 -0
- package/node_modules/tokenjuice/dist/rules/task/ruby.json +30 -0
- package/node_modules/tokenjuice/dist/rules/task/uv.json +35 -0
- package/node_modules/tokenjuice/dist/rules/tests/bun-test.json +56 -0
- package/node_modules/tokenjuice/dist/rules/tests/cargo-test.json +41 -0
- package/node_modules/tokenjuice/dist/rules/tests/go-test.json +49 -0
- package/node_modules/tokenjuice/dist/rules/tests/jest.json +41 -0
- package/node_modules/tokenjuice/dist/rules/tests/mocha.json +35 -0
- package/node_modules/tokenjuice/dist/rules/tests/npm-test.json +56 -0
- package/node_modules/tokenjuice/dist/rules/tests/playwright.json +37 -0
- package/node_modules/tokenjuice/dist/rules/tests/pnpm-test.json +56 -0
- package/node_modules/tokenjuice/dist/rules/tests/pytest.json +54 -0
- package/node_modules/tokenjuice/dist/rules/tests/rspec.json +31 -0
- package/node_modules/tokenjuice/dist/rules/tests/swift-test.json +66 -0
- package/node_modules/tokenjuice/dist/rules/tests/vitest.json +56 -0
- package/node_modules/tokenjuice/dist/rules/tests/yarn-test.json +56 -0
- package/node_modules/tokenjuice/dist/rules/text/wc.json +35 -0
- package/node_modules/tokenjuice/dist/rules/tokenjuice-rule.schema.json +155 -0
- package/node_modules/tokenjuice/dist/rules/transfer/rsync.json +30 -0
- package/node_modules/tokenjuice/dist/rules/transfer/scp.json +30 -0
- package/node_modules/tokenjuice/dist/types.d.ts +212 -0
- package/node_modules/tokenjuice/dist/types.js +1 -0
- package/node_modules/tokenjuice/package.json +80 -0
- package/npm-shrinkwrap.json +39 -0
- package/openclaw.plugin.json +16 -0
- package/package.json +55 -0
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
const COMPOUND_SHELL_OPERATORS = new Set([";", "\n", "|", "&&", "||"]);
|
|
2
|
+
const SEQUENTIAL_SHELL_OPERATORS = new Set([";", "\n", "&&", "||"]);
|
|
3
|
+
export const ENV_ASSIGNMENT_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*=.*/u;
|
|
4
|
+
export function tokenizeCommand(command) {
|
|
5
|
+
const tokens = [];
|
|
6
|
+
let current = "";
|
|
7
|
+
let quote = null;
|
|
8
|
+
let escaping = false;
|
|
9
|
+
for (const char of command.trim()) {
|
|
10
|
+
if (escaping) {
|
|
11
|
+
current += char;
|
|
12
|
+
escaping = false;
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
if (char === "\\") {
|
|
16
|
+
escaping = true;
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
if (quote) {
|
|
20
|
+
if (char === quote) {
|
|
21
|
+
quote = null;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
current += char;
|
|
25
|
+
}
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
if (char === "'" || char === "\"") {
|
|
29
|
+
quote = char;
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
if (/\s/u.test(char)) {
|
|
33
|
+
if (current) {
|
|
34
|
+
tokens.push(current);
|
|
35
|
+
current = "";
|
|
36
|
+
}
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
current += char;
|
|
40
|
+
}
|
|
41
|
+
if (escaping) {
|
|
42
|
+
current += "\\";
|
|
43
|
+
}
|
|
44
|
+
if (current) {
|
|
45
|
+
tokens.push(current);
|
|
46
|
+
}
|
|
47
|
+
return tokens;
|
|
48
|
+
}
|
|
49
|
+
function hasUnquotedShellOperator(command, operators) {
|
|
50
|
+
let quote = null;
|
|
51
|
+
let escaping = false;
|
|
52
|
+
for (let index = 0; index < command.length; index += 1) {
|
|
53
|
+
const char = command[index];
|
|
54
|
+
if (escaping) {
|
|
55
|
+
escaping = false;
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (char === "\\") {
|
|
59
|
+
escaping = true;
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
if (quote) {
|
|
63
|
+
if (char === quote) {
|
|
64
|
+
quote = null;
|
|
65
|
+
}
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
if (char === "'" || char === "\"") {
|
|
69
|
+
quote = char;
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
if ((char === ";" || char === "\n" || char === "|") && operators.has(char)) {
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
if (char === "&" && command[index + 1] === "&" && operators.has("&&")) {
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
if (char === "|" && command[index + 1] === "|" && operators.has("||")) {
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
export function splitTopLevelCommandChain(command) {
|
|
85
|
+
const trimmed = command.trim();
|
|
86
|
+
if (!trimmed) {
|
|
87
|
+
return [];
|
|
88
|
+
}
|
|
89
|
+
const segments = [];
|
|
90
|
+
let current = "";
|
|
91
|
+
let quote = null;
|
|
92
|
+
let escaping = false;
|
|
93
|
+
for (let index = 0; index < trimmed.length; index += 1) {
|
|
94
|
+
const char = trimmed[index];
|
|
95
|
+
if (escaping) {
|
|
96
|
+
current += char;
|
|
97
|
+
escaping = false;
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
if (char === "\\") {
|
|
101
|
+
current += char;
|
|
102
|
+
escaping = true;
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
if (quote) {
|
|
106
|
+
current += char;
|
|
107
|
+
if (char === quote) {
|
|
108
|
+
quote = null;
|
|
109
|
+
}
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
if (char === "'" || char === "\"") {
|
|
113
|
+
current += char;
|
|
114
|
+
quote = char;
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
if (char === "&" && trimmed[index + 1] === "&") {
|
|
118
|
+
const segment = current.trim();
|
|
119
|
+
if (segment) {
|
|
120
|
+
segments.push(segment);
|
|
121
|
+
}
|
|
122
|
+
current = "";
|
|
123
|
+
index += 1;
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
if (char === ";" || char === "\n") {
|
|
127
|
+
const segment = current.trim();
|
|
128
|
+
if (segment) {
|
|
129
|
+
segments.push(segment);
|
|
130
|
+
}
|
|
131
|
+
current = "";
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
current += char;
|
|
135
|
+
}
|
|
136
|
+
if (quote || escaping) {
|
|
137
|
+
return [trimmed];
|
|
138
|
+
}
|
|
139
|
+
const segment = current.trim();
|
|
140
|
+
if (segment) {
|
|
141
|
+
segments.push(segment);
|
|
142
|
+
}
|
|
143
|
+
return segments;
|
|
144
|
+
}
|
|
145
|
+
export function isCompoundShellCommand(command) {
|
|
146
|
+
return hasUnquotedShellOperator(command, COMPOUND_SHELL_OPERATORS);
|
|
147
|
+
}
|
|
148
|
+
export function hasSequentialShellCommands(command) {
|
|
149
|
+
return hasUnquotedShellOperator(command, SEQUENTIAL_SHELL_OPERATORS);
|
|
150
|
+
}
|
|
151
|
+
export function stripLeadingEnvAssignmentsFromCommand(command) {
|
|
152
|
+
const trimmed = command.trim();
|
|
153
|
+
if (!trimmed) {
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
let index = 0;
|
|
157
|
+
while (index < trimmed.length) {
|
|
158
|
+
while (/\s/u.test(trimmed[index] ?? "")) {
|
|
159
|
+
index += 1;
|
|
160
|
+
}
|
|
161
|
+
if (index >= trimmed.length) {
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
const tokenStart = index;
|
|
165
|
+
let quote = null;
|
|
166
|
+
let escaping = false;
|
|
167
|
+
while (index < trimmed.length) {
|
|
168
|
+
const char = trimmed[index];
|
|
169
|
+
if (escaping) {
|
|
170
|
+
escaping = false;
|
|
171
|
+
index += 1;
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
if (char === "\\") {
|
|
175
|
+
escaping = true;
|
|
176
|
+
index += 1;
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
if (quote) {
|
|
180
|
+
if (char === quote) {
|
|
181
|
+
quote = null;
|
|
182
|
+
}
|
|
183
|
+
index += 1;
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
if (char === "'" || char === "\"") {
|
|
187
|
+
quote = char;
|
|
188
|
+
index += 1;
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
if (/\s/u.test(char)) {
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
index += 1;
|
|
195
|
+
}
|
|
196
|
+
if (quote || escaping) {
|
|
197
|
+
return trimmed;
|
|
198
|
+
}
|
|
199
|
+
const token = trimmed.slice(tokenStart, index);
|
|
200
|
+
if (!ENV_ASSIGNMENT_PATTERN.test(token)) {
|
|
201
|
+
return trimmed.slice(tokenStart).trim();
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return null;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Strip trivial leading `cd <dir> && ` (or `pushd`) prefixes from a shell
|
|
208
|
+
* command. Models sometimes emit `cd /path && git status` even when the
|
|
209
|
+
* harness provides a cwd, which causes downstream compound-command heuristics
|
|
210
|
+
* to skip compaction. Stripping the prefix lets classification and the
|
|
211
|
+
* rewrite policy reason about the effective command.
|
|
212
|
+
*
|
|
213
|
+
* Only handles trivially safe chains — a single shell token argument, no
|
|
214
|
+
* redirections, no nested pipelines. Anything fancier returns the input
|
|
215
|
+
* unchanged.
|
|
216
|
+
*/
|
|
217
|
+
export function stripLeadingCdPrefix(command) {
|
|
218
|
+
let current = command.trim();
|
|
219
|
+
for (let iteration = 0; iteration < 8; iteration += 1) {
|
|
220
|
+
const next = matchLeadingCdChain(current);
|
|
221
|
+
if (next === null) {
|
|
222
|
+
return current;
|
|
223
|
+
}
|
|
224
|
+
current = next;
|
|
225
|
+
}
|
|
226
|
+
return current;
|
|
227
|
+
}
|
|
228
|
+
function matchLeadingCdChain(command) {
|
|
229
|
+
const keywordMatch = /^\s*(cd|pushd)(\s+)/u.exec(command);
|
|
230
|
+
if (!keywordMatch) {
|
|
231
|
+
return null;
|
|
232
|
+
}
|
|
233
|
+
let index = keywordMatch[0].length;
|
|
234
|
+
const length = command.length;
|
|
235
|
+
let quote = null;
|
|
236
|
+
let escaping = false;
|
|
237
|
+
let sawArg = false;
|
|
238
|
+
while (index < length) {
|
|
239
|
+
const char = command[index];
|
|
240
|
+
if (escaping) {
|
|
241
|
+
escaping = false;
|
|
242
|
+
index += 1;
|
|
243
|
+
sawArg = true;
|
|
244
|
+
continue;
|
|
245
|
+
}
|
|
246
|
+
if (char === "\\") {
|
|
247
|
+
escaping = true;
|
|
248
|
+
index += 1;
|
|
249
|
+
sawArg = true;
|
|
250
|
+
continue;
|
|
251
|
+
}
|
|
252
|
+
if (quote) {
|
|
253
|
+
if (char === quote) {
|
|
254
|
+
quote = null;
|
|
255
|
+
}
|
|
256
|
+
index += 1;
|
|
257
|
+
sawArg = true;
|
|
258
|
+
continue;
|
|
259
|
+
}
|
|
260
|
+
if (char === "'" || char === "\"") {
|
|
261
|
+
quote = char;
|
|
262
|
+
index += 1;
|
|
263
|
+
sawArg = true;
|
|
264
|
+
continue;
|
|
265
|
+
}
|
|
266
|
+
if (/\s/u.test(char)) {
|
|
267
|
+
break;
|
|
268
|
+
}
|
|
269
|
+
if (char === "&"
|
|
270
|
+
|| char === "|"
|
|
271
|
+
|| char === ";"
|
|
272
|
+
|| char === "<"
|
|
273
|
+
|| char === ">"
|
|
274
|
+
|| char === "\n") {
|
|
275
|
+
return null;
|
|
276
|
+
}
|
|
277
|
+
sawArg = true;
|
|
278
|
+
index += 1;
|
|
279
|
+
}
|
|
280
|
+
if (!sawArg) {
|
|
281
|
+
return null;
|
|
282
|
+
}
|
|
283
|
+
while (index < length && /[ \t]/u.test(command[index])) {
|
|
284
|
+
index += 1;
|
|
285
|
+
}
|
|
286
|
+
if (command[index] === "&" && command[index + 1] === "&") {
|
|
287
|
+
const tail = command.slice(index + 2).trim();
|
|
288
|
+
return tail.length > 0 ? tail : null;
|
|
289
|
+
}
|
|
290
|
+
return null;
|
|
291
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { hasSequentialShellCommands, isCompoundShellCommand, splitTopLevelCommandChain, stripLeadingCdPrefix, tokenizeCommand, } from "./command-shell.js";
|
|
2
|
+
export type { CommandMatchCandidate } from "./command-match.js";
|
|
3
|
+
export { deriveCommandMatchCandidates, getEffectiveCommandArgv, isSetupWrapperSegment, resolveEffectiveCommand, stripLeadingEnvAssignments, unwrapShellRunner, } from "./command-match.js";
|
|
4
|
+
export { getCommandName, getGitSubcommand, isFileContentInspectionCommand, isRepositoryInspectionCommand, normalizeCommandSignature, normalizeEffectiveCommandSignature, } from "./command-identity.js";
|
|
5
|
+
export { normalizeExecutionInput } from "./execution-input.js";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { hasSequentialShellCommands, isCompoundShellCommand, splitTopLevelCommandChain, stripLeadingCdPrefix, tokenizeCommand, } from "./command-shell.js";
|
|
2
|
+
export { deriveCommandMatchCandidates, getEffectiveCommandArgv, isSetupWrapperSegment, resolveEffectiveCommand, stripLeadingEnvAssignments, unwrapShellRunner, } from "./command-match.js";
|
|
3
|
+
export { getCommandName, getGitSubcommand, isFileContentInspectionCommand, isRepositoryInspectionCommand, normalizeCommandSignature, normalizeEffectiveCommandSignature, } from "./command-identity.js";
|
|
4
|
+
export { normalizeExecutionInput } from "./execution-input.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type CompactionKind = "head-tail-omission" | "middle-truncation" | "tail-truncation" | "hashed-middle-clip" | "git-diff-hunk-clip" | "inspection-package-lock-summary" | "inspection-large-document-summary" | "github-actions-command-list-omission" | "github-actions-log-signal-filter" | "github-status-check-rollup-omission" | "no-omit-head-tail-passthrough" | "no-omit-char-clip-passthrough" | "no-omit-domain-passthrough";
|
|
2
|
+
export type CompactionMetadata = {
|
|
3
|
+
authoritative: boolean;
|
|
4
|
+
kinds: CompactionKind[];
|
|
5
|
+
};
|
|
6
|
+
export declare const NO_COMPACTION_METADATA: CompactionMetadata;
|
|
7
|
+
export declare const WRAP_AUTHORITATIVE_FOOTER = "[tokenjuice] This is the complete, authoritative output for this command. It was deterministically compacted to remove low-signal noise; the omitted content is not retrievable. Do not re-run the command, vary flags, or switch tools to try to recover it. Proceed with the task using this output.";
|
|
8
|
+
export declare function createCompactionMetadata(...kinds: CompactionKind[]): CompactionMetadata;
|
|
9
|
+
export declare function createPassthroughCompactionMetadata(...kinds: CompactionKind[]): CompactionMetadata;
|
|
10
|
+
export declare function mergeCompactionMetadata(...values: Array<CompactionMetadata | undefined>): CompactionMetadata;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export const NO_COMPACTION_METADATA = {
|
|
2
|
+
authoritative: false,
|
|
3
|
+
kinds: [],
|
|
4
|
+
};
|
|
5
|
+
export const WRAP_AUTHORITATIVE_FOOTER = "[tokenjuice] This is the complete, authoritative output for this command. It was deterministically compacted to remove low-signal noise; the omitted content is not retrievable. Do not re-run the command, vary flags, or switch tools to try to recover it. Proceed with the task using this output.";
|
|
6
|
+
function buildCompactionMetadata(authoritative, ...kinds) {
|
|
7
|
+
if (kinds.length === 0) {
|
|
8
|
+
return NO_COMPACTION_METADATA;
|
|
9
|
+
}
|
|
10
|
+
return {
|
|
11
|
+
authoritative,
|
|
12
|
+
kinds: Array.from(new Set(kinds)),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export function createCompactionMetadata(...kinds) {
|
|
16
|
+
return buildCompactionMetadata(true, ...kinds);
|
|
17
|
+
}
|
|
18
|
+
export function createPassthroughCompactionMetadata(...kinds) {
|
|
19
|
+
return buildCompactionMetadata(false, ...kinds);
|
|
20
|
+
}
|
|
21
|
+
export function mergeCompactionMetadata(...values) {
|
|
22
|
+
const presentValues = values.filter((value) => Boolean(value) && (value?.kinds.length ?? 0) > 0);
|
|
23
|
+
if (presentValues.length === 0) {
|
|
24
|
+
return NO_COMPACTION_METADATA;
|
|
25
|
+
}
|
|
26
|
+
const kinds = presentValues.flatMap((value) => value.kinds);
|
|
27
|
+
return buildCompactionMetadata(presentValues.every((value) => value.authoritative), ...kinds);
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function readNoOmissionFromEnv(env?: NodeJS.ProcessEnv): boolean;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { resolveEffectiveCommand, unwrapShellRunner } from "./command-match.js";
|
|
2
|
+
import { isCompoundShellCommand, stripLeadingCdPrefix, tokenizeCommand } from "./command-shell.js";
|
|
3
|
+
export function normalizeExecutionInput(input) {
|
|
4
|
+
const shellWrapped = unwrapShellRunner(input);
|
|
5
|
+
if (shellWrapped) {
|
|
6
|
+
const effectiveCommand = stripLeadingCdPrefix(shellWrapped);
|
|
7
|
+
if (isCompoundShellCommand(effectiveCommand)) {
|
|
8
|
+
const { argv: _argv, ...restInput } = input;
|
|
9
|
+
return {
|
|
10
|
+
...restInput,
|
|
11
|
+
command: effectiveCommand,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
const argv = resolveEffectiveCommand({ command: effectiveCommand })?.argv ?? tokenizeCommand(effectiveCommand);
|
|
15
|
+
if (argv.length === 0) {
|
|
16
|
+
return {
|
|
17
|
+
...input,
|
|
18
|
+
command: effectiveCommand,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
...input,
|
|
23
|
+
command: argv.join(" "),
|
|
24
|
+
argv,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
const effective = resolveEffectiveCommand(input);
|
|
28
|
+
if (effective?.argv.length) {
|
|
29
|
+
return {
|
|
30
|
+
...input,
|
|
31
|
+
...(effective.command ? { command: effective.command } : {}),
|
|
32
|
+
argv: effective.argv,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
if (input.argv?.length || !input.command) {
|
|
36
|
+
return input;
|
|
37
|
+
}
|
|
38
|
+
const effectiveCommand = stripLeadingCdPrefix(input.command);
|
|
39
|
+
if (isCompoundShellCommand(effectiveCommand)) {
|
|
40
|
+
return input;
|
|
41
|
+
}
|
|
42
|
+
const argv = tokenizeCommand(effectiveCommand);
|
|
43
|
+
if (argv.length === 0) {
|
|
44
|
+
return input;
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
...input,
|
|
48
|
+
command: argv.join(" "),
|
|
49
|
+
argv,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { RuleFixture } from "../types.js";
|
|
2
|
+
export type FixtureVerificationResult = {
|
|
3
|
+
id: string;
|
|
4
|
+
ruleId: string;
|
|
5
|
+
ok: boolean;
|
|
6
|
+
path: string;
|
|
7
|
+
errors: string[];
|
|
8
|
+
};
|
|
9
|
+
export declare function loadBuiltinFixtures(): Promise<Array<{
|
|
10
|
+
fixture: RuleFixture;
|
|
11
|
+
path: string;
|
|
12
|
+
}>>;
|
|
13
|
+
export declare function verifyBuiltinFixtures(): Promise<FixtureVerificationResult[]>;
|
|
14
|
+
export declare function clearFixtureCache(): void;
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { readdir, readFile } from "node:fs/promises";
|
|
2
|
+
import { join, relative, resolve } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { reduceExecutionWithRules } from "./reduce.js";
|
|
5
|
+
import { loadBuiltinRules } from "./rules.js";
|
|
6
|
+
function fixturesRoot() {
|
|
7
|
+
return resolve(fileURLToPath(new URL("../rules/fixtures", import.meta.url)));
|
|
8
|
+
}
|
|
9
|
+
const fixtureCache = new Map();
|
|
10
|
+
async function listFixtureFiles(root) {
|
|
11
|
+
async function walk(currentDir) {
|
|
12
|
+
const entries = (await readdir(currentDir, { withFileTypes: true })).sort((left, right) => left.name.localeCompare(right.name));
|
|
13
|
+
const files = await Promise.all(entries.map(async (entry) => {
|
|
14
|
+
const fullPath = join(currentDir, entry.name);
|
|
15
|
+
if (entry.isDirectory()) {
|
|
16
|
+
return await walk(fullPath);
|
|
17
|
+
}
|
|
18
|
+
if (!entry.isFile() || !entry.name.endsWith(".fixture.json")) {
|
|
19
|
+
return [];
|
|
20
|
+
}
|
|
21
|
+
return [fullPath];
|
|
22
|
+
}));
|
|
23
|
+
return files.flat();
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
return await walk(root);
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function isStringArray(value) {
|
|
33
|
+
return Array.isArray(value) && value.every((entry) => typeof entry === "string");
|
|
34
|
+
}
|
|
35
|
+
function isFactMap(value) {
|
|
36
|
+
return (typeof value === "object"
|
|
37
|
+
&& value !== null
|
|
38
|
+
&& !Array.isArray(value)
|
|
39
|
+
&& Object.values(value).every((entry) => typeof entry === "number" && Number.isInteger(entry) && entry >= 0));
|
|
40
|
+
}
|
|
41
|
+
function validateFixture(raw) {
|
|
42
|
+
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
const value = raw;
|
|
46
|
+
if (typeof value.id !== "string" || typeof value.ruleId !== "string") {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
if (typeof value.input !== "object" || value.input === null || Array.isArray(value.input)) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
if (typeof value.expect !== "object" || value.expect === null || Array.isArray(value.expect)) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
const expect = value.expect;
|
|
56
|
+
if ("matchedReducer" in expect && typeof expect.matchedReducer !== "string") {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
if ("family" in expect && typeof expect.family !== "string") {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
if ("inlineText" in expect && typeof expect.inlineText !== "string") {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
if ("previewText" in expect && typeof expect.previewText !== "string") {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
if ("facts" in expect && !isFactMap(expect.facts)) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
if ("contains" in expect && !isStringArray(expect.contains)) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
if ("excludes" in expect && !isStringArray(expect.excludes)) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
export async function loadBuiltinFixtures() {
|
|
80
|
+
const root = fixturesRoot();
|
|
81
|
+
const cached = fixtureCache.get(root);
|
|
82
|
+
if (cached) {
|
|
83
|
+
return cached;
|
|
84
|
+
}
|
|
85
|
+
const files = await listFixtureFiles(root);
|
|
86
|
+
const fixtures = await Promise.all(files.map(async (fullPath) => {
|
|
87
|
+
const parsed = JSON.parse(await readFile(fullPath, "utf8"));
|
|
88
|
+
if (!validateFixture(parsed)) {
|
|
89
|
+
throw new Error(`invalid fixture: ${relative(root, fullPath)}`);
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
fixture: parsed,
|
|
93
|
+
path: fullPath,
|
|
94
|
+
};
|
|
95
|
+
}));
|
|
96
|
+
const duplicateIds = new Map();
|
|
97
|
+
for (const { fixture, path } of fixtures) {
|
|
98
|
+
const group = duplicateIds.get(fixture.id) ?? [];
|
|
99
|
+
group.push(path);
|
|
100
|
+
duplicateIds.set(fixture.id, group);
|
|
101
|
+
}
|
|
102
|
+
for (const [id, paths] of duplicateIds) {
|
|
103
|
+
if (paths.length > 1) {
|
|
104
|
+
throw new Error(`duplicate fixture id ${id}: ${paths.join(", ")}`);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
fixtureCache.set(root, fixtures);
|
|
108
|
+
return fixtures;
|
|
109
|
+
}
|
|
110
|
+
export async function verifyBuiltinFixtures() {
|
|
111
|
+
const root = fixturesRoot();
|
|
112
|
+
const fixtures = await loadBuiltinFixtures();
|
|
113
|
+
const rules = await loadBuiltinRules();
|
|
114
|
+
const knownRuleIds = new Set(rules.map((rule) => rule.rule.id));
|
|
115
|
+
const coveredRuleIds = new Set();
|
|
116
|
+
const results = await Promise.all(fixtures.map(async ({ fixture, path }) => {
|
|
117
|
+
const errors = [];
|
|
118
|
+
coveredRuleIds.add(fixture.ruleId);
|
|
119
|
+
try {
|
|
120
|
+
if (!knownRuleIds.has(fixture.ruleId)) {
|
|
121
|
+
errors.push(`unknown builtin ruleId: ${fixture.ruleId}`);
|
|
122
|
+
}
|
|
123
|
+
if (fixture.expect.matchedReducer !== fixture.ruleId) {
|
|
124
|
+
errors.push(fixture.expect.matchedReducer
|
|
125
|
+
? `builtin fixture matchedReducer must equal ruleId (${fixture.ruleId}), got ${fixture.expect.matchedReducer}`
|
|
126
|
+
: `builtin fixture must declare expect.matchedReducer = ${fixture.ruleId}`);
|
|
127
|
+
}
|
|
128
|
+
const result = await reduceExecutionWithRules(fixture.input, rules, {
|
|
129
|
+
...(fixture.input.cwd ? { cwd: fixture.input.cwd } : {}),
|
|
130
|
+
maxInlineChars: 5000,
|
|
131
|
+
});
|
|
132
|
+
const factText = Object.entries(result.facts ?? {})
|
|
133
|
+
.filter(([, count]) => count > 0)
|
|
134
|
+
.map(([name, count]) => `${count} ${name}${count === 1 ? "" : "s"}`)
|
|
135
|
+
.join("\n");
|
|
136
|
+
const searchableText = [result.inlineText, result.previewText, factText].filter(Boolean).join("\n");
|
|
137
|
+
if (fixture.expect.matchedReducer && result.classification.matchedReducer !== fixture.expect.matchedReducer) {
|
|
138
|
+
errors.push(`expected matched reducer ${fixture.expect.matchedReducer}, got ${result.classification.matchedReducer ?? "none"}`);
|
|
139
|
+
}
|
|
140
|
+
if (fixture.expect.family && result.classification.family !== fixture.expect.family) {
|
|
141
|
+
errors.push(`expected family ${fixture.expect.family}, got ${result.classification.family}`);
|
|
142
|
+
}
|
|
143
|
+
if (fixture.expect.inlineText && result.inlineText !== fixture.expect.inlineText) {
|
|
144
|
+
errors.push(`expected inlineText ${JSON.stringify(fixture.expect.inlineText)}, got ${JSON.stringify(result.inlineText)}`);
|
|
145
|
+
}
|
|
146
|
+
if (fixture.expect.previewText && result.previewText !== fixture.expect.previewText) {
|
|
147
|
+
errors.push(`expected previewText ${JSON.stringify(fixture.expect.previewText)}, got ${JSON.stringify(result.previewText)}`);
|
|
148
|
+
}
|
|
149
|
+
for (const [name, count] of Object.entries(fixture.expect.facts ?? {})) {
|
|
150
|
+
if ((result.facts?.[name] ?? 0) !== count) {
|
|
151
|
+
errors.push(`expected fact ${JSON.stringify(name)}=${count}, got ${result.facts?.[name] ?? 0}`);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
for (const snippet of fixture.expect.contains ?? []) {
|
|
155
|
+
if (!searchableText.includes(snippet)) {
|
|
156
|
+
errors.push(`missing expected text: ${snippet}`);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
for (const snippet of fixture.expect.excludes ?? []) {
|
|
160
|
+
if (searchableText.includes(snippet)) {
|
|
161
|
+
errors.push(`unexpected text present: ${snippet}`);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
catch (error) {
|
|
166
|
+
errors.push(error instanceof Error ? error.message : String(error));
|
|
167
|
+
}
|
|
168
|
+
return {
|
|
169
|
+
id: fixture.id,
|
|
170
|
+
ruleId: fixture.ruleId,
|
|
171
|
+
ok: errors.length === 0,
|
|
172
|
+
path,
|
|
173
|
+
errors,
|
|
174
|
+
};
|
|
175
|
+
}));
|
|
176
|
+
const missingCoverage = rules
|
|
177
|
+
.map((rule) => rule.rule.id)
|
|
178
|
+
.filter((id) => !coveredRuleIds.has(id))
|
|
179
|
+
.map((ruleId) => ({
|
|
180
|
+
id: `coverage:${ruleId}`,
|
|
181
|
+
ruleId,
|
|
182
|
+
ok: false,
|
|
183
|
+
path: root,
|
|
184
|
+
errors: [`missing builtin fixture coverage for rule ${ruleId}`],
|
|
185
|
+
}));
|
|
186
|
+
return [...results, ...missingCoverage];
|
|
187
|
+
}
|
|
188
|
+
export function clearFixtureCache() {
|
|
189
|
+
fixtureCache.clear();
|
|
190
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ToolExecutionInput } from "../types.js";
|
|
2
|
+
import { type CompactionMetadata } from "./compaction-metadata.js";
|
|
3
|
+
export declare function buildGithubActionsFailureSummary(input: ToolExecutionInput, rawText: string, noOmit?: boolean): {
|
|
4
|
+
text: string;
|
|
5
|
+
compaction?: CompactionMetadata;
|
|
6
|
+
} | null;
|