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

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 (257) hide show
  1. package/CLAUDE.md +43 -0
  2. package/README.md +94 -250
  3. package/aigne.yaml +5 -146
  4. package/doc-smith/SKILL.md +117 -0
  5. package/doc-smith/references/changeset_schema.md +118 -0
  6. package/doc-smith/references/document_structure_schema.md +139 -0
  7. package/doc-smith/references/document_update_guide.md +193 -0
  8. package/doc-smith/references/structure_confirmation_guide.md +133 -0
  9. package/doc-smith/references/structure_planning_guide.md +146 -0
  10. package/doc-smith/references/user_intent_guide.md +172 -0
  11. package/doc-smith.yaml +114 -0
  12. package/main-system-prompt.md +56 -0
  13. package/package.json +3 -69
  14. package/scripts/README.md +90 -0
  15. package/scripts/install.sh +86 -0
  16. package/scripts/uninstall.sh +52 -0
  17. package/CHANGELOG.md +0 -994
  18. package/LICENSE +0 -93
  19. package/agentic-agents/common/base-info.md +0 -53
  20. package/agentic-agents/common/completer.md +0 -54
  21. package/agentic-agents/common/planner.md +0 -168
  22. package/agentic-agents/common/worker.md +0 -93
  23. package/agentic-agents/create/index.yaml +0 -129
  24. package/agentic-agents/create/objective.md +0 -44
  25. package/agentic-agents/create/set-custom-prompt.mjs +0 -27
  26. package/agentic-agents/detail/index.yaml +0 -95
  27. package/agentic-agents/detail/objective.md +0 -9
  28. package/agentic-agents/detail/set-custom-prompt.mjs +0 -88
  29. package/agentic-agents/predict-resources/index.yaml +0 -44
  30. package/agentic-agents/predict-resources/instructions.md +0 -61
  31. package/agentic-agents/structure/design-rules.md +0 -39
  32. package/agentic-agents/structure/index.yaml +0 -86
  33. package/agentic-agents/structure/objective.md +0 -14
  34. package/agentic-agents/structure/review-criteria.md +0 -55
  35. package/agentic-agents/structure/set-custom-prompt.mjs +0 -78
  36. package/agentic-agents/utils/init-workspace-cache.mjs +0 -171
  37. package/agentic-agents/utils/load-base-sources.mjs +0 -20
  38. package/agentic-agents/workspace-cache-sharing-design.md +0 -671
  39. package/agents/chat/chat-system.md +0 -38
  40. package/agents/chat/index.mjs +0 -59
  41. package/agents/chat/skills/generate-document.yaml +0 -15
  42. package/agents/chat/skills/list-documents.mjs +0 -15
  43. package/agents/chat/skills/update-document.yaml +0 -24
  44. package/agents/clear/choose-contents.mjs +0 -192
  45. package/agents/clear/clear-auth-tokens.mjs +0 -88
  46. package/agents/clear/clear-deployment-config.mjs +0 -49
  47. package/agents/clear/clear-document-config.mjs +0 -36
  48. package/agents/clear/clear-document-structure.mjs +0 -102
  49. package/agents/clear/clear-generated-docs.mjs +0 -142
  50. package/agents/clear/clear-media-description.mjs +0 -129
  51. package/agents/clear/index.yaml +0 -26
  52. package/agents/create/analyze-diagram-type-llm.yaml +0 -160
  53. package/agents/create/analyze-diagram-type.mjs +0 -297
  54. package/agents/create/check-document-structure.yaml +0 -30
  55. package/agents/create/check-need-generate-structure.mjs +0 -105
  56. package/agents/create/document-structure-tools/add-document.mjs +0 -85
  57. package/agents/create/document-structure-tools/delete-document.mjs +0 -116
  58. package/agents/create/document-structure-tools/move-document.mjs +0 -109
  59. package/agents/create/document-structure-tools/update-document.mjs +0 -84
  60. package/agents/create/generate-diagram-image.yaml +0 -60
  61. package/agents/create/generate-structure.yaml +0 -117
  62. package/agents/create/index.yaml +0 -49
  63. package/agents/create/refine-document-structure.yaml +0 -12
  64. package/agents/create/replace-d2-with-image.mjs +0 -625
  65. package/agents/create/update-document-structure.yaml +0 -54
  66. package/agents/create/user-add-document/add-documents-to-structure.mjs +0 -90
  67. package/agents/create/user-add-document/find-documents-to-add-links.yaml +0 -47
  68. package/agents/create/user-add-document/index.yaml +0 -46
  69. package/agents/create/user-add-document/prepare-documents-to-translate.mjs +0 -22
  70. package/agents/create/user-add-document/print-add-document-summary.mjs +0 -63
  71. package/agents/create/user-add-document/review-documents-with-new-links.mjs +0 -110
  72. package/agents/create/user-remove-document/find-documents-with-invalid-links.mjs +0 -78
  73. package/agents/create/user-remove-document/index.yaml +0 -40
  74. package/agents/create/user-remove-document/prepare-documents-to-translate.mjs +0 -22
  75. package/agents/create/user-remove-document/print-remove-document-summary.mjs +0 -53
  76. package/agents/create/user-remove-document/remove-documents-from-structure.mjs +0 -99
  77. package/agents/create/user-remove-document/review-documents-with-invalid-links.mjs +0 -115
  78. package/agents/create/user-review-document-structure.mjs +0 -140
  79. package/agents/create/utils/init-current-content.mjs +0 -34
  80. package/agents/create/utils/merge-document-structures.mjs +0 -30
  81. package/agents/evaluate/code-snippet.mjs +0 -97
  82. package/agents/evaluate/document-structure.yaml +0 -67
  83. package/agents/evaluate/document.yaml +0 -82
  84. package/agents/evaluate/generate-report.mjs +0 -85
  85. package/agents/evaluate/index.yaml +0 -46
  86. package/agents/history/index.yaml +0 -6
  87. package/agents/history/view.mjs +0 -78
  88. package/agents/init/check.mjs +0 -16
  89. package/agents/init/index.mjs +0 -275
  90. package/agents/init/validate.mjs +0 -16
  91. package/agents/localize/choose-language.mjs +0 -107
  92. package/agents/localize/index.yaml +0 -58
  93. package/agents/localize/record-translation-history.mjs +0 -23
  94. package/agents/localize/translate-document.yaml +0 -24
  95. package/agents/localize/translate-multilingual.yaml +0 -51
  96. package/agents/media/batch-generate-media-description.yaml +0 -46
  97. package/agents/media/generate-media-description.yaml +0 -50
  98. package/agents/media/load-media-description.mjs +0 -256
  99. package/agents/prefs/index.mjs +0 -203
  100. package/agents/publish/index.yaml +0 -26
  101. package/agents/publish/publish-docs.mjs +0 -356
  102. package/agents/publish/translate-meta.mjs +0 -103
  103. package/agents/schema/document-structure-item.yaml +0 -26
  104. package/agents/schema/document-structure-refine-item.yaml +0 -23
  105. package/agents/schema/document-structure.yaml +0 -29
  106. package/agents/update/batch-generate-document.yaml +0 -27
  107. package/agents/update/batch-update-document.yaml +0 -7
  108. package/agents/update/check-diagram-flag.mjs +0 -116
  109. package/agents/update/check-document.mjs +0 -162
  110. package/agents/update/check-generate-diagram.mjs +0 -106
  111. package/agents/update/check-sync-image-flag.mjs +0 -55
  112. package/agents/update/check-update-is-single.mjs +0 -53
  113. package/agents/update/document-tools/update-document-content.mjs +0 -303
  114. package/agents/update/generate-diagram.yaml +0 -63
  115. package/agents/update/generate-document.yaml +0 -70
  116. package/agents/update/handle-document-update.yaml +0 -103
  117. package/agents/update/index.yaml +0 -79
  118. package/agents/update/pre-check-generate-diagram.yaml +0 -44
  119. package/agents/update/save-and-translate-document.mjs +0 -76
  120. package/agents/update/sync-images-and-exit.mjs +0 -148
  121. package/agents/update/update-document-detail.yaml +0 -71
  122. package/agents/update/update-single/update-single-document-detail.mjs +0 -280
  123. package/agents/update/update-single-document.yaml +0 -7
  124. package/agents/update/user-review-document.mjs +0 -272
  125. package/agents/utils/action-success.mjs +0 -16
  126. package/agents/utils/analyze-document-feedback-intent.yaml +0 -32
  127. package/agents/utils/analyze-feedback-intent.mjs +0 -136
  128. package/agents/utils/analyze-structure-feedback-intent.yaml +0 -29
  129. package/agents/utils/check-detail-result.mjs +0 -38
  130. package/agents/utils/check-feedback-refiner.mjs +0 -81
  131. package/agents/utils/choose-docs.mjs +0 -293
  132. package/agents/utils/document-icon-generate.yaml +0 -52
  133. package/agents/utils/document-title-streamline.yaml +0 -48
  134. package/agents/utils/ensure-document-icons.mjs +0 -129
  135. package/agents/utils/exit.mjs +0 -6
  136. package/agents/utils/feedback-refiner.yaml +0 -50
  137. package/agents/utils/find-item-by-path.mjs +0 -114
  138. package/agents/utils/find-user-preferences-by-path.mjs +0 -37
  139. package/agents/utils/format-document-structure.mjs +0 -35
  140. package/agents/utils/generate-document-or-skip.mjs +0 -41
  141. package/agents/utils/handle-diagram-operations.mjs +0 -263
  142. package/agents/utils/load-all-document-content.mjs +0 -30
  143. package/agents/utils/load-document-all-content.mjs +0 -84
  144. package/agents/utils/load-sources.mjs +0 -405
  145. package/agents/utils/map-reasoning-effort-level.mjs +0 -15
  146. package/agents/utils/post-generate.mjs +0 -144
  147. package/agents/utils/read-current-document-content.mjs +0 -46
  148. package/agents/utils/save-doc-translation.mjs +0 -61
  149. package/agents/utils/save-doc.mjs +0 -88
  150. package/agents/utils/save-output.mjs +0 -26
  151. package/agents/utils/save-sidebar.mjs +0 -51
  152. package/agents/utils/skip-if-content-exists.mjs +0 -27
  153. package/agents/utils/streamline-document-titles-if-needed.mjs +0 -88
  154. package/agents/utils/transform-detail-data-sources.mjs +0 -45
  155. package/agents/utils/update-branding.mjs +0 -84
  156. package/assets/report-template/report.html +0 -198
  157. package/docs-mcp/analyze-content-relevance.yaml +0 -50
  158. package/docs-mcp/analyze-docs-relevance.yaml +0 -59
  159. package/docs-mcp/docs-search.yaml +0 -42
  160. package/docs-mcp/get-docs-detail.mjs +0 -41
  161. package/docs-mcp/get-docs-structure.mjs +0 -16
  162. package/docs-mcp/read-doc-content.mjs +0 -119
  163. package/prompts/common/document/content-rules-core.md +0 -20
  164. package/prompts/common/document/markdown-syntax-rules.md +0 -65
  165. package/prompts/common/document/media-file-list-usage-rules.md +0 -18
  166. package/prompts/common/document/openapi-usage-rules.md +0 -189
  167. package/prompts/common/document/role-and-personality.md +0 -16
  168. package/prompts/common/document/user-preferences.md +0 -9
  169. package/prompts/common/document-structure/conflict-resolution-guidance.md +0 -16
  170. package/prompts/common/document-structure/document-icon-generate.md +0 -116
  171. package/prompts/common/document-structure/document-structure-rules.md +0 -43
  172. package/prompts/common/document-structure/document-title-streamline.md +0 -86
  173. package/prompts/common/document-structure/glossary.md +0 -7
  174. package/prompts/common/document-structure/intj-traits.md +0 -5
  175. package/prompts/common/document-structure/openapi-usage-rules.md +0 -28
  176. package/prompts/common/document-structure/output-constraints.md +0 -18
  177. package/prompts/common/document-structure/user-locale-rules.md +0 -10
  178. package/prompts/common/document-structure/user-preferences.md +0 -9
  179. package/prompts/detail/custom/admonition-usage-rules.md +0 -94
  180. package/prompts/detail/custom/code-block-usage-rules.md +0 -163
  181. package/prompts/detail/custom/custom-components/x-card-usage-rules.md +0 -63
  182. package/prompts/detail/custom/custom-components/x-cards-usage-rules.md +0 -83
  183. package/prompts/detail/custom/custom-components/x-field-desc-usage-rules.md +0 -120
  184. package/prompts/detail/custom/custom-components/x-field-group-usage-rules.md +0 -80
  185. package/prompts/detail/custom/custom-components/x-field-usage-rules.md +0 -189
  186. package/prompts/detail/custom/custom-components-usage-rules.md +0 -18
  187. package/prompts/detail/diagram/generate-image-system.md +0 -135
  188. package/prompts/detail/diagram/generate-image-user.md +0 -32
  189. package/prompts/detail/diagram/guide.md +0 -29
  190. package/prompts/detail/diagram/official-examples.md +0 -712
  191. package/prompts/detail/diagram/pre-check.md +0 -23
  192. package/prompts/detail/diagram/role-and-personality.md +0 -2
  193. package/prompts/detail/diagram/rules.md +0 -46
  194. package/prompts/detail/diagram/system-prompt.md +0 -1139
  195. package/prompts/detail/diagram/user-prompt.md +0 -43
  196. package/prompts/detail/generate/detail-example.md +0 -457
  197. package/prompts/detail/generate/document-rules.md +0 -45
  198. package/prompts/detail/generate/system-prompt.md +0 -61
  199. package/prompts/detail/generate/user-prompt.md +0 -99
  200. package/prompts/detail/jsx/rules.md +0 -6
  201. package/prompts/detail/update/system-prompt.md +0 -121
  202. package/prompts/detail/update/user-prompt.md +0 -41
  203. package/prompts/evaluate/document-structure.md +0 -93
  204. package/prompts/evaluate/document.md +0 -149
  205. package/prompts/media/media-description/system-prompt.md +0 -43
  206. package/prompts/media/media-description/user-prompt.md +0 -17
  207. package/prompts/structure/check-document-structure.md +0 -93
  208. package/prompts/structure/document-rules.md +0 -21
  209. package/prompts/structure/find-documents-to-add-links.md +0 -52
  210. package/prompts/structure/generate/system-prompt.md +0 -13
  211. package/prompts/structure/generate/user-prompt.md +0 -137
  212. package/prompts/structure/review/structure-review-system.md +0 -81
  213. package/prompts/structure/structure-example.md +0 -89
  214. package/prompts/structure/structure-getting-started.md +0 -10
  215. package/prompts/structure/update/system-prompt.md +0 -93
  216. package/prompts/structure/update/user-prompt.md +0 -43
  217. package/prompts/translate/admonition.md +0 -20
  218. package/prompts/translate/code-block.md +0 -33
  219. package/prompts/translate/glossary.md +0 -6
  220. package/prompts/translate/translate-document.md +0 -305
  221. package/prompts/utils/analyze-document-feedback-intent.md +0 -54
  222. package/prompts/utils/analyze-structure-feedback-intent.md +0 -43
  223. package/prompts/utils/feedback-refiner.md +0 -105
  224. package/types/document-schema.mjs +0 -55
  225. package/types/document-structure-schema.mjs +0 -261
  226. package/utils/auth-utils.mjs +0 -275
  227. package/utils/blocklet.mjs +0 -104
  228. package/utils/check-document-has-diagram.mjs +0 -95
  229. package/utils/conflict-detector.mjs +0 -149
  230. package/utils/constants/index.mjs +0 -620
  231. package/utils/constants/linter.mjs +0 -102
  232. package/utils/d2-utils.mjs +0 -198
  233. package/utils/debug.mjs +0 -3
  234. package/utils/delete-diagram-images.mjs +0 -99
  235. package/utils/deploy.mjs +0 -86
  236. package/utils/docs-finder-utils.mjs +0 -623
  237. package/utils/evaluate/report-utils.mjs +0 -132
  238. package/utils/extract-api.mjs +0 -32
  239. package/utils/file-utils.mjs +0 -960
  240. package/utils/history-utils.mjs +0 -203
  241. package/utils/icon-map.mjs +0 -26
  242. package/utils/image-compress.mjs +0 -75
  243. package/utils/kroki-utils.mjs +0 -173
  244. package/utils/linter/index.mjs +0 -50
  245. package/utils/load-config.mjs +0 -107
  246. package/utils/markdown/index.mjs +0 -26
  247. package/utils/markdown-checker.mjs +0 -694
  248. package/utils/mermaid-validator.mjs +0 -140
  249. package/utils/mermaid-worker-pool.mjs +0 -250
  250. package/utils/mermaid-worker.mjs +0 -233
  251. package/utils/openapi/index.mjs +0 -28
  252. package/utils/preferences-utils.mjs +0 -175
  253. package/utils/request.mjs +0 -10
  254. package/utils/store/index.mjs +0 -45
  255. package/utils/sync-diagram-to-translations.mjs +0 -262
  256. package/utils/upload-files.mjs +0 -231
  257. package/utils/utils.mjs +0 -1354
