micro-models-agent 0.6.4 → 0.7.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/README.md +286 -436
- package/dist/main.js +11744 -0
- package/dist/skills/builtin/git.md +36 -0
- package/dist/skills/builtin/typescript.md +35 -0
- package/package.json +41 -47
- package/dist/agent/context.d.ts +0 -73
- package/dist/agent/context.d.ts.map +0 -1
- package/dist/agent/context.js +0 -262
- package/dist/agent/context.js.map +0 -1
- package/dist/agent/error-escalation.d.ts +0 -19
- package/dist/agent/error-escalation.d.ts.map +0 -1
- package/dist/agent/error-escalation.js +0 -168
- package/dist/agent/error-escalation.js.map +0 -1
- package/dist/agent/loop.d.ts +0 -46
- package/dist/agent/loop.d.ts.map +0 -1
- package/dist/agent/loop.js +0 -1043
- package/dist/agent/loop.js.map +0 -1
- package/dist/agent/memory.d.ts +0 -40
- package/dist/agent/memory.d.ts.map +0 -1
- package/dist/agent/memory.js +0 -231
- package/dist/agent/memory.js.map +0 -1
- package/dist/agent/modes/applier.d.ts +0 -43
- package/dist/agent/modes/applier.d.ts.map +0 -1
- package/dist/agent/modes/applier.js +0 -30
- package/dist/agent/modes/applier.js.map +0 -1
- package/dist/agent/modes/registry.d.ts +0 -35
- package/dist/agent/modes/registry.d.ts.map +0 -1
- package/dist/agent/modes/registry.js +0 -169
- package/dist/agent/modes/registry.js.map +0 -1
- package/dist/agent/modes/types.d.ts +0 -61
- package/dist/agent/modes/types.d.ts.map +0 -1
- package/dist/agent/modes/types.js +0 -13
- package/dist/agent/modes/types.js.map +0 -1
- package/dist/agent/react-loop.d.ts +0 -65
- package/dist/agent/react-loop.d.ts.map +0 -1
- package/dist/agent/react-loop.js +0 -101
- package/dist/agent/react-loop.js.map +0 -1
- package/dist/agent/system-prompt.d.ts +0 -26
- package/dist/agent/system-prompt.d.ts.map +0 -1
- package/dist/agent/system-prompt.js +0 -478
- package/dist/agent/system-prompt.js.map +0 -1
- package/dist/agent/tool-executor.d.ts +0 -36
- package/dist/agent/tool-executor.d.ts.map +0 -1
- package/dist/agent/tool-executor.js +0 -346
- package/dist/agent/tool-executor.js.map +0 -1
- package/dist/agent/user-profile.d.ts +0 -26
- package/dist/agent/user-profile.d.ts.map +0 -1
- package/dist/agent/user-profile.js +0 -169
- package/dist/agent/user-profile.js.map +0 -1
- package/dist/agent/write-enforcer.d.ts +0 -7
- package/dist/agent/write-enforcer.d.ts.map +0 -1
- package/dist/agent/write-enforcer.js +0 -8
- package/dist/agent/write-enforcer.js.map +0 -1
- package/dist/cli/config.d.ts +0 -13
- package/dist/cli/config.d.ts.map +0 -1
- package/dist/cli/config.js +0 -82
- package/dist/cli/config.js.map +0 -1
- package/dist/cli/model.d.ts +0 -13
- package/dist/cli/model.d.ts.map +0 -1
- package/dist/cli/model.js +0 -170
- package/dist/cli/model.js.map +0 -1
- package/dist/cli/provider.d.ts +0 -12
- package/dist/cli/provider.d.ts.map +0 -1
- package/dist/cli/provider.js +0 -90
- package/dist/cli/provider.js.map +0 -1
- package/dist/cli/update.d.ts +0 -12
- package/dist/cli/update.d.ts.map +0 -1
- package/dist/cli/update.js +0 -69
- package/dist/cli/update.js.map +0 -1
- package/dist/cli.d.ts +0 -3
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -310
- package/dist/cli.js.map +0 -1
- package/dist/config/config.d.ts +0 -59
- package/dist/config/config.d.ts.map +0 -1
- package/dist/config/config.js +0 -232
- package/dist/config/config.js.map +0 -1
- package/dist/config/types.d.ts +0 -122
- package/dist/config/types.d.ts.map +0 -1
- package/dist/config/types.js +0 -13
- package/dist/config/types.js.map +0 -1
- package/dist/file-loader.d.ts +0 -20
- package/dist/file-loader.d.ts.map +0 -1
- package/dist/file-loader.js +0 -121
- package/dist/file-loader.js.map +0 -1
- package/dist/index.d.ts +0 -9
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -11
- package/dist/index.js.map +0 -1
- package/dist/indexer/cache.d.ts +0 -34
- package/dist/indexer/cache.d.ts.map +0 -1
- package/dist/indexer/cache.js +0 -221
- package/dist/indexer/cache.js.map +0 -1
- package/dist/indexer/code-index.d.ts +0 -27
- package/dist/indexer/code-index.d.ts.map +0 -1
- package/dist/indexer/code-index.js +0 -219
- package/dist/indexer/code-index.js.map +0 -1
- package/dist/indexer/project-map.d.ts +0 -23
- package/dist/indexer/project-map.d.ts.map +0 -1
- package/dist/indexer/project-map.js +0 -264
- package/dist/indexer/project-map.js.map +0 -1
- package/dist/llm/lmstudio-native.d.ts +0 -10
- package/dist/llm/lmstudio-native.d.ts.map +0 -1
- package/dist/llm/lmstudio-native.js +0 -179
- package/dist/llm/lmstudio-native.js.map +0 -1
- package/dist/llm/openai-compat.d.ts +0 -11
- package/dist/llm/openai-compat.d.ts.map +0 -1
- package/dist/llm/openai-compat.js +0 -161
- package/dist/llm/openai-compat.js.map +0 -1
- package/dist/llm/provider.d.ts +0 -46
- package/dist/llm/provider.d.ts.map +0 -1
- package/dist/llm/provider.js +0 -13
- package/dist/llm/provider.js.map +0 -1
- package/dist/llm/token-counter.d.ts +0 -15
- package/dist/llm/token-counter.d.ts.map +0 -1
- package/dist/llm/token-counter.js +0 -51
- package/dist/llm/token-counter.js.map +0 -1
- package/dist/logger.d.ts +0 -24
- package/dist/logger.d.ts.map +0 -1
- package/dist/logger.js +0 -156
- package/dist/logger.js.map +0 -1
- package/dist/plugins/adapters/hooks-adapter.d.ts +0 -12
- package/dist/plugins/adapters/hooks-adapter.d.ts.map +0 -1
- package/dist/plugins/adapters/hooks-adapter.js +0 -23
- package/dist/plugins/adapters/hooks-adapter.js.map +0 -1
- package/dist/plugins/builtin/lint-on-write/index.d.ts +0 -12
- package/dist/plugins/builtin/lint-on-write/index.d.ts.map +0 -1
- package/dist/plugins/builtin/lint-on-write/index.js +0 -98
- package/dist/plugins/builtin/lint-on-write/index.js.map +0 -1
- package/dist/plugins/builtin/lint-on-write/index.ts +0 -97
- package/dist/plugins/builtin/lint-on-write/manifest.json +0 -13
- package/dist/plugins/builtin/notify/index.d.ts +0 -11
- package/dist/plugins/builtin/notify/index.d.ts.map +0 -1
- package/dist/plugins/builtin/notify/index.js +0 -102
- package/dist/plugins/builtin/notify/index.js.map +0 -1
- package/dist/plugins/builtin/notify/index.ts +0 -105
- package/dist/plugins/builtin/notify/manifest.json +0 -16
- package/dist/plugins/loader.d.ts +0 -18
- package/dist/plugins/loader.d.ts.map +0 -1
- package/dist/plugins/loader.js +0 -182
- package/dist/plugins/loader.js.map +0 -1
- package/dist/plugins/manager.d.ts +0 -55
- package/dist/plugins/manager.d.ts.map +0 -1
- package/dist/plugins/manager.js +0 -190
- package/dist/plugins/manager.js.map +0 -1
- package/dist/plugins/types.d.ts +0 -76
- package/dist/plugins/types.d.ts.map +0 -1
- package/dist/plugins/types.js +0 -8
- package/dist/plugins/types.js.map +0 -1
- package/dist/repl/commands.d.ts +0 -63
- package/dist/repl/commands.d.ts.map +0 -1
- package/dist/repl/commands.js +0 -1070
- package/dist/repl/commands.js.map +0 -1
- package/dist/repl/history.d.ts +0 -32
- package/dist/repl/history.d.ts.map +0 -1
- package/dist/repl/history.js +0 -40
- package/dist/repl/history.js.map +0 -1
- package/dist/repl/index.d.ts +0 -14
- package/dist/repl/index.d.ts.map +0 -1
- package/dist/repl/index.js +0 -235
- package/dist/repl/index.js.map +0 -1
- package/dist/session/store.d.ts +0 -46
- package/dist/session/store.d.ts.map +0 -1
- package/dist/session/store.js +0 -154
- package/dist/session/store.js.map +0 -1
- package/dist/setup-wizard.d.ts +0 -3
- package/dist/setup-wizard.d.ts.map +0 -1
- package/dist/setup-wizard.js +0 -410
- package/dist/setup-wizard.js.map +0 -1
- package/dist/skills/builtin/agent-test/SKILL.md +0 -68
- package/dist/skills/builtin/cli-expert/SKILL.md +0 -848
- package/dist/skills/builtin/code-review/SKILL.md +0 -424
- package/dist/skills/builtin/git-expert/SKILL.md +0 -522
- package/dist/skills/builtin/grill-me/SKILL.md +0 -46
- package/dist/skills/builtin/jest-testing-expert/SKILL.md +0 -957
- package/dist/skills/builtin/nodejs-expert/SKILL.md +0 -192
- package/dist/skills/builtin/systematic-debugging/SKILL.md +0 -296
- package/dist/skills/builtin/test-driven-development/SKILL.md +0 -371
- package/dist/skills/builtin/typescript-expert/SKILL.md +0 -429
- package/dist/skills/builtin/web-scraping/SKILL.md +0 -422
- package/dist/skills/loader.d.ts +0 -49
- package/dist/skills/loader.d.ts.map +0 -1
- package/dist/skills/loader.js +0 -401
- package/dist/skills/loader.js.map +0 -1
- package/dist/styling/engine.d.ts +0 -39
- package/dist/styling/engine.d.ts.map +0 -1
- package/dist/styling/engine.js +0 -122
- package/dist/styling/engine.js.map +0 -1
- package/dist/styling/index.d.ts +0 -15
- package/dist/styling/index.d.ts.map +0 -1
- package/dist/styling/index.js +0 -40
- package/dist/styling/index.js.map +0 -1
- package/dist/styling/loader.d.ts +0 -9
- package/dist/styling/loader.d.ts.map +0 -1
- package/dist/styling/loader.js +0 -169
- package/dist/styling/loader.js.map +0 -1
- package/dist/styling/types.d.ts +0 -64
- package/dist/styling/types.d.ts.map +0 -1
- package/dist/styling/types.js +0 -12
- package/dist/styling/types.js.map +0 -1
- package/dist/subagent/chat.d.ts +0 -19
- package/dist/subagent/chat.d.ts.map +0 -1
- package/dist/subagent/chat.js +0 -279
- package/dist/subagent/chat.js.map +0 -1
- package/dist/subagent/context.d.ts +0 -9
- package/dist/subagent/context.d.ts.map +0 -1
- package/dist/subagent/context.js +0 -75
- package/dist/subagent/context.js.map +0 -1
- package/dist/subagent/definition.d.ts +0 -7
- package/dist/subagent/definition.d.ts.map +0 -1
- package/dist/subagent/definition.js +0 -26
- package/dist/subagent/definition.js.map +0 -1
- package/dist/subagent/errors.d.ts +0 -24
- package/dist/subagent/errors.d.ts.map +0 -1
- package/dist/subagent/errors.js +0 -85
- package/dist/subagent/errors.js.map +0 -1
- package/dist/subagent/validation.d.ts +0 -17
- package/dist/subagent/validation.d.ts.map +0 -1
- package/dist/subagent/validation.js +0 -83
- package/dist/subagent/validation.js.map +0 -1
- package/dist/tools/adapters/bash-to-fs.d.ts +0 -20
- package/dist/tools/adapters/bash-to-fs.d.ts.map +0 -1
- package/dist/tools/adapters/bash-to-fs.js +0 -74
- package/dist/tools/adapters/bash-to-fs.js.map +0 -1
- package/dist/tools/adapters/content-sanitizer.d.ts +0 -13
- package/dist/tools/adapters/content-sanitizer.d.ts.map +0 -1
- package/dist/tools/adapters/content-sanitizer.js +0 -73
- package/dist/tools/adapters/content-sanitizer.js.map +0 -1
- package/dist/tools/adapters/grounding-fixer.d.ts +0 -15
- package/dist/tools/adapters/grounding-fixer.d.ts.map +0 -1
- package/dist/tools/adapters/grounding-fixer.js +0 -57
- package/dist/tools/adapters/grounding-fixer.js.map +0 -1
- package/dist/tools/adapters/index.d.ts +0 -6
- package/dist/tools/adapters/index.d.ts.map +0 -1
- package/dist/tools/adapters/index.js +0 -5
- package/dist/tools/adapters/index.js.map +0 -1
- package/dist/tools/adapters/pipeline.d.ts +0 -34
- package/dist/tools/adapters/pipeline.d.ts.map +0 -1
- package/dist/tools/adapters/pipeline.js +0 -58
- package/dist/tools/adapters/pipeline.js.map +0 -1
- package/dist/tools/adapters/types.d.ts +0 -46
- package/dist/tools/adapters/types.d.ts.map +0 -1
- package/dist/tools/adapters/types.js +0 -2
- package/dist/tools/adapters/types.js.map +0 -1
- package/dist/tools/approve.d.ts +0 -27
- package/dist/tools/approve.d.ts.map +0 -1
- package/dist/tools/approve.js +0 -45
- package/dist/tools/approve.js.map +0 -1
- package/dist/tools/bash.d.ts +0 -25
- package/dist/tools/bash.d.ts.map +0 -1
- package/dist/tools/bash.js +0 -292
- package/dist/tools/bash.js.map +0 -1
- package/dist/tools/fs/copy-file.d.ts +0 -13
- package/dist/tools/fs/copy-file.d.ts.map +0 -1
- package/dist/tools/fs/copy-file.js +0 -54
- package/dist/tools/fs/copy-file.js.map +0 -1
- package/dist/tools/fs/create-dir.d.ts +0 -13
- package/dist/tools/fs/create-dir.d.ts.map +0 -1
- package/dist/tools/fs/create-dir.js +0 -44
- package/dist/tools/fs/create-dir.js.map +0 -1
- package/dist/tools/fs/delete-file.d.ts +0 -13
- package/dist/tools/fs/delete-file.d.ts.map +0 -1
- package/dist/tools/fs/delete-file.js +0 -52
- package/dist/tools/fs/delete-file.js.map +0 -1
- package/dist/tools/fs/edit-file.d.ts +0 -15
- package/dist/tools/fs/edit-file.d.ts.map +0 -1
- package/dist/tools/fs/edit-file.js +0 -95
- package/dist/tools/fs/edit-file.js.map +0 -1
- package/dist/tools/fs/file-info.d.ts +0 -13
- package/dist/tools/fs/file-info.d.ts.map +0 -1
- package/dist/tools/fs/file-info.js +0 -50
- package/dist/tools/fs/file-info.js.map +0 -1
- package/dist/tools/fs/glob-search.d.ts +0 -13
- package/dist/tools/fs/glob-search.d.ts.map +0 -1
- package/dist/tools/fs/glob-search.js +0 -112
- package/dist/tools/fs/glob-search.js.map +0 -1
- package/dist/tools/fs/grep-search.d.ts +0 -14
- package/dist/tools/fs/grep-search.d.ts.map +0 -1
- package/dist/tools/fs/grep-search.js +0 -135
- package/dist/tools/fs/grep-search.js.map +0 -1
- package/dist/tools/fs/list-dir.d.ts +0 -13
- package/dist/tools/fs/list-dir.d.ts.map +0 -1
- package/dist/tools/fs/list-dir.js +0 -74
- package/dist/tools/fs/list-dir.js.map +0 -1
- package/dist/tools/fs/move-file.d.ts +0 -13
- package/dist/tools/fs/move-file.d.ts.map +0 -1
- package/dist/tools/fs/move-file.js +0 -54
- package/dist/tools/fs/move-file.js.map +0 -1
- package/dist/tools/fs/path-utils.d.ts +0 -51
- package/dist/tools/fs/path-utils.d.ts.map +0 -1
- package/dist/tools/fs/path-utils.js +0 -103
- package/dist/tools/fs/path-utils.js.map +0 -1
- package/dist/tools/fs/read-file.d.ts +0 -13
- package/dist/tools/fs/read-file.d.ts.map +0 -1
- package/dist/tools/fs/read-file.js +0 -64
- package/dist/tools/fs/read-file.js.map +0 -1
- package/dist/tools/fs/tree.d.ts +0 -13
- package/dist/tools/fs/tree.d.ts.map +0 -1
- package/dist/tools/fs/tree.js +0 -89
- package/dist/tools/fs/tree.js.map +0 -1
- package/dist/tools/fs/types.d.ts +0 -14
- package/dist/tools/fs/types.d.ts.map +0 -1
- package/dist/tools/fs/types.js +0 -11
- package/dist/tools/fs/types.js.map +0 -1
- package/dist/tools/fs/write-file.d.ts +0 -14
- package/dist/tools/fs/write-file.d.ts.map +0 -1
- package/dist/tools/fs/write-file.js +0 -83
- package/dist/tools/fs/write-file.js.map +0 -1
- package/dist/tools/hooks.d.ts +0 -44
- package/dist/tools/hooks.d.ts.map +0 -1
- package/dist/tools/hooks.js +0 -217
- package/dist/tools/hooks.js.map +0 -1
- package/dist/tools/id-gen.d.ts +0 -4
- package/dist/tools/id-gen.d.ts.map +0 -1
- package/dist/tools/id-gen.js +0 -12
- package/dist/tools/id-gen.js.map +0 -1
- package/dist/tools/mcp.d.ts +0 -36
- package/dist/tools/mcp.d.ts.map +0 -1
- package/dist/tools/mcp.js +0 -93
- package/dist/tools/mcp.js.map +0 -1
- package/dist/tools/native/approve.d.ts +0 -11
- package/dist/tools/native/approve.d.ts.map +0 -1
- package/dist/tools/native/approve.js +0 -39
- package/dist/tools/native/approve.js.map +0 -1
- package/dist/tools/native/plan.d.ts +0 -10
- package/dist/tools/native/plan.d.ts.map +0 -1
- package/dist/tools/native/plan.js +0 -115
- package/dist/tools/native/plan.js.map +0 -1
- package/dist/tools/native/project-map.d.ts +0 -15
- package/dist/tools/native/project-map.d.ts.map +0 -1
- package/dist/tools/native/project-map.js +0 -203
- package/dist/tools/native/project-map.js.map +0 -1
- package/dist/tools/native/question.d.ts +0 -11
- package/dist/tools/native/question.d.ts.map +0 -1
- package/dist/tools/native/question.js +0 -41
- package/dist/tools/native/question.js.map +0 -1
- package/dist/tools/native/scaffold.d.ts +0 -5
- package/dist/tools/native/scaffold.d.ts.map +0 -1
- package/dist/tools/native/scaffold.js +0 -246
- package/dist/tools/native/scaffold.js.map +0 -1
- package/dist/tools/native/theme.d.ts +0 -10
- package/dist/tools/native/theme.d.ts.map +0 -1
- package/dist/tools/native/theme.js +0 -101
- package/dist/tools/native/theme.js.map +0 -1
- package/dist/tools/native/todo.d.ts +0 -10
- package/dist/tools/native/todo.d.ts.map +0 -1
- package/dist/tools/native/todo.js +0 -58
- package/dist/tools/native/todo.js.map +0 -1
- package/dist/tools/native/user-profile.d.ts +0 -10
- package/dist/tools/native/user-profile.d.ts.map +0 -1
- package/dist/tools/native/user-profile.js +0 -58
- package/dist/tools/native/user-profile.js.map +0 -1
- package/dist/tools/parse-tool-call.d.ts +0 -11
- package/dist/tools/parse-tool-call.d.ts.map +0 -1
- package/dist/tools/parse-tool-call.js +0 -87
- package/dist/tools/parse-tool-call.js.map +0 -1
- package/dist/tools/plan.d.ts +0 -40
- package/dist/tools/plan.d.ts.map +0 -1
- package/dist/tools/plan.js +0 -143
- package/dist/tools/plan.js.map +0 -1
- package/dist/tools/question.d.ts +0 -33
- package/dist/tools/question.d.ts.map +0 -1
- package/dist/tools/question.js +0 -62
- package/dist/tools/question.js.map +0 -1
- package/dist/tools/registry.d.ts +0 -37
- package/dist/tools/registry.d.ts.map +0 -1
- package/dist/tools/registry.js +0 -97
- package/dist/tools/registry.js.map +0 -1
- package/dist/tools/sanitizer.d.ts +0 -30
- package/dist/tools/sanitizer.d.ts.map +0 -1
- package/dist/tools/sanitizer.js +0 -77
- package/dist/tools/sanitizer.js.map +0 -1
- package/dist/tools/subagent.d.ts +0 -39
- package/dist/tools/subagent.d.ts.map +0 -1
- package/dist/tools/subagent.js +0 -225
- package/dist/tools/subagent.js.map +0 -1
- package/dist/tools/syntax-check.d.ts +0 -32
- package/dist/tools/syntax-check.d.ts.map +0 -1
- package/dist/tools/syntax-check.js +0 -272
- package/dist/tools/syntax-check.js.map +0 -1
- package/dist/tools/todo.d.ts +0 -28
- package/dist/tools/todo.d.ts.map +0 -1
- package/dist/tools/todo.js +0 -125
- package/dist/tools/todo.js.map +0 -1
- package/dist/tools/types.d.ts +0 -51
- package/dist/tools/types.d.ts.map +0 -1
- package/dist/tools/types.js +0 -2
- package/dist/tools/types.js.map +0 -1
- package/dist/tools/web-browse.d.ts +0 -5
- package/dist/tools/web-browse.d.ts.map +0 -1
- package/dist/tools/web-browse.js +0 -757
- package/dist/tools/web-browse.js.map +0 -1
- package/dist/tools/web-fetch.d.ts +0 -19
- package/dist/tools/web-fetch.d.ts.map +0 -1
- package/dist/tools/web-fetch.js +0 -90
- package/dist/tools/web-fetch.js.map +0 -1
- package/dist/tools/web-search.d.ts +0 -19
- package/dist/tools/web-search.d.ts.map +0 -1
- package/dist/tools/web-search.js +0 -97
- package/dist/tools/web-search.js.map +0 -1
- package/dist/ui/components/status-bar.d.ts +0 -11
- package/dist/ui/components/status-bar.d.ts.map +0 -1
- package/dist/ui/components/status-bar.js +0 -20
- package/dist/ui/components/status-bar.js.map +0 -1
- package/dist/ui/index.d.ts +0 -8
- package/dist/ui/index.d.ts.map +0 -1
- package/dist/ui/index.js +0 -9
- package/dist/ui/index.js.map +0 -1
- package/dist/ui/ink/components/App.d.ts +0 -98
- package/dist/ui/ink/components/App.d.ts.map +0 -1
- package/dist/ui/ink/components/App.js +0 -212
- package/dist/ui/ink/components/App.js.map +0 -1
- package/dist/ui/ink/components/Conversation.d.ts +0 -20
- package/dist/ui/ink/components/Conversation.d.ts.map +0 -1
- package/dist/ui/ink/components/Conversation.js +0 -15
- package/dist/ui/ink/components/Conversation.js.map +0 -1
- package/dist/ui/ink/components/MessageBlock.d.ts +0 -27
- package/dist/ui/ink/components/MessageBlock.d.ts.map +0 -1
- package/dist/ui/ink/components/MessageBlock.js +0 -41
- package/dist/ui/ink/components/MessageBlock.js.map +0 -1
- package/dist/ui/ink/components/PromptInput.d.ts +0 -25
- package/dist/ui/ink/components/PromptInput.d.ts.map +0 -1
- package/dist/ui/ink/components/PromptInput.js +0 -167
- package/dist/ui/ink/components/PromptInput.js.map +0 -1
- package/dist/ui/ink/components/SelectInput.d.ts +0 -9
- package/dist/ui/ink/components/SelectInput.d.ts.map +0 -1
- package/dist/ui/ink/components/SelectInput.js +0 -30
- package/dist/ui/ink/components/SelectInput.js.map +0 -1
- package/dist/ui/ink/components/StatusBar.d.ts +0 -14
- package/dist/ui/ink/components/StatusBar.d.ts.map +0 -1
- package/dist/ui/ink/components/StatusBar.js +0 -20
- package/dist/ui/ink/components/StatusBar.js.map +0 -1
- package/dist/ui/ink/components/StreamBlock.d.ts +0 -8
- package/dist/ui/ink/components/StreamBlock.d.ts.map +0 -1
- package/dist/ui/ink/components/StreamBlock.js +0 -15
- package/dist/ui/ink/components/StreamBlock.js.map +0 -1
- package/dist/ui/ink/components/Tags.d.ts +0 -26
- package/dist/ui/ink/components/Tags.d.ts.map +0 -1
- package/dist/ui/ink/components/Tags.js +0 -37
- package/dist/ui/ink/components/Tags.js.map +0 -1
- package/dist/ui/ink/components/ToolCallBlock.d.ts +0 -31
- package/dist/ui/ink/components/ToolCallBlock.d.ts.map +0 -1
- package/dist/ui/ink/components/ToolCallBlock.js +0 -17
- package/dist/ui/ink/components/ToolCallBlock.js.map +0 -1
- package/dist/ui/ink/renderer.d.ts +0 -69
- package/dist/ui/ink/renderer.d.ts.map +0 -1
- package/dist/ui/ink/renderer.js +0 -142
- package/dist/ui/ink/renderer.js.map +0 -1
- package/dist/ui/ink/theme.d.ts +0 -28
- package/dist/ui/ink/theme.d.ts.map +0 -1
- package/dist/ui/ink/theme.js +0 -45
- package/dist/ui/ink/theme.js.map +0 -1
- package/dist/ui/md-formatter.d.ts +0 -16
- package/dist/ui/md-formatter.d.ts.map +0 -1
- package/dist/ui/md-formatter.js +0 -448
- package/dist/ui/md-formatter.js.map +0 -1
- package/dist/ui/readline-renderer.d.ts +0 -45
- package/dist/ui/readline-renderer.d.ts.map +0 -1
- package/dist/ui/readline-renderer.js +0 -181
- package/dist/ui/readline-renderer.js.map +0 -1
- package/dist/ui/renderer.d.ts +0 -66
- package/dist/ui/renderer.d.ts.map +0 -1
- package/dist/ui/renderer.js +0 -16
- package/dist/ui/renderer.js.map +0 -1
- package/dist/ui/subagent-renderer.d.ts +0 -58
- package/dist/ui/subagent-renderer.d.ts.map +0 -1
- package/dist/ui/subagent-renderer.js +0 -100
- package/dist/ui/subagent-renderer.js.map +0 -1
- package/dist/updater.d.ts +0 -15
- package/dist/updater.d.ts.map +0 -1
- package/dist/updater.js +0 -166
- package/dist/updater.js.map +0 -1
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { copyFileSync, mkdirSync } from 'node:fs';
|
|
2
|
-
import { dirname } from 'node:path';
|
|
3
|
-
import { resolvePath, assertExists, normalizePath } from './path-utils.js';
|
|
4
|
-
import { fsError, fsOk } from './types.js';
|
|
5
|
-
/**
|
|
6
|
-
* Инструмент копирования файлов.
|
|
7
|
-
* Создаёт родительские директории автоматически.
|
|
8
|
-
*
|
|
9
|
-
* @module tools/fs/copy-file
|
|
10
|
-
*/
|
|
11
|
-
export const copyFileDefinition = {
|
|
12
|
-
type: 'function',
|
|
13
|
-
function: {
|
|
14
|
-
name: 'copy_file',
|
|
15
|
-
description: 'Copy a file to a new location.',
|
|
16
|
-
parameters: {
|
|
17
|
-
type: 'object',
|
|
18
|
-
properties: {
|
|
19
|
-
source: { type: 'string', description: 'Source file path' },
|
|
20
|
-
destination: { type: 'string', description: 'Destination file path' },
|
|
21
|
-
},
|
|
22
|
-
required: ['source', 'destination'],
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
export function handleCopyFile(args, cwd) {
|
|
27
|
-
const source = String(args.source ?? '');
|
|
28
|
-
const dest = String(args.destination ?? '');
|
|
29
|
-
const srcResolved = resolvePath(source, cwd);
|
|
30
|
-
if (!srcResolved.ok)
|
|
31
|
-
return fsError(`Source: ${srcResolved.error}`);
|
|
32
|
-
const srcExists = assertExists(srcResolved.abs, 'file');
|
|
33
|
-
if (!srcExists.ok)
|
|
34
|
-
return fsError(srcExists.error);
|
|
35
|
-
const dstResolved = resolvePath(dest, cwd);
|
|
36
|
-
if (!dstResolved.ok)
|
|
37
|
-
return fsError(`Destination: ${dstResolved.error}`);
|
|
38
|
-
try {
|
|
39
|
-
mkdirSync(dirname(dstResolved.abs), { recursive: true });
|
|
40
|
-
copyFileSync(srcResolved.abs, dstResolved.abs);
|
|
41
|
-
}
|
|
42
|
-
catch (e) {
|
|
43
|
-
return fsError(`Copy failed: ${e.message}`);
|
|
44
|
-
}
|
|
45
|
-
return fsOk(`Copied ${normalizePath(source)} → ${normalizePath(dest)}`);
|
|
46
|
-
}
|
|
47
|
-
export const copyFileHandler = {
|
|
48
|
-
name: 'copy_file',
|
|
49
|
-
definition: copyFileDefinition,
|
|
50
|
-
async execute(args, ctx) {
|
|
51
|
-
return handleCopyFile(args, ctx.cwd);
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
//# sourceMappingURL=copy-file.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"copy-file.js","sourceRoot":"","sources":["../../../src/tools/fs/copy-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAE3C;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAmB;IAChD,IAAI,EAAE,UAAU;IAChB,QAAQ,EAAE;QACR,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,gCAAgC;QAC7C,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,kBAAkB,EAAE;gBAC3D,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EA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E,CAAC,CAAC;AAC1E,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAAgB;IAC1C,IAAI,EAAE,WAAW;IACjB,UAAU,EAAE,kBAAkB;IAC9B,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG;QACrB,OAAO,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IACvC,CAAC;CACF,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ToolDefinition } from '../registry.js';
|
|
2
|
-
import type { ToolHandler } from '../types.js';
|
|
3
|
-
import { fsOk } from './types.js';
|
|
4
|
-
/**
|
|
5
|
-
* Инструмент создания директорий.
|
|
6
|
-
* Создаёт одну или несколько директорий по указанному пути.
|
|
7
|
-
*
|
|
8
|
-
* @module tools/fs/create-dir
|
|
9
|
-
*/
|
|
10
|
-
export declare const createDirDefinition: ToolDefinition;
|
|
11
|
-
export declare function handleCreateDir(args: Record<string, unknown>, cwd: string): ReturnType<typeof fsOk>;
|
|
12
|
-
export declare const createDirHandler: ToolHandler;
|
|
13
|
-
//# sourceMappingURL=create-dir.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-dir.d.ts","sourceRoot":"","sources":["../../../src/tools/fs/create-dir.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAW,IAAI,EAAE,MAAM,YAAY,CAAC;AAE3C;;;;;GAKG;AAEH,eAAO,MAAM,mBAAmB,EAAE,cAajC,CAAC;AAEF,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,GAAG,EAAE,MAAM,GACV,UAAU,CAAC,OAAO,IAAI,CAAC,CAYzB;AAED,eAAO,MAAM,gBAAgB,EAAE,WAM9B,CAAC"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { mkdirSync } from 'node:fs';
|
|
2
|
-
import { resolvePath, normalizePath } from './path-utils.js';
|
|
3
|
-
import { fsError, fsOk } from './types.js';
|
|
4
|
-
/**
|
|
5
|
-
* Инструмент создания директорий.
|
|
6
|
-
* Создаёт одну или несколько директорий по указанному пути.
|
|
7
|
-
*
|
|
8
|
-
* @module tools/fs/create-dir
|
|
9
|
-
*/
|
|
10
|
-
export const createDirDefinition = {
|
|
11
|
-
type: 'function',
|
|
12
|
-
function: {
|
|
13
|
-
name: 'create_dir',
|
|
14
|
-
description: 'Create a directory (and parent directories if needed).',
|
|
15
|
-
parameters: {
|
|
16
|
-
type: 'object',
|
|
17
|
-
properties: {
|
|
18
|
-
path: { type: 'string', description: 'Directory path to create' },
|
|
19
|
-
},
|
|
20
|
-
required: ['path'],
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
export function handleCreateDir(args, cwd) {
|
|
25
|
-
const path = String(args.path ?? '');
|
|
26
|
-
const resolved = resolvePath(path, cwd);
|
|
27
|
-
if (!resolved.ok)
|
|
28
|
-
return fsError(resolved.error);
|
|
29
|
-
try {
|
|
30
|
-
mkdirSync(resolved.abs, { recursive: true });
|
|
31
|
-
}
|
|
32
|
-
catch (e) {
|
|
33
|
-
return fsError(`Cannot create directory: ${e.message}`);
|
|
34
|
-
}
|
|
35
|
-
return fsOk(`Created directory: ${normalizePath(path)}`);
|
|
36
|
-
}
|
|
37
|
-
export const createDirHandler = {
|
|
38
|
-
name: 'create_dir',
|
|
39
|
-
definition: createDirDefinition,
|
|
40
|
-
async execute(args, ctx) {
|
|
41
|
-
return handleCreateDir(args, ctx.cwd);
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
//# sourceMappingURL=create-dir.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-dir.js","sourceRoot":"","sources":["../../../src/tools/fs/create-dir.ts"],"names":[],"mappings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,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG;QACrB,OAAO,eAAe,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IACxC,CAAC;CACF,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ToolDefinition } from '../registry.js';
|
|
2
|
-
import type { ToolHandler } from '../types.js';
|
|
3
|
-
import { fsOk } from './types.js';
|
|
4
|
-
/**
|
|
5
|
-
* Инструмент удаления файлов и директорий.
|
|
6
|
-
* Директории требуют recursive: true.
|
|
7
|
-
*
|
|
8
|
-
* @module tools/fs/delete-file
|
|
9
|
-
*/
|
|
10
|
-
export declare const deleteFileDefinition: ToolDefinition;
|
|
11
|
-
export declare function handleDeleteFile(args: Record<string, unknown>, cwd: string): ReturnType<typeof fsOk>;
|
|
12
|
-
export declare const deleteFileHandler: ToolHandler;
|
|
13
|
-
//# sourceMappingURL=delete-file.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"delete-file.d.ts","sourceRoot":"","sources":["../../../src/tools/fs/delete-file.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAW,IAAI,EAAE,MAAM,YAAY,CAAC;AAE3C;;;;;GAKG;AAEH,eAAO,MAAM,oBAAoB,EAAE,cAclC,CAAC;AAEF,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,GAAG,EAAE,MAAM,GACV,UAAU,CAAC,OAAO,IAAI,CAAC,CAqBzB;AAED,eAAO,MAAM,iBAAiB,EAAE,WAM/B,CAAC"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { rmSync } from 'node:fs';
|
|
2
|
-
import { resolvePath, assertExists, normalizePath } from './path-utils.js';
|
|
3
|
-
import { fsError, fsOk } from './types.js';
|
|
4
|
-
/**
|
|
5
|
-
* Инструмент удаления файлов и директорий.
|
|
6
|
-
* Директории требуют recursive: true.
|
|
7
|
-
*
|
|
8
|
-
* @module tools/fs/delete-file
|
|
9
|
-
*/
|
|
10
|
-
export const deleteFileDefinition = {
|
|
11
|
-
type: 'function',
|
|
12
|
-
function: {
|
|
13
|
-
name: 'delete_file',
|
|
14
|
-
description: 'Delete a file or directory. Directories require recursive: true.',
|
|
15
|
-
parameters: {
|
|
16
|
-
type: 'object',
|
|
17
|
-
properties: {
|
|
18
|
-
path: { type: 'string', description: 'Path to delete' },
|
|
19
|
-
recursive: { type: 'boolean', description: 'Delete directories recursively (default: false)' },
|
|
20
|
-
},
|
|
21
|
-
required: ['path'],
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
export function handleDeleteFile(args, cwd) {
|
|
26
|
-
const path = String(args.path ?? '');
|
|
27
|
-
const recursive = Boolean(args.recursive);
|
|
28
|
-
const resolved = resolvePath(path, cwd);
|
|
29
|
-
if (!resolved.ok)
|
|
30
|
-
return fsError(resolved.error);
|
|
31
|
-
const exists = assertExists(resolved.abs);
|
|
32
|
-
if (!exists.ok)
|
|
33
|
-
return fsError(exists.error);
|
|
34
|
-
if (exists.stat.isDirectory() && !recursive) {
|
|
35
|
-
return fsError(`Cannot delete directory without recursive: true. Use recursive: true for directories.`);
|
|
36
|
-
}
|
|
37
|
-
try {
|
|
38
|
-
rmSync(resolved.abs, { recursive, force: true });
|
|
39
|
-
}
|
|
40
|
-
catch (e) {
|
|
41
|
-
return fsError(`Delete failed: ${e.message}`);
|
|
42
|
-
}
|
|
43
|
-
return fsOk(`Deleted: ${normalizePath(path)}`);
|
|
44
|
-
}
|
|
45
|
-
export const deleteFileHandler = {
|
|
46
|
-
name: 'delete_file',
|
|
47
|
-
definition: deleteFileDefinition,
|
|
48
|
-
async execute(args, ctx) {
|
|
49
|
-
return handleDeleteFile(args, ctx.cwd);
|
|
50
|
-
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C,EAAE;QAAE,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAE7C,IAAI,MAAM,CAAC,IAAK,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC;QAC7C,OAAO,OAAO,CAAC,uFAAuF,CAAC,CAAC;IAC1G,CAAC;IAED,IAAI,CAAC;QACH,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACnD,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,OAAO,OAAO,CAAC,kBAAkB,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IAChD,CAAC;IAED,OAAO,IAAI,CAAC,YAAY,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAgB;IAC5C,IAAI,EAAE,aAAa;IACnB,UAAU,EAAE,oBAAoB;IAChC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG;QACrB,OAAO,gBAAgB,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IACzC,CAAC;CACF,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { ToolDefinition } from '../registry.js';
|
|
2
|
-
import type { ToolHandler } from '../types.js';
|
|
3
|
-
import { fsOk } from './types.js';
|
|
4
|
-
/**
|
|
5
|
-
* Инструмент редактирования файла (find & replace).
|
|
6
|
-
* Точное строковое совпадение (не regex).
|
|
7
|
-
* Ошибка если old_string не найден или найден несколько раз
|
|
8
|
-
* (если не указан replace_all).
|
|
9
|
-
*
|
|
10
|
-
* @module tools/fs/edit-file
|
|
11
|
-
*/
|
|
12
|
-
export declare const editFileDefinition: ToolDefinition;
|
|
13
|
-
export declare function handleEditFile(args: Record<string, unknown>, cwd: string): ReturnType<typeof fsOk>;
|
|
14
|
-
export declare const editFileHandler: ToolHandler;
|
|
15
|
-
//# sourceMappingURL=edit-file.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"edit-file.d.ts","sourceRoot":"","sources":["../../../src/tools/fs/edit-file.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAW,IAAI,EAAE,MAAM,YAAY,CAAC;AAE3C;;;;;;;GAOG;AAEH,eAAO,MAAM,kBAAkB,EAAE,cAgBhC,CAAC;AAEF,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,GAAG,EAAE,MAAM,GACV,UAAU,CAAC,OAAO,IAAI,CAAC,CA0CzB;AAsBD,eAAO,MAAM,eAAe,EAAE,WAM7B,CAAC"}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { readFileSync, writeFileSync, unlinkSync, renameSync, existsSync } from 'node:fs';
|
|
2
|
-
import { resolvePath, assertExists, normalizePath } from './path-utils.js';
|
|
3
|
-
import { fsError, fsOk } from './types.js';
|
|
4
|
-
/**
|
|
5
|
-
* Инструмент редактирования файла (find & replace).
|
|
6
|
-
* Точное строковое совпадение (не regex).
|
|
7
|
-
* Ошибка если old_string не найден или найден несколько раз
|
|
8
|
-
* (если не указан replace_all).
|
|
9
|
-
*
|
|
10
|
-
* @module tools/fs/edit-file
|
|
11
|
-
*/
|
|
12
|
-
export const editFileDefinition = {
|
|
13
|
-
type: 'function',
|
|
14
|
-
function: {
|
|
15
|
-
name: 'edit_file',
|
|
16
|
-
description: 'Find and replace text in a file. Use exact string matching (not regex). Fails if old_string not found or found multiple times (unless replace_all=true).',
|
|
17
|
-
parameters: {
|
|
18
|
-
type: 'object',
|
|
19
|
-
properties: {
|
|
20
|
-
path: { type: 'string', description: 'File path (relative to project root)' },
|
|
21
|
-
old_string: { type: 'string', description: 'Exact text to find (must match exactly)' },
|
|
22
|
-
new_string: { type: 'string', description: 'Replacement text' },
|
|
23
|
-
replace_all: { type: 'boolean', description: 'Replace all occurrences (default: false)' },
|
|
24
|
-
},
|
|
25
|
-
required: ['path', 'old_string', 'new_string'],
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
export function handleEditFile(args, cwd) {
|
|
30
|
-
const path = String(args.path ?? '');
|
|
31
|
-
const oldString = String(args.old_string ?? '');
|
|
32
|
-
const newString = String(args.new_string ?? '');
|
|
33
|
-
const replaceAll = Boolean(args.replace_all);
|
|
34
|
-
if (!path)
|
|
35
|
-
return fsError('path is required. Usage: {"name":"edit_file","arguments":{"path":"file.ts","old_string":"old","new_string":"new"}}');
|
|
36
|
-
if (!oldString)
|
|
37
|
-
return fsError('old_string is required');
|
|
38
|
-
if (newString === '' && !args.hasOwnProperty('new_string'))
|
|
39
|
-
return fsError('new_string is required (use empty string "" to delete text)');
|
|
40
|
-
const resolved = resolvePath(path, cwd);
|
|
41
|
-
if (!resolved.ok)
|
|
42
|
-
return fsError(resolved.error);
|
|
43
|
-
const exists = assertExists(resolved.abs, 'file');
|
|
44
|
-
if (!exists.ok)
|
|
45
|
-
return fsError(exists.error);
|
|
46
|
-
let content;
|
|
47
|
-
try {
|
|
48
|
-
content = readFileSync(resolved.abs, 'utf-8');
|
|
49
|
-
}
|
|
50
|
-
catch (e) {
|
|
51
|
-
return fsError(`Cannot read file: ${e.message}`);
|
|
52
|
-
}
|
|
53
|
-
if (!content.includes(oldString)) {
|
|
54
|
-
const preview = oldString.length > 80 ? oldString.slice(0, 80) + '...' : oldString;
|
|
55
|
-
return fsError(`old_string not found in file. Text: "${preview}"`);
|
|
56
|
-
}
|
|
57
|
-
if (replaceAll) {
|
|
58
|
-
const count = content.split(oldString).length - 1;
|
|
59
|
-
content = content.split(oldString).join(newString);
|
|
60
|
-
return writeAndReport(resolved.abs, content, path, count, 'Replaced');
|
|
61
|
-
}
|
|
62
|
-
const idx = content.indexOf(oldString);
|
|
63
|
-
const afterFirst = content.indexOf(oldString, idx + oldString.length);
|
|
64
|
-
if (afterFirst !== -1) {
|
|
65
|
-
return fsError(`old_string found multiple times. Use replace_all: true to replace all, or provide a more specific old_string.`);
|
|
66
|
-
}
|
|
67
|
-
content = content.slice(0, idx) + newString + content.slice(idx + oldString.length);
|
|
68
|
-
return writeAndReport(resolved.abs, content, path, 1, 'Replaced');
|
|
69
|
-
}
|
|
70
|
-
function writeAndReport(absPath, content, relPath, count, verb) {
|
|
71
|
-
const tmpPath = absPath + '.mma.tmp';
|
|
72
|
-
try {
|
|
73
|
-
writeFileSync(tmpPath, content, 'utf-8');
|
|
74
|
-
if (existsSync(absPath))
|
|
75
|
-
unlinkSync(absPath);
|
|
76
|
-
renameSync(tmpPath, absPath);
|
|
77
|
-
}
|
|
78
|
-
catch (e) {
|
|
79
|
-
try {
|
|
80
|
-
if (existsSync(tmpPath))
|
|
81
|
-
unlinkSync(tmpPath);
|
|
82
|
-
}
|
|
83
|
-
catch { /* ignore */ }
|
|
84
|
-
return fsError(`Write failed: ${e.message}`);
|
|
85
|
-
}
|
|
86
|
-
return fsOk(`${verb} ${count} occurrence(s) in ${normalizePath(relPath)}`);
|
|
87
|
-
}
|
|
88
|
-
export const editFileHandler = {
|
|
89
|
-
name: 'edit_file',
|
|
90
|
-
definition: editFileDefinition,
|
|
91
|
-
async execute(args, ctx) {
|
|
92
|
-
return handleEditFile(args, ctx.cwd);
|
|
93
|
-
},
|
|
94
|
-
};
|
|
95
|
-
//# sourceMappingURL=edit-file.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"edit-file.js","sourceRoot":"","sources":["../../../src/tools/fs/edit-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAa,MAAM,SAAS,CAAC;AAIrG,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,aA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,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;AAC7E,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAAgB;IAC1C,IAAI,EAAE,WAAW;IACjB,UAAU,EAAE,kBAAkB;IAC9B,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG;QACrB,OAAO,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IACvC,CAAC;CACF,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ToolDefinition } from '../registry.js';
|
|
2
|
-
import type { ToolHandler } from '../types.js';
|
|
3
|
-
import { fsOk } from './types.js';
|
|
4
|
-
/**
|
|
5
|
-
* Инструмент получения метаданных файла/директории.
|
|
6
|
-
* Показывает размер, даты создания/изменения, права доступа.
|
|
7
|
-
*
|
|
8
|
-
* @module tools/fs/file-info
|
|
9
|
-
*/
|
|
10
|
-
export declare const fileInfoDefinition: ToolDefinition;
|
|
11
|
-
export declare function handleFileInfo(args: Record<string, unknown>, cwd: string): ReturnType<typeof fsOk>;
|
|
12
|
-
export declare const fileInfoHandler: ToolHandler;
|
|
13
|
-
//# sourceMappingURL=file-info.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-info.d.ts","sourceRoot":"","sources":["../../../src/tools/fs/file-info.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAW,IAAI,EAAE,MAAM,YAAY,CAAC;AAE3C;;;;;GAKG;AAEH,eAAO,MAAM,kBAAkB,EAAE,cAahC,CAAC;AAEF,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,GAAG,EAAE,MAAM,GACV,UAAU,CAAC,OAAO,IAAI,CAAC,CAoBzB;AAED,eAAO,MAAM,eAAe,EAAE,WAM7B,CAAC"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { resolvePath, assertExists, formatSize, normalizePath } from './path-utils.js';
|
|
2
|
-
import { fsError, fsOk } from './types.js';
|
|
3
|
-
/**
|
|
4
|
-
* Инструмент получения метаданных файла/директории.
|
|
5
|
-
* Показывает размер, даты создания/изменения, права доступа.
|
|
6
|
-
*
|
|
7
|
-
* @module tools/fs/file-info
|
|
8
|
-
*/
|
|
9
|
-
export const fileInfoDefinition = {
|
|
10
|
-
type: 'function',
|
|
11
|
-
function: {
|
|
12
|
-
name: 'file_info',
|
|
13
|
-
description: 'Get file/directory metadata: size, dates, permissions.',
|
|
14
|
-
parameters: {
|
|
15
|
-
type: 'object',
|
|
16
|
-
properties: {
|
|
17
|
-
path: { type: 'string', description: 'File or directory path' },
|
|
18
|
-
},
|
|
19
|
-
required: ['path'],
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
export function handleFileInfo(args, cwd) {
|
|
24
|
-
const path = String(args.path ?? '');
|
|
25
|
-
const resolved = resolvePath(path, cwd);
|
|
26
|
-
if (!resolved.ok)
|
|
27
|
-
return fsError(resolved.error);
|
|
28
|
-
const exists = assertExists(resolved.abs);
|
|
29
|
-
if (!exists.ok)
|
|
30
|
-
return fsError(exists.error);
|
|
31
|
-
const s = exists.stat;
|
|
32
|
-
const info = [
|
|
33
|
-
`Path: ${normalizePath(path)}`,
|
|
34
|
-
`Type: ${s.isDirectory() ? 'directory' : 'file'}`,
|
|
35
|
-
`Size: ${formatSize(Number(s.size))}`,
|
|
36
|
-
`Created: ${s.birthtime.toISOString()}`,
|
|
37
|
-
`Modified: ${s.mtime.toISOString()}`,
|
|
38
|
-
`Accessed: ${s.atime.toISOString()}`,
|
|
39
|
-
`Mode: ${s.mode.toString(8)}`,
|
|
40
|
-
];
|
|
41
|
-
return fsOk(info.join('\n'));
|
|
42
|
-
}
|
|
43
|
-
export const fileInfoHandler = {
|
|
44
|
-
name: 'file_info',
|
|
45
|
-
definition: fileInfoDefinition,
|
|
46
|
-
async execute(args, ctx) {
|
|
47
|
-
return handleFileInfo(args, ctx.cwd);
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
//# sourceMappingURL=file-info.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-info.js","sourceRoot":"","sources":["../../../src/tools/fs/file-info.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACvF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAE3C;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAmB;IAChD,IAAI,EAAE,UAAU;IAChB,QAAQ,EAAE;QACR,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,wDAAwD;QACrE,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,wBAAwB,EAAE;aAChE;YACD,QAAQ,EAAE,CAAC,MAAM,CAAC;SACnB;KACF;CACF,CAAC;AAEF,MAAM,UAAU,cAAc,CAC5B,IAA6B,EAC7B,GAAW;IAEX,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;IACrC,MAAM,QAAQ,GAAG,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACxC,IAAI,CAAC,QAAQ,CAAC,EAAE;QAAE,OAAO,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAEjD,MAAM,MAAM,GAAG,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC1C,IAAI,CAAC,MAAM,CAAC,EAAE;QAAE,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAE7C,MAAM,CAAC,GAAG,MAAM,CAAC,IAAK,CAAC;IACvB,MAAM,IAAI,GAAG;QACX,SAAS,aAAa,CAAC,IAAI,CAAC,EAAE;QAC9B,SAAS,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,EAAE;QACjD,SAAS,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE;QACrC,aAAa,CAAC,CAAC,SAAS,CAAC,WAAW,EAAE,EAAE;QACxC,aAAa,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE;QACpC,aAAa,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE;QACpC,SAAS,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE;KAC9B,CAAC;IAEF,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AAC/B,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAAgB;IAC1C,IAAI,EAAE,WAAW;IACjB,UAAU,EAAE,kBAAkB;IAC9B,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG;QACrB,OAAO,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IACvC,CAAC;CACF,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ToolDefinition } from '../registry.js';
|
|
2
|
-
import type { ToolHandler } from '../types.js';
|
|
3
|
-
import { fsOk } from './types.js';
|
|
4
|
-
/**
|
|
5
|
-
* Инструмент поиска файлов по glob-паттерну.
|
|
6
|
-
* Поддерживает * и ** wildcard'ы.
|
|
7
|
-
*
|
|
8
|
-
* @module tools/fs/glob-search
|
|
9
|
-
*/
|
|
10
|
-
export declare const globSearchDefinition: ToolDefinition;
|
|
11
|
-
export declare function handleGlobSearch(args: Record<string, unknown>, cwd: string): ReturnType<typeof fsOk>;
|
|
12
|
-
export declare const globSearchHandler: ToolHandler;
|
|
13
|
-
//# sourceMappingURL=glob-search.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"glob-search.d.ts","sourceRoot":"","sources":["../../../src/tools/fs/glob-search.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAW,IAAI,EAAoB,MAAM,YAAY,CAAC;AAE7D;;;;;GAKG;AAEH,eAAO,MAAM,oBAAoB,EAAE,cAclC,CAAC;AAwDF,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,GAAG,EAAE,MAAM,GACV,UAAU,CAAC,OAAO,IAAI,CAAC,CAyBzB;AAED,eAAO,MAAM,iBAAiB,EAAE,WAM/B,CAAC"}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { join } from 'node:path';
|
|
2
|
-
import { resolvePath, IGNORE_DIRS, normalizePath, readDirEntries } from './path-utils.js';
|
|
3
|
-
import { fsError, fsOk } from './types.js';
|
|
4
|
-
/**
|
|
5
|
-
* Инструмент поиска файлов по glob-паттерну.
|
|
6
|
-
* Поддерживает * и ** wildcard'ы.
|
|
7
|
-
*
|
|
8
|
-
* @module tools/fs/glob-search
|
|
9
|
-
*/
|
|
10
|
-
export const globSearchDefinition = {
|
|
11
|
-
type: 'function',
|
|
12
|
-
function: {
|
|
13
|
-
name: 'glob_search',
|
|
14
|
-
description: 'Find files matching a glob pattern. Supports * and ** wildcards.',
|
|
15
|
-
parameters: {
|
|
16
|
-
type: 'object',
|
|
17
|
-
properties: {
|
|
18
|
-
pattern: { type: 'string', description: 'Glob pattern (e.g. "**/*.ts", "src/**/*.test.ts")' },
|
|
19
|
-
path: { type: 'string', description: 'Search root directory (default: project root)' },
|
|
20
|
-
},
|
|
21
|
-
required: ['pattern'],
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
/** Конвертирует glob-паттерн в regex */
|
|
26
|
-
function globToRegex(pattern) {
|
|
27
|
-
let re = '^';
|
|
28
|
-
let i = 0;
|
|
29
|
-
while (i < pattern.length) {
|
|
30
|
-
const c = pattern[i];
|
|
31
|
-
if (c === '*' && i + 2 < pattern.length && pattern[i + 1] === '*' && pattern[i + 2] === '/') {
|
|
32
|
-
re += '(.+/)?';
|
|
33
|
-
i += 3;
|
|
34
|
-
}
|
|
35
|
-
else if (c === '*' && i + 1 < pattern.length && pattern[i + 1] === '*') {
|
|
36
|
-
re += '.*';
|
|
37
|
-
i += 2;
|
|
38
|
-
}
|
|
39
|
-
else if (c === '*') {
|
|
40
|
-
re += '[^/]*';
|
|
41
|
-
i++;
|
|
42
|
-
}
|
|
43
|
-
else if (c === '?') {
|
|
44
|
-
re += '[^/]';
|
|
45
|
-
i++;
|
|
46
|
-
}
|
|
47
|
-
else if (c === '.') {
|
|
48
|
-
re += '\\.';
|
|
49
|
-
i++;
|
|
50
|
-
}
|
|
51
|
-
else if (/[+^${}()|[\]\\]/.test(c)) {
|
|
52
|
-
re += '\\' + c;
|
|
53
|
-
i++;
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
re += c;
|
|
57
|
-
i++;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
return new RegExp(re + '$');
|
|
61
|
-
}
|
|
62
|
-
function walkGlob(dir, baseDir, regex, results, maxResults) {
|
|
63
|
-
if (results.length >= maxResults)
|
|
64
|
-
return;
|
|
65
|
-
const entries = readDirEntries(dir);
|
|
66
|
-
for (const entry of entries) {
|
|
67
|
-
if (results.length >= maxResults)
|
|
68
|
-
break;
|
|
69
|
-
const name = String(entry.name);
|
|
70
|
-
if (IGNORE_DIRS.has(name) || name.startsWith('.'))
|
|
71
|
-
continue;
|
|
72
|
-
const fullPath = join(dir, name);
|
|
73
|
-
const rel = normalizePath(fullPath.slice(baseDir.length + 1));
|
|
74
|
-
if (entry.isDirectory()) {
|
|
75
|
-
walkGlob(fullPath, baseDir, regex, results, maxResults);
|
|
76
|
-
}
|
|
77
|
-
else if (entry.isFile()) {
|
|
78
|
-
if (regex.test(rel) || regex.test(name)) {
|
|
79
|
-
results.push(rel);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
export function handleGlobSearch(args, cwd) {
|
|
85
|
-
const pattern = String(args.pattern ?? '');
|
|
86
|
-
const searchPath = String(args.path ?? '.');
|
|
87
|
-
if (!pattern)
|
|
88
|
-
return fsError('Pattern is required');
|
|
89
|
-
const resolved = resolvePath(searchPath, cwd);
|
|
90
|
-
if (!resolved.ok)
|
|
91
|
-
return fsError(resolved.error);
|
|
92
|
-
const regex = globToRegex(pattern);
|
|
93
|
-
const results = [];
|
|
94
|
-
const maxResults = 200;
|
|
95
|
-
walkGlob(resolved.abs, resolved.abs, regex, results, maxResults);
|
|
96
|
-
results.sort();
|
|
97
|
-
if (results.length === 0) {
|
|
98
|
-
return fsOk(`No files match pattern: ${pattern}`);
|
|
99
|
-
}
|
|
100
|
-
const truncated = results.length >= maxResults;
|
|
101
|
-
const output = results.join('\n');
|
|
102
|
-
const suffix = truncated ? `\n... (showing first ${maxResults} matches)` : '';
|
|
103
|
-
return fsOk(`${results.length} match(es) for "${pattern}":\n${output}${suffix}`, truncated);
|
|
104
|
-
}
|
|
105
|
-
export const globSearchHandler = {
|
|
106
|
-
name: 'glob_search',
|
|
107
|
-
definition: globSearchDefinition,
|
|
108
|
-
async execute(args, ctx) {
|
|
109
|
-
return handleGlobSearch(args, ctx.cwd);
|
|
110
|
-
},
|
|
111
|
-
};
|
|
112
|
-
//# sourceMappingURL=glob-search.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"glob-search.js","sourceRoot":"","sources":["../../../src/tools/fs/glob-search.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE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AI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC,2BAA2B,OAAO,EAAE,CAAC,CAAC;IACpD,CAAC;IAED,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,IAAI,UAAU,CAAC;IAC/C,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClC,MAAM,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,wBAAwB,UAAU,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;IAE9E,OAAO,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,mBAAmB,OAAO,OAAO,MAAM,GAAG,MAAM,EAAE,EAAE,SAAS,CAAC,CAAC;AAC9F,CAAC;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAgB;IAC5C,IAAI,EAAE,aAAa;IACnB,UAAU,EAAE,oBAAoB;IAChC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG;QACrB,OAAO,gBAAgB,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IACzC,CAAC;CACF,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { ToolDefinition } from '../registry.js';
|
|
2
|
-
import type { ToolHandler } from '../types.js';
|
|
3
|
-
import { fsOk } from './types.js';
|
|
4
|
-
/**
|
|
5
|
-
* Инструмент поиска по содержимому файлов (grep).
|
|
6
|
-
* Возвращает совпадающие строки с указанием файла и номера строки.
|
|
7
|
-
* Поддерживает regex-паттерны и фильтрацию по расширению.
|
|
8
|
-
*
|
|
9
|
-
* @module tools/fs/grep-search
|
|
10
|
-
*/
|
|
11
|
-
export declare const grepSearchDefinition: ToolDefinition;
|
|
12
|
-
export declare function handleGrepSearch(args: Record<string, unknown>, cwd: string): ReturnType<typeof fsOk>;
|
|
13
|
-
export declare const grepSearchHandler: ToolHandler;
|
|
14
|
-
//# sourceMappingURL=grep-search.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"grep-search.d.ts","sourceRoot":"","sources":["../../../src/tools/fs/grep-search.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAW,IAAI,EAAoB,MAAM,YAAY,CAAC;AAE7D;;;;;;GAMG;AAEH,eAAO,MAAM,oBAAoB,EAAE,cAgBlC,CAAC;AAkEF,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,GAAG,EAAE,MAAM,GACV,UAAU,CAAC,OAAO,IAAI,CAAC,CA+BzB;AAED,eAAO,MAAM,iBAAiB,EAAE,WAM/B,CAAC"}
|