@aigne/doc-smith 0.8.12-beta.3 → 0.8.12-beta.4

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.
Files changed (169) hide show
  1. package/.aigne/doc-smith/config.yaml +9 -6
  2. package/.aigne/doc-smith/output/structure-plan.json +123 -109
  3. package/.aigne/doc-smith/upload-cache.yaml +48 -0
  4. package/.github/workflows/publish-docs.yml +4 -7
  5. package/.release-please-manifest.json +1 -1
  6. package/CHANGELOG.md +13 -0
  7. package/agents/clear/choose-contents.mjs +22 -5
  8. package/agents/clear/clear-auth-tokens.mjs +2 -4
  9. package/agents/clear/clear-deployment-config.mjs +49 -0
  10. package/agents/clear/clear-document-config.mjs +2 -5
  11. package/agents/clear/clear-document-structure.mjs +2 -6
  12. package/agents/clear/clear-generated-docs.mjs +0 -1
  13. package/agents/generate/check-need-generate-structure.mjs +15 -60
  14. package/agents/generate/document-structure-tools/generate-sub-structure.mjs +131 -0
  15. package/agents/generate/generate-structure-without-tools.yaml +65 -0
  16. package/agents/generate/generate-structure.yaml +7 -1
  17. package/agents/generate/index.yaml +0 -3
  18. package/agents/generate/update-document-structure.yaml +3 -0
  19. package/agents/generate/user-review-document-structure.mjs +7 -5
  20. package/agents/init/index.mjs +15 -15
  21. package/agents/publish/publish-docs.mjs +130 -111
  22. package/agents/translate/index.yaml +1 -1
  23. package/agents/update/batch-generate-document.yaml +1 -1
  24. package/agents/update/batch-update-document.yaml +1 -1
  25. package/agents/update/check-document.mjs +3 -19
  26. package/agents/update/user-review-document.mjs +4 -3
  27. package/agents/utils/load-sources.mjs +54 -151
  28. package/agents/utils/transform-detail-datasources.mjs +14 -18
  29. package/aigne.yaml +2 -0
  30. package/biome.json +1 -1
  31. package/docs/_sidebar.md +13 -15
  32. package/docs/configuration-initial-setup.ja.md +179 -0
  33. package/docs/configuration-initial-setup.md +179 -0
  34. package/docs/configuration-initial-setup.zh-TW.md +179 -0
  35. package/docs/configuration-initial-setup.zh.md +179 -0
  36. package/docs/configuration-managing-preferences.ja.md +100 -0
  37. package/docs/configuration-managing-preferences.md +100 -0
  38. package/docs/configuration-managing-preferences.zh-TW.md +100 -0
  39. package/docs/configuration-managing-preferences.zh.md +100 -0
  40. package/docs/configuration.ja.md +68 -184
  41. package/docs/configuration.md +62 -178
  42. package/docs/configuration.zh-TW.md +70 -186
  43. package/docs/configuration.zh.md +67 -183
  44. package/docs/getting-started.ja.md +46 -78
  45. package/docs/getting-started.md +46 -78
  46. package/docs/getting-started.zh-TW.md +47 -79
  47. package/docs/getting-started.zh.md +47 -79
  48. package/docs/guides-cleaning-up.ja.md +50 -0
  49. package/docs/guides-cleaning-up.md +50 -0
  50. package/docs/guides-cleaning-up.zh-TW.md +50 -0
  51. package/docs/guides-cleaning-up.zh.md +50 -0
  52. package/docs/guides-evaluating-documents.ja.md +66 -0
  53. package/docs/guides-evaluating-documents.md +66 -0
  54. package/docs/guides-evaluating-documents.zh-TW.md +66 -0
  55. package/docs/guides-evaluating-documents.zh.md +66 -0
  56. package/docs/guides-generating-documentation.ja.md +149 -0
  57. package/docs/guides-generating-documentation.md +149 -0
  58. package/docs/guides-generating-documentation.zh-TW.md +149 -0
  59. package/docs/guides-generating-documentation.zh.md +149 -0
  60. package/docs/guides-interactive-chat.ja.md +85 -0
  61. package/docs/guides-interactive-chat.md +85 -0
  62. package/docs/guides-interactive-chat.zh-TW.md +85 -0
  63. package/docs/guides-interactive-chat.zh.md +85 -0
  64. package/docs/guides-managing-history.ja.md +51 -0
  65. package/docs/guides-managing-history.md +51 -0
  66. package/docs/guides-managing-history.zh-TW.md +51 -0
  67. package/docs/guides-managing-history.zh.md +51 -0
  68. package/docs/guides-publishing-your-docs.ja.md +78 -0
  69. package/docs/guides-publishing-your-docs.md +78 -0
  70. package/docs/guides-publishing-your-docs.zh-TW.md +78 -0
  71. package/docs/guides-publishing-your-docs.zh.md +78 -0
  72. package/docs/guides-translating-documentation.ja.md +95 -0
  73. package/docs/guides-translating-documentation.md +95 -0
  74. package/docs/guides-translating-documentation.zh-TW.md +95 -0
  75. package/docs/guides-translating-documentation.zh.md +95 -0
  76. package/docs/guides-updating-documentation.ja.md +77 -0
  77. package/docs/guides-updating-documentation.md +77 -0
  78. package/docs/guides-updating-documentation.zh-TW.md +77 -0
  79. package/docs/guides-updating-documentation.zh.md +77 -0
  80. package/docs/guides.ja.md +32 -0
  81. package/docs/guides.md +32 -0
  82. package/docs/guides.zh-TW.md +32 -0
  83. package/docs/guides.zh.md +32 -0
  84. package/docs/overview.ja.md +39 -60
  85. package/docs/overview.md +39 -60
  86. package/docs/overview.zh-TW.md +39 -60
  87. package/docs/overview.zh.md +39 -60
  88. package/docs/release-notes.ja.md +255 -0
  89. package/docs/release-notes.md +255 -0
  90. package/docs/release-notes.zh-TW.md +255 -0
  91. package/docs/release-notes.zh.md +255 -0
  92. package/package.json +4 -2
  93. package/prompts/common/document/content-rules-core.md +1 -0
  94. package/prompts/common/document-structure/document-structure-rules.md +8 -9
  95. package/prompts/common/document-structure/output-constraints.md +1 -1
  96. package/prompts/structure/document-rules.md +8 -2
  97. package/prompts/structure/generate/system-prompt.md +27 -2
  98. package/prompts/structure/generate/user-prompt.md +18 -0
  99. package/prompts/structure/update/system-prompt.md +12 -0
  100. package/prompts/structure/update/user-prompt.md +3 -0
  101. package/tests/agents/clear/choose-contents.test.mjs +8 -4
  102. package/tests/agents/generate/check-need-generate-structure.test.mjs +53 -63
  103. package/tests/agents/generate/document-structure-tools/generate-sub-structure.test.mjs +277 -0
  104. package/tests/agents/init/init.test.mjs +18 -18
  105. package/tests/agents/publish/publish-docs.test.mjs +79 -0
  106. package/tests/agents/update/check-document.test.mjs +7 -67
  107. package/tests/agents/utils/load-sources.test.mjs +90 -90
  108. package/tests/agents/utils/transform-detail-datasources.test.mjs +153 -196
  109. package/tests/utils/file-utils.test.mjs +309 -1
  110. package/utils/auth-utils.mjs +9 -3
  111. package/utils/constants/index.mjs +3 -1
  112. package/utils/file-utils.mjs +315 -0
  113. package/utils/utils.mjs +89 -50
  114. package/docs/advanced-how-it-works.ja.md +0 -101
  115. package/docs/advanced-how-it-works.md +0 -101
  116. package/docs/advanced-how-it-works.zh-TW.md +0 -101
  117. package/docs/advanced-how-it-works.zh.md +0 -101
  118. package/docs/advanced-quality-assurance.ja.md +0 -92
  119. package/docs/advanced-quality-assurance.md +0 -92
  120. package/docs/advanced-quality-assurance.zh-TW.md +0 -92
  121. package/docs/advanced-quality-assurance.zh.md +0 -92
  122. package/docs/advanced.ja.md +0 -20
  123. package/docs/advanced.md +0 -20
  124. package/docs/advanced.zh-TW.md +0 -20
  125. package/docs/advanced.zh.md +0 -20
  126. package/docs/changelog.ja.md +0 -486
  127. package/docs/changelog.md +0 -486
  128. package/docs/changelog.zh-TW.md +0 -486
  129. package/docs/changelog.zh.md +0 -486
  130. package/docs/cli-reference.ja.md +0 -311
  131. package/docs/cli-reference.md +0 -311
  132. package/docs/cli-reference.zh-TW.md +0 -311
  133. package/docs/cli-reference.zh.md +0 -311
  134. package/docs/configuration-interactive-setup.ja.md +0 -138
  135. package/docs/configuration-interactive-setup.md +0 -138
  136. package/docs/configuration-interactive-setup.zh-TW.md +0 -138
  137. package/docs/configuration-interactive-setup.zh.md +0 -138
  138. package/docs/configuration-language-support.ja.md +0 -64
  139. package/docs/configuration-language-support.md +0 -64
  140. package/docs/configuration-language-support.zh-TW.md +0 -64
  141. package/docs/configuration-language-support.zh.md +0 -64
  142. package/docs/configuration-llm-setup.ja.md +0 -56
  143. package/docs/configuration-llm-setup.md +0 -56
  144. package/docs/configuration-llm-setup.zh-TW.md +0 -56
  145. package/docs/configuration-llm-setup.zh.md +0 -56
  146. package/docs/configuration-preferences.ja.md +0 -144
  147. package/docs/configuration-preferences.md +0 -144
  148. package/docs/configuration-preferences.zh-TW.md +0 -144
  149. package/docs/configuration-preferences.zh.md +0 -144
  150. package/docs/features-generate-documentation.ja.md +0 -95
  151. package/docs/features-generate-documentation.md +0 -95
  152. package/docs/features-generate-documentation.zh-TW.md +0 -95
  153. package/docs/features-generate-documentation.zh.md +0 -95
  154. package/docs/features-publish-your-docs.ja.md +0 -130
  155. package/docs/features-publish-your-docs.md +0 -130
  156. package/docs/features-publish-your-docs.zh-TW.md +0 -130
  157. package/docs/features-publish-your-docs.zh.md +0 -130
  158. package/docs/features-translate-documentation.ja.md +0 -90
  159. package/docs/features-translate-documentation.md +0 -90
  160. package/docs/features-translate-documentation.zh-TW.md +0 -90
  161. package/docs/features-translate-documentation.zh.md +0 -90
  162. package/docs/features-update-and-refine.ja.md +0 -142
  163. package/docs/features-update-and-refine.md +0 -142
  164. package/docs/features-update-and-refine.zh-TW.md +0 -143
  165. package/docs/features-update-and-refine.zh.md +0 -142
  166. package/docs/features.ja.md +0 -62
  167. package/docs/features.md +0 -62
  168. package/docs/features.zh-TW.md +0 -62
  169. package/docs/features.zh.md +0 -62
