@aigne/doc-smith 0.2.2 → 0.2.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.
- package/CHANGELOG.md +14 -0
- package/README.md +158 -59
- package/agents/batch-translate.yaml +1 -0
- package/agents/check-detail.mjs +3 -1
- package/agents/check-structure-plan.mjs +3 -1
- package/agents/detail-generator-and-translate.yaml +1 -0
- package/agents/docs-generator.yaml +2 -2
- package/agents/publish-docs.mjs +14 -2
- package/agents/reflective-structure-planner.yaml +1 -0
- package/agents/save-docs.mjs +36 -1
- package/aigne.yaml +1 -2
- package/package.json +1 -1
- package/prompts/document/structure-planning.md +1 -0
- package/utils/utils.mjs +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.2.4](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.2.3...v0.2.4) (2025-08-07)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* polish agent output log ([40a2451](https://github.com/AIGNE-io/aigne-doc-smith/commit/40a245122ce4d8747e5b5dbe88be6986047c38ae))
|
|
9
|
+
|
|
10
|
+
## [0.2.3](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.2.2...v0.2.3) (2025-08-07)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* 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))
|
|
16
|
+
|
|
3
17
|
## [0.2.2](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.2.1...v0.2.2) (2025-08-07)
|
|
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
|
-
##
|
|
5
|
+
## AIGNE Ecosystem
|
|
6
6
|
|
|
7
|
-
|
|
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
|
-
|
|
9
|
+

|
|
15
10
|
|
|
16
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
28
|
+
- AIGNE CLI
|
|
30
29
|
|
|
31
30
|
### Installation
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
|
-
|
|
64
|
+
#### Generate Documentation
|
|
65
|
+
|
|
66
|
+
To generate documentation, simply run:
|
|
45
67
|
|
|
46
68
|
```bash
|
|
47
|
-
aigne
|
|
69
|
+
aigne doc generate
|
|
48
70
|
```
|
|
49
71
|
|
|
50
|
-
|
|
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
|
-
|
|
79
|
+
**Force Regeneration:** To regenerate all documentation from scratch, use:
|
|
53
80
|
|
|
54
|
-
|
|
81
|
+
```bash
|
|
82
|
+
aigne doc generate --forceRegenerate
|
|
83
|
+
```
|
|
55
84
|
|
|
56
|
-
|
|
85
|
+
This will regenerate all documentation based on the latest source code and configuration.
|
|
57
86
|
|
|
58
|
-
|
|
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
|
-
|
|
91
|
+
```bash
|
|
92
|
+
aigne doc init
|
|
93
|
+
```
|
|
65
94
|
|
|
66
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 --
|
|
173
|
+
# Generate with specific model
|
|
174
|
+
aigne doc generate --model google:gemini-2.5-flash
|
|
92
175
|
|
|
93
|
-
#
|
|
94
|
-
|
|
95
|
-
|
|
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
|
-
|
|
101
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
+
|
package/agents/check-detail.mjs
CHANGED
|
@@ -106,7 +106,7 @@ export default async function checkDetail(
|
|
|
106
106
|
!sourceIdsChanged &&
|
|
107
107
|
!sourceFilesChanged &&
|
|
108
108
|
!contentValidationFailed &&
|
|
109
|
-
forceRegenerate
|
|
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
|
|
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";
|
|
@@ -103,8 +103,8 @@ input_schema:
|
|
|
103
103
|
type: string
|
|
104
104
|
description: Feedback for structure planning adjustments
|
|
105
105
|
forceRegenerate:
|
|
106
|
-
type:
|
|
107
|
-
description: Force regenerate
|
|
106
|
+
type: boolean
|
|
107
|
+
description: Force regenerate all documentation
|
|
108
108
|
# labels:
|
|
109
109
|
# type: array
|
|
110
110
|
# items:
|
package/agents/publish-docs.mjs
CHANGED
|
@@ -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 {
|
|
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
|
-
|
|
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
|
package/agents/save-docs.mjs
CHANGED
|
@@ -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
|
-
|
|
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
package/package.json
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
- 结构规划要精炼,避免同一个功能被拆为了多个部分,当内容足够复杂,放在一起展示过长影响用户阅读时,考虑拆出子层级
|
|
8
8
|
- **第一层 <= 7 项**,层级 <= 3 级;同一层使用统一语义(动词时态、名词单复数)
|
|
9
9
|
- 如果当前部分是存在子文档,当前文档只展示简要的内容,引导用户到子文档中查看详细的内容
|
|
10
|
+
- 如果存在测试相关的代码,可以作为生成文档的参考,**不要为测试代码生成文档**
|
|
10
11
|
- 总是在一开始包含下列内容:
|
|
11
12
|
- Overview:简要说明产品能解决什么,产品能提供什么,产品的结构信息,让用户能快速有一个全面的认识,给出下一步的入口,引导用户阅读
|
|
12
13
|
- Getting Started:内容包含安装、最小运行示例,让用户用通过一部分文档,在很短的时间就能跑通一个最简单的示例
|
package/utils/utils.mjs
CHANGED
|
@@ -595,7 +595,12 @@ function getDirectoryContents(dirPath, searchTerm = "") {
|
|
|
595
595
|
|
|
596
596
|
for (const entry of entries) {
|
|
597
597
|
const entryName = entry.name;
|
|
598
|
-
|
|
598
|
+
|
|
599
|
+
// Preserve ./ prefix when dirPath is "./"
|
|
600
|
+
let relativePath = path.join(dirPath, entryName);
|
|
601
|
+
if (dirPath?.startsWith("./")) {
|
|
602
|
+
relativePath = `./${relativePath}`;
|
|
603
|
+
}
|
|
599
604
|
|
|
600
605
|
// Filter by search term if provided
|
|
601
606
|
if (
|