@aigne/doc-smith 0.9.8-alpha.5 → 0.9.8-alpha.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -48,10 +48,10 @@ doc-smith-skill/
48
48
  ├── doc-smith/ # Skill 主目录
49
49
  │ ├── SKILL.md # Skill 主文档(中文)
50
50
  │ └── references/ # 参考文档
51
- │ ├── document_structure_schema.md # 文档结构 Schema
52
- │ ├── structure_confirmation_guide.md # 结构确认指南
53
- │ ├── structure_planning_guide.md # 结构规划指南
54
- │ └── user_intent_guide.md # 用户意图指南
51
+ │ ├── document-structure-schema.md # 文档结构 Schema
52
+ │ ├── structure-confirmation-guide.md # 结构确认指南
53
+ │ ├── structure-planning-guide.md # 结构规划指南
54
+ │ └── user-intent-guide.md # 用户意图指南
55
55
  ├── scripts/ # 安装/卸载脚本
56
56
  │ ├── install.sh # 安装脚本
57
57
  │ ├── uninstall.sh # 卸载脚本
@@ -80,7 +80,7 @@ doc-smith-skill/
80
80
  然后根据提示操作,DocSmith 会:
81
81
  1. 分析你的工作区
82
82
  2. 规划文档结构
83
- 3. 生成 `document_structure.yaml`
83
+ 3. 生成 `document-structure.yaml`
84
84
  4. 创建结构化的 Markdown 文档
85
85
 
86
86
  ### 3. 查看生成的文档
@@ -90,7 +90,7 @@ doc-smith-skill/
90
90
  ```
91
91
  .aigne/doc-smith/
92
92
  ├── output/
93
- │ └── document_structure.yaml # 文档结构定义
93
+ │ └── document-structure.yaml # 文档结构定义
94
94
  └── docs/
95
95
  └── [生成的文档文件]
96
96
  ```
@@ -99,10 +99,10 @@ doc-smith-skill/
99
99
 
100
100
  - **SKILL.md** - Skill 完整使用指南,包含工作流程、最佳实践等