@@ -0,0 +1,255 @@
1
+ # 发行说明
2
+
3
+ 本文档总结了该工具每个版本的新功能、改进和错误修复。所有变更均按时间倒序排列。
4
+
5
+ ## 版本 0.8.12-beta.3 (2025-10-09)
6
+
7
+ ### 错误修复
8
+
9
+ - 解决了发布到云端时错误地要求管理员权限的问题。
10
+
11
+ ## 版本 0.8.12-beta.2 (2025-10-09)
12
+
13
+ ### 错误修复
14
+
15
+ - 修正了更新文档时文件路径的错误。
16
+ - 修复了可能导致文档生成和更新失败的问题。
17
+
18
+ ## 版本 0.8.12-beta.1 (2025-10-08)
19
+
20
+ ### 新功能
21
+
22
+ - 引入了历史记录跟踪功能,允许您查看文档的过往变更。
23
+ - 在文档更新过程中,翻译现在是一个可选步骤,提供了更大的灵活性。
24
+
25
+ ### 改进
26
+
27
+ - 优化了文档生成和更新流程,以提高可靠性。
28
+
29
+ ## 版本 0.8.12-beta (2025-10-07)
30
+
31
+ ### 错误修复
32
+
33
+ - 内部文件读取工具现在可以正确支持相对路径。
34
+
35
+ ## 版本 0.8.11 (2025-10-05)
36
+
37
+ 此版本包含常规维护和稳定性改进。
38
+
39
+ ## 版本 0.8.11-beta.7 (2025-10-03)
40
+
41
+ ### 新功能
42
+
43
+ - 增强了文档生成器和更新器,以获得更好的性能。
44
+ - 通过使用共享上下文,提高了文档结构分析和内容优化的速度。
45
+
46
+ ### 错误修复
47
+
48
+ - 更新了内部文档并优化了自定义组件的提示,以提高准确性。
49
+
50
+ ## 版本 0.8.11-beta.5 (2025-10-01)
51
+
52
+ ### 新功能
53
+
54
+ - 新增了对发布时的用户角色要求和自定义规则配置的支持。
55
+ - 将 D2 图表生成功能分离为一个独立的工具,以实现更专注的功能。
56
+
57
+ ## 版本 0.8.11-beta.4 (2025-09-30)
58
+
59
+ ### 新功能
60
+
61
+ - 为使用选择输入的 Agent 添加了“仅检查”选项。
62
+
63
+ ### 错误修复
64
+
65
+ - 改进了文档选择实用程序中的错误处理。
66
+ - 调整了翻译提示;现在代码块内的注释可以被正确翻译。
67
+
68
+ ## 版本 0.8.11-beta.3 (2025-09-29)
69
+
70
+ ### 错误修复
71
+
72
+ - 为评估 Agent 添加了命令行入口。
73
+
74
+ ## 版本 0.8.11-beta.2 (2025-09-27)
75
+
76
+ ### 错误修复
77
+
78
+ - 解决了依赖冲突,以确保更平稳的运行。
79
+
80
+ ## 版本 0.8.11-beta.1 (2025-09-27)
81
+
82
+ ### 新功能
83
+
84
+ - 引入了文档评估功能,以生成质量报告。
85
+ - 通过改进的工具增强了文档和结构的更新流程。
86
+ - 改进了发布过程中的供应商处理和调试能力。
87
+
88
+ ### 错误修复
89
+
90
+ - 修复了组件描述被当作属性而非文本处理的问题,从而改进了自定义组件的渲染。
91
+
92
+ ## 版本 0.8.10 (2025-09-20)
93
+
94
+ 此版本包含常规维护和稳定性改进。
95
+
96
+ ## 版本 0.8.10-beta.3 (2025-09-19)
97
+
98
+ ### 错误修复
99
+
100
+ - 添加了与企业部署相关的链接。
101
+ - 优化了文档审查提示的文案。
102
+
103
+ ## 版本 0.8.10-beta.2 (2025-09-18)
104
+
105
+ ### 错误修复
106
+
107
+ - 改进了文档结构审查的提示和显示。
108
+ - 更新了字段元素的使用规则,以确保正确渲染。
109
+
110
+ ## 版本 0.8.10-beta.1 (2025-09-18)
111
+
112
+ ### 新功能
113
+
114
+ - 新增了在生成前审查文档结构的工作流。
115
+
116
+ ### 错误修复
117
+
118
+ - 提高了用户界面中英文文本的一致性和清晰度。
119
+ - 更新了 DocSmith 徽标。
120
+
121
+ ## 版本 0.8.9 (2025-09-15)
122
+
123
+ ### 错误修复
124
+
125
+ - 更新了 D2 图表的主题颜色,以获得更好的视觉一致性。
126
+
127
+ ## 版本 0.8.8 (2025-09-13)
128
+
129
+ ### 错误修复
130
+
131
+ - 优化了问询反馈的文案,使其更清晰、更有帮助。
132
+
133
+ ## 版本 0.8.7 (2025-09-12)
134
+
135
+ ### 新功能
136
+
137
+ - 新增了使用 `<x-field>` 自定义组件定义 API 参数的支持。
138
+
139
+ ## 版本 0.8.6 (2025-09-11)
140
+
141
+ ### 新功能
142
+
143
+ - 成功发布后,现在默认显示 URL。
144
+
145
+ ### 错误修复
146
+
147
+ - 确保在部署过程中正确保存日志,以防止数据丢失。
148
+
149
+ ## 版本 0.8.5 (2025-09-10)
150
+
151
+ ### 新功能
152
+
153
+ - 新增了对将文档发布到企业空间的支持。
154
+
155
+ ## 版本 0.8.4 (2025-09-09)
156
+
157
+ ### 错误修复
158
+
159
+ - Markdown 代码块现在被解析为自定义的 `<x-code>` 元素,并支持标题和图标等增强属性。
160
+ - 将 D2 图表的背景设置为透明,以便更好地与不同主题集成。
161
+
162
+ ## 版本 0.8.3 (2025-09-05)
163
+
164
+ ### 错误修复
165
+
166
+ - 为本地图片添加了自动尺寸检测功能,以确保其正确显示。
167
+
168
+ ## 版本 0.8.1 (2025-09-03)
169
+
170
+ ### 新功能
171
+
172
+ - 通过更全面的示例调整了 D2 图表生成,以提高输出质量。
173
+
174
+ ## 版本 0.8.0 (2025-09-03)
175
+
176
+ ### 新功能
177
+
178
+ - 更新了自定义组件的指南,增加了新的格式限制。
179
+
180
+ ## 版本 0.7.1 (2025-08-31)
181
+
182
+ ### 错误修复
183
+
184
+ - 修复了使用 Tab 键进行路径选择时无法正常工作的错误。
185
+
186
+ ## 版本 0.7.0 (2025-08-30)
187
+
188
+ ### 新功能
189
+
190
+ - 新增了用于生成和管理文档的交互式聊天模式。
191
+ - 在文档生成和发布工作流中引入了对 D2 图表的支持。
192
+ - 启用了对自定义组件和更强大的配置处理的支持。
193
+
194
+ ## 版本 0.6.0 (2025-08-27)
195
+
196
+ ### 新功能
197
+
198
+ - 实现了在发布文档前对媒体进行处理的完整支持。
199
+
200
+ ## 版本 0.5.0 (2025-08-26)
201
+
202
+ ### 新功能
203
+
204
+ - 用户反馈现在可以作为持久化偏好保存,供未来会话使用。
205
+
206
+ ### 错误修复
207
+
208
+ - 优化了初始设置过程中提问的文本。
209
+
210
+ ## 版本 0.4.4 (2025-08-22)
211
+
212
+ ### 错误修复
213
+
214
+ - 新增了在发布过程中分配看板 ID 的支持。
215
+
216
+ ## 版本 0.4.1 (2025-08-21)
217
+
218
+ ### 错误修复
219
+
220
+ - 新增了对更新看板信息的支持。
221
+
222
+ ## 版本 0.4.0 (2025-08-20)
223
+
224
+ ### 新功能
225
+
226
+ - 引入了用于翻译文档的新命令 `translate`。
227
+
228
+ ## 版本 0.3.0 (2025-08-19)
229
+
230
+ ### 新功能
231
+
232
+ - 优化了在文档生成期间收集上下文的工作流。
233
+
234
+ ### 错误修复
235
+
236
+ - 优化了为运行自托管 Discuss Kit 实例的用户提供的帮助文本。
237
+
238
+ ## 版本 0.2.11 (2025-08-15)
239
+
240
+ ### 错误修复
241
+
242
+ - 更换了默认语言模型以提高生成质量。
243
+
244
+ ## 版本 0.2.5 (2025-08-08)
245
+
246
+ ### 错误修复
247
+
248
+ - 优化了命令行界面流程,以提供更流畅的用户体验。
249
+
250
+ ## 版本 0.2.0 (2025-08-05)
251
+
252
+ ### 新功能
253
+
254
+ - 现在,当运行命令时,如果配置缺失,工具将自动初始化配置。
255
+ - 新增了 `update` 命令,用于在源文件发生更改时刷新文档。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/doc-smith",
3
- "version": "0.8.12-beta.3",
3
+ "version": "0.8.12-beta.4",
4
4
  "description": "AI-driven documentation generation tool built on the AIGNE Framework",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -19,7 +19,7 @@
