@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,596 @@
|
|
|
1
|
+
import { lstat, realpath, stat } 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 { collectGuidanceIssues, readInstructionFile, removeInstructionFile, writeInstructionFile } from "../shared/instruction-file.js";
|
|
5
|
+
import { buildInstructionDoctorReportFields } from "../shared/instruction-doctor.js";
|
|
6
|
+
import { collectMarkerDelimitedBlockIssues, inspectMarkerDelimitedBlock, uninstallMarkerDelimitedBlock, } from "../shared/marker-instructions.js";
|
|
7
|
+
const TOKENJUICE_ONA_FIX_COMMAND = "tokenjuice install ona";
|
|
8
|
+
const TOKENJUICE_ONA_OWNERSHIP_MARKER = "<!-- tokenjuice:ona skill -->";
|
|
9
|
+
const TOKENJUICE_ONA_SKILL_MARKER = "# tokenjuice terminal output compaction";
|
|
10
|
+
const TOKENJUICE_ONA_SKILL_PATH = ".ona/skills/tokenjuice/SKILL.md";
|
|
11
|
+
const TOKENJUICE_ONA_LEGACY_BEGIN = "<!-- tokenjuice:ona begin -->";
|
|
12
|
+
const TOKENJUICE_ONA_LEGACY_END = "<!-- tokenjuice:ona end -->";
|
|
13
|
+
const TOKENJUICE_ONA_ADVISORY = "Ona support is beta and skill-based; Ona discovers .ona/skills/tokenjuice/SKILL.md in workspace sessions, but tokenjuice does not intercept shell output.";
|
|
14
|
+
const TOKENJUICE_ONA_LEGACY_BLOCK_CONFIG = {
|
|
15
|
+
beginMarker: TOKENJUICE_ONA_LEGACY_BEGIN,
|
|
16
|
+
endMarker: TOKENJUICE_ONA_LEGACY_END,
|
|
17
|
+
block: [TOKENJUICE_ONA_LEGACY_BEGIN, "# tokenjuice terminal output compaction", TOKENJUICE_ONA_LEGACY_END].join("\n"),
|
|
18
|
+
};
|
|
19
|
+
function countMarker(text, marker) {
|
|
20
|
+
return text.split(marker).length - 1;
|
|
21
|
+
}
|
|
22
|
+
function hasMalformedLegacyMarkerStructure(text, completeBlockCount) {
|
|
23
|
+
const beginCount = countMarker(text, TOKENJUICE_ONA_LEGACY_BEGIN);
|
|
24
|
+
const endCount = countMarker(text, TOKENJUICE_ONA_LEGACY_END);
|
|
25
|
+
return beginCount !== endCount || beginCount !== completeBlockCount || endCount !== completeBlockCount;
|
|
26
|
+
}
|
|
27
|
+
function getExplicitProjectDir(options = {}) {
|
|
28
|
+
return options.projectDir || process.env.ONA_PROJECT_DIR;
|
|
29
|
+
}
|
|
30
|
+
async function hasGitMetadata(dir) {
|
|
31
|
+
try {
|
|
32
|
+
await stat(join(dir, ".git"));
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
async function findGitRoot(startDir) {
|
|
40
|
+
let current = resolve(startDir);
|
|
41
|
+
while (true) {
|
|
42
|
+
if (await hasGitMetadata(current)) {
|
|
43
|
+
return current;
|
|
44
|
+
}
|
|
45
|
+
const parent = dirname(current);
|
|
46
|
+
if (parent === current) {
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
current = parent;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
async function resolveProjectDir(options = {}) {
|
|
53
|
+
const explicitProjectDir = getExplicitProjectDir(options);
|
|
54
|
+
if (explicitProjectDir) {
|
|
55
|
+
return resolve(explicitProjectDir);
|
|
56
|
+
}
|
|
57
|
+
return (await findGitRoot(process.cwd())) ?? process.cwd();
|
|
58
|
+
}
|
|
59
|
+
async function resolveCanonicalProjectDir(options = {}) {
|
|
60
|
+
const projectDir = await resolveProjectDir(options);
|
|
61
|
+
await rejectSkillSymlink(projectDir);
|
|
62
|
+
return realpath(projectDir).catch(() => projectDir);
|
|
63
|
+
}
|
|
64
|
+
function isInsideOrEqual(parentDir, childPath) {
|
|
65
|
+
const relativePath = relative(parentDir, childPath);
|
|
66
|
+
return relativePath === "" || (!relativePath.startsWith("..") && !isAbsolute(relativePath));
|
|
67
|
+
}
|
|
68
|
+
async function realpathExistingAncestor(path) {
|
|
69
|
+
let current = path;
|
|
70
|
+
while (true) {
|
|
71
|
+
try {
|
|
72
|
+
return await realpath(current);
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
if (error.code !== "ENOENT") {
|
|
76
|
+
throw error;
|
|
77
|
+
}
|
|
78
|
+
const parent = dirname(current);
|
|
79
|
+
if (parent === current) {
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
82
|
+
current = parent;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
async function findExistingAncestor(path) {
|
|
87
|
+
let current = path;
|
|
88
|
+
while (true) {
|
|
89
|
+
try {
|
|
90
|
+
return { path: current, realPath: await realpath(current) };
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
if (error.code !== "ENOENT") {
|
|
94
|
+
throw error;
|
|
95
|
+
}
|
|
96
|
+
const parent = dirname(current);
|
|
97
|
+
if (parent === current) {
|
|
98
|
+
throw error;
|
|
99
|
+
}
|
|
100
|
+
current = parent;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
async function resolveCanonicalInstructionPath(filePath) {
|
|
105
|
+
const resolvedPath = resolve(filePath);
|
|
106
|
+
const existingAncestor = await findExistingAncestor(dirname(resolvedPath));
|
|
107
|
+
return join(existingAncestor.realPath, relative(existingAncestor.path, resolvedPath));
|
|
108
|
+
}
|
|
109
|
+
async function rejectSkillSymlink(filePath) {
|
|
110
|
+
try {
|
|
111
|
+
const stats = await lstat(filePath);
|
|
112
|
+
if (stats.isSymbolicLink()) {
|
|
113
|
+
throw new Error(`cannot use Ona skill ${filePath}; tokenjuice will not read or write through instruction symlinks`);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
if (error.code === "ENOENT") {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
throw error;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
async function isSymlink(filePath) {
|
|
124
|
+
try {
|
|
125
|
+
return (await lstat(filePath)).isSymbolicLink();
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
if (error.code === "ENOENT") {
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
throw error;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
async function rejectSkillPathComponentSymlinks(filePath, projectDir) {
|
|
135
|
+
const relativePath = relative(projectDir, filePath);
|
|
136
|
+
const segments = relativePath.split(sep).filter(Boolean);
|
|
137
|
+
let currentPath = projectDir;
|
|
138
|
+
for (const segment of segments.slice(0, -1)) {
|
|
139
|
+
currentPath = join(currentPath, segment);
|
|
140
|
+
try {
|
|
141
|
+
const stats = await lstat(currentPath);
|
|
142
|
+
if (stats.isSymbolicLink()) {
|
|
143
|
+
throw new Error(`cannot use Ona skill ${filePath}; tokenjuice will not read or write through instruction symlinks`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
catch (error) {
|
|
147
|
+
if (error.code === "ENOENT") {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
throw error;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
async function rejectInstallSidecarSymlinks(filePath) {
|
|
155
|
+
await rejectSkillSymlink(`${filePath}.bak`);
|
|
156
|
+
await rejectSkillSymlink(`${filePath}.tmp`);
|
|
157
|
+
}
|
|
158
|
+
function getExpectedSkillPath(projectDir) {
|
|
159
|
+
return join(projectDir, TOKENJUICE_ONA_SKILL_PATH);
|
|
160
|
+
}
|
|
161
|
+
async function resolveSafeProjectSkillPath(filePath, projectDir, realProjectDir = projectDir) {
|
|
162
|
+
const resolvedPath = resolve(filePath);
|
|
163
|
+
await rejectSkillSymlink(projectDir);
|
|
164
|
+
await rejectSkillPathComponentSymlinks(resolvedPath, projectDir);
|
|
165
|
+
const realParentDir = await realpathExistingAncestor(dirname(resolvedPath));
|
|
166
|
+
if (!isInsideOrEqual(realProjectDir, realParentDir)) {
|
|
167
|
+
throw new Error(`cannot use Ona skill ${resolvedPath}; tokenjuice will not write through instruction directories outside ${realProjectDir}`);
|
|
168
|
+
}
|
|
169
|
+
await rejectSkillSymlink(resolvedPath);
|
|
170
|
+
const expectedSkillPath = getExpectedSkillPath(projectDir);
|
|
171
|
+
if (resolvedPath !== expectedSkillPath) {
|
|
172
|
+
throw new Error(`cannot use Ona skill ${resolvedPath}; tokenjuice only installs the project-local ${TOKENJUICE_ONA_SKILL_PATH} file`);
|
|
173
|
+
}
|
|
174
|
+
return resolvedPath;
|
|
175
|
+
}
|
|
176
|
+
async function getDefaultSkillPath(options = {}) {
|
|
177
|
+
const projectDir = await resolveCanonicalProjectDir(options);
|
|
178
|
+
return resolveSafeProjectSkillPath(getExpectedSkillPath(projectDir), projectDir, projectDir);
|
|
179
|
+
}
|
|
180
|
+
async function getDefaultLegacyInstructionsPath(options = {}) {
|
|
181
|
+
return join(await resolveCanonicalProjectDir(options), "AGENTS.md");
|
|
182
|
+
}
|
|
183
|
+
async function getDefaultAliasPath(options = {}) {
|
|
184
|
+
return getExpectedSkillPath(await resolveProjectDir(options));
|
|
185
|
+
}
|
|
186
|
+
async function skillArtifactExists(filePath) {
|
|
187
|
+
try {
|
|
188
|
+
await lstat(filePath);
|
|
189
|
+
return true;
|
|
190
|
+
}
|
|
191
|
+
catch (error) {
|
|
192
|
+
if (error.code === "ENOENT") {
|
|
193
|
+
return false;
|
|
194
|
+
}
|
|
195
|
+
throw error;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
async function resolveSkillPath(skillPath, options = {}) {
|
|
199
|
+
if (skillPath) {
|
|
200
|
+
const projectDir = await resolveCanonicalProjectDir(options);
|
|
201
|
+
return resolveSafeProjectSkillPath(await resolveCanonicalInstructionPath(skillPath), projectDir, projectDir);
|
|
202
|
+
}
|
|
203
|
+
return getDefaultSkillPath(options);
|
|
204
|
+
}
|
|
205
|
+
function stripYamlComment(value) {
|
|
206
|
+
let quote;
|
|
207
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
208
|
+
const char = value[index];
|
|
209
|
+
if (quote === "\"") {
|
|
210
|
+
if (char === "\\" && index + 1 < value.length) {
|
|
211
|
+
index += 1;
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
if (char === "\"") {
|
|
215
|
+
quote = undefined;
|
|
216
|
+
}
|
|
217
|
+
continue;
|
|
218
|
+
}
|
|
219
|
+
if (quote === "'") {
|
|
220
|
+
if (char === "'" && value[index + 1] === "'") {
|
|
221
|
+
index += 1;
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
if (char === "'") {
|
|
225
|
+
quote = undefined;
|
|
226
|
+
}
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
229
|
+
if (char === "\"" || char === "'") {
|
|
230
|
+
quote = char;
|
|
231
|
+
continue;
|
|
232
|
+
}
|
|
233
|
+
if (char === "#" && (index === 0 || /\s/u.test(value[index - 1] ?? ""))) {
|
|
234
|
+
return { value: value.slice(0, index).trim(), isValid: true };
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return { value: value.trim(), isValid: quote === undefined };
|
|
238
|
+
}
|
|
239
|
+
function hasHexDigits(value, start, length) {
|
|
240
|
+
if (start + length > value.length) {
|
|
241
|
+
return false;
|
|
242
|
+
}
|
|
243
|
+
return /^[0-9A-Fa-f]+$/u.test(value.slice(start, start + length));
|
|
244
|
+
}
|
|
245
|
+
function isValidDoubleQuotedYamlScalar(value) {
|
|
246
|
+
if (!value.startsWith("\"") || !value.endsWith("\"")) {
|
|
247
|
+
return false;
|
|
248
|
+
}
|
|
249
|
+
for (let index = 1; index < value.length - 1; index += 1) {
|
|
250
|
+
if (value[index] === "\"") {
|
|
251
|
+
return false;
|
|
252
|
+
}
|
|
253
|
+
if (value[index] !== "\\") {
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
256
|
+
const escape = value[index + 1];
|
|
257
|
+
if (!escape) {
|
|
258
|
+
return false;
|
|
259
|
+
}
|
|
260
|
+
if ("0abtnvfre\"/\\N_LP".includes(escape)) {
|
|
261
|
+
index += 1;
|
|
262
|
+
continue;
|
|
263
|
+
}
|
|
264
|
+
const hexLength = escape === "x" ? 2 : escape === "u" ? 4 : escape === "U" ? 8 : 0;
|
|
265
|
+
if (hexLength === 0 || !hasHexDigits(value, index + 2, hexLength)) {
|
|
266
|
+
return false;
|
|
267
|
+
}
|
|
268
|
+
index += 1 + hexLength;
|
|
269
|
+
}
|
|
270
|
+
return true;
|
|
271
|
+
}
|
|
272
|
+
function isValidSimpleYamlScalar(rawValue) {
|
|
273
|
+
const stripped = stripYamlComment(rawValue);
|
|
274
|
+
if (!stripped.isValid) {
|
|
275
|
+
return false;
|
|
276
|
+
}
|
|
277
|
+
const value = stripped.value;
|
|
278
|
+
if (value === "") {
|
|
279
|
+
return true;
|
|
280
|
+
}
|
|
281
|
+
if (value.startsWith("\"")) {
|
|
282
|
+
return isValidDoubleQuotedYamlScalar(value);
|
|
283
|
+
}
|
|
284
|
+
if (value.startsWith("'")) {
|
|
285
|
+
return /^'(?:''|[^'])*'$/u.test(value);
|
|
286
|
+
}
|
|
287
|
+
if (/[[\]{}]/u.test(value) || /:(?:$|[\s,[\]{}])/u.test(value)) {
|
|
288
|
+
return false;
|
|
289
|
+
}
|
|
290
|
+
if (/^[-?:]\s/u.test(value)) {
|
|
291
|
+
return false;
|
|
292
|
+
}
|
|
293
|
+
return !/^[@,&*!|>%`]/u.test(value);
|
|
294
|
+
}
|
|
295
|
+
function isYamlBlockScalarHeader(value) {
|
|
296
|
+
return /^[|>](?:[+-][1-9]?|[1-9][+-]?)?$/u.test(value);
|
|
297
|
+
}
|
|
298
|
+
function normalizeYamlScalar(value) {
|
|
299
|
+
if (value.startsWith("\"") && value.endsWith("\"")) {
|
|
300
|
+
return value.slice(1, -1).replace(/\\(["\\])/gu, "$1");
|
|
301
|
+
}
|
|
302
|
+
if (value.startsWith("'") && value.endsWith("'")) {
|
|
303
|
+
return value.slice(1, -1).replace(/''/gu, "'");
|
|
304
|
+
}
|
|
305
|
+
return value;
|
|
306
|
+
}
|
|
307
|
+
function parseSimpleYamlFrontmatter(frontmatter) {
|
|
308
|
+
const values = new Map();
|
|
309
|
+
for (let index = 0; index < frontmatter.length; index += 1) {
|
|
310
|
+
const line = frontmatter[index] ?? "";
|
|
311
|
+
const trimmedLine = line.trim();
|
|
312
|
+
if (trimmedLine === "" || trimmedLine.startsWith("#")) {
|
|
313
|
+
continue;
|
|
314
|
+
}
|
|
315
|
+
const match = /^\s*([A-Za-z0-9_-]+):\s*(.*)$/u.exec(line);
|
|
316
|
+
if (!match) {
|
|
317
|
+
return { hasValidYaml: false, values };
|
|
318
|
+
}
|
|
319
|
+
const key = match[1] ?? "";
|
|
320
|
+
if (values.has(key)) {
|
|
321
|
+
return { hasValidYaml: false, values };
|
|
322
|
+
}
|
|
323
|
+
const rawValue = match[2] ?? "";
|
|
324
|
+
const stripped = stripYamlComment(rawValue);
|
|
325
|
+
if (!stripped.isValid) {
|
|
326
|
+
return { hasValidYaml: false, values };
|
|
327
|
+
}
|
|
328
|
+
if (isYamlBlockScalarHeader(stripped.value)) {
|
|
329
|
+
const blockLines = [];
|
|
330
|
+
for (index += 1; index < frontmatter.length; index += 1) {
|
|
331
|
+
const blockLine = frontmatter[index] ?? "";
|
|
332
|
+
if (blockLine.trim() === "") {
|
|
333
|
+
blockLines.push("");
|
|
334
|
+
continue;
|
|
335
|
+
}
|
|
336
|
+
if (/^\s/u.test(blockLine)) {
|
|
337
|
+
blockLines.push(blockLine.trimEnd());
|
|
338
|
+
continue;
|
|
339
|
+
}
|
|
340
|
+
index -= 1;
|
|
341
|
+
break;
|
|
342
|
+
}
|
|
343
|
+
values.set(key, blockLines.join("\n").trim());
|
|
344
|
+
continue;
|
|
345
|
+
}
|
|
346
|
+
if (!isValidSimpleYamlScalar(rawValue)) {
|
|
347
|
+
return { hasValidYaml: false, values };
|
|
348
|
+
}
|
|
349
|
+
values.set(key, normalizeYamlScalar(stripped.value));
|
|
350
|
+
}
|
|
351
|
+
return { hasValidYaml: true, values };
|
|
352
|
+
}
|
|
353
|
+
function inspectSkillFrontmatter(text) {
|
|
354
|
+
const lines = text.split(/\r?\n/u);
|
|
355
|
+
if (lines[0] !== "---") {
|
|
356
|
+
return { hasName: false, hasDescription: false, hasValidYaml: false };
|
|
357
|
+
}
|
|
358
|
+
const endIndex = lines.findIndex((line, index) => index > 0 && line === "---");
|
|
359
|
+
if (endIndex < 0) {
|
|
360
|
+
return { hasName: false, hasDescription: false, hasValidYaml: false };
|
|
361
|
+
}
|
|
362
|
+
const frontmatter = lines.slice(1, endIndex);
|
|
363
|
+
const parsed = parseSimpleYamlFrontmatter(frontmatter);
|
|
364
|
+
return {
|
|
365
|
+
hasName: parsed.values.get("name") === "tokenjuice",
|
|
366
|
+
hasDescription: (parsed.values.get("description") ?? "") !== "",
|
|
367
|
+
hasValidYaml: parsed.hasValidYaml,
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
const TOKENJUICE_ONA_SKILL = [
|
|
371
|
+
"---",
|
|
372
|
+
"name: tokenjuice",
|
|
373
|
+
'description: "Use when Ona Agent is running terminal or shell commands, tests, builds, or log-heavy commands likely to produce long output; prefer tokenjuice wrap for compacted output."',
|
|
374
|
+
"---",
|
|
375
|
+
"",
|
|
376
|
+
TOKENJUICE_ONA_OWNERSHIP_MARKER,
|
|
377
|
+
"# tokenjuice terminal output compaction",
|
|
378
|
+
"",
|
|
379
|
+
...buildTokenjuiceGuidanceBullets({
|
|
380
|
+
wrapBullet: "- When Ona Agent runs terminal commands likely to produce long output, prefer `tokenjuice wrap -- <command>`.",
|
|
381
|
+
}),
|
|
382
|
+
"- Ona Agent discovers this reusable skill from `.ona/skills/tokenjuice/SKILL.md` and still owns shell execution and tool output delivery.",
|
|
383
|
+
"",
|
|
384
|
+
].join("\n");
|
|
385
|
+
async function inspectLegacyOnaInstructions(options = {}) {
|
|
386
|
+
const instructionsPath = await getDefaultLegacyInstructionsPath(options);
|
|
387
|
+
if (await isSymlink(instructionsPath)) {
|
|
388
|
+
return { instructionsPath, hasLegacyBlock: false, issues: [], unsafeIssues: [] };
|
|
389
|
+
}
|
|
390
|
+
const existing = await readInstructionFile(instructionsPath);
|
|
391
|
+
const markerState = inspectMarkerDelimitedBlock(existing.text, TOKENJUICE_ONA_LEGACY_BLOCK_CONFIG);
|
|
392
|
+
const hasLegacyBlock = existing.exists && (markerState.hasBegin || markerState.hasEnd);
|
|
393
|
+
if (!hasLegacyBlock) {
|
|
394
|
+
return { instructionsPath, hasLegacyBlock: false, issues: [], unsafeIssues: [] };
|
|
395
|
+
}
|
|
396
|
+
const unsafeIssues = hasMalformedLegacyMarkerStructure(existing.text, markerState.completeBlockCount)
|
|
397
|
+
? [
|
|
398
|
+
`configured legacy Ona instructions have malformed tokenjuice markers; remove the dangling marker manually, then rerun ${TOKENJUICE_ONA_FIX_COMMAND}`,
|
|
399
|
+
]
|
|
400
|
+
: [];
|
|
401
|
+
return {
|
|
402
|
+
instructionsPath,
|
|
403
|
+
hasLegacyBlock: true,
|
|
404
|
+
issues: [
|
|
405
|
+
...collectMarkerDelimitedBlockIssues(markerState, {
|
|
406
|
+
configuredLabel: "legacy Ona instructions",
|
|
407
|
+
repairCommand: TOKENJUICE_ONA_FIX_COMMAND,
|
|
408
|
+
}),
|
|
409
|
+
...unsafeIssues,
|
|
410
|
+
],
|
|
411
|
+
unsafeIssues,
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
async function uninstallLegacyOnaInstructions(options = {}) {
|
|
415
|
+
const instructionsPath = await getDefaultLegacyInstructionsPath(options);
|
|
416
|
+
if (await isSymlink(instructionsPath)) {
|
|
417
|
+
return { instructionsPath, removed: false };
|
|
418
|
+
}
|
|
419
|
+
const legacy = await inspectLegacyOnaInstructions(options);
|
|
420
|
+
if (legacy.unsafeIssues.length > 0) {
|
|
421
|
+
throw new Error(`cannot safely migrate malformed tokenjuice markers in ${legacy.instructionsPath}; remove the dangling marker manually, then rerun tokenjuice install ona`);
|
|
422
|
+
}
|
|
423
|
+
const result = await uninstallMarkerDelimitedBlock(instructionsPath, TOKENJUICE_ONA_LEGACY_BLOCK_CONFIG);
|
|
424
|
+
return { instructionsPath: result.filePath, removed: result.removed };
|
|
425
|
+
}
|
|
426
|
+
export async function installOnaSkill(skillPath, options = {}) {
|
|
427
|
+
const resolvedSkillPath = await resolveSkillPath(skillPath, options);
|
|
428
|
+
const legacyBeforeInstall = await inspectLegacyOnaInstructions(options);
|
|
429
|
+
if (legacyBeforeInstall.unsafeIssues.length > 0) {
|
|
430
|
+
throw new Error(`cannot safely migrate malformed tokenjuice markers in ${legacyBeforeInstall.instructionsPath}; remove the dangling marker manually, then rerun tokenjuice install ona`);
|
|
431
|
+
}
|
|
432
|
+
await rejectInstallSidecarSymlinks(resolvedSkillPath);
|
|
433
|
+
const result = await writeInstructionFile(resolvedSkillPath, TOKENJUICE_ONA_SKILL);
|
|
434
|
+
const legacy = await uninstallLegacyOnaInstructions(options);
|
|
435
|
+
return {
|
|
436
|
+
skillPath: result.filePath,
|
|
437
|
+
...(result.backupPath ? { backupPath: result.backupPath } : {}),
|
|
438
|
+
...(legacy ? { legacyInstructionsPath: legacy.instructionsPath, legacyRemoved: legacy.removed } : {}),
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
export async function uninstallOnaSkill(skillPath, options = {}) {
|
|
442
|
+
const resolvedSkillPath = await resolveSkillPath(skillPath, options);
|
|
443
|
+
const legacyBeforeUninstall = await inspectLegacyOnaInstructions(options);
|
|
444
|
+
if (legacyBeforeUninstall.unsafeIssues.length > 0) {
|
|
445
|
+
throw new Error(`cannot safely migrate malformed tokenjuice markers in ${legacyBeforeUninstall.instructionsPath}; remove the dangling marker manually, then rerun tokenjuice uninstall ona`);
|
|
446
|
+
}
|
|
447
|
+
const existing = await readInstructionFile(resolvedSkillPath);
|
|
448
|
+
const skillRemoved = existing.exists && existing.text.includes(TOKENJUICE_ONA_OWNERSHIP_MARKER);
|
|
449
|
+
const result = skillRemoved ? await removeInstructionFile(resolvedSkillPath) : { filePath: resolvedSkillPath, removed: false };
|
|
450
|
+
const legacy = await uninstallLegacyOnaInstructions(options);
|
|
451
|
+
return {
|
|
452
|
+
skillPath: result.filePath,
|
|
453
|
+
removed: skillRemoved || Boolean(legacy?.removed),
|
|
454
|
+
...(legacy ? { legacyInstructionsPath: legacy.instructionsPath, legacyRemoved: legacy.removed } : {}),
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
export async function doctorOnaSkill(skillPath, options = {}) {
|
|
458
|
+
let resolvedSkillPath;
|
|
459
|
+
try {
|
|
460
|
+
resolvedSkillPath = await resolveSkillPath(skillPath, options);
|
|
461
|
+
}
|
|
462
|
+
catch (error) {
|
|
463
|
+
const aliasPath = skillPath ?? (await getDefaultAliasPath(options));
|
|
464
|
+
if (!skillPath && !(await skillArtifactExists(aliasPath))) {
|
|
465
|
+
return {
|
|
466
|
+
skillPath: aliasPath,
|
|
467
|
+
hasTokenjuiceMarker: false,
|
|
468
|
+
hasUnsafePathIssue: false,
|
|
469
|
+
...buildInstructionDoctorReportFields({
|
|
470
|
+
status: "disabled",
|
|
471
|
+
issues: ["tokenjuice Ona skill is not installed"],
|
|
472
|
+
advisory: TOKENJUICE_ONA_ADVISORY,
|
|
473
|
+
fixCommand: TOKENJUICE_ONA_FIX_COMMAND,
|
|
474
|
+
}),
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
return {
|
|
478
|
+
skillPath: aliasPath,
|
|
479
|
+
hasTokenjuiceMarker: false,
|
|
480
|
+
hasUnsafePathIssue: true,
|
|
481
|
+
...buildInstructionDoctorReportFields({
|
|
482
|
+
status: "broken",
|
|
483
|
+
issues: [error.message],
|
|
484
|
+
advisory: TOKENJUICE_ONA_ADVISORY,
|
|
485
|
+
fixCommand: "replace symlinked Ona skill with a regular project file, then run tokenjuice install ona",
|
|
486
|
+
}),
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
const existing = await readInstructionFile(resolvedSkillPath);
|
|
490
|
+
if (!existing.exists) {
|
|
491
|
+
const legacy = await inspectLegacyOnaInstructions(options);
|
|
492
|
+
if (legacy.hasLegacyBlock) {
|
|
493
|
+
const issues = legacy.issues.length > 0
|
|
494
|
+
? legacy.issues
|
|
495
|
+
: [
|
|
496
|
+
"legacy Ona AGENTS.md tokenjuice instructions are still installed; run tokenjuice install ona to migrate to .ona/skills/tokenjuice/SKILL.md or tokenjuice uninstall ona to remove them",
|
|
497
|
+
];
|
|
498
|
+
return {
|
|
499
|
+
skillPath: resolvedSkillPath,
|
|
500
|
+
hasTokenjuiceMarker: true,
|
|
501
|
+
hasUnsafePathIssue: false,
|
|
502
|
+
status: legacy.issues.length > 0 ? "broken" : "warn",
|
|
503
|
+
issues,
|
|
504
|
+
advisories: [TOKENJUICE_ONA_ADVISORY],
|
|
505
|
+
fixCommand: legacy.issues.length > 0 ? "remove unmatched tokenjuice markers from AGENTS.md, then run tokenjuice install ona" : TOKENJUICE_ONA_FIX_COMMAND,
|
|
506
|
+
checkedPaths: [legacy.instructionsPath],
|
|
507
|
+
missingPaths: [],
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
return {
|
|
511
|
+
skillPath: resolvedSkillPath,
|
|
512
|
+
hasTokenjuiceMarker: false,
|
|
513
|
+
hasUnsafePathIssue: false,
|
|
514
|
+
...buildInstructionDoctorReportFields({
|
|
515
|
+
status: "disabled",
|
|
516
|
+
issues: ["tokenjuice Ona skill is not installed"],
|
|
517
|
+
advisory: TOKENJUICE_ONA_ADVISORY,
|
|
518
|
+
fixCommand: TOKENJUICE_ONA_FIX_COMMAND,
|
|
519
|
+
}),
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
const hasTokenjuiceMarker = existing.text.includes(TOKENJUICE_ONA_OWNERSHIP_MARKER);
|
|
523
|
+
const frontmatter = inspectSkillFrontmatter(existing.text);
|
|
524
|
+
const legacy = await inspectLegacyOnaInstructions(options);
|
|
525
|
+
const legacyIssues = legacy.hasLegacyBlock && legacy.issues.length === 0
|
|
526
|
+
? ["legacy Ona AGENTS.md tokenjuice instructions are still installed; run tokenjuice uninstall ona to remove duplicate always-loaded guidance"]
|
|
527
|
+
: legacy.issues;
|
|
528
|
+
const skillIssues = [
|
|
529
|
+
...(!frontmatter.hasValidYaml ? ["configured Ona skill has invalid discovery frontmatter"] : []),
|
|
530
|
+
...(!frontmatter.hasName ? ["configured Ona skill is missing the required tokenjuice skill name"] : []),
|
|
531
|
+
...(!frontmatter.hasDescription ? ["configured Ona skill is missing discovery frontmatter"] : []),
|
|
532
|
+
...collectGuidanceIssues(existing.text, {
|
|
533
|
+
required: [
|
|
534
|
+
{
|
|
535
|
+
requiredText: TOKENJUICE_ONA_OWNERSHIP_MARKER,
|
|
536
|
+
missingIssue: "configured Ona skill is missing the tokenjuice ownership marker",
|
|
537
|
+
},
|
|
538
|
+
{
|
|
539
|
+
requiredText: TOKENJUICE_ONA_SKILL_MARKER,
|
|
540
|
+
missingIssue: "configured Ona skill does not look like the tokenjuice skill",
|
|
541
|
+
},
|
|
542
|
+
{
|
|
543
|
+
requiredText: TOKENJUICE_WRAP_COMMAND,
|
|
544
|
+
missingIssue: "configured Ona skill is missing tokenjuice wrap guidance",
|
|
545
|
+
},
|
|
546
|
+
{
|
|
547
|
+
requiredText: TOKENJUICE_RAW_COMMAND,
|
|
548
|
+
missingIssue: "configured Ona skill is missing the raw escape hatch",
|
|
549
|
+
},
|
|
550
|
+
{
|
|
551
|
+
requiredText: TOKENJUICE_ONA_SKILL_PATH,
|
|
552
|
+
missingIssue: "configured Ona skill is missing workspace skill path guidance",
|
|
553
|
+
},
|
|
554
|
+
],
|
|
555
|
+
forbidden: [
|
|
556
|
+
{
|
|
557
|
+
forbiddenText: TOKENJUICE_FULL_COMMAND,
|
|
558
|
+
presentIssue: "configured Ona skill still suggests the full escape hatch",
|
|
559
|
+
},
|
|
560
|
+
],
|
|
561
|
+
}),
|
|
562
|
+
];
|
|
563
|
+
const issues = [
|
|
564
|
+
...legacyIssues,
|
|
565
|
+
...skillIssues,
|
|
566
|
+
];
|
|
567
|
+
const status = skillIssues.length > 0 || legacy.issues.length > 0 ? "broken" : legacy.hasLegacyBlock ? "warn" : "ok";
|
|
568
|
+
return {
|
|
569
|
+
skillPath: resolvedSkillPath,
|
|
570
|
+
hasTokenjuiceMarker: hasTokenjuiceMarker || legacy.hasLegacyBlock,
|
|
571
|
+
hasUnsafePathIssue: false,
|
|
572
|
+
status,
|
|
573
|
+
issues,
|
|
574
|
+
advisories: [TOKENJUICE_ONA_ADVISORY],
|
|
575
|
+
fixCommand: legacy.hasLegacyBlock && legacy.issues.length > 0
|
|
576
|
+
? "remove unmatched tokenjuice markers from AGENTS.md, then run tokenjuice install ona"
|
|
577
|
+
: TOKENJUICE_ONA_FIX_COMMAND,
|
|
578
|
+
checkedPaths: legacy.hasLegacyBlock ? [legacy.instructionsPath] : [],
|
|
579
|
+
missingPaths: [],
|
|
580
|
+
};
|
|
581
|
+
}
|
|
582
|
+
export async function installOnaInstructions(instructionsPath, options = {}) {
|
|
583
|
+
const resolvedOptions = instructionsPath ? { ...options, projectDir: dirname(resolve(instructionsPath)) } : options;
|
|
584
|
+
const result = await installOnaSkill(undefined, resolvedOptions);
|
|
585
|
+
return { ...result, instructionsPath: result.skillPath };
|
|
586
|
+
}
|
|
587
|
+
export async function uninstallOnaInstructions(instructionsPath, options = {}) {
|
|
588
|
+
const resolvedOptions = instructionsPath ? { ...options, projectDir: dirname(resolve(instructionsPath)) } : options;
|
|
589
|
+
const result = await uninstallOnaSkill(undefined, resolvedOptions);
|
|
590
|
+
return { ...result, instructionsPath: result.skillPath };
|
|
591
|
+
}
|
|
592
|
+
export async function doctorOnaInstructions(instructionsPath, options = {}) {
|
|
593
|
+
const resolvedOptions = instructionsPath ? { ...options, projectDir: dirname(resolve(instructionsPath)) } : options;
|
|
594
|
+
const result = await doctorOnaSkill(undefined, resolvedOptions);
|
|
595
|
+
return { ...result, instructionsPath: result.skillPath };
|
|
596
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type OpenInterpreterInstructionsOptions = {
|
|
2
|
+
projectDir?: string;
|
|
3
|
+
scanProjectTree?: boolean;
|
|
4
|
+
};
|
|
5
|
+
export type InstallOpenInterpreterInstructionsResult = {
|
|
6
|
+
instructionsPath: string;
|
|
7
|
+
instructionsPaths?: string[];
|
|
8
|
+
backupPath?: string;
|
|
9
|
+
};
|
|
10
|
+
export type UninstallOpenInterpreterInstructionsResult = {
|
|
11
|
+
instructionsPath: string;
|
|
12
|
+
removedPaths?: string[];
|
|
13
|
+
removed: boolean;
|
|
14
|
+
};
|
|
15
|
+
export type OpenInterpreterDoctorReport = {
|
|
16
|
+
instructionsPath: string;
|
|
17
|
+
status: "ok" | "warn" | "broken" | "disabled";
|
|
18
|
+
issues: string[];
|
|
19
|
+
advisories: string[];
|
|
20
|
+
fixCommand: string;
|
|
21
|
+
checkedPaths: string[];
|
|
22
|
+
missingPaths: string[];
|
|
23
|
+
};
|
|
24
|
+
export declare function installOpenInterpreterInstructions(instructionsPath?: string, options?: OpenInterpreterInstructionsOptions): Promise<InstallOpenInterpreterInstructionsResult>;
|
|
25
|
+
export declare function uninstallOpenInterpreterInstructions(instructionsPath?: string, options?: OpenInterpreterInstructionsOptions): Promise<UninstallOpenInterpreterInstructionsResult>;
|
|
26
|
+
export declare function doctorOpenInterpreterInstructions(instructionsPath?: string, options?: OpenInterpreterInstructionsOptions): Promise<OpenInterpreterDoctorReport>;
|