@aigne/doc-smith 0.8.10 → 0.8.11-beta.1

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 (260) hide show
  1. package/.aigne/doc-smith/config.yaml +2 -0
  2. package/.aigne/doc-smith/output/structure-plan.json +3 -3
  3. package/.aigne/doc-smith/upload-cache.yaml +252 -0
  4. package/.github/workflows/create-release-pr.yaml +21 -0
  5. package/.github/workflows/publish-docs.yml +67 -0
  6. package/.github/workflows/release.yml +3 -7
  7. package/.release-please-manifest.json +1 -1
  8. package/CHANGELOG.md +22 -0
  9. package/README.md +48 -115
  10. package/RELEASE.md +1 -2
  11. package/agents/clear/choose-contents.mjs +170 -0
  12. package/agents/clear/clear-auth-tokens.mjs +111 -0
  13. package/agents/clear/clear-document-config.mjs +39 -0
  14. package/agents/clear/clear-document-structure.mjs +106 -0
  15. package/agents/clear/clear-generated-docs.mjs +51 -0
  16. package/agents/clear/index.yaml +23 -0
  17. package/agents/evaluate/code-snippet.mjs +93 -0
  18. package/agents/evaluate/document-structure.yaml +70 -0
  19. package/agents/evaluate/document.yaml +79 -0
  20. package/agents/evaluate/generate-report.mjs +78 -0
  21. package/agents/evaluate/index.yaml +39 -0
  22. package/agents/generate/document-structure-tools/add-document.mjs +56 -0
  23. package/agents/generate/document-structure-tools/delete-document.mjs +49 -0
  24. package/agents/generate/document-structure-tools/move-document.mjs +82 -0
  25. package/agents/generate/document-structure-tools/update-document.mjs +50 -0
  26. package/agents/generate/generate-structure.yaml +1 -1
  27. package/agents/generate/update-document-structure.yaml +42 -0
  28. package/agents/generate/user-review-document-structure.mjs +6 -4
  29. package/agents/init/index.mjs +1 -1
  30. package/agents/publish/publish-docs.mjs +12 -3
  31. package/agents/translate/choose-language.mjs +1 -1
  32. package/agents/update/batch-update-document.yaml +7 -0
  33. package/agents/update/check-update-is-single.mjs +38 -0
  34. package/agents/update/document-tools/update-document-content.mjs +293 -0
  35. package/agents/update/index.yaml +4 -10
  36. package/agents/update/update-document-detail.yaml +52 -0
  37. package/agents/update/update-single-document.yaml +15 -0
  38. package/agents/update/user-review-document.mjs +248 -0
  39. package/agents/utils/choose-docs.mjs +4 -2
  40. package/agents/utils/format-document-structure.mjs +12 -2
  41. package/agents/utils/load-document-all-content.mjs +84 -0
  42. package/agents/utils/load-sources.mjs +4 -1
  43. package/aigne.yaml +59 -20
  44. package/assets/report-template/report.html +198 -0
  45. package/biome.json +14 -2
  46. package/docs/advanced-how-it-works.ja.md +101 -0
  47. package/docs/advanced-how-it-works.zh-TW.md +101 -0
  48. package/docs/advanced-how-it-works.zh.md +20 -20
  49. package/docs/advanced-quality-assurance.ja.md +96 -0
  50. package/docs/advanced-quality-assurance.zh-TW.md +96 -0
  51. package/docs/advanced-quality-assurance.zh.md +18 -18
  52. package/docs/advanced.ja.md +16 -0
  53. package/docs/advanced.zh-TW.md +16 -0
  54. package/docs/advanced.zh.md +4 -4
  55. package/docs/changelog.ja.md +309 -0
  56. package/docs/changelog.zh-TW.md +309 -0
  57. package/docs/changelog.zh.md +23 -23
  58. package/docs/cli-reference.ja.md +210 -0
  59. package/docs/cli-reference.zh-TW.md +210 -0
  60. package/docs/cli-reference.zh.md +21 -21
  61. package/docs/configuration-interactive-setup.ja.md +135 -0
  62. package/docs/configuration-interactive-setup.zh-TW.md +135 -0
  63. package/docs/configuration-interactive-setup.zh.md +29 -29
  64. package/docs/configuration-language-support.ja.md +94 -0
  65. package/docs/configuration-language-support.zh-TW.md +94 -0
  66. package/docs/configuration-language-support.zh.md +13 -13
  67. package/docs/configuration-llm-setup.ja.md +54 -0
  68. package/docs/configuration-llm-setup.zh-TW.md +54 -0
  69. package/docs/configuration-llm-setup.zh.md +12 -12
  70. package/docs/configuration-preferences.ja.md +129 -0
  71. package/docs/configuration-preferences.zh-TW.md +129 -0
  72. package/docs/configuration-preferences.zh.md +36 -36
  73. package/docs/configuration.ja.md +172 -0
  74. package/docs/configuration.zh-TW.md +172 -0
  75. package/docs/configuration.zh.md +49 -49
  76. package/docs/features-generate-documentation.ja.md +101 -0
  77. package/docs/features-generate-documentation.zh-TW.md +101 -0
  78. package/docs/features-generate-documentation.zh.md +17 -17
  79. package/docs/features-publish-your-docs.ja.md +107 -0
  80. package/docs/features-publish-your-docs.zh-TW.md +107 -0
  81. package/docs/features-publish-your-docs.zh.md +22 -22
  82. package/docs/features-translate-documentation.ja.md +79 -0
  83. package/docs/features-translate-documentation.zh-TW.md +79 -0
  84. package/docs/features-translate-documentation.zh.md +12 -12
  85. package/docs/features-update-and-refine.ja.md +138 -0
  86. package/docs/features-update-and-refine.zh-TW.md +138 -0
  87. package/docs/features-update-and-refine.zh.md +21 -21
  88. package/docs/features.ja.md +52 -0
  89. package/docs/features.zh-TW.md +52 -0
  90. package/docs/features.zh.md +8 -8
  91. package/docs/getting-started.ja.md +123 -0
  92. package/docs/getting-started.zh-TW.md +123 -0
  93. package/docs/getting-started.zh.md +24 -24
  94. package/docs/overview.ja.md +30 -0
  95. package/docs/overview.zh-TW.md +30 -0
  96. package/docs/overview.zh.md +8 -8
  97. package/package.json +19 -11
  98. package/prompts/common/document/content-rules-core.md +19 -0
  99. package/prompts/common/document/media-handling-rules.md +9 -0
  100. package/prompts/common/document/role-and-personality.md +15 -0
  101. package/prompts/common/document/user-preferences.md +9 -0
  102. package/prompts/common/document-structure/conflict-resolution-guidance.md +16 -0
  103. package/prompts/common/document-structure/document-structure-rules.md +45 -0
  104. package/prompts/common/document-structure/glossary.md +7 -0
  105. package/prompts/common/document-structure/intj-traits.md +5 -0
  106. package/prompts/common/document-structure/output-constraints.md +9 -0
  107. package/prompts/common/document-structure/user-locale-rules.md +10 -0
  108. package/prompts/common/document-structure/user-preferences.md +9 -0
  109. package/prompts/detail/custom/custom-components.md +9 -1
  110. package/prompts/detail/document-rules.md +6 -6
  111. package/prompts/detail/generate-document.md +5 -45
  112. package/prompts/detail/update-document.md +145 -0
  113. package/prompts/evaluate/document-structure.md +94 -0
  114. package/prompts/evaluate/document.md +149 -0
  115. package/prompts/structure/document-rules.md +1 -1
  116. package/prompts/structure/generate-structure-system.md +74 -0
  117. package/prompts/structure/generate-structure-user.md +41 -0
  118. package/prompts/structure/update-document-structure.md +118 -0
  119. package/prompts/translate/translate-document.md +1 -1
  120. package/prompts/utils/feedback-refiner.md +3 -3
  121. package/release-please-config.json +4 -3
  122. package/tests/agents/clear/choose-contents.test.mjs +280 -0
  123. package/tests/agents/clear/clear-auth-tokens.test.mjs +268 -0
  124. package/tests/agents/clear/clear-document-config.test.mjs +167 -0
  125. package/tests/agents/clear/clear-document-structure.test.mjs +374 -0
  126. package/tests/agents/clear/clear-generated-docs.test.mjs +222 -0
  127. package/tests/agents/evaluate/code-snippet.test.mjs +163 -0
  128. package/tests/agents/evaluate/fixtures/api-services.md +87 -0
  129. package/tests/agents/evaluate/fixtures/js-sdk.md +94 -0
  130. package/tests/agents/evaluate/generate-report.test.mjs +312 -0
  131. package/tests/agents/generate/check-document-structure.test.mjs +0 -6
  132. package/tests/agents/generate/document-structure-tools/add-document.test.mjs +449 -0
  133. package/tests/agents/generate/document-structure-tools/delete-document.test.mjs +410 -0
  134. package/tests/agents/generate/document-structure-tools/move-document.test.mjs +476 -0
  135. package/tests/agents/generate/document-structure-tools/update-document.test.mjs +548 -0
  136. package/tests/agents/generate/generate-structure.test.mjs +0 -6
  137. package/tests/agents/generate/user-review-document-structure.test.mjs +9 -9
  138. package/tests/agents/publish/publish-docs.test.mjs +2 -2
  139. package/tests/agents/update/check-update-is-single.test.mjs +300 -0
  140. package/tests/agents/update/document-tools/update-document-content.test.mjs +326 -0
  141. package/tests/agents/update/user-review-document.test.mjs +561 -0
  142. package/tests/agents/utils/format-document-structure.test.mjs +100 -0
  143. package/tests/utils/auth-utils.test.mjs +239 -1
  144. package/tests/utils/blocklet.test.mjs +9 -7
  145. package/tests/utils/constants.test.mjs +1 -1
  146. package/tests/utils/d2-utils.test.mjs +1 -1
  147. package/tests/utils/deploy.test.mjs +310 -366
  148. package/tests/utils/kroki-utils.test.mjs +2 -15
  149. package/tests/utils/linter/fixtures/css/keyword-error.css +1 -0
  150. package/tests/utils/linter/fixtures/css/missing-semicolon.css +1 -0
  151. package/tests/utils/linter/fixtures/css/syntax-error.css +1 -0
  152. package/tests/utils/linter/fixtures/css/undeclare-variable.css +1 -0
  153. package/tests/utils/linter/fixtures/css/unused-variable.css +2 -0
  154. package/tests/utils/linter/fixtures/css/valid-code.css +1 -0
  155. package/tests/utils/linter/fixtures/dockerfile/keyword-error.dockerfile +1 -0
  156. package/tests/utils/linter/fixtures/dockerfile/missing-semicolon.dockerfile +2 -0
  157. package/tests/utils/linter/fixtures/dockerfile/syntax-error.dockerfile +2 -0
  158. package/tests/utils/linter/fixtures/dockerfile/undeclare-variable.dockerfile +1 -0
  159. package/tests/utils/linter/fixtures/dockerfile/unused-variable.dockerfile +1 -0
  160. package/tests/utils/linter/fixtures/dockerfile/valid-code.dockerfile +2 -0
  161. package/tests/utils/linter/fixtures/go/keyword-error.go +5 -0
  162. package/tests/utils/linter/fixtures/go/missing-semicolon.go +5 -0
  163. package/tests/utils/linter/fixtures/go/syntax-error.go +6 -0
  164. package/tests/utils/linter/fixtures/go/undeclare-variable.go +5 -0
  165. package/tests/utils/linter/fixtures/go/unused-variable.go +5 -0
  166. package/tests/utils/linter/fixtures/go/valid-code.go +7 -0
  167. package/tests/utils/linter/fixtures/js/keyword-error.js +3 -0
  168. package/tests/utils/linter/fixtures/js/missing-semicolon.js +6 -0
  169. package/tests/utils/linter/fixtures/js/syntax-error.js +4 -0
  170. package/tests/utils/linter/fixtures/js/undeclare-variable.js +3 -0
  171. package/tests/utils/linter/fixtures/js/unused-variable.js +7 -0
  172. package/tests/utils/linter/fixtures/js/valid-code.js +15 -0
  173. package/tests/utils/linter/fixtures/json/keyword-error.json +1 -0
  174. package/tests/utils/linter/fixtures/json/missing-semicolon.json +1 -0
  175. package/tests/utils/linter/fixtures/json/syntax-error.json +1 -0
  176. package/tests/utils/linter/fixtures/json/undeclare-variable.json +1 -0
  177. package/tests/utils/linter/fixtures/json/unused-variable.json +1 -0
  178. package/tests/utils/linter/fixtures/json/valid-code.json +1 -0
  179. package/tests/utils/linter/fixtures/jsx/keyword-error.jsx +5 -0
  180. package/tests/utils/linter/fixtures/jsx/missing-semicolon.jsx +5 -0
  181. package/tests/utils/linter/fixtures/jsx/syntax-error.jsx +5 -0
  182. package/tests/utils/linter/fixtures/jsx/undeclare-variable.jsx +5 -0
  183. package/tests/utils/linter/fixtures/jsx/unused-variable.jsx +4 -0
  184. package/tests/utils/linter/fixtures/jsx/valid-code.jsx +5 -0
  185. package/tests/utils/linter/fixtures/python/keyword-error.py +3 -0
  186. package/tests/utils/linter/fixtures/python/missing-semicolon.py +2 -0
  187. package/tests/utils/linter/fixtures/python/syntax-error.py +3 -0
  188. package/tests/utils/linter/fixtures/python/undeclare-variable.py +3 -0
  189. package/tests/utils/linter/fixtures/python/unused-variable.py +6 -0
  190. package/tests/utils/linter/fixtures/python/valid-code.py +12 -0
  191. package/tests/utils/linter/fixtures/ruby/keyword-error.rb +2 -0
  192. package/tests/utils/linter/fixtures/ruby/missing-semicolon.rb +1 -0
  193. package/tests/utils/linter/fixtures/ruby/syntax-error.rb +2 -0
  194. package/tests/utils/linter/fixtures/ruby/undeclare-variable.rb +1 -0
  195. package/tests/utils/linter/fixtures/ruby/unused-variable.rb +2 -0
  196. package/tests/utils/linter/fixtures/ruby/valid-code.rb +1 -0
  197. package/tests/utils/linter/fixtures/sass/keyword-error.sass +2 -0
  198. package/tests/utils/linter/fixtures/sass/missing-semicolon.sass +3 -0
  199. package/tests/utils/linter/fixtures/sass/syntax-error.sass +3 -0
  200. package/tests/utils/linter/fixtures/sass/undeclare-variable.sass +2 -0
  201. package/tests/utils/linter/fixtures/sass/unused-variable.sass +4 -0
  202. package/tests/utils/linter/fixtures/sass/valid-code.sass +2 -0
  203. package/tests/utils/linter/fixtures/scss/keyword-error.scss +1 -0
  204. package/tests/utils/linter/fixtures/scss/missing-semicolon.scss +1 -0
  205. package/tests/utils/linter/fixtures/scss/syntax-error.scss +1 -0
  206. package/tests/utils/linter/fixtures/scss/undeclare-variable.scss +1 -0
  207. package/tests/utils/linter/fixtures/scss/unused-variable.scss +2 -0
  208. package/tests/utils/linter/fixtures/scss/valid-code.scss +1 -0
  209. package/tests/utils/linter/fixtures/shell/keyword-error.sh +5 -0
  210. package/tests/utils/linter/fixtures/shell/missing-semicolon.sh +3 -0
  211. package/tests/utils/linter/fixtures/shell/syntax-error.sh +4 -0
  212. package/tests/utils/linter/fixtures/shell/undeclare-variable.sh +3 -0
  213. package/tests/utils/linter/fixtures/shell/unused-variable.sh +4 -0
  214. package/tests/utils/linter/fixtures/shell/valid-code.sh +3 -0
  215. package/tests/utils/linter/fixtures/ts/keyword-error.ts +1 -0
  216. package/tests/utils/linter/fixtures/ts/missing-semicolon.ts +1 -0
  217. package/tests/utils/linter/fixtures/ts/syntax-error.ts +1 -0
  218. package/tests/utils/linter/fixtures/ts/undeclare-variable.ts +1 -0
  219. package/tests/utils/linter/fixtures/ts/unused-variable.ts +3 -0
  220. package/tests/utils/linter/fixtures/ts/valid-code.ts +3 -0
  221. package/tests/utils/linter/fixtures/tsx/keyword-error.tsx +5 -0
  222. package/tests/utils/linter/fixtures/tsx/missing-semicolon.tsx +5 -0
  223. package/tests/utils/linter/fixtures/tsx/syntax-error.tsx +5 -0
  224. package/tests/utils/linter/fixtures/tsx/undeclare-variable.tsx +6 -0
  225. package/tests/utils/linter/fixtures/tsx/unused-variable.tsx +6 -0
  226. package/tests/utils/linter/fixtures/tsx/valid-code.tsx +5 -0
  227. package/tests/utils/linter/fixtures/vue/keyword-error.vue +6 -0
  228. package/tests/utils/linter/fixtures/vue/missing-semicolon.vue +6 -0
  229. package/tests/utils/linter/fixtures/vue/syntax-error.vue +6 -0
  230. package/tests/utils/linter/fixtures/vue/undeclare-variable.vue +6 -0
  231. package/tests/utils/linter/fixtures/vue/unused-variable.vue +7 -0
  232. package/tests/utils/linter/fixtures/vue/valid-code.vue +6 -0
  233. package/tests/utils/linter/fixtures/yaml/keyword-error.yml +1 -0
  234. package/tests/utils/linter/fixtures/yaml/missing-semicolon.yml +2 -0
  235. package/tests/utils/linter/fixtures/yaml/syntax-error.yml +1 -0
  236. package/tests/utils/linter/fixtures/yaml/undeclare-variable.yml +1 -0
  237. package/tests/utils/linter/fixtures/yaml/unused-variable.yml +2 -0
  238. package/tests/utils/linter/fixtures/yaml/valid-code.yml +3 -0
  239. package/tests/utils/linter/index.test.mjs +440 -0
  240. package/tests/utils/linter/scan-results.mjs +42 -0
  241. package/tests/utils/markdown/index.test.mjs +478 -0
  242. package/tests/utils/mermaid-validator.test.mjs +2 -2
  243. package/tests/utils/utils.test.mjs +3 -1
  244. package/types/document-schema.mjs +54 -0
  245. package/types/document-structure-schema.mjs +244 -0
  246. package/utils/auth-utils.mjs +131 -6
  247. package/utils/conflict-detector.mjs +5 -1
  248. package/utils/{constants.mjs → constants/index.mjs} +109 -0
  249. package/utils/constants/linter.mjs +102 -0
  250. package/utils/d2-utils.mjs +2 -4
  251. package/utils/debug.mjs +3 -0
  252. package/utils/deploy.mjs +81 -385
  253. package/utils/evaluate/report-utils.mjs +131 -0
  254. package/utils/file-utils.mjs +36 -1
  255. package/utils/kroki-utils.mjs +1 -1
  256. package/utils/linter/index.mjs +50 -0
  257. package/utils/markdown/index.mjs +26 -0
  258. package/utils/markdown-checker.mjs +1 -1
  259. package/utils/utils.mjs +19 -7
  260. package/prompts/structure/generate-structure.md +0 -161