19
19
  "@aigne/gemini": "^0.14.0",
20
20
  "@aigne/openai": "^0.16.0",
21
21
  "@aigne/publish-docs": "^0.11.0",
22
- "@blocklet/payment-broker-client": "^1.21.5",
22
+ "@blocklet/payment-broker-client": "^1.21.10",
23
23
  "@terrastruct/d2": "^0.1.33",
24
24
  "chalk": "^5.5.0",
25
25
  "cli-highlight": "^2.1.11",
@@ -28,6 +28,8 @@
28
28
  "dompurify": "^3.2.6",
29
29
  "fs-extra": "^11.3.1",
30
30
  "glob": "^11.0.3",
31
+ "gpt-tokenizer": "^3.2.0",
32
+ "isbinaryfile": "^5.0.6",
31
33
  "jsdom": "^26.1.0",
32
34
  "marked": "^15.0.12",
33
35
  "marked-terminal": "^7.3.0",
@@ -12,6 +12,7 @@ Content Generation Rules:
12
12
  {% endif %}
13
13
  - Output complete information including all content planned for the {{nodeName}}
14
14
  - Ensure each {{nodeName}} detail includes a markdown level-1 heading displaying the current {{nodeName}} title: {{title}}
15
+ - Maintain a strict, sequential heading hierarchy; no skipping (e.g., no jump from level-1 to level-3).
15
16
  - Format markdown output with proper line breaks and spacing for easy reading
