codemate-ai 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/LICENSE +21 -0
- package/README.md +314 -0
- package/dist/src/agents/base/Agent.d.ts +13 -0
- package/dist/src/agents/base/Agent.d.ts.map +1 -0
- package/dist/src/agents/base/Agent.js +10 -0
- package/dist/src/agents/base/Agent.js.map +1 -0
- package/dist/src/agents/builtin/ExploreAgent.d.ts +13 -0
- package/dist/src/agents/builtin/ExploreAgent.d.ts.map +1 -0
- package/dist/src/agents/builtin/ExploreAgent.js +71 -0
- package/dist/src/agents/builtin/ExploreAgent.js.map +1 -0
- package/dist/src/agents/builtin/GeneralAgent.d.ts +13 -0
- package/dist/src/agents/builtin/GeneralAgent.d.ts.map +1 -0
- package/dist/src/agents/builtin/GeneralAgent.js +80 -0
- package/dist/src/agents/builtin/GeneralAgent.js.map +1 -0
- package/dist/src/agents/builtin/PlanAgent.d.ts +15 -0
- package/dist/src/agents/builtin/PlanAgent.d.ts.map +1 -0
- package/dist/src/agents/builtin/PlanAgent.js +85 -0
- package/dist/src/agents/builtin/PlanAgent.js.map +1 -0
- package/dist/src/application/Application.d.ts +28 -0
- package/dist/src/application/Application.d.ts.map +1 -0
- package/dist/src/application/Application.js +209 -0
- package/dist/src/application/Application.js.map +1 -0
- package/dist/src/application/Container.d.ts +14 -0
- package/dist/src/application/Container.d.ts.map +1 -0
- package/dist/src/application/Container.js +47 -0
- package/dist/src/application/Container.js.map +1 -0
- package/dist/src/cli.d.ts +3 -0
- package/dist/src/cli.d.ts.map +1 -0
- package/dist/src/cli.js +54 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/code/CodeEditor.d.ts +9 -0
- package/dist/src/code/CodeEditor.d.ts.map +1 -0
- package/dist/src/code/CodeEditor.js +61 -0
- package/dist/src/code/CodeEditor.js.map +1 -0
- package/dist/src/code/CodeLocator.d.ts +8 -0
- package/dist/src/code/CodeLocator.d.ts.map +1 -0
- package/dist/src/code/CodeLocator.js +111 -0
- package/dist/src/code/CodeLocator.js.map +1 -0
- package/dist/src/code/CodeParser.d.ts +6 -0
- package/dist/src/code/CodeParser.d.ts.map +1 -0
- package/dist/src/code/CodeParser.js +32 -0
- package/dist/src/code/CodeParser.js.map +1 -0
- package/dist/src/code/types.d.ts +21 -0
- package/dist/src/code/types.d.ts.map +1 -0
- package/dist/src/code/types.js +2 -0
- package/dist/src/code/types.js.map +1 -0
- package/dist/src/commands/base/SlashCommand.d.ts +14 -0
- package/dist/src/commands/base/SlashCommand.d.ts.map +1 -0
- package/dist/src/commands/base/SlashCommand.js +14 -0
- package/dist/src/commands/base/SlashCommand.js.map +1 -0
- package/dist/src/commands/model/ModelCommand.d.ts +10 -0
- package/dist/src/commands/model/ModelCommand.d.ts.map +1 -0
- package/dist/src/commands/model/ModelCommand.js +20 -0
- package/dist/src/commands/model/ModelCommand.js.map +1 -0
- package/dist/src/commands/performance/PerformanceCommand.d.ts +12 -0
- package/dist/src/commands/performance/PerformanceCommand.d.ts.map +1 -0
- package/dist/src/commands/performance/PerformanceCommand.js +22 -0
- package/dist/src/commands/performance/PerformanceCommand.js.map +1 -0
- package/dist/src/commands/session/ClearCommand.d.ts +9 -0
- package/dist/src/commands/session/ClearCommand.d.ts.map +1 -0
- package/dist/src/commands/session/ClearCommand.js +19 -0
- package/dist/src/commands/session/ClearCommand.js.map +1 -0
- package/dist/src/commands/session/ExitCommand.d.ts +9 -0
- package/dist/src/commands/session/ExitCommand.d.ts.map +1 -0
- package/dist/src/commands/session/ExitCommand.js +12 -0
- package/dist/src/commands/session/ExitCommand.js.map +1 -0
- package/dist/src/commands/session/HelpCommand.d.ts +9 -0
- package/dist/src/commands/session/HelpCommand.d.ts.map +1 -0
- package/dist/src/commands/session/HelpCommand.js +44 -0
- package/dist/src/commands/session/HelpCommand.js.map +1 -0
- package/dist/src/commands/session/SessionsCommand.d.ts +9 -0
- package/dist/src/commands/session/SessionsCommand.d.ts.map +1 -0
- package/dist/src/commands/session/SessionsCommand.js +26 -0
- package/dist/src/commands/session/SessionsCommand.js.map +1 -0
- package/dist/src/commands/snapshot/RewindCommand.d.ts +9 -0
- package/dist/src/commands/snapshot/RewindCommand.d.ts.map +1 -0
- package/dist/src/commands/snapshot/RewindCommand.js +43 -0
- package/dist/src/commands/snapshot/RewindCommand.js.map +1 -0
- package/dist/src/commands/snapshot/SnapshotsCommand.d.ts +9 -0
- package/dist/src/commands/snapshot/SnapshotsCommand.d.ts.map +1 -0
- package/dist/src/commands/snapshot/SnapshotsCommand.js +25 -0
- package/dist/src/commands/snapshot/SnapshotsCommand.js.map +1 -0
- package/dist/src/commands/spec/SpecCreateCommand.d.ts +9 -0
- package/dist/src/commands/spec/SpecCreateCommand.d.ts.map +1 -0
- package/dist/src/commands/spec/SpecCreateCommand.js +22 -0
- package/dist/src/commands/spec/SpecCreateCommand.js.map +1 -0
- package/dist/src/commands/spec/SpecListCommand.d.ts +9 -0
- package/dist/src/commands/spec/SpecListCommand.d.ts.map +1 -0
- package/dist/src/commands/spec/SpecListCommand.js +15 -0
- package/dist/src/commands/spec/SpecListCommand.js.map +1 -0
- package/dist/src/commands/spec/SpecShowCommand.d.ts +9 -0
- package/dist/src/commands/spec/SpecShowCommand.d.ts.map +1 -0
- package/dist/src/commands/spec/SpecShowCommand.js +21 -0
- package/dist/src/commands/spec/SpecShowCommand.js.map +1 -0
- package/dist/src/managers/AgentManager.d.ts +19 -0
- package/dist/src/managers/AgentManager.d.ts.map +1 -0
- package/dist/src/managers/AgentManager.js +47 -0
- package/dist/src/managers/AgentManager.js.map +1 -0
- package/dist/src/managers/PluginManager.d.ts +23 -0
- package/dist/src/managers/PluginManager.d.ts.map +1 -0
- package/dist/src/managers/PluginManager.js +80 -0
- package/dist/src/managers/PluginManager.js.map +1 -0
- package/dist/src/managers/SlashCommandManager.d.ts +19 -0
- package/dist/src/managers/SlashCommandManager.d.ts.map +1 -0
- package/dist/src/managers/SlashCommandManager.js +80 -0
- package/dist/src/managers/SlashCommandManager.js.map +1 -0
- package/dist/src/managers/SpecManager.d.ts +26 -0
- package/dist/src/managers/SpecManager.d.ts.map +1 -0
- package/dist/src/managers/SpecManager.js +134 -0
- package/dist/src/managers/SpecManager.js.map +1 -0
- package/dist/src/managers/ToolManager.d.ts +24 -0
- package/dist/src/managers/ToolManager.d.ts.map +1 -0
- package/dist/src/managers/ToolManager.js +97 -0
- package/dist/src/managers/ToolManager.js.map +1 -0
- package/dist/src/mcp/MCPClient.d.ts +17 -0
- package/dist/src/mcp/MCPClient.d.ts.map +1 -0
- package/dist/src/mcp/MCPClient.js +117 -0
- package/dist/src/mcp/MCPClient.js.map +1 -0
- package/dist/src/mcp/MCPManager.d.ts +12 -0
- package/dist/src/mcp/MCPManager.d.ts.map +1 -0
- package/dist/src/mcp/MCPManager.js +63 -0
- package/dist/src/mcp/MCPManager.js.map +1 -0
- package/dist/src/mcp/MCPTool.d.ts +15 -0
- package/dist/src/mcp/MCPTool.d.ts.map +1 -0
- package/dist/src/mcp/MCPTool.js +73 -0
- package/dist/src/mcp/MCPTool.js.map +1 -0
- package/dist/src/mcp/types.d.ts +42 -0
- package/dist/src/mcp/types.d.ts.map +1 -0
- package/dist/src/mcp/types.js +2 -0
- package/dist/src/mcp/types.js.map +1 -0
- package/dist/src/optimization/CompactionService.d.ts +10 -0
- package/dist/src/optimization/CompactionService.d.ts.map +1 -0
- package/dist/src/optimization/CompactionService.js +82 -0
- package/dist/src/optimization/CompactionService.js.map +1 -0
- package/dist/src/optimization/CompressionService.d.ts +18 -0
- package/dist/src/optimization/CompressionService.d.ts.map +1 -0
- package/dist/src/optimization/CompressionService.js +95 -0
- package/dist/src/optimization/CompressionService.js.map +1 -0
- package/dist/src/optimization/PerformanceMonitor.d.ts +22 -0
- package/dist/src/optimization/PerformanceMonitor.d.ts.map +1 -0
- package/dist/src/optimization/PerformanceMonitor.js +90 -0
- package/dist/src/optimization/PerformanceMonitor.js.map +1 -0
- package/dist/src/optimization/PruningService.d.ts +5 -0
- package/dist/src/optimization/PruningService.d.ts.map +1 -0
- package/dist/src/optimization/PruningService.js +59 -0
- package/dist/src/optimization/PruningService.js.map +1 -0
- package/dist/src/optimization/types.d.ts +49 -0
- package/dist/src/optimization/types.d.ts.map +1 -0
- package/dist/src/optimization/types.js +2 -0
- package/dist/src/optimization/types.js.map +1 -0
- package/dist/src/plugins/base/Plugin.d.ts +17 -0
- package/dist/src/plugins/base/Plugin.d.ts.map +1 -0
- package/dist/src/plugins/base/Plugin.js +19 -0
- package/dist/src/plugins/base/Plugin.js.map +1 -0
- package/dist/src/plugins/builtin/LoggerPlugin.d.ts +13 -0
- package/dist/src/plugins/builtin/LoggerPlugin.d.ts.map +1 -0
- package/dist/src/plugins/builtin/LoggerPlugin.js +19 -0
- package/dist/src/plugins/builtin/LoggerPlugin.js.map +1 -0
- package/dist/src/plugins/builtin/PerformancePlugin.d.ts +16 -0
- package/dist/src/plugins/builtin/PerformancePlugin.d.ts.map +1 -0
- package/dist/src/plugins/builtin/PerformancePlugin.js +50 -0
- package/dist/src/plugins/builtin/PerformancePlugin.js.map +1 -0
- package/dist/src/plugins/builtin/SecurityPlugin.d.ts +18 -0
- package/dist/src/plugins/builtin/SecurityPlugin.d.ts.map +1 -0
- package/dist/src/plugins/builtin/SecurityPlugin.js +42 -0
- package/dist/src/plugins/builtin/SecurityPlugin.js.map +1 -0
- package/dist/src/server/HTTPServer.d.ts +25 -0
- package/dist/src/server/HTTPServer.d.ts.map +1 -0
- package/dist/src/server/HTTPServer.js +231 -0
- package/dist/src/server/HTTPServer.js.map +1 -0
- package/dist/src/server/WebSocketServer.d.ts +16 -0
- package/dist/src/server/WebSocketServer.d.ts.map +1 -0
- package/dist/src/server/WebSocketServer.js +118 -0
- package/dist/src/server/WebSocketServer.js.map +1 -0
- package/dist/src/services/ConfigService.d.ts +23 -0
- package/dist/src/services/ConfigService.d.ts.map +1 -0
- package/dist/src/services/ConfigService.js +169 -0
- package/dist/src/services/ConfigService.js.map +1 -0
- package/dist/src/services/EventBus.d.ts +12 -0
- package/dist/src/services/EventBus.d.ts.map +1 -0
- package/dist/src/services/EventBus.js +63 -0
- package/dist/src/services/EventBus.js.map +1 -0
- package/dist/src/services/ModelService.d.ts +24 -0
- package/dist/src/services/ModelService.d.ts.map +1 -0
- package/dist/src/services/ModelService.js +188 -0
- package/dist/src/services/ModelService.js.map +1 -0
- package/dist/src/services/Paths.d.ts +17 -0
- package/dist/src/services/Paths.d.ts.map +1 -0
- package/dist/src/services/Paths.js +125 -0
- package/dist/src/services/Paths.js.map +1 -0
- package/dist/src/services/SessionService.d.ts +19 -0
- package/dist/src/services/SessionService.d.ts.map +1 -0
- package/dist/src/services/SessionService.js +137 -0
- package/dist/src/services/SessionService.js.map +1 -0
- package/dist/src/snapshot/FileHistory.d.ts +18 -0
- package/dist/src/snapshot/FileHistory.d.ts.map +1 -0
- package/dist/src/snapshot/FileHistory.js +118 -0
- package/dist/src/snapshot/FileHistory.js.map +1 -0
- package/dist/src/snapshot/types.d.ts +19 -0
- package/dist/src/snapshot/types.d.ts.map +1 -0
- package/dist/src/snapshot/types.js +2 -0
- package/dist/src/snapshot/types.js.map +1 -0
- package/dist/src/specs/types.d.ts +54 -0
- package/dist/src/specs/types.d.ts.map +1 -0
- package/dist/src/specs/types.js +8 -0
- package/dist/src/specs/types.js.map +1 -0
- package/dist/src/specs/utils/generator.d.ts +4 -0
- package/dist/src/specs/utils/generator.d.ts.map +1 -0
- package/dist/src/specs/utils/generator.js +106 -0
- package/dist/src/specs/utils/generator.js.map +1 -0
- package/dist/src/specs/utils/parser.d.ts +3 -0
- package/dist/src/specs/utils/parser.d.ts.map +1 -0
- package/dist/src/specs/utils/parser.js +152 -0
- package/dist/src/specs/utils/parser.js.map +1 -0
- package/dist/src/styles/base/OutputStyle.d.ts +15 -0
- package/dist/src/styles/base/OutputStyle.d.ts.map +1 -0
- package/dist/src/styles/base/OutputStyle.js +16 -0
- package/dist/src/styles/base/OutputStyle.js.map +1 -0
- package/dist/src/styles/builtin/index.d.ts +8 -0
- package/dist/src/styles/builtin/index.d.ts.map +1 -0
- package/dist/src/styles/builtin/index.js +61 -0
- package/dist/src/styles/builtin/index.js.map +1 -0
- package/dist/src/styles/managers/OutputStyleManager.d.ts +20 -0
- package/dist/src/styles/managers/OutputStyleManager.d.ts.map +1 -0
- package/dist/src/styles/managers/OutputStyleManager.js +110 -0
- package/dist/src/styles/managers/OutputStyleManager.js.map +1 -0
- package/dist/src/styles/utils/markdown.d.ts +18 -0
- package/dist/src/styles/utils/markdown.d.ts.map +1 -0
- package/dist/src/styles/utils/markdown.js +107 -0
- package/dist/src/styles/utils/markdown.js.map +1 -0
- package/dist/src/tools/base/Tool.d.ts +17 -0
- package/dist/src/tools/base/Tool.d.ts.map +1 -0
- package/dist/src/tools/base/Tool.js +31 -0
- package/dist/src/tools/base/Tool.js.map +1 -0
- package/dist/src/tools/code/EditCodeTool.d.ts +50 -0
- package/dist/src/tools/code/EditCodeTool.d.ts.map +1 -0
- package/dist/src/tools/code/EditCodeTool.js +38 -0
- package/dist/src/tools/code/EditCodeTool.js.map +1 -0
- package/dist/src/tools/file/DeleteFileTool.d.ts +18 -0
- package/dist/src/tools/file/DeleteFileTool.d.ts.map +1 -0
- package/dist/src/tools/file/DeleteFileTool.js +45 -0
- package/dist/src/tools/file/DeleteFileTool.js.map +1 -0
- package/dist/src/tools/file/EditFileTool.d.ts +24 -0
- package/dist/src/tools/file/EditFileTool.d.ts.map +1 -0
- package/dist/src/tools/file/EditFileTool.js +53 -0
- package/dist/src/tools/file/EditFileTool.js.map +1 -0
- package/dist/src/tools/file/ListFilesTool.d.ts +29 -0
- package/dist/src/tools/file/ListFilesTool.d.ts.map +1 -0
- package/dist/src/tools/file/ListFilesTool.js +34 -0
- package/dist/src/tools/file/ListFilesTool.js.map +1 -0
- package/dist/src/tools/file/ReadFileTool.d.ts +25 -0
- package/dist/src/tools/file/ReadFileTool.d.ts.map +1 -0
- package/dist/src/tools/file/ReadFileTool.js +38 -0
- package/dist/src/tools/file/ReadFileTool.js.map +1 -0
- package/dist/src/tools/file/WriteFileTool.d.ts +30 -0
- package/dist/src/tools/file/WriteFileTool.d.ts.map +1 -0
- package/dist/src/tools/file/WriteFileTool.js +39 -0
- package/dist/src/tools/file/WriteFileTool.js.map +1 -0
- package/dist/src/tools/interactive/AskUserTool.d.ts +18 -0
- package/dist/src/tools/interactive/AskUserTool.d.ts.map +1 -0
- package/dist/src/tools/interactive/AskUserTool.js +43 -0
- package/dist/src/tools/interactive/AskUserTool.js.map +1 -0
- package/dist/src/tools/interactive/ConfirmTool.d.ts +18 -0
- package/dist/src/tools/interactive/ConfirmTool.d.ts.map +1 -0
- package/dist/src/tools/interactive/ConfirmTool.js +53 -0
- package/dist/src/tools/interactive/ConfirmTool.js.map +1 -0
- package/dist/src/tools/network/FetchTool.d.ts +24 -0
- package/dist/src/tools/network/FetchTool.d.ts.map +1 -0
- package/dist/src/tools/network/FetchTool.js +56 -0
- package/dist/src/tools/network/FetchTool.js.map +1 -0
- package/dist/src/tools/network/WebSearchTool.d.ts +20 -0
- package/dist/src/tools/network/WebSearchTool.d.ts.map +1 -0
- package/dist/src/tools/network/WebSearchTool.js +69 -0
- package/dist/src/tools/network/WebSearchTool.js.map +1 -0
- package/dist/src/tools/search/GlobTool.d.ts +20 -0
- package/dist/src/tools/search/GlobTool.d.ts.map +1 -0
- package/dist/src/tools/search/GlobTool.js +62 -0
- package/dist/src/tools/search/GlobTool.js.map +1 -0
- package/dist/src/tools/search/GrepTool.d.ts +26 -0
- package/dist/src/tools/search/GrepTool.d.ts.map +1 -0
- package/dist/src/tools/search/GrepTool.js +97 -0
- package/dist/src/tools/search/GrepTool.js.map +1 -0
- package/dist/src/tools/spec/SpecReadTool.d.ts +16 -0
- package/dist/src/tools/spec/SpecReadTool.d.ts.map +1 -0
- package/dist/src/tools/spec/SpecReadTool.js +79 -0
- package/dist/src/tools/spec/SpecReadTool.js.map +1 -0
- package/dist/src/tools/spec/SpecUpdateTaskTool.d.ts +23 -0
- package/dist/src/tools/spec/SpecUpdateTaskTool.d.ts.map +1 -0
- package/dist/src/tools/spec/SpecUpdateTaskTool.js +42 -0
- package/dist/src/tools/spec/SpecUpdateTaskTool.js.map +1 -0
- package/dist/src/tools/special/ExitPlanTool.d.ts +15 -0
- package/dist/src/tools/special/ExitPlanTool.d.ts.map +1 -0
- package/dist/src/tools/special/ExitPlanTool.js +32 -0
- package/dist/src/tools/special/ExitPlanTool.js.map +1 -0
- package/dist/src/tools/special/SkillTool.d.ts +19 -0
- package/dist/src/tools/special/SkillTool.d.ts.map +1 -0
- package/dist/src/tools/special/SkillTool.js +45 -0
- package/dist/src/tools/special/SkillTool.js.map +1 -0
- package/dist/src/tools/system/BashTool.d.ts +18 -0
- package/dist/src/tools/system/BashTool.d.ts.map +1 -0
- package/dist/src/tools/system/BashTool.js +29 -0
- package/dist/src/tools/system/BashTool.js.map +1 -0
- package/dist/src/tools/system/EnvTool.d.ts +15 -0
- package/dist/src/tools/system/EnvTool.d.ts.map +1 -0
- package/dist/src/tools/system/EnvTool.js +47 -0
- package/dist/src/tools/system/EnvTool.js.map +1 -0
- package/dist/src/tools/system/ExecTool.d.ts +21 -0
- package/dist/src/tools/system/ExecTool.d.ts.map +1 -0
- package/dist/src/tools/system/ExecTool.js +41 -0
- package/dist/src/tools/system/ExecTool.js.map +1 -0
- package/dist/src/tools/task/TaskTool.d.ts +34 -0
- package/dist/src/tools/task/TaskTool.d.ts.map +1 -0
- package/dist/src/tools/task/TaskTool.js +105 -0
- package/dist/src/tools/task/TaskTool.js.map +1 -0
- package/dist/src/tools/task/TodoReadTool.d.ts +16 -0
- package/dist/src/tools/task/TodoReadTool.d.ts.map +1 -0
- package/dist/src/tools/task/TodoReadTool.js +43 -0
- package/dist/src/tools/task/TodoReadTool.js.map +1 -0
- package/dist/src/tools/task/TodoWriteTool.d.ts +25 -0
- package/dist/src/tools/task/TodoWriteTool.d.ts.map +1 -0
- package/dist/src/tools/task/TodoWriteTool.js +82 -0
- package/dist/src/tools/task/TodoWriteTool.js.map +1 -0
- package/dist/src/types/index.d.ts +175 -0
- package/dist/src/types/index.d.ts.map +1 -0
- package/dist/src/types/index.js +31 -0
- package/dist/src/types/index.js.map +1 -0
- package/dist/src/ui/App.d.ts +8 -0
- package/dist/src/ui/App.d.ts.map +1 -0
- package/dist/src/ui/App.js +100 -0
- package/dist/src/ui/App.js.map +1 -0
- package/dist/src/ui/components/MessageList.d.ts +8 -0
- package/dist/src/ui/components/MessageList.d.ts.map +1 -0
- package/dist/src/ui/components/MessageList.js +13 -0
- package/dist/src/ui/components/MessageList.js.map +1 -0
- package/dist/src/ui/components/SessionList.d.ts +10 -0
- package/dist/src/ui/components/SessionList.d.ts.map +1 -0
- package/dist/src/ui/components/SessionList.js +23 -0
- package/dist/src/ui/components/SessionList.js.map +1 -0
- package/dist/src/ui/context/AppContext.d.ts +18 -0
- package/dist/src/ui/context/AppContext.d.ts.map +1 -0
- package/dist/src/ui/context/AppContext.js +22 -0
- package/dist/src/ui/context/AppContext.js.map +1 -0
- package/dist/src/ui/hooks/useSession.d.ts +6 -0
- package/dist/src/ui/hooks/useSession.d.ts.map +1 -0
- package/dist/src/ui/hooks/useSession.js +59 -0
- package/dist/src/ui/hooks/useSession.js.map +1 -0
- package/dist/src/utils/calculator.d.ts +3 -0
- package/dist/src/utils/calculator.d.ts.map +1 -0
- package/dist/src/utils/calculator.js +13 -0
- package/dist/src/utils/calculator.js.map +1 -0
- package/dist/src/utils/firstRun.d.ts +4 -0
- package/dist/src/utils/firstRun.d.ts.map +1 -0
- package/dist/src/utils/firstRun.js +32 -0
- package/dist/src/utils/firstRun.js.map +1 -0
- package/dist/src/utils/math.d.ts +2 -0
- package/dist/src/utils/math.d.ts.map +1 -0
- package/dist/src/utils/math.js +4 -0
- package/dist/src/utils/math.js.map +1 -0
- package/dist/src/utils/setup.d.ts +2 -0
- package/dist/src/utils/setup.d.ts.map +1 -0
- package/dist/src/utils/setup.js +87 -0
- package/dist/src/utils/setup.js.map +1 -0
- package/dist/src/utils/tokenCounter.d.ts +4 -0
- package/dist/src/utils/tokenCounter.d.ts.map +1 -0
- package/dist/src/utils/tokenCounter.js +27 -0
- package/dist/src/utils/tokenCounter.js.map +1 -0
- package/dist/tests/integration/agents.test.d.ts +2 -0
- package/dist/tests/integration/agents.test.d.ts.map +1 -0
- package/dist/tests/integration/agents.test.js +34 -0
- package/dist/tests/integration/agents.test.js.map +1 -0
- package/dist/tests/integration/cli.test.d.ts +2 -0
- package/dist/tests/integration/cli.test.d.ts.map +1 -0
- package/dist/tests/integration/cli.test.js +70 -0
- package/dist/tests/integration/cli.test.js.map +1 -0
- package/dist/tests/integration/commands.test.d.ts +2 -0
- package/dist/tests/integration/commands.test.d.ts.map +1 -0
- package/dist/tests/integration/commands.test.js +35 -0
- package/dist/tests/integration/commands.test.js.map +1 -0
- package/dist/tests/integration/mcp.test.d.ts +2 -0
- package/dist/tests/integration/mcp.test.d.ts.map +1 -0
- package/dist/tests/integration/mcp.test.js +44 -0
- package/dist/tests/integration/mcp.test.js.map +1 -0
- package/dist/tests/integration/output-styles.test.d.ts +2 -0
- package/dist/tests/integration/output-styles.test.d.ts.map +1 -0
- package/dist/tests/integration/output-styles.test.js +88 -0
- package/dist/tests/integration/output-styles.test.js.map +1 -0
- package/dist/tests/integration/plugins.test.d.ts +2 -0
- package/dist/tests/integration/plugins.test.d.ts.map +1 -0
- package/dist/tests/integration/plugins.test.js +42 -0
- package/dist/tests/integration/plugins.test.js.map +1 -0
- package/dist/tests/integration/specs.test.d.ts +2 -0
- package/dist/tests/integration/specs.test.d.ts.map +1 -0
- package/dist/tests/integration/specs.test.js +102 -0
- package/dist/tests/integration/specs.test.js.map +1 -0
- package/dist/tests/integration/ui.test.d.ts +2 -0
- package/dist/tests/integration/ui.test.d.ts.map +1 -0
- package/dist/tests/integration/ui.test.js +71 -0
- package/dist/tests/integration/ui.test.js.map +1 -0
- package/dist/tests/mocks/mock-mcp-server.d.ts +3 -0
- package/dist/tests/mocks/mock-mcp-server.d.ts.map +1 -0
- package/dist/tests/mocks/mock-mcp-server.js +127 -0
- package/dist/tests/mocks/mock-mcp-server.js.map +1 -0
- package/dist/tests/unit/application/Application.test.d.ts +2 -0
- package/dist/tests/unit/application/Application.test.d.ts.map +1 -0
- package/dist/tests/unit/application/Application.test.js +21 -0
- package/dist/tests/unit/application/Application.test.js.map +1 -0
- package/dist/tests/unit/application/Container.test.d.ts +2 -0
- package/dist/tests/unit/application/Container.test.d.ts.map +1 -0
- package/dist/tests/unit/application/Container.test.js +38 -0
- package/dist/tests/unit/application/Container.test.js.map +1 -0
- package/dist/tests/unit/code/CodeEditor.test.d.ts +2 -0
- package/dist/tests/unit/code/CodeEditor.test.d.ts.map +1 -0
- package/dist/tests/unit/code/CodeEditor.test.js +56 -0
- package/dist/tests/unit/code/CodeEditor.test.js.map +1 -0
- package/dist/tests/unit/code/CodeLocator.test.d.ts +2 -0
- package/dist/tests/unit/code/CodeLocator.test.d.ts.map +1 -0
- package/dist/tests/unit/code/CodeLocator.test.js +50 -0
- package/dist/tests/unit/code/CodeLocator.test.js.map +1 -0
- package/dist/tests/unit/code/CodeParser.test.d.ts +2 -0
- package/dist/tests/unit/code/CodeParser.test.d.ts.map +1 -0
- package/dist/tests/unit/code/CodeParser.test.js +27 -0
- package/dist/tests/unit/code/CodeParser.test.js.map +1 -0
- package/dist/tests/unit/managers/AgentManager.test.d.ts +2 -0
- package/dist/tests/unit/managers/AgentManager.test.d.ts.map +1 -0
- package/dist/tests/unit/managers/AgentManager.test.js +68 -0
- package/dist/tests/unit/managers/AgentManager.test.js.map +1 -0
- package/dist/tests/unit/managers/PluginManager.test.d.ts +2 -0
- package/dist/tests/unit/managers/PluginManager.test.d.ts.map +1 -0
- package/dist/tests/unit/managers/PluginManager.test.js +76 -0
- package/dist/tests/unit/managers/PluginManager.test.js.map +1 -0
- package/dist/tests/unit/managers/SlashCommandManager.test.d.ts +2 -0
- package/dist/tests/unit/managers/SlashCommandManager.test.d.ts.map +1 -0
- package/dist/tests/unit/managers/SlashCommandManager.test.js +47 -0
- package/dist/tests/unit/managers/SlashCommandManager.test.js.map +1 -0
- package/dist/tests/unit/managers/SpecManager.test.d.ts +2 -0
- package/dist/tests/unit/managers/SpecManager.test.d.ts.map +1 -0
- package/dist/tests/unit/managers/SpecManager.test.js +97 -0
- package/dist/tests/unit/managers/SpecManager.test.js.map +1 -0
- package/dist/tests/unit/managers/ToolManager.test.d.ts +2 -0
- package/dist/tests/unit/managers/ToolManager.test.d.ts.map +1 -0
- package/dist/tests/unit/managers/ToolManager.test.js +69 -0
- package/dist/tests/unit/managers/ToolManager.test.js.map +1 -0
- package/dist/tests/unit/mcp/MCPClient.test.d.ts +2 -0
- package/dist/tests/unit/mcp/MCPClient.test.d.ts.map +1 -0
- package/dist/tests/unit/mcp/MCPClient.test.js +40 -0
- package/dist/tests/unit/mcp/MCPClient.test.js.map +1 -0
- package/dist/tests/unit/services/ConfigService.test.d.ts +2 -0
- package/dist/tests/unit/services/ConfigService.test.d.ts.map +1 -0
- package/dist/tests/unit/services/ConfigService.test.js +104 -0
- package/dist/tests/unit/services/ConfigService.test.js.map +1 -0
- package/dist/tests/unit/services/EventBus.test.d.ts +2 -0
- package/dist/tests/unit/services/EventBus.test.d.ts.map +1 -0
- package/dist/tests/unit/services/EventBus.test.js +117 -0
- package/dist/tests/unit/services/EventBus.test.js.map +1 -0
- package/dist/tests/unit/services/ModelService.test.d.ts +2 -0
- package/dist/tests/unit/services/ModelService.test.d.ts.map +1 -0
- package/dist/tests/unit/services/ModelService.test.js +63 -0
- package/dist/tests/unit/services/ModelService.test.js.map +1 -0
- package/dist/tests/unit/services/Paths.test.d.ts +2 -0
- package/dist/tests/unit/services/Paths.test.d.ts.map +1 -0
- package/dist/tests/unit/services/Paths.test.js +33 -0
- package/dist/tests/unit/services/Paths.test.js.map +1 -0
- package/dist/tests/unit/services/SessionService.test.d.ts +2 -0
- package/dist/tests/unit/services/SessionService.test.d.ts.map +1 -0
- package/dist/tests/unit/services/SessionService.test.js +80 -0
- package/dist/tests/unit/services/SessionService.test.js.map +1 -0
- package/dist/tests/unit/snapshot/FileHistory.test.d.ts +2 -0
- package/dist/tests/unit/snapshot/FileHistory.test.d.ts.map +1 -0
- package/dist/tests/unit/snapshot/FileHistory.test.js +101 -0
- package/dist/tests/unit/snapshot/FileHistory.test.js.map +1 -0
- package/dist/tests/unit/specs/generator.test.d.ts +2 -0
- package/dist/tests/unit/specs/generator.test.d.ts.map +1 -0
- package/dist/tests/unit/specs/generator.test.js +70 -0
- package/dist/tests/unit/specs/generator.test.js.map +1 -0
- package/dist/tests/unit/specs/parser.test.d.ts +2 -0
- package/dist/tests/unit/specs/parser.test.d.ts.map +1 -0
- package/dist/tests/unit/specs/parser.test.js +85 -0
- package/dist/tests/unit/specs/parser.test.js.map +1 -0
- package/dist/tests/unit/styles/OutputStyle.test.d.ts +2 -0
- package/dist/tests/unit/styles/OutputStyle.test.d.ts.map +1 -0
- package/dist/tests/unit/styles/OutputStyle.test.js +33 -0
- package/dist/tests/unit/styles/OutputStyle.test.js.map +1 -0
- package/dist/tests/unit/styles/OutputStyleManager.test.d.ts +2 -0
- package/dist/tests/unit/styles/OutputStyleManager.test.d.ts.map +1 -0
- package/dist/tests/unit/styles/OutputStyleManager.test.js +75 -0
- package/dist/tests/unit/styles/OutputStyleManager.test.js.map +1 -0
- package/dist/tests/unit/tools/BashTool.test.d.ts +2 -0
- package/dist/tests/unit/tools/BashTool.test.d.ts.map +1 -0
- package/dist/tests/unit/tools/BashTool.test.js +35 -0
- package/dist/tests/unit/tools/BashTool.test.js.map +1 -0
- package/dist/tests/unit/tools/EditFileTool.test.d.ts +2 -0
- package/dist/tests/unit/tools/EditFileTool.test.d.ts.map +1 -0
- package/dist/tests/unit/tools/EditFileTool.test.js +48 -0
- package/dist/tests/unit/tools/EditFileTool.test.js.map +1 -0
- package/dist/tests/unit/tools/GrepTool.test.d.ts +2 -0
- package/dist/tests/unit/tools/GrepTool.test.d.ts.map +1 -0
- package/dist/tests/unit/tools/GrepTool.test.js +46 -0
- package/dist/tests/unit/tools/GrepTool.test.js.map +1 -0
- package/dist/tests/unit/tools/ListFilesTool.test.d.ts +2 -0
- package/dist/tests/unit/tools/ListFilesTool.test.d.ts.map +1 -0
- package/dist/tests/unit/tools/ListFilesTool.test.js +58 -0
- package/dist/tests/unit/tools/ListFilesTool.test.js.map +1 -0
- package/dist/tests/unit/tools/ReadFileTool.test.d.ts +2 -0
- package/dist/tests/unit/tools/ReadFileTool.test.d.ts.map +1 -0
- package/dist/tests/unit/tools/ReadFileTool.test.js +42 -0
- package/dist/tests/unit/tools/ReadFileTool.test.js.map +1 -0
- package/dist/tests/unit/tools/TodoWriteTool.test.d.ts +2 -0
- package/dist/tests/unit/tools/TodoWriteTool.test.d.ts.map +1 -0
- package/dist/tests/unit/tools/TodoWriteTool.test.js +54 -0
- package/dist/tests/unit/tools/TodoWriteTool.test.js.map +1 -0
- package/dist/tests/unit/tools/WriteFileTool.test.d.ts +2 -0
- package/dist/tests/unit/tools/WriteFileTool.test.d.ts.map +1 -0
- package/dist/tests/unit/tools/WriteFileTool.test.js +69 -0
- package/dist/tests/unit/tools/WriteFileTool.test.js.map +1 -0
- package/dist/tests/unit/ui/App.test.d.ts +2 -0
- package/dist/tests/unit/ui/App.test.d.ts.map +1 -0
- package/dist/tests/unit/ui/App.test.js +46 -0
- package/dist/tests/unit/ui/App.test.js.map +1 -0
- package/dist/tests/unit/ui/AppContext.test.d.ts +2 -0
- package/dist/tests/unit/ui/AppContext.test.d.ts.map +1 -0
- package/dist/tests/unit/ui/AppContext.test.js +39 -0
- package/dist/tests/unit/ui/AppContext.test.js.map +1 -0
- package/dist/tests/unit/ui/MessageList.test.d.ts +2 -0
- package/dist/tests/unit/ui/MessageList.test.d.ts.map +1 -0
- package/dist/tests/unit/ui/MessageList.test.js +23 -0
- package/dist/tests/unit/ui/MessageList.test.js.map +1 -0
- package/dist/tests/unit/ui/SessionList.test.d.ts +2 -0
- package/dist/tests/unit/ui/SessionList.test.d.ts.map +1 -0
- package/dist/tests/unit/ui/SessionList.test.js +49 -0
- package/dist/tests/unit/ui/SessionList.test.js.map +1 -0
- package/package.json +84 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 curry
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
# AICLI - Enterprise AI Coding Assistant 🤖
|
|
2
|
+
|
|
3
|
+
> Your AI pair programmer in the terminal
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@your-org/aicli)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
[](https://nodejs.org)
|
|
8
|
+
|
|
9
|
+
AICLI is an enterprise-grade AI coding assistant that brings the power of large language models directly to your terminal. Built with TypeScript and powered by OpenAI and Anthropic, it transforms natural language into working code.
|
|
10
|
+
|
|
11
|
+
## ✨ Features
|
|
12
|
+
|
|
13
|
+
- 🚀 **Natural Language to Code** - Describe what you want, get working code
|
|
14
|
+
- 🔧 **Intelligent Code Editing** - AST-based code modifications with context awareness
|
|
15
|
+
- 🧪 **AI-Powered Testing** - Automatic test generation and validation
|
|
16
|
+
- 📊 **Performance Optimization** - Prompt caching, context compression, intelligent pruning
|
|
17
|
+
- 🌐 **HTTP Server Mode** - Browser-based UI with WebSocket support
|
|
18
|
+
- 🔌 **MCP Protocol Support** - Extensible tool system via Model Context Protocol
|
|
19
|
+
- 🌍 **Multiple AI Providers** - OpenAI, Anthropic, DeepSeek, OpenRouter, and custom APIs
|
|
20
|
+
- 🎨 **Multiple Output Styles** - Customizable output formatting and themes
|
|
21
|
+
- 💾 **Session Management** - Resume conversations and track file changes
|
|
22
|
+
- 🔄 **Multi-Agent System** - Specialized agents for different tasks
|
|
23
|
+
- 🎯 **Slash Commands** - Quick actions with `/help`, `/clear`, `/sessions`, etc.
|
|
24
|
+
|
|
25
|
+
## 📦 Installation
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install -g @your-org/aicli
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Requirements:**
|
|
32
|
+
- Node.js 18.0.0 or higher
|
|
33
|
+
- OpenAI or Anthropic API key
|
|
34
|
+
|
|
35
|
+
## 🚀 Quick Start
|
|
36
|
+
|
|
37
|
+
### First Run
|
|
38
|
+
|
|
39
|
+
On first run, AICLI will guide you through interactive setup:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
$ aicli
|
|
43
|
+
|
|
44
|
+
欢迎使用 AICLI! 🎉
|
|
45
|
+
|
|
46
|
+
检测到这是首次运行,需要进行初始配置。
|
|
47
|
+
|
|
48
|
+
请选择 AI 提供商:
|
|
49
|
+
1. OpenAI (GPT-4, GPT-3.5)
|
|
50
|
+
2. Anthropic (Claude)
|
|
51
|
+
3. DeepSeek (国内可用,性价比高)
|
|
52
|
+
4. OpenRouter (多模型聚合)
|
|
53
|
+
5. 自定义 (OpenAI 兼容 API)
|
|
54
|
+
|
|
55
|
+
请输入选项 (1-5): 3
|
|
56
|
+
|
|
57
|
+
请输入 API Key: sk-...
|
|
58
|
+
|
|
59
|
+
请输入模型名称 (直接回车使用默认: deepseek-chat):
|
|
60
|
+
|
|
61
|
+
✅ 配置已保存到: ~/.aiclirc.json
|
|
62
|
+
|
|
63
|
+
提供商: DeepSeek
|
|
64
|
+
模型: deepseek-chat
|
|
65
|
+
Base URL: https://api.deepseek.com
|
|
66
|
+
|
|
67
|
+
配置完成!现在可以开始使用了。
|
|
68
|
+
|
|
69
|
+
试试:aicli "创建一个 Hello World 程序"
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Basic Usage
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# One-shot command
|
|
76
|
+
aicli "create a REST API with Express and TypeScript"
|
|
77
|
+
|
|
78
|
+
# Interactive mode
|
|
79
|
+
aicli
|
|
80
|
+
|
|
81
|
+
# Server mode (browser UI)
|
|
82
|
+
aicli --server --port 3000
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## 📖 Usage Examples
|
|
86
|
+
|
|
87
|
+
### Create a New Project
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
aicli "create a React app with TypeScript and Tailwind CSS"
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Refactor Code
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
aicli "refactor the UserService class to use dependency injection"
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Generate Tests
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
aicli "write unit tests for the authentication module"
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Debug Issues
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
aicli "fix the memory leak in the WebSocket server"
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## ⚙️ Configuration
|
|
112
|
+
|
|
113
|
+
Configuration file: `~/.aiclirc.json`
|
|
114
|
+
|
|
115
|
+
### Supported AI Providers
|
|
116
|
+
|
|
117
|
+
| Provider | Features | Best For |
|
|
118
|
+
|----------|----------|----------|
|
|
119
|
+
| **OpenAI** | GPT-4, GPT-3.5 | International users, best ecosystem |
|
|
120
|
+
| **Anthropic** | Claude series | Long context, high safety |
|
|
121
|
+
| **DeepSeek** | 国内可用 | China users, cost-effective |
|
|
122
|
+
| **OpenRouter** | Multi-model | Access multiple models |
|
|
123
|
+
| **Custom** | OpenAI-compatible | Self-hosted, special needs |
|
|
124
|
+
|
|
125
|
+
### Configuration Examples
|
|
126
|
+
|
|
127
|
+
**OpenAI:**
|
|
128
|
+
```json
|
|
129
|
+
{
|
|
130
|
+
"provider": "openai",
|
|
131
|
+
"apiKey": "sk-...",
|
|
132
|
+
"model": "gpt-4",
|
|
133
|
+
"performance": {
|
|
134
|
+
"enableCaching": true,
|
|
135
|
+
"enableCompression": true
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**DeepSeek:**
|
|
141
|
+
```json
|
|
142
|
+
{
|
|
143
|
+
"provider": "deepseek",
|
|
144
|
+
"apiKey": "sk-...",
|
|
145
|
+
"model": "deepseek-chat",
|
|
146
|
+
"baseURL": "https://api.deepseek.com",
|
|
147
|
+
"performance": {
|
|
148
|
+
"enableCaching": true,
|
|
149
|
+
"enableCompression": true
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
**Custom API:**
|
|
155
|
+
```json
|
|
156
|
+
{
|
|
157
|
+
"provider": "custom",
|
|
158
|
+
"apiKey": "your-key",
|
|
159
|
+
"model": "your-model",
|
|
160
|
+
"baseURL": "https://api.example.com/v1",
|
|
161
|
+
"performance": {
|
|
162
|
+
"enableCaching": true,
|
|
163
|
+
"enableCompression": true
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Supported Models
|
|
169
|
+
|
|
170
|
+
**OpenAI:**
|
|
171
|
+
- `gpt-4`
|
|
172
|
+
- `gpt-4-turbo`
|
|
173
|
+
- `gpt-3.5-turbo`
|
|
174
|
+
|
|
175
|
+
**Anthropic:**
|
|
176
|
+
- `claude-3-5-sonnet-20241022`
|
|
177
|
+
- `claude-3-opus-20240229`
|
|
178
|
+
- `claude-3-sonnet-20240229`
|
|
179
|
+
|
|
180
|
+
**DeepSeek:**
|
|
181
|
+
- `deepseek-chat`
|
|
182
|
+
- `deepseek-coder`
|
|
183
|
+
|
|
184
|
+
**OpenRouter:**
|
|
185
|
+
- `anthropic/claude-3.5-sonnet`
|
|
186
|
+
- `openai/gpt-4`
|
|
187
|
+
- And many more...
|
|
188
|
+
|
|
189
|
+
## 🎮 Commands
|
|
190
|
+
|
|
191
|
+
### Slash Commands
|
|
192
|
+
|
|
193
|
+
- `/help` - Show available commands
|
|
194
|
+
- `/clear` - Clear current session
|
|
195
|
+
- `/sessions` - List all sessions
|
|
196
|
+
- `/model` - Change AI model
|
|
197
|
+
- `/style` - Change output style
|
|
198
|
+
- `/snapshots` - View file history
|
|
199
|
+
- `/rewind` - Revert file changes
|
|
200
|
+
- `/exit` - Exit AICLI
|
|
201
|
+
|
|
202
|
+
### CLI Options
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
aicli [options] [prompt]
|
|
206
|
+
|
|
207
|
+
Options:
|
|
208
|
+
-v, --version Output version number
|
|
209
|
+
-h, --help Display help
|
|
210
|
+
-s, --server Start HTTP server mode
|
|
211
|
+
-p, --port <port> Server port (default: 3000)
|
|
212
|
+
-m, --model <model> AI model to use
|
|
213
|
+
--no-cache Disable prompt caching
|
|
214
|
+
--no-compression Disable context compression
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## 🏗️ Architecture
|
|
218
|
+
|
|
219
|
+
AICLI is built with a modular architecture:
|
|
220
|
+
|
|
221
|
+
- **Application Layer** - Dependency injection and lifecycle management
|
|
222
|
+
- **Service Layer** - Core services (Model, Config, Session, EventBus)
|
|
223
|
+
- **Manager Layer** - Tool, Plugin, Agent, Command managers
|
|
224
|
+
- **Tool System** - File operations, search, bash execution, code editing
|
|
225
|
+
- **Agent System** - General, Plan, and Explore agents
|
|
226
|
+
- **UI Layer** - Ink-based terminal UI with React components
|
|
227
|
+
- **Server Layer** - HTTP server with WebSocket for browser UI
|
|
228
|
+
|
|
229
|
+
## 🔌 Extensibility
|
|
230
|
+
|
|
231
|
+
### Custom Plugins
|
|
232
|
+
|
|
233
|
+
Create custom plugins in `~/.aicli/plugins/`:
|
|
234
|
+
|
|
235
|
+
```typescript
|
|
236
|
+
import { Plugin } from '@your-org/aicli';
|
|
237
|
+
|
|
238
|
+
export class MyPlugin extends Plugin {
|
|
239
|
+
name = 'my-plugin';
|
|
240
|
+
|
|
241
|
+
async onInit() {
|
|
242
|
+
console.log('Plugin initialized');
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
async onToolCall(tool: string, args: any) {
|
|
246
|
+
// Custom logic
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### MCP Integration
|
|
252
|
+
|
|
253
|
+
AICLI supports the Model Context Protocol for extending tool capabilities. Configure MCP servers in your config file.
|
|
254
|
+
|
|
255
|
+
## 📚 Documentation
|
|
256
|
+
|
|
257
|
+
- [Complete Tutorial](./docs/) - 25-chapter tutorial series
|
|
258
|
+
- [Architecture Design](./docs/00-项目架构设计.md)
|
|
259
|
+
- [API Documentation](./docs/01-AI-API调用.md)
|
|
260
|
+
- [Tool System](./docs/02-工具系统.md)
|
|
261
|
+
- [Performance Optimization](./docs/23-性能优化.md)
|
|
262
|
+
|
|
263
|
+
## 🧪 Development
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
# Clone repository
|
|
267
|
+
git clone https://github.com/your-org/aicli.git
|
|
268
|
+
cd aicli
|
|
269
|
+
|
|
270
|
+
# Install dependencies
|
|
271
|
+
npm install
|
|
272
|
+
|
|
273
|
+
# Run in development mode
|
|
274
|
+
npm run dev
|
|
275
|
+
|
|
276
|
+
# Run tests
|
|
277
|
+
npm test
|
|
278
|
+
|
|
279
|
+
# Type checking
|
|
280
|
+
npm run typecheck
|
|
281
|
+
|
|
282
|
+
# Format code
|
|
283
|
+
npm run format
|
|
284
|
+
|
|
285
|
+
# Run full CI
|
|
286
|
+
npm run ci
|
|
287
|
+
|
|
288
|
+
# Build for production
|
|
289
|
+
npm run build
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
## 🤝 Contributing
|
|
293
|
+
|
|
294
|
+
Contributions are welcome! Please read our [Contributing Guide](./CONTRIBUTING.md) for details.
|
|
295
|
+
|
|
296
|
+
## 📝 License
|
|
297
|
+
|
|
298
|
+
MIT © [Your Name](https://github.com/your-org)
|
|
299
|
+
|
|
300
|
+
## 🙏 Acknowledgments
|
|
301
|
+
|
|
302
|
+
- Built with [AI SDK](https://sdk.vercel.ai)
|
|
303
|
+
- UI powered by [Ink](https://github.com/vadimdemedes/ink)
|
|
304
|
+
- Inspired by [Neovate Code](https://github.com/neovate/code)
|
|
305
|
+
|
|
306
|
+
## 📮 Support
|
|
307
|
+
|
|
308
|
+
- 🐛 [Report Issues](https://github.com/your-org/aicli/issues)
|
|
309
|
+
- 💬 [Discussions](https://github.com/your-org/aicli/discussions)
|
|
310
|
+
- 📧 Email: support@your-org.com
|
|
311
|
+
|
|
312
|
+
---
|
|
313
|
+
|
|
314
|
+
**Made with ❤️ by developers, for developers**
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Task, Result, AgentContext } from '../../types/index';
|
|
2
|
+
export declare abstract class Agent {
|
|
3
|
+
abstract name: string;
|
|
4
|
+
abstract description: string;
|
|
5
|
+
abstract whenToUse: string;
|
|
6
|
+
abstract execute(task: Task, context: AgentContext): Promise<Result>;
|
|
7
|
+
getInfo(): {
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
whenToUse: string;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=Agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Agent.d.ts","sourceRoot":"","sources":["../../../../src/agents/base/Agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAUpE,8BAAsB,KAAK;IAIzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAKtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAK7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAS3B,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC;IAKpE,OAAO,IAAI;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE;CAOpE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Agent.js","sourceRoot":"","sources":["../../../../src/agents/base/Agent.ts"],"names":[],"mappings":"AAUA,MAAM,OAAgB,KAAK;IA4BzB,OAAO;QACL,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,SAAS,EAAE,IAAI,CAAC,SAAS;SAC1B,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Agent } from '../base/Agent';
|
|
2
|
+
import type { Task, Result, AgentContext } from '../../types/index';
|
|
3
|
+
export declare class ExploreAgent extends Agent {
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
whenToUse: string;
|
|
7
|
+
execute(task: Task, context: AgentContext): Promise<Result>;
|
|
8
|
+
private listProjectFiles;
|
|
9
|
+
private analyzeStructure;
|
|
10
|
+
private identifyKeyFiles;
|
|
11
|
+
private generateSummary;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=ExploreAgent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExploreAgent.d.ts","sourceRoot":"","sources":["../../../../src/agents/builtin/ExploreAgent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAepE,qBAAa,YAAa,SAAQ,KAAK;IACrC,IAAI,SAAa;IACjB,WAAW,SAAoB;IAC/B,SAAS,SAAyB;IAE5B,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC;YAwCnD,gBAAgB;YAYhB,gBAAgB;YAkBhB,gBAAgB;IAkB9B,OAAO,CAAC,eAAe;CASxB"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Agent } from '../base/Agent';
|
|
2
|
+
export class ExploreAgent extends Agent {
|
|
3
|
+
name = 'explore';
|
|
4
|
+
description = '探索代码库结构,识别关键文件';
|
|
5
|
+
whenToUse = '需要理解代码库结构或查找特定功能时使用';
|
|
6
|
+
async execute(task, context) {
|
|
7
|
+
console.log('🔍 开始探索代码库...');
|
|
8
|
+
try {
|
|
9
|
+
const files = await this.listProjectFiles(context);
|
|
10
|
+
const structure = await this.analyzeStructure(files);
|
|
11
|
+
const keyFiles = await this.identifyKeyFiles(files, task.goal);
|
|
12
|
+
const summary = this.generateSummary(structure, keyFiles);
|
|
13
|
+
console.log('✅ 探索完成');
|
|
14
|
+
return {
|
|
15
|
+
success: true,
|
|
16
|
+
data: {
|
|
17
|
+
files,
|
|
18
|
+
structure,
|
|
19
|
+
keyFiles,
|
|
20
|
+
summary,
|
|
21
|
+
},
|
|
22
|
+
message: '代码库探索完成',
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
return {
|
|
27
|
+
success: false,
|
|
28
|
+
data: null,
|
|
29
|
+
error: error instanceof Error ? error : new Error(String(error)),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
async listProjectFiles(context) {
|
|
34
|
+
const result = await context.toolManager.execute('list_files', {
|
|
35
|
+
path: '.',
|
|
36
|
+
recursive: true,
|
|
37
|
+
});
|
|
38
|
+
return result.files || [];
|
|
39
|
+
}
|
|
40
|
+
async analyzeStructure(files) {
|
|
41
|
+
const structure = {};
|
|
42
|
+
for (const file of files) {
|
|
43
|
+
const dir = file.split('/').slice(0, -1).join('/') || '.';
|
|
44
|
+
if (!structure[dir]) {
|
|
45
|
+
structure[dir] = [];
|
|
46
|
+
}
|
|
47
|
+
structure[dir].push(file);
|
|
48
|
+
}
|
|
49
|
+
return structure;
|
|
50
|
+
}
|
|
51
|
+
async identifyKeyFiles(files, goal) {
|
|
52
|
+
const keywords = goal.toLowerCase().split(' ');
|
|
53
|
+
const keyFiles = [];
|
|
54
|
+
for (const file of files) {
|
|
55
|
+
const fileName = file.toLowerCase();
|
|
56
|
+
if (keywords.some((keyword) => fileName.includes(keyword))) {
|
|
57
|
+
keyFiles.push(file);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return keyFiles;
|
|
61
|
+
}
|
|
62
|
+
generateSummary(structure, keyFiles) {
|
|
63
|
+
const dirCount = Object.keys(structure).length;
|
|
64
|
+
const fileCount = Object.values(structure).flat().length;
|
|
65
|
+
return `
|
|
66
|
+
项目包含 ${dirCount} 个目录,${fileCount} 个文件。
|
|
67
|
+
找到 ${keyFiles.length} 个相关文件。
|
|
68
|
+
`.trim();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=ExploreAgent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExploreAgent.js","sourceRoot":"","sources":["../../../../src/agents/builtin/ExploreAgent.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Agent } from '../base/Agent';
|
|
2
|
+
import type { Task, Result, AgentContext } from '../../types/index';
|
|
3
|
+
export declare class GeneralAgent extends Agent {
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
whenToUse: string;
|
|
7
|
+
execute(task: Task, context: AgentContext): Promise<Result>;
|
|
8
|
+
private parseTaskType;
|
|
9
|
+
private selectTool;
|
|
10
|
+
private executeTool;
|
|
11
|
+
private extractParams;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=GeneralAgent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeneralAgent.d.ts","sourceRoot":"","sources":["../../../../src/agents/builtin/GeneralAgent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAepE,qBAAa,YAAa,SAAQ,KAAK;IACrC,IAAI,SAAqB;IACzB,WAAW,SAAqB;IAChC,SAAS,SAAe;IAElB,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC;IAgCjE,OAAO,CAAC,aAAa;IAgBrB,OAAO,CAAC,UAAU;YAgBJ,WAAW;IAWzB,OAAO,CAAC,aAAa;CA8BtB"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Agent } from '../base/Agent';
|
|
2
|
+
export class GeneralAgent extends Agent {
|
|
3
|
+
name = 'general-purpose';
|
|
4
|
+
description = '执行通用任务,调用工具完成工作';
|
|
5
|
+
whenToUse = '执行具体任务时使用';
|
|
6
|
+
async execute(task, context) {
|
|
7
|
+
console.log('⚙️ 开始执行任务...');
|
|
8
|
+
try {
|
|
9
|
+
const taskType = this.parseTaskType(task);
|
|
10
|
+
const tool = this.selectTool(taskType);
|
|
11
|
+
const result = await this.executeTool(tool, task, context);
|
|
12
|
+
console.log('✅ 任务执行完成');
|
|
13
|
+
return {
|
|
14
|
+
success: true,
|
|
15
|
+
data: result,
|
|
16
|
+
message: '任务已完成',
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
return {
|
|
21
|
+
success: false,
|
|
22
|
+
data: null,
|
|
23
|
+
error: error instanceof Error ? error : new Error(String(error)),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
parseTaskType(task) {
|
|
28
|
+
const goal = task.goal.toLowerCase();
|
|
29
|
+
if (goal.includes('读取') || goal.includes('查看'))
|
|
30
|
+
return 'read';
|
|
31
|
+
if (goal.includes('写入') || goal.includes('创建'))
|
|
32
|
+
return 'write';
|
|
33
|
+
if (goal.includes('修改') || goal.includes('编辑'))
|
|
34
|
+
return 'edit';
|
|
35
|
+
if (goal.includes('删除'))
|
|
36
|
+
return 'delete';
|
|
37
|
+
if (goal.includes('搜索') || goal.includes('查找'))
|
|
38
|
+
return 'search';
|
|
39
|
+
if (goal.includes('执行') || goal.includes('运行'))
|
|
40
|
+
return 'execute';
|
|
41
|
+
return 'unknown';
|
|
42
|
+
}
|
|
43
|
+
selectTool(taskType) {
|
|
44
|
+
const toolMap = {
|
|
45
|
+
read: 'read_file',
|
|
46
|
+
write: 'write_file',
|
|
47
|
+
edit: 'edit_file',
|
|
48
|
+
delete: 'delete_file',
|
|
49
|
+
search: 'grep',
|
|
50
|
+
execute: 'bash',
|
|
51
|
+
};
|
|
52
|
+
return toolMap[taskType] || 'read_file';
|
|
53
|
+
}
|
|
54
|
+
async executeTool(toolName, task, context) {
|
|
55
|
+
const params = this.extractParams(task, toolName);
|
|
56
|
+
return await context.toolManager.execute(toolName, params);
|
|
57
|
+
}
|
|
58
|
+
extractParams(task, toolName) {
|
|
59
|
+
if (task.context) {
|
|
60
|
+
return task.context;
|
|
61
|
+
}
|
|
62
|
+
switch (toolName) {
|
|
63
|
+
case 'read_file':
|
|
64
|
+
return { path: 'package.json' };
|
|
65
|
+
case 'write_file':
|
|
66
|
+
return { path: 'test.txt', content: 'Hello World' };
|
|
67
|
+
case 'edit_file':
|
|
68
|
+
return { path: 'test.txt', content: 'Updated content' };
|
|
69
|
+
case 'delete_file':
|
|
70
|
+
return { path: 'test.txt' };
|
|
71
|
+
case 'grep':
|
|
72
|
+
return { pattern: 'test', path: '.' };
|
|
73
|
+
case 'bash':
|
|
74
|
+
return { command: 'echo "Hello from GeneralAgent"' };
|
|
75
|
+
default:
|
|
76
|
+
return { path: '.' };
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=GeneralAgent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeneralAgent.js","sourceRoot":"","sources":["../../../../src/agents/builtin/GeneralAgent.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Agent } from '../base/Agent';
|
|
2
|
+
import type { Task, Result, AgentContext } from '../../types/index';
|
|
3
|
+
export declare class PlanAgent extends Agent {
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
whenToUse: string;
|
|
7
|
+
execute(task: Task, _context: AgentContext): Promise<Result>;
|
|
8
|
+
private analyzeTask;
|
|
9
|
+
private breakdownTask;
|
|
10
|
+
private orderTasks;
|
|
11
|
+
private generatePlan;
|
|
12
|
+
private estimateComplexity;
|
|
13
|
+
private extractRequirements;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=PlanAgent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlanAgent.d.ts","sourceRoot":"","sources":["../../../../src/agents/builtin/PlanAgent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAepE,qBAAa,SAAU,SAAQ,KAAK;IAClC,IAAI,SAAU;IACd,WAAW,SAAmB;IAC9B,SAAS,SAAwB;IAE3B,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC;YAuCpD,WAAW;YAWX,aAAa;IAiC3B,OAAO,CAAC,UAAU;IAQlB,OAAO,CAAC,YAAY;IAcpB,OAAO,CAAC,kBAAkB;IAU1B,OAAO,CAAC,mBAAmB;CAI5B"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { Agent } from '../base/Agent';
|
|
2
|
+
export class PlanAgent extends Agent {
|
|
3
|
+
name = 'plan';
|
|
4
|
+
description = '分析任务需求,制定执行计划';
|
|
5
|
+
whenToUse = '需要分解复杂任务或制定实施方案时使用';
|
|
6
|
+
async execute(task, _context) {
|
|
7
|
+
console.log('📋 开始制定计划...');
|
|
8
|
+
try {
|
|
9
|
+
const analysis = await this.analyzeTask(task);
|
|
10
|
+
const subtasks = await this.breakdownTask(task, analysis);
|
|
11
|
+
const orderedTasks = this.orderTasks(subtasks);
|
|
12
|
+
const plan = this.generatePlan(orderedTasks);
|
|
13
|
+
console.log('✅ 计划制定完成');
|
|
14
|
+
return {
|
|
15
|
+
success: true,
|
|
16
|
+
data: {
|
|
17
|
+
analysis,
|
|
18
|
+
subtasks: orderedTasks,
|
|
19
|
+
plan,
|
|
20
|
+
},
|
|
21
|
+
message: '执行计划已生成',
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
return {
|
|
26
|
+
success: false,
|
|
27
|
+
data: null,
|
|
28
|
+
error: error instanceof Error ? error : new Error(String(error)),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
async analyzeTask(task) {
|
|
33
|
+
return {
|
|
34
|
+
goal: task.goal,
|
|
35
|
+
complexity: this.estimateComplexity(task.goal),
|
|
36
|
+
requirements: this.extractRequirements(task.goal),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
async breakdownTask(task, _analysis) {
|
|
40
|
+
const subtasks = [];
|
|
41
|
+
const keywords = ['创建', '修改', '删除', '测试', '部署'];
|
|
42
|
+
for (const keyword of keywords) {
|
|
43
|
+
if (task.goal.includes(keyword)) {
|
|
44
|
+
subtasks.push({
|
|
45
|
+
id: subtasks.length + 1,
|
|
46
|
+
action: keyword,
|
|
47
|
+
description: `${keyword}相关功能`,
|
|
48
|
+
estimated: '30分钟',
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (subtasks.length === 0) {
|
|
53
|
+
subtasks.push({
|
|
54
|
+
id: 1,
|
|
55
|
+
action: '执行',
|
|
56
|
+
description: task.goal,
|
|
57
|
+
estimated: '1小时',
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return subtasks;
|
|
61
|
+
}
|
|
62
|
+
orderTasks(subtasks) {
|
|
63
|
+
return subtasks.sort((a, b) => a.id - b.id);
|
|
64
|
+
}
|
|
65
|
+
generatePlan(subtasks) {
|
|
66
|
+
let plan = '执行计划:\n\n';
|
|
67
|
+
for (const task of subtasks) {
|
|
68
|
+
plan += `${task.id}. ${task.action} - ${task.description}\n`;
|
|
69
|
+
plan += ` 预计时间:${task.estimated}\n\n`;
|
|
70
|
+
}
|
|
71
|
+
return plan;
|
|
72
|
+
}
|
|
73
|
+
estimateComplexity(goal) {
|
|
74
|
+
const length = goal.length;
|
|
75
|
+
if (length < 50)
|
|
76
|
+
return '简单';
|
|
77
|
+
if (length < 100)
|
|
78
|
+
return '中等';
|
|
79
|
+
return '复杂';
|
|
80
|
+
}
|
|
81
|
+
extractRequirements(goal) {
|
|
82
|
+
return goal.split('。').filter((s) => s.trim());
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=PlanAgent.js.map
|