@aigne/doc-smith 0.9.8-alpha.2 → 0.9.8-alpha.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 (256) hide show
  1. package/CLAUDE.md +43 -0
  2. package/README.md +94 -250
  3. package/aigne.yaml +2 -149
  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/planner.md +0 -168
  21. package/agentic-agents/common/worker.md +0 -93
  22. package/agentic-agents/create/index.yaml +0 -118
  23. package/agentic-agents/create/objective.md +0 -44
  24. package/agentic-agents/create/set-custom-prompt.mjs +0 -27
  25. package/agentic-agents/detail/index.yaml +0 -95
  26. package/agentic-agents/detail/objective.md +0 -9
  27. package/agentic-agents/detail/set-custom-prompt.mjs +0 -88
  28. package/agentic-agents/predict-resources/index.yaml +0 -44
  29. package/agentic-agents/predict-resources/instructions.md +0 -61
  30. package/agentic-agents/structure/design-rules.md +0 -39
  31. package/agentic-agents/structure/index.yaml +0 -86
  32. package/agentic-agents/structure/objective.md +0 -14
  33. package/agentic-agents/structure/review-criteria.md +0 -55
  34. package/agentic-agents/structure/set-custom-prompt.mjs +0 -78
  35. package/agentic-agents/utils/init-workspace-cache.mjs +0 -171
  36. package/agentic-agents/utils/load-base-sources.mjs +0 -20
  37. package/agentic-agents/workspace-cache-sharing-design.md +0 -671
  38. package/agents/chat/chat-system.md +0 -38
  39. package/agents/chat/index.mjs +0 -59
  40. package/agents/chat/skills/generate-document.yaml +0 -15
  41. package/agents/chat/skills/list-documents.mjs +0 -15
  42. package/agents/chat/skills/update-document.yaml +0 -24
  43. package/agents/clear/choose-contents.mjs +0 -192
  44. package/agents/clear/clear-auth-tokens.mjs +0 -88
  45. package/agents/clear/clear-deployment-config.mjs +0 -49
  46. package/agents/clear/clear-document-config.mjs +0 -36
  47. package/agents/clear/clear-document-structure.mjs +0 -102
  48. package/agents/clear/clear-generated-docs.mjs +0 -142
  49. package/agents/clear/clear-media-description.mjs +0 -129
  50. package/agents/clear/index.yaml +0 -26
  51. package/agents/create/analyze-diagram-type-llm.yaml +0 -160
  52. package/agents/create/analyze-diagram-type.mjs +0 -297
  53. package/agents/create/check-document-structure.yaml +0 -30
  54. package/agents/create/check-need-generate-structure.mjs +0 -105
  55. package/agents/create/document-structure-tools/add-document.mjs +0 -85
  56. package/agents/create/document-structure-tools/delete-document.mjs +0 -116
  57. package/agents/create/document-structure-tools/move-document.mjs +0 -109
  58. package/agents/create/document-structure-tools/update-document.mjs +0 -84
  59. package/agents/create/generate-diagram-image.yaml +0 -60
  60. package/agents/create/generate-structure.yaml +0 -117
  61. package/agents/create/index.yaml +0 -49
  62. package/agents/create/refine-document-structure.yaml +0 -12
  63. package/agents/create/replace-d2-with-image.mjs +0 -625
  64. package/agents/create/update-document-structure.yaml +0 -54
  65. package/agents/create/user-add-document/add-documents-to-structure.mjs +0 -90
  66. package/agents/create/user-add-document/find-documents-to-add-links.yaml +0 -47
  67. package/agents/create/user-add-document/index.yaml +0 -46
  68. package/agents/create/user-add-document/prepare-documents-to-translate.mjs +0 -22
  69. package/agents/create/user-add-document/print-add-document-summary.mjs +0 -63
  70. package/agents/create/user-add-document/review-documents-with-new-links.mjs +0 -110
  71. package/agents/create/user-remove-document/find-documents-with-invalid-links.mjs +0 -78
  72. package/agents/create/user-remove-document/index.yaml +0 -40
  73. package/agents/create/user-remove-document/prepare-documents-to-translate.mjs +0 -22
  74. package/agents/create/user-remove-document/print-remove-document-summary.mjs +0 -53
  75. package/agents/create/user-remove-document/remove-documents-from-structure.mjs +0 -99
  76. package/agents/create/user-remove-document/review-documents-with-invalid-links.mjs +0 -115
  77. package/agents/create/user-review-document-structure.mjs +0 -140
  78. package/agents/create/utils/init-current-content.mjs +0 -34
  79. package/agents/create/utils/merge-document-structures.mjs +0 -30
  80. package/agents/evaluate/code-snippet.mjs +0 -97
  81. package/agents/evaluate/document-structure.yaml +0 -67
  82. package/agents/evaluate/document.yaml +0 -82
  83. package/agents/evaluate/generate-report.mjs +0 -85
  84. package/agents/evaluate/index.yaml +0 -46
  85. package/agents/history/index.yaml +0 -6
  86. package/agents/history/view.mjs +0 -78
  87. package/agents/init/check.mjs +0 -16
  88. package/agents/init/index.mjs +0 -275
  89. package/agents/init/validate.mjs +0 -16
  90. package/agents/localize/choose-language.mjs +0 -107
  91. package/agents/localize/index.yaml +0 -58
  92. package/agents/localize/record-translation-history.mjs +0 -23
  93. package/agents/localize/translate-document.yaml +0 -24
  94. package/agents/localize/translate-multilingual.yaml +0 -51
  95. package/agents/media/batch-generate-media-description.yaml +0 -46
  96. package/agents/media/generate-media-description.yaml +0 -50
  97. package/agents/media/load-media-description.mjs +0 -256
  98. package/agents/prefs/index.mjs +0 -203
  99. package/agents/publish/index.yaml +0 -26
  100. package/agents/publish/publish-docs.mjs +0 -356
  101. package/agents/publish/translate-meta.mjs +0 -103
  102. package/agents/schema/document-structure-item.yaml +0 -26
  103. package/agents/schema/document-structure-refine-item.yaml +0 -23
  104. package/agents/schema/document-structure.yaml +0 -29
  105. package/agents/update/batch-generate-document.yaml +0 -27
  106. package/agents/update/batch-update-document.yaml +0 -7
  107. package/agents/update/check-diagram-flag.mjs +0 -116
  108. package/agents/update/check-document.mjs +0 -162
  109. package/agents/update/check-generate-diagram.mjs +0 -106
  110. package/agents/update/check-sync-image-flag.mjs +0 -55
  111. package/agents/update/check-update-is-single.mjs +0 -53
  112. package/agents/update/document-tools/update-document-content.mjs +0 -303
  113. package/agents/update/generate-diagram.yaml +0 -63
  114. package/agents/update/generate-document.yaml +0 -70
  115. package/agents/update/handle-document-update.yaml +0 -103
  116. package/agents/update/index.yaml +0 -79
  117. package/agents/update/pre-check-generate-diagram.yaml +0 -44
  118. package/agents/update/save-and-translate-document.mjs +0 -76
  119. package/agents/update/sync-images-and-exit.mjs +0 -148
  120. package/agents/update/update-document-detail.yaml +0 -71
  121. package/agents/update/update-single/update-single-document-detail.mjs +0 -280
  122. package/agents/update/update-single-document.yaml +0 -7
  123. package/agents/update/user-review-document.mjs +0 -272
  124. package/agents/utils/action-success.mjs +0 -16
  125. package/agents/utils/analyze-document-feedback-intent.yaml +0 -32
  126. package/agents/utils/analyze-feedback-intent.mjs +0 -136
  127. package/agents/utils/analyze-structure-feedback-intent.yaml +0 -29
  128. package/agents/utils/check-detail-result.mjs +0 -38
  129. package/agents/utils/check-feedback-refiner.mjs +0 -81
  130. package/agents/utils/choose-docs.mjs +0 -293
  131. package/agents/utils/document-icon-generate.yaml +0 -52
  132. package/agents/utils/document-title-streamline.yaml +0 -48
  133. package/agents/utils/ensure-document-icons.mjs +0 -129
  134. package/agents/utils/exit.mjs +0 -6
  135. package/agents/utils/feedback-refiner.yaml +0 -50
  136. package/agents/utils/find-item-by-path.mjs +0 -114
  137. package/agents/utils/find-user-preferences-by-path.mjs +0 -37
  138. package/agents/utils/format-document-structure.mjs +0 -35
  139. package/agents/utils/generate-document-or-skip.mjs +0 -41
  140. package/agents/utils/handle-diagram-operations.mjs +0 -263
  141. package/agents/utils/load-all-document-content.mjs +0 -30
  142. package/agents/utils/load-document-all-content.mjs +0 -84
  143. package/agents/utils/load-sources.mjs +0 -405
  144. package/agents/utils/map-reasoning-effort-level.mjs +0 -15
  145. package/agents/utils/post-generate.mjs +0 -144
  146. package/agents/utils/read-current-document-content.mjs +0 -46
  147. package/agents/utils/save-doc-translation.mjs +0 -61
  148. package/agents/utils/save-doc.mjs +0 -88
  149. package/agents/utils/save-output.mjs +0 -26
  150. package/agents/utils/save-sidebar.mjs +0 -51
  151. package/agents/utils/skip-if-content-exists.mjs +0 -27
  152. package/agents/utils/streamline-document-titles-if-needed.mjs +0 -88
  153. package/agents/utils/transform-detail-data-sources.mjs +0 -45
  154. package/agents/utils/update-branding.mjs +0 -84
  155. package/assets/report-template/report.html +0 -198
  156. package/docs-mcp/analyze-content-relevance.yaml +0 -50
  157. package/docs-mcp/analyze-docs-relevance.yaml +0 -59
  158. package/docs-mcp/docs-search.yaml +0 -42
  159. package/docs-mcp/get-docs-detail.mjs +0 -41
  160. package/docs-mcp/get-docs-structure.mjs +0 -16
  161. package/docs-mcp/read-doc-content.mjs +0 -119
  162. package/prompts/common/document/content-rules-core.md +0 -20
  163. package/prompts/common/document/markdown-syntax-rules.md +0 -65
  164. package/prompts/common/document/media-file-list-usage-rules.md +0 -18
  165. package/prompts/common/document/openapi-usage-rules.md +0 -189
  166. package/prompts/common/document/role-and-personality.md +0 -16
  167. package/prompts/common/document/user-preferences.md +0 -9
  168. package/prompts/common/document-structure/conflict-resolution-guidance.md +0 -16
  169. package/prompts/common/document-structure/document-icon-generate.md +0 -116
  170. package/prompts/common/document-structure/document-structure-rules.md +0 -43
  171. package/prompts/common/document-structure/document-title-streamline.md +0 -86
  172. package/prompts/common/document-structure/glossary.md +0 -7
  173. package/prompts/common/document-structure/intj-traits.md +0 -5
  174. package/prompts/common/document-structure/openapi-usage-rules.md +0 -28
  175. package/prompts/common/document-structure/output-constraints.md +0 -18
  176. package/prompts/common/document-structure/user-locale-rules.md +0 -10
  177. package/prompts/common/document-structure/user-preferences.md +0 -9
  178. package/prompts/detail/custom/admonition-usage-rules.md +0 -94
  179. package/prompts/detail/custom/code-block-usage-rules.md +0 -163
  180. package/prompts/detail/custom/custom-components/x-card-usage-rules.md +0 -63
  181. package/prompts/detail/custom/custom-components/x-cards-usage-rules.md +0 -83
  182. package/prompts/detail/custom/custom-components/x-field-desc-usage-rules.md +0 -120
  183. package/prompts/detail/custom/custom-components/x-field-group-usage-rules.md +0 -80
  184. package/prompts/detail/custom/custom-components/x-field-usage-rules.md +0 -189
  185. package/prompts/detail/custom/custom-components-usage-rules.md +0 -18
  186. package/prompts/detail/diagram/generate-image-system.md +0 -135
  187. package/prompts/detail/diagram/generate-image-user.md +0 -32
  188. package/prompts/detail/diagram/guide.md +0 -29
  189. package/prompts/detail/diagram/official-examples.md +0 -712
  190. package/prompts/detail/diagram/pre-check.md +0 -23
  191. package/prompts/detail/diagram/role-and-personality.md +0 -2
  192. package/prompts/detail/diagram/rules.md +0 -46
  193. package/prompts/detail/diagram/system-prompt.md +0 -1139
  194. package/prompts/detail/diagram/user-prompt.md +0 -43
  195. package/prompts/detail/generate/detail-example.md +0 -457
  196. package/prompts/detail/generate/document-rules.md +0 -45
  197. package/prompts/detail/generate/system-prompt.md +0 -61
  198. package/prompts/detail/generate/user-prompt.md +0 -99
  199. package/prompts/detail/jsx/rules.md +0 -6
  200. package/prompts/detail/update/system-prompt.md +0 -121
  201. package/prompts/detail/update/user-prompt.md +0 -41
  202. package/prompts/evaluate/document-structure.md +0 -93
  203. package/prompts/evaluate/document.md +0 -149
  204. package/prompts/media/media-description/system-prompt.md +0 -43
  205. package/prompts/media/media-description/user-prompt.md +0 -17
  206. package/prompts/structure/check-document-structure.md +0 -93
  207. package/prompts/structure/document-rules.md +0 -21
  208. package/prompts/structure/find-documents-to-add-links.md +0 -52
  209. package/prompts/structure/generate/system-prompt.md +0 -13
  210. package/prompts/structure/generate/user-prompt.md +0 -137
  211. package/prompts/structure/review/structure-review-system.md +0 -81
  212. package/prompts/structure/structure-example.md +0 -89
  213. package/prompts/structure/structure-getting-started.md +0 -10
  214. package/prompts/structure/update/system-prompt.md +0 -93
  215. package/prompts/structure/update/user-prompt.md +0 -43
  216. package/prompts/translate/admonition.md +0 -20
  217. package/prompts/translate/code-block.md +0 -33
  218. package/prompts/translate/glossary.md +0 -6
  219. package/prompts/translate/translate-document.md +0 -305
  220. package/prompts/utils/analyze-document-feedback-intent.md +0 -54
  221. package/prompts/utils/analyze-structure-feedback-intent.md +0 -43
  222. package/prompts/utils/feedback-refiner.md +0 -105
  223. package/types/document-schema.mjs +0 -55
  224. package/types/document-structure-schema.mjs +0 -261
  225. package/utils/auth-utils.mjs +0 -275
  226. package/utils/blocklet.mjs +0 -104
  227. package/utils/check-document-has-diagram.mjs +0 -95
  228. package/utils/conflict-detector.mjs +0 -149
  229. package/utils/constants/index.mjs +0 -620
  230. package/utils/constants/linter.mjs +0 -102
  231. package/utils/d2-utils.mjs +0 -198
  232. package/utils/debug.mjs +0 -3
  233. package/utils/delete-diagram-images.mjs +0 -99
  234. package/utils/deploy.mjs +0 -86
  235. package/utils/docs-finder-utils.mjs +0 -623
  236. package/utils/evaluate/report-utils.mjs +0 -132
  237. package/utils/extract-api.mjs +0 -32
  238. package/utils/file-utils.mjs +0 -960
  239. package/utils/history-utils.mjs +0 -203
  240. package/utils/icon-map.mjs +0 -26
  241. package/utils/image-compress.mjs +0 -75
  242. package/utils/kroki-utils.mjs +0 -173
  243. package/utils/linter/index.mjs +0 -50
  244. package/utils/load-config.mjs +0 -107
  245. package/utils/markdown/index.mjs +0 -26
  246. package/utils/markdown-checker.mjs +0 -694
  247. package/utils/mermaid-validator.mjs +0 -140
  248. package/utils/mermaid-worker-pool.mjs +0 -250
  249. package/utils/mermaid-worker.mjs +0 -233
  250. package/utils/openapi/index.mjs +0 -28
  251. package/utils/preferences-utils.mjs +0 -175
  252. package/utils/request.mjs +0 -10
  253. package/utils/store/index.mjs +0 -45
  254. package/utils/sync-diagram-to-translations.mjs +0 -262
  255. package/utils/upload-files.mjs +0 -231
  256. package/utils/utils.mjs +0 -1354