16
17
  - For list data with many items, prioritize using markdown table for cleaner, more readable presentation
17
18
  - Do not mention 'DataSources' in output, your content is for user consumption, and users are unaware of DataSources
@@ -10,15 +10,14 @@ DataSources usage rules:
10
10
  Structural planning rules:
11
11
 
12
12
  1. {{nodeName}} planning should prioritize user-specified rules, especially requirements like "number of {{nodeName}}", "must include xxx {{nodeName}}", "cannot include xxx {{nodeName}}"
13
- 2. Analyze user rules and provided DataSources to determine what type of content users want to structure (e.g., websites, documentation, books, etc.) and design appropriate structures for different content types
14
- 3. {{nodeName}} planning should display as much information as possible from the user-provided context
15
- 4. Structure planning should have reasonable hierarchical relationships, with content planned at appropriate levels, avoiding flat layouts with numerous {{nodeName}} items
16
- 5. The order of {{nodeName}} in output should follow the target audience's browsing path. It doesn't need to follow the exact order in DataSources—progress from simple to advanced, from understanding to exploration, with reasonable pathways
17
- 6. Each {{nodeName}} should have a clear content plan and must not duplicate content from other {{nodeName}} items
18
- 7. Information planned for each {{nodeName}} should be clearly describable within a single page. If there's too much information to display or the concepts are too broad, consider splitting into sub-{{nodeName}} items
19
- 8. If previous documentation structure and user feedback are provided, make only necessary modifications based on user feedback without major changes
20
- 9. If previous documentation structure is provided but no feedback is given, **directly return the previous documentation structure**
21
- 10. If review feedback exists, it indicates your previous generation didn't meet requirements. Optimize your output based on the review feedback
13
+ 2. {{nodeName}} planning should display as much information as possible from the user-provided context
14
+ 3. Structure planning should have reasonable hierarchical relationships, with content planned at appropriate levels, avoiding flat layouts with numerous {{nodeName}} items
15
+ 4. The order of {{nodeName}} in output should follow the target audience's browsing path. It doesn't need to follow the exact order in DataSources—progress from simple to advanced, from understanding to exploration, with reasonable pathways
16
+ 5. Each {{nodeName}} should have a clear content plan and must not duplicate content from other {{nodeName}} items
17
+ 6. Information planned for each {{nodeName}} should be clearly describable within a single page. If there's too much information to display or the concepts are too broad, consider splitting into sub-{{nodeName}} items
18
+ 7. If previous documentation structure and user feedback are provided, make only necessary modifications based on user feedback without major changes
19
+ 8. If previous documentation structure is provided but no feedback is given, **directly return the previous documentation structure**
20
+ 9. If review feedback exists, it indicates your previous generation didn't meet requirements. Optimize your output based on the review feedback
22
21
 
