plugsuits 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.js +3 -0
- package/dist/agent-reasoning-default.test.d.ts +2 -0
- package/dist/agent-reasoning-default.test.d.ts.map +1 -0
- package/dist/agent-reasoning-default.test.js +38 -0
- package/dist/agent-reasoning-default.test.js.map +1 -0
- package/dist/agent.d.ts +61 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +308 -0
- package/dist/agent.js.map +1 -0
- package/dist/agent.test.d.ts +2 -0
- package/dist/agent.test.d.ts.map +1 -0
- package/dist/agent.test.js +38 -0
- package/dist/agent.test.js.map +1 -0
- package/dist/cli-args.d.ts +15 -0
- package/dist/cli-args.d.ts.map +1 -0
- package/dist/cli-args.js +63 -0
- package/dist/cli-args.js.map +1 -0
- package/dist/cli-args.test.d.ts +2 -0
- package/dist/cli-args.test.d.ts.map +1 -0
- package/dist/cli-args.test.js +105 -0
- package/dist/cli-args.test.js.map +1 -0
- package/dist/commands/aliases-and-tool-fallback.test.d.ts +2 -0
- package/dist/commands/aliases-and-tool-fallback.test.d.ts.map +1 -0
- package/dist/commands/aliases-and-tool-fallback.test.js +132 -0
- package/dist/commands/aliases-and-tool-fallback.test.js.map +1 -0
- package/dist/commands/clear.d.ts +3 -0
- package/dist/commands/clear.d.ts.map +1 -0
- package/dist/commands/clear.js +12 -0
- package/dist/commands/clear.js.map +1 -0
- package/dist/commands/factories/create-toggle-command.d.ts +13 -0
- package/dist/commands/factories/create-toggle-command.d.ts.map +1 -0
- package/dist/commands/factories/create-toggle-command.js +38 -0
- package/dist/commands/factories/create-toggle-command.js.map +1 -0
- package/dist/commands/help.d.ts +3 -0
- package/dist/commands/help.d.ts.map +1 -0
- package/dist/commands/help.js +23 -0
- package/dist/commands/help.js.map +1 -0
- package/dist/commands/index.d.ts +18 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +82 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/model.d.ts +15 -0
- package/dist/commands/model.d.ts.map +1 -0
- package/dist/commands/model.js +100 -0
- package/dist/commands/model.js.map +1 -0
- package/dist/commands/reasoning-mode.d.ts +3 -0
- package/dist/commands/reasoning-mode.d.ts.map +1 -0
- package/dist/commands/reasoning-mode.js +47 -0
- package/dist/commands/reasoning-mode.js.map +1 -0
- package/dist/commands/render.d.ts +19 -0
- package/dist/commands/render.d.ts.map +1 -0
- package/dist/commands/render.js +140 -0
- package/dist/commands/render.js.map +1 -0
- package/dist/commands/render.test.d.ts +2 -0
- package/dist/commands/render.test.d.ts.map +1 -0
- package/dist/commands/render.test.js +36 -0
- package/dist/commands/render.test.js.map +1 -0
- package/dist/commands/tool-fallback.d.ts +3 -0
- package/dist/commands/tool-fallback.d.ts.map +1 -0
- package/dist/commands/tool-fallback.js +38 -0
- package/dist/commands/tool-fallback.js.map +1 -0
- package/dist/commands/translate.d.ts +3 -0
- package/dist/commands/translate.d.ts.map +1 -0
- package/dist/commands/translate.js +12 -0
- package/dist/commands/translate.js.map +1 -0
- package/dist/commands/translate.test.d.ts +2 -0
- package/dist/commands/translate.test.d.ts.map +1 -0
- package/dist/commands/translate.test.js +49 -0
- package/dist/commands/translate.test.js.map +1 -0
- package/dist/commands/types.d.ts +17 -0
- package/dist/commands/types.d.ts.map +1 -0
- package/dist/commands/types.js +2 -0
- package/dist/commands/types.js.map +1 -0
- package/dist/context/environment-context.d.ts +2 -0
- package/dist/context/environment-context.d.ts.map +1 -0
- package/dist/context/environment-context.js +11 -0
- package/dist/context/environment-context.js.map +1 -0
- package/dist/context/paths.d.ts +3 -0
- package/dist/context/paths.d.ts.map +1 -0
- package/dist/context/paths.js +3 -0
- package/dist/context/paths.js.map +1 -0
- package/dist/context/session.d.ts +4 -0
- package/dist/context/session.d.ts.map +1 -0
- package/dist/context/session.js +16 -0
- package/dist/context/session.js.map +1 -0
- package/dist/context/skill-command-prefix.d.ts +4 -0
- package/dist/context/skill-command-prefix.d.ts.map +1 -0
- package/dist/context/skill-command-prefix.js +15 -0
- package/dist/context/skill-command-prefix.js.map +1 -0
- package/dist/context/skills-integration.test.d.ts +2 -0
- package/dist/context/skills-integration.test.d.ts.map +1 -0
- package/dist/context/skills-integration.test.js +87 -0
- package/dist/context/skills-integration.test.js.map +1 -0
- package/dist/context/skills.d.ts +18 -0
- package/dist/context/skills.d.ts.map +1 -0
- package/dist/context/skills.js +431 -0
- package/dist/context/skills.js.map +1 -0
- package/dist/context/skills.test.d.ts +2 -0
- package/dist/context/skills.test.d.ts.map +1 -0
- package/dist/context/skills.test.js +20 -0
- package/dist/context/skills.test.js.map +1 -0
- package/dist/context/system-prompt.d.ts +2 -0
- package/dist/context/system-prompt.d.ts.map +1 -0
- package/dist/context/system-prompt.js +100 -0
- package/dist/context/system-prompt.js.map +1 -0
- package/dist/context/translation-integration.test.d.ts +2 -0
- package/dist/context/translation-integration.test.d.ts.map +1 -0
- package/dist/context/translation-integration.test.js +138 -0
- package/dist/context/translation-integration.test.js.map +1 -0
- package/dist/context/translation.d.ts +21 -0
- package/dist/context/translation.d.ts.map +1 -0
- package/dist/context/translation.js +82 -0
- package/dist/context/translation.js.map +1 -0
- package/dist/context/translation.test.d.ts +2 -0
- package/dist/context/translation.test.d.ts.map +1 -0
- package/dist/context/translation.test.js +129 -0
- package/dist/context/translation.test.js.map +1 -0
- package/dist/entrypoints/cli-input-rendering.test.d.ts +2 -0
- package/dist/entrypoints/cli-input-rendering.test.d.ts.map +1 -0
- package/dist/entrypoints/cli-input-rendering.test.js +192 -0
- package/dist/entrypoints/cli-input-rendering.test.js.map +1 -0
- package/dist/entrypoints/cli.d.ts +3 -0
- package/dist/entrypoints/cli.d.ts.map +1 -0
- package/dist/entrypoints/cli.js +1268 -0
- package/dist/entrypoints/cli.js.map +1 -0
- package/dist/entrypoints/headless-agent-config.d.ts +21 -0
- package/dist/entrypoints/headless-agent-config.d.ts.map +1 -0
- package/dist/entrypoints/headless-agent-config.js +15 -0
- package/dist/entrypoints/headless-agent-config.js.map +1 -0
- package/dist/entrypoints/headless-agent-config.test.d.ts +2 -0
- package/dist/entrypoints/headless-agent-config.test.d.ts.map +1 -0
- package/dist/entrypoints/headless-agent-config.test.js +63 -0
- package/dist/entrypoints/headless-agent-config.test.js.map +1 -0
- package/dist/entrypoints/headless.d.ts +3 -0
- package/dist/entrypoints/headless.d.ts.map +1 -0
- package/dist/entrypoints/headless.js +396 -0
- package/dist/entrypoints/headless.js.map +1 -0
- package/dist/env.d.ts +8 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +14 -0
- package/dist/env.js.map +1 -0
- package/dist/friendli-models.d.ts +21 -0
- package/dist/friendli-models.d.ts.map +1 -0
- package/dist/friendli-models.js +57 -0
- package/dist/friendli-models.js.map +1 -0
- package/dist/friendli-reasoning.d.ts +10 -0
- package/dist/friendli-reasoning.d.ts.map +1 -0
- package/dist/friendli-reasoning.js +181 -0
- package/dist/friendli-reasoning.js.map +1 -0
- package/dist/friendli-reasoning.test.d.ts +2 -0
- package/dist/friendli-reasoning.test.d.ts.map +1 -0
- package/dist/friendli-reasoning.test.js +77 -0
- package/dist/friendli-reasoning.test.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/interaction/colors.d.ts +22 -0
- package/dist/interaction/colors.d.ts.map +1 -0
- package/dist/interaction/colors.js +24 -0
- package/dist/interaction/colors.js.map +1 -0
- package/dist/interaction/pi-tui-stream-renderer.d.ts +19 -0
- package/dist/interaction/pi-tui-stream-renderer.d.ts.map +1 -0
- package/dist/interaction/pi-tui-stream-renderer.js +1509 -0
- package/dist/interaction/pi-tui-stream-renderer.js.map +1 -0
- package/dist/interaction/pi-tui-stream-renderer.test.d.ts +2 -0
- package/dist/interaction/pi-tui-stream-renderer.test.d.ts.map +1 -0
- package/dist/interaction/pi-tui-stream-renderer.test.js +1314 -0
- package/dist/interaction/pi-tui-stream-renderer.test.js.map +1 -0
- package/dist/interaction/spinner.d.ts +13 -0
- package/dist/interaction/spinner.d.ts.map +1 -0
- package/dist/interaction/spinner.js +51 -0
- package/dist/interaction/spinner.js.map +1 -0
- package/dist/middleware/index.d.ts +7 -0
- package/dist/middleware/index.d.ts.map +1 -0
- package/dist/middleware/index.js +15 -0
- package/dist/middleware/index.js.map +1 -0
- package/dist/middleware/todo-continuation.d.ts +11 -0
- package/dist/middleware/todo-continuation.d.ts.map +1 -0
- package/dist/middleware/todo-continuation.js +103 -0
- package/dist/middleware/todo-continuation.js.map +1 -0
- package/dist/middleware/trim-leading-newlines.d.ts +3 -0
- package/dist/middleware/trim-leading-newlines.d.ts.map +1 -0
- package/dist/middleware/trim-leading-newlines.js +49 -0
- package/dist/middleware/trim-leading-newlines.js.map +1 -0
- package/dist/reasoning-mode.d.ts +5 -0
- package/dist/reasoning-mode.d.ts.map +1 -0
- package/dist/reasoning-mode.js +30 -0
- package/dist/reasoning-mode.js.map +1 -0
- package/dist/reasoning-mode.test.d.ts +2 -0
- package/dist/reasoning-mode.test.d.ts.map +1 -0
- package/dist/reasoning-mode.test.js +22 -0
- package/dist/reasoning-mode.test.js.map +1 -0
- package/dist/tool-fallback-mode.d.ts +6 -0
- package/dist/tool-fallback-mode.d.ts.map +1 -0
- package/dist/tool-fallback-mode.js +25 -0
- package/dist/tool-fallback-mode.js.map +1 -0
- package/dist/tools/execute/shell-execute.d.ts +17 -0
- package/dist/tools/execute/shell-execute.d.ts.map +1 -0
- package/dist/tools/execute/shell-execute.js +55 -0
- package/dist/tools/execute/shell-execute.js.map +1 -0
- package/dist/tools/execute/shell-execute.test.d.ts +2 -0
- package/dist/tools/execute/shell-execute.test.d.ts.map +1 -0
- package/dist/tools/execute/shell-execute.test.js +86 -0
- package/dist/tools/execute/shell-execute.test.js.map +1 -0
- package/dist/tools/execute/shell-interact.d.ts +10 -0
- package/dist/tools/execute/shell-interact.d.ts.map +1 -0
- package/dist/tools/execute/shell-interact.js +122 -0
- package/dist/tools/execute/shell-interact.js.map +1 -0
- package/dist/tools/execute/shell-interact.test.d.ts +2 -0
- package/dist/tools/execute/shell-interact.test.d.ts.map +1 -0
- package/dist/tools/execute/shell-interact.test.js +175 -0
- package/dist/tools/execute/shell-interact.test.js.map +1 -0
- package/dist/tools/explore/glob.d.ts +15 -0
- package/dist/tools/explore/glob.d.ts.map +1 -0
- package/dist/tools/explore/glob.js +107 -0
- package/dist/tools/explore/glob.js.map +1 -0
- package/dist/tools/explore/glob.test.d.ts +2 -0
- package/dist/tools/explore/glob.test.d.ts.map +1 -0
- package/dist/tools/explore/glob.test.js +183 -0
- package/dist/tools/explore/glob.test.js.map +1 -0
- package/dist/tools/explore/grep.d.ts +27 -0
- package/dist/tools/explore/grep.d.ts.map +1 -0
- package/dist/tools/explore/grep.js +203 -0
- package/dist/tools/explore/grep.js.map +1 -0
- package/dist/tools/explore/grep.test.d.ts +2 -0
- package/dist/tools/explore/grep.test.d.ts.map +1 -0
- package/dist/tools/explore/grep.test.js +132 -0
- package/dist/tools/explore/grep.test.js.map +1 -0
- package/dist/tools/explore/read-file.d.ts +23 -0
- package/dist/tools/explore/read-file.d.ts.map +1 -0
- package/dist/tools/explore/read-file.js +84 -0
- package/dist/tools/explore/read-file.js.map +1 -0
- package/dist/tools/explore/read-file.test.d.ts +2 -0
- package/dist/tools/explore/read-file.test.d.ts.map +1 -0
- package/dist/tools/explore/read-file.test.js +278 -0
- package/dist/tools/explore/read-file.test.js.map +1 -0
- package/dist/tools/index.d.ts +71 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +26 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/modify/delete-file.d.ts +19 -0
- package/dist/tools/modify/delete-file.d.ts.map +1 -0
- package/dist/tools/modify/delete-file.js +71 -0
- package/dist/tools/modify/delete-file.js.map +1 -0
- package/dist/tools/modify/delete-file.test.d.ts +2 -0
- package/dist/tools/modify/delete-file.test.d.ts.map +1 -0
- package/dist/tools/modify/delete-file.test.js +136 -0
- package/dist/tools/modify/delete-file.test.js.map +1 -0
- package/dist/tools/modify/edit-file-diagnostics.d.ts +17 -0
- package/dist/tools/modify/edit-file-diagnostics.d.ts.map +1 -0
- package/dist/tools/modify/edit-file-diagnostics.js +157 -0
- package/dist/tools/modify/edit-file-diagnostics.js.map +1 -0
- package/dist/tools/modify/edit-file-repair.d.ts +13 -0
- package/dist/tools/modify/edit-file-repair.d.ts.map +1 -0
- package/dist/tools/modify/edit-file-repair.js +135 -0
- package/dist/tools/modify/edit-file-repair.js.map +1 -0
- package/dist/tools/modify/edit-file-stress.test.d.ts +2 -0
- package/dist/tools/modify/edit-file-stress.test.d.ts.map +1 -0
- package/dist/tools/modify/edit-file-stress.test.js +163 -0
- package/dist/tools/modify/edit-file-stress.test.js.map +1 -0
- package/dist/tools/modify/edit-file-validation.d.ts +9 -0
- package/dist/tools/modify/edit-file-validation.d.ts.map +1 -0
- package/dist/tools/modify/edit-file-validation.js +86 -0
- package/dist/tools/modify/edit-file-validation.js.map +1 -0
- package/dist/tools/modify/edit-file-whitespace.test.d.ts +2 -0
- package/dist/tools/modify/edit-file-whitespace.test.d.ts.map +1 -0
- package/dist/tools/modify/edit-file-whitespace.test.js +90 -0
- package/dist/tools/modify/edit-file-whitespace.test.js.map +1 -0
- package/dist/tools/modify/edit-file.d.ts +33 -0
- package/dist/tools/modify/edit-file.d.ts.map +1 -0
- package/dist/tools/modify/edit-file.js +177 -0
- package/dist/tools/modify/edit-file.js.map +1 -0
- package/dist/tools/modify/edit-file.test.d.ts +2 -0
- package/dist/tools/modify/edit-file.test.d.ts.map +1 -0
- package/dist/tools/modify/edit-file.test.js +948 -0
- package/dist/tools/modify/edit-file.test.js.map +1 -0
- package/dist/tools/modify/write-file.d.ts +17 -0
- package/dist/tools/modify/write-file.d.ts.map +1 -0
- package/dist/tools/modify/write-file.js +39 -0
- package/dist/tools/modify/write-file.js.map +1 -0
- package/dist/tools/modify/write-file.test.d.ts +2 -0
- package/dist/tools/modify/write-file.test.d.ts.map +1 -0
- package/dist/tools/modify/write-file.test.js +168 -0
- package/dist/tools/modify/write-file.test.js.map +1 -0
- package/dist/tools/planning/load-skill.d.ts +13 -0
- package/dist/tools/planning/load-skill.d.ts.map +1 -0
- package/dist/tools/planning/load-skill.js +101 -0
- package/dist/tools/planning/load-skill.js.map +1 -0
- package/dist/tools/planning/load-skill.test.d.ts +2 -0
- package/dist/tools/planning/load-skill.test.d.ts.map +1 -0
- package/dist/tools/planning/load-skill.test.js +37 -0
- package/dist/tools/planning/load-skill.test.js.map +1 -0
- package/dist/tools/planning/todo-write.d.ts +49 -0
- package/dist/tools/planning/todo-write.d.ts.map +1 -0
- package/dist/tools/planning/todo-write.js +118 -0
- package/dist/tools/planning/todo-write.js.map +1 -0
- package/dist/tools/planning/todo-write.test.d.ts +2 -0
- package/dist/tools/planning/todo-write.test.d.ts.map +1 -0
- package/dist/tools/planning/todo-write.test.js +82 -0
- package/dist/tools/planning/todo-write.test.js.map +1 -0
- package/dist/tools/utils/execute/format-utils.d.ts +4 -0
- package/dist/tools/utils/execute/format-utils.d.ts.map +1 -0
- package/dist/tools/utils/execute/format-utils.js +31 -0
- package/dist/tools/utils/execute/format-utils.js.map +1 -0
- package/dist/tools/utils/execute/format-utils.test.d.ts +2 -0
- package/dist/tools/utils/execute/format-utils.test.d.ts.map +1 -0
- package/dist/tools/utils/execute/format-utils.test.js +40 -0
- package/dist/tools/utils/execute/format-utils.test.js.map +1 -0
- package/dist/tools/utils/execute/noninteractive-wrapper.d.ts +12 -0
- package/dist/tools/utils/execute/noninteractive-wrapper.d.ts.map +1 -0
- package/dist/tools/utils/execute/noninteractive-wrapper.js +269 -0
- package/dist/tools/utils/execute/noninteractive-wrapper.js.map +1 -0
- package/dist/tools/utils/execute/noninteractive-wrapper.test.d.ts +2 -0
- package/dist/tools/utils/execute/noninteractive-wrapper.test.d.ts.map +1 -0
- package/dist/tools/utils/execute/noninteractive-wrapper.test.js +233 -0
- package/dist/tools/utils/execute/noninteractive-wrapper.test.js.map +1 -0
- package/dist/tools/utils/execute/output-handler.d.ts +14 -0
- package/dist/tools/utils/execute/output-handler.d.ts.map +1 -0
- package/dist/tools/utils/execute/output-handler.js +71 -0
- package/dist/tools/utils/execute/output-handler.js.map +1 -0
- package/dist/tools/utils/execute/output-handler.test.d.ts +2 -0
- package/dist/tools/utils/execute/output-handler.test.d.ts.map +1 -0
- package/dist/tools/utils/execute/output-handler.test.js +58 -0
- package/dist/tools/utils/execute/output-handler.test.js.map +1 -0
- package/dist/tools/utils/execute/process-manager.d.ts +17 -0
- package/dist/tools/utils/execute/process-manager.d.ts.map +1 -0
- package/dist/tools/utils/execute/process-manager.js +229 -0
- package/dist/tools/utils/execute/process-manager.js.map +1 -0
- package/dist/tools/utils/execute/process-manager.test.d.ts +2 -0
- package/dist/tools/utils/execute/process-manager.test.d.ts.map +1 -0
- package/dist/tools/utils/execute/process-manager.test.js +139 -0
- package/dist/tools/utils/execute/process-manager.test.js.map +1 -0
- package/dist/tools/utils/execute/shell-detection.d.ts +3 -0
- package/dist/tools/utils/execute/shell-detection.d.ts.map +1 -0
- package/dist/tools/utils/execute/shell-detection.js +56 -0
- package/dist/tools/utils/execute/shell-detection.js.map +1 -0
- package/dist/tools/utils/execute/shell-detection.test.d.ts +2 -0
- package/dist/tools/utils/execute/shell-detection.test.d.ts.map +1 -0
- package/dist/tools/utils/execute/shell-detection.test.js +86 -0
- package/dist/tools/utils/execute/shell-detection.test.js.map +1 -0
- package/dist/tools/utils/hashline/autocorrect-replacement-lines.d.ts +5 -0
- package/dist/tools/utils/hashline/autocorrect-replacement-lines.d.ts.map +1 -0
- package/dist/tools/utils/hashline/autocorrect-replacement-lines.js +113 -0
- package/dist/tools/utils/hashline/autocorrect-replacement-lines.js.map +1 -0
- package/dist/tools/utils/hashline/constants.d.ts +5 -0
- package/dist/tools/utils/hashline/constants.d.ts.map +1 -0
- package/dist/tools/utils/hashline/constants.js +11 -0
- package/dist/tools/utils/hashline/constants.js.map +1 -0
- package/dist/tools/utils/hashline/diff-utils.d.ts +7 -0
- package/dist/tools/utils/hashline/diff-utils.d.ts.map +1 -0
- package/dist/tools/utils/hashline/diff-utils.js +50 -0
- package/dist/tools/utils/hashline/diff-utils.js.map +1 -0
- package/dist/tools/utils/hashline/diff-utils.test.d.ts +2 -0
- package/dist/tools/utils/hashline/diff-utils.test.d.ts.map +1 -0
- package/dist/tools/utils/hashline/diff-utils.test.js +46 -0
- package/dist/tools/utils/hashline/diff-utils.test.js.map +1 -0
- package/dist/tools/utils/hashline/edit-deduplication.d.ts +6 -0
- package/dist/tools/utils/hashline/edit-deduplication.d.ts.map +1 -0
- package/dist/tools/utils/hashline/edit-deduplication.js +32 -0
- package/dist/tools/utils/hashline/edit-deduplication.js.map +1 -0
- package/dist/tools/utils/hashline/edit-operation-primitives.d.ts +11 -0
- package/dist/tools/utils/hashline/edit-operation-primitives.d.ts.map +1 -0
- package/dist/tools/utils/hashline/edit-operation-primitives.js +93 -0
- package/dist/tools/utils/hashline/edit-operation-primitives.js.map +1 -0
- package/dist/tools/utils/hashline/edit-operations.d.ts +9 -0
- package/dist/tools/utils/hashline/edit-operations.d.ts.map +1 -0
- package/dist/tools/utils/hashline/edit-operations.js +101 -0
- package/dist/tools/utils/hashline/edit-operations.js.map +1 -0
- package/dist/tools/utils/hashline/edit-operations.test.d.ts +2 -0
- package/dist/tools/utils/hashline/edit-operations.test.d.ts.map +1 -0
- package/dist/tools/utils/hashline/edit-operations.test.js +135 -0
- package/dist/tools/utils/hashline/edit-operations.test.js.map +1 -0
- package/dist/tools/utils/hashline/edit-ordering.d.ts +5 -0
- package/dist/tools/utils/hashline/edit-ordering.d.ts.map +1 -0
- package/dist/tools/utils/hashline/edit-ordering.js +54 -0
- package/dist/tools/utils/hashline/edit-ordering.js.map +1 -0
- package/dist/tools/utils/hashline/edit-text-normalization.d.ts +9 -0
- package/dist/tools/utils/hashline/edit-text-normalization.d.ts.map +1 -0
- package/dist/tools/utils/hashline/edit-text-normalization.js +135 -0
- package/dist/tools/utils/hashline/edit-text-normalization.js.map +1 -0
- package/dist/tools/utils/hashline/file-text-canonicalization.d.ts +8 -0
- package/dist/tools/utils/hashline/file-text-canonicalization.d.ts.map +1 -0
- package/dist/tools/utils/hashline/file-text-canonicalization.js +42 -0
- package/dist/tools/utils/hashline/file-text-canonicalization.js.map +1 -0
- package/dist/tools/utils/hashline/hash-computation.d.ts +14 -0
- package/dist/tools/utils/hashline/hash-computation.d.ts.map +1 -0
- package/dist/tools/utils/hashline/hash-computation.js +158 -0
- package/dist/tools/utils/hashline/hash-computation.js.map +1 -0
- package/dist/tools/utils/hashline/hash-computation.test.d.ts +2 -0
- package/dist/tools/utils/hashline/hash-computation.test.d.ts.map +1 -0
- package/dist/tools/utils/hashline/hash-computation.test.js +63 -0
- package/dist/tools/utils/hashline/hash-computation.test.js.map +1 -0
- package/dist/tools/utils/hashline/hashline-chunk-formatter.d.ts +11 -0
- package/dist/tools/utils/hashline/hashline-chunk-formatter.d.ts.map +1 -0
- package/dist/tools/utils/hashline/hashline-chunk-formatter.js +41 -0
- package/dist/tools/utils/hashline/hashline-chunk-formatter.js.map +1 -0
- package/dist/tools/utils/hashline/hashline-edit-diff.d.ts +2 -0
- package/dist/tools/utils/hashline/hashline-edit-diff.d.ts.map +1 -0
- package/dist/tools/utils/hashline/hashline-edit-diff.js +27 -0
- package/dist/tools/utils/hashline/hashline-edit-diff.js.map +1 -0
- package/dist/tools/utils/hashline/index.d.ts +14 -0
- package/dist/tools/utils/hashline/index.d.ts.map +1 -0
- package/dist/tools/utils/hashline/index.js +11 -0
- package/dist/tools/utils/hashline/index.js.map +1 -0
- package/dist/tools/utils/hashline/merge-expansion.d.ts +4 -0
- package/dist/tools/utils/hashline/merge-expansion.d.ts.map +1 -0
- package/dist/tools/utils/hashline/merge-expansion.js +105 -0
- package/dist/tools/utils/hashline/merge-expansion.js.map +1 -0
- package/dist/tools/utils/hashline/normalize-edits.d.ts +11 -0
- package/dist/tools/utils/hashline/normalize-edits.d.ts.map +1 -0
- package/dist/tools/utils/hashline/normalize-edits.js +81 -0
- package/dist/tools/utils/hashline/normalize-edits.js.map +1 -0
- package/dist/tools/utils/hashline/types.d.ts +18 -0
- package/dist/tools/utils/hashline/types.d.ts.map +1 -0
- package/dist/tools/utils/hashline/types.js +2 -0
- package/dist/tools/utils/hashline/types.js.map +1 -0
- package/dist/tools/utils/hashline/validation.d.ts +19 -0
- package/dist/tools/utils/hashline/validation.d.ts.map +1 -0
- package/dist/tools/utils/hashline/validation.js +161 -0
- package/dist/tools/utils/hashline/validation.js.map +1 -0
- package/dist/tools/utils/hashline/validation.test.d.ts +2 -0
- package/dist/tools/utils/hashline/validation.test.d.ts.map +1 -0
- package/dist/tools/utils/hashline/validation.test.js +86 -0
- package/dist/tools/utils/hashline/validation.test.js.map +1 -0
- package/dist/tools/utils/safety-utils.d.ts +66 -0
- package/dist/tools/utils/safety-utils.d.ts.map +1 -0
- package/dist/tools/utils/safety-utils.js +681 -0
- package/dist/tools/utils/safety-utils.js.map +1 -0
- package/dist/utils/tools-manager.d.ts +16 -0
- package/dist/utils/tools-manager.d.ts.map +1 -0
- package/dist/utils/tools-manager.js +257 -0
- package/dist/utils/tools-manager.js.map +1 -0
- package/package.json +49 -0
- package/src/AGENTS.md +52 -0
- package/src/agent-reasoning-default.test.ts +48 -0
- package/src/agent.test.ts +49 -0
- package/src/agent.ts +455 -0
- package/src/cli-args.test.ts +152 -0
- package/src/cli-args.ts +90 -0
- package/src/commands/aliases-and-tool-fallback.test.ts +172 -0
- package/src/commands/clear.ts +14 -0
- package/src/commands/factories/create-toggle-command.ts +68 -0
- package/src/commands/help.ts +30 -0
- package/src/commands/index.ts +125 -0
- package/src/commands/model.ts +146 -0
- package/src/commands/reasoning-mode.ts +55 -0
- package/src/commands/render.test.ts +47 -0
- package/src/commands/render.ts +205 -0
- package/src/commands/tool-fallback.ts +47 -0
- package/src/commands/translate.test.ts +62 -0
- package/src/commands/translate.ts +14 -0
- package/src/commands/types.ts +18 -0
- package/src/context/environment-context.ts +11 -0
- package/src/context/paths.ts +2 -0
- package/src/context/session.ts +18 -0
- package/src/context/skill-command-prefix.ts +18 -0
- package/src/context/skills-integration.test.ts +113 -0
- package/src/context/skills.test.ts +25 -0
- package/src/context/skills.ts +566 -0
- package/src/context/system-prompt.ts +100 -0
- package/src/context/translation-integration.test.ts +194 -0
- package/src/context/translation.test.ts +186 -0
- package/src/context/translation.ts +122 -0
- package/src/entrypoints/AGENTS.md +33 -0
- package/src/entrypoints/cli-input-rendering.test.ts +236 -0
- package/src/entrypoints/cli.ts +1845 -0
- package/src/entrypoints/headless-agent-config.test.ts +82 -0
- package/src/entrypoints/headless-agent-config.ts +42 -0
- package/src/entrypoints/headless.ts +622 -0
- package/src/env.ts +14 -0
- package/src/friendli-models.ts +81 -0
- package/src/friendli-reasoning.test.ts +147 -0
- package/src/friendli-reasoning.ts +280 -0
- package/src/index.ts +3 -0
- package/src/interaction/colors.ts +24 -0
- package/src/interaction/pi-tui-stream-renderer.test.ts +1471 -0
- package/src/interaction/pi-tui-stream-renderer.ts +2150 -0
- package/src/interaction/spinner.ts +61 -0
- package/src/middleware/index.ts +32 -0
- package/src/middleware/todo-continuation.ts +128 -0
- package/src/middleware/trim-leading-newlines.ts +66 -0
- package/src/reasoning-mode.test.ts +24 -0
- package/src/reasoning-mode.ts +40 -0
- package/src/skills/example/SKILL.md +44 -0
- package/src/skills/example/references/api.md +37 -0
- package/src/skills/example/scripts/setup.sh +13 -0
- package/src/skills/git-workflow.md +405 -0
- package/src/tool-fallback-mode.ts +34 -0
- package/src/tools/AGENTS.md +44 -0
- package/src/tools/execute/shell-execute.test.ts +114 -0
- package/src/tools/execute/shell-execute.ts +74 -0
- package/src/tools/execute/shell-execute.txt +27 -0
- package/src/tools/execute/shell-interact.test.ts +236 -0
- package/src/tools/execute/shell-interact.ts +151 -0
- package/src/tools/execute/shell-interact.txt +15 -0
- package/src/tools/explore/glob-files.txt +8 -0
- package/src/tools/explore/glob.test.ts +217 -0
- package/src/tools/explore/glob.ts +137 -0
- package/src/tools/explore/grep-files.txt +12 -0
- package/src/tools/explore/grep.test.ts +183 -0
- package/src/tools/explore/grep.ts +266 -0
- package/src/tools/explore/read-file.test.ts +355 -0
- package/src/tools/explore/read-file.ts +102 -0
- package/src/tools/explore/read-file.txt +24 -0
- package/src/tools/index.ts +29 -0
- package/src/tools/modify/AGENTS.md +38 -0
- package/src/tools/modify/delete-file.test.ts +200 -0
- package/src/tools/modify/delete-file.ts +95 -0
- package/src/tools/modify/delete-file.txt +9 -0
- package/src/tools/modify/edit-file-diagnostics.ts +210 -0
- package/src/tools/modify/edit-file-repair.ts +183 -0
- package/src/tools/modify/edit-file-stress.test.ts +200 -0
- package/src/tools/modify/edit-file-validation.ts +134 -0
- package/src/tools/modify/edit-file-whitespace.test.ts +117 -0
- package/src/tools/modify/edit-file.test.ts +1231 -0
- package/src/tools/modify/edit-file.ts +252 -0
- package/src/tools/modify/edit-file.txt +73 -0
- package/src/tools/modify/write-file.test.ts +240 -0
- package/src/tools/modify/write-file.ts +56 -0
- package/src/tools/modify/write-file.txt +9 -0
- package/src/tools/planning/load-skill.test.ts +48 -0
- package/src/tools/planning/load-skill.ts +136 -0
- package/src/tools/planning/load-skill.txt +6 -0
- package/src/tools/planning/todo-write.test.ts +91 -0
- package/src/tools/planning/todo-write.ts +141 -0
- package/src/tools/planning/todo-write.txt +7 -0
- package/src/tools/utils/execute/format-utils.test.ts +53 -0
- package/src/tools/utils/execute/format-utils.ts +37 -0
- package/src/tools/utils/execute/noninteractive-wrapper.test.ts +306 -0
- package/src/tools/utils/execute/noninteractive-wrapper.ts +314 -0
- package/src/tools/utils/execute/output-handler.test.ts +72 -0
- package/src/tools/utils/execute/output-handler.ts +101 -0
- package/src/tools/utils/execute/process-manager.test.ts +175 -0
- package/src/tools/utils/execute/process-manager.ts +310 -0
- package/src/tools/utils/execute/shell-detection.test.ts +112 -0
- package/src/tools/utils/execute/shell-detection.ts +72 -0
- package/src/tools/utils/hashline/autocorrect-replacement-lines.ts +159 -0
- package/src/tools/utils/hashline/constants.ts +13 -0
- package/src/tools/utils/hashline/diff-utils.test.ts +61 -0
- package/src/tools/utils/hashline/diff-utils.ts +64 -0
- package/src/tools/utils/hashline/edit-deduplication.ts +40 -0
- package/src/tools/utils/hashline/edit-operation-primitives.ts +149 -0
- package/src/tools/utils/hashline/edit-operations.test.ts +154 -0
- package/src/tools/utils/hashline/edit-operations.ts +132 -0
- package/src/tools/utils/hashline/edit-ordering.ts +60 -0
- package/src/tools/utils/hashline/edit-text-normalization.ts +180 -0
- package/src/tools/utils/hashline/file-text-canonicalization.ts +58 -0
- package/src/tools/utils/hashline/hash-computation.test.ts +82 -0
- package/src/tools/utils/hashline/hash-computation.ts +199 -0
- package/src/tools/utils/hashline/hashline-chunk-formatter.ts +61 -0
- package/src/tools/utils/hashline/hashline-edit-diff.ts +35 -0
- package/src/tools/utils/hashline/index.ts +55 -0
- package/src/tools/utils/hashline/merge-expansion.ts +120 -0
- package/src/tools/utils/hashline/normalize-edits.ts +127 -0
- package/src/tools/utils/hashline/types.ts +20 -0
- package/src/tools/utils/hashline/validation.test.ts +109 -0
- package/src/tools/utils/hashline/validation.ts +212 -0
- package/src/tools/utils/safety-utils.ts +938 -0
- package/src/utils/tools-manager.ts +353 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { basename } from "node:path";
|
|
2
|
+
import { tool } from "ai";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { formatBlock, safeReadFileEnhanced } from "../utils/safety-utils";
|
|
5
|
+
import READ_FILE_DESCRIPTION from "./read-file.txt";
|
|
6
|
+
const inputSchema = z.object({
|
|
7
|
+
path: z.string().describe("File path (absolute or relative)"),
|
|
8
|
+
offset: z
|
|
9
|
+
.number()
|
|
10
|
+
.int()
|
|
11
|
+
.min(0)
|
|
12
|
+
.optional()
|
|
13
|
+
.describe("Start line (0-based, default: 0). Use around_line for smarter reading."),
|
|
14
|
+
limit: z
|
|
15
|
+
.number()
|
|
16
|
+
.int()
|
|
17
|
+
.min(1)
|
|
18
|
+
.optional()
|
|
19
|
+
.describe("Max lines to read (default: 2000)"),
|
|
20
|
+
around_line: z
|
|
21
|
+
.number()
|
|
22
|
+
.int()
|
|
23
|
+
.min(1)
|
|
24
|
+
.optional()
|
|
25
|
+
.describe("Read around this line (1-based). Combines with before/after."),
|
|
26
|
+
before: z
|
|
27
|
+
.number()
|
|
28
|
+
.int()
|
|
29
|
+
.min(0)
|
|
30
|
+
.optional()
|
|
31
|
+
.describe("Lines before around_line (default: 5)"),
|
|
32
|
+
after: z
|
|
33
|
+
.number()
|
|
34
|
+
.int()
|
|
35
|
+
.min(0)
|
|
36
|
+
.optional()
|
|
37
|
+
.describe("Lines after around_line (default: 10)"),
|
|
38
|
+
respect_git_ignore: z
|
|
39
|
+
.boolean()
|
|
40
|
+
.optional()
|
|
41
|
+
.default(true)
|
|
42
|
+
.describe("Respect ignore rules from .gitignore/.ignore/.fdignore"),
|
|
43
|
+
});
|
|
44
|
+
export async function executeReadFile({ path, offset, limit, around_line, before, after, respect_git_ignore, }) {
|
|
45
|
+
const parsedInput = inputSchema.parse({
|
|
46
|
+
path,
|
|
47
|
+
offset,
|
|
48
|
+
limit,
|
|
49
|
+
around_line,
|
|
50
|
+
before,
|
|
51
|
+
after,
|
|
52
|
+
respect_git_ignore,
|
|
53
|
+
});
|
|
54
|
+
const result = await safeReadFileEnhanced(path, {
|
|
55
|
+
offset: parsedInput.offset,
|
|
56
|
+
limit: parsedInput.limit,
|
|
57
|
+
around_line: parsedInput.around_line,
|
|
58
|
+
before: parsedInput.before,
|
|
59
|
+
after: parsedInput.after,
|
|
60
|
+
respect_git_ignore: parsedInput.respect_git_ignore,
|
|
61
|
+
});
|
|
62
|
+
const fileName = basename(path);
|
|
63
|
+
const rangeStr = `L${result.startLine1}-L${result.endLine1}`;
|
|
64
|
+
const output = [
|
|
65
|
+
"OK - read file",
|
|
66
|
+
`path: ${path}`,
|
|
67
|
+
`bytes: ${result.bytes}`,
|
|
68
|
+
`last_modified: ${result.lastModified}`,
|
|
69
|
+
`lines: ${result.totalLines} (returned: ${result.endLine1 - result.startLine1 + 1})`,
|
|
70
|
+
`file_hash: ${result.fileHash}`,
|
|
71
|
+
`range: ${rangeStr}`,
|
|
72
|
+
`truncated: ${result.truncated}`,
|
|
73
|
+
`respect_git_ignore: ${parsedInput.respect_git_ignore}`,
|
|
74
|
+
"",
|
|
75
|
+
formatBlock(`${fileName} ${rangeStr}`, result.numberedContent),
|
|
76
|
+
];
|
|
77
|
+
return output.join("\n");
|
|
78
|
+
}
|
|
79
|
+
export const readFileTool = tool({
|
|
80
|
+
description: READ_FILE_DESCRIPTION,
|
|
81
|
+
inputSchema,
|
|
82
|
+
execute: executeReadFile,
|
|
83
|
+
});
|
|
84
|
+
//# sourceMappingURL=read-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-file.js","sourceRoot":"","sources":["../../../src/tools/explore/read-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,qBAAqB,MAAM,iBAAiB,CAAC;AAEpD,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;IAC7D,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,GAAG,EAAE;SACL,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,EAAE;SACV,QAAQ,CACP,wEAAwE,CACzE;IACH,KAAK,EAAE,CAAC;SACL,MAAM,EAAE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MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAChC,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC,UAAU,KAAK,MAAM,CAAC,QAAQ,EAAE,CAAC;IAE7D,MAAM,MAAM,GAAG;QACb,gBAAgB;QAChB,SAAS,IAAI,EAAE;QACf,UAAU,MAAM,CAAC,KAAK,EAAE;QACxB,kBAAkB,MAAM,CAAC,YAAY,EAAE;QACvC,UAAU,MAAM,CAAC,UAAU,eAAe,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,UAAU,GAAG,CAAC,GAAG;QACpF,cAAc,MAAM,CAAC,QAAQ,EAAE;QAC/B,UAAU,QAAQ,EAAE;QACpB,cAAc,MAAM,CAAC,SAAS,EAAE;QAChC,uBAAuB,WAAW,CAAC,kBAAkB,EAAE;QACvD,EAAE;QACF,WAAW,CAAC,GAAG,QAAQ,IAAI,QAAQ,EAAE,EAAE,MAAM,CAAC,eAAe,CAAC;KAC/D,CAAC;IAEF,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC;IAC/B,WAAW,EAAE,qBAAqB;IAClC,WAAW;IACX,OAAO,EAAE,eAAe;CACzB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-file.test.d.ts","sourceRoot":"","sources":["../../../src/tools/explore/read-file.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { afterAll, beforeAll, describe, expect, it } from "bun:test";
|
|
2
|
+
import { existsSync, mkdirSync, mkdtempSync, rmSync, writeFileSync, } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { executeReadFile } from "./read-file";
|
|
6
|
+
const ISO_DATE_PATTERN = /\d{4}-\d{2}-\d{2}T/;
|
|
7
|
+
const FILE_HASH_PATTERN = /file_hash:\s+[0-9a-f]{8}/;
|
|
8
|
+
const LINE_TAG_PATTERN = /\d+#(?:[ZPMQVRWSNKTXJBYH]{2})\|/;
|
|
9
|
+
const HASHLINE_ALPHABET = "[ZPMQVRWSNKTXJBYH]{2}";
|
|
10
|
+
const REGEX_ESCAPE_PATTERN = /[.*+?^${}()|[\]\\]/g;
|
|
11
|
+
function buildTaggedLinePattern(lineNumber, text) {
|
|
12
|
+
const escaped = text.replaceAll(REGEX_ESCAPE_PATTERN, "\\$&");
|
|
13
|
+
return new RegExp(`${lineNumber}#${HASHLINE_ALPHABET}\\|${escaped}`);
|
|
14
|
+
}
|
|
15
|
+
describe("executeReadFile", () => {
|
|
16
|
+
let tempDir;
|
|
17
|
+
beforeAll(() => {
|
|
18
|
+
tempDir = mkdtempSync(join(tmpdir(), "read-file-test-"));
|
|
19
|
+
});
|
|
20
|
+
afterAll(() => {
|
|
21
|
+
if (existsSync(tempDir)) {
|
|
22
|
+
rmSync(tempDir, { recursive: true });
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
describe("basic read operations", () => {
|
|
26
|
+
it("reads file and returns structured response", async () => {
|
|
27
|
+
const testFile = join(tempDir, "basic.txt");
|
|
28
|
+
writeFileSync(testFile, "line1\nline2\nline3");
|
|
29
|
+
const result = await executeReadFile({ path: testFile });
|
|
30
|
+
expect(result).toContain("OK - read file");
|
|
31
|
+
expect(result).toContain(`path: ${testFile}`);
|
|
32
|
+
expect(result).toContain("bytes:");
|
|
33
|
+
expect(result).toContain("lines: 3");
|
|
34
|
+
expect(result).toMatch(FILE_HASH_PATTERN);
|
|
35
|
+
expect(result).toContain("range: L1-L3");
|
|
36
|
+
expect(result).toContain("======== basic.txt L1-L3 ========");
|
|
37
|
+
expect(result).toMatch(buildTaggedLinePattern(1, "line1"));
|
|
38
|
+
expect(result).toMatch(buildTaggedLinePattern(2, "line2"));
|
|
39
|
+
expect(result).toMatch(buildTaggedLinePattern(3, "line3"));
|
|
40
|
+
expect(result).toContain("======== end ========");
|
|
41
|
+
});
|
|
42
|
+
it("includes last_modified timestamp", async () => {
|
|
43
|
+
const testFile = join(tempDir, "mtime.txt");
|
|
44
|
+
writeFileSync(testFile, "content");
|
|
45
|
+
const result = await executeReadFile({ path: testFile });
|
|
46
|
+
expect(result).toContain("last_modified:");
|
|
47
|
+
expect(result).toMatch(ISO_DATE_PATTERN);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
describe("offset and limit", () => {
|
|
51
|
+
it("respects offset parameter", async () => {
|
|
52
|
+
const testFile = join(tempDir, "offset.txt");
|
|
53
|
+
writeFileSync(testFile, "a\nb\nc\nd\ne");
|
|
54
|
+
const result = await executeReadFile({ path: testFile, offset: 2 });
|
|
55
|
+
expect(result).toContain("range: L3-L5");
|
|
56
|
+
expect(result).toMatch(buildTaggedLinePattern(3, "c"));
|
|
57
|
+
expect(result).toMatch(buildTaggedLinePattern(4, "d"));
|
|
58
|
+
expect(result).toMatch(buildTaggedLinePattern(5, "e"));
|
|
59
|
+
expect(result).not.toMatch(buildTaggedLinePattern(1, "a"));
|
|
60
|
+
expect(result).not.toMatch(buildTaggedLinePattern(2, "b"));
|
|
61
|
+
});
|
|
62
|
+
it("respects limit parameter", async () => {
|
|
63
|
+
const testFile = join(tempDir, "limit.txt");
|
|
64
|
+
writeFileSync(testFile, "a\nb\nc\nd\ne");
|
|
65
|
+
const result = await executeReadFile({ path: testFile, limit: 2 });
|
|
66
|
+
expect(result).toContain("range: L1-L2");
|
|
67
|
+
expect(result).toContain("returned: 2");
|
|
68
|
+
expect(result).toMatch(buildTaggedLinePattern(1, "a"));
|
|
69
|
+
expect(result).toMatch(buildTaggedLinePattern(2, "b"));
|
|
70
|
+
});
|
|
71
|
+
it("combines offset and limit", async () => {
|
|
72
|
+
const testFile = join(tempDir, "combo.txt");
|
|
73
|
+
writeFileSync(testFile, "1\n2\n3\n4\n5\n6\n7\n8\n9\n10");
|
|
74
|
+
const result = await executeReadFile({
|
|
75
|
+
path: testFile,
|
|
76
|
+
offset: 3,
|
|
77
|
+
limit: 3,
|
|
78
|
+
});
|
|
79
|
+
expect(result).toContain("range: L4-L6");
|
|
80
|
+
expect(result).toMatch(buildTaggedLinePattern(4, "4"));
|
|
81
|
+
expect(result).toMatch(buildTaggedLinePattern(5, "5"));
|
|
82
|
+
expect(result).toMatch(buildTaggedLinePattern(6, "6"));
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
describe("around_line feature", () => {
|
|
86
|
+
it("reads around specified line with defaults", async () => {
|
|
87
|
+
const testFile = join(tempDir, "around.txt");
|
|
88
|
+
const lines = Array.from({ length: 30 }, (_, i) => `line${i + 1}`);
|
|
89
|
+
writeFileSync(testFile, lines.join("\n"));
|
|
90
|
+
const result = await executeReadFile({
|
|
91
|
+
path: testFile,
|
|
92
|
+
around_line: 15,
|
|
93
|
+
});
|
|
94
|
+
expect(result).toContain("L10-L25");
|
|
95
|
+
expect(result).toContain("line15");
|
|
96
|
+
expect(result).toContain("line10");
|
|
97
|
+
expect(result).toContain("line25");
|
|
98
|
+
});
|
|
99
|
+
it("respects before parameter", async () => {
|
|
100
|
+
const testFile = join(tempDir, "before.txt");
|
|
101
|
+
const lines = Array.from({ length: 20 }, (_, i) => `line${i + 1}`);
|
|
102
|
+
writeFileSync(testFile, lines.join("\n"));
|
|
103
|
+
const result = await executeReadFile({
|
|
104
|
+
path: testFile,
|
|
105
|
+
around_line: 10,
|
|
106
|
+
before: 2,
|
|
107
|
+
after: 2,
|
|
108
|
+
});
|
|
109
|
+
expect(result).toContain("L8-L12");
|
|
110
|
+
expect(result).toContain("line8");
|
|
111
|
+
expect(result).toContain("line10");
|
|
112
|
+
expect(result).toContain("line12");
|
|
113
|
+
});
|
|
114
|
+
it("handles around_line at start of file", async () => {
|
|
115
|
+
const testFile = join(tempDir, "start.txt");
|
|
116
|
+
writeFileSync(testFile, "1\n2\n3\n4\n5\n6\n7\n8\n9\n10");
|
|
117
|
+
const result = await executeReadFile({
|
|
118
|
+
path: testFile,
|
|
119
|
+
around_line: 1,
|
|
120
|
+
before: 5,
|
|
121
|
+
after: 3,
|
|
122
|
+
});
|
|
123
|
+
expect(result).toContain("L1-L4");
|
|
124
|
+
});
|
|
125
|
+
it("handles around_line at end of file", async () => {
|
|
126
|
+
const testFile = join(tempDir, "end.txt");
|
|
127
|
+
writeFileSync(testFile, "1\n2\n3\n4\n5");
|
|
128
|
+
const result = await executeReadFile({
|
|
129
|
+
path: testFile,
|
|
130
|
+
around_line: 5,
|
|
131
|
+
before: 2,
|
|
132
|
+
after: 10,
|
|
133
|
+
});
|
|
134
|
+
expect(result).toContain("L3-L5");
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
describe("truncation indication", () => {
|
|
138
|
+
it("indicates when file is truncated", async () => {
|
|
139
|
+
const testFile = join(tempDir, "trunc.txt");
|
|
140
|
+
writeFileSync(testFile, "a\nb\nc\nd\ne");
|
|
141
|
+
const result = await executeReadFile({ path: testFile, limit: 2 });
|
|
142
|
+
expect(result).toContain("truncated: true");
|
|
143
|
+
});
|
|
144
|
+
it("indicates when file is not truncated", async () => {
|
|
145
|
+
const testFile = join(tempDir, "notrunc.txt");
|
|
146
|
+
writeFileSync(testFile, "a\nb");
|
|
147
|
+
const result = await executeReadFile({ path: testFile });
|
|
148
|
+
expect(result).toContain("truncated: false");
|
|
149
|
+
expect(result).toMatch(LINE_TAG_PATTERN);
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
describe("error handling", () => {
|
|
153
|
+
it("throws error for non-existent file", async () => {
|
|
154
|
+
await expect(executeReadFile({ path: join(tempDir, "nonexistent.txt") })).rejects.toThrow();
|
|
155
|
+
});
|
|
156
|
+
it("respects .ignore and .fdignore by default", async () => {
|
|
157
|
+
const isolatedDir = mkdtempSync(join(tmpdir(), "read-ignore-"));
|
|
158
|
+
try {
|
|
159
|
+
const ignoredByDotIgnore = join(isolatedDir, "blocked-ignore.txt");
|
|
160
|
+
const ignoredByFdIgnore = join(isolatedDir, "blocked-fd.txt");
|
|
161
|
+
writeFileSync(join(isolatedDir, ".ignore"), "blocked-ignore.txt\n");
|
|
162
|
+
writeFileSync(join(isolatedDir, ".fdignore"), "blocked-fd.txt\n");
|
|
163
|
+
writeFileSync(ignoredByDotIgnore, "blocked");
|
|
164
|
+
writeFileSync(ignoredByFdIgnore, "blocked");
|
|
165
|
+
await expect(executeReadFile({ path: ignoredByDotIgnore })).rejects.toThrow("excluded by ignore rules");
|
|
166
|
+
await expect(executeReadFile({ path: ignoredByFdIgnore })).rejects.toThrow("excluded by ignore rules");
|
|
167
|
+
}
|
|
168
|
+
finally {
|
|
169
|
+
if (existsSync(isolatedDir)) {
|
|
170
|
+
rmSync(isolatedDir, { recursive: true });
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
it("can bypass ignore rules when respect_git_ignore is false", async () => {
|
|
175
|
+
const isolatedDir = mkdtempSync(join(tmpdir(), "read-ignore-off-"));
|
|
176
|
+
try {
|
|
177
|
+
const ignoredFile = join(isolatedDir, "blocked.txt");
|
|
178
|
+
writeFileSync(join(isolatedDir, ".ignore"), "blocked.txt\n");
|
|
179
|
+
writeFileSync(ignoredFile, "allowed");
|
|
180
|
+
const result = await executeReadFile({
|
|
181
|
+
path: ignoredFile,
|
|
182
|
+
respect_git_ignore: false,
|
|
183
|
+
});
|
|
184
|
+
expect(result).toContain("OK - read file");
|
|
185
|
+
expect(result).toContain("respect_git_ignore: false");
|
|
186
|
+
expect(result).toMatch(buildTaggedLinePattern(1, "allowed"));
|
|
187
|
+
}
|
|
188
|
+
finally {
|
|
189
|
+
if (existsSync(isolatedDir)) {
|
|
190
|
+
rmSync(isolatedDir, { recursive: true });
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
it("applies parent .gitignore when reading from subdirectory", async () => {
|
|
195
|
+
const repoDir = mkdtempSync(join(tmpdir(), "read-parent-gitignore-"));
|
|
196
|
+
const workspaceDir = join(repoDir, "workspace");
|
|
197
|
+
try {
|
|
198
|
+
mkdirSync(join(repoDir, ".git"));
|
|
199
|
+
mkdirSync(workspaceDir);
|
|
200
|
+
writeFileSync(join(repoDir, ".gitignore"), "/workspace/blocked.txt\n");
|
|
201
|
+
writeFileSync(join(workspaceDir, "blocked.txt"), "blocked");
|
|
202
|
+
await expect(executeReadFile({ path: join(workspaceDir, "blocked.txt") })).rejects.toThrow("excluded by ignore rules");
|
|
203
|
+
}
|
|
204
|
+
finally {
|
|
205
|
+
if (existsSync(repoDir)) {
|
|
206
|
+
rmSync(repoDir, { recursive: true });
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
it("applies slashless nested .gitignore patterns to descendants", async () => {
|
|
211
|
+
const repoDir = mkdtempSync(join(tmpdir(), "read-nested-gitignore-"));
|
|
212
|
+
const srcDir = join(repoDir, "src");
|
|
213
|
+
const nestedDir = join(srcDir, "nested");
|
|
214
|
+
try {
|
|
215
|
+
mkdirSync(join(repoDir, ".git"));
|
|
216
|
+
mkdirSync(srcDir);
|
|
217
|
+
mkdirSync(nestedDir);
|
|
218
|
+
writeFileSync(join(srcDir, ".gitignore"), "ignored.ts\n");
|
|
219
|
+
writeFileSync(join(nestedDir, "ignored.ts"), "blocked");
|
|
220
|
+
await expect(executeReadFile({ path: join(nestedDir, "ignored.ts") })).rejects.toThrow("excluded by ignore rules");
|
|
221
|
+
}
|
|
222
|
+
finally {
|
|
223
|
+
if (existsSync(repoDir)) {
|
|
224
|
+
rmSync(repoDir, { recursive: true });
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
it("does not bypass ignore rules with relative parent paths", async () => {
|
|
229
|
+
const originalCwd = process.cwd();
|
|
230
|
+
const repoDir = mkdtempSync(join(tmpdir(), "read-relative-parent-"));
|
|
231
|
+
const nestedDir = join(repoDir, "nested");
|
|
232
|
+
try {
|
|
233
|
+
mkdirSync(join(repoDir, ".git"));
|
|
234
|
+
mkdirSync(nestedDir);
|
|
235
|
+
writeFileSync(join(repoDir, ".gitignore"), "/blocked.txt\n");
|
|
236
|
+
writeFileSync(join(repoDir, "blocked.txt"), "blocked");
|
|
237
|
+
process.chdir(nestedDir);
|
|
238
|
+
await expect(executeReadFile({ path: "../blocked.txt" })).rejects.toThrow("excluded by ignore rules");
|
|
239
|
+
}
|
|
240
|
+
finally {
|
|
241
|
+
process.chdir(originalCwd);
|
|
242
|
+
if (existsSync(repoDir)) {
|
|
243
|
+
rmSync(repoDir, { recursive: true });
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
it("rejects negative offset", async () => {
|
|
248
|
+
const testFile = join(tempDir, "invalid-offset.txt");
|
|
249
|
+
writeFileSync(testFile, "a\nb\n");
|
|
250
|
+
await expect(executeReadFile({
|
|
251
|
+
path: testFile,
|
|
252
|
+
offset: -1,
|
|
253
|
+
})).rejects.toThrow();
|
|
254
|
+
});
|
|
255
|
+
it("rejects non-positive limit", async () => {
|
|
256
|
+
const testFile = join(tempDir, "invalid-limit.txt");
|
|
257
|
+
writeFileSync(testFile, "a\nb\n");
|
|
258
|
+
await expect(executeReadFile({
|
|
259
|
+
path: testFile,
|
|
260
|
+
limit: 0,
|
|
261
|
+
})).rejects.toThrow();
|
|
262
|
+
});
|
|
263
|
+
it("rejects binary content even with text extension", async () => {
|
|
264
|
+
const testFile = join(tempDir, "binary.txt");
|
|
265
|
+
writeFileSync(testFile, Buffer.from([0x00, 0x61, 0x62, 0x63]));
|
|
266
|
+
await expect(executeReadFile({ path: testFile })).rejects.toThrow("binary");
|
|
267
|
+
});
|
|
268
|
+
it("allows text files with .lock extension", async () => {
|
|
269
|
+
const testFile = join(tempDir, "plain.lock");
|
|
270
|
+
writeFileSync(testFile, "line1\nline2");
|
|
271
|
+
const result = await executeReadFile({ path: testFile });
|
|
272
|
+
expect(result).toContain("OK - read file");
|
|
273
|
+
expect(result).toMatch(buildTaggedLinePattern(1, "line1"));
|
|
274
|
+
expect(result).toMatch(buildTaggedLinePattern(2, "line2"));
|
|
275
|
+
});
|
|
276
|
+
});
|
|
277
|
+
});
|
|
278
|
+
//# sourceMappingURL=read-file.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-file.test.js","sourceRoot":"","sources":["../../../src/tools/explore/read-file.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AACrE,OAAO,EACL,UAAU,EACV,SAAS,EACT,WAAW,EACX,MAAM,EACN,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,gBAAgB,GAAG,oBAAoB,CAAC;AAC9C,MAAM,iBAAiB,GAAG,0BAA0B,CAAC;AACrD,MAAM,gBAAgB,GAAG,iCAAiC,CAAC;AAC3D,MAAM,iBAAiB,GAAG,uBAAuB,CAAC;AAClD,MAAM,oBAAoB,GAAG,qBAAqB,CAAC;AAEnD,SAAS,sBAAsB,CAAC,UAAkB,EAAE,IAAY;IAC9D,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC;IAC9D,OAAO,IAAI,MAAM,CAAC,GAAG,UAAU,IAAI,iBAAiB,MAAM,OAAO,EAAE,CAAC,CAAC;AACvE,CAAC;AAED,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,IAAI,OAAe,CAAC;IAEpB,SAAS,CAAC,GAAG,EAAE;QACb,OAAO,GAAG,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;IAEH,QAAQ,CA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E;YACtD,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;YAC7C,aAAa,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;YAExC,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;YAEzD,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;YAC3C,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;YAC3D,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;QAC7D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export declare const createTools: () => {
|
|
2
|
+
readonly shell_execute: import("ai").Tool<{
|
|
3
|
+
command: string;
|
|
4
|
+
workdir?: string | undefined;
|
|
5
|
+
timeout_ms?: number | undefined;
|
|
6
|
+
}, import("./execute/shell-execute").ToolOutput>;
|
|
7
|
+
readonly shell_interact: import("ai").Tool<{
|
|
8
|
+
keystrokes: string;
|
|
9
|
+
timeout_ms?: number | undefined;
|
|
10
|
+
}, import("./execute/shell-interact").InteractResult>;
|
|
11
|
+
readonly write_file: import("ai").Tool<{
|
|
12
|
+
path: string;
|
|
13
|
+
content: string;
|
|
14
|
+
}, string>;
|
|
15
|
+
readonly edit_file: import("ai").Tool<{
|
|
16
|
+
path: string;
|
|
17
|
+
edits: {
|
|
18
|
+
op: "replace" | "append" | "prepend";
|
|
19
|
+
lines: string | string[] | null;
|
|
20
|
+
pos?: string | undefined;
|
|
21
|
+
end?: string | undefined;
|
|
22
|
+
}[];
|
|
23
|
+
expected_file_hash?: string | undefined;
|
|
24
|
+
}, string>;
|
|
25
|
+
readonly read_file: import("ai").Tool<{
|
|
26
|
+
path: string;
|
|
27
|
+
respect_git_ignore: boolean;
|
|
28
|
+
offset?: number | undefined;
|
|
29
|
+
limit?: number | undefined;
|
|
30
|
+
around_line?: number | undefined;
|
|
31
|
+
before?: number | undefined;
|
|
32
|
+
after?: number | undefined;
|
|
33
|
+
}, string>;
|
|
34
|
+
readonly delete_file: import("ai").Tool<{
|
|
35
|
+
path: string;
|
|
36
|
+
recursive: boolean;
|
|
37
|
+
ignore_missing: boolean;
|
|
38
|
+
}, string>;
|
|
39
|
+
readonly glob_files: import("ai").Tool<{
|
|
40
|
+
pattern: string;
|
|
41
|
+
respect_git_ignore: boolean;
|
|
42
|
+
path?: string | undefined;
|
|
43
|
+
}, string>;
|
|
44
|
+
readonly grep_files: import("ai").Tool<{
|
|
45
|
+
pattern: string;
|
|
46
|
+
case_sensitive: boolean;
|
|
47
|
+
fixed_strings: boolean;
|
|
48
|
+
no_ignore: boolean;
|
|
49
|
+
path?: string | undefined;
|
|
50
|
+
include?: string | undefined;
|
|
51
|
+
context?: number | undefined;
|
|
52
|
+
before?: number | undefined;
|
|
53
|
+
after?: number | undefined;
|
|
54
|
+
}, string>;
|
|
55
|
+
readonly load_skill: import("ai").Tool<{
|
|
56
|
+
skillName: string;
|
|
57
|
+
relativePath?: string | undefined;
|
|
58
|
+
}, string>;
|
|
59
|
+
readonly todo_write: import("ai").Tool<{
|
|
60
|
+
todos: {
|
|
61
|
+
id: string;
|
|
62
|
+
content: string;
|
|
63
|
+
status: "pending" | "in_progress" | "completed" | "cancelled";
|
|
64
|
+
priority: "high" | "medium" | "low";
|
|
65
|
+
description?: string | undefined;
|
|
66
|
+
}[];
|
|
67
|
+
}, string>;
|
|
68
|
+
};
|
|
69
|
+
export type ToolRegistry = ReturnType<typeof createTools>;
|
|
70
|
+
export declare const tools: ToolRegistry;
|
|
71
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAavB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAE1D,eAAO,MAAM,KAAK,EAAE,YAA4B,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { shellExecuteTool } from "./execute/shell-execute";
|
|
2
|
+
import { shellInteractTool } from "./execute/shell-interact";
|
|
3
|
+
import { globTool } from "./explore/glob";
|
|
4
|
+
import { grepTool } from "./explore/grep";
|
|
5
|
+
import { readFileTool } from "./explore/read-file";
|
|
6
|
+
import { deleteFileTool } from "./modify/delete-file";
|
|
7
|
+
import { editFileTool } from "./modify/edit-file";
|
|
8
|
+
import { writeFileTool } from "./modify/write-file";
|
|
9
|
+
import { loadSkillTool } from "./planning/load-skill";
|
|
10
|
+
import { todoWriteTool } from "./planning/todo-write";
|
|
11
|
+
export const createTools = () => {
|
|
12
|
+
return {
|
|
13
|
+
shell_execute: shellExecuteTool,
|
|
14
|
+
shell_interact: shellInteractTool,
|
|
15
|
+
write_file: writeFileTool,
|
|
16
|
+
edit_file: editFileTool,
|
|
17
|
+
read_file: readFileTool,
|
|
18
|
+
delete_file: deleteFileTool,
|
|
19
|
+
glob_files: globTool,
|
|
20
|
+
grep_files: grepTool,
|
|
21
|
+
load_skill: loadSkillTool,
|
|
22
|
+
todo_write: todoWriteTool,
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export const tools = createTools();
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,EAAE;IAC9B,OAAO;QACL,aAAa,EAAE,gBAAgB;QAC/B,cAAc,EAAE,iBAAiB;QACjC,UAAU,EAAE,aAAa;QACzB,SAAS,EAAE,YAAY;QACvB,SAAS,EAAE,YAAY;QACvB,WAAW,EAAE,cAAc;QAC3B,UAAU,EAAE,QAAQ;QACpB,UAAU,EAAE,QAAQ;QACpB,UAAU,EAAE,aAAa;QACzB,UAAU,EAAE,aAAa;KACjB,CAAC;AACb,CAAC,CAAC;AAIF,MAAM,CAAC,MAAM,KAAK,GAAiB,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
declare const inputSchema: z.ZodObject<{
|
|
3
|
+
path: z.ZodString;
|
|
4
|
+
recursive: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
5
|
+
ignore_missing: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
export type DeleteFileInput = z.input<typeof inputSchema>;
|
|
8
|
+
export interface DeleteFileOptions {
|
|
9
|
+
/** Override project root for safety checks (defaults to process.cwd()). */
|
|
10
|
+
rootDir?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function executeDeleteFile({ path, recursive, ignore_missing }: DeleteFileInput, options?: DeleteFileOptions): Promise<string>;
|
|
13
|
+
export declare const deleteFileTool: import("ai").Tool<{
|
|
14
|
+
path: string;
|
|
15
|
+
recursive: boolean;
|
|
16
|
+
ignore_missing: boolean;
|
|
17
|
+
}, string>;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=delete-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-file.d.ts","sourceRoot":"","sources":["../../../src/tools/modify/delete-file.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,QAAA,MAAM,WAAW;;;;iBAYf,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAE1D,MAAM,WAAW,iBAAiB;IAChC,2EAA2E;IAC3E,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAsB,iBAAiB,CACrC,EAAE,IAAI,EAAE,SAAiB,EAAE,cAAsB,EAAE,EAAE,eAAe,EACpE,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,MAAM,CAAC,CAyDjB;AAED,eAAO,MAAM,cAAc;;;;UAIzB,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { lstat, rm } from "node:fs/promises";
|
|
2
|
+
import { basename } from "node:path";
|
|
3
|
+
import { tool } from "ai";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { assertWriteSafety } from "../utils/safety-utils";
|
|
6
|
+
import DELETE_FILE_DESCRIPTION from "./delete-file.txt";
|
|
7
|
+
const inputSchema = z.object({
|
|
8
|
+
path: z.string().describe("Path to delete"),
|
|
9
|
+
recursive: z
|
|
10
|
+
.boolean()
|
|
11
|
+
.optional()
|
|
12
|
+
.default(false)
|
|
13
|
+
.describe("Delete directories recursively (default: false)"),
|
|
14
|
+
ignore_missing: z
|
|
15
|
+
.boolean()
|
|
16
|
+
.optional()
|
|
17
|
+
.default(false)
|
|
18
|
+
.describe("Don't error if file doesn't exist (default: false)"),
|
|
19
|
+
});
|
|
20
|
+
export async function executeDeleteFile({ path, recursive = false, ignore_missing = false }, options) {
|
|
21
|
+
// C-1 + C-2: Path traversal and symlink safety checks
|
|
22
|
+
const safePath = await assertWriteSafety(path, options?.rootDir);
|
|
23
|
+
// C-2: Use lstat (not stat) — lstat does NOT follow symlinks,
|
|
24
|
+
// so we see the symlink entry itself rather than its target.
|
|
25
|
+
let stats;
|
|
26
|
+
try {
|
|
27
|
+
stats = await lstat(safePath);
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
if (ignore_missing &&
|
|
31
|
+
error instanceof Error &&
|
|
32
|
+
"code" in error &&
|
|
33
|
+
error.code === "ENOENT") {
|
|
34
|
+
return `SKIPPED - file does not exist: ${path}`;
|
|
35
|
+
}
|
|
36
|
+
throw error;
|
|
37
|
+
}
|
|
38
|
+
// Reject symlink deletion — force explicit resolution
|
|
39
|
+
if (stats.isSymbolicLink()) {
|
|
40
|
+
throw new Error(`Refusing to delete symlink: '${path}'. ` +
|
|
41
|
+
"Resolve the symlink first or operate on the real file directly.");
|
|
42
|
+
}
|
|
43
|
+
const isDirectory = stats.isDirectory();
|
|
44
|
+
const fileName = basename(path);
|
|
45
|
+
const byteSize = isDirectory ? null : stats.size;
|
|
46
|
+
const mtime = stats.mtime.toISOString();
|
|
47
|
+
if (isDirectory && !recursive) {
|
|
48
|
+
throw new Error(`Cannot delete directory '${path}' without recursive: true. ` +
|
|
49
|
+
"Set recursive: true to delete directories.");
|
|
50
|
+
}
|
|
51
|
+
await rm(safePath, { recursive, force: false });
|
|
52
|
+
const output = [];
|
|
53
|
+
if (isDirectory) {
|
|
54
|
+
output.push(`OK - deleted directory: ${fileName}`);
|
|
55
|
+
output.push(`path: ${path}`);
|
|
56
|
+
output.push(`last_modified: ${mtime}`);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
output.push(`OK - deleted file: ${fileName}`);
|
|
60
|
+
output.push(`path: ${path}`);
|
|
61
|
+
output.push(`bytes: ${byteSize}`);
|
|
62
|
+
output.push(`last_modified: ${mtime}`);
|
|
63
|
+
}
|
|
64
|
+
return output.join("\n");
|
|
65
|
+
}
|
|
66
|
+
export const deleteFileTool = tool({
|
|
67
|
+
description: DELETE_FILE_DESCRIPTION,
|
|
68
|
+
inputSchema,
|
|
69
|
+
execute: (input) => executeDeleteFile(input),
|
|
70
|
+
});
|
|
71
|
+
//# sourceMappingURL=delete-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-file.js","sourceRoot":"","sources":["../../../src/tools/modify/delete-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,uBAAuB,MAAM,mBAAmB,CAAC;AAExD,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC;IAC3C,SAAS,EAAE,CAAC;SACT,OAAO,EAAE;SACT,QAAQ,EAAE;SACV,OAAO,CAAC,KAAK,CAAC;SACd,QAAQ,CAAC,iDAAiD,CAAC;IAC9D,cAAc,EAAE,CAAC;SACd,OAAO,EAAE;SACT,QAAQ,EAAE;SACV,OAAO,CAAC,KAAK,CAAC;SACd,QAAQ,CAAC,oDAAoD,CAAC;CAClE,CAAC,CAAC;AASH,MAAM,CAAC,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