diff --git a/README.md b/README.md index f875e1d..f22a401 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ PromptX 能做什么?简单来说,它让你的 AI 助手拥有了"大脑"和 ### 📸 **配置成功后的使用效果** #### **1. 发现并激活专业角色** -*使用 `promptx_hello` 发现可用角色,再用 `promptx_action` 激活,AI即刻变身领域专家。* +*使用 `promptx_welcome` 发现可用角色,再用 `promptx_action` 激活,AI即刻变身领域专家。* 角色发现与激活 #### **2. 拥有智能记忆** diff --git a/README_EN.md b/README_EN.md index b66f2b9..a3006de 100644 --- a/README_EN.md +++ b/README_EN.md @@ -34,7 +34,7 @@ What can PromptX do? Simply put, it gives your AI assistant a "brain" and "memor ### 📸 **Usage Effects After Configuration** #### **1. Discover and Activate Professional Roles** -*Use `promptx_hello` to discover available roles, then `promptx_action` to activate them, instantly transforming your AI into a domain expert.* +*Use `promptx_welcome` to discover available roles, then `promptx_action` to activate them, instantly transforming your AI into a domain expert.* Role Discovery and Activation #### **2. Intelligent Memory** diff --git a/src/bin/promptx.js b/src/bin/promptx.js index 61edb80..8fd89fa 100755 --- a/src/bin/promptx.js +++ b/src/bin/promptx.js @@ -31,10 +31,10 @@ program }) program - .command('hello') - .description('👋 hello锦囊 - 发现并展示所有可用的AI角色和领域专家') + .command('welcome') + .description('👋 welcome锦囊 - 发现并展示所有可用的AI角色和领域专家') .action(async (options) => { - await cli.execute('hello', []) + await cli.execute('welcome', []) }) program @@ -151,7 +151,7 @@ ${chalk.cyan('💡 PromptX 锦囊框架 - AI use CLI get prompt for AI')} ${chalk.cyan('🎒 七大核心命令:')} 🏗️ ${chalk.cyan('init')} → 初始化环境,传达系统协议 - 👋 ${chalk.yellow('hello')} → 发现可用角色和领域专家 + 👋 ${chalk.yellow('welcome')} → 发现可用角色和领域专家 ⚡ ${chalk.red('action')} → 激活特定角色,获取专业能力 📚 ${chalk.blue('learn')} → 深入学习领域知识体系 🔍 ${chalk.green('recall')} → AI主动检索应用记忆 @@ -164,7 +164,7 @@ ${chalk.cyan('示例:')} promptx init ${chalk.gray('# 2️⃣ 发现可用角色')} - promptx hello + promptx welcome ${chalk.gray('# 3️⃣ 激活专业角色')} promptx action copywriter diff --git a/src/constants.js b/src/constants.js index 4458fb8..d51e6fa 100644 --- a/src/constants.js +++ b/src/constants.js @@ -19,7 +19,7 @@ const COMMAND_PREFIX = getCommandPrefix() // 静态命令常量 const COMMANDS = { INIT: `${COMMAND_PREFIX} init`, - HELLO: `${COMMAND_PREFIX} hello`, + WELCOME: `${COMMAND_PREFIX} welcome`, ACTION: `${COMMAND_PREFIX} action`, LEARN: `${COMMAND_PREFIX} learn`, RECALL: `${COMMAND_PREFIX} recall`, diff --git a/src/lib/commands/MCPServerCommand.js b/src/lib/commands/MCPServerCommand.js index f43728f..292ae8e 100644 --- a/src/lib/commands/MCPServerCommand.js +++ b/src/lib/commands/MCPServerCommand.js @@ -460,7 +460,7 @@ class MCPServerCommand { const paramMapping = { 'promptx_init': (args) => args.workingDirectory ? [args] : [], - 'promptx_hello': () => [], + 'promptx_welcome': () => [], 'promptx_action': (args) => [args.role], diff --git a/src/lib/commands/MCPStreamableHttpCommand.js b/src/lib/commands/MCPStreamableHttpCommand.js index 380b20f..7bb5ded 100644 --- a/src/lib/commands/MCPStreamableHttpCommand.js +++ b/src/lib/commands/MCPStreamableHttpCommand.js @@ -431,7 +431,7 @@ class MCPStreamableHttpCommand { convertMCPToCliParams(toolName, mcpArgs) { const paramMapping = { 'promptx_init': () => [], - 'promptx_hello': () => [], + 'promptx_welcome': () => [], 'promptx_action': (args) => args && args.role ? [args.role] : [], 'promptx_learn': (args) => args && args.resource ? [args.resource] : [], 'promptx_recall': (args) => { diff --git a/src/lib/core/pouch/PouchCLI.js b/src/lib/core/pouch/PouchCLI.js index 5ac7f82..3bbc171 100644 --- a/src/lib/core/pouch/PouchCLI.js +++ b/src/lib/core/pouch/PouchCLI.js @@ -26,7 +26,7 @@ class PouchCLI { // 批量注册所有命令 this.registry.registerBatch({ init: commands.InitCommand, - hello: commands.HelloCommand, + welcome: commands.WelcomeCommand, action: commands.ActionCommand, learn: commands.LearnCommand, recall: commands.RecallCommand, @@ -115,7 +115,7 @@ class PouchCLI { 💡 使用示例: ${COMMANDS.INIT} # 初始化工作环境 - ${COMMANDS.HELLO} # 发现可用角色 + ${COMMANDS.WELCOME} # 发现可用角色 ${COMMANDS.ACTION} copywriter # 激活文案专家 ${COMMANDS.LEARN} scrum # 学习敏捷知识 ${COMMANDS.RECALL} frontend # 检索前端记忆 diff --git a/src/lib/core/pouch/README.md b/src/lib/core/pouch/README.md index eeff791..354e685 100644 --- a/src/lib/core/pouch/README.md +++ b/src/lib/core/pouch/README.md @@ -19,7 +19,7 @@ ├── PouchStateMachine # 状态机管理器 └── Commands/ # 五个核心锦囊 ├── InitCommand # 初始化锦囊 - ├── HelloCommand # 角色发现锦囊 + ├── WelcomeCommand # 角色发现锦囊 ├── ActionCommand # 角色激活锦囊 ├── LearnCommand # 领域学习锦囊 └── RecallCommand # 记忆检索锦囊 @@ -43,7 +43,7 @@ const { PouchCLI, BasePouchCommand } = require('./lib/core/pouch'); await cli.execute('init'); // 发现可用角色 -await cli.execute('hello'); +await cli.execute('welcome'); // 激活特定角色 await cli.execute('action', ['copywriter']); @@ -137,7 +137,7 @@ command.setOutputFormat('human'); | 命令 | 说明 | 示例 | |------|------|------| | init | 初始化工作环境 | `promptx init` | -| hello | 发现可用角色 | `promptx hello` | +| welcome | 发现可用角色 | `promptx welcome` | | action | 激活特定角色 | `promptx action copywriter` | | learn | 学习领域知识 | `promptx learn scrum` | | recall | 检索相关记忆 | `promptx recall test` | @@ -156,7 +156,7 @@ await cli.runInteractive(); ```javascript const commands = [ { name: 'init', args: [] }, - { name: 'hello', args: [] }, + { name: 'welcome', args: [] }, { name: 'action', args: ['frontend'] } ]; diff --git a/src/lib/core/pouch/commands/ActionCommand.js b/src/lib/core/pouch/commands/ActionCommand.js index f01fed9..18e0ef6 100644 --- a/src/lib/core/pouch/commands/ActionCommand.js +++ b/src/lib/core/pouch/commands/ActionCommand.js @@ -15,8 +15,8 @@ const logger = require('../../../utils/logger') class ActionCommand extends BasePouchCommand { constructor () { super() - // 获取HelloCommand的角色注册表 - this.helloCommand = null + // 获取WelcomeCommand的角色注册表 + this.welcomeCommand = null // 使用全局单例 ResourceManager this.resourceManager = getGlobalResourceManager() this.dpmlParser = new DPMLContentParser() @@ -40,7 +40,7 @@ class ActionCommand extends BasePouchCommand { 通过 MCP PromptX 工具的 action 功能激活角色 💡 查看可用角色: -使用 MCP PromptX 工具的 hello 功能` +使用 MCP PromptX 工具的 welcome 功能` } try { @@ -66,7 +66,7 @@ class ActionCommand extends BasePouchCommand { 💡 解决方案: 1. **首先尝试**:使用 MCP PromptX 工具的 **init** 功能刷新注册表 2. **然后重试**:再次使用 action 功能激活角色 -3. **查看角色**:使用 hello 功能查看所有可用角色 +3. **查看角色**:使用 welcome 功能查看所有可用角色 🚨 **特别提示**:如果刚刚用女娲创建了新角色,必须先执行 init 刷新注册表!` } @@ -89,7 +89,7 @@ class ActionCommand extends BasePouchCommand { 💡 解决方案: 1. **优先尝试**:使用 MCP PromptX 工具的 **init** 功能刷新注册表 2. **然后重试**:再次尝试激活角色 -3. **查看可用角色**:使用 hello 功能查看角色列表 +3. **查看可用角色**:使用 welcome 功能查看角色列表 🚨 **新角色提示**:如果是女娲等工具刚创建的角色,必须先执行 init! @@ -98,18 +98,18 @@ class ActionCommand extends BasePouchCommand { } /** - * 获取角色信息(从HelloCommand) + * 获取角色信息(从WelcomeCommand) */ async getRoleInfo (roleId) { logger.debug(`[ActionCommand] getRoleInfo调用,角色ID: ${roleId}`) - // 总是创建新的HelloCommand实例,确保获取最新的角色信息 - logger.debug(`[ActionCommand] 创建新的HelloCommand实例以获取最新角色信息`) - const HelloCommand = require('./HelloCommand') - this.helloCommand = new HelloCommand() + // 总是创建新的WelcomeCommand实例,确保获取最新的角色信息 + logger.debug(`[ActionCommand] 创建新的WelcomeCommand实例以获取最新角色信息`) + const WelcomeCommand = require('./WelcomeCommand') + this.welcomeCommand = new WelcomeCommand() - const result = await this.helloCommand.getRoleInfo(roleId) - logger.debug(`[ActionCommand] HelloCommand.getRoleInfo返回:`, result) + const result = await this.welcomeCommand.getRoleInfo(roleId) + logger.debug(`[ActionCommand] WelcomeCommand.getRoleInfo返回:`, result) return result } @@ -276,7 +276,7 @@ promptx learn principle://${roleInfo.id} 角色激活完成后,可以: - 📝 **开始专业工作** - 运用角色能力解决实际问题 - 🔍 **调用记忆** - 使用 \`promptx recall\` 检索相关经验 -- 🔄 **切换角色** - 使用 \`promptx hello\` 选择其他专业角色 +- 🔄 **切换角色** - 使用 \`promptx welcome\` 选择其他专业角色 💡 **设计理念**:基于 DPML 基础协议组合,通过thought和execution的灵活编排实现角色能力。` @@ -443,12 +443,12 @@ ${recallContent} if (!roleId) { return { currentState: 'action_awaiting_role', - availableTransitions: ['hello'], + availableTransitions: ['welcome'], nextActions: [ { name: '查看可用角色', description: '返回角色发现页面', - method: 'MCP PromptX hello 工具', + method: 'MCP PromptX welcome 工具', priority: 'high' } ], @@ -460,7 +460,7 @@ ${recallContent} return { currentState: 'role_activated_with_memory', - availableTransitions: ['hello', 'remember', 'learn'], + availableTransitions: ['welcome', 'remember', 'learn'], nextActions: [ { name: '开始专业服务', @@ -471,7 +471,7 @@ ${recallContent} { name: '返回角色选择', description: '选择其他角色', - method: 'MCP PromptX hello 工具', + method: 'MCP PromptX welcome 工具', priority: 'medium' }, { diff --git a/src/lib/core/pouch/commands/InitCommand.js b/src/lib/core/pouch/commands/InitCommand.js index 3b28f84..e7550ac 100644 --- a/src/lib/core/pouch/commands/InitCommand.js +++ b/src/lib/core/pouch/commands/InitCommand.js @@ -120,7 +120,7 @@ class InitCommand extends BasePouchCommand { ${registryStats.message} ## 🚀 下一步建议 -- 使用 \`hello\` 发现可用的专业角色 +- 使用 \`welcome\` 发现可用的专业角色 - 使用 \`action\` 激活特定角色获得专业能力 - 使用 \`learn\` 深入学习专业知识 - 使用 \`remember/recall\` 管理专业记忆 @@ -231,12 +231,12 @@ ${registryStats.message} const version = await this.getVersionInfo() return { currentState: 'initialized', - availableTransitions: ['hello', 'action', 'learn', 'recall', 'remember'], + availableTransitions: ['welcome', 'action', 'learn', 'recall', 'remember'], nextActions: [ { name: '发现专业角色', description: '查看所有可用的AI专业角色', - method: 'MCP PromptX hello 工具', + method: 'MCP PromptX welcome 工具', priority: 'recommended' }, { diff --git a/src/lib/core/pouch/commands/LearnCommand.js b/src/lib/core/pouch/commands/LearnCommand.js index 53872c4..3700700 100644 --- a/src/lib/core/pouch/commands/LearnCommand.js +++ b/src/lib/core/pouch/commands/LearnCommand.js @@ -165,7 +165,7 @@ ${errorMessage} - 继续学习: 使用 MCP PromptX learn 工具学习其他资源 - 应用记忆: 使用 MCP PromptX recall 工具检索相关经验 - 激活角色: 使用 MCP PromptX action 工具激活完整角色能力 - - 查看角色列表: 使用 MCP PromptX hello 工具选择其他角色` + - 查看角色列表: 使用 MCP PromptX welcome 工具选择其他角色` } /** @@ -198,11 +198,11 @@ ${errorMessage} ## 🔍 发现可学习资源 - 使用 MCP PromptX action 工具查看角色需要的所有资源 -- 使用 MCP PromptX hello 工具查看可用角色列表 +- 使用 MCP PromptX welcome 工具查看可用角色列表 🔄 下一步行动: - 激活角色: 使用 MCP PromptX action 工具分析角色依赖 - - 查看角色: 使用 MCP PromptX hello 工具选择感兴趣的角色` + - 查看角色: 使用 MCP PromptX welcome 工具选择感兴趣的角色` } /** @@ -214,12 +214,12 @@ ${errorMessage} if (!resourceUrl) { return { currentState: 'learn_awaiting_resource', - availableTransitions: ['hello', 'action'], + availableTransitions: ['welcome', 'action'], nextActions: [ { name: '查看可用角色', description: '返回角色选择页面', - method: 'MCP PromptX hello 工具', + method: 'MCP PromptX welcome 工具', priority: 'high' }, { @@ -236,7 +236,7 @@ ${errorMessage} if (!urlMatch) { return { currentState: 'learn_error', - availableTransitions: ['hello', 'action'], + availableTransitions: ['welcome', 'action'], nextActions: [ { name: '查看使用帮助', @@ -252,7 +252,7 @@ ${errorMessage} return { currentState: `learned_${protocol}`, - availableTransitions: ['learn', 'recall', 'hello', 'action'], + availableTransitions: ['learn', 'recall', 'welcome', 'action'], nextActions: [ { name: '继续学习', @@ -275,7 +275,7 @@ ${errorMessage} { name: '查看角色列表', description: '选择其他角色', - method: 'MCP PromptX hello 工具', + method: 'MCP PromptX welcome 工具', priority: 'low' } ], diff --git a/src/lib/core/pouch/commands/LearnCommand.js.backup b/src/lib/core/pouch/commands/LearnCommand.js.backup deleted file mode 100644 index c6528e2..0000000 --- a/src/lib/core/pouch/commands/LearnCommand.js.backup +++ /dev/null @@ -1,279 +0,0 @@ -const BasePouchCommand = require('../BasePouchCommand') -const ResourceManager = require('../../resource/resourceManager') -const DPMLContentParser = require('../../dpml/DPMLContentParser') -const SemanticRenderer = require('../../dpml/SemanticRenderer') -const { COMMANDS } = require('../../../../constants') - -/** - * 智能学习锦囊命令 - * 支持加载thought、execution、memory等协议资源,以及角色的personality、principle、knowledge - * 支持语义占位符渲染,将@引用展开为完整的语义内容 - */ -class LearnCommand extends BasePouchCommand { - constructor () { - super() - this.resourceManager = new ResourceManager() - this.dpmlParser = new DPMLContentParser() - this.semanticRenderer = new SemanticRenderer() - } - - getPurpose () { - return '智能学习指定协议的资源内容,支持thought、execution、memory等DPML协议以及角色组件,支持@引用的语义渲染' - } - - async getContent (args) { - const [resourceUrl] = args - - if (!resourceUrl) { - return this.getUsageHelp() - } - - try { - // 解析协议信息 - const urlMatch = resourceUrl.match(/^(@[!?]?)?([a-zA-Z][a-zA-Z0-9_-]*):\/\/(.+)$/) - if (!urlMatch) { - return this.formatErrorResponse(resourceUrl, '无效的资源URL格式') - } - - const [, loadingSemantic, protocol, resourceId] = urlMatch - - // 使用ResourceManager解析资源 - const result = await this.resourceManager.resolve(resourceUrl) - - if (!result.success) { - return this.formatErrorResponse(resourceUrl, result.error.message) - } - - // 检查内容是否包含@引用,如果包含则进行语义渲染 - let finalContent = result.content - - if (this.containsReferences(result.content)) { - // 对于完整的DPML标签(如...),提取标签内容进行渲染 - const innerContent = this.extractTagInnerContent(result.content, protocol) - - if (innerContent) { - // 解析标签内的混合内容(@引用 + 直接内容) - const tagSemantics = this.dpmlParser.parseTagContent(innerContent, protocol) - - // 使用SemanticRenderer进行语义占位符渲染 - const renderedInnerContent = await this.semanticRenderer.renderSemanticContent(tagSemantics, this.resourceManager) - - // 如果渲染成功,重新包装为完整的DPML标签 - if (renderedInnerContent && renderedInnerContent.trim()) { - finalContent = `<${protocol}>\n${renderedInnerContent}\n` - } - } - } - - return this.formatSuccessResponse(protocol, resourceId, finalContent) - } catch (error) { - return this.formatErrorResponse(resourceUrl, error.message) - } - } - - /** - * 检查内容是否包含@引用 - * @param {string} content - 要检查的内容 - * @returns {boolean} 是否包含@引用 - */ - containsReferences(content) { - const resourceRegex = /@([!?]?)([a-zA-Z][a-zA-Z0-9_-]*):\/\/([a-zA-Z0-9_\/.,-]+)/g - return resourceRegex.test(content) - } - - /** - * 提取完整的DPML标签内容 - * @param {string} content - 要提取的内容 - * @param {string} protocol - 协议 - * @returns {string} 提取的完整DPML标签内容 - */ - extractTagInnerContent(content, protocol) { - const tagRegex = new RegExp(`<${protocol}>([\\s\\S]*?)<\\/${protocol}>`, 'i') - const match = content.match(tagRegex) - return match ? match[1].trim() : null - } - - /** - * 格式化成功响应 - */ - formatSuccessResponse (protocol, resourceId, content) { - const protocolLabels = { - thought: '🧠 思维模式', - execution: '⚡ 执行模式', - memory: '💾 记忆模式', - personality: '👤 角色人格', - principle: '⚖️ 行为原则', - knowledge: '📚 专业知识' - } - - const label = protocolLabels[protocol] || `📄 ${protocol}` - - return `✅ **成功学习${label}:${resourceId}** - -## 📋 学习内容 - -${content} - -## 🎯 学习效果 -- ✅ **已激活${label}能力** -- ✅ **相关知识已整合到AI认知体系** -- ✅ **可立即应用于实际场景** - -## 🔄 下一步行动: -- 继续学习: 使用 MCP PromptX learn 工具学习其他相关资源 -- 应用记忆: 使用 MCP PromptX recall 工具检索相关经验 -- 激活角色: 使用 MCP PromptX action 工具激活完整角色能力 - -📍 当前状态:learned_${protocol}` - } - - /** - * 格式化错误响应 - */ - formatErrorResponse (resourceUrl, errorMessage) { - return `❌ 学习资源失败:${resourceUrl} - -🔍 错误详情: -${errorMessage} - -💡 支持的协议: -- \`thought://resource-id\` - 学习思维模式 -- \`execution://resource-id\` - 学习执行模式 -- \`memory://resource-id\` - 学习记忆模式 -- \`personality://role-id\` - 学习角色思维 -- \`principle://role-id\` - 学习角色原则 -- \`knowledge://role-id\` - 学习角色知识 - -🔍 查看可用资源: -使用 MCP PromptX action 工具查看角色的所有依赖 - -🔄 下一步行动: - - 继续学习: 使用 MCP PromptX learn 工具学习其他资源 - - 应用记忆: 使用 MCP PromptX recall 工具检索相关经验 - - 激活角色: 使用 MCP PromptX action 工具激活完整角色能力 - - 查看角色列表: 使用 MCP PromptX hello 工具选择其他角色` - } - - /** - * 获取使用帮助 - */ - getUsageHelp () { - return `🎓 **Learn锦囊 - 智能学习系统** - -## 📖 基本用法 -\`\`\`bash -promptx learn :// -\`\`\` - -## 🎯 支持的协议 - -### 🔧 DPML核心协议 -- **\`thought://\`** - 思维模式资源 -- **\`execution://\`** - 执行模式资源 -- **\`memory://\`** - 记忆系统资源 - -### 👤 角色组件协议 -- **\`personality://\`** - 角色人格特征 -- **\`principle://\`** - 行为原则 -- **\`knowledge://\`** - 专业知识 - -## 📝 使用示例 -通过 MCP PromptX learn 工具学习各种资源: -- 学习执行技能: `execution://deal-at-reference` -- 学习思维模式: `thought://prompt-developer` -- 学习角色人格: `personality://video-copywriter` - -## 🔍 发现可学习资源 -- 使用 MCP PromptX action 工具查看角色需要的所有资源 -- 使用 MCP PromptX hello 工具查看可用角色列表 - -🔄 下一步行动: - - 激活角色: 使用 MCP PromptX action 工具分析角色依赖 - - 查看角色: 使用 MCP PromptX hello 工具选择感兴趣的角色` - } - - /** - * 获取PATEOAS导航信息 - */ - getPATEOAS (args) { - const [resourceUrl] = args - - if (!resourceUrl) { - return { - currentState: 'learn_awaiting_resource', - availableTransitions: ['hello', 'action'], - nextActions: [ - { - name: '查看可用角色', - description: '返回角色选择页面', - command: COMMANDS.HELLO, - priority: 'high' - }, - { - name: '生成学习计划', - description: '为特定角色生成学习计划', - method: 'MCP PromptX action 工具', - priority: 'high' - } - ] - } - } - - const urlMatch = resourceUrl.match(/^([a-zA-Z]+):\/\/(.+)$/) - if (!urlMatch) { - return { - currentState: 'learn_error', - availableTransitions: ['hello', 'action'], - nextActions: [ - { - name: '查看使用帮助', - description: '重新学习命令使用方法', - command: COMMANDS.LEARN, - priority: 'high' - } - ] - } - } - - const [, protocol, resourceId] = urlMatch - - return { - currentState: `learned_${protocol}`, - availableTransitions: ['learn', 'recall', 'hello', 'action'], - nextActions: [ - { - name: '继续学习', - description: '学习其他资源', - command: buildCommand.learn('://'), - priority: 'medium' - }, - { - name: '应用记忆', - description: '检索相关经验', - command: COMMANDS.RECALL, - priority: 'medium' - }, - { - name: '激活角色', - description: '激活完整角色能力', - command: buildCommand.action(''), - priority: 'high' - }, - { - name: '查看角色列表', - description: '选择其他角色', - command: COMMANDS.HELLO, - priority: 'low' - } - ], - metadata: { - learnedResource: resourceUrl, - protocol, - resourceId, - systemVersion: '锦囊串联状态机 v1.0' - } - } - } -} - -module.exports = LearnCommand diff --git a/src/lib/core/pouch/commands/RecallCommand.js b/src/lib/core/pouch/commands/RecallCommand.js index 71c7e32..f1052d3 100644 --- a/src/lib/core/pouch/commands/RecallCommand.js +++ b/src/lib/core/pouch/commands/RecallCommand.js @@ -66,12 +66,12 @@ ${formattedMemories} return { currentState, - availableTransitions: ['hello', 'remember', 'learn', 'recall'], + availableTransitions: ['welcome', 'remember', 'learn', 'recall'], nextActions: [ { name: '选择角色', description: '选择专业角色来应用检索到的知识', - method: 'MCP PromptX hello 工具' + method: 'MCP PromptX welcome 工具' }, { name: '记忆新知识', diff --git a/src/lib/core/pouch/commands/RegisterCommand.js b/src/lib/core/pouch/commands/RegisterCommand.js index b150b16..90b2afd 100644 --- a/src/lib/core/pouch/commands/RegisterCommand.js +++ b/src/lib/core/pouch/commands/RegisterCommand.js @@ -174,12 +174,12 @@ class RegisterCommand extends BasePouchCommand { if (!roleId) { return { currentState: 'register_awaiting_role', - availableTransitions: ['hello', 'action'], + availableTransitions: ['welcome', 'action'], nextActions: [ { name: '查看可用角色', description: '查看已注册的角色', - method: 'MCP PromptX hello 工具', + method: 'MCP PromptX welcome 工具', priority: 'medium' }, { @@ -197,7 +197,7 @@ class RegisterCommand extends BasePouchCommand { return { currentState: 'register_completed', - availableTransitions: ['action', 'hello'], + availableTransitions: ['action', 'welcome'], nextActions: [ { name: '激活角色', @@ -208,7 +208,7 @@ class RegisterCommand extends BasePouchCommand { { name: '查看所有角色', description: '查看角色列表', - method: 'MCP PromptX hello 工具', + method: 'MCP PromptX welcome 工具', priority: 'medium' } ], diff --git a/src/lib/core/pouch/commands/RememberCommand.js b/src/lib/core/pouch/commands/RememberCommand.js index 526854a..41b3ee2 100644 --- a/src/lib/core/pouch/commands/RememberCommand.js +++ b/src/lib/core/pouch/commands/RememberCommand.js @@ -201,12 +201,12 @@ AI学习和内化各种专业知识: if (!content) { return { currentState: 'remember_awaiting_input', - availableTransitions: ['hello', 'learn', 'recall'], + availableTransitions: ['welcome', 'learn', 'recall'], nextActions: [ { name: '查看角色', description: '选择角色获取专业知识', - method: 'MCP PromptX hello 工具', + method: 'MCP PromptX welcome 工具', priority: 'medium' }, { diff --git a/src/lib/core/pouch/commands/HelloCommand.js b/src/lib/core/pouch/commands/WelcomeCommand.js similarity index 94% rename from src/lib/core/pouch/commands/HelloCommand.js rename to src/lib/core/pouch/commands/WelcomeCommand.js index db4930f..5642079 100644 --- a/src/lib/core/pouch/commands/HelloCommand.js +++ b/src/lib/core/pouch/commands/WelcomeCommand.js @@ -6,10 +6,10 @@ const CurrentProjectManager = require('../../../utils/CurrentProjectManager') const logger = require('../../../utils/logger') /** - * 角色发现锦囊命令 + * 角色欢迎锦囊命令 * 负责展示可用的AI角色和领域专家 */ -class HelloCommand extends BasePouchCommand { +class WelcomeCommand extends BasePouchCommand { constructor () { super() // 使用全局单例 ResourceManager @@ -264,16 +264,16 @@ class HelloCommand extends BasePouchCommand { * 获取角色信息(提供给其他命令使用) */ async getRoleInfo (roleId) { - logger.debug(`[HelloCommand] getRoleInfo调用,角色ID: ${roleId}`) + logger.debug(`[WelcomeCommand] getRoleInfo调用,角色ID: ${roleId}`) const registry = await this.loadRoleRegistry() - logger.debug(`[HelloCommand] 注册表加载完成,包含角色:`, Object.keys(registry)) + logger.debug(`[WelcomeCommand] 注册表加载完成,包含角色:`, Object.keys(registry)) const roleData = registry[roleId] - logger.debug(`[HelloCommand] 查找角色${roleId}结果:`, roleData ? '找到' : '未找到') + logger.debug(`[WelcomeCommand] 查找角色${roleId}结果:`, roleData ? '找到' : '未找到') if (!roleData) { - logger.debug(`[HelloCommand] 角色${roleId}在注册表中不存在`) + logger.debug(`[WelcomeCommand] 角色${roleId}在注册表中不存在`) return null } @@ -284,7 +284,7 @@ class HelloCommand extends BasePouchCommand { file: roleData.file } - logger.debug(`[HelloCommand] 返回角色信息:`, result) + logger.debug(`[WelcomeCommand] 返回角色信息:`, result) return result } @@ -310,7 +310,7 @@ class HelloCommand extends BasePouchCommand { async debugRegistry() { await this.loadRoleRegistry() - logger.info('\n🔍 HelloCommand - 注册表调试信息') + logger.info('\n🔍 WelcomeCommand - 注册表调试信息') logger.info('='.repeat(50)) if (this.roleRegistry && Object.keys(this.roleRegistry).length > 0) { @@ -400,4 +400,4 @@ ${divider} } } -module.exports = HelloCommand +module.exports = WelcomeCommand diff --git a/src/lib/core/pouch/commands/index.js b/src/lib/core/pouch/commands/index.js index c7ddbb3..ebeeac3 100644 --- a/src/lib/core/pouch/commands/index.js +++ b/src/lib/core/pouch/commands/index.js @@ -3,7 +3,7 @@ */ const InitCommand = require('./InitCommand') -const HelloCommand = require('./HelloCommand') +const WelcomeCommand = require('./WelcomeCommand') const ActionCommand = require('./ActionCommand') const LearnCommand = require('./LearnCommand') const RecallCommand = require('./RecallCommand') @@ -12,7 +12,7 @@ const DACPCommand = require('./DACPCommand') module.exports = { InitCommand, - HelloCommand, + WelcomeCommand, ActionCommand, LearnCommand, RecallCommand, diff --git a/src/lib/core/pouch/state/PouchStateMachine.js b/src/lib/core/pouch/state/PouchStateMachine.js index 8b80b81..8c8b1ff 100644 --- a/src/lib/core/pouch/state/PouchStateMachine.js +++ b/src/lib/core/pouch/state/PouchStateMachine.js @@ -84,11 +84,11 @@ class PouchStateMachine { */ getAvailableTransitions () { const transitions = { - initial: ['init', 'hello'], - initialized: ['hello', 'action', 'learn'], + initial: ['init', 'welcome'], + initialized: ['welcome', 'action', 'learn'], discovering: ['action', 'learn', 'init'], - activated: ['learn', 'recall', 'hello'], - learned: ['action', 'recall', 'hello'], + activated: ['learn', 'recall', 'welcome'], + learned: ['action', 'recall', 'welcome'], recalled: ['action', 'learn', 'remember'] } @@ -100,7 +100,7 @@ class PouchStateMachine { } // 默认可转换状态 - return ['hello', 'init'] + return ['welcome', 'init'] } /** diff --git a/src/lib/mcp/toolDefinitions.js b/src/lib/mcp/toolDefinitions.js index f6d1fc3..5032b3a 100644 --- a/src/lib/mcp/toolDefinitions.js +++ b/src/lib/mcp/toolDefinitions.js @@ -26,7 +26,7 @@ const TOOL_DEFINITIONS = [ }) }, { - name: 'promptx_hello', + name: 'promptx_welcome', description: '🎭 [专业角色选择菜单] 🔥 当你需要专业能力时必须先看这个 - 展示大量可激活的专家身份清单:产品经理/Java开发者/UI设计师/文案策划师/数据分析师/项目经理等,每个角色都有完整的专业思维模式和工作技能。🛑 **重要**:使用此工具时必须首先关注并响应工具返回结果开头的项目环境验证提示,确认项目路径正确后再处理角色列表内容,看完后选择最适合当前任务的专家身份', inputSchema: { type: 'object', diff --git a/src/scripts/test-pouch.js b/src/scripts/test-pouch.js index 0332ab6..8ab2534 100644 --- a/src/scripts/test-pouch.js +++ b/src/scripts/test-pouch.js @@ -14,8 +14,8 @@ async function testPouchFramework () { console.log('\n') // 测试2: 发现角色 - console.log('2️⃣ 测试 hello 命令:') - await cli.execute('hello') + console.log('2️⃣ 测试 welcome 命令:') + await cli.execute('welcome') console.log('\n') // 测试3: 激活角色