@@ -1,95 +0,0 @@
1
- type: team
2
- name: GenerateDetail
3
- description: Generate or update detailed content for multiple documentation files
4
- input_schema:
5
- type: object
6
- properties:
7
- rules:
8
- type: string
9
- description: Your specific requirements for documentation structure
10
- locale:
11
- type: string
12
- description: Primary language for documentation (e.g., zh, en, ja)
13
- tasks:
14
- type: array
15
- description: Tasks describing which documents to generate/update, including title, path, description, sourcePaths, and task description
16
- items:
17
- type: object
18
- properties:
19
- task:
20
- type: string
21
- description: Task describing which document to generate/update, including title, path, description, sourcePaths, and task description
22
- iterate_on: tasks
23
- concurrency: 5
24
- skills:
25
- # - ../utils/load-base-sources.mjs
26
- - ./set-custom-prompt.mjs
27
- - type: "@aigne/agent-library/orchestrator"
28
- input_schema:
29
- type: object
30
- properties:
31
- task:
32
- type: string
33
- description: Task describing which document to generate/update, including title, path, description, sourcePaths, and task description
34
- rules:
35
- type: string
36
- description: Your specific requirements for documentation content
37
- locale:
38
- type: string
39
- description: Primary language for documentation (e.g., zh, en, ja)
40
- objective:
41
- url: objective.md
42
- planner:
43
- type: ai
44
- model: anthropic/claude-opus-4-5
45
- instructions:
46
- url: ../common/planner.md
47
- input_schema:
48
- type: object
49
- properties:
50
- workspace:
51
- type: string
52
- description: The workspace path
53
- doc_smith_workspace:
54
- type: string
55
- description: The Doc Smith workspace path
56
- plannerInitState:
57
- type: string
58
- description: The initial state of the planner
59
- customPlannerPrompt:
60
- type: string
61
- description: The custom planner prompt
62
- worker:
63
- type: ai
64
- model: gemini-3-pro-preview
65
- instructions:
66
- url: ../common/worker.md
67
- input_schema:
68
- type: object
69
- properties:
70
- workspace:
71
- type: string
72
- description: The workspace path
73
- doc_smith_workspace:
74
- type: string
75
- description: The Doc Smith workspace path
76
- domainKnowledge:
77
- type: string
78
- description: The domain knowledge
79
- completer:
80
- type: function
81
- process: |
82
- let message = 'All tasks have been completed.';
83
- return { message };
84
- afs:
85
- modules:
86
- - module: local-fs
87
- options:
88
- name: workspace
89
- localPath: .
90
- description: The target repository containing source code and documentation. Read-only, cannot be modified.
91
- - module: local-fs
92
- options:
93
- name: doc-smith
94
- localPath: .aigne/doc-smith
95
- description: The Doc Smith workspace for storing intermediate and output files
@@ -1,9 +0,0 @@
1
- 目标:
2
- {{ task }}
3
-
4
- 我对文档的要求:
5
- 以 {{ locale }} 语言输出内容
6
- {% if rules %}
7
- {{ rules }}
8
- {% endif %}
9
-
@@ -1,88 +0,0 @@
1
- import fs from "node:fs";
2
- import path from "node:path";
3
- import { fileURLToPath } from "node:url";
4
-
5
- const __filename = fileURLToPath(import.meta.url);
6
- const __dirname = path.dirname(__filename);
7
-
8
- // FIXME: 临时使用这种方式设置自定义变量,框架优化后需要修改
9
- export default function getCustomPrompt({ structureContent }) {
10
- let finalStructureContent = "文档结构未生成";
11
- if (structureContent) {
12
- finalStructureContent = `
13
- \`\`\`yaml\n${structureContent}\n\`\`\`
14
- `;
15
- }
16
-
17
- const plannerInitState = `
18
- 文档结构(/modules/doc-smith/output/document_structure.yaml):
19
- ${finalStructureContent}
20
- `;
21
- const customPlannerPrompt = `
22
- - 首先确定需要处理的是文档结构中的哪一篇文档
23
- - 检查文档是否已存在,决定是生成新文档还是更新现有文档
24
- - 文档详情以 markdown 的格式输出在 /modules/doc-smith/docs 目录中,根据文档的 \`path\` 生成文件名。
25
- - 读取 sourcePaths 中的文件作为初始上下文,按需求读取更多的相关文件作为上下文
26
- - 生成文档内容后,review 文档内容,确保符合文档质量标准
27
-
28
- `;
29
-
30
- const baseInfoPath = path.join(__dirname, "../common/base-info.md");
31
- const baseInfo = fs.readFileSync(baseInfoPath, "utf-8");
32
-
33
- const domainKnowledge = `
34
- ${baseInfo}
35
-
36
- ### 文档质量标准
37
-
38
- #### 深度要求
39
-
40
- 每篇文档应该:
41
- - 基于 sourcePaths 中的数据源生成详细准确的内容
42
- - 根据需要读取更多相关数据源作为上下文
43
- - 每个章节应尽可能参考更多相关数据源,使生成的文档详细准确
44
-
45
- 文档应该是**生产级别、可直接使用**的,而不是简单概述。
46
-
47
- #### 必须包含的内容
48
-
49
- - **代码示例**: 可运行的完整代码,包含必要的 import 语句
50
- - **响应数据示例**: 所有接口和方法必须包含响应数据示例
51
- - **配置参数说明**: 全面解释配置选项和参数,多值参数需解释每个选项的用途
52
-
53
- #### 标准结构
54
-
55
- 每篇文档包含:
56
- - **标题层级正确**: 总是以一级标题开始,标题层级连续
57
- - **Opening Hook**: 简洁有力(≤50 词),说明读者将获得什么
58
- - **引言**: 包含相关文档内链
59
- - **主体**: 多个小节,含代码示例和说明
60
- - **总结**: 包含延伸阅读链接(引导阅读其他相关文档)
61
-
62
- #### 写作风格
63
-
64
- - 简洁、严谨、准确
65
- - 为人类写作,不是为算法
66
- - 主动语态优先,可混用被动
67
- - 直接表达: 发生了什么、为什么重要、如何帮助
68
-
69
- #### 信息获取
70
-
71
- - workspace 中的数据源需要主动探索和搜索
72
- - 基于实际找到的信息生成文档
73
- - 不编造或假设不存在的功能
74
-
75
- #### 数据源使用
76
-
77
- - 公开产品/技术: 可用已有知识补充
78
- - 私有产品: 不能编造虚假信息
79
- - 信息不足: 说明需要更多上下文
80
-
81
- `;
82
-
83
- return {
84
- plannerInitState,
85
- customPlannerPrompt,
86
- domainKnowledge,
87
- };
88
- }
@@ -1,44 +0,0 @@
1
- type: ai
2
- name: predictResources
3
- description: Predict necessary resources for documentation task
4
-
5
- instructions:
6
- url: ./instructions.md
7
-
8
- input_schema:
9
- type: object
10
- properties:
11
- query:
12
- type: string
13
- description: The user's documentation objective to predict resources for
14
- path:
15
- type: string
16
- description: The workspace path
17
-
18
- default_input:
19
- path: "/modules/workspace"
20
-
21
- output_schema:
22
- type: object
23
- properties:
24
- data:
25
- type: array
26
- items:
27
- type: string
28
- description: A list of predicted resources needed for the documentation task, must be absolute file paths within the workspace.
29
-
30
- afs:
31
- modules:
32
- - module: local-fs
33
- options:
34
- name: workspace
35
- localPath: .
36
- description: The target repository containing source code and documentation. Read-only, cannot be modified.
37
- ignore:
38
- - ".git"
39
- - ".aigne"
40
- - module: local-fs
41
- options:
42
- name: doc-smith
43
- localPath: .aigne/doc-smith
44
- description: The Doc Smith workspace for storing intermediate and output files
@@ -1,61 +0,0 @@
1
- You are a resource prediction agent. Your job is to analyze a workspace directory structure and predict which files would be most relevant for a given documentation task.
2
-
3
- ## Your Responsibility
4
-
5
- Given a workspace directory structure and a user's documentation objective, you must:
6
- 1. Analyze the directory structure to understand the project layout
7
- 2. Identify files that are most likely to provide useful context for the documentation task
8
- 3. Return a prioritized list of file paths that should be read
9
-
10
- ## Workspace Directory Structure
11
-
12
- ```yaml alt="The cached directory structure of the workspace"
13
- {{ $afs.list("/modules/workspace", { maxChildren: 50, maxDepth: 10 }) | yaml.stringify }}
14
- ```
15
-
16
- ```yaml alt="The cached directory structure of the doc-smith"
17
- {{ $afs.list("/modules/doc-smith", { maxChildren: 50, maxDepth: 10 }) | yaml.stringify }}
18
- ```
19
-
20
- ## Documentation Objective
21
-
22
- ```txt alt="The user's objective you should help predict resources for"
23
- {{ query }}
24
- ```
25
-
26
- ## Selection Principles
27
-
28
- ### What to Include
29
-
30
- - **Entry points**: Main files, index files, configuration files that define project structure
31
- - **Core modules**: Files that implement the main functionality related to the objective
32
- - **Type definitions**: TypeScript types, interfaces, schemas that define data structures
33
- - **Configuration**: Package.json, tsconfig.json, and other config files that reveal project dependencies and settings
34
- - **Documentation**: Existing README files, docs that provide context
35
- - **Examples**: Example files or test files that demonstrate usage patterns
36
-
37
- ### What to Exclude
38
-
39
- - **Generated files**: Build outputs, compiled code, node_modules contents
40
- - **Binary files**: Images, fonts, compiled assets (unless specifically relevant)
41
- - **Lock files**: package-lock.json, yarn.lock, pnpm-lock.yaml
42
- - **Cache/temp files**: .cache, .tmp, dist directories
43
- - **Redundant files**: If multiple files serve similar purposes, select the most representative ones
44
-
45
- ### Prioritization Strategy
46
-
47
- 1. **High priority**: Files directly related to the documentation objective
48
- 2. **Medium priority**: Files that provide structural context (configs, types, main exports)
49
- 3. **Low priority**: Supporting files that may provide additional context
50
-
51
- ## Important Constraints
52
-
53
- - **Return absolute paths**: All paths must be absolute paths within the workspace (e.g., `/modules/workspace/src/index.ts`)
54
- - **Be selective**: Don't return every file. Focus on quality over quantity - typically 5-20 files is appropriate
55
- - **Consider file size**: Prefer smaller, focused files over large monolithic ones when possible
56
- - **No directories**: Return only file paths, not directory paths
57
- - **Verify existence**: Only return files that exist in the provided directory structure
58
-
59
- ## Output Format
60
-
61
- Return your prediction as a structured response with a `resources` array containing the predicted file paths, ordered by relevance (most relevant first).
@@ -1,39 +0,0 @@
1
-
2
- 1. **sourcePaths Must Be Files**: This is CRITICAL - `sourcePaths` must contain only file paths, never directory paths
3
- - ✅ Correct: `["README.md", "src/index.ts", "docs/guide.md"]`
4
- - ❌ Wrong: `["src/", "docs/", "src/components/"]`
5
- - Must be relative paths from workspace root, **without** the `/modules/workspace` prefix
6
- - Examples: `src/index.ts`, `README.md`, `package.json`, `docs/api.md`
7
-
8
- 2. **Prioritize Based on Project Focus**: Use insights from README and docs to guide structure
9
- - If README highlights specific features, create dedicated sections for them
10
- - If the project emphasizes certain workflows, mirror this in structure
11
- - Create documentation that helps users understand what the project owners consider most important
12
-
13
- 3. **Create a Logical, User-Focused Hierarchy**:
14
- - Start with what users need first (overview, quick start, core concepts)
15
- - Follow with detailed sections for key features
16
- - Include advanced topics and reference material later
17
- - Each document section should have a distinct, non-overlapping purpose
18
-
19
- 4. **Focus on Project Domain, Not Build System**: For code projects, focus documentation on the project's core purpose and functionality, NOT on build/tooling infrastructure
20
- - ✅ **Include**: Project features, APIs, architecture, usage guides, domain concepts
21
- - ❌ **Exclude**: Build system docs (webpack config, rollup setup, vite config), CI/CD pipelines, development tooling setup, linting/formatting configuration
22
- - **Exception**: Only include build/tooling docs if the project IS a build tool
23
-
24
- 5. **For Multi-Package Projects**: Create hierarchical documentation structure
25
- - Start with overview documentation (getting started, architecture overview)
26
- - Create a parent section for each package/module with clear naming
27
- - Under each package section, add child sections for that package's specific documentation
28
- - Include cross-package documentation (how packages interact, dependency graph)
29
-
30
- 6. **sourcePaths Should Be Comprehensive**:
31
- - Include as many related files as possible to ensure quality of subsequent detail generation
32
- - If analyzing source code, include related and adjacent source code files
33
- - Analyze referenced files within the source code and include them too
34
- - **Ensure sourcePaths are never empty** - Do not create document sections without related data sources
35
-
36
- 7. **Character Length Constraints**:
37
- - `project.title`: Must not exceed **40 characters** (all languages count equally)
38
- - `project.description`: Must not exceed **160 characters** (all languages count equally)
39
- - Ensure generated content is complete and grammatically correct within these constraints
@@ -1,86 +0,0 @@
1
- type: team
2
- name: GenerateStructure
3
- description: Generate the structure of your documentation
4
- input_schema:
5
- type: object
6
- properties:
7
- rules:
8
- type: string
9
- description: Your specific requirements for documentation structure
10
- locale:
11
- type: string
12
- description: Primary language for documentation (e.g., zh, en, ja)
13
- task:
14
- type: string
15
- description: Task related to this documentation structure
16
- skills:
17
- # - ../utils/load-base-sources.mjs
18
- - ./set-custom-prompt.mjs
19
- - type: "@aigne/agent-library/orchestrator"
20
- objective:
21
- url: objective.md
22
- planner:
23
- type: ai
24
- model: anthropic/claude-opus-4-5
25
- instructions:
26
- url: ../common/planner.md
27
- input_schema:
28
- type: object
29
- properties:
30
- isStructureGenerator:
31
- type: boolean
32
- description: Flag indicating if this is for structure generation
33
- workspace:
34
- type: string
35
- description: The workspace path
36
- doc_smith_workspace:
37
- type: string
38
- description: The Doc Smith workspace path
39
- plannerInitState:
40
- type: string
41
- description: The initial state of the planner
42
- customPlannerPrompt:
43
- type: string
44
- description: The custom planner prompt
45
- default_input:
46
- isStructureGenerator: true
47
- worker:
48
- type: ai
49
- model: gemini-3-pro-preview
50
- instructions:
51
- url: ../common/worker.md
52
- input_schema:
53
- type: object
54
- properties:
55
- workspace:
56
- type: string
57
- description: The workspace path
58
- doc_smith_workspace:
59
- type: string
60
- description: The Doc Smith workspace path
61
- domainKnowledge:
62
- type: string
63
- description: The domain knowledge
64
- completer:
65
- type: function
66
- process: |
67
- let message = 'Structure generation completed.';
68
- return { task: input.task, message };
69
- afs:
70
- modules:
71
- - module: local-fs
72
- options:
73
- name: workspace
74
- localPath: .
75
- description: The target repository containing source code and documentation. Read-only, cannot be modified.
76
- - module: local-fs
77
- options:
78
- name: doc-smith
79
- localPath: .aigne/doc-smith
80
- description: The Doc Smith workspace for storing intermediate and output files
81
- context:
82
- search:
83
- presets:
84
- predict-resources:
85
- select:
86
- agent: "../predict-resources/index.yaml"
@@ -1,14 +0,0 @@
1
- {{ task }}
2
-
3
- 我对文档的要求:
4
- 以 {{ locale }} 语言输出内容
5
- {% if rules %}
6
- {{ rules }}
7
- {% endif %}
8
-
9
- 设计要求:
10
- {% include "design-rules.md" %}
11
-
12
- 质量审查标准:
13
-
14
- {% include "review-criteria.md" %}
@@ -1,55 +0,0 @@
1
-
2
- 1. **YAML Format Correctness** - Automatic rejection if:
3
- - Indentation is not exactly 2 spaces per level
4
- - Missing spaces after colons (e.g., `title:"value"` instead of `title: "value"`)
5
- - List items don't start with `- ` (dash + space)
6
- - Special characters are not properly quoted
7
- - Any YAML syntax errors that would cause parsing to fail
8
-
9
- 2. **Valid sourcePaths** - Automatic rejection if:
10
- - ANY `sourcePaths` entry contains a directory path (e.g., `src/`, `docs/`)
11
- - ANY `sourcePaths` entry includes the `/modules/workspace` prefix
12
- - ANY `sourcePaths` entry uses absolute paths
13
- - ✅ Valid examples: `README.md`, `src/index.ts`, `docs/api.md`
14
- - ❌ Invalid examples: `src/`, `/modules/workspace/README.md`, `/absolute/path/file.ts`
15
-
16
- 3. **Project Domain Focus** - Automatic rejection if:
17
- - Structure includes build/tooling documentation for non-build-tool projects (e.g., "Webpack Configuration", "CI/CD Pipeline", "ESLint Rules")
18
- - Documentation focuses on internal development infrastructure instead of project features
19
- - ✅ Approve: Project features, APIs, architecture, usage guides, domain concepts
20
- - ❌ Reject: Build configs, CI/CD, linting setup (unless the project IS a build tool)
21
-
22
- ## Quality Assessment Checks
23
-
24
- 4. **Adequate Coverage and Depth**
25
- - Reject if structure is too minimal (only 1-2 sections for non-trivial projects)
26
- - Reject if missing obvious sections (e.g., no API docs for a library, no getting-started guide)
27
- - Approve if structure has appropriate breadth and depth
28
-
29
- 5. **Project Priorities Alignment**
30
- - Reject if structure ignores key features emphasized in README/documentation
31
- - Approve if key features from README have dedicated sections
32
-
33
- 6. **Multi-Package/Monorepo Structure** (if applicable)
34
- - Reject if ANY package section lacks nested children subsections
35
- - Approve if each package has its own section with children organizing package-specific docs
36
-
37
- 7. **No Duplicate Sections**
38
- - Reject if multiple sections have the same purpose without clear differentiation
39
-
40
- 8. **Clear Section Purposes**
41
- - Reject if section titles are vague (e.g., "Other", "Misc", "Files")
42
-
43
- ## Review Decision Making
44
-
45
- **If user feedback exists**:
46
- - ONLY verify that structure changes address the user's specific feedback
47
- - Ignore all standard quality criteria
48
- - Approve if user's requirements are met, even if other issues exist
49
-
50
- **If no user feedback**:
51
- - Apply all quality criteria strictly
52
- - Reject if any critical validation fails
53
- - Reject if multiple quality issues exist
54
-
55
- **If rejected**: Loop back to design phase and regenerate based on review feedback
@@ -1,78 +0,0 @@
1
- import fs from "node:fs";
2
- import path from "node:path";
3
- import { fileURLToPath } from "node:url";
4
-
5
- const __filename = fileURLToPath(import.meta.url);
6
- const __dirname = path.dirname(__filename);
7
-
8
- // FIXME: 临时使用这种方式设置自定义变量,框架优化后需要修改
9
- export default function getCustomPrompt({ structureContent }) {
10
- let finalStructureContent = "文档结构未生成";
11
- if (structureContent) {
12
- finalStructureContent = `
13
- \`\`\`yaml\n${structureContent}\n\`\`\`
14
- `;
15
- }
16
- const plannerInitState = `
17
- 文档结构(/modules/doc-smith/output/document_structure.yaml):
18
- ${finalStructureContent}
19
- `;
20
-
21
- const customPlannerPrompt = `
22
- - 文档结构生成之后,需要按照'质量审查标准',进行质量审查,并修复发现的问题
23
- - 关键: 在保存 YAML 文件之前,严格验证格式:
24
-
25
- ✅ **正确格式示例:**
26
- \`\`\`yaml
27
- project:
28
- title: "我的项目"
29
- description: "项目的简要描述"
30
-
31
- documents:
32
- - title: "概览"
33
- description: "项目介绍"
34
- path: /overview.md
35
- sourcePaths:
36
- - README.md
37
- - docs/intro.md
38
- children: []
39
- - title: "API 参考"
40
- description: "完整的 API 文档"
41
- path: /api-Reference.md
42
- sourcePaths:
43
- - docs/api.md
44
- children:
45
- - title: "核心 API"
46
- path: /core-api.md
47
- description: "核心功能"
48
- sourcePaths:
49
- - docs/api/core.md
50
- children: []
51
- \`\`\`
52
-
53
- ❌ **要避免的常见错误:**
54
- 1. 冒号后缺少空格: \`title:"测试"\` (错误) → \`title: "测试"\` (正确)
55
- 2. 错误的缩进: 每级必须恰好 2 个空格
56
- 3. 列表项缺少破折号: \`documents: title: "测试"\` (错误) → \`documents: - title: "测试"\` (正确)
57
- 4. sourcePaths 中的目录路径: \`sourcePaths: - src/\` (错误) → \`sourcePaths: - src/index.ts\` (正确)
58
- 5. 包含模块前缀: \`/modules/workspace/README.md\` (错误) → \`README.md\` (正确)
59
-
60
- `;
61
-
62
- const baseInfoPath = path.join(__dirname, "../common/base-info.md");
63
- const baseInfo = fs.readFileSync(baseInfoPath, "utf-8");
64
-
65
- const domainKnowledge = `
66
- ${baseInfo}
67
-
68
- ### 使用用文档相关的 Skill 完成任务
69
- 文档结构相关的任务使用:GenerateStructure
70
- 文档内容相关的任务使用:GenerateDetail
71
- `;
72
-
73
- return {
74
- plannerInitState,
75
- customPlannerPrompt,
76
- domainKnowledge,
77
- };
78
- }