@aigne/doc-smith 0.2.1 → 0.2.3

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.3](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.2.2...v0.2.3) (2025-08-07)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * polish process info ([#14](https://github.com/AIGNE-io/aigne-doc-smith/issues/14)) ([a4a314f](https://github.com/AIGNE-io/aigne-doc-smith/commit/a4a314f65af25f6012726b782f30895ce4124f52))
9
+
10
+ ## [0.2.2](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.2.1...v0.2.2) (2025-08-07)
11
+
12
+
13
+ ### Miscellaneous Chores
14
+
15
+ * release 0.2.2 ([c3fb52a](https://github.com/AIGNE-io/aigne-doc-smith/commit/c3fb52a78b95676e1c13361b30ebec2914a89fa8))
16
+
3
17
  ## [0.2.1](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.2.0...v0.2.1) (2025-08-06)
4
18
 
5
19
 
package/README.md CHANGED
@@ -1,114 +1,213 @@
1
1
  # AIGNE DocSmith
2
2
 
3
- AIGNE DocSmith is a powerful, AI-driven documentation generation tool built on the AIGNE Framework. It automates the creation of detailed, structured, and multi-language documentation directly from your source code.
3
+ AIGNE DocSmith is a powerful, AI-driven documentation generation tool built on the [AIGNE Framework](https://www.aigne.io/en/framework). It automates the creation of detailed, structured, and multi-language documentation directly from your source code.
4
4
 
5
- ## Features
5
+ ## AIGNE Ecosystem
6
6
 
7
- - **Automated Structure Planning:** Intelligently analyzes your codebase to generate a comprehensive and logical document structure.
8
- - **AI-Powered Content Generation:** Populates the document structure with detailed, high-quality content.
9
- - **Multi-Language Support:** Seamlessly translates your documentation into multiple languages.
10
- - **Smart File Management:** Automatically cleans up invalid .md files that are no longer in the structure plan, preventing file accumulation.
11
- - **Customizable Prompts:** Allows for fine-tuning the output by customizing the prompts used by the AI agents.
12
- - **Extensible Workflow:** Built with a modular agent-based architecture, making it easy to extend and customize the documentation generation process.
7
+ DocSmith is part of the [AIGNE](https://www.aigne.io) ecosystem, a comprehensive AI application development platform. Here's the architecture overview:
13
8
 
14
- ## How It Works
9
+ ![AIGNE Ecosystem Architecture](https://www.aigne.io/image-bin/uploads/1a609bad1b46e8bc9bbaaa2d5f587938.png)
15
10
 
16
- AIGNE DocSmith utilizes a chain of AI agents to generate documentation in a three-step process:
11
+ As shown in the diagram, DocSmith integrates seamlessly with other [AIGNE](https://www.aigne.io) components, leveraging the platform's AI capabilities and infrastructure.
17
12
 
18
- 1. **Structure Planning (`structure-planning`):** This agent analyzes the source code and creates a structured plan for the documentation. The plan is defined in `agents/structure-planning.yaml` and uses the prompt in `prompts/structure-planning.md`.
19
- 2. **Content Detail Generation (`content-detail-generator`):** This agent takes the structured plan and generates detailed content for each section of the documentation. This process is defined in `agents/content-detail-generator.yaml` and guided by the prompt in `prompts/document/detail-generator.md`.
20
- 3. **Translation (`translate`):** This agent translates the generated documentation into different languages. The translation agent is defined in `agents/translate.yaml` and uses the prompt in `prompts/translator.md`.
13
+ ## Features
21
14
 
22
- The main workflow is orchestrated by the `docs-generator` agent, as defined in `agents/docs-generator.yaml`.
15
+ - **Automated Structure Planning:** Intelligently analyzes your codebase to generate a comprehensive and logical document structure.
16
+ - **AI-Powered Content Generation:** Populates the document structure with detailed, high-quality content.
17
+ - **Multi-Language Support:** Seamlessly translates your documentation into 12+ languages including English, Chinese, Japanese, Korean, Spanish, French, German, Portuguese, Russian, Italian, and Arabic.
18
+ - **AIGNE Hub Integration:** Use AIGNE Hub as your LLM provider without needing your own API keys, with easy switching between different large language models.
19
+ - **Discuss Kit Publishing:** Publish documentation to the official platform at [docsmith.aigne.io](https://docsmith.aigne.io/app/) or your own independently deployed Discuss Kit instance.
20
+ - **Document Update Mechanism:** Automatically detects source code changes and updates documentation accordingly.
21
+ - **Individual Document Optimization:** Regenerate and optimize specific documents with targeted feedback.
23
22
 
24
23
  ## Getting Started
25
24
 
26
25
  ### Prerequisites
27
26
 
28
27
  - Node.js and pnpm
29
- - AIGNE Framework
28
+ - AIGNE CLI
30
29
 
31
30
  ### Installation
32
31
 
33
- 1. Clone the repository:
34
- ```bash
35
- git clone https://github.com/your-username/aigne-doc-smith.git
36
- ```
37
- 2. Install the dependencies:
38
- ```bash
39
- pnpm install
40
- ```
32
+ Install the latest version of AIGNE CLI globally:
33
+
34
+ ```bash
35
+ npm i -g @aigne/cli
36
+ ```
37
+
38
+ Verify the installation:
39
+
40
+ ```bash
41
+ aigne doc -h
42
+ ```
43
+
44
+ That's it! You can now use DocSmith directly through the AIGNE CLI.
45
+
46
+ ### LLM Configuration
47
+
48
+ DocSmith supports multiple LLM providers through AIGNE Hub:
49
+
50
+ - **AIGNE Hub (Recommended):** No API key required, easy model switching
51
+ - **Custom API Keys:** Support for OpenAI, Anthropic, and other providers
52
+
53
+ To use AIGNE Hub, simply run commands without specifying API keys:
54
+
55
+ ```bash
56
+ # Using AIGNE Hub with different models
57
+ aigne doc generate --model google:gemini-2.5-flash
58
+ aigne doc generate --model claude:claude-3-5-sonnet
59
+ aigne doc generate --model openai:gpt-4o
60
+ ```
41
61
 
42
62
  ### Usage
43
63
 
44
- To generate documentation, run the following command:
64
+ #### Generate Documentation
65
+
66
+ To generate documentation, simply run:
45
67
 
46
68
  ```bash
47
- aigne run docs-generator --datasources.source-code-path=/path/to/your/code
69
+ aigne doc generate
48
70
  ```
49
71
 
50
- This will initiate the documentation generation process, and the output will be saved in the `output` directory.
72
+ **Smart Auto-Configuration:** If you haven't run `init` before, DocSmith will automatically detect this and guide you through the interactive configuration wizard first. This includes:
73
+ - Document generation rules and style selection
74
+ - Target audience definition
75
+ - Primary and translation language settings
76
+ - Source code path configuration
77
+ - Output directory setup
51
78
 
52
- ## Contributing
79
+ **Force Regeneration:** To regenerate all documentation from scratch, use:
53
80
 
54
- Contributions are welcome! Please feel free to submit a pull request or open an issue if you have any suggestions or find any bugs.
81
+ ```bash
82
+ aigne doc generate --forceRegenerate
83
+ ```
55
84
 
56
- ## Test Commands
85
+ This will regenerate all documentation based on the latest source code and configuration.
57
86
 
58
- ```shell
87
+ #### Manual Configuration (Optional)
59
88
 
60
- # 初始化
61
- npx --no doc-smith run --entry-agent init
89
+ If you prefer to set up configuration manually or want to modify existing settings:
62
90
 
63
- # 生成命令
64
- npx --no doc-smith run --entry-agent generate --model gemini:gemini-2.5-flash
91
+ ```bash
92
+ aigne doc init
93
+ ```
65
94
 
66
- aigne run --path /Users/lban/arcblock/code/aigne-doc-smith/ --entry-agent generate --model gemini:gemini-2.5-flash --input-forceRegenerate=true
95
+ This will start the interactive configuration wizard directly.
67
96
 
68
- # 重新生成单篇
69
- npx --no doc-smith run --entry-agent update --input-doc-path bitnet-getting-started
97
+ #### Update Individual Documents
70
98
 
71
- # 结构规划优化
72
- npx --no doc-smith run --entry-agent generate --input-feedback "补充节点的 sourceIds,确保所有节点 sourceIds 都有值" --model gemini:gemini-2.5-pro
99
+ Optimize specific documents with targeted feedback:
73
100
 
101
+ ```bash
102
+ # Interactive document selection and update
103
+ aigne doc update
74
104
 
75
- # 发布文档
76
- npx --no doc-smith run --entry-agent publish
105
+ # Update a specific document
106
+ aigne doc update --doc-path /faq --feedback "Add more comprehensive FAQ entries"
107
+ ```
108
+
109
+ **Interactive Mode:** When run without parameters, `aigne doc update` will present an interactive menu for you to select which document to regenerate and provide feedback.
110
+
111
+ #### Optimize Structure Planning
77
112
 
113
+ Improve the overall documentation structure based on feedback:
78
114
 
115
+ ```bash
116
+ # Optimize structure with feedback
117
+ aigne doc generate --feedback "Remove About section and add API Reference"
118
+
119
+ # Regenerate structure with specific improvements
120
+ aigne doc generate --feedback "Add more detailed installation guide and troubleshooting section"
121
+ ```
122
+
123
+ **Structure Optimization:** Use `aigne doc generate` with `--feedback` to refine the overall documentation structure, add new sections, or reorganize existing content.
124
+
125
+ #### Publishing to Discuss Kit
126
+
127
+ Publish your documentation to Discuss Kit platforms:
128
+
129
+ ```bash
130
+ # Interactive publishing with platform selection
131
+ aigne doc publish
79
132
  ```
80
133
 
81
- 使用 `aigne doc` 运行
134
+ **Interactive Publishing:** When run `aigne doc publish` will present an interactive menu for you to choose between:
135
+ - **Official Platform:** [docsmith.aigne.io](https://docsmith.aigne.io/app/)
136
+ - **Self-Hosted Platform:** Your own deployed Discuss Kit instance
137
+
138
+
139
+
140
+ ## Supported Languages
141
+
142
+ DocSmith supports 12 languages with automatic translation:
143
+
144
+ - English (en)
145
+ - 简体中文 (zh-CN)
146
+ - 繁體中文 (zh-TW)
147
+ - 日本語 (ja)
148
+ - 한국어 (ko)
149
+ - Español (es)
150
+ - Français (fr)
151
+ - Deutsch (de)
152
+ - Português (pt-BR)
153
+ - Русский (ru)
154
+ - Italiano (it)
155
+ - العربية (ar)
156
+
157
+
158
+ ## Contributing
159
+
160
+ Contributions are welcome! Please feel free to submit a pull request or open an issue if you have any suggestions or find any bugs.
161
+
162
+ ## Command Examples
163
+
164
+ ### Basic Usage
82
165
 
83
166
  ```shell
84
- # 初始化
167
+ # Interactive setup and configuration
85
168
  aigne doc init
86
169
 
87
- # 生成文档
170
+ # Generate documentation with default settings
88
171
  aigne doc generate
89
172
 
90
- # 优化结构规划
91
- aigne doc generate --feedback "删除 About 文档"
173
+ # Generate with specific model
174
+ aigne doc generate --model google:gemini-2.5-flash
92
175
 
93
- # 优化单篇文档
94
- # 可使用 structure-plan.json 中的 path ,或 Discuss Kit 中访问的 path
95
- aigne doc update --doc-path /faq --feedback "添加更多的 FAQ"
176
+ # Force regenerate all documentation from scratch
177
+ aigne doc generate --forceRegenerate
178
+ ```
96
179
 
97
- # 发布文档
98
- aigne doc publish
180
+ ### Advanced Usage
99
181
 
100
- # 将文档作为 MCP Server
101
- aigne doc serve-mcp
182
+ ```shell
183
+ # Update structure with feedback
184
+ aigne doc generate --feedback "Remove About section and add API Reference"
102
185
 
186
+ # Update specific document
187
+ aigne doc update --doc-path /faq --feedback "Add more comprehensive FAQ entries"
103
188
  ```
104
189
 
105
- ## Testing
190
+ ### Publishing and Integration
191
+
192
+ ```shell
193
+ # Interactive publishing with platform selection
194
+ aigne doc publish
195
+
196
+ # Publish to custom Discuss Kit instance
197
+ aigne doc publish --appUrl https://your-discuss-kit-instance.com
106
198
 
107
- 运行测试来验证功能:
108
199
 
109
- ```bash
110
- # 测试 saveDocs 方法的文件清理功能
111
- node tests/test-save-docs.mjs
112
200
  ```
113
201
 
114
- 更多测试信息请查看 [tests/README.md](tests/README.md)。
202
+ ### Development Commands
203
+
204
+ ```shell
205
+ # Development and debugging commands using npx to run local code
206
+ npx --no doc-smith run --entry-agent init
207
+ npx --no doc-smith run --entry-agent generate
208
+ npx --no doc-smith run --entry-agent update
209
+ npx --no doc-smith run --entry-agent publish
210
+ ```
211
+
212
+ **Development Mode:** These commands use `npx` to run the local code version for development and debugging purposes, bypassing the globally installed CLI.
213
+
@@ -16,6 +16,7 @@ skills:
16
16
  is_approved: isApproved
17
17
  max_iterations: 3
18
18
  return_last_on_max_iterations: true
19
+ task_title: Translate '{{ title }}' to '{{ language }}'
19
20
  input_schema:
20
21
  type: object
21
22
  properties:
@@ -106,7 +106,7 @@ export default async function checkDetail(
106
106
  !sourceIdsChanged &&
107
107
  !sourceFilesChanged &&
108
108
  !contentValidationFailed &&
109
- forceRegenerate !== "true"
109
+ !forceRegenerate
110
110
  ) {
111
111
  return {
112
112
  path,
@@ -137,3 +137,5 @@ export default async function checkDetail(
137
137
  result,
138
138
  };
139
139
  }
140
+
141
+ checkDetail.taskTitle = "Check if '{{ title }}' needs regeneration";
@@ -47,7 +47,7 @@ export default async function checkStructurePlan(
47
47
  originalStructurePlan &&
48
48
  !feedback &&
49
49
  !shouldRegenerate &&
50
- forceRegenerate !== "true"
50
+ !forceRegenerate
51
51
  ) {
52
52
  return {
53
53
  structurePlan: originalStructurePlan,
@@ -70,3 +70,5 @@ export default async function checkStructurePlan(
70
70
  : JSON.parse(JSON.stringify(result.structurePlan || [])),
71
71
  };
72
72
  }
73
+
74
+ checkStructurePlan.taskTitle = "Check if structure plan needs regeneration";
@@ -17,6 +17,7 @@ skills:
17
17
  is_approved: isApproved
18
18
  max_iterations: 3
19
19
  return_last_on_max_iterations: true
20
+ task_title: Generate detail for '{{ title }}'
20
21
  - ./batch-translate.yaml
21
22
  - ./save-single-doc.mjs
22
23
  input_schema:
@@ -103,8 +103,8 @@ input_schema:
103
103
  type: string
104
104
  description: Feedback for structure planning adjustments
105
105
  forceRegenerate:
106
- type: string
107
- description: Force regenerate the documentation
106
+ type: boolean
107
+ description: Force regenerate all documentation
108
108
  # labels:
109
109
  # type: array
110
110
  # items:
@@ -167,6 +167,8 @@ async function getAccessToken(appUrl) {
167
167
  source: `AIGNE DocSmith connect to Discuss Kit`,
168
168
  closeOnSuccess: true,
169
169
  appName: "AIGNE DocSmith",
170
+ appLogo:
171
+ "https://www.aigne.io/image-bin/uploads/a7910a71364ee15a27e86f869ad59009.svg",
170
172
  openPage: (pageUrl) => open(pageUrl),
171
173
  });
172
174
 
@@ -274,7 +276,11 @@ export default async function publishDocs(
274
276
  await saveValueToConfig("boardCover", projectInfo.icon);
275
277
  }
276
278
 
277
- const { success, boardId: newBoardId } = await publishDocsFn({
279
+ const {
280
+ success,
281
+ boardId: newBoardId,
282
+ docsUrl,
283
+ } = await publishDocsFn({
278
284
  sidebarPath,
279
285
  accessToken,
280
286
  appUrl,
@@ -299,7 +305,13 @@ export default async function publishDocs(
299
305
  }
300
306
  }
301
307
 
302
- return {};
308
+ // const message = `## ✅ Documentation Published Successfully!
309
+
310
+ // Documentation is now available at: \`${docsUrl}\`
311
+ // `;
312
+ return {
313
+ // message,
314
+ };
303
315
  }
304
316
 
305
317
  publishDocs.input_schema = {
@@ -3,6 +3,7 @@ name: reflectiveStructurePlanner
3
3
  description: A team of agents that plan the structure of the documentation.
4
4
  skills:
5
5
  - structure-planning.yaml
6
+ task_title: Plan the structure of the documentation
6
7
  reflection:
7
8
  reviewer: check-structure-planning-result.yaml
8
9
  is_approved: isValid
@@ -45,7 +45,42 @@ export default async function saveDocs({
45
45
  console.error("Failed to cleanup invalid .md files:", err.message);
46
46
  }
47
47
 
48
- return {};
48
+ // const message = `## ✅ Documentation Generated Successfully!
49
+
50
+ // Successfully generated **${structurePlan.length}** documents and saved to: \`${docsDir}\`
51
+
52
+ // ### 🚀 Next Steps
53
+
54
+ // 1. Publish Documentation
55
+
56
+ // \`\`\`bash
57
+ // aigne doc publish
58
+ // \`\`\`
59
+
60
+ // Get an online preview link to share with your team
61
+
62
+ // ### 🔧 Optional Improvements
63
+
64
+ // 1. Update Specific Documents
65
+
66
+ // \`\`\`bash
67
+ // aigne doc update
68
+ // \`\`\`
69
+
70
+ // Regenerate content for specific documents
71
+
72
+ // 2. Provide Structure Feedback
73
+ // \`\`\`bash
74
+ // aigne doc generate --feedback "Your feedback on document structure"
75
+ // \`\`\`
76
+ // Improve the overall documentation structure
77
+
78
+ // ---
79
+ // `;
80
+
81
+ return {
82
+ // message,
83
+ };
49
84
  }
50
85
 
51
86
  /**
package/aigne.yaml CHANGED
@@ -1,9 +1,8 @@
1
1
  #!/usr/bin/env aigne
2
2
 
3
3
  chat_model:
4
- provider: gemini
4
+ provider: google
5
5
  name: gemini-2.5-pro
6
- # name: gemini-2.5-flash-preview-05-20
7
6
  temperature: 0.8
8
7
  agents:
9
8
  - ./agents/structure-planning.yaml
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/doc-smith",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -12,12 +12,12 @@
12
12
  "author": "Arcblock <blocklet@arcblock.io> https://github.com/blocklet",
13
13
  "license": "MIT",
14
14
  "dependencies": {
15
- "@aigne/anthropic": "^0.10.9",
16
- "@aigne/cli": "^1.30.4",
17
- "@aigne/core": "^1.45.0",
18
- "@aigne/gemini": "^0.8.13",
19
- "@aigne/openai": "^0.10.13",
20
- "@aigne/publish-docs": "^0.5.2",
15
+ "@aigne/anthropic": "^0.10.10",
16
+ "@aigne/cli": "^1.31.0",
17
+ "@aigne/core": "^1.46.0",
18
+ "@aigne/gemini": "^0.8.14",
19
+ "@aigne/openai": "^0.10.14",
20
+ "@aigne/publish-docs": "^0.5.3",
21
21
  "chalk": "^5.5.0",
22
22
  "glob": "^11.0.3",
23
23
  "open": "^10.2.0",