@aigne/doc-smith 0.9.8-alpha.3 → 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 (257) 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/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,63 +0,0 @@
1
- type: team
2
- task_render_mode: collapse
3
- name: generateDiagram
4
- skills:
5
- # Step 1: Analyze document content to determine diagram type and style
6
- - ../create/analyze-diagram-type.mjs
7
- # Step 2: Transform output for image generation agent (map aspectRatio to ratio, add size)
8
- - type: transform
9
- jsonata: |
10
- $merge([
11
- $,
12
- {
13
- "ratio": aspectRatio,
14
- "size": "1K"
15
- }
16
- ])
17
- # Step 3: Generate diagram image directly with unified agent
18
- - ../create/generate-diagram-image.yaml
19
- # Step 4: Replace placeholder with generated image
20
- - ../create/replace-d2-with-image.mjs
21
- input_schema:
22
- type: object
23
- properties:
24
- documentContent:
25
- type: string
26
- description: The **raw text content** of the current document. (**Note:** This is the original document and **does not include** any diagram source code.)
27
- locale:
28
- type: string
29
- description: Language for diagram labels and text
30
- default: en
31
- diagramming:
32
- type: object
33
- description: Diagramming configuration
34
- properties:
35
- style:
36
- type: string
37
- description: Default diagram style to use when no style is specified in feedback
38
- feedback:
39
- type: string
40
- description: User feedback that may contain style or type preferences, or diagram index (e.g., 'use anthropomorphic style', 'update the second diagram')
41
- default: ""
42
- originalContent:
43
- type: string
44
- description: Original document content before modifications. Used to find existing diagrams when updating (may contain DIAGRAM_IMAGE_START, ```d2, or ```mermaid code blocks)
45
- diagramIndex:
46
- type: number
47
- description: Index of the diagram to replace (0-based). If not provided, will try to extract from feedback.
48
- path:
49
- type: string
50
- description: Document path (e.g., "guides/getting-started.md") used for generating image filename
51
- docsDir:
52
- type: string
53
- description: Documentation directory where assets will be saved (relative to project root)
54
- required:
55
- - documentContent
56
- output_schema:
57
- type: object
58
- properties:
59
- content:
60
- type: string
61
- description: The document content with D2 code blocks replaced by generated diagram image.
62
- required:
63
- - content
@@ -1,70 +0,0 @@
1
- name: generateDocument
2
- description: Comprehensive content generator for documentation that creates detailed, high-quality document content from various data sources with intelligent analysis.
3
- instructions:
4
- - role: system
5
- url: ../../prompts/detail/generate/system-prompt.md
6
- - role: user
7
- url: ../../prompts/detail/generate/user-prompt.md
8
- auto_reorder_system_messages: true
9
- auto_merge_system_messages: true
10
- input_schema:
11
- type: object
12
- properties:
13
- rules:
14
- type: string
15
- description: User's content generation rules and requirements
16
- locale:
17
- type: string
18
- description: User language, such as zh, en
19
- detailDataSource:
20
- type: string
21
- description: Source data and context for document content generation
22
- targetAudience:
23
- type: string
24
- description: Target audience for document content
25
- nodeName:
26
- type: string
27
- description: Document node name for content generation
28
- originalDocumentStructure: ../schema/document-structure.yaml
29
- title:
30
- type: string
31
- description:
32
- type: string
33
- path:
34
- type: string
35
- originalContent:
36
- type: string
37
- description: The original content of the document before update
38
- parentId:
39
- type:
40
- - string
41
- - "null"
42
- glossary:
43
- type: string
44
- description: Glossary
45
- additionalInformation:
46
- type: string
47
- description: Additional supplementary information
48
- intentType:
49
- type:
50
- - string
51
- - "null"
52
- description: User intent type analyzed from feedback (addDiagram, updateDiagram, deleteDiagram, updateDocument). Can be null if not specified.
53
- enum: ["addDiagram", "updateDiagram", "deleteDiagram", "updateDocument", null]
54
- required:
55
- - rules
56
- - detailDataSource
57
- - originalDocumentStructure
58
- output_key: content
59
- afs:
60
- modules:
61
- - module: system-fs
62
- options:
63
- name: sources
64
- localPath: .
65
- description: |
66
- Codebase of the project to be documented used as context for document generation,
67
- should search and read as needed while generating document content
68
- keep_text_in_tool_uses: false
69
- # skills:
70
- # - ./generate-diagram.yaml
@@ -1,103 +0,0 @@
1
- type: team
2
- name: handleDocumentUpdate
3
- description: Update a document in a batch
4
- skills:
5
- - ../utils/transform-detail-data-sources.mjs
6
- # Check if document generation should be skipped (if content already exists)
7
- # If intentType is diagram-related and content exists, mark skipGenerateDocument so generation can be short-circuited
8
- - url: ../utils/skip-if-content-exists.mjs
9
- # Generate document content (skipped when skipGenerateDocument is true and content exists)
10
- - type: team
11
- task_render_mode: collapse
12
- name: generateDocumentContent
13
- skills:
14
- - url: ../utils/find-user-preferences-by-path.mjs
15
- default_input:
16
- scope: document
17
- - ../utils/generate-document-or-skip.mjs
18
- reflection:
19
- reviewer: ../utils/check-detail-result.mjs
20
- is_approved: isApproved
21
- max_iterations: 5
22
- return_last_on_max_iterations: true
23
- task_title: Generate document for '{{ title }}'
24
- # Ensure content, documentContent, and originalContent are set
25
- - type: transform
26
- jsonata: |
27
- $merge([
28
- $,
29
- {
30
- "documentContent": content,
31
- "originalContent": content
32
- }
33
- ])
34
- - ./check-generate-diagram.mjs
35
- # - ../generate/merge-diagram.yaml
36
- - ../utils/save-doc.mjs
37
- input_schema:
38
- type: object
39
- properties:
40
- nodeName:
41
- type: string
42
- description: Node name
43
- default: Section
44
- locale:
45
- type: string
46
- description: Language
47
- targetAudience:
48
- type: string
49
- description: Target audience
50
- glossary:
51
- type: string
52
- description: Glossary
53
- doc-path:
54
- type: string
55
- description: Current path
56
- feedback:
57
- type: string
58
- description: Feedback
59
- sources:
60
- type: array
61
- items:
62
- type: string
63
- description: Source code path
64
- sourcesPath:
65
- type: array
66
- items:
67
- type: string
68
- description: Source code path
69
- default:
70
- - ./
71
- includePatterns:
72
- type: array
73
- items:
74
- type: string
75
- description: Included file name patterns
76
- excludePatterns:
77
- type: array
78
- items:
79
- type: string
80
- description: Excluded file name patterns
81
- outputDir:
82
- type: string
83
- description: Output directory
84
- default: ./aigne-docs/output
85
- docsDir:
86
- type: string
87
- description: Documentation directory
88
- default: ./aigne-docs/docs
89
- additionalInformation:
90
- type: string
91
- description: Additional information
92
- output_schema:
93
- type: object
94
- properties:
95
- title:
96
- type: string
97
- description:
98
- type: string
99
- path:
100
- type: string
101
- content:
102
- type: string
103
- mode: sequential
@@ -1,79 +0,0 @@
1
- type: team
2
- name: update
3
- alias:
4
- - up
5
- description: Update specific documents and their translations. Use --diagram to filter and select documents with diagrams, --diagram-all to auto-update all diagrams, or --diagram-sync to sync existing images to translations.
6
- skills:
7
- - url: ../init/index.mjs
8
- default_input:
9
- skipIfExists: true
10
- checkOnly: true
11
- - url: ../init/check.mjs
12
- - ../utils/load-sources.mjs
13
- - type: transform
14
- task_render_mode: hide
15
- jsonata: |
16
- $merge([
17
- $,
18
- {
19
- 'documentStructure': originalDocumentStructure
20
- }
21
- ])
22
- # Check if --diagram or --diagram-all flag is set
23
- - url: ../update/check-diagram-flag.mjs
24
- # Check if --diagram-sync flag is set
25
- - url: ../update/check-sync-image-flag.mjs
26
- - url: ../utils/choose-docs.mjs
27
- default_input:
28
- requiredFeedback: false
29
- - ../utils/format-document-structure.mjs
30
- - ../utils/ensure-document-icons.mjs
31
- - ../media/load-media-description.mjs
32
- - ../utils/analyze-feedback-intent.mjs
33
- - ../update/sync-images-and-exit.mjs
34
- - ../update/check-update-is-single.mjs
35
- - ../update/save-and-translate-document.mjs
36
- - url: ../utils/action-success.mjs
37
- default_input:
38
- action: "✅ Documents updated successfully!\n💡 Looks good? Run `aigne doc publish` to go live."
39
- input_schema:
40
- type: object
41
- properties:
42
- # glossary:
43
- # type: string
44
- # description: Glossary file for consistent terminology (use @filename.md)
45
- docs:
46
- type: array
47
- items:
48
- type: string
49
- description: Documents to update, use document path in document structure to specify, eg ["/getting-started", "/overview"]
50
- feedback:
51
- type: string
52
- description: Tell us what to change in this content
53
- isChat:
54
- type: boolean
55
- description: Whether the update is from chat
56
- # reset:
57
- # type: boolean
58
- # description: Start fresh - ignore previous versions
59
- # diagram:
60
- # type: ["boolean", "string"]
61
- # description: "Flag to update diagrams: true for user selection (can also use --diagram CLI arg)"
62
- # "diagram-all":
63
- # type: ["boolean", "string"]
64
- # description: "Flag to auto-select all documents with diagrams (can also use --diagram-all CLI arg)"
65
- # "diagram-sync":
66
- # type: ["boolean", "string"]
67
- # description: "Flag to sync existing banana images to translations (can also use --diagram-sync CLI arg or DOC_SMITH_SYNC_IMAGES env var)"
68
- output_schema:
69
- type: object
70
- properties:
71
- title:
72
- type: string
73
- description:
74
- type: string
75
- path:
76
- type: string
77
- content:
78
- type: string
79
- mode: sequential
@@ -1,44 +0,0 @@
1
- name: preCheckGenerateDiagram
2
- description: Pre-check for generating diagram
3
- model:
4
- reasoning_effort: 1
5
- instructions:
6
- url: ../../prompts/detail/diagram/pre-check.md
7
- input_schema:
8
- type: object
9
- properties:
10
- documentContent:
11
- type: string
12
- description: Source content of the document
13
- feedback:
14
- type: string
15
- description: User generation feedback
16
- detailFeedback:
17
- type: string
18
- description: Current document detail feedback
19
- previousGenerationContent:
20
- type: string
21
- description: Previous document content
22
- required:
23
- - documentContent
24
- output_schema:
25
- type: object
26
- properties:
27
- content:
28
- type: string
29
- description: Document content
30
- details:
31
- type: array
32
- description: Detailed needDiagram score
33
- items:
34
- type: object
35
- properties:
36
- type:
37
- type: string
38
- score:
39
- type: number
40
- reason:
41
- type: string
42
- required:
43
- - content
44
-
@@ -1,76 +0,0 @@
1
- import pMap from "p-map";
2
- import { recordUpdate } from "../../utils/history-utils.mjs";
3
-
4
- export default async function saveAndTranslateDocument(input, options) {
5
- const { selectedDocs, docsDir, translateLanguages, locale } = input;
6
-
7
- if (!Array.isArray(selectedDocs) || selectedDocs.length === 0) {
8
- return {};
9
- }
10
-
11
- // Record history if feedback is provided
12
- const doc = selectedDocs[0];
13
- if (doc.feedback?.trim()) {
14
- recordUpdate({
15
- operation: "document_update",
16
- feedback: doc.feedback.trim(),
17
- docPaths: selectedDocs.map((v) => v.path),
18
- });
19
- }
20
-
21
- // Only prompt user if translation is actually needed
22
- let shouldTranslate = false;
23
- if (
24
- Array.isArray(translateLanguages) &&
25
- translateLanguages.filter((lang) => lang !== locale).length > 0
26
- ) {
27
- const choice = await options.prompts.select({
28
- message: "Document update completed. Would you like to translate these documents now?",
29
- choices: [
30
- {
31
- name: "Review documents first, translate later",
32
- value: "no",
33
- },
34
- {
35
- name: "Translate now",
36
- value: "yes",
37
- },
38
- ],
39
- });
40
- shouldTranslate = choice === "yes";
41
- }
42
-
43
- // Save documents in batches
44
- const batchSize = 3;
45
-
46
- // Return results if user chose to skip translation
47
- if (!shouldTranslate) {
48
- return {};
49
- }
50
-
51
- // Translate documents in batches
52
- const translateAgent = options.context.agents["translateMultilingual"];
53
-
54
- await pMap(
55
- selectedDocs,
56
- async (doc) => {
57
- try {
58
- // Clear feedback to ensure translation is not affected by update feedback
59
- doc.feedback = "";
60
-
61
- await options.context.invoke(translateAgent, {
62
- ...input, // context is required
63
- content: doc.content,
64
- title: doc.title,
65
- path: doc.path,
66
- docsDir,
67
- });
68
- } catch (error) {
69
- console.error(`❌ Failed to translate document ${doc.path}:`, error.message);
70
- }
71
- },
72
- { concurrency: batchSize },
73
- );
74
-
75
- return {};
76
- }
@@ -1,148 +0,0 @@
1
- import { syncDiagramToTranslations } from "../../utils/sync-diagram-to-translations.mjs";
2
- import { readFileContent } from "../../utils/docs-finder-utils.mjs";
3
- import { getFileName } from "../../utils/utils.mjs";
4
- import { debug } from "../../utils/debug.mjs";
5
-
6
- /**
7
- * Sync images to translations and exit if shouldSyncImages is true
8
- * Otherwise, passes through input for normal update flow
9
- *
10
- * This agent combines:
11
- * - Image synchronization logic
12
- * - Flow routing (sync vs normal update)
13
- * - Early exit handling
14
- */
15
- export default async function syncImagesAndExit(input, options) {
16
- // If shouldSyncImages is false, pass through for normal update flow
17
- if (!input.shouldSyncImages) {
18
- return input;
19
- }
20
-
21
- // Sync images flow
22
- const { selectedDocs = [], docsDir, locale = "en" } = input;
23
-
24
- if (!docsDir) {
25
- throw new Error("docsDir is required for image sync. Please ensure config is loaded.");
26
- }
27
-
28
- if (!Array.isArray(selectedDocs) || selectedDocs.length === 0) {
29
- const actionSuccessAgent = options.context?.agents?.["actionSuccess"];
30
- if (actionSuccessAgent) {
31
- await options.context.invoke(actionSuccessAgent, {
32
- action: "ℹ️ No documents selected for image sync",
33
- });
34
- }
35
- // Exit normally to prevent passing to next steps
36
- process.exit(0);
37
- }
38
-
39
- const results = {
40
- updated: 0,
41
- skipped: 0,
42
- errors: [],
43
- };
44
-
45
- // Process each document
46
- for (const doc of selectedDocs) {
47
- try {
48
- // Use content from doc if available, otherwise read from file
49
- let mainContent = doc.content;
50
- if (!mainContent) {
51
- const mainFileName = getFileName(doc.path, locale);
52
- mainContent = await readFileContent(docsDir, mainFileName);
53
- }
54
-
55
- if (!mainContent) {
56
- debug(`⚠️ Could not read main document: ${doc.path}`);
57
- results.skipped++;
58
- continue;
59
- }
60
-
61
- // Sync images to translation documents
62
- const syncResult = await syncDiagramToTranslations(mainContent, doc.path, docsDir, locale);
63
-
64
- results.updated += syncResult.updated;
65
- results.skipped += syncResult.skipped;
66
- results.errors.push(...syncResult.errors);
67
-
68
- if (syncResult.updated > 0) {
69
- debug(`✅ Synced images from ${doc.path} to ${syncResult.updated} translation file(s)`);
70
- } else if (syncResult.skipped > 0) {
71
- debug(
72
- `⏭️ No changes needed for ${doc.path} (${syncResult.skipped} translation file(s) already in sync)`,
73
- );
74
- }
75
- } catch (error) {
76
- debug(`❌ Error syncing images for ${doc.path}: ${error.message}`);
77
- results.errors.push({
78
- doc: doc.path,
79
- error: error.message,
80
- });
81
- }
82
- }
83
-
84
- // Generate success message
85
- const message = `✅ Image sync completed: ${results.updated} translation file(s) updated, ${results.skipped} skipped${
86
- results.errors.length > 0 ? `, ${results.errors.length} error(s)` : ""
87
- }`;
88
-
89
- // Show success message
90
- const actionSuccessAgent = options.context?.agents?.["actionSuccess"];
91
- if (actionSuccessAgent) {
92
- await options.context.invoke(actionSuccessAgent, {
93
- action: message,
94
- });
95
- }
96
-
97
- // Exit normally to prevent passing to next steps and avoid validation errors
98
- // This ensures a clean exit after successful image sync
99
- process.exit(0);
100
- }
101
-
102
- syncImagesAndExit.input_schema = {
103
- type: "object",
104
- properties: {
105
- shouldSyncImages: {
106
- type: "boolean",
107
- description: "Whether to trigger image sync to translations",
108
- },
109
- selectedDocs: {
110
- type: "array",
111
- description: "Array of selected documents to sync images from",
112
- },
113
- docsDir: {
114
- type: "string",
115
- description: "Documentation directory where documents are stored",
116
- },
117
- locale: {
118
- type: "string",
119
- description: "Main language locale (e.g., 'en', 'zh')",
120
- default: "en",
121
- },
122
- },
123
- required: ["shouldSyncImages"],
124
- };
125
-
126
- syncImagesAndExit.output_schema = {
127
- type: "object",
128
- properties: {
129
- message: {
130
- type: "string",
131
- description: "Summary message of the sync operation",
132
- },
133
- updated: {
134
- type: "number",
135
- description: "Number of translation files successfully updated",
136
- },
137
- skipped: {
138
- type: "number",
139
- description: "Number of translation files skipped (no changes needed)",
140
- },
141
- errors: {
142
- type: "array",
143
- description: "Array of errors encountered during sync",
144
- },
145
- },
146
- };
147
-
148
- syncImagesAndExit.task_render_mode = "hide";
@@ -1,71 +0,0 @@
1
- type: team
2
- name: updateDocumentDetail
3
- description: Update and optimize document content based on user feedback using diff patches
4
- task_render_mode: collapse
5
- skills:
6
- - url: ../utils/analyze-document-feedback-intent.yaml
7
- - type: ai
8
- instructions:
9
- - role: system
10
- url: ../../prompts/detail/update/system-prompt.md
11
- - role: user
12
- url: ../../prompts/detail/update/user-prompt.md
13
- auto_reorder_system_messages: true
14
- auto_merge_system_messages: true
15
- input_schema:
16
- type: object
17
- properties:
18
- originalContent:
19
- type: string
20
- description: Original markdown content to be updated
21
- feedback:
22
- type: string
23
- description: User feedback for content improvements
24
- rules:
25
- type: string
26
- description: User configuration rules
27
- locale:
28
- type: string
29
- description: User language, e.g. zh, en
30
- detailDataSource:
31
- type: string
32
- description: Context for document content
33
- glossary:
34
- type: string
35
- description: Glossary of terms
36
- userPreferences:
37
- type: string
38
- description: User's saved preferences for content and documentation style
39
- targetAudience:
40
- type: string
41
- description: Target audience for the documentation
42
- title:
43
- type: string
44
- description: Document title
45
- description:
46
- type: string
47
- description: Document description
48
- needDataSources:
49
- type: boolean
50
- description: Whether data sources are needed for content modifications
51
- path:
52
- type: string
53
- description: Document path
54
- required:
55
- - originalContent
56
- - feedback
57
- - path
58
- output_key: message
59
- afs:
60
- modules:
61
- - module: system-fs
62
- options:
63
- name: sources
64
- localPath: .
65
- description: |
66
- Codebase of the project to be documented used as context for document generation,
67
- should search and read as needed while generating document content
68
- keep_text_in_tool_uses: false
69
- skills:
70
- - ./document-tools/update-document-content.mjs
71
- # - ./generate-diagram.yaml