@@ -1,50 +0,0 @@
1
- name: analyze-content-relevance
2
- description: Analyze document content relevance to user query and extract relevant information
3
- instructions: |
4
- You are an AI assistant that analyzes the relevance between user queries and document content.
5
-
6
- <user-query>
7
- {{ query }}
8
- </user-query>
9
-
10
- <document-content>
11
- {{ allDocumentsText }}
12
- </document-content>
13
-
14
- Given a user query and multiple document contents, your task is to:
15
- 1. Understand the user's specific information needs from the query
16
- 2. Analyze document content for relevance to the query
17
- 3. Extract and synthesize the most relevant information from the documents
18
- 4. Provide a comprehensive answer that directly addresses the user's query
19
- 5. Answer user questions based on the given document content, do not return false or non-existent information
20
-
21
- Guidelines:
22
- - Focus on information that directly answers the user's question
23
- - Extract specific facts, examples, and explanations from the documents
24
- - Organize the information logically and coherently
25
- - Include relevant code examples, configuration details, or step-by-step instructions when available
26
- - Cite the source documents when referencing specific information
27
- - If multiple documents contain related information, synthesize them into a unified response
28
- - If no relevant information is found, clearly state this
29
-
30
- Format your response as a comprehensive answer that:
31
- - Directly addresses the user's query
32
- - Includes relevant excerpts from the documents
33
- - Provides context and explanations where needed
34
- - Is well-structured and easy to understand
35
- includeInputInOutput: false
36
- input_schema:
37
- type: object
38
- properties:
39
- query:
40
- type: string
41
- description: User search query
42
- allDocumentsText:
43
- type: string
44
- description: Combined text content of all successfully read documents
45
- output_schema:
46
- type: object
47
- properties:
48
- relevantContent:
49
- type: string
50
- description: Comprehensive answer synthesizing relevant information from documents
@@ -1,59 +0,0 @@
1
- name: analyze-docs-relevance
2
- description: Analyze which documents in the documentation structure are relevant to the user query
3
- instructions: |
4
- You are an AI assistant that analyzes the relevance between a user query and documents in a documentation structure.
5
-
6
- <document_structure>
7
- {{ originalDocumentStructure }}
8
- </document_structure>
9
-
10
- <user-query>
11
- {{ query }}
12
- </user-query>
13
-
14
- Given a user query and a documentation structure containing multiple documents, your task is to:
15
- 1. Understand the user's search intent from the query
16
- 2. Analyze each document in the documentation structure to determine relevance
17
- 3. Return a list of relevant documents with their paths, titles, and descriptions
18
-
19
- Consider the following factors for relevance:
20
- - Semantic similarity between query and document title/description
21
- - Topic alignment
22
- - User intent matching
23
- - Content scope overlap
24
-
25
- Return only the most relevant documents (top 5-10) to avoid overwhelming results.
26
-
27
- Format your response as a JSON object with:
28
- - relevantDocs: array of relevant document paths
29
- - reasoning: brief explanation of why these documents were selected
30
- input_schema:
31
- type: object
32
- properties:
33
- query:
34
- type: string
35
- description: User search query
36
- originalDocumentStructure:
37
- type: array
38
- items:
39
- type: object
40
- properties:
41
- path:
42
- type: string
43
- title:
44
- type: string
45
- description:
46
- type: string
47
- description: Documentation Structure containing all available documents
48
- output_schema:
49
- type: object
50
- properties:
51
- relevantDocPaths:
52
- type: array
53
- items:
54
- type: string
55
- description: Must be selected from paths in the documentation structure, cannot be other paths
56
- description: List of relevant documents
57
- reasoning:
58
- type: string
59
- description: Brief explanation of document selection
@@ -1,42 +0,0 @@
1
- type: team
2
- name: docs-search
3
- description: Search relevant documents based on user query
4
- skills:
5
- - url: ../agents/init/index.mjs
6
- default_input:
7
- skipIfExists: true
8
- - ../agents/utils/load-sources.mjs
9
- - analyze-docs-relevance.yaml
10
- - read-doc-content.mjs
11
- - analyze-content-relevance.yaml
12
- includeInputInOutput: false
13
- input_schema:
14
- type: object
15
- properties:
16
- query:
17
- type: string
18
- description: User search query
19
- required: true
20
- config:
21
- type: string
22
- description: Path to the config file
23
- default: ./.aigne/doc-smith/config.yaml
24
- output_schema:
25
- type: object
26
- properties:
27
- relevantContent:
28
- type: string
29
- description: AI analyzed relevant content from documents
30
- relevantDocs:
31
- type: array
32
- items:
33
- type: object
34
- properties:
35
- path:
36
- type: string
37
- title:
38
- type: string
39
- description:
40
- type: string
41
- description: List of relevant documents from documentation structure
42
- mode: sequential
@@ -1,41 +0,0 @@
1
- import fs from "node:fs/promises";
2
- import path from "node:path";
3
-
4
- const docsDir = path.join(process.cwd(), "./.aigne/doc-smith", "docs");
5
-
6
- export default async function getDocDetail({ path: docPath }) {
7
- try {
8
- // Flatten path: remove leading /, replace all / with - (same logic as utils.mjs)
9
- const flatName = docPath.replace(/^\//, "").replace(/\//g, "-");
10
- const fileFullName = `${flatName}.md`;
11
- const filePath = path.join(docsDir, fileFullName);
12
-
13
- // Read the markdown file
14
- const content = await fs.readFile(filePath, "utf8");
15
-
16
- return {
17
- success: true,
18
- path: docPath,
19
- content,
20
- filePath,
21
- };
22
- } catch (error) {
23
- return {
24
- success: false,
25
- path: docPath,
26
- error: error.message,
27
- };
28
- }
29
- }
30
-
31
- getDocDetail.input_schema = {
32
- type: "object",
33
- properties: {
34
- path: {
35
- type: "string",
36
- description: "The path of the docs to get detail",
37
- },
38
- },
39
- };
40
-
41
- getDocDetail.description = "Get single docs detail";
@@ -1,16 +0,0 @@
1
- import fs from "node:fs/promises";
2
- import path from "node:path";
3
-
4
- const structureDir = path.join(
5
- process.cwd(),
6
- "./.aigne/doc-smith",
7
- "output",
8
- "structure-plan.json",
9
- );
10
-
11
- export default async function getDocsStructure() {
12
- const structure = await fs.readFile(structureDir, "utf-8");
13
- return { structure };
14
- }
15
-
16
- getDocsStructure.description = "Get documentation structure";
@@ -1,119 +0,0 @@
1
- import fs from "node:fs/promises";
2
- import path from "node:path";
3
-
4
- const docsDir = path.join(process.cwd(), "./.aigne/doc-smith", "docs");
5
-
6
- /**
7
- * Remove base64 encoded images from markdown content
8
- * This prevents large binary data from being included in document content
9
- * Base64 images are completely removed (not replaced with placeholders) because:
10
- * 1. They significantly increase token usage without providing useful information to LLM
11
- * 2. Normal image references (file paths) are preserved and should be used instead
12
- * 3. Base64 images are typically temporary or erroneous entries
13
- *
14
- * @param {string} content - Markdown content that may contain base64 images
15
- * @returns {string} - Content with base64 images completely removed
16
- */
17
- function removeBase64Images(content) {
18
- if (!content || typeof content !== "string") {
19
- return content;
20
- }
21
-
22
- // Match markdown image syntax with data URLs: ![alt](data:image/...;base64,...)
23
- const base64ImageRegex = /!\[([^\]]*)\]\(data:image\/[^)]+\)/g;
24
-
25
- // Completely remove base64 images (including the entire markdown image syntax)
26
- // This maximizes token reduction while preserving normal image references
27
- const cleanedContent = content.replace(base64ImageRegex, "");
28
-
29
- return cleanedContent;
30
- }
31
-
32
- export default async function readDocContent({ relevantDocPaths, docsDir: customDocsDir }) {
33
- const targetDocsDir = customDocsDir || docsDir;
34
- const docContents = [];
35
-
36
- for (const docPath of relevantDocPaths) {
37
- try {
38
- // Flatten path: remove leading /, replace all / with - (same logic as utils.mjs)
39
- const flatName = docPath.replace(/^\//, "").replace(/\//g, "-");
40
- const fileFullName = `${flatName}.md`;
41
- const filePath = path.join(targetDocsDir, fileFullName);
42
-
43
- // Read the markdown file
44
- let content = await fs.readFile(filePath, "utf8");
45
-
46
- // Remove base64 encoded images to reduce token usage
47
- content = removeBase64Images(content);
48
-
49
- docContents.push({
50
- success: true,
51
- path: docPath,
52
- content,
53
- filePath,
54
- });
55
- } catch (error) {
56
- docContents.push({
57
- success: false,
58
- path: docPath,
59
- error: error.message,
60
- });
61
- }
62
- }
63
-
64
- // Combine all successful document contents into a single text
65
- const allDocumentsText = docContents
66
- .filter((doc) => doc.success)
67
- .map((doc) => doc.content)
68
- .join("\n\n---\n\n");
69
-
70
- return {
71
- docContents,
72
- allDocumentsText,
73
- totalDocs: relevantDocPaths.length,
74
- successfulReads: docContents.filter((doc) => doc.success).length,
75
- };
76
- }
77
-
78
- readDocContent.input_schema = {
79
- type: "object",
80
- properties: {
81
- relevantDocPaths: {
82
- type: "array",
83
- items: { type: "string" },
84
- description: "List of document paths to read",
85
- },
86
- docsDir: {
87
- type: "string",
88
- description: "Custom docs directory path (optional)",
89
- },
90
- },
91
- required: ["relevantDocPaths"],
92
- };
93
-
94
- readDocContent.output_schema = {
95
- type: "object",
96
- properties: {
97
- docContents: {
98
- type: "array",
99
- items: {
100
- type: "object",
101
- properties: {
102
- success: { type: "boolean" },
103
- path: { type: "string" },
104
- content: { type: "string" },
105
- filePath: { type: "string" },
106
- error: { type: "string" },
107
- },
108
- },
109
- },
110
- allDocumentsText: {
111
- type: "string",
112
- description: "Combined text content of all successfully read documents",
113
- },
114
- totalDocs: { type: "number" },
115
- successfulReads: { type: "number" },
116
- },
117
- };
118
-
119
- readDocContent.description = "Read markdown content for multiple documents";
@@ -1,20 +0,0 @@
1
- Target Audience: {{targetAudience}}
2
-
3
- Content Generation Rules:
4
-
5
- - Use only information from `<detail_data_source>`, never fabricate or supplement content not present in the sources
6
- - Combine the current {{nodeName}} title and description to create a well-structured content plan that is rich, organized, and engaging
7
- - Content style must match the target audience
8
- - Clearly differentiate content from other {{nodeName}} items in the `<document_structure>` to avoid duplication and highlight this {{nodeName}}'s unique value
9
- {% if enforceInfoCompleteness %}
10
- - If `<detail_data_source>` lack sufficient information, return an error message requesting users to provide additional content. Ensure page content is sufficiently rich, don't hesitate to ask users for supplementary information
11
- - Display only valuable, engaging information. If information is insufficient, prompt users to provide more details
12
- {% endif %}
13
- - Output complete information including all content planned for the {{nodeName}}
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).
16
- - Format markdown output with proper line breaks and spacing for easy reading
17
- - For list data with many items, prioritize using markdown table for cleaner, more readable presentation
18
- - Do not mention `<detail_data_source>` in output, your content is for user consumption, and users are unaware of detailDataSource
19
- - Do not include file paths from `<data_sources>` in output as they are meaningless to users
20
- - Avoid phrases like 'current {{nodeName}}'
@@ -1,65 +0,0 @@
1
- <markdown_syntax_rules>
2
-
3
- ## Markdown Syntax Standard
4
-
5
- ### Allowed Syntax
6
-
7
- **Inline** (used within text):
8
-
9
- - Emphasis: `**bold**`, `*italic*`, `~~strikethrough~~`
10
- - Links: `[text](url)`
11
- - Images: `![alt](url)`
12
- - Inline Code: `` `code` ``
13
-
14
- **Block** (standalone blocks):
15
-
16
- - Headings: `#`, `##`, `###`, etc.
17
- - Lists: `- item`, `1. item`
18
- - Task Lists: `- [ ]`, `- [x]`
19
- - Blockquotes: `> quote`
20
- - Code Block: ` ```language ... ``` `
21
- - Tables: `| col | col |` with `|---|---|` separator
22
- - Horizontal Rule: `---`
23
- - Admonition: `:::severity ... :::`
24
-
25
- ### Prohibited Syntax
26
-
27
- The following are **strictly forbidden**:
28
-
29
- - Footnotes: `[^1]: note text`
30
- - Math/LaTeX: `$inline$`, `$$ block $$`
31
- - Highlight: `==highlighted==`
32
- - Subscript/Superscript: `H~2~O`, `X^2^`
33
- - Abbreviations: `*[HTML]: Hyper Text Markup Language`
34
-
35
- ### Link Rules
36
-
37
- - Links must reference valid external URLs or paths from the document structure
38
- - Use absolute paths from the documentation structure for internal links
39
-
40
- ### Table Formatting Rules
41
-
42
- - Separator row (`|---|---|---|`) must match the exact column count of header row
43
- - Each row must have the same number of columns
44
- - Use tables for predefined values (e.g., status types, options) or term definitions
45
- - Validate table structure before output
46
-
47
- ### Code Block Rules
48
-
49
- - Ensure code blocks are properly closed
50
- - Generate complete, syntactically correct code (JSON, etc.)
51
- - Perform self-validation to ensure all code blocks, lists, and tables are properly closed without truncation
52
-
53
- ### Block-Level Elements
54
-
55
- Block-level elements are standalone content blocks that must be visually separated from surrounding content.
56
-
57
- Block-Level Element List:
58
-
59
- - Admonition: `:::severity ... :::`
60
- - Code Block: ` ```language ... ``` `
61
- - Custom Components: `<x-cards>`, `<x-card>`, `<x-field-group>`, etc.
62
-
63
- **Spacing Rule:** Always insert a blank line before and after any block-level element when it is **adjacent to** other Markdown content (headings, paragraphs, lists, etc.).
64
-
65
- </markdown_syntax_rules>
@@ -1,18 +0,0 @@
1
- <media_file_list_usage_rules>
2
-
3
- ## Media File List Usage Rules
4
-
5
- You must use the provided `<media_file_list>` data to determine which media files to use and where to insert them.
6
-
7
- ### Usage Workflow
8
-
9
- 1. Read the `<media_file_list>` data and take note of each file's `path` and `description` as references.
10
- 2. Combine those descriptions with the current document's content to decide which images should be used and where they should be inserted.
11
- 3. Confirm that every inserted image path comes from `<media_file_list>`. If a path is missing from that list, replace it with one that is included.
12
-
13
- ### Usage Requirements
14
- - Insert images with Markdown syntax: `![Descriptive alt text](<path-from-media_file_list>)`.
15
- - Never invent, reinterpret, fabricate, normalize, or rewrite any media file path under any circumstances.
16
- - After inserting a media file, update the surrounding document text to introduce, reference, or describe the media, so the media is properly integrated and its purpose is clear to readers.
17
-
18
- </media_file_list_usage_rules>
@@ -1,189 +0,0 @@
1
- {% if openAPISpec %}
2
- <openapi_usage_rules>
3
- ## OpenAPI Usage Rules
4
-
5
- Use the provided OpenAPI (Swagger) specification in `<openapi_usage_rules>`, align it with the current page objective, and leverage it to refine this document.
6
-
7
- ### Documentation Requirements and Constraints
8
-
9
- - Extract the core content
10
- - Organize the document by functional modules.
11
- - For each path item, include the following elements:
12
- - HTTP method and path.
13
- - Concise summary.
14
- - Detailed description.
15
- - Request parameters: name, location (`in`), type, required flag, description.
16
- - Request body: describe its structure when present.
17
- - Response body: describe its structure, ignore status code layer.
18
- - Response Example: provide example responses for common scenarios
19
-
20
- - Mandatory API description constraints (deduplication rule):
21
- - **Ensure** that throughout the document (including preface, overview, etc.), any introduction to the project APIs appears only within this OpenAPI-generated "API reference" section.
22
- - **Never** repeat or expand the interface list elsewhere in the document (for example, "Quick Start" or "Architecture Overview" sections).
23
-
24
- ### Expected Output Format
25
- - A concise, clear, and easy-to-scan Markdown document.
26
-
27
- ### Examples
28
- #### OpenAPI Spec Content
29
- ```yml
30
- openapi: 3.0.1
31
- info:
32
- title: DISCUSS KIT
33
- description: ''
34
- version: 1.0.0
35
- paths:
36
- /api/v1/sdk/posts:
37
- get:
38
- summary: List posts
39
- deprecated: false
40
- description: 'List posts'
41
- parameters:
42
- - name: type
43
- in: query
44
- description: 'The type of the posts'
45
- required: false
46
- example: blog
47
- schema:
48
- type: string
49
- enum:
50
- - discussion
51
- - blog
52
- - doc
53
- - name: locale
54
- in: query
55
- description: 'The locale of the posts'
56
- required: false
57
- example: en
58
- schema:
59
- type: string
60
- default: en
61
- examples:
62
- - en
63
- - zh
64
- - name: page
65
- in: query
66
- description: 'The page number'
67
- required: false
68
- example: 1
69
- schema:
70
- type: integer
71
- - name: size
72
- in: query
73
- description: 'The number of posts per page'
74
- required: false
75
- example: 20
76
- schema:
77
- type: integer
78
- - name: sort
79
- in: query
80
- description: 'The sort order of the posts'
81
- required: false
82
- example: '-createdAt'
83
- schema:
84
- type: string
85
- enum:
86
- - createdAt
87
- - '-createdAt'
88
- - name: labels
89
- in: query
90
- description: 'The labels of the posts'
91
- required: false
92
- example:
93
- - did
94
- schema:
95
- type: array
96
- items:
97
- type: string
98
- nullable: true
99
- responses:
100
- '200':
101
- description: succeed
102
- content:
103
- application/json:
104
- schema:
105
- type: object
106
- properties:
107
- data:
108
- type: array
109
- items:
110
- type: object
111
- properties: {}
112
- meta:
113
- type: object
114
- properties:
115
- total:
116
- type: integer
117
- required:
118
- - total
119
- required:
120
- - data
121
- - meta
122
- ```
123
-
124
- #### Generate Output
125
- ````md
126
- ### Posts
127
-
128
- ### List posts
129
-
130
- Retrieves a list of posts, which can be filtered by type, locale, and other criteria. This endpoint supports pagination.
131
-
132
- `GET` `/api/v1/sdk/posts`
133
-
134
- #### Parameters
135
-
136
- <x-field-group>
137
- <x-field data-name="type" data-type="string" data-required="false" data-default="blog">
138
- <x-field-desc markdown>The type of posts to retrieve. Can be `discussion`, `blog`, or `doc`.</x-field-desc>
139
- </x-field>
140
- <x-field data-name="locale" data-type="string" data-required="false" data-default="en">
141
- <x-field-desc markdown>The locale of the posts, e.g., `en` or `zh`.</x-field-desc>
142
- </x-field>
143
- <x-field data-name="page" data-type="integer" data-required="false">
144
- <x-field-desc markdown>The page number for pagination.</x-field-desc>
145
- </x-field>
146
- <x-field data-name="size" data-type="integer" data-required="false" data-default="20">
147
- <x-field-desc markdown>The number of posts to return per page.</x-field-desc>
148
- </x-field>
149
- <x-field data-name="sort" data-type="string" data-required="false" data-default="-createdAt">
150
- <x-field-desc markdown>The sort order for the posts. Use `createdAt` for ascending or `-createdAt` for descending.</x-field-desc>
151
- </x-field>
152
- <x-field data-name="labels" data-type="array" data-required="false">
153
- <x-field-desc markdown>An array of label strings to filter posts by.</x-field-desc>
154
- </x-field>
155
- </x-field-group>
156
-
157
- #### Responses
158
-
159
- <x-field-group>
160
- <x-field data-name="data" data-type="array" data-required="true">
161
- <x-field-desc markdown>An array of post objects.</x-field-desc>
162
- </x-field>
163
- <x-field data-name="meta" data-type="object" data-required="true">
164
- <x-field-desc markdown>Metadata for pagination.</x-field-desc>
165
- <x-field data-name="total" data-type="integer" data-required="true" data-desc="The total number of posts available."></x-field>
166
- </x-field>
167
- </x-field-group>
168
-
169
- #### Response Example
170
-
171
- ```json posts result
172
- {
173
- "data": [
174
- {
175
- "id": "15bcb4e7-8bd9-4759-b60b-ae826534057a",
176
- "title": "Example Blog Post",
177
- "content": "This is the content of the blog post.",
178
- "createdAt": "2023-10-27T10:00:00Z"
179
- }
180
- ],
181
- "meta": {
182
- "total": 1
183
- }
184
- }
185
- ```
186
- ````
187
-
188
- </openapi_usage_rules>
189
- {% endif %}
@@ -1,16 +0,0 @@
1
- You are an AI technical writer with the personality of an **ISTJ (The Logistician)**. Your primary strengths are precision, factual accuracy, and a methodical, step-by-step approach. You value clarity, structure, and proven information over abstract theories. Your goal is to produce documentation that is unambiguous, reliable, and easy for a technical user to follow.
2
-
3
- Your key strengths include:
4
- - Deep Analytical Understanding: You can rapidly and thoroughly analyze different data sources, identifying critical information, logical relationships, potential issues, and key points that users care about most.
5
- - Information Distillation and Organization: You excel at extracting core insights from vast amounts of information and presenting them with clear logic and rigorous structure, tailored to the document's purpose and target audience.
6
- - Versatile Writing Style: You're not confined to specific technical domains and can adapt your language style to meet diverse documentation needs—whether technical specifications, user guides, product descriptions, or business process documentation.
7
- - Quality-Driven Approach: You consistently pursue top-tier documentation quality, ensuring accuracy, completeness, consistency, readability, and practicality. You pay attention to detail and strive for precision in every expression.
8
- - User-Centric Perspective: You think from the target reader's viewpoint, anticipating their potential questions and confusion, addressing them proactively in the documentation to enhance user experience and value.
9
- - Tool Usage Capability: You can call available tools as needed based on context to query information, gather data, or generate visuals, ensuring the documentation is accurate, complete, and visually clear.
10
-
11
- **Your process must reflect ISTJ traits:**
12
-
13
- 1. **Fact-Driven:** Adhere strictly to the provided technical specifications. Do not infer or embellish information.
14
- 2. **Structured and Orderly:** Organize the content logically with clear headings, subheadings, lists, and tables. Present information sequentially where appropriate (e.g., installation steps).
15
- 3. **Clarity and Precision:** Use precise, unambiguous language. Define technical terms clearly. Avoid marketing jargon or emotionally charged words.
16
- 5. **Tool Utilization:** Actively call tools as needed, potentially multiple times, to obtain complete information from AFS (AIGNE File System).
@@ -1,9 +0,0 @@
1
- {% if userPreferences %}
2
- <user_preferences>
3
- {{userPreferences}}
4
-
5
- User preference guidelines:
6
- - User preferences are derived from feedback provided in previous interactions. Consider these preferences when {{operation_type}} content to avoid repeating issues mentioned in user feedback
7
- - User preferences carry less weight than current user feedback
8
- </user_preferences>
9
- {% endif %}
@@ -1,16 +0,0 @@
1
- <conflict_resolution_guidance>
2
- When users select potentially conflicting options, conflict resolution guidance will be provided in `<user_rules>`. Please carefully read these guidelines and implement the corresponding resolution strategies in the documentation structure.
3
-
4
- Core principles for conflict resolution:
5
- 1. **Layered need satisfaction**: Simultaneously satisfy multiple purposes and audiences through reasonable documentation structure hierarchy
6
- 2. **Clear navigation paths**: Provide clear document usage paths for users with different needs
7
- 3. **Avoid content duplication**: Ensure content across different sections is complementary rather than repetitive
8
- 4. **Progressive disclosure**: From high-level overview to specific details, meeting needs at different depth levels
9
-
10
- Common conflict resolution patterns:
11
- - **Purpose conflicts**: Create hierarchical structures
12
- - **Audience conflicts**: Design role-oriented sections or paths
13
- - **Depth conflicts**: Adopt progressive structures that allow users to choose appropriate depth levels
14
-
15
- When generating documentation structure, prioritize conflict resolution strategies to ensure the final structure can harmoniously satisfy all user needs.
16
- </conflict_resolution_guidance>