refactor: 重构PromptXToolCommand为ToolCommand并移至标准目录
📁 文件重构 - 移动: src/lib/commands/PromptXToolCommand.js → src/lib/core/pouch/commands/ToolCommand.js - 重命名: PromptXToolCommand → ToolCommand - 统一: 与其他Command文件保持相同目录结构 🔧 代码更新 Class: - class PromptXToolCommand → class ToolCommand - 更新module.exports导出名称 Imports: - 修正BasePouchCommand相对路径引用 - 修正getGlobalResourceManager相对路径引用 - 修正ToolExecutor和logger相对路径引用 References: - src/lib/core/pouch/commands/index.js: 更新import和export - src/lib/core/pouch/PouchCLI.js: 更新commands.ToolCommand引用 📂 目录结构统一 src/lib/core/pouch/commands/ ├── ActionCommand.js ├── InitCommand.js ├── LearnCommand.js ├── RecallCommand.js ├── RememberCommand.js ├── ToolCommand.js # 新位置 ├── WelcomeCommand.js └── index.js ✅ 验证通过 - @tool://calculator 减法功能正常: 100 - 58 = 42 - 所有引用路径正确 - 命名规范统一 - 目录结构规范 💡 重构收益 - 遵循项目命名约定 - 统一Command文件组织 - 简化类名提升可读性 - 便于维护和扩展 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -31,7 +31,7 @@ class PouchCLI {
|
|||||||
learn: commands.LearnCommand,
|
learn: commands.LearnCommand,
|
||||||
recall: commands.RecallCommand,
|
recall: commands.RecallCommand,
|
||||||
remember: commands.RememberCommand,
|
remember: commands.RememberCommand,
|
||||||
tool: commands.PromptXToolCommand
|
tool: commands.ToolCommand
|
||||||
})
|
})
|
||||||
|
|
||||||
// 将命令注册到状态机
|
// 将命令注册到状态机
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
const BasePouchCommand = require('../core/pouch/BasePouchCommand')
|
const BasePouchCommand = require('../BasePouchCommand')
|
||||||
const { getGlobalResourceManager } = require('../core/resource')
|
const { getGlobalResourceManager } = require('../../resource')
|
||||||
const ToolExecutor = require('../tool/ToolExecutor')
|
const ToolExecutor = require('../../../tool/ToolExecutor')
|
||||||
const logger = require('../utils/logger')
|
const logger = require('../../../utils/logger')
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PromptX Tool命令处理器
|
* Tool命令处理器
|
||||||
* 实现promptx_tool MCP工具,执行通过@tool协议声明的工具
|
* 实现promptx_tool MCP工具,执行通过@tool协议声明的工具
|
||||||
*/
|
*/
|
||||||
class PromptXToolCommand extends BasePouchCommand {
|
class ToolCommand extends BasePouchCommand {
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super()
|
||||||
this.toolExecutor = new ToolExecutor()
|
this.toolExecutor = new ToolExecutor()
|
||||||
@ -268,4 +268,4 @@ ${JSON.stringify(result.result, null, 2)}
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = PromptXToolCommand
|
module.exports = ToolCommand
|
||||||
@ -8,7 +8,7 @@ const ActionCommand = require('./ActionCommand')
|
|||||||
const LearnCommand = require('./LearnCommand')
|
const LearnCommand = require('./LearnCommand')
|
||||||
const RecallCommand = require('./RecallCommand')
|
const RecallCommand = require('./RecallCommand')
|
||||||
const RememberCommand = require('./RememberCommand')
|
const RememberCommand = require('./RememberCommand')
|
||||||
const PromptXToolCommand = require('../../../commands/PromptXToolCommand')
|
const ToolCommand = require('./ToolCommand')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
InitCommand,
|
InitCommand,
|
||||||
@ -17,5 +17,5 @@ module.exports = {
|
|||||||
LearnCommand,
|
LearnCommand,
|
||||||
RecallCommand,
|
RecallCommand,
|
||||||
RememberCommand,
|
RememberCommand,
|
||||||
PromptXToolCommand
|
ToolCommand
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user