23
22
  {{nodeName}} planning rules:
24
23
 
@@ -4,6 +4,6 @@
4
4
  - If datasources contain source code, **include as much related and adjacent source code as possible** to ensure quality of subsequent detail generation.
5
5
  - First identify the most relevant source code files, then analyze the source code referenced within them. Referenced file paths, referenced files, and files in referenced paths all need to be included in sourceIds
6
6
  - For referenced files, analyze another layer of source code files referenced within them and add to sourceIds to ensure complete context for detail generation
7
- 2. Ensure sourceIds are never empty. Do not plan {{nodeName}} items without related data sources
7
+ 2. **Ensure sourceIds are never empty**. Do not plan {{nodeName}} items without related data sources
8
8
 
9
9
  </output_constraints>
@@ -4,12 +4,18 @@ Documentation structure rules:
4
4
  - Plan the structure based on the provided source code, ensuring each planned node has enough information to be displayed.
5
5
  - Group related content in the same section to avoid scattering it across multiple sections and duplicating content.
6
6
  - Keep the structure concise, avoiding splitting the same functionality into multiple parts. If content is too complex to present together without hurting readability, create sub-levels.
7
- - **First level: ≤ 7 items; hierarchy: ≤ 3 levels.** Use consistent semantics within each level (verb tense and noun number).
8
7
  - When a section contains sub-documents, show only brief content and guide users to the sub-documents for details.
