refactor: 完成domain到role目录结构统一和硬编码清理
## 核心变更 1. **女娲角色知识更新** - dpml-authoring.execution.md: 更新镜像结构约束为.promptx/resource/role/ - role-generation.execution.md: 4处domain路径更新为role - role-creation.thought.md: 文件组织思维从domain改为role 2. **命令类硬编码清理** - InitCommand.js: 移除domain目录创建,改为按需创建 - RegisterCommand.js: 使用ResourceManager协议查找替代硬编码路径 - WelcomeCommand.js: 简化loadRoleRegistry()方法,直接使用注册表 3. **包注册表同步** - 重新生成package.registry.json确保资源发现一致性 ## 技术价值 - ✅ 统一目录语义:role比domain更准确描述AI角色 - ✅ 清理边角料代码:移除不必要的硬编码路径依赖 - ✅ 增强系统架构:基于注册表的资源发现更稳定 - ✅ 女娲知识同步:包含最新的role目录结构认知 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -4,8 +4,8 @@
|
||||
"metadata": {
|
||||
"version": "2.0.0",
|
||||
"description": "package 级资源注册表",
|
||||
"createdAt": "2025-06-28T11:40:17.935Z",
|
||||
"updatedAt": "2025-06-28T11:40:17.951Z",
|
||||
"createdAt": "2025-06-28T11:53:03.703Z",
|
||||
"updatedAt": "2025-06-28T11:53:03.717Z",
|
||||
"resourceCount": 29
|
||||
},
|
||||
"resources": [
|
||||
@ -17,9 +17,9 @@
|
||||
"description": "专业角色,提供特定领域的专业能力",
|
||||
"reference": "@package://resource/role/assistant/assistant.role.md",
|
||||
"metadata": {
|
||||
"createdAt": "2025-06-28T11:40:17.941Z",
|
||||
"updatedAt": "2025-06-28T11:40:17.941Z",
|
||||
"scannedAt": "2025-06-28T11:40:17.941Z",
|
||||
"createdAt": "2025-06-28T11:53:03.708Z",
|
||||
"updatedAt": "2025-06-28T11:53:03.708Z",
|
||||
"scannedAt": "2025-06-28T11:53:03.708Z",
|
||||
"filePath": "/Users/sean/Management/ContradictionManagement/projects/PromptX/resource/role/assistant/assistant.role.md",
|
||||
"fileType": "role"
|
||||
}
|
||||
@ -32,9 +32,9 @@
|
||||
"description": "专业角色,提供特定领域的专业能力",
|
||||
"reference": "@package://resource/role/luban/luban.role.md",
|
||||
"metadata": {
|
||||
"createdAt": "2025-06-28T11:40:17.941Z",
|
||||
"updatedAt": "2025-06-28T11:40:17.941Z",
|
||||
"scannedAt": "2025-06-28T11:40:17.941Z",
|
||||
"createdAt": "2025-06-28T11:53:03.708Z",
|
||||
"updatedAt": "2025-06-28T11:53:03.708Z",
|
||||
"scannedAt": "2025-06-28T11:53:03.708Z",
|
||||
"filePath": "/Users/sean/Management/ContradictionManagement/projects/PromptX/resource/role/luban/luban.role.md",
|
||||
"fileType": "role"
|
||||
}
|
||||
@ -47,9 +47,9 @@
|
||||
"description": "专业角色,提供特定领域的专业能力",
|
||||
"reference": "@package://resource/role/noface/noface.role.md",
|
||||
"metadata": {
|
||||
"createdAt": "2025-06-28T11:40:17.942Z",
|
||||
"updatedAt": "2025-06-28T11:40:17.942Z",
|
||||
"scannedAt": "2025-06-28T11:40:17.942Z",
|
||||
"createdAt": "2025-06-28T11:53:03.708Z",
|
||||
"updatedAt": "2025-06-28T11:53:03.708Z",
|
||||
"scannedAt": "2025-06-28T11:53:03.708Z",
|
||||
"filePath": "/Users/sean/Management/ContradictionManagement/projects/PromptX/resource/role/noface/noface.role.md",
|
||||
"fileType": "role"
|
||||
}
|
||||
@ -62,9 +62,9 @@
|
||||
"description": "专业角色,提供特定领域的专业能力",
|
||||
"reference": "@package://resource/role/nuwa/nuwa.role.md",
|
||||
"metadata": {
|
||||
"createdAt": "2025-06-28T11:40:17.942Z",
|
||||
"updatedAt": "2025-06-28T11:40:17.942Z",
|
||||
"scannedAt": "2025-06-28T11:40:17.942Z",
|
||||
"createdAt": "2025-06-28T11:53:03.709Z",
|
||||
"updatedAt": "2025-06-28T11:53:03.709Z",
|
||||
"scannedAt": "2025-06-28T11:53:03.709Z",
|
||||
"filePath": "/Users/sean/Management/ContradictionManagement/projects/PromptX/resource/role/nuwa/nuwa.role.md",
|
||||
"fileType": "role"
|
||||
}
|
||||
@ -77,9 +77,9 @@
|
||||
"description": "专业角色,提供特定领域的专业能力",
|
||||
"reference": "@package://resource/role/sean/sean.role.md",
|
||||
"metadata": {
|
||||
"createdAt": "2025-06-28T11:40:17.942Z",
|
||||
"updatedAt": "2025-06-28T11:40:17.942Z",
|
||||
"scannedAt": "2025-06-28T11:40:17.942Z",
|
||||
"createdAt": "2025-06-28T11:53:03.709Z",
|
||||
"updatedAt": "2025-06-28T11:53:03.709Z",
|
||||
"scannedAt": "2025-06-28T11:53:03.709Z",
|
||||
"filePath": "/Users/sean/Management/ContradictionManagement/projects/PromptX/resource/role/sean/sean.role.md",
|
||||
"fileType": "role"
|
||||
}
|
||||
@ -92,9 +92,9 @@
|
||||
"description": "思维模式,指导AI的思考方式",
|
||||
"reference": "@package://resource/core/_deprecated/recall_v1.thought.md",
|
||||
"metadata": {
|
||||
"createdAt": "2025-06-28T11:40:17.943Z",
|
||||
"updatedAt": "2025-06-28T11:40:17.943Z",
|
||||
"scannedAt": "2025-06-28T11:40:17.943Z",
|
||||
"createdAt": "2025-06-28T11:53:03.710Z",
|
||||
"updatedAt": "2025-06-28T11:53:03.710Z",
|
||||
"scannedAt": "2025-06-28T11:53:03.710Z",
|
||||
"filePath": "/Users/sean/Management/ContradictionManagement/projects/PromptX/resource/core/_deprecated/recall_v1.thought.md",
|
||||
"fileType": "thought"
|
||||
}
|
||||
@ -107,9 +107,9 @@
|
||||
"description": "思维模式,指导AI的思考方式",
|
||||
"reference": "@package://resource/core/_deprecated/remember_v1.thought.md",
|
||||
"metadata": {
|
||||
"createdAt": "2025-06-28T11:40:17.943Z",
|
||||
"updatedAt": "2025-06-28T11:40:17.943Z",
|
||||
"scannedAt": "2025-06-28T11:40:17.943Z",
|
||||
"createdAt": "2025-06-28T11:53:03.710Z",
|
||||
"updatedAt": "2025-06-28T11:53:03.710Z",
|
||||
"scannedAt": "2025-06-28T11:53:03.710Z",
|
||||
"filePath": "/Users/sean/Management/ContradictionManagement/projects/PromptX/resource/core/_deprecated/remember_v1.thought.md",
|
||||
"fileType": "thought"
|
||||
}
|
||||
@ -122,9 +122,9 @@
|
||||
"description": "思维模式,指导AI的思考方式",
|
||||
"reference": "@package://resource/core/remember-xml.thought.md",
|
||||
"metadata": {
|
||||
"createdAt": "2025-06-28T11:40:17.944Z",
|
||||
"updatedAt": "2025-06-28T11:40:17.944Z",
|
||||
"scannedAt": "2025-06-28T11:40:17.944Z",
|
||||
"createdAt": "2025-06-28T11:53:03.711Z",
|
||||
"updatedAt": "2025-06-28T11:53:03.711Z",
|
||||
"scannedAt": "2025-06-28T11:53:03.711Z",
|
||||
"filePath": "/Users/sean/Management/ContradictionManagement/projects/PromptX/resource/core/remember-xml.thought.md",
|
||||
"fileType": "thought"
|
||||
}
|
||||
@ -137,9 +137,9 @@
|
||||
"description": "思维模式,指导AI的思考方式",
|
||||
"reference": "@package://resource/core/remember.thought.md",
|
||||
"metadata": {
|
||||
"createdAt": "2025-06-28T11:40:17.944Z",
|
||||
"updatedAt": "2025-06-28T11:40:17.944Z",
|
||||
"scannedAt": "2025-06-28T11:40:17.944Z",
|
||||
"createdAt": "2025-06-28T11:53:03.711Z",
|
||||
"updatedAt": "2025-06-28T11:53:03.711Z",
|
||||
"scannedAt": "2025-06-28T11:53:03.711Z",
|
||||
"filePath": "/Users/sean/Management/ContradictionManagement/projects/PromptX/resource/core/remember.thought.md",
|
||||
"fileType": "thought"
|
||||
}
|
||||
@ -152,9 +152,9 @@
|
||||
"description": "思维模式,指导AI的思考方式",
|
||||
"reference": "@package://resource/role/assistant/thought/assistant.thought.md",
|
||||
"metadata": {
|
||||
"createdAt": "2025-06-28T11:40:17.944Z",
|
||||
"updatedAt": "2025-06-28T11:40:17.944Z",
|
||||
"scannedAt": "2025-06-28T11:40:17.944Z",
|
||||
"createdAt": "2025-06-28T11:53:03.711Z",
|
||||
"updatedAt": "2025-06-28T11:53:03.711Z",
|
||||
"scannedAt": "2025-06-28T11:53:03.711Z",
|
||||
"filePath": "/Users/sean/Management/ContradictionManagement/projects/PromptX/resource/role/assistant/thought/assistant.thought.md",
|
||||
"fileType": "thought"
|
||||
}
|
||||
@ -167,9 +167,9 @@
|
||||
"description": "思维模式,指导AI的思考方式",
|
||||
"reference": "@package://resource/role/luban/thought/craftsmanship.thought.md",
|
||||
"metadata": {
|
||||
"createdAt": "2025-06-28T11:40:17.944Z",
|
||||
"updatedAt": "2025-06-28T11:40:17.944Z",
|
||||
"scannedAt": "2025-06-28T11:40:17.944Z",
|
||||
"createdAt": "2025-06-28T11:53:03.711Z",
|
||||
"updatedAt": "2025-06-28T11:53:03.711Z",
|
||||
"scannedAt": "2025-06-28T11:53:03.711Z",
|
||||
"filePath": "/Users/sean/Management/ContradictionManagement/projects/PromptX/resource/role/luban/thought/craftsmanship.thought.md",
|
||||
"fileType": "thought"
|
||||
}
|
||||
@ -182,9 +182,9 @@
|
||||
"description": "思维模式,指导AI的思考方式",
|
||||
"reference": "@package://resource/role/nuwa/thought/role-creation.thought.md",
|
||||
"metadata": {
|
||||
"createdAt": "2025-06-28T11:40:17.945Z",
|
||||
"updatedAt": "2025-06-28T11:40:17.945Z",
|
||||
"scannedAt": "2025-06-28T11:40:17.945Z",
|
||||
"createdAt": "2025-06-28T11:53:03.711Z",
|
||||
"updatedAt": "2025-06-28T11:53:03.711Z",
|
||||
"scannedAt": "2025-06-28T11:53:03.711Z",
|
||||
"filePath": "/Users/sean/Management/ContradictionManagement/projects/PromptX/resource/role/nuwa/thought/role-creation.thought.md",
|
||||
"fileType": "thought"
|
||||
}
|
||||
@ -197,9 +197,9 @@
|
||||
"description": "执行模式,定义具体的行为模式",
|
||||
"reference": "@package://resource/role/assistant/execution/assistant.execution.md",
|
||||
"metadata": {
|
||||
"createdAt": "2025-06-28T11:40:17.946Z",
|
||||
"updatedAt": "2025-06-28T11:40:17.946Z",
|
||||
"scannedAt": "2025-06-28T11:40:17.946Z",
|
||||
"createdAt": "2025-06-28T11:53:03.712Z",
|
||||
"updatedAt": "2025-06-28T11:53:03.712Z",
|
||||
"scannedAt": "2025-06-28T11:53:03.712Z",
|
||||
"filePath": "/Users/sean/Management/ContradictionManagement/projects/PromptX/resource/role/assistant/execution/assistant.execution.md",
|
||||
"fileType": "execution"
|
||||
}
|
||||
@ -212,9 +212,9 @@
|
||||
"description": "执行模式,定义具体的行为模式",
|
||||
"reference": "@package://resource/role/luban/execution/tool-development-workflow.execution.md",
|
||||
"metadata": {
|
||||
"createdAt": "2025-06-28T11:40:17.946Z",
|
||||
"updatedAt": "2025-06-28T11:40:17.946Z",
|
||||
"scannedAt": "2025-06-28T11:40:17.946Z",
|
||||
"createdAt": "2025-06-28T11:53:03.713Z",
|
||||
"updatedAt": "2025-06-28T11:53:03.713Z",
|
||||
"scannedAt": "2025-06-28T11:53:03.713Z",
|
||||
"filePath": "/Users/sean/Management/ContradictionManagement/projects/PromptX/resource/role/luban/execution/tool-development-workflow.execution.md",
|
||||
"fileType": "execution"
|
||||
}
|
||||
@ -227,9 +227,9 @@
|
||||
"description": "执行模式,定义具体的行为模式",
|
||||
"reference": "@package://resource/role/luban/execution/toolsandbox-mastery.execution.md",
|
||||
"metadata": {
|
||||
"createdAt": "2025-06-28T11:40:17.946Z",
|
||||
"updatedAt": "2025-06-28T11:40:17.946Z",
|
||||
"scannedAt": "2025-06-28T11:40:17.946Z",
|
||||
"createdAt": "2025-06-28T11:53:03.713Z",
|
||||
"updatedAt": "2025-06-28T11:53:03.713Z",
|
||||
"scannedAt": "2025-06-28T11:53:03.713Z",
|
||||
"filePath": "/Users/sean/Management/ContradictionManagement/projects/PromptX/resource/role/luban/execution/toolsandbox-mastery.execution.md",
|
||||
"fileType": "execution"
|
||||
}
|
||||
@ -242,9 +242,9 @@
|
||||
"description": "执行模式,定义具体的行为模式",
|
||||
"reference": "@package://resource/role/noface/execution/adaptive-learning.execution.md",
|
||||
"metadata": {
|
||||
"createdAt": "2025-06-28T11:40:17.946Z",
|
||||
"updatedAt": "2025-06-28T11:40:17.946Z",
|
||||
"scannedAt": "2025-06-28T11:40:17.946Z",
|
||||
"createdAt": "2025-06-28T11:53:03.713Z",
|
||||
"updatedAt": "2025-06-28T11:53:03.713Z",
|
||||
"scannedAt": "2025-06-28T11:53:03.713Z",
|
||||
"filePath": "/Users/sean/Management/ContradictionManagement/projects/PromptX/resource/role/noface/execution/adaptive-learning.execution.md",
|
||||
"fileType": "execution"
|
||||
}
|
||||
@ -257,9 +257,9 @@
|
||||
"description": "执行模式,定义具体的行为模式",
|
||||
"reference": "@package://resource/role/noface/execution/content-preservation.execution.md",
|
||||
"metadata": {
|
||||
"createdAt": "2025-06-28T11:40:17.946Z",
|
||||
"updatedAt": "2025-06-28T11:40:17.946Z",
|
||||
"scannedAt": "2025-06-28T11:40:17.946Z",
|
||||
"createdAt": "2025-06-28T11:53:03.713Z",
|
||||
"updatedAt": "2025-06-28T11:53:03.713Z",
|
||||
"scannedAt": "2025-06-28T11:53:03.713Z",
|
||||
"filePath": "/Users/sean/Management/ContradictionManagement/projects/PromptX/resource/role/noface/execution/content-preservation.execution.md",
|
||||
"fileType": "execution"
|
||||
}
|
||||
@ -272,9 +272,9 @@
|
||||
"description": "执行模式,定义具体的行为模式",
|
||||
"reference": "@package://resource/role/nuwa/execution/dpml-authoring.execution.md",
|
||||
"metadata": {
|
||||
"createdAt": "2025-06-28T11:40:17.947Z",
|
||||
"updatedAt": "2025-06-28T11:40:17.947Z",
|
||||
"scannedAt": "2025-06-28T11:40:17.947Z",
|
||||
"createdAt": "2025-06-28T11:53:03.713Z",
|
||||
"updatedAt": "2025-06-28T11:53:03.713Z",
|
||||
"scannedAt": "2025-06-28T11:53:03.713Z",
|
||||
"filePath": "/Users/sean/Management/ContradictionManagement/projects/PromptX/resource/role/nuwa/execution/dpml-authoring.execution.md",
|
||||
"fileType": "execution"
|
||||
}
|
||||
@ -287,9 +287,9 @@
|
||||
"description": "执行模式,定义具体的行为模式",
|
||||
"reference": "@package://resource/role/nuwa/execution/role-design-patterns.execution.md",
|
||||
"metadata": {
|
||||
"createdAt": "2025-06-28T11:40:17.947Z",
|
||||
"updatedAt": "2025-06-28T11:40:17.947Z",
|
||||
"scannedAt": "2025-06-28T11:40:17.947Z",
|
||||
"createdAt": "2025-06-28T11:53:03.713Z",
|
||||
"updatedAt": "2025-06-28T11:53:03.713Z",
|
||||
"scannedAt": "2025-06-28T11:53:03.713Z",
|
||||
"filePath": "/Users/sean/Management/ContradictionManagement/projects/PromptX/resource/role/nuwa/execution/role-design-patterns.execution.md",
|
||||
"fileType": "execution"
|
||||
}
|
||||
@ -302,9 +302,9 @@
|
||||
"description": "执行模式,定义具体的行为模式",
|
||||
"reference": "@package://resource/role/nuwa/execution/role-generation.execution.md",
|
||||
"metadata": {
|
||||
"createdAt": "2025-06-28T11:40:17.947Z",
|
||||
"updatedAt": "2025-06-28T11:40:17.947Z",
|
||||
"scannedAt": "2025-06-28T11:40:17.947Z",
|
||||
"createdAt": "2025-06-28T11:53:03.714Z",
|
||||
"updatedAt": "2025-06-28T11:53:03.714Z",
|
||||
"scannedAt": "2025-06-28T11:53:03.714Z",
|
||||
"filePath": "/Users/sean/Management/ContradictionManagement/projects/PromptX/resource/role/nuwa/execution/role-generation.execution.md",
|
||||
"fileType": "execution"
|
||||
}
|
||||
@ -317,9 +317,9 @@
|
||||
"description": "执行模式,定义具体的行为模式",
|
||||
"reference": "@package://resource/role/nuwa/execution/visualization-enhancement.execution.md",
|
||||
"metadata": {
|
||||
"createdAt": "2025-06-28T11:40:17.947Z",
|
||||
"updatedAt": "2025-06-28T11:40:17.947Z",
|
||||
"scannedAt": "2025-06-28T11:40:17.947Z",
|
||||
"createdAt": "2025-06-28T11:53:03.714Z",
|
||||
"updatedAt": "2025-06-28T11:53:03.714Z",
|
||||
"scannedAt": "2025-06-28T11:53:03.714Z",
|
||||
"filePath": "/Users/sean/Management/ContradictionManagement/projects/PromptX/resource/role/nuwa/execution/visualization-enhancement.execution.md",
|
||||
"fileType": "execution"
|
||||
}
|
||||
@ -332,9 +332,9 @@
|
||||
"description": "执行模式,定义具体的行为模式",
|
||||
"reference": "@package://resource/role/sean/execution/template-adherence.execution.md",
|
||||
"metadata": {
|
||||
"createdAt": "2025-06-28T11:40:17.948Z",
|
||||
"updatedAt": "2025-06-28T11:40:17.948Z",
|
||||
"scannedAt": "2025-06-28T11:40:17.948Z",
|
||||
"createdAt": "2025-06-28T11:53:03.714Z",
|
||||
"updatedAt": "2025-06-28T11:53:03.714Z",
|
||||
"scannedAt": "2025-06-28T11:53:03.714Z",
|
||||
"filePath": "/Users/sean/Management/ContradictionManagement/projects/PromptX/resource/role/sean/execution/template-adherence.execution.md",
|
||||
"fileType": "execution"
|
||||
}
|
||||
@ -347,9 +347,9 @@
|
||||
"description": "知识库,提供专业知识和信息",
|
||||
"reference": "@package://resource/role/luban/knowledge/dpml-tool-tagging.knowledge.md",
|
||||
"metadata": {
|
||||
"createdAt": "2025-06-28T11:40:17.949Z",
|
||||
"updatedAt": "2025-06-28T11:40:17.949Z",
|
||||
"scannedAt": "2025-06-28T11:40:17.949Z",
|
||||
"createdAt": "2025-06-28T11:53:03.715Z",
|
||||
"updatedAt": "2025-06-28T11:53:03.715Z",
|
||||
"scannedAt": "2025-06-28T11:53:03.715Z",
|
||||
"filePath": "/Users/sean/Management/ContradictionManagement/projects/PromptX/resource/role/luban/knowledge/dpml-tool-tagging.knowledge.md",
|
||||
"fileType": "knowledge"
|
||||
}
|
||||
@ -362,9 +362,9 @@
|
||||
"description": "知识库,提供专业知识和信息",
|
||||
"reference": "@package://resource/role/luban/knowledge/javascript-ecosystem.knowledge.md",
|
||||
"metadata": {
|
||||
"createdAt": "2025-06-28T11:40:17.949Z",
|
||||
"updatedAt": "2025-06-28T11:40:17.949Z",
|
||||
"scannedAt": "2025-06-28T11:40:17.949Z",
|
||||
"createdAt": "2025-06-28T11:53:03.715Z",
|
||||
"updatedAt": "2025-06-28T11:53:03.715Z",
|
||||
"scannedAt": "2025-06-28T11:53:03.715Z",
|
||||
"filePath": "/Users/sean/Management/ContradictionManagement/projects/PromptX/resource/role/luban/knowledge/javascript-ecosystem.knowledge.md",
|
||||
"fileType": "knowledge"
|
||||
}
|
||||
@ -377,9 +377,9 @@
|
||||
"description": "知识库,提供专业知识和信息",
|
||||
"reference": "@package://resource/role/luban/knowledge/promptx-tool-architecture.knowledge.md",
|
||||
"metadata": {
|
||||
"createdAt": "2025-06-28T11:40:17.949Z",
|
||||
"updatedAt": "2025-06-28T11:40:17.949Z",
|
||||
"scannedAt": "2025-06-28T11:40:17.949Z",
|
||||
"createdAt": "2025-06-28T11:53:03.715Z",
|
||||
"updatedAt": "2025-06-28T11:53:03.715Z",
|
||||
"scannedAt": "2025-06-28T11:53:03.715Z",
|
||||
"filePath": "/Users/sean/Management/ContradictionManagement/projects/PromptX/resource/role/luban/knowledge/promptx-tool-architecture.knowledge.md",
|
||||
"fileType": "knowledge"
|
||||
}
|
||||
@ -392,9 +392,9 @@
|
||||
"description": "知识库,提供专业知识和信息",
|
||||
"reference": "@package://resource/role/luban/knowledge/tool-best-practices.knowledge.md",
|
||||
"metadata": {
|
||||
"createdAt": "2025-06-28T11:40:17.949Z",
|
||||
"updatedAt": "2025-06-28T11:40:17.949Z",
|
||||
"scannedAt": "2025-06-28T11:40:17.949Z",
|
||||
"createdAt": "2025-06-28T11:53:03.716Z",
|
||||
"updatedAt": "2025-06-28T11:53:03.716Z",
|
||||
"scannedAt": "2025-06-28T11:53:03.716Z",
|
||||
"filePath": "/Users/sean/Management/ContradictionManagement/projects/PromptX/resource/role/luban/knowledge/tool-best-practices.knowledge.md",
|
||||
"fileType": "knowledge"
|
||||
}
|
||||
@ -407,9 +407,9 @@
|
||||
"description": "知识库,提供专业知识和信息",
|
||||
"reference": "@package://resource/role/sean/knowledge/contradiction-methodology.knowledge.md",
|
||||
"metadata": {
|
||||
"createdAt": "2025-06-28T11:40:17.949Z",
|
||||
"updatedAt": "2025-06-28T11:40:17.949Z",
|
||||
"scannedAt": "2025-06-28T11:40:17.949Z",
|
||||
"createdAt": "2025-06-28T11:53:03.716Z",
|
||||
"updatedAt": "2025-06-28T11:53:03.716Z",
|
||||
"scannedAt": "2025-06-28T11:53:03.716Z",
|
||||
"filePath": "/Users/sean/Management/ContradictionManagement/projects/PromptX/resource/role/sean/knowledge/contradiction-methodology.knowledge.md",
|
||||
"fileType": "knowledge"
|
||||
}
|
||||
@ -422,9 +422,9 @@
|
||||
"description": "知识库,提供专业知识和信息",
|
||||
"reference": "@package://resource/role/sean/knowledge/product-philosophy.knowledge.md",
|
||||
"metadata": {
|
||||
"createdAt": "2025-06-28T11:40:17.950Z",
|
||||
"updatedAt": "2025-06-28T11:40:17.950Z",
|
||||
"scannedAt": "2025-06-28T11:40:17.950Z",
|
||||
"createdAt": "2025-06-28T11:53:03.716Z",
|
||||
"updatedAt": "2025-06-28T11:53:03.716Z",
|
||||
"scannedAt": "2025-06-28T11:53:03.716Z",
|
||||
"filePath": "/Users/sean/Management/ContradictionManagement/projects/PromptX/resource/role/sean/knowledge/product-philosophy.knowledge.md",
|
||||
"fileType": "knowledge"
|
||||
}
|
||||
@ -437,9 +437,9 @@
|
||||
"description": "知识库,提供专业知识和信息",
|
||||
"reference": "@package://resource/role/sean/knowledge/promptx-evolution.knowledge.md",
|
||||
"metadata": {
|
||||
"createdAt": "2025-06-28T11:40:17.950Z",
|
||||
"updatedAt": "2025-06-28T11:40:17.950Z",
|
||||
"scannedAt": "2025-06-28T11:40:17.950Z",
|
||||
"createdAt": "2025-06-28T11:53:03.716Z",
|
||||
"updatedAt": "2025-06-28T11:53:03.716Z",
|
||||
"scannedAt": "2025-06-28T11:53:03.716Z",
|
||||
"filePath": "/Users/sean/Management/ContradictionManagement/projects/PromptX/resource/role/sean/knowledge/promptx-evolution.knowledge.md",
|
||||
"fileType": "knowledge"
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
- **纯XML结构**:文件必须从根标签开始,不得包含任何XML结构外的内容
|
||||
- **文件纯净性**:除了标签结构外,不得包含任何其他内容
|
||||
- **引用规范性**:使用@!引用时必须遵循resource协议语法
|
||||
- **镜像结构约束**:用户资源必须遵循`.promptx/resource/domain/`结构
|
||||
- **镜像结构约束**:用户资源必须遵循`.promptx/resource/role/`结构
|
||||
</rule>
|
||||
|
||||
<guideline>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
- **文件格式要求**:生成的角色文件必须是有效的Markdown格式并符合XML语法
|
||||
- **系统集成约束**:生成的角色必须与PromptX系统兼容,支持ResourceManager发现机制
|
||||
- **快速生成要求**:整个创建过程应在1-2分钟内完成
|
||||
- **目录结构约束**:用户资源必须创建在`.promptx/resource/domain/{roleId}/`目录,镜像系统结构
|
||||
- **目录结构约束**:用户资源必须创建在`.promptx/resource/role/{roleId}/`目录,镜像系统结构
|
||||
- **文件组织约束**:角色相关的所有文件(execution、thought等)必须统一存放在角色目录下
|
||||
</constraint>
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
- **领域识别准确性**:必须准确识别用户需求的专业领域
|
||||
- **模板化生成**:基于标准模板快速生成,避免复杂的定制化过程
|
||||
- **一次性交付**:生成后直接交付,避免反复确认和修改
|
||||
- **镜像结构强制**:用户资源必须创建在`.promptx/resource/domain/{roleId}/`,镜像系统`prompt/domain/`结构
|
||||
- **镜像结构强制**:用户资源必须创建在`.promptx/resource/role/{roleId}/`,镜像系统`resource/role/`结构
|
||||
- **文件统一管理**:角色的execution、thought等扩展文件必须放在同一角色目录下,便于统一管理
|
||||
- **引用路径准确**:使用@!引用时必须指向正确的文件路径,确保引用关系有效
|
||||
</rule>
|
||||
@ -96,7 +96,7 @@
|
||||
**文件组织结构**:
|
||||
```mermaid
|
||||
graph LR
|
||||
A[.promptx/resource/domain/{roleId}/] --> B[{roleId}.role.md]
|
||||
A[.promptx/resource/role/{roleId}/] --> B[{roleId}.role.md]
|
||||
A --> C[thought/]
|
||||
A --> D[execution/]
|
||||
C --> E[{specific}.thought.md]
|
||||
@ -132,7 +132,7 @@
|
||||
✅ 角色创建成功!
|
||||
|
||||
📁 文件结构:
|
||||
.promptx/resource/domain/{roleId}/
|
||||
.promptx/resource/role/{roleId}/
|
||||
├── {roleId}.role.md
|
||||
└── [扩展文件...]
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
```
|
||||
|
||||
### 镜像结构思维模式
|
||||
- **结构一致性**:用户资源目录镜像系统`prompt/domain/`结构
|
||||
- **结构一致性**:用户资源目录镜像系统`resource/role/`结构
|
||||
- **认知负载最小化**:与系统结构保持一致,降低学习成本
|
||||
- **资源聚合原则**:角色相关的所有文件统一管理在角色目录下
|
||||
|
||||
@ -48,7 +48,7 @@
|
||||
- 常用工具和方法论
|
||||
|
||||
### 文件组织优化思维
|
||||
- **目录结构规划**:`.promptx/resource/domain/{roleId}/`
|
||||
- **目录结构规划**:`.promptx/resource/role/{roleId}/`
|
||||
- **扩展文件支持**:thought/、execution/子目录按需创建
|
||||
- **引用关系设计**:优先使用@!引用机制,实现模块化
|
||||
- **发现机制适配**:确保ResourceManager能正确发现和加载
|
||||
|
||||
@ -136,11 +136,10 @@ ${registryStats.message}
|
||||
// 1. 使用统一的目录服务获取项目根目录
|
||||
const projectRoot = await this.directoryService.getProjectRoot(context)
|
||||
const resourceDir = await this.directoryService.getResourceDirectory(context)
|
||||
const domainDir = path.join(resourceDir, 'domain')
|
||||
|
||||
// 2. 确保目录结构存在
|
||||
await fs.ensureDir(domainDir)
|
||||
logger.debug(`[InitCommand] 确保目录结构存在: ${domainDir}`)
|
||||
// 2. 确保资源目录存在(具体子目录由ResourceManager扫描时按需创建)
|
||||
await fs.ensureDir(resourceDir)
|
||||
logger.debug(`[InitCommand] 确保资源目录存在: ${resourceDir}`)
|
||||
|
||||
// 3. 使用 ProjectDiscovery 的正确方法生成注册表
|
||||
logger.step('正在扫描项目资源...')
|
||||
|
||||
@ -39,14 +39,9 @@ class RegisterCommand extends BasePouchCommand {
|
||||
// 1. 检查角色文件是否存在
|
||||
const roleExists = await this.checkRoleExists(roleId)
|
||||
if (!roleExists) {
|
||||
return `❌ 角色文件不存在!
|
||||
return `❌ 角色 ${roleId} 不存在!
|
||||
|
||||
请确保以下文件存在:
|
||||
- resource/domain/${roleId}/${roleId}.role.md
|
||||
- resource/domain/${roleId}/thought/${roleId}.thought.md
|
||||
- resource/domain/${roleId}/execution/${roleId}.execution.md
|
||||
|
||||
💡 您可以使用女娲来创建完整的角色套件:
|
||||
💡 您可以使用女娲来创建角色:
|
||||
使用 MCP PromptX action 工具激活 'nuwa' 角色`
|
||||
}
|
||||
|
||||
@ -85,35 +80,35 @@ class RegisterCommand extends BasePouchCommand {
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查角色文件是否存在(使用ResourceManager路径获取)
|
||||
* 检查角色是否存在(通过ResourceManager注册表)
|
||||
*/
|
||||
async checkRoleExists (roleId) {
|
||||
try {
|
||||
// 确保ResourceManager已初始化(就像ActionCommand那样)
|
||||
// 确保ResourceManager已初始化
|
||||
if (!this.resourceManager.initialized) {
|
||||
await this.resourceManager.initializeWithNewArchitecture()
|
||||
}
|
||||
|
||||
// 通过ResourceManager获取项目路径(与ActionCommand一致)
|
||||
const projectPath = await this.getProjectPath()
|
||||
const roleFile = path.join(projectPath, 'resource', 'domain', roleId, `${roleId}.role.md`)
|
||||
|
||||
return await fs.pathExists(roleFile)
|
||||
// 直接通过ResourceManager查找角色(不依赖硬编码路径)
|
||||
const roleResource = await this.resourceManager.loadResource(`@role://${roleId}`)
|
||||
return roleResource.success
|
||||
} catch (error) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 提取角色元数据(使用ResourceManager路径获取)
|
||||
* 提取角色元数据(通过ResourceManager)
|
||||
*/
|
||||
async extractRoleMetadata (roleId) {
|
||||
// 通过ResourceManager获取项目路径(与ActionCommand一致)
|
||||
const projectPath = await this.getProjectPath()
|
||||
const roleFile = path.join(projectPath, 'prompt', 'domain', roleId, `${roleId}.role.md`)
|
||||
// 通过ResourceManager加载角色内容(不依赖硬编码路径)
|
||||
const roleResource = await this.resourceManager.loadResource(`@role://${roleId}`)
|
||||
if (!roleResource.success) {
|
||||
throw new Error(`角色 ${roleId} 不存在`)
|
||||
}
|
||||
|
||||
const content = await fs.readFile(roleFile, 'utf-8')
|
||||
const relativePath = path.relative(projectPath, roleFile)
|
||||
const content = roleResource.content
|
||||
const relativePath = roleResource.metadata?.filePath || `role/${roleId}/${roleId}.role.md`
|
||||
|
||||
// 提取元数据
|
||||
let name = `🎭 ${roleId}`
|
||||
|
||||
@ -25,63 +25,13 @@ class WelcomeCommand extends BasePouchCommand {
|
||||
* 动态加载角色注册表 - 使用新的RegistryData架构
|
||||
*/
|
||||
async loadRoleRegistry () {
|
||||
try {
|
||||
// 确保ResourceManager已初始化
|
||||
if (!this.resourceManager.initialized) {
|
||||
await this.resourceManager.initializeWithNewArchitecture()
|
||||
}
|
||||
|
||||
const roleRegistry = {}
|
||||
|
||||
// 使用新的RegistryData获取角色资源
|
||||
const registryData = this.resourceManager.registryData
|
||||
|
||||
if (registryData && registryData.resources && registryData.resources.length > 0) {
|
||||
const roleResources = registryData.getResourcesByProtocol('role')
|
||||
|
||||
for (const resource of roleResources) {
|
||||
const roleId = resource.id
|
||||
|
||||
// 避免重复角色(同一个ID可能有多个来源)
|
||||
if (!roleRegistry[roleId]) {
|
||||
roleRegistry[roleId] = {
|
||||
id: resource.id,
|
||||
name: resource.name,
|
||||
description: resource.description,
|
||||
source: resource.source,
|
||||
file: resource.reference,
|
||||
protocol: resource.protocol
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 如果没有任何角色,使用基础角色
|
||||
if (Object.keys(roleRegistry).length === 0) {
|
||||
roleRegistry.assistant = {
|
||||
id: 'assistant',
|
||||
name: '🙋 智能助手',
|
||||
description: '通用助理角色,提供基础的助理服务和记忆支持',
|
||||
source: 'fallback',
|
||||
file: '@package://resource/domain/assistant/assistant.role.md',
|
||||
protocol: 'role'
|
||||
}
|
||||
}
|
||||
|
||||
return roleRegistry
|
||||
} catch (error) {
|
||||
// 使用基础角色作为fallback
|
||||
return {
|
||||
assistant: {
|
||||
id: 'assistant',
|
||||
name: '🙋 智能助手',
|
||||
description: '通用助理角色,提供基础的助理服务和记忆支持',
|
||||
source: 'fallback',
|
||||
file: '@package://resource/domain/assistant/assistant.role.md',
|
||||
protocol: 'role'
|
||||
}
|
||||
}
|
||||
// 确保ResourceManager已初始化
|
||||
if (!this.resourceManager.initialized) {
|
||||
await this.resourceManager.initializeWithNewArchitecture()
|
||||
}
|
||||
|
||||
// 直接使用ResourceManager的注册表,无需重复处理
|
||||
return this.resourceManager.registryData.getResourcesByProtocol('role')
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user