101
101
  - **references/**
102
- - **document_structure_schema.md** - 文档结构 YAML 的完整 Schema 说明
103
- - **structure_planning_guide.md** - 文档结构规划指南
104
- - **structure_confirmation_guide.md** - 结构确认流程指南
105
- - **user_intent_guide.md** - 用户意图理解指南
102
+ - **document-structure-schema.md** - 文档结构 YAML 的完整 Schema 说明
103
+ - **structure-planning-guide.md** - 文档结构规划指南
104
+ - **structure-confirmation-guide.md** - 结构确认流程指南
105
+ - **user-intent-guide.md** - 用户意图理解指南
106
106
 
107
107
  所有文档均已翻译为中文,方便理解和编辑。
108
108
 
@@ -10,8 +10,8 @@ description: "从工作区数据源生成和更新全面的文档,包括代码
10
10
  ## 概述
11
11
 
12
12
  DocSmith 分析工作区内容(代码、文件、媒体)并生成:
13
- 1. 用户意图描述(`user_intent.md`)
14
- 2. 文档结构计划(`document_structure.yaml`)
13
+ 1. 用户意图描述(`user-intent.md`)
14
+ 2. 文档结构计划(`document-structure.yaml`)
15
15
  3. 按层次组织的 Markdown 文档文件
16
16
 
17
17
  所有输出都创建在 `.aigne/doc-smith/` 目录中。
@@ -48,31 +48,31 @@ DocSmith 分析工作区内容(代码、文件、媒体)并生成:
48
48
  ### 2. 推断用户意图
49
49
 
50
50
  首先检查用户意图文件是否已存在,如果存在向用户问询是否需要修改。
51
- 用户意图格式参考: `references\user_intent_guide.md`
51
+ 用户意图格式参考: `references\user-intent-guide.md`
52
52
 
53
53
  ### 3. 规划文档结构
54
54
 
55
55
  首先检查文档结构文件是否已存在,如果存在执行第 5 步骤 ,向用户问询是否需要修改。
56
- 文档结构规划要求参考: `references\structure_planning_guide.md`
56
+ 文档结构规划要求参考: `references\structure-planning-guide.md`
57
57
 
58
- ### 4. 生成 document_structure.yaml
58
+ ### 4. 生成 document-structure.yaml
59
59
 
60
- 文档结构数据结构参考: `references\document_structure_schema.md`
60
+ 文档结构数据结构参考: `references\document-structure-schema.md`
61
61
 
62
62
  ### 5. 确认文档结构
63
63
 
64
- 向用户展示的结构请参考: `references\structure_confirmation_guide.md`
64
+ 向用户展示的结构请参考: `references\structure-confirmation-guide.md`
65
65
 
66
66
  ### 6. 生成文档内容
67
67
 
68
- 为结构中的每个文档在 `.aigne/doc-smith/docs/` 中创建 markdown 文件。使用 YAML 中的 `path` 作为文件路径,从 `sourcePaths` 提取信息,编写清晰、结构化的内容。
69
-
70
- 在文档开头和结尾添加导航链接,引导用户阅读相关文档(开头:前置条件、父主题;结尾:相关主题、下一步、子文档)。
68
+ 为结构中的每个文档在 `.aigne/doc-smith/docs/` 中创建 markdown 文件。
69
+ 文档内容生成要求参考:`references\document-content-guide.md`
71
70
 
72
71
  ### 7. 更新已有文档
73
72
 
74
73
  仅当 `.aigne/doc-smith/docs/` 已存在时处理文档更新。
75
- 处理流程请参考 `references\document_update_guide.md` 和 `references\changeset_schema.md`
74
+ 处理流程请参考 `references\document-update-guide.md` 和 `references\changeset-schema.md`
75
+ 文档的更新需要符合文档内容的生成要求,参考:`references\document-content-guide.md`
76
76
 
77
77
  ## 输出结构
78
78
 
@@ -81,8 +81,8 @@ DocSmith 分析工作区内容(代码、文件、媒体)并生成:
81
81
  ```
82
82
  .aigne/doc-smith/
83
83
  ├── output/
84
- │ ├── user_intent.md # 用户意图描述
85
- │ └── document_structure.yaml # 文档计划
84
+ │ ├── user-intent.md # 用户意图描述
85
+ │ └── document-structure.yaml # 文档计划
86
86
  └── docs/
87
87
  ├── overview.md # 生成的文档
88
88
  ├── getting-started.md
@@ -90,28 +90,10 @@ DocSmith 分析工作区内容(代码、文件、媒体)并生成:
90
90
  └── authentication.md
91
91
  ```
92
92
 
93
- ## 媒体资源
94
-
95
- 当工作区中存在媒体文件(图片、视频)时:
96
-
97
- **发现:**
98
- ```bash
99
- find . -type f \( -name "*.png" -o -name "*.jpg" -o -name "*.gif" -o -name "*.mp4" \)
100
- ```
101
-
102
- **在 markdown 中引用:**
103
- ```markdown
104
- ![架构图](../path/to/diagram.png)
105
-
106
- <!-- 或相对于文档位置 -->
107
- ![截图](../../screenshots/ui.png)
108
- ```
109
-
110
- **不要复制**媒体文件。直接从它们的工作区位置引用。
111
-
112
93
  ## 关键原则
113
94
 
114
95
  - **参考引用文件**:执行到每个步骤时,如果提供了参考文件,必须先阅读参考文件中的要求
115
- - **基于用户意图**:所有规划和生成都应参考 `user_intent.md`
96
+ - **文档内容要求**:执行任何文档相关的生成、更新,都需要参考`references\document-content-guide.md`,确保文档符合要求
97
+ - **基于用户意图**:所有规划和生成都应参考 `user-intent.md`
116
98
  - **最小必要原则**:只生成用户意图中明确需要的文档
117
99
  - **批量执行**:生成文档内容时优先批量执行,缩短执行时间
@@ -6,8 +6,6 @@ Changeset 只包含两类修改:
6
6
  1. **全局语义修改** - 跨文档的规则、术语、风格
7
7
  2. **结构重写** - 补充、重写、重组特定章节
8
8
 
9
- **注意:** PATCH 类修改通过文档内 `:::PATCH` 标记实现,不会出现在 changeset 中。
10
-
11
9
  ## 读取和理解
12
10
 
13
11
  Changeset 是自然语言文本,格式自由。你需要:
@@ -42,51 +40,17 @@ Changeset 是自然语言文本,格式自由。你需要:
42
40
  "API 文档补充错误码说明" → 结构重写
43
41
  ```
44
42
 
45
- ## 常见模式参考
46
-
47
- ### 模式 1:简单列表
48
- ```markdown
49
- 1. 统一术语:"API" → "API 接口"
50
- 2. 补充 overview.md 的项目背景
51
- 3. 删除所有形容词
52
- ```
53
-
54
- 理解:1, 3 是全局修改;2 是结构重写
55
-
56
- ### 模式 2:分类组织
57
- ```markdown
58
- ## 全局修改
59
- - 代码示例添加语言标识符
60
- - 禁止使用第一人称
61
-
62
- ## 补充内容
63
- - getting-started.md 添加环境要求
64
- - api/errors.md 补充错误原因
65
- ```
66
-
67
- 理解:按章节分类,直接识别
68
-
69
- ### 模式 3:自由描述
70
- ```markdown
71
- 发现文档问题:
72
- - "API" 和 "接口" 混用,统一为 "API 接口"
73
- - 快速开始缺环境要求说明
74
- ```
75
-
76
- 理解:第一条是全局修改,第二条是结构重写
77
-
78
43
  ## 执行流程
79
44
 
80
45
  ### 1. 读取文件
81
- ```bash
82
- cat <changeset-file-path>
83
- ```
46
+
47
+ 读取 changeset 文件,只读取用户指令中指定的文件,忽略其他 changeset 文件。
84
48
 
85
49
  ### 2. 分类汇总
86
50
 
87
51
  **全局修改:**
88
- - 规则 1: ...
89
- - 规则 2: ...
52
+ - 1: ...
53
+ - 2: ...
90
54
 
91
55
  **结构重写:**
92
56
  - 文档 A, 章节 X: ...
@@ -97,9 +61,6 @@ cat <changeset-file-path>
97
61
  **优先级:** 全局修改 → 结构重写
98
62
 
99
63
  **全局修改:**
100
- ```bash
101
- find .aigne/doc-smith/docs/ -name "*.md"
102
- ```
103
64
  遍历所有文档,应用规则
104
65
 
105
66
  **结构重写:**
@@ -0,0 +1,188 @@
1
+ # 文档内容生成指南
2
+
3
+ 本指南定义了生成 markdown 文档时的内容要求和格式规范。
4
+
5
+ ## 基本要求
6
+
7
+ 为结构中的每个文档在 `.aigne/doc-smith/docs/` 中创建 markdown 文件:
8
+ - 使用 YAML 中的 `path` 作为文件路径
9
+ - 从 `sourcePaths` 提取信息
10
+ - 编写清晰、结构化的内容
11
+ - **在生成文档内容时主动添加图片**(参见"媒体资源"章节)
12
+
13
+ ## 导航链接
14
+
15
+ 在每个文档中添加导航链接,引导用户在文档之间流畅跳转。
16
+ 只能链接生成的其他文档,不能链接到工作目录中的 markdown 文件,文档发布后会导致无法访问。
17
+
18
+ ### 文档开头导航
19
+
20
+ 在文档正文开始前添加:
21
+ - **前置条件**:阅读本文档前建议先了解的内容
22
+ - **父主题**:当前文档所属的上级主题
23
+
24
+ ### 文档结尾导航
25
+
26
+ 在文档末尾添加:
27
+ - **相关主题**:与当前文档相关的其他文档
28
+ - **下一步**:建议阅读的后续内容
29
+ - **子文档**:当前文档包含的子主题列表
30
+
31
+ ## 媒体资源
32
+
33
+ ### 前置准备:确定文档和媒体的位置关系
34
+
35
+ **在开始生成文档前,必须完成以下步骤:**
36
+
37
+ #### 1. 确定文档输出目录
38
+
39
+ 从 `document-structure.yaml` 的文档配置中读取,文档输出目录固定为:`.aigne/doc-smith/docs/`
40
+
41
+ #### 2. 查找所有媒体文件
42
+
43
+ 执行以下命令查找工作区中的所有媒体文件:
44
+
45
+ ```bash
46
+ find . -type f \( -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" -o -name "*.gif" -o -name "*.svg" -o -name "*.mp4" -o -name "*.webp" \)
47
+ ```
48
+
49
+ 记录所有结果,例如:
50
+ - `./assets/create/screenshot1.png`
51
+ - `./assets/run/screenshot2.png`
52
+ - `./images/architecture.png`
53
+
54
+ #### 3. 相对路径计算规则
55
+
56
+ **核心公式:**
57
+ ```
58
+ 图片相对路径 = (向上到根目录的 ../) + 图片路径(去掉开头的 ./)
59
+ ```
60
+
61
+ **层级对照表:**
62
+ - 文档在 `docs/` → 3层 → `../../../`
63
+ - 文档在 `docs/api/` → 4层 → `../../../../`
64
+ - 文档在 `docs/api/auth/` → 5层 → `../../../../../`
65
+ - 规律:每增加一层子目录,增加一个 `../`
66
+
67
+ **示例:**
68
+ - 文档:`.aigne/doc-smith/docs/getting-started.md`(3层)
69
+ - 图片:`./assets/run/screenshot.png`
70
+ - 结果:`../../../assets/run/screenshot.png`
71
+
72
+ **常见错误:**
73
+ - ❌ 层级数数错(`docs/` 用了 `../../` 而非 `../../../`)
74
+ - ❌ 忘记计算子目录(`docs/api/` 用了 3层而非 4层)
75
+
76
+ ### 生成文档时的图片处理
77
+
78
+ 在编写每个文档的内容时,必须主动添加图片以增强文档的可读性和专业性。
79
+
80
+ #### 1. 图片分类与要求
81
+
82
+ **A. 技术图表(必须生成)**
83
+
84
+ 以下类型的内容**必须包含相应的技术图表**,没有已有图片时必须生成 AFS Image Slot:
85
+
86
+ - **架构说明** → 架构图(系统架构、模块关系、组件结构)
87
+ - **流程说明** → 流程图(业务流程、数据流向、状态转换)
88
+ - **时序说明** → 时序图(交互时序、调用链路)
89
+ - **概念解释** → 概念图(概念关系、层次结构)
90
+ - **数据结构** → 数据模型图(类图、ER 图)
91
+
92
+ **B. 应用截图(必须使用已有)**
93
+
94
+ 以下类型必须使用工作区中的已有截图,因为必须使用真实的应用截图:
95
+
96
+ - **界面介绍** → UI 截图
97
+ - **操作步骤** → 操作演示截图
98
+ - **功能展示** → 功能界面截图
99
+
100
+ **强制性要求:**
101
+
102
+ 1. **技术文档必须包含技术图表**:
103
+ - 架构文档:至少 1 个架构图
104
+ - API 文档:至少 1 个时序图或流程图
105
+ - 概念说明:至少 1 个概念图
106
+ - 数据模型:至少 1 个数据结构图
107
+
108
+ 2. **用户指南需要包含应用截图**:
109
+ - 操作指南:每个主要操作步骤至少 1 张截图
110
+ - 功能介绍:每个功能至少 1 张界面截图
111
+
112
+ 3. **综合文档建议配比**:
113
+ - 技术图表:1-3 个
114
+ - 应用截图:1-2 个
115
+
116
+ #### 2. 图片处理流程
117
+
118
+ **对于应用截图(B 类):**
119
+
120
+ 1. 只能从前置准备的查找结果中匹配图片
121
+ 2. 根据文件名判断用途(如 login.png、dashboard.png、settings.png)
122
+ 3. 使用层级对照表计算相对路径
123
+ 4. 引用图片:`![截图说明](../../../assets/screenshot.png)`
124
+ 5. 如果仓库未提供相关截图,可以不展示
125
+
126
+ **对于技术图表(A 类):**
127
+
128
+ 1. 检查是否有对应的技术图表(架构图、流程图等)
129
+ 2. 如果没有,**必须生成 AFS Image Slot**(不是可选)
130
+ 3. 即使有应用截图,也不能用应用截图替代技术图表
131
+
132
+ **关键区别:**
133
+ - ❌ 错误:架构说明章节使用应用截图代替架构图
134
+ - ✅ 正确:架构说明章节生成架构图 slot,另外可以添加应用截图作为补充
135
+
136
+ #### 3. 生成 AFS Image Slot
137
+
138
+ **何时必须生成 Slot:**
139
+
140
+ 1. 文档内容需要技术图表(架构图、流程图、时序图等)
141
+ 2. 工作区中没有对应的技术图表
142
+ 3. 即使有应用截图,也需要生成技术图表 slot
143
+
144
+ AFS Image Slot Instructions
145
+
146
+ Use an AFS image slot only when you want the framework to generate a new image.
147
+
148
+ Slot format (single line):
149
+ <!-- afs:image id="architecture-overview" desc="..." -->
150
+
151
+ Optional stable intent key (for reuse across edits or documents):
152
+ <!-- afs:image id="architecture-overview" key="aigne-cli-architecture" desc="..." -->
153
+
154
+ Rules:
155
+ - Insert a slot only for new image generation.
156
+ If the source already provides an image (existing URL/path/asset), reference it directly; do not create a slot.
157
+ - id is required and must be a semantic identifier describing the image’s role or position
158
+ (e.g. architecture-overview, core-flow, deployment-banner).
159
+ It must be unique in the same document and match: [a-z0-9._-]+.
160
+ - desc is required, concise, double-quoted, and must not contain ".
161
+ It describes what the image should depict.
162
+ - key is optional. Use a short, stable token ([a-z0-9._-]+) when you want the same image intent to be reused across sections or documents.
163
+
164
+ ### 图片使用检查清单
165
+
166
+ 生成每个文档时,确认以下项目:
167
+
168
+ **技术图表检查:**
169
+ - [ ] 架构说明章节是否包含架构图?(没有则生成 slot)
170
+ - [ ] 流程说明章节是否包含流程图?(没有则生成 slot)
171
+ - [ ] 时序说明章节是否包含时序图?(没有则生成 slot)
172
+ - [ ] 概念解释章节是否包含概念图?(没有则生成 slot)
173
+
174
+ **应用截图检查:**
175
+ - [ ] 是否有可用的应用截图可以引用?
176
+ - [ ] 引用路径是否按层级对照表正确计算?
177
+
178
+ **数量检查:**
179
+ - [ ] 技术文档是否至少包含 1 个技术图表?
180
+ - [ ] 用户指南是否包含足够的应用截图?
181
+
182
+ ## 内容组织原则
183
+
184
+ 1. **层次清晰**:使用恰当的标题层级(H1-H6)
185
+ 2. **段落简洁**:每个段落专注于单一主题
186
+ 3. **代码示例**:提供实用的代码示例和说明
187
+ 4. **列表使用**:用列表组织并列信息
188
+ 5. **强调重点**:使用粗体、引用等方式突出重要信息
@@ -1,6 +1,6 @@
1
1
  # 文档结构 Schema
2
2
 
3
- 本参考定义了 `document_structure.yaml` 的完整 schema。
3
+ 本参考定义了 `document-structure.yaml` 的完整 schema。
4
4
 
5
5
  ## 完整的 YAML 结构
6
6
 
@@ -43,18 +43,21 @@
43
43
  **处理方式:**
44
44
  1. 扫描所有文档查找 `:::PATCH` 标记
45
45
  2. 读取 PATCH 内的修改指令
46
- 3. 执行精确替换
46
+ 3. 在指定位置完成 PATCH要求的修改,可能包含:替换原始内容、删除内容、新增内容
47
47
  4. 删除整个 PATCH 标记
48
48
 
49
49
  **PATCH 标记格式:**
50
50
  ```markdown
51
51
  ::: PATCH
52
- 修改说明或新内容
52
+ # Original
53
+ DocSmith 直接修改用户文档并写回到原项目。
54
+
55
+ # Revised
56
+ DocSmith 永远不直接 touch 用户原始 repo,而是
57
+ 在独立 workspace 中生成版本化产物,再通过 patch 合并。
53
58
  :::
54
59
  ```
55
60
 
56
- **来源:** 仅通过文档内标记(不会出现在 Changeset 文件中)
57
-
58
61
  ## 三种输入方式处理
59
62
 
60
63
  ### 方式 1:自然语言修改请求
@@ -80,7 +83,7 @@
80
83
 
81
84
  **重要:**
82
85
  - 格式自由,自然语言描述
83
- - 参见 `references\changeset_schema.md` 了解识别规则
86
+ - 参见 `references\changeset-schema.md` 了解识别规则
84
87
 
85
88
  ### 方式 3:文档内 PATCH 标记
86
89
 
@@ -133,10 +136,6 @@ ls -la .aigne/doc-smith/docs/
133
136
  **执行优先级:** 全局修改 → 结构重写 → PATCH
134
137
 
135
138
  **全局修改:**
136
- ```bash
137
- # 获取所有文档
138
- find .aigne/doc-smith/docs/ -name "*.md"
139
- ```
140
139
  对每个文档:
141
140
  - 读取内容
142
141
  - 应用规则(替换、删除、添加)
@@ -71,7 +71,7 @@
71
71
 
72
72
  ### 反馈类型
73
73
 
74
- 1. **删除文档**:从 document_structure.yaml 删除条目,如果是父文档则连同子文档一起删除
74
+ 1. **删除文档**:从 document-structure.yaml 删除条目,如果是父文档则连同子文档一起删除
75
75
  2. **添加文档**:确定位置、title、description、path、sourcePaths 和 icon(如果是顶层文档)
76
76
  3. **调整层次**:合并/拆分子文档,或调整父子关系
77
77
  4. **修改内容范围**:更新 description 和 sourcePaths
@@ -6,7 +6,7 @@
6
6
 
7
7
  **规划必须依据用户意图**
8
8
 
9
- 在规划文档结构时,持续参考 `user_intent.md` 中的内容:
9
+ 在规划文档结构时,持续参考 `user-intent.md` 中的内容:
10
10
  - **目标用户决定文档类型**:技术开发者需要 API 参考,最终用户需要使用指南
11
11
  - **使用场景决定文档范围**:快速上手只需核心功能,深入学习才需要完整架构
12
12
  - **侧重点决定详细程度**:使用指南型文档重实践轻原理,参考手册型文档要全面覆盖
@@ -15,11 +15,11 @@
15
15
 
16
16
  ### ❌ 不看用户意图,直接按代码结构规划
17
17
 
18
- 导致文档大而全,不聚焦用户需求。应该先参考 user_intent.md,只为用户需要的模块创建文档。
18
+ 导致文档大而全,不聚焦用户需求。应该先参考 user-intent.md,只为用户需要的模块创建文档。
19
19
 
20
20
  ### ❌ 规划了用户不需要的文档
21
21
 
22
- 浪费资源生成无用文档。应该严格按照 user_intent.md 中的"文档侧重点"规划。
22
+ 浪费资源生成无用文档。应该严格按照 user-intent.md 中的"文档侧重点"规划。
23
23
 
24
24
  ### ❌ 文档粒度与用户需求不匹配
25
25
 
@@ -32,7 +32,7 @@
32
32
  只规划用户意图中明确需要的文档。
33
33
 
34
34
  **检查清单**:
35
- - [ ] 这个文档是否在 user_intent.md 的使用场景中?
35
+ - [ ] 这个文档是否在 user-intent.md 的使用场景中?
36
36
  - [ ] 这个文档是否符合文档侧重点?
37
37
  - [ ] 如果去掉这个文档,用户会缺失重要信息吗?
38
38
 
@@ -41,7 +41,7 @@
41
41
  优先覆盖用户的主要使用场景。
42
42
 
43
43
  **优先级排序**:
44
- 1. user_intent.md 中明确提到的场景
44
+ 1. user-intent.md 中明确提到的场景
45
45
  2. 对目标用户最重要的功能
46
46
  3. 可选的高级特性
47
47
 
@@ -107,7 +107,7 @@ API 参考拆分为用户、订单、支付三个子文档,因为每个类别
107
107
 
108
108
  ## 结构评估清单
109
109
 
110
- 在创建 document_structure.yaml 之前,对每个可能的嵌套结构使用此清单:
110
+ 在创建 document-structure.yaml 之前,对每个可能的嵌套结构使用此清单:
111
111
 
112
112
  ### 支持拆分的信号
113
113
 
@@ -18,7 +18,7 @@
18
18
 
19
19
  确定文档类型(使用指南型、参考手册型、快速上手型、架构说明型)。
20
20
 
21
- ## user_intent.md 模板
21
+ ## user-intent.md 模板
22
22
 
23
23
  ```markdown
24
24
  # 用户意图
@@ -64,12 +64,12 @@
64
64
 
65
65
  ### 默认流程
66
66
 
67
- 1. **自动生成**:基于工作区分析,自动推断用户意图并生成 user_intent.md
67
+ 1. **自动生成**:基于工作区分析,自动推断用户意图并生成 user-intent.md
68
68
  2. **展示意图**:向用户展示推断的完整意图
69
69
  3. **使用 AskUserQuestion 工具确认**:
70
70
  - 问题:"用户意图是否符合您的需求?"
71
71
  - 选项:"✅ 确认,开始规划文档结构"
72
- 4. **接收反馈**:如果用户选择调整或通过 Other 提供具体需求,更新 user_intent.md
72
+ 4. **接收反馈**:如果用户选择调整或通过 Other 提供具体需求,更新 user-intent.md
73
73
  5. **重新展示**:展示更新后的完整意图
74
74
  6. **循环确认**:重复步骤 3-5,直到用户确认
75
75
  7. **进入下一步**:用户确认后,才开始规划文档结构
@@ -161,12 +161,12 @@ Agent: 收到确认,开始规划文档结构...
161
161
 
162
162
  ### 处理反馈
163
163
 
164
- 根据用户反馈更新 user_intent.md 的对应部分(目标用户、使用场景、文档侧重点),必要时完全重写。每次修改后必须重新展示完整意图并询问确认。
164
+ 根据用户反馈更新 user-intent.md 的对应部分(目标用户、使用场景、文档侧重点),必要时完全重写。每次修改后必须重新展示完整意图并询问确认。
165
165
 
166
166
  ## 关键原则
167
167
 
168
168
  1. **基于证据推断**:从工作区内容(代码结构、README、配置文件)中寻找线索
169
- 2. **保持简洁**:user_intent.md 应该简洁明了,避免冗长
169
+ 2. **保持简洁**:user-intent.md 应该简洁明了,避免冗长
170
170
  3. **可修改性**:用自然语言编写,用户易于理解和调整
171
171
  4. **多轮确认**:支持用户多轮调整,每次修改后重新展示完整意图并确认
172
172
  5. **用户确认后才继续**:绝对不要在用户确认前开始规划文档结构
package/doc-smith.yaml CHANGED
@@ -1,100 +1,26 @@
1
- type: ai
1
+ type: "@aigne/agent-library/agent-skill-manager"
2
2
  name: docsmith
3
- keep_text_in_tool_uses: true
4
3
  task_render_mode: collapse
5
- instructions:
6
- - role: system
7
- url: ./main-system-prompt.md
8
4
 
9
- input_key: message
10
- skills:
11
- - type: function
12
- name: askUserQuestion
13
- description: |
14
- Use this tool when you need to ask the user questions during execution. This allows you to:
15
- 1. Gather user preferences or requirements
16
- 2. Clarify ambiguous instructions
17
- 3. Get decisions on implementation choices as you work
18
- 4. Offer choices to the user about what direction to take.
19
-
20
- Usage notes:
21
- - The system automatically adds an "✏️ Other" option to all questions, allowing users to provide custom text input. DO NOT add your own "Other", "需要调整", or similar options - they will cause duplication.
22
- - Only provide the specific action options (e.g., "✅ Confirm"). The "Other" option is handled by the system.
23
- - Use multiSelect: true to allow multiple answers to be selected for a question
24
- - If you recommend a specific option, make that the first option in the list and add "(Recommended)" at the end of the label
25
- input_schema:
26
- type: object
27
- properties:
28
- questions:
29
- type: array
30
- items:
31
- type: object
32
- properties:
33
- question:
34
- type: string
35
- description: The complete question to ask
36
- header:
37
- type: string
38
- description: Short label(max 12 chars)
39
- options:
40
- type: array
41
- items:
42
- type: string
43
- description:
44
- Available choices (2 ~ 4 options)
45
- # multiSelect:
46
- # type: boolean
47
- # description: Allow multiple selections
48
- required:
49
- - question
50
- - header
51
- required:
52
- - questions
53
- process: |
54
- const {questions} = input
55
-
56
- const answers = []
57
- const OTHER_OPTION = '✏️ Other'
58
-
59
- for (const item of questions) {
60
- let answer
61
-
62
- if (item?.options?.length) {
63
- answer = await options.prompts.select({
64
- message: item.question,
65
- choices: [
66
- ...item.options.map(option => ({
67
- name: option,
68
- description: option,
69
- value: option
70
- })),
71
- {
72
- name: OTHER_OPTION,
73
- description: 'Enter your own response',
74
- value: OTHER_OPTION
75
- }
76
- ]
77
- })
5
+ model:
6
+ cache_config:
7
+ autoBreakpoints:
8
+ lastMessage: true
78
9
 
79
- if (answer === OTHER_OPTION) {
80
- answer = await options.prompts.input({
81
- message: 'Please enter your response:'
82
- })
83
- }
84
- } else {
85
- answer = await options.prompts.input({
86
- message: item.question
87
- })
88
- }
89
-
90
- answers.push({question: item.question, answer})
91
- }
92
-
93
- return {answers}
10
+ history_config:
11
+ enabled: true
94
12
 
13
+ input_key: message
14
+ skills:
15
+ - type: "@aigne/agent-library/ask-user-question"
95
16
 
96
17
  afs:
97
18
  modules:
19
+ - module: history
20
+ options:
21
+ storage:
22
+ url: file:./.aigne/history.db
23
+
98
24
  - module: local-fs
99
25
  options:
100
26
  name: workspace
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/doc-smith",
3
- "version": "0.9.8-alpha.5",
3
+ "version": "0.9.8-alpha.7",
4
4
  "description": "AI-driven documentation generation tool built on the AIGNE Framework",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -1,56 +0,0 @@
1
- You are an interactive CLI tool that helps users according to your "Output Style" below, which describes how you should respond to user queries. Use the instructions below and the tools available to you to assist the user.
2
-
3
- IMPORTANT: You must NEVER generate or guess URLs for the user unless you are confident that the URLs are for helping the user with programming. You may use URLs provided by the user in their messages or local files.
4
-
5
- # Looking up your own documentation:
6
-
7
- When the user directly asks about any of the following:
8
- - how to use Claude Code (eg. "can Claude Code do...", "does Claude Code have...")
9
- - what you're able to do as Claude Code in second person (eg. "are you able...", "can you do...")
10
- - about how they might do something with Claude Code (eg. "how do I...", "how can I...")
11
- - how to use a specific Claude Code feature (eg. implement a hook, write a slash command, or install an MCP server)
12
- - how to use the Claude Agent SDK, or asks you to write code that uses the Claude Agent SDK
13
-
14
- # Tone and style
15
- - Only use emojis if the user explicitly requests it. Avoid using emojis in all communication unless asked.
16
- - Your output will be displayed on a command line interface. Your responses should be short and concise. You can use Github-flavored markdown for formatting, and will be rendered in a monospace font using the CommonMark specification.
17
- - Output text to communicate with the user; all text you output outside of tool use is displayed to the user. Only use tools to complete tasks. Never use tools like Bash or code comments as means to communicate with the user during the session.
18
- - NEVER create files unless they're absolutely necessary for achieving your goal. ALWAYS prefer editing an existing file to creating a new one. This includes markdown files.
19
- - Do not use a colon before tool calls. Your tool calls may not be shown directly in the output, so text like "Let me read the file:" followed by a read tool call should just be "Let me read the file." with a period.
20
-
21
- # AFS Context
22
-
23
- {{ $afs.description }}
24
-
25
- ```yaml alt="AFS Modules"
26
- {{ $afs.modules | yaml.stringify }}
27
- ```
28
-
29
- # Asking questions as you work
30
-
31
- You have access to the askUserQuestion tool to ask the user questions when you need clarification, want to validate assumptions, or need to make a decision you're unsure about. When presenting options or plans, never include time estimates - focus on what each option involves, not how long it takes.
32
-
33
- # Skill usage
34
-
35
- When the user requests you to perform tasks, check if any of the available skills can help complete the task more effectively. Skills provide specialized capabilities and domain knowledge.
36
-
37
- ## Loading skill resources on demand
38
-
39
- Skills may include reference documents (guides, schemas, examples) in a `references/` directory. To optimize performance and context usage:
40
-
41
- 1. **Start with the main skill file** (e.g., `SKILL.md`) - it contains the workflow overview and references to detailed guides
42
- 2. **Load reference documents only when needed** - read specific guides only when you reach the step that requires them
43
- 3. **Don't preload all resources** - avoid reading all reference files at the start of a task
44
-
45
- # Doing tasks
46
- The user will primarily request you perform software engineering tasks. This includes solving bugs, adding new functionality, refactoring code, explaining code, and more. For these tasks the following steps are recommended:
47
- - NEVER propose changes to code you haven't read. If a user asks about or wants you to modify a file, read it first. Understand existing code before suggesting modifications.
48
- - Use the askUserQuestion tool to ask questions, clarify and gather information as needed.
49
- - Be careful not to introduce security vulnerabilities such as command injection, XSS, SQL injection, and other OWASP top 10 vulnerabilities. If you notice that you wrote insecure code, immediately fix it.
50
- - Avoid over-engineering. Only make changes that are directly requested or clearly necessary. Keep solutions simple and focused.
51
- - Don't add features, refactor code, or make "improvements" beyond what was asked. A bug fix doesn't need surrounding code cleaned up. A simple feature doesn't need extra configurability. Don't add docstrings, comments, or type annotations to code you didn't change. Only add comments where the logic isn't self-evident.
52
- - Don't add error handling, fallbacks, or validation for scenarios that can't happen. Trust internal code and framework guarantees. Only validate at system boundaries (user input, external APIs). Don't use feature flags or backwards-compatibility shims when you can just change the code.
53
- - Don't create helpers, utilities, or abstractions for one-time operations. Don't design for hypothetical future requirements. The right amount of complexity is the minimum needed for the current task—three similar lines of code is better than a premature abstraction.
54
- - Avoid backwards-compatibility hacks like renaming unused \`_vars\`, re-exporting types, adding \`// removed\` comments for removed code, etc. If something is unused, delete it completely.
55
-
56
- IMPORTANT: Complete tasks fully. Do not stop mid-task or leave work incomplete. Do not claim a task is too large, that you lack time, or that context limits prevent completion. You have unlimited context through summarization. Continue working until the task is done or the user stops you.