9
8
  - If test-related code exists, it may serve as a reference for document generation, but **do not generate documentation for the test code**.
9
+ {% if not isSubStructure %}
10
+ - **hierarchy: ≤ 3 levels.** Use consistent semantics within each level (verb tense and noun number).
10
11
  - Always include the following at the beginning:
11
12
  - Overview: Briefly explain the problems the product solves, what it provides, and its overall structure. Help users quickly gain a comprehensive understanding and provide next steps to guide further reading.
12
13
 
13
- - Titles should not include the product name to keep the display streamlined.
14
14
  - The 'Overview' section should reference all source code to support accurate and comprehensive introductions.
15
+ {%else%}
16
+ - **hierarchy: ≤ 2 levels.** Use consistent semantics within each level (verb tense and noun number).
17
+ - The current process is generate sub-structures for a large module, showing detailed content planned in the parent document, no need to include 'Overview' section
18
+ {% endif %}
19
+
20
+ - Titles should not include the product name to keep the display streamlined.
15
21
  - Each section should reference as much related source code as possible to make the generated documentation detailed and accurate. When unsure, prioritize adding references.
@@ -33,9 +33,34 @@ Always follow one principle: You must ensure the final structural plan meets use
33
33
  {% include "../../common/document-structure/conflict-resolution-guidance.md" %}
