fix: 系统化优化角色输出显示,解决角色名称混淆问题

- 优化WelcomeCommand输出格式,角色列表显示为 `id` - name 格式
- 优化ActionCommand输出格式,激活成功时显示 `id` (name) 格式
- 更新package.registry.json中7个角色的name和description:
  * nuwa: "Nuwa 角色" → "女娲",描述更新为专业的角色创造能力
  * sean: "Sean 角色" → "Sean",描述更新为CEO身份
  * product-manager: 更新为"产品经理",描述强调价值平衡能力
  * java-backend-developer: 更新为"Java后端开发工程师",描述强调架构能力
  * frontend-developer: 更新为"前端开发工程师",描述强调用户体验
  * xiaohongshu-marketer: 更新为"小红书营销专家",描述强调平台运营
  * assistant: 更新为"总经理秘书",描述强调执行和协调能力
- 解决角色名称显示不一致和描述过于通用的问题
- 提升用户体验,避免角色身份混淆

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
sean
2025-06-26 16:24:07 +08:00
parent 1cc01bf1ef
commit 5181bfeff1
3 changed files with 29 additions and 30 deletions

View File

@ -75,7 +75,7 @@ class ActionCommand extends BasePouchCommand {
const dependencies = await this.analyzeRoleDependencies(roleInfo)
// 3. 生成学习计划并直接加载所有内容
return await this.generateLearningPlan(roleInfo.id, dependencies)
return await this.generateLearningPlan(roleInfo, dependencies)
} catch (error) {
logger.error('Action command error:', error)
return `❌ 激活角色 "${roleId}" 时发生错误。
@ -325,10 +325,11 @@ ${result.content}
/**
* 生成学习计划并直接加载所有内容(包含完整的角色语义)
*/
async generateLearningPlan (roleId, dependencies) {
async generateLearningPlan (roleInfo, dependencies) {
const { thoughts, executions, roleSemantics } = dependencies
const { id: roleId } = roleInfo
let content = `🎭 **角色激活完成:${roleId}** - 所有技能已自动加载\n`
let content = `🎭 **角色激活完成:\`${roleId}\` (${roleInfo.name})** - 所有技能已自动加载\n`
// 加载思维模式技能仅包含独立的thought引用
if (thoughts.size > 0) {
@ -388,7 +389,7 @@ ${result.content}
// 激活总结
content += `# 🎯 角色激活总结\n`
content += `✅ **${roleId} 角色已完全激活!**\n`
content += `✅ **\`${roleId}\` (${roleInfo.name}) 角色已完全激活!**\n`
content += `📋 **已获得能力**\n`
if (thoughts.size > 0) content += `- 🧠 思维模式:${Array.from(thoughts).join(', ')}\n`
if (executions.size > 0) content += `- ⚡ 执行技能:${Array.from(executions).join(', ')}\n`
@ -402,7 +403,7 @@ ${result.content}
content += `- 🎭 角色组件:${roleComponents.join(', ')}\n`
}
content += `💡 **现在可以立即开始以 ${roleId} 身份提供专业服务!**\n`
content += `💡 **现在可以立即开始以 \`${roleId}\` (${roleInfo.name}) 身份提供专业服务!**\n`
// 自动执行 recall 命令
content += await this.executeRecall(roleId)

View File

@ -201,10 +201,8 @@ class WelcomeCommand extends BasePouchCommand {
content += `### ${sourceLabel}\n\n`
rolesBySource[source].forEach(role => {
content += `#### ${roleIndex}. ${role.name}
**角色ID**: \`${role.id}\`
content += `#### ${roleIndex}. \`${role.id}\` - ${role.name}
**专业能力**: ${role.description}
**文件路径**: ${role.file}
**来源**: ${sourceLabel}
---

View File

@ -5,7 +5,7 @@
"version": "2.0.0",
"description": "package 级资源注册表",
"createdAt": "2025-06-22T07:24:56.208Z",
"updatedAt": "2025-06-22T07:24:56.212Z",
"updatedAt": "2025-06-26T08:15:31.756Z",
"resourceCount": 51
},
"resources": [
@ -13,12 +13,12 @@
"id": "assistant",
"source": "package",
"protocol": "role",
"name": "Assistant 角色",
"description": "专业角色,提供特定领域的专业能力",
"name": "总经理秘书",
"description": "高效执行与协调沟通专家,具备前瞻性服务能力",
"reference": "@package://prompt/domain/assistant/assistant.role.md",
"metadata": {
"createdAt": "2025-06-22T07:24:56.209Z",
"updatedAt": "2025-06-22T07:24:56.209Z",
"updatedAt": "2025-06-26T08:15:31.753Z",
"scannedAt": "2025-06-22T07:24:56.209Z"
}
},
@ -52,12 +52,12 @@
"id": "frontend-developer",
"source": "package",
"protocol": "role",
"name": "Frontend Developer 角色",
"description": "专业角色,提供特定领域的专业能力",
"name": "前端开发工程师",
"description": "用户体验与前端技术专家,注重代码质量",
"reference": "@package://prompt/domain/frontend-developer/frontend-developer.role.md",
"metadata": {
"createdAt": "2025-06-22T07:24:56.210Z",
"updatedAt": "2025-06-22T07:24:56.210Z",
"updatedAt": "2025-06-26T08:15:31.755Z",
"scannedAt": "2025-06-22T07:24:56.210Z"
}
},
@ -143,12 +143,12 @@
"id": "java-backend-developer",
"source": "package",
"protocol": "role",
"name": "Java Backend Developer 角色",
"description": "专业角色,提供特定领域的专业能力",
"name": "Java后端开发工程师",
"description": "系统架构与后端开发专家精通Spring生态",
"reference": "@package://prompt/domain/java-backend-developer/java-backend-developer.role.md",
"metadata": {
"createdAt": "2025-06-22T07:24:56.210Z",
"updatedAt": "2025-06-22T07:24:56.210Z",
"updatedAt": "2025-06-26T08:15:31.755Z",
"scannedAt": "2025-06-22T07:24:56.210Z"
}
},
@ -221,12 +221,12 @@
"id": "nuwa",
"source": "package",
"protocol": "role",
"name": "Nuwa 角色",
"description": "专业角色,提供特定领域的专业能力",
"name": "女娲",
"description": "AI角色创造专家精通PromptX角色系统设计",
"reference": "@package://prompt/domain/nuwa/nuwa.role.md",
"metadata": {
"createdAt": "2025-06-22T07:24:56.211Z",
"updatedAt": "2025-06-22T07:24:56.211Z",
"updatedAt": "2025-06-26T08:15:31.756Z",
"scannedAt": "2025-06-22T07:24:56.211Z"
}
},
@ -299,12 +299,12 @@
"id": "product-manager",
"source": "package",
"protocol": "role",
"name": "Product Manager 角色",
"description": "专业角色,提供特定领域的专业能力",
"name": "产品经理",
"description": "用户价值与商业价值平衡专家,具备全面产品管理能力",
"reference": "@package://prompt/domain/product-manager/product-manager.role.md",
"metadata": {
"createdAt": "2025-06-22T07:24:56.211Z",
"updatedAt": "2025-06-22T07:24:56.211Z",
"updatedAt": "2025-06-26T08:15:31.756Z",
"scannedAt": "2025-06-22T07:24:56.211Z"
}
},
@ -364,12 +364,12 @@
"id": "sean",
"source": "package",
"protocol": "role",
"name": "Sean 角色",
"description": "专业角色,提供特定领域的专业能力",
"name": "Sean",
"description": "deepractice.ai创始人&CEO专注AI产品创新",
"reference": "@package://prompt/domain/sean/sean.role.md",
"metadata": {
"createdAt": "2025-06-22T07:24:56.211Z",
"updatedAt": "2025-06-22T07:24:56.211Z",
"updatedAt": "2025-06-26T08:15:31.756Z",
"scannedAt": "2025-06-22T07:24:56.211Z"
}
},
@ -455,12 +455,12 @@
"id": "xiaohongshu-marketer",
"source": "package",
"protocol": "role",
"name": "Xiaohongshu Marketer 角色",
"description": "专业角色,提供特定领域的专业能力",
"name": "小红书营销专家",
"description": "内容营销与用户增长专家,精通小红书平台运营",
"reference": "@package://prompt/domain/xiaohongshu-marketer/xiaohongshu-marketer.role.md",
"metadata": {
"createdAt": "2025-06-22T07:24:56.212Z",
"updatedAt": "2025-06-22T07:24:56.212Z",
"updatedAt": "2025-06-26T08:15:31.756Z",
"scannedAt": "2025-06-22T07:24:56.212Z"
}
},