@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,584 @@
|
|
|
1
|
+
import { chmod, lstat, mkdir, mkdtemp, realpath, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
2
|
+
import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
3
|
+
import { buildTokenjuiceGuidanceBullets, TOKENJUICE_FULL_COMMAND, TOKENJUICE_RAW_COMMAND, TOKENJUICE_WRAP_COMMAND, } from "../shared/instruction-guidance.js";
|
|
4
|
+
import { buildInstructionDoctorReportFields, instructionDoctorStatusFromIssues, } from "../shared/instruction-doctor.js";
|
|
5
|
+
import { collectGuidanceIssues, readInstructionFile } from "../shared/instruction-file.js";
|
|
6
|
+
const TOKENJUICE_QODO_FIX_COMMAND = "tokenjuice install qodo";
|
|
7
|
+
const TOKENJUICE_QODO_BEGIN = "# tokenjuice:qodo begin";
|
|
8
|
+
const TOKENJUICE_QODO_END = "# tokenjuice:qodo end";
|
|
9
|
+
const TOKENJUICE_QODO_ADVISORY = "Qodo support is beta and review-guideline based; Qodo still owns pull-request review, CI feedback, and comment delivery.";
|
|
10
|
+
const TOML_REVIEW_AGENT_KEY = String.raw `(?:"review_agent"|'review_agent'|review_agent)`;
|
|
11
|
+
const TOML_ISSUES_GUIDELINES_KEY = String.raw `(?:"issues_user_guidelines"|'issues_user_guidelines'|issues_user_guidelines)`;
|
|
12
|
+
const TOML_COMPLIANCE_GUIDELINES_KEY = String.raw `(?:"compliance_user_guidelines"|'compliance_user_guidelines'|compliance_user_guidelines)`;
|
|
13
|
+
const DOTTED_ISSUES_GUIDELINES_PATTERN = new RegExp(String.raw `^\s*${TOML_REVIEW_AGENT_KEY}\s*\.\s*${TOML_ISSUES_GUIDELINES_KEY}\s*=`, "u");
|
|
14
|
+
const DOTTED_COMPLIANCE_GUIDELINES_PATTERN = new RegExp(String.raw `^\s*${TOML_REVIEW_AGENT_KEY}\s*\.\s*${TOML_COMPLIANCE_GUIDELINES_KEY}\s*=`, "u");
|
|
15
|
+
const INLINE_REVIEW_AGENT_TABLE_PATTERN = new RegExp(String.raw `^\s*${TOML_REVIEW_AGENT_KEY}\s*=\s*\{`, "u");
|
|
16
|
+
const ISSUES_GUIDELINES_KEY_PATTERN = new RegExp(String.raw `^\s*${TOML_ISSUES_GUIDELINES_KEY}\s*=`, "u");
|
|
17
|
+
const COMPLIANCE_GUIDELINES_KEY_PATTERN = new RegExp(String.raw `^\s*${TOML_COMPLIANCE_GUIDELINES_KEY}\s*=`, "u");
|
|
18
|
+
function getExplicitProjectDir(options = {}) {
|
|
19
|
+
return options.projectDir || process.env.QODO_PROJECT_DIR;
|
|
20
|
+
}
|
|
21
|
+
async function hasGitMetadata(dir) {
|
|
22
|
+
try {
|
|
23
|
+
await stat(join(dir, ".git"));
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
async function findGitRoot(startDir) {
|
|
31
|
+
let current = resolve(startDir);
|
|
32
|
+
while (true) {
|
|
33
|
+
if (await hasGitMetadata(current)) {
|
|
34
|
+
return current;
|
|
35
|
+
}
|
|
36
|
+
const parent = dirname(current);
|
|
37
|
+
if (parent === current) {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
current = parent;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async function resolveProjectDir(options = {}) {
|
|
44
|
+
const explicitProjectDir = getExplicitProjectDir(options);
|
|
45
|
+
if (explicitProjectDir) {
|
|
46
|
+
return resolve(explicitProjectDir);
|
|
47
|
+
}
|
|
48
|
+
return (await findGitRoot(process.cwd())) ?? process.cwd();
|
|
49
|
+
}
|
|
50
|
+
function isInsideOrEqual(parentDir, childPath) {
|
|
51
|
+
const relativePath = relative(parentDir, childPath);
|
|
52
|
+
return relativePath === "" || (!relativePath.startsWith("..") && !isAbsolute(relativePath));
|
|
53
|
+
}
|
|
54
|
+
function getExpectedConfigPath(projectDir) {
|
|
55
|
+
return join(projectDir, ".pr_agent.toml");
|
|
56
|
+
}
|
|
57
|
+
async function realpathExistingAncestor(path) {
|
|
58
|
+
let current = path;
|
|
59
|
+
while (true) {
|
|
60
|
+
try {
|
|
61
|
+
return await realpath(current);
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
if (error.code !== "ENOENT") {
|
|
65
|
+
throw error;
|
|
66
|
+
}
|
|
67
|
+
const parent = dirname(current);
|
|
68
|
+
if (parent === current) {
|
|
69
|
+
throw error;
|
|
70
|
+
}
|
|
71
|
+
current = parent;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
async function rejectConfigSymlink(filePath) {
|
|
76
|
+
try {
|
|
77
|
+
const stats = await lstat(filePath);
|
|
78
|
+
if (stats.isSymbolicLink()) {
|
|
79
|
+
throw new Error(`cannot use Qodo config ${filePath}; tokenjuice will not read or write through instruction symlinks`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
if (error.code === "ENOENT") {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
throw error;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
async function rejectInstallSidecarSymlinks(filePath) {
|
|
90
|
+
await rejectConfigSymlink(`${filePath}.bak`);
|
|
91
|
+
await rejectConfigSymlink(`${filePath}.tmp`);
|
|
92
|
+
}
|
|
93
|
+
async function rejectSymlinkPathComponents(filePath, projectDir) {
|
|
94
|
+
const relativePath = relative(projectDir, filePath);
|
|
95
|
+
const segments = relativePath.split(sep).filter(Boolean);
|
|
96
|
+
let currentPath = projectDir;
|
|
97
|
+
for (const segment of segments.slice(0, -1)) {
|
|
98
|
+
currentPath = join(currentPath, segment);
|
|
99
|
+
try {
|
|
100
|
+
const stats = await lstat(currentPath);
|
|
101
|
+
if (stats.isSymbolicLink()) {
|
|
102
|
+
throw new Error(`cannot use Qodo config ${filePath}; tokenjuice will not read or write through instruction symlinks`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
if (error.code === "ENOENT") {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
throw error;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
async function resolveSafeProjectConfigPath(filePath, projectDir, realProjectDir = projectDir) {
|
|
114
|
+
const resolvedPath = resolve(filePath);
|
|
115
|
+
if (projectDir !== realProjectDir) {
|
|
116
|
+
throw new Error(`cannot use Qodo config ${resolvedPath}; tokenjuice will not read or write through instruction symlinks`);
|
|
117
|
+
}
|
|
118
|
+
const realParentDir = await realpathExistingAncestor(dirname(resolvedPath));
|
|
119
|
+
if (!isInsideOrEqual(realProjectDir, realParentDir)) {
|
|
120
|
+
throw new Error(`cannot use Qodo config ${resolvedPath}; tokenjuice will not write through instruction directories outside ${realProjectDir}`);
|
|
121
|
+
}
|
|
122
|
+
await rejectConfigSymlink(projectDir);
|
|
123
|
+
await rejectSymlinkPathComponents(resolvedPath, projectDir);
|
|
124
|
+
await rejectConfigSymlink(resolvedPath);
|
|
125
|
+
const expectedConfigPath = getExpectedConfigPath(projectDir);
|
|
126
|
+
if (resolvedPath !== expectedConfigPath) {
|
|
127
|
+
throw new Error(`cannot use Qodo config ${resolvedPath}; tokenjuice only installs the project-local .pr_agent.toml config`);
|
|
128
|
+
}
|
|
129
|
+
return resolvedPath;
|
|
130
|
+
}
|
|
131
|
+
async function getDefaultConfigPath(options = {}) {
|
|
132
|
+
const projectDir = await resolveProjectDir(options);
|
|
133
|
+
const realProjectDir = await realpath(projectDir).catch(() => projectDir);
|
|
134
|
+
return resolveSafeProjectConfigPath(getExpectedConfigPath(projectDir), projectDir, realProjectDir);
|
|
135
|
+
}
|
|
136
|
+
async function getDefaultAliasPath(options = {}) {
|
|
137
|
+
return getExpectedConfigPath(await resolveProjectDir(options));
|
|
138
|
+
}
|
|
139
|
+
async function resolveConfigPath(configPath, options = {}) {
|
|
140
|
+
if (configPath) {
|
|
141
|
+
const projectDir = await resolveProjectDir(options);
|
|
142
|
+
const realProjectDir = await realpath(projectDir).catch(() => projectDir);
|
|
143
|
+
return resolveSafeProjectConfigPath(configPath, projectDir, realProjectDir);
|
|
144
|
+
}
|
|
145
|
+
return getDefaultConfigPath(options);
|
|
146
|
+
}
|
|
147
|
+
async function getExistingFileMode(filePath, existing) {
|
|
148
|
+
if (!existing.exists) {
|
|
149
|
+
return undefined;
|
|
150
|
+
}
|
|
151
|
+
return (await lstat(filePath)).mode & 0o777;
|
|
152
|
+
}
|
|
153
|
+
async function writeQodoConfigAtomically(filePath, text, mode) {
|
|
154
|
+
const fileMode = mode ?? 0o600;
|
|
155
|
+
await mkdir(dirname(filePath), { recursive: true, mode: 0o700 });
|
|
156
|
+
const tempDir = await mkdtemp(join(dirname(filePath), ".tokenjuice-"));
|
|
157
|
+
const tempPath = join(tempDir, "write");
|
|
158
|
+
try {
|
|
159
|
+
await writeFile(tempPath, text, { encoding: "utf8", flag: "wx", mode: fileMode });
|
|
160
|
+
await chmod(tempPath, fileMode);
|
|
161
|
+
await rename(tempPath, filePath);
|
|
162
|
+
}
|
|
163
|
+
finally {
|
|
164
|
+
await rm(tempDir, { recursive: true, force: true });
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
async function chooseQodoBackupPath(filePath) {
|
|
168
|
+
for (let index = 0;; index += 1) {
|
|
169
|
+
const candidate = index === 0 ? `${filePath}.bak` : `${filePath}.bak.${index}`;
|
|
170
|
+
try {
|
|
171
|
+
const stats = await lstat(candidate);
|
|
172
|
+
if (stats.isSymbolicLink()) {
|
|
173
|
+
throw new Error(`cannot use Qodo config ${filePath}; tokenjuice will not read or write through instruction symlinks`);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
catch (error) {
|
|
177
|
+
if (error.code === "ENOENT") {
|
|
178
|
+
return candidate;
|
|
179
|
+
}
|
|
180
|
+
throw error;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
async function writeQodoConfigFile(filePath, text, existing) {
|
|
185
|
+
const mode = await getExistingFileMode(filePath, existing);
|
|
186
|
+
let backupPath;
|
|
187
|
+
if (existing.exists) {
|
|
188
|
+
backupPath = await chooseQodoBackupPath(filePath);
|
|
189
|
+
await writeFile(backupPath, existing.text, { encoding: "utf8", flag: "wx", mode: mode ?? 0o600 });
|
|
190
|
+
await chmod(backupPath, mode ?? 0o600);
|
|
191
|
+
}
|
|
192
|
+
await writeQodoConfigAtomically(filePath, text, mode);
|
|
193
|
+
return {
|
|
194
|
+
configPath: filePath,
|
|
195
|
+
...(backupPath ? { backupPath } : {}),
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
function getStructuralMarkerLines(text, marker) {
|
|
199
|
+
const lines = text.split("\n");
|
|
200
|
+
const structureLines = getTomlStructureLines(lines);
|
|
201
|
+
return {
|
|
202
|
+
lines,
|
|
203
|
+
markerLines: structureLines.flatMap((line, index) => (line.trim() === marker ? [index] : [])),
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
function findTokenjuiceBlockLineRange(text) {
|
|
207
|
+
const begin = getStructuralMarkerLines(text, TOKENJUICE_QODO_BEGIN);
|
|
208
|
+
const end = getStructuralMarkerLines(text, TOKENJUICE_QODO_END);
|
|
209
|
+
if (begin.markerLines.length !== 1 || end.markerLines.length !== 1 || end.markerLines[0] < begin.markerLines[0]) {
|
|
210
|
+
return undefined;
|
|
211
|
+
}
|
|
212
|
+
return {
|
|
213
|
+
lines: begin.lines,
|
|
214
|
+
start: begin.markerLines[0],
|
|
215
|
+
end: end.markerLines[0] + 1,
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
function hasMalformedMarkerStructure(text) {
|
|
219
|
+
const begin = getStructuralMarkerLines(text, TOKENJUICE_QODO_BEGIN);
|
|
220
|
+
const end = getStructuralMarkerLines(text, TOKENJUICE_QODO_END);
|
|
221
|
+
const beginCount = begin.markerLines.length;
|
|
222
|
+
const endCount = end.markerLines.length;
|
|
223
|
+
return beginCount !== endCount || beginCount > 1 || endCount > 1 || (beginCount === 1 && end.markerLines[0] < begin.markerLines[0]);
|
|
224
|
+
}
|
|
225
|
+
function hasStructuralTokenjuiceMarker(text) {
|
|
226
|
+
return getStructuralMarkerLines(text, TOKENJUICE_QODO_BEGIN).markerLines.length > 0 || getStructuralMarkerLines(text, TOKENJUICE_QODO_END).markerLines.length > 0;
|
|
227
|
+
}
|
|
228
|
+
function hasTokenjuiceBlock(text) {
|
|
229
|
+
return Boolean(findTokenjuiceBlockLineRange(text));
|
|
230
|
+
}
|
|
231
|
+
function getTokenjuiceBlockText(text) {
|
|
232
|
+
const range = findTokenjuiceBlockLineRange(text);
|
|
233
|
+
if (!range) {
|
|
234
|
+
return "";
|
|
235
|
+
}
|
|
236
|
+
return range.lines.slice(range.start, range.end).join("\n");
|
|
237
|
+
}
|
|
238
|
+
function isTokenjuiceBlockInsideReviewAgentTable(text) {
|
|
239
|
+
const blockRange = findTokenjuiceBlockLineRange(text);
|
|
240
|
+
if (!blockRange) {
|
|
241
|
+
return false;
|
|
242
|
+
}
|
|
243
|
+
const reviewAgentRange = findReviewAgentTableRange(blockRange.lines);
|
|
244
|
+
return Boolean(reviewAgentRange && blockRange.start > reviewAgentRange.start && blockRange.end <= reviewAgentRange.end);
|
|
245
|
+
}
|
|
246
|
+
function hasTokenjuiceGuidelineAssignments(text) {
|
|
247
|
+
const blockRange = findTokenjuiceBlockLineRange(text);
|
|
248
|
+
if (!blockRange) {
|
|
249
|
+
return false;
|
|
250
|
+
}
|
|
251
|
+
const structuralBlockLines = getTomlStructureLines(blockRange.lines).slice(blockRange.start, blockRange.end);
|
|
252
|
+
return (structuralBlockLines.some((line) => ISSUES_GUIDELINES_KEY_PATTERN.test(line)) &&
|
|
253
|
+
structuralBlockLines.some((line) => COMPLIANCE_GUIDELINES_KEY_PATTERN.test(line)));
|
|
254
|
+
}
|
|
255
|
+
function removeTokenjuiceBlock(text) {
|
|
256
|
+
const range = findTokenjuiceBlockLineRange(text);
|
|
257
|
+
if (!range) {
|
|
258
|
+
return { text, removed: false };
|
|
259
|
+
}
|
|
260
|
+
const before = range.lines.slice(0, range.start);
|
|
261
|
+
const after = range.lines.slice(range.end);
|
|
262
|
+
const needsBoundaryBlank = before.length > 0 && after.length > 0 && before.at(-1) !== "" && after[0] !== "";
|
|
263
|
+
const next = [...before, ...(needsBoundaryBlank ? [""] : []), ...after];
|
|
264
|
+
return {
|
|
265
|
+
text: next.join("\n"),
|
|
266
|
+
removed: true,
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
function readTableName(line) {
|
|
270
|
+
const match = /^\s*\[([^\]\n]+)\]\s*(?:#.*)?$/u.exec(line);
|
|
271
|
+
const name = match?.[1]?.trim();
|
|
272
|
+
if (name === '"review_agent"' || name === "'review_agent'") {
|
|
273
|
+
return "review_agent";
|
|
274
|
+
}
|
|
275
|
+
return name;
|
|
276
|
+
}
|
|
277
|
+
function isEscaped(text, index) {
|
|
278
|
+
let slashCount = 0;
|
|
279
|
+
for (let cursor = index - 1; cursor >= 0 && text[cursor] === "\\"; cursor -= 1) {
|
|
280
|
+
slashCount += 1;
|
|
281
|
+
}
|
|
282
|
+
return slashCount % 2 === 1;
|
|
283
|
+
}
|
|
284
|
+
function findTomlMultilineClose(line, delimiter, fromIndex) {
|
|
285
|
+
let searchIndex = fromIndex;
|
|
286
|
+
while (searchIndex < line.length) {
|
|
287
|
+
const closeIndex = line.indexOf(delimiter, searchIndex);
|
|
288
|
+
if (closeIndex === -1) {
|
|
289
|
+
return -1;
|
|
290
|
+
}
|
|
291
|
+
if (delimiter === "'''" || !isEscaped(line, closeIndex)) {
|
|
292
|
+
return closeIndex;
|
|
293
|
+
}
|
|
294
|
+
searchIndex = closeIndex + 1;
|
|
295
|
+
}
|
|
296
|
+
return -1;
|
|
297
|
+
}
|
|
298
|
+
function updateTomlMultilineState(line, state) {
|
|
299
|
+
let index = 0;
|
|
300
|
+
let inBasicString = false;
|
|
301
|
+
let inLiteralString = false;
|
|
302
|
+
while (index < line.length) {
|
|
303
|
+
if (state.delimiter) {
|
|
304
|
+
const closeIndex = findTomlMultilineClose(line, state.delimiter, index);
|
|
305
|
+
if (closeIndex === -1) {
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
index = closeIndex + state.delimiter.length;
|
|
309
|
+
state.delimiter = undefined;
|
|
310
|
+
continue;
|
|
311
|
+
}
|
|
312
|
+
const next = line.slice(index, index + 3);
|
|
313
|
+
const char = line[index];
|
|
314
|
+
if (inBasicString) {
|
|
315
|
+
if (char === "\"" && !isEscaped(line, index)) {
|
|
316
|
+
inBasicString = false;
|
|
317
|
+
}
|
|
318
|
+
index += 1;
|
|
319
|
+
continue;
|
|
320
|
+
}
|
|
321
|
+
if (inLiteralString) {
|
|
322
|
+
if (char === "'") {
|
|
323
|
+
inLiteralString = false;
|
|
324
|
+
}
|
|
325
|
+
index += 1;
|
|
326
|
+
continue;
|
|
327
|
+
}
|
|
328
|
+
if (char === "#") {
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
if (next === "\"\"\"" || next === "'''") {
|
|
332
|
+
const closeIndex = findTomlMultilineClose(line, next, index + next.length);
|
|
333
|
+
if (closeIndex === -1) {
|
|
334
|
+
state.delimiter = next;
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
index = closeIndex + next.length;
|
|
338
|
+
continue;
|
|
339
|
+
}
|
|
340
|
+
if (char === "\"") {
|
|
341
|
+
inBasicString = true;
|
|
342
|
+
}
|
|
343
|
+
else if (char === "'") {
|
|
344
|
+
inLiteralString = true;
|
|
345
|
+
}
|
|
346
|
+
index += 1;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
function getTomlStructureLines(lines) {
|
|
350
|
+
const state = { delimiter: undefined };
|
|
351
|
+
return lines.map((line) => {
|
|
352
|
+
const structuralLine = state.delimiter ? "" : line;
|
|
353
|
+
updateTomlMultilineState(line, state);
|
|
354
|
+
return structuralLine;
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
function isTomlTableHeader(line) {
|
|
358
|
+
return /^\s*(?:\[[^\]\n]+\]|\[\[[^\]\n]+\]\])\s*(?:#.*)?$/u.test(line);
|
|
359
|
+
}
|
|
360
|
+
function findReviewAgentTableRange(lines) {
|
|
361
|
+
const structureLines = getTomlStructureLines(lines);
|
|
362
|
+
const start = structureLines.findIndex((line) => readTableName(line) === "review_agent");
|
|
363
|
+
if (start === -1) {
|
|
364
|
+
return undefined;
|
|
365
|
+
}
|
|
366
|
+
const nextTableOffset = structureLines.slice(start + 1).findIndex((line) => isTomlTableHeader(line));
|
|
367
|
+
return {
|
|
368
|
+
start,
|
|
369
|
+
end: nextTableOffset === -1 ? lines.length : start + 1 + nextTableOffset,
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
function getRootLines(lines) {
|
|
373
|
+
const structureLines = getTomlStructureLines(lines);
|
|
374
|
+
const firstTableIndex = structureLines.findIndex((line) => isTomlTableHeader(line));
|
|
375
|
+
return firstTableIndex === -1 ? structureLines : structureLines.slice(0, firstTableIndex);
|
|
376
|
+
}
|
|
377
|
+
function hasUserOwnedGuideline(text) {
|
|
378
|
+
const lines = text.split("\n");
|
|
379
|
+
if (getRootLines(lines).some((line) => DOTTED_ISSUES_GUIDELINES_PATTERN.test(line) || DOTTED_COMPLIANCE_GUIDELINES_PATTERN.test(line))) {
|
|
380
|
+
return true;
|
|
381
|
+
}
|
|
382
|
+
const range = findReviewAgentTableRange(lines);
|
|
383
|
+
if (!range) {
|
|
384
|
+
return false;
|
|
385
|
+
}
|
|
386
|
+
return getTomlStructureLines(lines)
|
|
387
|
+
.slice(range.start + 1, range.end)
|
|
388
|
+
.some((line) => ISSUES_GUIDELINES_KEY_PATTERN.test(line) || COMPLIANCE_GUIDELINES_KEY_PATTERN.test(line));
|
|
389
|
+
}
|
|
390
|
+
function hasInlineReviewAgentTable(text) {
|
|
391
|
+
return getRootLines(text.split("\n")).some((line) => INLINE_REVIEW_AGENT_TABLE_PATTERN.test(line));
|
|
392
|
+
}
|
|
393
|
+
const TOKENJUICE_QODO_GUIDANCE = [
|
|
394
|
+
"tokenjuice terminal output compaction",
|
|
395
|
+
"",
|
|
396
|
+
...buildTokenjuiceGuidanceBullets({
|
|
397
|
+
wrapBullet: "- When Qodo review, ask, checks, or generated-fix workflows suggest terminal commands likely to produce long output, prefer `tokenjuice wrap -- <command>`.",
|
|
398
|
+
}),
|
|
399
|
+
].join("\n");
|
|
400
|
+
function createReviewAgentGuidelinesBlock() {
|
|
401
|
+
return [
|
|
402
|
+
TOKENJUICE_QODO_BEGIN,
|
|
403
|
+
'issues_user_guidelines = """',
|
|
404
|
+
TOKENJUICE_QODO_GUIDANCE,
|
|
405
|
+
'"""',
|
|
406
|
+
'compliance_user_guidelines = """',
|
|
407
|
+
TOKENJUICE_QODO_GUIDANCE,
|
|
408
|
+
'"""',
|
|
409
|
+
TOKENJUICE_QODO_END,
|
|
410
|
+
].join("\n");
|
|
411
|
+
}
|
|
412
|
+
function installTokenjuiceBlock(text) {
|
|
413
|
+
const withoutTokenjuice = removeTokenjuiceBlock(text).text.trimEnd();
|
|
414
|
+
const block = createReviewAgentGuidelinesBlock().split("\n");
|
|
415
|
+
const lines = withoutTokenjuice ? withoutTokenjuice.split("\n") : [];
|
|
416
|
+
const range = findReviewAgentTableRange(lines);
|
|
417
|
+
if (!range) {
|
|
418
|
+
return `${withoutTokenjuice}${withoutTokenjuice ? "\n\n" : ""}[review_agent]\n${block.join("\n")}\n`;
|
|
419
|
+
}
|
|
420
|
+
const next = [
|
|
421
|
+
...lines.slice(0, range.end),
|
|
422
|
+
...(range.end > range.start + 1 ? [""] : []),
|
|
423
|
+
...block,
|
|
424
|
+
...((range.end < lines.length && lines[range.end] !== "") ? [""] : []),
|
|
425
|
+
...lines.slice(range.end),
|
|
426
|
+
];
|
|
427
|
+
return `${next.join("\n").replace(/\n{3,}/gu, "\n\n").trimEnd()}\n`;
|
|
428
|
+
}
|
|
429
|
+
function removeEmptyReviewAgentTable(text) {
|
|
430
|
+
const trimmed = text.trimEnd();
|
|
431
|
+
if (!trimmed) {
|
|
432
|
+
return "";
|
|
433
|
+
}
|
|
434
|
+
const lines = trimmed.split("\n");
|
|
435
|
+
const range = findReviewAgentTableRange(lines);
|
|
436
|
+
if (!range) {
|
|
437
|
+
return trimmed;
|
|
438
|
+
}
|
|
439
|
+
const tableBody = lines.slice(range.start + 1, range.end).join("\n").trim();
|
|
440
|
+
if (tableBody) {
|
|
441
|
+
return trimmed;
|
|
442
|
+
}
|
|
443
|
+
const next = [...lines.slice(0, range.start), ...lines.slice(range.end)];
|
|
444
|
+
return next.join("\n").replace(/\n{3,}/gu, "\n\n").trimEnd();
|
|
445
|
+
}
|
|
446
|
+
export async function installQodoReviewConfig(configPath, options = {}) {
|
|
447
|
+
const resolvedConfigPath = await resolveConfigPath(configPath, options);
|
|
448
|
+
await rejectInstallSidecarSymlinks(resolvedConfigPath);
|
|
449
|
+
const existing = await readInstructionFile(resolvedConfigPath);
|
|
450
|
+
if (existing.exists && hasMalformedMarkerStructure(existing.text)) {
|
|
451
|
+
throw new Error(`cannot safely repair malformed tokenjuice Qodo markers in ${resolvedConfigPath}; remove the dangling marker manually, then rerun tokenjuice install qodo`);
|
|
452
|
+
}
|
|
453
|
+
const withoutTokenjuice = removeTokenjuiceBlock(existing.text).text;
|
|
454
|
+
if (hasInlineReviewAgentTable(withoutTokenjuice)) {
|
|
455
|
+
throw new Error(`cannot install Qodo guidance because ${resolvedConfigPath} defines review_agent as an inline TOML table; convert it to a [review_agent] table, then rerun tokenjuice install qodo`);
|
|
456
|
+
}
|
|
457
|
+
if (hasUserOwnedGuideline(withoutTokenjuice)) {
|
|
458
|
+
throw new Error(`cannot install Qodo guidance because ${resolvedConfigPath} already defines review_agent user guidelines; merge tokenjuice guidance manually or remove those settings, then rerun tokenjuice install qodo`);
|
|
459
|
+
}
|
|
460
|
+
return writeQodoConfigFile(resolvedConfigPath, installTokenjuiceBlock(existing.text), existing);
|
|
461
|
+
}
|
|
462
|
+
export async function uninstallQodoReviewConfig(configPath, options = {}) {
|
|
463
|
+
const resolvedConfigPath = await resolveConfigPath(configPath, options);
|
|
464
|
+
const existing = await readInstructionFile(resolvedConfigPath);
|
|
465
|
+
if (!existing.exists) {
|
|
466
|
+
return { configPath: resolvedConfigPath, removed: false };
|
|
467
|
+
}
|
|
468
|
+
if (hasMalformedMarkerStructure(existing.text)) {
|
|
469
|
+
throw new Error(`cannot safely uninstall malformed tokenjuice Qodo markers in ${resolvedConfigPath}; remove the dangling marker manually, then rerun tokenjuice uninstall qodo`);
|
|
470
|
+
}
|
|
471
|
+
const result = removeTokenjuiceBlock(existing.text);
|
|
472
|
+
if (result.removed) {
|
|
473
|
+
const nextText = removeEmptyReviewAgentTable(result.text);
|
|
474
|
+
if (nextText.trim()) {
|
|
475
|
+
await writeQodoConfigFile(resolvedConfigPath, `${nextText}\n`, existing);
|
|
476
|
+
}
|
|
477
|
+
else {
|
|
478
|
+
await rm(resolvedConfigPath, { force: true });
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
return { configPath: resolvedConfigPath, removed: result.removed };
|
|
482
|
+
}
|
|
483
|
+
export async function doctorQodoReviewConfig(configPath, options = {}) {
|
|
484
|
+
let resolvedConfigPath;
|
|
485
|
+
try {
|
|
486
|
+
resolvedConfigPath = await resolveConfigPath(configPath, options);
|
|
487
|
+
}
|
|
488
|
+
catch (error) {
|
|
489
|
+
const aliasPath = configPath ?? (await getDefaultAliasPath(options));
|
|
490
|
+
return {
|
|
491
|
+
configPath: aliasPath,
|
|
492
|
+
hasTokenjuiceMarker: false,
|
|
493
|
+
...buildInstructionDoctorReportFields({
|
|
494
|
+
status: "broken",
|
|
495
|
+
issues: [error.message],
|
|
496
|
+
advisory: TOKENJUICE_QODO_ADVISORY,
|
|
497
|
+
fixCommand: error.message.includes("outside") || error.message.includes("only installs")
|
|
498
|
+
? "use a project-local .pr_agent.toml path, then run tokenjuice install qodo"
|
|
499
|
+
: "replace symlinked Qodo config with a regular project file, then run tokenjuice install qodo",
|
|
500
|
+
}),
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
const existing = await readInstructionFile(resolvedConfigPath);
|
|
504
|
+
const hasTokenjuiceMarker = hasStructuralTokenjuiceMarker(existing.text);
|
|
505
|
+
if (existing.exists && hasMalformedMarkerStructure(existing.text)) {
|
|
506
|
+
return {
|
|
507
|
+
configPath: resolvedConfigPath,
|
|
508
|
+
hasTokenjuiceMarker,
|
|
509
|
+
...buildInstructionDoctorReportFields({
|
|
510
|
+
status: "broken",
|
|
511
|
+
issues: ["configured Qodo review config has unmatched or duplicate tokenjuice markers"],
|
|
512
|
+
advisory: TOKENJUICE_QODO_ADVISORY,
|
|
513
|
+
fixCommand: "remove unmatched tokenjuice markers from .pr_agent.toml, then run tokenjuice install qodo",
|
|
514
|
+
}),
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
if (!existing.exists || !hasTokenjuiceBlock(existing.text)) {
|
|
518
|
+
return {
|
|
519
|
+
configPath: resolvedConfigPath,
|
|
520
|
+
hasTokenjuiceMarker,
|
|
521
|
+
...buildInstructionDoctorReportFields({
|
|
522
|
+
status: "disabled",
|
|
523
|
+
issues: ["tokenjuice Qodo review guidance is not installed"],
|
|
524
|
+
advisory: TOKENJUICE_QODO_ADVISORY,
|
|
525
|
+
fixCommand: TOKENJUICE_QODO_FIX_COMMAND,
|
|
526
|
+
}),
|
|
527
|
+
};
|
|
528
|
+
}
|
|
529
|
+
const withoutTokenjuice = removeTokenjuiceBlock(existing.text).text;
|
|
530
|
+
const collisionIssues = [
|
|
531
|
+
...(hasInlineReviewAgentTable(withoutTokenjuice)
|
|
532
|
+
? ["configured Qodo review config defines review_agent as an inline TOML table outside the tokenjuice block"]
|
|
533
|
+
: []),
|
|
534
|
+
...(hasUserOwnedGuideline(withoutTokenjuice)
|
|
535
|
+
? ["configured Qodo review config has user-owned review-agent guidelines outside the tokenjuice block"]
|
|
536
|
+
: []),
|
|
537
|
+
];
|
|
538
|
+
const placementIssues = [
|
|
539
|
+
...(!isTokenjuiceBlockInsideReviewAgentTable(existing.text)
|
|
540
|
+
? ["configured Qodo tokenjuice block is outside the [review_agent] table"]
|
|
541
|
+
: []),
|
|
542
|
+
...(!hasTokenjuiceGuidelineAssignments(existing.text)
|
|
543
|
+
? ["configured Qodo tokenjuice block is missing review-agent guideline settings"]
|
|
544
|
+
: []),
|
|
545
|
+
];
|
|
546
|
+
const issues = [
|
|
547
|
+
...placementIssues,
|
|
548
|
+
...collisionIssues,
|
|
549
|
+
...collectGuidanceIssues(getTokenjuiceBlockText(existing.text), {
|
|
550
|
+
required: [
|
|
551
|
+
{
|
|
552
|
+
requiredText: TOKENJUICE_WRAP_COMMAND,
|
|
553
|
+
missingIssue: "configured Qodo review guidance is missing tokenjuice wrap guidance",
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
requiredText: TOKENJUICE_RAW_COMMAND,
|
|
557
|
+
missingIssue: "configured Qodo review guidance is missing the raw escape hatch",
|
|
558
|
+
},
|
|
559
|
+
],
|
|
560
|
+
forbidden: [
|
|
561
|
+
{
|
|
562
|
+
forbiddenText: TOKENJUICE_FULL_COMMAND,
|
|
563
|
+
presentIssue: "configured Qodo review guidance still suggests the full escape hatch",
|
|
564
|
+
},
|
|
565
|
+
],
|
|
566
|
+
}),
|
|
567
|
+
];
|
|
568
|
+
return {
|
|
569
|
+
configPath: resolvedConfigPath,
|
|
570
|
+
hasTokenjuiceMarker,
|
|
571
|
+
...buildInstructionDoctorReportFields({
|
|
572
|
+
status: instructionDoctorStatusFromIssues(issues),
|
|
573
|
+
issues,
|
|
574
|
+
advisory: TOKENJUICE_QODO_ADVISORY,
|
|
575
|
+
fixCommand: placementIssues.length > 0
|
|
576
|
+
? "move the tokenjuice Qodo block under [review_agent], then run tokenjuice install qodo"
|
|
577
|
+
: collisionIssues.length > 0
|
|
578
|
+
? "remove duplicate review_agent guideline settings outside the tokenjuice block, then run tokenjuice install qodo"
|
|
579
|
+
: hasMalformedMarkerStructure(existing.text)
|
|
580
|
+
? "remove unmatched tokenjuice markers from .pr_agent.toml, then run tokenjuice install qodo"
|
|
581
|
+
: TOKENJUICE_QODO_FIX_COMMAND,
|
|
582
|
+
}),
|
|
583
|
+
};
|
|
584
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type TokenjuiceHookCommandOptions } from "../shared/host-command.js";
|
|
2
|
+
export type QwenCodeHookCommandOptions = TokenjuiceHookCommandOptions & {
|
|
3
|
+
projectDir?: string;
|
|
4
|
+
};
|
|
5
|
+
export type InstallQwenCodeHookResult = {
|
|
6
|
+
settingsPath: string;
|
|
7
|
+
backupPath?: string;
|
|
8
|
+
command: string;
|
|
9
|
+
};
|
|
10
|
+
export type UninstallQwenCodeHookResult = {
|
|
11
|
+
settingsPath: string;
|
|
12
|
+
removed: number;
|
|
13
|
+
};
|
|
14
|
+
export type QwenCodeDoctorReport = {
|
|
15
|
+
settingsPath: string;
|
|
16
|
+
status: "ok" | "warn" | "broken" | "disabled";
|
|
17
|
+
issues: string[];
|
|
18
|
+
advisories: string[];
|
|
19
|
+
fixCommand: string;
|
|
20
|
+
expectedCommand: string;
|
|
21
|
+
detectedCommand?: string;
|
|
22
|
+
checkedPaths: string[];
|
|
23
|
+
missingPaths: string[];
|
|
24
|
+
};
|
|
25
|
+
export declare function installQwenCodeHook(settingsPath?: string, options?: QwenCodeHookCommandOptions): Promise<InstallQwenCodeHookResult>;
|
|
26
|
+
export declare function uninstallQwenCodeHook(settingsPath?: string, options?: QwenCodeHookCommandOptions): Promise<UninstallQwenCodeHookResult>;
|
|
27
|
+
export declare function doctorQwenCodeHook(settingsPath?: string, options?: QwenCodeHookCommandOptions): Promise<QwenCodeDoctorReport>;
|
|
28
|
+
export declare function runQwenCodePostToolUseHook(rawText: string): Promise<number>;
|