34
34
 
35
35
 
36
- {% ifAsync docsType == 'general' %}
37
- {% include "../structure-example.md" %}
36
+ <sub_structure>
37
+ {% if isLargeContext %}
38
+ Analyze the provided file list and DataSources to complete the document structure planning:
39
+ - If the DataSources contain sufficient context and already include content from all files in the file list, you can directly generate a detailed document structure.
40
+ - First plan the document structure based on DataSources and <file_list>, ensuring all user-provided information will be presented in the document
41
+ - Ensure initial planning has sufficient content separation to avoid oversized data sources when generating sub-documents
42
+ - For sections with extensive content, use the `generateSubStructure` tool to generate detailed sub-structures
43
+ - Trigger all Tool calls at once whenever possible
44
+ - When triggering Tool calls, only output Tool call related information
45
+ - Carefully check the data returned by the `generateSubStructure` tool, integrate all data, merge the complete document structure, and finally verify that it meets the requirements in <output_constraints>
46
+
47
+ Using `generateSubStructure`:
48
+ - When the provided file list is large and DataSources don't contain all file contents, resulting in an oversized context, split the generation into sub-document structures to make the context more focused and complete
49
+ - Generate sub-documents to more effectively and fully utilize the data source files provided in <file_list>
50
+ - Requires `parentDocument` and `subSourcePaths` as context parameters
51
+ - `subSourcePaths` supports individual files and Glob Patterns, generation process:
52
+ - Analyze relevant files from the file list, include as many related files as possible to ensure complete context
53
+ - Selected files must come from <file_list>, ensure file paths are correct
54
+ - Consolidation Rules:
55
+ 1. If all files from a single directory (e.g., src/) have been selected, consolidate them into a pattern like src/\*.
56
+ 2. If multiple files with a common naming convention are selected (e.g., README.md, README-dockerfile.md, README-turbo.md), consolidate them into a pattern like README\*.md.
57
+ 3. Ensure only files correctly matched by the pattern are removed, while unmatched files must be preserved
58
+ - Merge the returned subStructure into the overall document structure plan, **ensuring all subStructures returned by the tool are included**.
59
+
60
+ {% else %}
61
+ The current context is sufficient, proceed directly with document structure planning based on DataSources.
38
62
  {% endif %}
63
+ </sub_structure>
39
64
 
40
65
 
41
66
  {% include "../../common/document-structure/output-constraints.md" %}
@@ -4,6 +4,10 @@
4
4
  {% include "../../common/document-structure/user-preferences.md" %}
5
5
 
6
6
 