package/README.md CHANGED
@@ -30,21 +30,25 @@ As shown in the diagram, DocSmith integrates seamlessly with other [AIGNE](https
30
30
  ## ✨ Features
31
31
 
32
32
  ### 🤖 AI-Powered Generation
33
+
33
34
  - **Smart Structure Planning**: Automatically analyzes your codebase to create logical, comprehensive documentation structure
34
35
  - **Intelligent Content Creation**: Generates detailed, contextual content that explains both "what" and "why"
35
36
  - **Adaptive Writing Styles**: Supports multiple documentation styles (Technical, User-Friendly, Developer-Focused, etc.)
36
37
 
37
38
  ### 🌍 Multi-Language Excellence
39
+
38
40
  - **12 Language Support**: English, Chinese (Simplified & Traditional), Japanese, Korean, Spanish, French, German, Portuguese, Russian, Italian, and Arabic
39
41
  - **Professional Translation**: Context-aware translation that maintains technical accuracy
40
42
  - **Glossary Integration**: Consistent terminology across all languages
41
43
 
42
44
  ### 🔗 Seamless Integration
45
+
43
46
  - **AIGNE Hub Integration**: Use [AIGNE Hub](https://www.aigne.io/en/hub) without API keys, switch between Google Gemini, OpenAI GPT, Claude, and more
44
47
  - **Multiple LLM Support**: Bring your own API keys for OpenAI, Anthropic, Google, and other providers
45
- - **Discuss Kit Publishing**: Deploy to [docsmith.aigne.io](https://docsmith.aigne.io/app/) or your own [Discuss Kit](https://www.arcblock.io/docs/web3-kit/en/discuss-kit) instance
48
+ - **Discuss Kit Publishing**: Deploy to [docsmith.aigne.io](https://docsmith.aigne.io/app/) or your own [Discuss Kit](https://www.web3kit.rocks/discuss-kit) instance
46
49
 
47
50
  ### 🔄 Smart Updates
51
+
48
52
  - **Change Detection**: Automatically identifies code changes and updates relevant documentation
49
53
  - **Targeted Regeneration**: Update specific sections with custom feedback and requirements
50
54
  - **Version Awareness**: Maintains documentation history and tracks changes over time
@@ -53,80 +57,9 @@ As shown in the diagram, DocSmith integrates seamlessly with other [AIGNE](https
53
57
 
54
58
  ### Prerequisites
55
59
 
56
- - Node.js 18+ and npm/pnpm
60
+ - Node.js 20+ and npm/pnpm
57
61
  - No API keys required (uses AIGNE Hub by default)
58
62
 
59
- ### Node.js Installation
60
-
61
- #### Windows
62
- 1. Download Node.js installer from [nodejs.org](https://nodejs.org/)
63
- 2. Run the installer (.msi file)
64
- 3. Follow installation wizard steps
65
- 4. Verify installation: `node --version`
66
-
67
- #### macOS
68
- **Option 1: Using Homebrew (Recommended)**
69
- ```bash
70
- # Install Homebrew if not already installed
71
- /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
72
-
73
- # Install Node.js
74
- brew install node
75
- ```
76
-
77
- **Option 2: Using the Official Installer**
78
- 1. Download the macOS installer from [nodejs.org](https://nodejs.org/)
79
- 2. Double-click the .pkg file to run the installer
80
- 3. Follow the installation wizard
81
- 4. Verify installation: `node --version`
82
-
83
- #### Linux
84
-
85
- **Ubuntu/Debian:**
86
- ```bash
87
- # Update package index
88
- sudo apt update
89
-
90
- # Install Node.js
91
- sudo apt install nodejs npm
92
-
93
- # Or install latest LTS version using NodeSource repository
94
- curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
95
- sudo apt-get install -y nodejs
96
- ```
97
-
98
- **CentOS/RHEL/Fedora:**
99
- ```bash
100
- # For CentOS/RHEL
101
- sudo yum install nodejs npm
102
-
103
- # For Fedora
104
- sudo dnf install nodejs npm
105
-
106
- # Or using NodeSource repository
107
- curl -fsSL https://rpm.nodesource.com/setup_lts.x | sudo bash -
108
- sudo yum install nodejs
109
- ```
110
-
111
- **Using Node Version Manager (nvm) - All Linux Distributions:**
112
- ```bash
113
- # Install nvm
114
- curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
115
-
116
- # Restart terminal or run:
117
- source ~/.bashrc
118
-
119
- # Install latest LTS Node.js
120
- nvm install --lts
121
- nvm use --lts
122
- ```
123
-
124
- #### Verification
125
- After installation on any platform, verify Node.js and npm are installed correctly:
126
- ```bash
127
- node --version
128
- npm --version
129
- ```
130
63
 
131
64
  ### 📦 Installation
132
65
 
@@ -152,6 +85,7 @@ aigne doc generate
152
85
  ```
153
86
 
154
87
  DocSmith will:
88
+
155
89
  1. 🔍 Auto-detect your project structure and tech stack
156
90
  2. 🎯 Guide you through an interactive setup (first time only)
157
91
  3. 📝 Generate comprehensive documentation
@@ -165,6 +99,7 @@ DocSmith will:
165
99
  DocSmith supports multiple AI providers:
166
100
 
167
101
  **🎯 AIGNE Hub (Recommended)**
102
+
168
103
  - ✅ No API keys required
169
104
  - ✅ Easy model switching
170
105
  - ✅ Built-in rate limiting and optimization
@@ -178,6 +113,7 @@ aigne doc generate --model openai:gpt-4o
178
113
 
179
114
  **🔑 Custom API Keys**
180
115
  Configure your own API keys for direct provider access:
116
+
181
117
  - OpenAI GPT models
182
118
  - Anthropic Claude models
183
119
  - Google Gemini models
@@ -188,6 +124,7 @@ Configure your own API keys for direct provider access:
188
124
  ### Core Commands
189
125
 
190
126
  #### 📝 Generate Documentation
127
+
191
128
  ```bash
192
129
  # Smart generation with auto-configuration
193
130
  aigne doc generate
@@ -200,6 +137,7 @@ aigne doc generate --feedback "Add more API examples and troubleshooting section
200
137
  ```
201
138
 
202
139
  #### 🔄 Update Existing Documents
140
+
203
141
  ```bash
204
142
  # Interactive document selection and update
205
143
  aigne doc update
@@ -209,6 +147,7 @@ aigne doc update --docs overview.md --feedback "Add comprehensive FAQ section"
209
147
  ```
210
148
 
211
149
  #### 🌍 Multi-Language Translation
150
+
212
151
  ```bash
213
152
  # Interactive translation with smart language selection
214
153
  aigne doc translate
@@ -221,6 +160,7 @@ aigne doc translate --glossary @path/to/glossary.md --feedback "Use technical te
221
160
  ```
222
161
 
223
162
  #### 🚀 Publishing & Deployment
163
+
224
164
  ```bash
225
165
  # Interactive publishing with platform selection
226
166
  aigne doc publish
@@ -230,6 +170,7 @@ aigne doc publish --appUrl https://your-discuss-kit-instance.com
230
170
  ```
231
171
 
232
172
  #### ⚙️ Configuration Management
173
+
233
174
  ```bash
234
175
  # Interactive configuration setup
235
176
  aigne doc init
@@ -248,43 +189,43 @@ DocSmith automatically detects your project structure, but you can customize:
248
189
  - **📁 Source Paths**: Customize which files and directories to analyze
249
190
  - **📤 Output Settings**: Configure documentation structure and formatting
250
191
 
251
-
252
-
253
192
  ## 🌐 Supported Languages
254
193
 
255
194
  DocSmith provides professional translation for 12 languages:
256
195
 
257
- | Language | Code | Support Level |
258
- |----------|------|---------------|
259
- | English | `en` | ✅ Native |
260
- | 简体中文 | `zh-CN` | ✅ Full |
261
- | 繁體中文 | `zh-TW` | ✅ Full |
262
- | 日本語 | `ja` | ✅ Full |
263
- | 한국어 | `ko` | ✅ Full |
264
- | Español | `es` | ✅ Full |
265
- | Français | `fr` | ✅ Full |
266
- | Deutsch | `de` | ✅ Full |
267
- | Português | `pt-BR` | ✅ Full |
268
- | Русский | `ru` | ✅ Full |
269
- | Italiano | `it` | ✅ Full |
270
- | العربية | `ar` | ✅ Full |
271
-
196
+ | Language | Code | Support Level |
197
+ | --------- | ------- | ------------- |
198
+ | English | `en` | ✅ Native |
199
+ | 简体中文 | `zh-CN` | ✅ Full |
200
+ | 繁體中文 | `zh-TW` | ✅ Full |
201
+ | 日本語 | `ja` | ✅ Full |
202
+ | 한국어 | `ko` | ✅ Full |
203
+ | Español | `es` | ✅ Full |
204
+ | Français | `fr` | ✅ Full |
205
+ | Deutsch | `de` | ✅ Full |
206
+ | Português | `pt-BR` | ✅ Full |
207
+ | Русский | `ru` | ✅ Full |
208
+ | Italiano | `it` | ✅ Full |
209
+ | العربية | `ar` | ✅ Full |
272
210
 
273
211
  ## 🤝 Contributing
274
212
 
275
213
  We welcome contributions from the community! Here's how you can help:
276
214
 
277
215
  ### 🐛 Reporting Issues
216
+
278
217
  - 🔍 [Search existing issues](https://github.com/AIGNE-io/aigne-doc-smith/issues) first
279
218
  - 📝 Use our issue templates for bug reports and feature requests
280
219
  - 🚨 Include clear reproduction steps and environment details
281
220
 
282
221
  ### 💡 Feature Requests
222
+
283
223
  - 🌟 Share your ideas in [GitHub Discussions](https://github.com/AIGNE-io/aigne-doc-smith/discussions)
284
224
  - 📋 Check our [roadmap](https://github.com/AIGNE-io/aigne-doc-smith/projects) for planned features
285
225
  - 🗳️ Vote on existing feature requests
286
226
 
287
227
  ### 🔧 Development Setup
228
+
288
229
  ```bash
289
230
  # Clone the repository
290
231
  git clone https://github.com/AIGNE-io/aigne-doc-smith.git
@@ -298,26 +239,33 @@ pnpm test
298
239
 
299
240
  # Run linting
300
241
  pnpm run lint
242
+
243
+ # Auto fix lint error
244
+ pnpm run lint:fix
301
245
  ```
302
246
 
303
247
  ### 📜 Code of Conduct
304
- Please read our [Code of Conduct](https://github.com/AIGNE-io/aigne-doc-smith/blob/main/CODE_OF_CONDUCT.md) before contributing.
248
+
249
+ Please follow our community guidelines and maintain respectful, constructive communication when contributing.
305
250
 
306
251
  ## 💼 Enterprise & Production Use
307
252
 
308
253
  ### 🏢 Enterprise Features
254
+
309
255
  - **Team Collaboration**: Multi-user workflows with role-based access
310
256
  - **Custom Branding**: White-label documentation with your brand identity
311
257
  - **API Integration**: REST APIs for automated documentation pipelines
312
258
  - **Analytics**: Track documentation usage and effectiveness
313
259
 
314
260
  ### 🔒 Security & Compliance
261
+
315
262
  - **Private Cloud**: Deploy on your own infrastructure
316
263
  - **SSO Integration**: Connect with your identity providers
317
264
  - **Audit Logs**: Complete activity tracking and compliance reporting
318
265
  - **Data Privacy**: Your code never leaves your environment in private deployments
319
266
 
320
267
  ### 📞 Support & Services
268
+
321
269
  - **Priority Support**: Direct access to our engineering team
322
270
  - **Custom Training**: Team onboarding and best practices workshops
323
271
  - **Professional Services**: Custom integrations and deployment assistance
@@ -327,27 +275,26 @@ Please read our [Code of Conduct](https://github.com/AIGNE-io/aigne-doc-smith/bl
327
275
  ## 📊 Community & Resources
328
276
 
329
277
  ### 📚 Documentation & Tutorials
330
- - 📖 [Official Documentation](https://docsmith.aigne.io/docs/)
331
- - 🎥 [Video Tutorials](https://www.youtube.com/@aigne-io)
332
- - 📝 [Best Practices Guide](https://docsmith.aigne.io/guides/best-practices)
333
- - 🔧 [API Reference](https://docsmith.aigne.io/api/)
278
+
279
+ - 📖 [Documentation](https://docsmith.aigne.io/docs/)
334
280
 
335
281
  ### 💬 Community Support
336
- - 💭 [GitHub Discussions](https://github.com/AIGNE-io/aigne-doc-smith/discussions) - Q&A and feature discussions
337
- - 🐦 [Twitter](https://twitter.com/aigne_io) - Updates and announcements
338
- - 🎮 [Discord Server](https://discord.gg/aigne) - Real-time community chat
339
- - 📧 [Newsletter](https://www.aigne.io/newsletter) - Monthly updates and tips
282
+
283
+ - 🐦 [Twitter](https://twitter.com/arcblock_io) - Updates and announcements
284
+ - 🎮 [Community](https://community.arcblock.io/discussions/boards/aigne) - Real-time community chat
340
285
 
341
286
  ### 🏆 Showcase
287
+
342
288
  See DocSmith in action with real-world examples:
343
- - [AIGNE Framework Docs](https://docs.aigne.io) - Generated with DocSmith
344
- - [Community Projects](https://github.com/topics/aigne-docsmith) - Browse repositories using DocSmith
289
+
290
+ - [Docs Repository](https://docsmith.aigne.io/app) - Generated with DocSmith
345
291
 
346
292
  ## 📄 License
347
293
 
348
294
  This project is licensed under the **Elastic License 2.0** - see the [LICENSE](LICENSE) file for details.
349
295
 
350
296
  ### What does this mean?
297
+
351
298
  - ✅ **Free for most use cases**: Personal projects, internal use, and most commercial applications
352
299
  - ✅ **Open source**: Full source code available for review and contributions
353
300
  - ✅ **Commercial friendly**: Use in your business applications and services
@@ -355,17 +302,3 @@ This project is licensed under the **Elastic License 2.0** - see the [LICENSE](L
355
302
 
356
303
  [Learn more about Elastic License 2.0](https://www.elastic.co/licensing/elastic-license)
357
304
 
358
- ---
359
-
360
- <div align="center">
361
-
362
- **🚀 Start generating amazing documentation today!**
363
-
364
- [![Get Started](https://img.shields.io/badge/Get_Started-brightgreen?style=for-the-badge&logo=rocket)](https://docsmith.aigne.io/get-started)
365
- [![Join Community](https://img.shields.io/badge/Join_Community-blue?style=for-the-badge&logo=discord)](https://discord.gg/aigne)
366
- [![Star on GitHub](https://img.shields.io/badge/Star_on_GitHub-yellow?style=for-the-badge&logo=github)](https://github.com/AIGNE-io/aigne-doc-smith)
367
-
368
- Made with ❤️ by the [AIGNE Team](https://www.aigne.io/team)
369
-
370
- </div>
371
-
package/RELEASE.md CHANGED
@@ -5,6 +5,5 @@ Merge that PR when appropriate.
5
5
 
6
6
  ### Release a prod version
7
7
 
8
- When you want to publish a production version, you can run `git commit --allow-empty -m "chore: release x.x.x" -m "Release-As: x.x.x"` to main.
9
- release-please will update the PR to release to a specific version (without beta).
8
+ When you want publish a prod version, manually execute the GitHub Action 'Create Release PR' to create a release PR for the prod version.
10
9
  Merge that PR when appropriate.
@@ -0,0 +1,170 @@
1
+ const TARGET_METADATA = {
2
+ generatedDocs: {
3
+ label: "generated documents",
4
+ description: "Delete all generated documents.",
5
+ agent: "clearGeneratedDocs",
6
+ },
7
+ documentStructure: {
8
+ label: "document structure",
9
+ description: "Delete the document structure and all generated documents.",
10
+ agent: "clearDocumentStructure",
11
+ },
12
+ documentConfig: {
13
+ label: "document configuration",
14
+ description: "Delete the document configuration.",
15
+ agent: "clearDocumentConfig",
16
+ },
17
+ authTokens: {
18
+ label: "authorizations",
19
+ description: "Clear published site authorizations.",
20
+ agent: "clearAuthTokens",
21
+ },
22
+ };
23
+
24
+ const TARGET_KEYS = Object.keys(TARGET_METADATA);
25
+
26
+ function normalizeTarget(value) {
27
+ if (!value) return null;
28
+ const trimmed = value.trim();
29
+ if (TARGET_METADATA[trimmed]) return trimmed;
30
+
31
+ const lowerMatched = TARGET_KEYS.find((key) => key.toLowerCase() === trimmed.toLowerCase());
32
+ return lowerMatched || null;
33
+ }
34
+
35
+ export default async function chooseContents(input = {}, options = {}) {
36
+ const { targets: rawTargets, ...rest } = input;
37
+
38
+ const normalizedTargets = Array.isArray(rawTargets)
39
+ ? rawTargets.map(normalizeTarget).filter(Boolean)
40
+ : [];
41
+
42
+ let selectedTargets = [...new Set(normalizedTargets)];
43
+
44
+ if (selectedTargets.length === 0) {
45
+ if (options?.prompts?.checkbox) {
46
+ const choices = Object.entries(TARGET_METADATA).map(([value, def]) => ({
47
+ name: def.label,
48
+ value,
49
+ description: def.description,
50
+ }));
51
+
52
+ selectedTargets = await options.prompts.checkbox({
53
+ message: "Select items to clear:",
54
+ choices,
55
+ validate: (answer) => (answer.length > 0 ? true : "Please select at least one item."),
56
+ });
57
+ } else {
58
+ // If no prompts available, show available options
59
+ return {
60
+ message: `Available options to clear: ${TARGET_KEYS.join(", ")}`,
61
+ availableTargets: TARGET_KEYS,
62
+ };
63
+ }
64
+ }
65
+
66
+ if (selectedTargets.length === 0) {
67
+ return {
68
+ message: "No items selected to clear.",
69
+ };
70
+ }
71
+
72
+ const results = [];
73
+ let hasError = false;
74
+ let configCleared = false;
75
+
76
+ // Process each target using its dedicated agent
77
+ for (const target of selectedTargets) {
78
+ const metadata = TARGET_METADATA[target];
79
+ if (!metadata) {
80
+ results.push({
81
+ status: "error",
82
+ message: `Unknown target: ${target}`,
83
+ });
84
+ hasError = true;
85
+ continue;
86
+ }
87
+
88
+ try {
89
+ // Get and invoke the specific agent using context
90
+ const clearAgent = options.context?.agents?.[metadata.agent];
91
+ if (!clearAgent) {
92
+ throw new Error(`Clear agent '${metadata.agent}' not found in context`);
93
+ }
94
+
95
+ const result = await options.context.invoke(clearAgent, rest);
96
+
97
+ if (result.error) {
98
+ hasError = true;
99
+ results.push({
100
+ status: "error",
101
+ message: result.message,
102
+ });
103
+ } else {
104
+ const status = result.cleared ? "removed" : "noop";
105
+ results.push({
106
+ status,
107
+ message: result.message,
108
+ path: result.path,
109
+ suggestions: result.suggestions,
110
+ });
111
+
112
+ // Track if document config was cleared
113
+ if (target === "documentConfig" && result.cleared) {
114
+ configCleared = true;
115
+ }
116
+ }
117
+ } catch (error) {
118
+ hasError = true;
119
+ results.push({
120
+ status: "error",
121
+ message: `Failed to clear ${metadata.label}: ${error.message}`,
122
+ });
123
+ }
124
+ }
125
+
126
+ // Prepare response message
127
+ const header = hasError
128
+ ? "Cleanup finished with some issues."
129
+ : "Cleanup completed successfully!";
130
+ const detailLines = results.map((item) => `- ${item.message}`).join("\n");
131
+
132
+ // Collect suggestions
133
+ const suggestions = [];
134
+ results.forEach((result) => {
135
+ if (result.suggestions) {
136
+ suggestions.push(...result.suggestions);
137
+ }
138
+ });
139
+
140
+ // Add default suggestion if config was cleared
141
+ if (configCleared && !suggestions.some((s) => s.includes("aigne doc init"))) {
142
+ suggestions.push("Run `aigne doc init` to generate a fresh configuration file.");
143
+ }
144
+
145
+ const message = [header, "", detailLines, suggestions.length ? "" : null, suggestions.join("\n")]
146
+ .filter(Boolean)
147
+ .join("\n");
148
+
149
+ return {
150
+ message,
151
+ };
152
+ }
153
+
154
+ chooseContents.input_schema = {
155
+ type: "object",
156
+ properties: {
157
+ targets: {
158
+ type: "array",
159
+ description: "Items to clear without confirmation",
160
+ items: {
161
+ type: "string",
162
+ enum: TARGET_KEYS,
163
+ },
164
+ },
165
+ },
166
+ };
167
+
168
+ chooseContents.taskTitle = "Choose contents to clear";
169
+ chooseContents.description =
170
+ "Choose contents to clear and execute the appropriate clearing operations";
@@ -0,0 +1,111 @@
1
+ import { existsSync } from "node:fs";
2
+ import { readFile, writeFile } from "node:fs/promises";
3
+ import { homedir } from "node:os";
4
+ import { join } from "node:path";
5
+ import chalk from "chalk";
6
+ import { parse, stringify } from "yaml";
7
+
8
+ export default async function clearAuthTokens(_input = {}, options = {}) {
9
+ const DOC_SMITH_ENV_FILE = join(homedir(), ".aigne", "doc-smith-connected.yaml");
10
+
11
+ // Check if the file exists
12
+ if (!existsSync(DOC_SMITH_ENV_FILE)) {
13
+ return {
14
+ message: "No site authorizations found to clear",
15
+ };
16
+ }
17
+
18
+ try {
19
+ // Read existing configuration
20
+ const data = await readFile(DOC_SMITH_ENV_FILE, "utf8");
21
+ const envs = parse(data) || {};
22
+
23
+ // Get all available sites
24
+ const siteHostnames = Object.keys(envs);
25
+
26
+ if (siteHostnames.length === 0) {
27
+ return {
28
+ message: "No site authorizations found to clear",
29
+ };
30
+ }
31
+
32
+ // Display all sites with their URLs for user selection
33
+ const choices = siteHostnames.map((hostname) => {
34
+ return {
35
+ name: `${chalk.cyan(hostname)}`,
36
+ value: hostname,
37
+ checked: false, // Allow multiple selection
38
+ };
39
+ });
40
+
41
+ // Add an option to clear all site authorizations
42
+ choices.push({
43
+ name: chalk.red("🗑️ Clear ALL site authorizations"),
44
+ value: "__ALL__",
45
+ checked: false,
46
+ });
47
+
48
+ let selectedSites = [];
49
+
50
+ if (options?.prompts?.checkbox) {
51
+ selectedSites = await options.prompts.checkbox({
52
+ message: "Select sites to clear authorization from:",
53
+ choices,
54
+ validate: (answer) => (answer.length > 0 ? true : "Please select at least one site."),
55
+ });
56
+ } else {
57
+ // If no prompts available, clear all site authorizations
58
+ selectedSites = ["__ALL__"];
59
+ }
60
+
61
+ if (selectedSites.length === 0) {
62
+ return {
63
+ message: "No sites selected for clearing authorization",
64
+ };
65
+ }
66
+
67
+ const results = [];
68
+ let clearedCount = 0;
69
+
70
+ if (selectedSites.includes("__ALL__")) {
71
+ // Clear all site authorizations
72
+ await writeFile(DOC_SMITH_ENV_FILE, stringify({}));
73
+ results.push(`Cleared site authorization for all sites (${siteHostnames.length} sites)`);
74
+ clearedCount = siteHostnames.length;
75
+ } else {
76
+ // Clear site authorizations for selected sites
77
+ const updatedEnvs = { ...envs };
78
+
79
+ for (const hostname of selectedSites) {
80
+ if (updatedEnvs[hostname]) {
81
+ // Remove the entire site object
82
+ delete updatedEnvs[hostname];
83
+
84
+ results.push(`Cleared site authorization for ${chalk.cyan(hostname)}`);
85
+ clearedCount++;
86
+ }
87
+ }
88
+
89
+ await writeFile(DOC_SMITH_ENV_FILE, stringify(updatedEnvs));
90
+ }
91
+
92
+ const header = `Successfully cleared site authorizations!`;
93
+ const detailLines = results.join("\n");
94
+
95
+ const message = [header, "", detailLines, ""].filter(Boolean).join("\n");
96
+
97
+ return {
98
+ message,
99
+ clearedCount,
100
+ clearedSites: selectedSites.includes("__ALL__") ? siteHostnames : selectedSites,
101
+ };
102
+ } catch (error) {
103
+ return {
104
+ message: `Failed to clear site authorizations: ${error.message}`,
105
+ error: true,
106
+ };
107
+ }
108
+ }
109
+
110
+ clearAuthTokens.taskTitle = "Clear site authorizations";
111
+ clearAuthTokens.description = "Clear site authorizations for document publishing sites";
@@ -0,0 +1,39 @@
1
+ import { rm } from "node:fs/promises";
2
+ import { join } from "node:path";
3
+ import { pathExists, toDisplayPath } from "../../utils/file-utils.mjs";
4
+
5
+ export default async function clearDocumentConfig({ workDir }) {
6
+ // Fixed path where config.yaml is saved by init command
7
+ const cwd = workDir || process.cwd();
8
+ const documentConfigPath = join(cwd, ".aigne", "doc-smith", "config.yaml");
9
+ const displayPath = toDisplayPath(documentConfigPath);
10
+
11
+ try {
12
+ const existed = await pathExists(documentConfigPath);
13
+ await rm(documentConfigPath, { recursive: true, force: true });
14
+
15
+ const message = existed
16
+ ? `Cleared document configuration (${displayPath})`
17
+ : `Document configuration already empty (${displayPath})`;
18
+
19
+ const suggestions = existed
20
+ ? ["Run `aigne doc init` to generate a fresh configuration file."]
21
+ : [];
22
+
23
+ return {
24
+ message,
25
+ cleared: existed,
26
+ path: displayPath,
27
+ suggestions,
28
+ };
29
+ } catch (error) {
30
+ return {
31
+ message: `Failed to clear document configuration: ${error.message}`,
32
+ error: true,
33
+ path: displayPath,
34
+ };
35
+ }
36
+ }
37
+
38
+ clearDocumentConfig.taskTitle = "Clear document configuration";
39
+ clearDocumentConfig.description = "Clear the document configuration file";