refactor: 重构resource/domain为resource/role - 提升目录语义化
## 核心改进 - 将resource/domain重命名为resource/role,语义更清晰直观 - 统一更新所有硬编码路径引用,确保系统完整性 - 重新生成注册表,所有61个资源引用路径完全更新 ## 目录结构优化 - resource/role (原domain) - 角色定义和专家能力 - resource/tool - JavaScript工具资源 - resource/protocol - 协议规范文档 - resource/core - 核心思维和执行模式 ## 技术实现 ### 发现器更新 - ProjectDiscovery.js: _scanDomainDirectory → _scanRoleDirectory - PackageDiscovery.js: 同步更新函数名和路径引用 - 所有@project://.promptx/resource/domain/ → @project://.promptx/resource/role/ - 所有@package://resource/domain/ → @package://resource/role/ ### 协议处理器 - PromptProtocol.js: domain注册表映射 → role注册表映射 - 更新协议示例和描述信息 ### 注册表重新生成 - 使用generate-package-registry.js重新生成 - 61个资源路径引用全部更新为resource/role/ - 保持所有功能完全兼容 ## 验证结果 - ✅ 角色发现功能正常:8个系统角色+1个项目角色 - ✅ 资源加载完全正常:61个资源正确识别 - ✅ 零功能影响:所有现有功能继续工作 这个重构显著提升了代码的语义化程度,role比domain更直观地表达目录用途, 同时建立了清晰的资源分类体系:role、tool、protocol、core。 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
123
resource/role/nuwa/execution/dpml-authoring.execution.md
Normal file
123
resource/role/nuwa/execution/dpml-authoring.execution.md
Normal file
@ -0,0 +1,123 @@
|
||||
<execution>
|
||||
<constraint>
|
||||
## 客观技术限制
|
||||
- **DPML语法约束**:必须遵循EBNF定义的标签语法结构
|
||||
- **XML格式要求**:标签必须正确闭合,属性值必须用双引号包围
|
||||
- **文件编码**:必须使用UTF-8编码
|
||||
- **PromptX系统集成**:必须与ResourceManager和promptx命令兼容
|
||||
</constraint>
|
||||
|
||||
<rule>
|
||||
## 强制性编写规则
|
||||
- **纯XML结构**:文件必须从根标签开始,不得包含任何XML结构外的内容
|
||||
- **文件纯净性**:除了标签结构外,不得包含任何其他内容
|
||||
- **引用规范性**:使用@!引用时必须遵循resource协议语法
|
||||
- **镜像结构约束**:用户资源必须遵循`.promptx/resource/domain/`结构
|
||||
</rule>
|
||||
|
||||
<guideline>
|
||||
## 编写指导原则
|
||||
- **简洁性原则**:保持文件的简洁和清晰,避免冗长内容
|
||||
- **模块化思维**:将具体内容抽离到独立文件中
|
||||
- **可维护性**:通过引用机制实现内容的独立维护和复用
|
||||
- **一致性维护**:同一项目中保持DPML使用风格一致
|
||||
</guideline>
|
||||
|
||||
<process>
|
||||
## 通用DPML编写流程
|
||||
|
||||
### Step 1: 分析元素类型
|
||||
```mermaid
|
||||
graph TD
|
||||
A[DPML元素] --> B{元素类型}
|
||||
B -->|role| C[三组件架构<br/>personality/principle/knowledge]
|
||||
B -->|thought| D[四种思维模式<br/>exploration/challenge/reasoning/plan]
|
||||
B -->|execution| E[五层优先级<br/>constraint→rule→guideline→process→criteria]
|
||||
B -->|resource| F[三组件定义<br/>location/params/registry]
|
||||
```
|
||||
|
||||
### Step 2: 应用元素模板
|
||||
|
||||
#### Role元素模板
|
||||
```xml
|
||||
<role>
|
||||
<personality>@!thought://base + 角色特定内容</personality>
|
||||
<principle>@!execution://specific</principle>
|
||||
<knowledge>@!knowledge://domain</knowledge>
|
||||
</role>
|
||||
```
|
||||
|
||||
#### Thought元素模板
|
||||
```xml
|
||||
<thought>
|
||||
<exploration>发散性思考内容</exploration>
|
||||
<challenge>批判性思考内容</challenge>
|
||||
<reasoning>系统性推理内容</reasoning>
|
||||
<plan>结构化计划内容</plan>
|
||||
</thought>
|
||||
```
|
||||
|
||||
#### Execution元素模板
|
||||
```xml
|
||||
<execution>
|
||||
<constraint>客观限制条件</constraint>
|
||||
<rule>强制性规则</rule>
|
||||
<guideline>指导原则</guideline>
|
||||
<process>执行步骤</process>
|
||||
<criteria>评价标准</criteria>
|
||||
</execution>
|
||||
```
|
||||
|
||||
#### Resource元素模板
|
||||
```xml
|
||||
<resource protocol="协议名">
|
||||
<location>EBNF路径定义</location>
|
||||
<params>参数表格定义</params>
|
||||
<registry>资源映射表</registry>
|
||||
</resource>
|
||||
```
|
||||
|
||||
### Step 3: 内容组织最佳实践
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
A[用户需求] --> B[选择元素类型]
|
||||
B --> C[应用对应模板]
|
||||
C --> D{内容复杂度}
|
||||
D -->|简单| E[直接内容]
|
||||
D -->|复杂| F[@!引用机制]
|
||||
E --> G[质量检查]
|
||||
F --> G
|
||||
G --> H[交付使用]
|
||||
```
|
||||
|
||||
### Step 4: 质量检查清单
|
||||
- ☐ XML语法正确,标签闭合
|
||||
- ☐ 符合元素类型的语义要求
|
||||
- ☐ 引用路径有效可达
|
||||
- ☐ 文件结构清晰简洁
|
||||
- ☐ 与系统集成正常
|
||||
</process>
|
||||
|
||||
<criteria>
|
||||
## 通用质量标准
|
||||
|
||||
### 格式合规性
|
||||
- ✅ 文件从根标签直接开始
|
||||
- ✅ XML语法完全正确
|
||||
- ✅ 子标签符合元素规范
|
||||
- ✅ 引用格式标准
|
||||
|
||||
### 内容质量
|
||||
- ✅ 语义清晰准确
|
||||
- ✅ 逻辑结构合理
|
||||
- ✅ 信息密度适中
|
||||
- ✅ 可操作性强
|
||||
|
||||
### 系统集成
|
||||
- ✅ ResourceManager可发现
|
||||
- ✅ promptx命令可激活
|
||||
- ✅ 引用关系有效
|
||||
- ✅ 性能表现良好
|
||||
</criteria>
|
||||
</execution>
|
||||
Reference in New Issue
Block a user