@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,105 @@
|
|
|
1
|
+
import { createCompactionMetadata, createPassthroughCompactionMetadata } from "./compaction-metadata.js";
|
|
2
|
+
import { normalizeLines, stripAnsi, trimEmptyEdges } from "./text.js";
|
|
3
|
+
const GITHUB_ACTIONS_EXIT_PATTERN = /^Error: Process completed with exit code (\d+)\.?$/u;
|
|
4
|
+
const GITHUB_ACTIONS_RUN_PATTERN = /^(?:##\[group\]|::group::)?Run\s+(.+)$/u;
|
|
5
|
+
const MAX_LISTED_COMMANDS = 24;
|
|
6
|
+
function isGithubActionsMetadataLine(line) {
|
|
7
|
+
return (line === "##[endgroup]"
|
|
8
|
+
|| line.startsWith("shell:")
|
|
9
|
+
|| line.startsWith("env:")
|
|
10
|
+
|| line.startsWith("Error: Process completed with exit code "));
|
|
11
|
+
}
|
|
12
|
+
function isShellSetupLine(line) {
|
|
13
|
+
return (line === "set -e"
|
|
14
|
+
|| line === "set -eo pipefail"
|
|
15
|
+
|| line === "set -euo pipefail"
|
|
16
|
+
|| /^set\s+-[A-Za-z]*e[A-Za-z]*$/u.test(line));
|
|
17
|
+
}
|
|
18
|
+
function stripGithubActionsScriptPrefix(line) {
|
|
19
|
+
return line
|
|
20
|
+
.replace(/^\s{2}/u, "")
|
|
21
|
+
.replace(/^\t/u, "")
|
|
22
|
+
.trim();
|
|
23
|
+
}
|
|
24
|
+
function dedupeAdjacent(values) {
|
|
25
|
+
const deduped = [];
|
|
26
|
+
for (const value of values) {
|
|
27
|
+
if (deduped[deduped.length - 1] !== value) {
|
|
28
|
+
deduped.push(value);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return deduped;
|
|
32
|
+
}
|
|
33
|
+
function extractRunCommands(lines) {
|
|
34
|
+
const runIndex = lines.findIndex((line) => GITHUB_ACTIONS_RUN_PATTERN.test(stripGithubActionsScriptPrefix(line)));
|
|
35
|
+
if (runIndex === -1) {
|
|
36
|
+
return [];
|
|
37
|
+
}
|
|
38
|
+
const commands = [];
|
|
39
|
+
const runMatch = stripGithubActionsScriptPrefix(lines[runIndex] ?? "").match(GITHUB_ACTIONS_RUN_PATTERN);
|
|
40
|
+
if (runMatch?.[1]) {
|
|
41
|
+
commands.push(runMatch[1].trim());
|
|
42
|
+
}
|
|
43
|
+
const bodyLines = lines.slice(runIndex + 1);
|
|
44
|
+
const hasIndentedScriptBody = bodyLines.some((line) => /^(?:\s{2}|\t)\S/u.test(line));
|
|
45
|
+
for (const rawLine of bodyLines) {
|
|
46
|
+
if (hasIndentedScriptBody && !/^(?:\s{2}|\t)/u.test(rawLine)) {
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
const line = stripGithubActionsScriptPrefix(rawLine);
|
|
50
|
+
if (!line || isGithubActionsMetadataLine(line)) {
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
commands.push(line);
|
|
54
|
+
}
|
|
55
|
+
return dedupeAdjacent(commands).filter((line) => !isShellSetupLine(line));
|
|
56
|
+
}
|
|
57
|
+
function formatCommandList(commands, noOmit = false) {
|
|
58
|
+
if (commands.length <= MAX_LISTED_COMMANDS) {
|
|
59
|
+
return { lines: commands.map((command) => `- ${command}`) };
|
|
60
|
+
}
|
|
61
|
+
if (noOmit) {
|
|
62
|
+
return {
|
|
63
|
+
lines: commands.map((command) => `- ${command}`),
|
|
64
|
+
compaction: createPassthroughCompactionMetadata("no-omit-head-tail-passthrough"),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
const headCount = Math.floor(MAX_LISTED_COMMANDS * 0.65);
|
|
68
|
+
const tailCount = MAX_LISTED_COMMANDS - headCount;
|
|
69
|
+
const omitted = commands.length - headCount - tailCount;
|
|
70
|
+
return {
|
|
71
|
+
lines: [
|
|
72
|
+
...commands.slice(0, headCount).map((command) => `- ${command}`),
|
|
73
|
+
`... ${omitted} commands omitted ...`,
|
|
74
|
+
...commands.slice(-tailCount).map((command) => `- ${command}`),
|
|
75
|
+
],
|
|
76
|
+
compaction: createCompactionMetadata("github-actions-command-list-omission"),
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
export function buildGithubActionsFailureSummary(input, rawText, noOmit = false) {
|
|
80
|
+
const lines = trimEmptyEdges(normalizeLines(stripAnsi(rawText))).map((line) => line.trimEnd());
|
|
81
|
+
const exitLine = [...lines].reverse().find((line) => GITHUB_ACTIONS_EXIT_PATTERN.test(stripGithubActionsScriptPrefix(line)));
|
|
82
|
+
const exitCode = exitLine?.match(GITHUB_ACTIONS_EXIT_PATTERN)?.[1] ?? (input.exitCode && input.exitCode !== 0 ? String(input.exitCode) : null);
|
|
83
|
+
if (!exitLine || !exitCode) {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
const commands = extractRunCommands(lines);
|
|
87
|
+
if (commands.length === 0) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
const commandList = formatCommandList(commands, noOmit);
|
|
91
|
+
const summary = [`GitHub Actions shell step failed (exit ${exitCode}).`];
|
|
92
|
+
if (commands.length === 1) {
|
|
93
|
+
summary.push(`Failing command: ${commands[0]}`);
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
summary.push(`Failing command: not visible; this shell step ran ${commands.length} commands without per-command failure markers.`);
|
|
97
|
+
summary.push("Commands in step:");
|
|
98
|
+
summary.push(...commandList.lines);
|
|
99
|
+
}
|
|
100
|
+
summary.push(stripGithubActionsScriptPrefix(exitLine));
|
|
101
|
+
return {
|
|
102
|
+
text: summary.join("\n"),
|
|
103
|
+
...(commandList.compaction ? { compaction: commandList.compaction } : {}),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type RewritePolicyOptions } from "./rewrite-policy.js";
|
|
2
|
+
import type { CompactResult, ToolExecutionInput } from "../../types.js";
|
|
3
|
+
import type { InspectionCommandPolicy, InspectionCommandSkipReason } from "../inventory-safety.js";
|
|
4
|
+
export type CompactBashResultInput = {
|
|
5
|
+
source: "claude-code" | "cline" | "codex" | "command-code" | "copilot-agent" | "copilot-cli" | "droid" | "gemini-cli" | "grok-cli" | "kimi" | "mux" | "openclaw" | "openhands" | "opencode" | "pi" | "qwen-code";
|
|
6
|
+
command: string;
|
|
7
|
+
cwd?: string;
|
|
8
|
+
visibleText: string;
|
|
9
|
+
trustedFullText?: string;
|
|
10
|
+
exitCode?: number;
|
|
11
|
+
maxInlineChars?: number;
|
|
12
|
+
noOmit?: boolean;
|
|
13
|
+
storeRaw?: boolean;
|
|
14
|
+
metadata?: Record<string, unknown>;
|
|
15
|
+
inspectionPolicy?: InspectionCommandPolicy;
|
|
16
|
+
/** @deprecated use inspectionPolicy instead. */
|
|
17
|
+
skipInspectionCommands?: boolean;
|
|
18
|
+
} & RewritePolicyOptions;
|
|
19
|
+
export type CompactBashResultKeepReason = "empty-output" | InspectionCommandSkipReason | "unsupported" | "no-compaction" | "low-savings-compaction" | "generic-compound-command" | "generic-weak-compaction";
|
|
20
|
+
export type CompactBashResultOutput = {
|
|
21
|
+
action: "keep";
|
|
22
|
+
reason: CompactBashResultKeepReason;
|
|
23
|
+
rawText: string;
|
|
24
|
+
usedTrustedFullText: boolean;
|
|
25
|
+
result?: CompactResult;
|
|
26
|
+
} | {
|
|
27
|
+
action: "rewrite";
|
|
28
|
+
rawText: string;
|
|
29
|
+
usedTrustedFullText: boolean;
|
|
30
|
+
result: CompactResult;
|
|
31
|
+
};
|
|
32
|
+
export declare function getOutputAwareInspectionSkipReason(policy: InspectionCommandPolicy, executionInput: ToolExecutionInput): InspectionCommandSkipReason | null;
|
|
33
|
+
export declare function compactBashResult(input: CompactBashResultInput): Promise<CompactBashResultOutput>;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { getInspectionCommandSkipReason, getSafeRepositoryInventorySourceArgv } from "../inventory-safety.js";
|
|
2
|
+
import { readNoOmissionFromEnv } from "../env.js";
|
|
3
|
+
import { buildInspectionSummary } from "../reduce-inspection-summary.js";
|
|
4
|
+
import { reduceExecution } from "../reduce.js";
|
|
5
|
+
import { getCompactionSkipReason } from "./rewrite-policy.js";
|
|
6
|
+
function resolveInspectionPolicy(input) {
|
|
7
|
+
if (input.inspectionPolicy) {
|
|
8
|
+
return input.inspectionPolicy;
|
|
9
|
+
}
|
|
10
|
+
return input.skipInspectionCommands ? "skip-all" : "compact-all";
|
|
11
|
+
}
|
|
12
|
+
export function getOutputAwareInspectionSkipReason(policy, executionInput) {
|
|
13
|
+
const command = executionInput.command ?? "";
|
|
14
|
+
const rawText = executionInput.combinedText ?? "";
|
|
15
|
+
const inspectionSkipReason = getInspectionCommandSkipReason(command, policy);
|
|
16
|
+
if (inspectionSkipReason === "file-content-inspection-command"
|
|
17
|
+
&& buildInspectionSummary(executionInput, rawText)) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
return inspectionSkipReason;
|
|
21
|
+
}
|
|
22
|
+
export async function compactBashResult(input) {
|
|
23
|
+
const command = input.command.trim();
|
|
24
|
+
if (!command) {
|
|
25
|
+
return {
|
|
26
|
+
action: "keep",
|
|
27
|
+
reason: "unsupported",
|
|
28
|
+
rawText: "",
|
|
29
|
+
usedTrustedFullText: false,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const rawText = input.trustedFullText ?? input.visibleText;
|
|
33
|
+
const usedTrustedFullText = typeof input.trustedFullText === "string";
|
|
34
|
+
if (!rawText.trim()) {
|
|
35
|
+
return {
|
|
36
|
+
action: "keep",
|
|
37
|
+
reason: "empty-output",
|
|
38
|
+
rawText,
|
|
39
|
+
usedTrustedFullText,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
const safeInventoryArgv = getSafeRepositoryInventorySourceArgv(command);
|
|
43
|
+
const executionInput = {
|
|
44
|
+
toolName: "exec",
|
|
45
|
+
command,
|
|
46
|
+
combinedText: rawText,
|
|
47
|
+
...(safeInventoryArgv ? { argv: safeInventoryArgv } : {}),
|
|
48
|
+
...(typeof input.cwd === "string" && input.cwd.trim() ? { cwd: input.cwd } : {}),
|
|
49
|
+
...(typeof input.exitCode === "number" ? { exitCode: input.exitCode } : {}),
|
|
50
|
+
...(input.metadata ? { metadata: input.metadata } : {}),
|
|
51
|
+
};
|
|
52
|
+
const inspectionSkipReason = getOutputAwareInspectionSkipReason(resolveInspectionPolicy(input), executionInput);
|
|
53
|
+
if (inspectionSkipReason) {
|
|
54
|
+
return {
|
|
55
|
+
action: "keep",
|
|
56
|
+
reason: inspectionSkipReason,
|
|
57
|
+
rawText,
|
|
58
|
+
usedTrustedFullText,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
const options = {
|
|
62
|
+
...(typeof input.cwd === "string" && input.cwd.trim() ? { cwd: input.cwd } : {}),
|
|
63
|
+
...(typeof input.maxInlineChars === "number" ? { maxInlineChars: input.maxInlineChars } : {}),
|
|
64
|
+
...(readNoOmissionFromEnv() || input.noOmit ? { noOmit: true } : {}),
|
|
65
|
+
recordStats: true,
|
|
66
|
+
...(input.storeRaw ? { store: true } : {}),
|
|
67
|
+
};
|
|
68
|
+
const result = await reduceExecution(executionInput, options);
|
|
69
|
+
const skipReason = getCompactionSkipReason(command, rawText, result, input);
|
|
70
|
+
if (skipReason) {
|
|
71
|
+
return {
|
|
72
|
+
action: "keep",
|
|
73
|
+
reason: skipReason,
|
|
74
|
+
rawText,
|
|
75
|
+
usedTrustedFullText,
|
|
76
|
+
result,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
action: "rewrite",
|
|
81
|
+
rawText,
|
|
82
|
+
usedTrustedFullText,
|
|
83
|
+
result,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CompactResult } from "../../types.js";
|
|
2
|
+
export type RewritePolicyOptions = {
|
|
3
|
+
minSavedCharsAny?: number;
|
|
4
|
+
genericFallbackMinSavedChars: number;
|
|
5
|
+
genericFallbackMaxRatio: number;
|
|
6
|
+
skipGenericFallbackForCompoundCommands: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare function getCompactionSkipReason(command: string, rawText: string, result: CompactResult, options: RewritePolicyOptions): "no-compaction" | "low-savings-compaction" | "generic-compound-command" | "generic-weak-compaction" | null;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { isCompoundShellCommand, stripLeadingCdPrefix } from "../command.js";
|
|
2
|
+
export function getCompactionSkipReason(command, rawText, result, options) {
|
|
3
|
+
const inlineText = typeof result.inlineText === "string" ? result.inlineText.trim() : "";
|
|
4
|
+
const normalizedRaw = rawText.trim();
|
|
5
|
+
const rawChars = typeof result.stats?.rawChars === "number" ? result.stats.rawChars : normalizedRaw.length;
|
|
6
|
+
const reducedChars = typeof result.stats?.reducedChars === "number" ? result.stats.reducedChars : inlineText.length;
|
|
7
|
+
const savedChars = rawChars - reducedChars;
|
|
8
|
+
if (!inlineText || inlineText === normalizedRaw || reducedChars >= rawChars) {
|
|
9
|
+
return "no-compaction";
|
|
10
|
+
}
|
|
11
|
+
if (typeof options.minSavedCharsAny === "number" && savedChars < options.minSavedCharsAny) {
|
|
12
|
+
return "low-savings-compaction";
|
|
13
|
+
}
|
|
14
|
+
if (result.classification?.matchedReducer !== "generic/fallback") {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
if (options.skipGenericFallbackForCompoundCommands && isCompoundShellCommand(stripLeadingCdPrefix(command))) {
|
|
18
|
+
return "generic-compound-command";
|
|
19
|
+
}
|
|
20
|
+
const ratio = rawChars === 0 ? 1 : reducedChars / rawChars;
|
|
21
|
+
if (savedChars < options.genericFallbackMinSavedChars || ratio > options.genericFallbackMaxRatio) {
|
|
22
|
+
return "generic-weak-compaction";
|
|
23
|
+
}
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ToolExecutionInput } from "../types.js";
|
|
2
|
+
export type RepositoryInventorySafety = "not-inventory" | "safe" | "sequential-command" | "unsafe-pipeline";
|
|
3
|
+
export type InspectionCommandPolicy = "compact-all" | "skip-all" | "skip-file-content" | "allow-safe-inventory";
|
|
4
|
+
export type InspectionCommandSkipReason = "inspection-command" | "file-content-inspection-command" | "sequential-inventory-command" | "unsafe-inventory-pipeline";
|
|
5
|
+
export declare function isRepositoryInventoryCommand(input: Pick<ToolExecutionInput, "argv" | "command">): boolean;
|
|
6
|
+
export declare function getRepositoryInventorySafety(command: string): RepositoryInventorySafety;
|
|
7
|
+
export declare function isSafeRepositoryInventoryPipeline(command: string): boolean;
|
|
8
|
+
export declare function isRepositoryInspectionCommand(input: Pick<ToolExecutionInput, "argv" | "command">): boolean;
|
|
9
|
+
export declare function hasCommandOnlyFileContentSummary(command: string): boolean;
|
|
10
|
+
export declare function getSafeRepositoryInventorySourceArgv(command: string): string[] | null;
|
|
11
|
+
export declare function getInspectionCommandSkipReason(command: string, policy: InspectionCommandPolicy): InspectionCommandSkipReason | null;
|
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
import { getCommandName, getGitSubcommand, isFileContentInspectionCommand, } from "./command-identity.js";
|
|
2
|
+
import { getEffectiveCommandArgv } from "./command-match.js";
|
|
3
|
+
import { hasSequentialShellCommands, stripLeadingCdPrefix, tokenizeCommand, } from "./command-shell.js";
|
|
4
|
+
const REPO_INVENTORY_COMMANDS = new Set(["find", "fd", "fdfind", "ls"]);
|
|
5
|
+
const REPO_INSPECTION_ONLY_COMMANDS = new Set(["tree"]);
|
|
6
|
+
const FIND_EXEC_ACTIONS = new Set(["-exec", "-execdir", "-ok", "-okdir"]);
|
|
7
|
+
const FD_EXEC_OPTIONS = new Set(["-x", "--exec", "-X", "--exec-batch"]);
|
|
8
|
+
const HEAD_FILTER = {
|
|
9
|
+
flags: ["-q", "-v", "-z"],
|
|
10
|
+
valueFlags: ["-n", "-c", "--lines", "--bytes"],
|
|
11
|
+
inlineValuePrefixes: ["--lines=", "--bytes="],
|
|
12
|
+
compactValueFlags: [/^-[0-9]+$/u, /^-[nc].+/u],
|
|
13
|
+
};
|
|
14
|
+
const TAIL_FILTER = {
|
|
15
|
+
flags: ["-q", "-v", "-z", "-f", "-F", "-r"],
|
|
16
|
+
valueFlags: ["-n", "-c", "--lines", "--bytes", "--pid", "-s", "--sleep-interval"],
|
|
17
|
+
inlineValuePrefixes: ["--lines=", "--bytes=", "--pid=", "--sleep-interval="],
|
|
18
|
+
compactValueFlags: [/^-[0-9]+$/u, /^-[nc].+/u],
|
|
19
|
+
};
|
|
20
|
+
const SORT_FILTER = {
|
|
21
|
+
flags: [
|
|
22
|
+
"-b",
|
|
23
|
+
"-d",
|
|
24
|
+
"-f",
|
|
25
|
+
"-g",
|
|
26
|
+
"-h",
|
|
27
|
+
"-i",
|
|
28
|
+
"-M",
|
|
29
|
+
"-m",
|
|
30
|
+
"-n",
|
|
31
|
+
"-R",
|
|
32
|
+
"-r",
|
|
33
|
+
"-s",
|
|
34
|
+
"-u",
|
|
35
|
+
"-V",
|
|
36
|
+
"-z",
|
|
37
|
+
"--check",
|
|
38
|
+
"--debug",
|
|
39
|
+
"--dictionary-order",
|
|
40
|
+
"--general-numeric-sort",
|
|
41
|
+
"--human-numeric-sort",
|
|
42
|
+
"--ignore-case",
|
|
43
|
+
"--ignore-leading-blanks",
|
|
44
|
+
"--ignore-nonprinting",
|
|
45
|
+
"--merge",
|
|
46
|
+
"--month-sort",
|
|
47
|
+
"--numeric-sort",
|
|
48
|
+
"--random-sort",
|
|
49
|
+
"--reverse",
|
|
50
|
+
"--stable",
|
|
51
|
+
"--unique",
|
|
52
|
+
"--version-sort",
|
|
53
|
+
"--zero-terminated",
|
|
54
|
+
],
|
|
55
|
+
valueFlags: ["-k", "-S", "-t", "--batch-size", "--key", "--sort"],
|
|
56
|
+
inlineValuePrefixes: ["--batch-size=", "--key=", "--sort="],
|
|
57
|
+
compactValueFlags: [/^-[bdfghinMmrRsuVz]*k.+/u, /^-[bdfghinMmrRsuVz]*S.+/u, /^-[bdfghinMmrRsuVz]*t.+/u],
|
|
58
|
+
};
|
|
59
|
+
const UNIQ_FILTER = {
|
|
60
|
+
flags: [
|
|
61
|
+
"-c",
|
|
62
|
+
"-d",
|
|
63
|
+
"-D",
|
|
64
|
+
"-i",
|
|
65
|
+
"-u",
|
|
66
|
+
"-z",
|
|
67
|
+
"--all-repeated",
|
|
68
|
+
"--count",
|
|
69
|
+
"--ignore-case",
|
|
70
|
+
"--repeated",
|
|
71
|
+
"--unique",
|
|
72
|
+
"--zero-terminated",
|
|
73
|
+
],
|
|
74
|
+
valueFlags: ["-f", "-s", "-w", "--skip-fields", "--skip-chars", "--check-chars"],
|
|
75
|
+
inlineValuePrefixes: ["--skip-fields=", "--skip-chars=", "--check-chars=", "--all-repeated="],
|
|
76
|
+
compactValueFlags: [/^-[fsw].+/u],
|
|
77
|
+
};
|
|
78
|
+
const WC_FILTER = {
|
|
79
|
+
flags: ["-l", "--lines"],
|
|
80
|
+
};
|
|
81
|
+
const REPO_INVENTORY_PIPE_FILTERS = new Map([
|
|
82
|
+
["head", HEAD_FILTER],
|
|
83
|
+
["sort", SORT_FILTER],
|
|
84
|
+
["tail", TAIL_FILTER],
|
|
85
|
+
["uniq", UNIQ_FILTER],
|
|
86
|
+
["wc", WC_FILTER],
|
|
87
|
+
]);
|
|
88
|
+
function getRepositoryInventorySourceArgv(command) {
|
|
89
|
+
const effectiveCommand = stripLeadingCdPrefix(command);
|
|
90
|
+
const leadingCommand = getLeadingSequentialSegment(effectiveCommand);
|
|
91
|
+
const sourceCommand = splitUnquotedPipes(leadingCommand)[0] ?? leadingCommand;
|
|
92
|
+
return getEffectiveCommandArgv({ command: sourceCommand });
|
|
93
|
+
}
|
|
94
|
+
function getLeadingSequentialSegment(command) {
|
|
95
|
+
let current = "";
|
|
96
|
+
let quote = null;
|
|
97
|
+
let escaping = false;
|
|
98
|
+
for (let index = 0; index < command.length; index += 1) {
|
|
99
|
+
const char = command[index];
|
|
100
|
+
if (escaping) {
|
|
101
|
+
current += char;
|
|
102
|
+
escaping = false;
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
if (char === "\\") {
|
|
106
|
+
current += char;
|
|
107
|
+
escaping = true;
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
if (quote) {
|
|
111
|
+
current += char;
|
|
112
|
+
if (char === quote) {
|
|
113
|
+
quote = null;
|
|
114
|
+
}
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
if (char === "'" || char === "\"") {
|
|
118
|
+
current += char;
|
|
119
|
+
quote = char;
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
if (char === ";" || char === "\n" || (char === "&" && command[index + 1] === "&") || (char === "|" && command[index + 1] === "|")) {
|
|
123
|
+
return current.trim();
|
|
124
|
+
}
|
|
125
|
+
current += char;
|
|
126
|
+
}
|
|
127
|
+
return current.trim();
|
|
128
|
+
}
|
|
129
|
+
function splitUnquotedPipes(command) {
|
|
130
|
+
const segments = [];
|
|
131
|
+
let current = "";
|
|
132
|
+
let quote = null;
|
|
133
|
+
let escaping = false;
|
|
134
|
+
for (let index = 0; index < command.length; index += 1) {
|
|
135
|
+
const char = command[index];
|
|
136
|
+
if (escaping) {
|
|
137
|
+
current += char;
|
|
138
|
+
escaping = false;
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
if (char === "\\") {
|
|
142
|
+
current += char;
|
|
143
|
+
escaping = true;
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
if (quote) {
|
|
147
|
+
current += char;
|
|
148
|
+
if (char === quote) {
|
|
149
|
+
quote = null;
|
|
150
|
+
}
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
if (char === "'" || char === "\"") {
|
|
154
|
+
current += char;
|
|
155
|
+
quote = char;
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
if (char === "|" && command[index + 1] !== "|") {
|
|
159
|
+
if (current.trim()) {
|
|
160
|
+
segments.push(current.trim());
|
|
161
|
+
}
|
|
162
|
+
current = "";
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
current += char;
|
|
166
|
+
}
|
|
167
|
+
if (current.trim()) {
|
|
168
|
+
segments.push(current.trim());
|
|
169
|
+
}
|
|
170
|
+
return segments;
|
|
171
|
+
}
|
|
172
|
+
function isKnownFlag(arg, spec) {
|
|
173
|
+
return (spec.flags?.includes(arg) ?? false)
|
|
174
|
+
|| (spec.inlineValuePrefixes?.some((prefix) => arg.startsWith(prefix)) ?? false)
|
|
175
|
+
|| (spec.compactValueFlags?.some((pattern) => pattern.test(arg)) ?? false);
|
|
176
|
+
}
|
|
177
|
+
function isStdinOnlyFilter(argv, spec) {
|
|
178
|
+
for (let index = 1; index < argv.length; index += 1) {
|
|
179
|
+
const arg = argv[index];
|
|
180
|
+
if (arg === "-") {
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
if (arg === "--") {
|
|
184
|
+
return argv.slice(index + 1).every((operand) => operand === "-");
|
|
185
|
+
}
|
|
186
|
+
if (spec.valueFlags?.includes(arg)) {
|
|
187
|
+
index += 1;
|
|
188
|
+
if (index >= argv.length) {
|
|
189
|
+
return false;
|
|
190
|
+
}
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
if (isKnownFlag(arg, spec)) {
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
return true;
|
|
199
|
+
}
|
|
200
|
+
function isSafeRepositoryInventoryPipeSegment(commandName, argv) {
|
|
201
|
+
if (commandName === "sed") {
|
|
202
|
+
return isSafeSedInventoryFilter(argv);
|
|
203
|
+
}
|
|
204
|
+
const spec = REPO_INVENTORY_PIPE_FILTERS.get(commandName);
|
|
205
|
+
if (!spec) {
|
|
206
|
+
return false;
|
|
207
|
+
}
|
|
208
|
+
return isStdinOnlyFilter(argv, spec);
|
|
209
|
+
}
|
|
210
|
+
function isSafeSedInventoryFilter(argv) {
|
|
211
|
+
const scripts = [];
|
|
212
|
+
for (let index = 1; index < argv.length; index += 1) {
|
|
213
|
+
const arg = argv[index];
|
|
214
|
+
if (arg === "-") {
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
if (arg === "-n" || arg === "-E" || arg === "-r") {
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
if (arg === "-e") {
|
|
221
|
+
index += 1;
|
|
222
|
+
if (index >= argv.length) {
|
|
223
|
+
return false;
|
|
224
|
+
}
|
|
225
|
+
scripts.push(argv[index]);
|
|
226
|
+
continue;
|
|
227
|
+
}
|
|
228
|
+
if (arg.startsWith("-")) {
|
|
229
|
+
return false;
|
|
230
|
+
}
|
|
231
|
+
scripts.push(arg);
|
|
232
|
+
}
|
|
233
|
+
if (scripts.length === 0 || scripts.length > 2) {
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
return scripts.every((script) => {
|
|
237
|
+
if (/^(?:\d+|\$)?(?:,\s*(?:\d+|\$))?p$/u.test(script)) {
|
|
238
|
+
return true;
|
|
239
|
+
}
|
|
240
|
+
return /^s(.)(?:\^?[^\\\n]*)\1(?:[^\\\n]*)\1[gIp]*$/u.test(script);
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
function isSafeRepositoryInventorySource(argv) {
|
|
244
|
+
const commandName = getCommandName(argv);
|
|
245
|
+
if (commandName === "find") {
|
|
246
|
+
return argv.every((arg) => !FIND_EXEC_ACTIONS.has(arg));
|
|
247
|
+
}
|
|
248
|
+
if (commandName === "fd" || commandName === "fdfind") {
|
|
249
|
+
return argv.every((arg) => !FD_EXEC_OPTIONS.has(arg) && !arg.startsWith("--exec=") && !arg.startsWith("--exec-batch="));
|
|
250
|
+
}
|
|
251
|
+
return true;
|
|
252
|
+
}
|
|
253
|
+
export function isRepositoryInventoryCommand(input) {
|
|
254
|
+
const argv = input.argv?.length ? getEffectiveCommandArgv(input) : getRepositoryInventorySourceArgv(input.command ?? "");
|
|
255
|
+
const argv0 = getCommandName(argv);
|
|
256
|
+
if (!argv0) {
|
|
257
|
+
return false;
|
|
258
|
+
}
|
|
259
|
+
if (REPO_INVENTORY_COMMANDS.has(argv0)) {
|
|
260
|
+
return true;
|
|
261
|
+
}
|
|
262
|
+
if (argv0 === "rg" && argv.includes("--files")) {
|
|
263
|
+
return true;
|
|
264
|
+
}
|
|
265
|
+
if (argv0 === "git" && getGitSubcommand(argv) === "ls-files") {
|
|
266
|
+
return true;
|
|
267
|
+
}
|
|
268
|
+
return false;
|
|
269
|
+
}
|
|
270
|
+
export function getRepositoryInventorySafety(command) {
|
|
271
|
+
const effectiveCommand = stripLeadingCdPrefix(command);
|
|
272
|
+
const sourceArgv = getRepositoryInventorySourceArgv(effectiveCommand);
|
|
273
|
+
if (!isRepositoryInventoryCommand({ argv: sourceArgv })) {
|
|
274
|
+
return "not-inventory";
|
|
275
|
+
}
|
|
276
|
+
if (!isSafeRepositoryInventorySource(sourceArgv)) {
|
|
277
|
+
return "unsafe-pipeline";
|
|
278
|
+
}
|
|
279
|
+
if (hasSequentialShellCommands(effectiveCommand)) {
|
|
280
|
+
return "sequential-command";
|
|
281
|
+
}
|
|
282
|
+
const segments = splitUnquotedPipes(effectiveCommand);
|
|
283
|
+
if (segments.length <= 1) {
|
|
284
|
+
return "safe";
|
|
285
|
+
}
|
|
286
|
+
const safePipeline = segments.slice(1).every((segment) => {
|
|
287
|
+
const argv = tokenizeCommand(segment);
|
|
288
|
+
const commandName = getCommandName(argv);
|
|
289
|
+
return commandName !== null && isSafeRepositoryInventoryPipeSegment(commandName, argv);
|
|
290
|
+
});
|
|
291
|
+
return safePipeline ? "safe" : "unsafe-pipeline";
|
|
292
|
+
}
|
|
293
|
+
export function isSafeRepositoryInventoryPipeline(command) {
|
|
294
|
+
return getRepositoryInventorySafety(command) === "safe";
|
|
295
|
+
}
|
|
296
|
+
export function isRepositoryInspectionCommand(input) {
|
|
297
|
+
const argv = input.argv?.length ? getEffectiveCommandArgv(input) : getRepositoryInventorySourceArgv(input.command ?? "");
|
|
298
|
+
const argv0 = getCommandName(argv);
|
|
299
|
+
if (isFileContentInspectionCommand(input)) {
|
|
300
|
+
return true;
|
|
301
|
+
}
|
|
302
|
+
if (isRepositoryInventoryCommand(input)) {
|
|
303
|
+
return true;
|
|
304
|
+
}
|
|
305
|
+
if (argv0 && REPO_INSPECTION_ONLY_COMMANDS.has(argv0)) {
|
|
306
|
+
return true;
|
|
307
|
+
}
|
|
308
|
+
return false;
|
|
309
|
+
}
|
|
310
|
+
export function hasCommandOnlyFileContentSummary(command) {
|
|
311
|
+
const effectiveCommand = stripLeadingCdPrefix(command);
|
|
312
|
+
return /\bpackage-lock\.json\b/u.test(effectiveCommand);
|
|
313
|
+
}
|
|
314
|
+
export function getSafeRepositoryInventorySourceArgv(command) {
|
|
315
|
+
return getRepositoryInventorySafety(command) === "safe"
|
|
316
|
+
? getRepositoryInventorySourceArgv(command)
|
|
317
|
+
: null;
|
|
318
|
+
}
|
|
319
|
+
export function getInspectionCommandSkipReason(command, policy) {
|
|
320
|
+
if (policy === "compact-all") {
|
|
321
|
+
return null;
|
|
322
|
+
}
|
|
323
|
+
if (policy === "skip-all") {
|
|
324
|
+
return isRepositoryInspectionCommand({ command }) ? "inspection-command" : null;
|
|
325
|
+
}
|
|
326
|
+
if (isFileContentInspectionCommand({ command }) && !hasCommandOnlyFileContentSummary(command)) {
|
|
327
|
+
return "file-content-inspection-command";
|
|
328
|
+
}
|
|
329
|
+
if (policy === "skip-file-content") {
|
|
330
|
+
return null;
|
|
331
|
+
}
|
|
332
|
+
if (isRepositoryInspectionCommand({ command })) {
|
|
333
|
+
const sourceArgv = getRepositoryInventorySourceArgv(command);
|
|
334
|
+
const argv0 = getCommandName(sourceArgv);
|
|
335
|
+
if (argv0 && REPO_INSPECTION_ONLY_COMMANDS.has(argv0)) {
|
|
336
|
+
return "inspection-command";
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
const inventorySafety = getRepositoryInventorySafety(command);
|
|
340
|
+
if (inventorySafety === "sequential-command") {
|
|
341
|
+
return "sequential-inventory-command";
|
|
342
|
+
}
|
|
343
|
+
if (inventorySafety === "unsafe-pipeline") {
|
|
344
|
+
return "unsafe-inventory-pipeline";
|
|
345
|
+
}
|
|
346
|
+
return null;
|
|
347
|
+
}
|