7
+ <file_list>
8
+ {{allFilesPaths}}
9
+ </file_list>
10
+
7
11
  <datasources>
8
12
  {{ datasources }}
9
13
  </datasources>
@@ -43,3 +47,17 @@ If a previous structural plan (last_document_structure) is provided, follow thes
43
47
  {{ structureReviewFeedback }}
44
48
  </document_structure_review_feedback>
45
49
  {% endif %}
50
+
51
+ {% if isSubStructure %}
52
+ <parent_document>
53
+ The current process is planning sub-structures for the following section:
54
+
55
+ {{parentDocument}}
56
+
57
+ Sub-structures must meet the following requirements:
58
+ - Sub-structures are planned based on DataSources and the parent document's description
59
+ - The parent document provides an overview of the planned content, while sub-structures directly plan the specific content to be displayed
60
+ - Further break down and comprehensively display the content planned in the parent document
61
+ - All sub-structures must have their parentId value set to {{parentDocument.path}}
62
+ </parent_document>
63
+ {% endif %}
@@ -107,5 +107,17 @@ Analyze the user feedback to determine the intended operation:
107
107
  </operation_output_constraints>
108
108
  </operation_execution_rules>
109
109
 
110
+ <file_tool_usage>
111
+ 1. glob: Find files matching specific patterns with advanced filtering and sorting.
112
+
113
+ 2. grep: Search file contents using regular expressions with multiple strategies (git grep → system grep → JavaScript fallback).
114
+
115
+ 3. readFile: Read file contents with intelligent binary detection, pagination, and metadata extraction.
116
+
117
+ When to use Tools:
118
+ - During document structure update, if the given context is missing or lacks referenced content, use glob/grep/readFile to obtain more context
119
+ - When sourceIds or file content from <file_list> is needed but not provided in DataSources, use readFile to read the file content
120
+ </file_tool_usage>
121
+
110
122
 
111
123
  {% include "../../common/document-structure/output-constraints.md" %}
@@ -2,6 +2,9 @@
2
2
 
3
3
  {% include "../../common/document-structure/user-preferences.md" %}
4
4
 
5
+ <file_list>
6
+ {{allFilesPaths}}
7
+ </file_list>
5
8
 
6
9
  <datasources>
7
10
  {{ datasources }}
@@ -85,7 +85,7 @@ describe("choose-contents", () => {
85
85
  test("should prompt user when no targets provided", async () => {
86
86
  mockOptions.prompts.checkbox.mockResolvedValue(["generatedDocs"]);
87
87
 
88
- await chooseContents({}, mockOptions);
88
+ await chooseContents({ docsDir: "/test/docs", workDir: "/test" }, mockOptions);
89
89
 
90
90
  expect(mockOptions.prompts.checkbox).toHaveBeenCalledWith({
91
91
  message: "Select items to clear:",
@@ -103,7 +103,7 @@ describe("choose-contents", () => {
103
103
  test("should handle empty selection from prompts", async () => {
104
104
  mockOptions.prompts.checkbox.mockResolvedValue([]);
105
105
 
106
- const result = await chooseContents({}, mockOptions);
106
+ const result = await chooseContents({ docsDir: "/test/docs", workDir: "/test" }, mockOptions);
107
107
 
108
108
  expect(result.message).toBe("No items selected to clear.");
109
109
  expect(mockContext.invoke).not.toHaveBeenCalled();
@@ -112,16 +112,20 @@ describe("choose-contents", () => {
112
112
  test("should return available options when no prompts available", async () => {
113
113
  const optionsWithoutPrompts = { context: mockContext };
114
114
 
115
- const result = await chooseContents({}, optionsWithoutPrompts);
115
+ const result = await chooseContents(
116
+ { docsDir: "/test/docs", workDir: "/test" },
117
+ optionsWithoutPrompts,
118
+ );
116
119
 
117
120
  expect(result.message).toBe(
118
- "Available options to clear: generatedDocs, documentStructure, documentConfig, authTokens",
121
+ "Available options to clear: generatedDocs, documentStructure, documentConfig, authTokens, deploymentConfig",
119
122
  );
120
123
  expect(result.availableTargets).toEqual([
121
124
  "generatedDocs",
122
125
  "documentStructure",
123
126
  "documentConfig",
124
127
  "authTokens",
128
+ "deploymentConfig",
125
129
  ]);
126
130
  });
127
131