@aigne/doc-smith 0.8.12 → 0.8.13

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,21 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.8.13](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.13-beta...v0.8.13) (2025-10-16)
4
+
5
+
6
+ ### Miscellaneous Chores
7
+
8
+ * release 0.8.13 ([496e30f](https://github.com/AIGNE-io/aigne-doc-smith/commit/496e30f60d7e78602ffdc0fc070bf09ce4415fde))
9
+
10
+ ## [0.8.13-beta](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.12...v0.8.13-beta) (2025-10-16)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * add check before evaluate/publish/translate/update ([#196](https://github.com/AIGNE-io/aigne-doc-smith/issues/196)) ([3d6f40b](https://github.com/AIGNE-io/aigne-doc-smith/commit/3d6f40b77f1a50b95625db3fb561c44b940d04bd))
16
+ * **assets:** reslove missing upload of local assets causing broken images in production ([#197](https://github.com/AIGNE-io/aigne-doc-smith/issues/197)) ([423cdc1](https://github.com/AIGNE-io/aigne-doc-smith/commit/423cdc1d7b2179f80e03c520a51ecfa65aff79de))
17
+ * **ux:** optimize visible copy for improved user interaction ([#192](https://github.com/AIGNE-io/aigne-doc-smith/issues/192)) ([603e5d8](https://github.com/AIGNE-io/aigne-doc-smith/commit/603e5d8a5f94134452973972b32d48d0c09c5c5f))
18
+
3
19
  ## [0.8.12](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.12-beta.9...v0.8.12) (2025-10-16)
4
20
 
5
21
  ## [0.8.12-beta.9](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.12-beta.8...v0.8.12-beta.9) (2025-10-15)
package/README.md CHANGED
@@ -7,21 +7,21 @@
7
7
 
8
8
  # AIGNE DocSmith
9
9
 
10
- > 🚀 **AI-powered documentation generation that understands your code**
10
+ > 🚀 **AI-powered documentation that understands your code**
11
11
 
12
- AIGNE DocSmith is a powerful, AI-driven documentation generation tool built on the [AIGNE Framework](https://www.aigne.io/en/framework). It automatically analyzes your codebase and generates comprehensive, structured, and multi-language documentation that stays in sync with your code.
12
+ AIGNE DocSmith is a powerful, AI-driven documentation tool built on the [AIGNE Framework](https://www.aigne.io/en/framework). It automatically analyzes your codebase to generate comprehensive, structured, and multi-language documentation that stays in sync with your code.
13
13
 
14
14
  ## 🎯 Why DocSmith?
15
15
 
16
- - **🧠 Intelligent Analysis**: Understands your code structure, patterns, and intent
17
- - **📚 Comprehensive Coverage**: Generates complete documentation from API references to user guides
18
- - **🌍 Global Ready**: Supports 12 languages with professional translation
19
- - **🔄 Always Current**: Automatically detects changes and updates documentation
20
- - **⚡ Zero Config**: Works out of the box with smart defaults and auto-detection
16
+ - **🧠 Intelligent Analysis**: Understands your code's structure, patterns, and intent.
17
+ - **📚 Comprehensive Coverage**: Generates everything from API references to user guides.
18
+ - **🌍 Global Ready**: Supports 12 languages with professional-grade translation.
19
+ - **🔄 Always Current**: Automatically detects changes and updates documentation accordingly.
20
+ - **⚡ Zero Config**: Works out of the box with smart defaults and auto-detection.
21
21
 
22
22
  ## AIGNE Ecosystem
23
23
 
24
- DocSmith is part of the [AIGNE](https://www.aigne.io) ecosystem, a comprehensive AI application development platform. Here's the architecture overview:
24
+ DocSmith is part of the [AIGNE](https://www.aigne.io) ecosystem, a comprehensive AI application development platform.
25
25
 
26
26
  ![AIGNE Ecosystem Architecture](https://docsmith.aigne.io/image-bin/uploads/def424c20bbdb3c77483894fe0e22819.png)
27
27
 
@@ -31,35 +31,34 @@ As shown in the diagram, DocSmith integrates seamlessly with other [AIGNE](https
31
31
 
32
32
  ### 🤖 AI-Powered Generation
33
33
 
34
- - **Smart Structure Planning**: Automatically analyzes your codebase to create logical, comprehensive documentation structure
35
- - **Intelligent Content Creation**: Generates detailed, contextual content that explains both "what" and "why"
36
- - **Adaptive Writing Styles**: Supports multiple documentation styles (Technical, User-Friendly, Developer-Focused, etc.)
34
+ - **Smart Structure Planning**: Analyzes your codebase to create a logical and comprehensive documentation structure.
35
+ - **Intelligent Content Creation**: Generates detailed, contextual content that explains both the "what" and the "why."
36
+ - **Adaptive Writing Styles**: Supports multiple documentation styles, including Technical, User-Friendly, and Developer-Focused.
37
37
 
38
- ### 🌍 Multi-Language Excellence
38
+ ### 🌍 Multi-Language Support
39
39
 
40
- - **12 Language Support**: English, Chinese (Simplified & Traditional), Japanese, Korean, Spanish, French, German, Portuguese, Russian, Italian, and Arabic
41
- - **Professional Translation**: Context-aware translation that maintains technical accuracy
42
- - **Glossary Integration**: Consistent terminology across all languages
40
+ - **12 Language Support**: English, Chinese (Simplified & Traditional), Japanese, Korean, Spanish, French, German, Portuguese, Russian, Italian, and Arabic.
41
+ - **Professional Translation**: Provides context-aware translations that maintain technical accuracy.
42
+ - **Glossary Integration**: Ensures consistent terminology across all languages.
43
43
 
44
44
  ### 🔗 Seamless Integration
45
45
 
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
47
- - **Multiple LLM Support**: Bring your own API keys for OpenAI, Anthropic, Google, and other providers
48
- - **One-Click Publishing**: Make your docs live and generate shareable links for your team - publish to [docsmith.aigne.io](https://docsmith.aigne.io/app/) or your own [Discuss Kit](https://www.web3kit.rocks/discuss-kit) instance
46
+ - **AIGNE Hub Integration**: Use the [AIGNE Hub](https://www.aigne.io/en/hub) without API keys and switch between Google Gemini, OpenAI GPT, Claude, and more.
47
+ - **Multiple LLM Support**: Bring your own API keys for OpenAI, Anthropic, Google, and other providers.
48
+ - **One-Click Publishing**: Publish your docs and generate shareable links for your team. Publish to [docsmith.aigne.io](https://docsmith.aigne.io/app/) or your own [Discuss Kit](https://www.web3kit.rocks/discuss-kit) instance.
49
49
 
50
50
  ### 🔄 Smart Updates
51
51
 
52
- - **Change Detection**: Automatically identifies code changes and updates relevant documentation
53
- - **Targeted Regeneration**: Update specific sections with custom feedback and requirements
54
- - **Version Awareness**: Maintains documentation history and tracks changes over time
52
+ - **Change Detection**: Automatically identifies code changes and updates the relevant documentation.
53
+ - **Targeted Regeneration**: Updates specific sections with custom feedback and requirements.
54
+ - **Version Awareness**: Maintains a history of your documentation and tracks changes over time.
55
55
 
56
56
  ## 🚀 Quick Start
57
57
 
58
58
  ### Prerequisites
59
59
 
60
60
  - Node.js 20+ and npm/pnpm
61
- - No API keys required (uses AIGNE Hub by default)
62
-
61
+ - No API keys required (uses the AIGNE Hub by default).
63
62
 
64
63
  ### 📦 Installation
65
64
 
@@ -80,17 +79,17 @@ aigne doc --help
80
79
  Navigate to your project directory and run:
81
80
 
82
81
  ```bash
83
- # One command to rule them all
82
+ # One command to generate your documentation
84
83
  aigne doc generate
85
84
  ```
86
85
 
87
86
  DocSmith will:
88
87
 
89
- 1. 🔍 Auto-detect your project structure and tech stack
90
- 2. 🎯 Guide you through an interactive setup (first time only)
91
- 3. 📝 Generate comprehensive documentation
92
- 4. 🌍 Optionally translate to multiple languages
93
- 5. 🚀 Publish to your preferred platform
88
+ 1. 🔍 Auto-detect your project's structure and tech stack.
89
+ 2. 🎯 Guide you through an interactive setup (first time only).
90
+ 3. 📝 Generate comprehensive documentation.
91
+ 4. 🌍 Optionally translate it into multiple languages.
92
+ 5. 🚀 Publish it to your preferred platform.
94
93
 
95
94
  ## 🔧 Advanced Configuration
96
95
 
@@ -100,9 +99,9 @@ DocSmith supports multiple AI providers:
100
99
 
101
100
  **🎯 AIGNE Hub (Recommended)**
102
101
 
103
- - ✅ No API keys required
104
- - ✅ Easy model switching
105
- - ✅ Built-in rate limiting and optimization
102
+ - ✅ No API keys required.
103
+ - ✅ Easy model switching.
104
+ - ✅ Built-in rate limiting and optimization.
106
105
 
107
106
  ```bash
108
107
  # Switch models effortlessly
@@ -117,7 +116,7 @@ Configure your own API keys for direct provider access:
117
116
  - OpenAI GPT models
118
117
  - Anthropic Claude models
119
118
  - Google Gemini models
120
- - And more...
119
+ - and more...
121
120
 
122
121
  ## 📖 Usage Guide
123
122
 
@@ -129,7 +128,7 @@ Configure your own API keys for direct provider access:
129
128
  # Smart generation with auto-configuration
130
129
  aigne doc generate
131
130
 
132
- # Force complete regeneration
131
+ # Force a complete regeneration of the documentation
133
132
  aigne doc generate --forceRegenerate
134
133
 
135
134
  # Generate with custom feedback
@@ -139,7 +138,7 @@ aigne doc generate --feedback "Add more API examples and troubleshooting section
139
138
  #### 🔄 Update Existing Documents
140
139
 
141
140
  ```bash
142
- # Interactive document selection and update
141
+ # Interactively select and update a document
143
142
  aigne doc update
144
143
 
145
144
  # Update specific document with feedback
@@ -152,10 +151,10 @@ aigne doc update --docs overview.md --feedback "Add comprehensive FAQ section"
152
151
  # Interactive translation with smart language selection
153
152
  aigne doc translate
154
153
 
155
- # Translate specific documents to multiple languages
154
+ # Translate specific documents into multiple languages
156
155
  aigne doc translate --langs zh --langs ja --docs examples.md --docs overview.md
157
156
 
158
- # Translation with custom glossary for consistent terminology
157
+ # Translate with a custom glossary for consistent terminology
159
158
  aigne doc translate --glossary @path/to/glossary.md --feedback "Use technical terminology consistently"
160
159
  ```
161
160
 
@@ -165,7 +164,7 @@ aigne doc translate --glossary @path/to/glossary.md --feedback "Use technical te
165
164
  # Interactive publishing with platform selection
166
165
  aigne doc publish
167
166
 
168
- # Publish to custom Discuss Kit instance
167
+ # Publish to a custom Discuss Kit instance
169
168
  aigne doc publish --appUrl https://your-discuss-kit-instance.com
170
169
  ```
171
170
 
@@ -175,23 +174,23 @@ aigne doc publish --appUrl https://your-discuss-kit-instance.com
175
174
  # Interactive configuration setup
176
175
  aigne doc init
177
176
 
178
- # View current configuration
177
+ # View the current configuration
179
178
  aigne doc prefs
180
179
  ```
181
180
 
182
181
  ### Configuration Options
183
182
 
184
- DocSmith automatically detects your project structure, but you can customize:
183
+ DocSmith automatically detects your project's structure, but you can customize it to your needs:
185
184
 
186
185
  - **📝 Documentation Styles**: Technical, User-Friendly, Developer-Focused, Academic
187
186
  - **🎯 Target Audiences**: Developers, End Users, System Administrators, Business Users
188
- - **🌍 Languages**: Choose from 12 supported languages
189
- - **📁 Source Paths**: Customize which files and directories to analyze
190
- - **📤 Output Settings**: Configure documentation structure and formatting
187
+ - **🌍 Languages**: Choose from 12 supported languages.
188
+ - **📁 Source Paths**: Customize which files and directories to analyze.
189
+ - **📤 Output Settings**: Configure the documentation structure and formatting.
191
190
 
192
191
  ## 🌐 Supported Languages
193
192
 
194
- DocSmith provides professional translation for 12 languages:
193
+ DocSmith provides professional-grade translations for 12 languages:
195
194
 
196
195
  | Language | Code | Support Level |
197
196
  | --------- | ------- | ------------- |
@@ -214,15 +213,15 @@ We welcome contributions from the community! Here's how you can help:
214
213
 
215
214
  ### 🐛 Reporting Issues
216
215
 
217
- - 🔍 [Search existing issues](https://github.com/AIGNE-io/aigne-doc-smith/issues) first
218
- - 📝 Use our issue templates for bug reports and feature requests
219
- - 🚨 Include clear reproduction steps and environment details
216
+ - 🔍 [Search existing issues](https://github.com/AIGNE-io/aigne-doc-smith/issues) first.
217
+ - 📝 Use our issue templates for bug reports and feature requests.
218
+ - 🚨 Include clear reproduction steps and details about your environment.
220
219
 
221
220
  ### 💡 Feature Requests
222
221
 
223
- - 🌟 Share your ideas in [GitHub Discussions](https://github.com/AIGNE-io/aigne-doc-smith/discussions)
224
- - 📋 Check our [roadmap](https://github.com/AIGNE-io/aigne-doc-smith/projects) for planned features
225
- - 🗳️ Vote on existing feature requests
222
+ - 🌟 Share your ideas in [GitHub Discussions](https://github.com/AIGNE-io/aigne-doc-smith/discussions).
223
+ - 📋 Check our [roadmap](https://github.com/AIGNE-io/aigne-doc-smith/projects) for planned features.
224
+ - 🗳️ Vote on existing feature requests.
226
225
 
227
226
  ### 🔧 Development Setup
228
227
 
@@ -237,38 +236,38 @@ pnpm install
237
236
  # Run tests
238
237
  pnpm test
239
238
 
240
- # Run linting
239
+ # Run the linter
241
240
  pnpm run lint
242
241
 
243
- # Auto fix lint error
242
+ # Automatically fix lint errors
244
243
  pnpm run lint:fix
245
244
  ```
246
245
 
247
246
  ### 📜 Code of Conduct
248
247
 
249
- Please follow our community guidelines and maintain respectful, constructive communication when contributing.
248
+ Please follow our community guidelines and maintain respectful, constructive communication.
250
249
 
251
250
  ## 💼 Enterprise & Production Use
252
251
 
253
252
  ### 🏢 Enterprise Features
254
253
 
255
- - **Team Collaboration**: Multi-user workflows with role-based access
256
- - **Custom Branding**: White-label documentation with your brand identity
257
- - **API Integration**: REST APIs for automated documentation pipelines
258
- - **Analytics**: Track documentation usage and effectiveness
254
+ - **Team Collaboration**: Multi-user workflows with role-based access.
255
+ - **Custom Branding**: White-label your documentation with your brand's identity.
256
+ - **API Integration**: Use REST APIs for automated documentation pipelines.
257
+ - **Analytics**: Track documentation usage and effectiveness.
259
258
 
260
259
  ### 🔒 Security & Compliance
261
260
 
262
- - **Private Cloud**: Deploy on your own infrastructure
263
- - **SSO Integration**: Connect with your identity providers
264
- - **Audit Logs**: Complete activity tracking and compliance reporting
265
- - **Data Privacy**: Your code never leaves your environment in private deployments
261
+ - **Private Cloud**: Deploy on your own infrastructure.
262
+ - **SSO Integration**: Connect with your existing identity providers.
263
+ - **Audit Logs**: Complete activity tracking and compliance reporting.
264
+ - **Data Privacy**: Your code never leaves your environment in private deployments.
266
265
 
267
266
  ### 📞 Support & Services
268
267
 
269
- - **Priority Support**: Direct access to our engineering team
270
- - **Custom Training**: Team onboarding and best practices workshops
271
- - **Professional Services**: Custom integrations and deployment assistance
268
+ - **Priority Support**: Get direct access to our engineering team.
269
+ - **Custom Training**: We offer team onboarding and best practices workshops.
270
+ - **Professional Services**: We provide custom integrations and deployment assistance.
272
271
 
273
272
  [Contact us](https://www.aigne.io/contact) for enterprise licensing and deployment options.
274
273
 
@@ -280,25 +279,25 @@ Please follow our community guidelines and maintain respectful, constructive com
280
279
 
281
280
  ### 💬 Community Support
282
281
 
283
- - 🐦 [Twitter](https://twitter.com/arcblock_io) - Updates and announcements
284
- - 🎮 [Community](https://community.arcblock.io/discussions/boards/aigne) - Real-time community chat
282
+ - 🐦 [Twitter](https://twitter.com/arcblock_io) - For updates and announcements.
283
+ - 🎮 [Community](https://community.arcblock.io/discussions/boards/aigne) - For real-time community chat.
285
284
 
286
285
  ### 🏆 Showcase
287
286
 
288
- See DocSmith in action with real-world examples:
287
+ See DocSmith in action with these real-world examples:
289
288
 
290
- - [Docs Repository](https://docsmith.aigne.io/app) - Generated with DocSmith
289
+ - [Docs Repository](https://docsmith.aigne.io/app) - Generated with DocSmith.
291
290
 
292
291
  ## 📄 License
293
292
 
294
- This project is licensed under the **Elastic License 2.0** - see the [LICENSE](LICENSE) file for details.
293
+ This project is licensed under the **Elastic License 2.0**. See the [LICENSE](LICENSE) file for details.
295
294
 
296
295
  ### What does this mean?
297
296
 
298
- - ✅ **Free for most use cases**: Personal projects, internal use, and most commercial applications
299
- - ✅ **Open source**: Full source code available for review and contributions
300
- - ✅ **Commercial friendly**: Use in your business applications and services
301
- - ❌ **Restrictions**: Cannot offer DocSmith as a competing hosted service
297
+ - ✅ **Free for most use cases**: Including personal projects, internal use, and most commercial applications.
298
+ - ✅ **Open source**: The full source code is available for review and contributions.
299
+ - ✅ **Commercial friendly**: Use it in your business applications and services.
300
+ - ❌ **Restrictions**: You cannot offer DocSmith as a competing hosted service.
302
301
 
303
- [Learn more about Elastic License 2.0](https://www.elastic.co/licensing/elastic-license)
302
+ [Learn more about the Elastic License 2.0](https://www.elastic.co/licensing/elastic-license)
304
303
 
@@ -8,45 +8,45 @@ import {
8
8
 
9
9
  const TARGET_METADATA = {
10
10
  generatedDocs: {
11
- label: "generated documents",
11
+ label: "Generated Documents",
12
12
  description: ({ docsDir }) =>
13
- `Delete all generated documents in './${toDisplayPath(docsDir)}' (documentation structure stays).`,
13
+ `Delete all generated documents in './${toDisplayPath(docsDir)}'. The documentation structure will be preserved.`,
14
14
  agent: "clearGeneratedDocs",
15
15
  },
16
16
  documentStructure: {
17
- label: "documentation structure",
17
+ label: "Documentation Structure",
18
18
  description: ({ docsDir, workDir }) =>
19
- `Delete all generated documents in './${toDisplayPath(docsDir)}' and the documentation structure './${toDisplayPath(
19
+ `Delete all generated documents in './${toDisplayPath(docsDir)}' and the documentation structure in './${toDisplayPath(
20
20
  getStructurePlanPath(workDir),
21
- )}' .`,
21
+ )}'.`,
22
22
  agent: "clearDocumentStructure",
23
23
  },
24
24
  documentConfig: {
25
- label: "document configuration",
25
+ label: "Document Configuration",
26
26
  description: ({ workDir }) =>
27
- `Delete the configuration file './${toDisplayPath(
27
+ `Delete the configuration file in './${toDisplayPath(
28
28
  getConfigFilePath(workDir),
29
- )}' (requires 'aigne doc init' to regenerate).`,
29
+ )}'. You will need to run \`aigne doc init\` to regenerate it.`,
30
30
  agent: "clearDocumentConfig",
31
31
  },
32
32
  authTokens: {
33
- label: "authorizations",
33
+ label: "Authorizations",
34
34
  description: () =>
35
- `Delete authorization information in '${getDocSmithEnvFilePath()}' (requires re-authorization after clearing).`,
35
+ `Delete authorization information in '${getDocSmithEnvFilePath()}'. You will need to re-authorize after clearing.`,
36
36
  agent: "clearAuthTokens",
37
37
  },
38
38
  deploymentConfig: {
39
- label: "deployment config",
39
+ label: "Deployment Config",
40
40
  description: ({ workDir }) =>
41
- `Delete appUrl from './${toDisplayPath(getConfigFilePath(workDir))}'.`,
41
+ `Delete the appUrl from './${toDisplayPath(getConfigFilePath(workDir))}'.`,
42
42
  agent: "clearDeploymentConfig",
43
43
  },
44
44
  mediaDescription: {
45
- label: "media file descriptions",
45
+ label: "Media File Descriptions",
46
46
  description: () =>
47
47
  `Delete AI-generated descriptions in './${toDisplayPath(
48
48
  getMediaDescriptionCachePath(),
49
- )}' (will regenerate on next generation).`,
49
+ )}'. They will be regenerated on the next run.`,
50
50
  agent: "clearMediaDescription",
51
51
  },
52
52
  };
@@ -80,12 +80,11 @@ export default async function chooseContents(input = {}, options = {}) {
80
80
  }));
81
81
 
82
82
  selectedTargets = await options.prompts.checkbox({
83
- message: "Select items to clear:",
83
+ message: "Please select the items you'd like to clear:",
84
84
  choices,
85
- validate: (answer) => (answer.length > 0 ? true : "Please select at least one item."),
85
+ validate: (answer) => (answer.length > 0 ? true : "You must select at least one item."),
86
86
  });
87
87
  } else {
88
- // If no prompts available, show available options
89
88
  return {
90
89
  message: `Available options to clear: ${TARGET_KEYS.join(", ")}`,
91
90
  availableTargets: TARGET_KEYS,
@@ -95,7 +94,7 @@ export default async function chooseContents(input = {}, options = {}) {
95
94
 
96
95
  if (selectedTargets.length === 0) {
97
96
  return {
98
- message: "No items selected to clear.",
97
+ message: "You haven't selected any items to clear.",
99
98
  };
100
99
  }
101
100
 
@@ -103,7 +102,6 @@ export default async function chooseContents(input = {}, options = {}) {
103
102
  let hasError = false;
104
103
  let configCleared = false;
105
104
 
106
- // Process each target using its dedicated agent
107
105
  for (const target of selectedTargets) {
108
106
  const metadata = TARGET_METADATA[target];
109
107
  if (!metadata) {
@@ -116,10 +114,9 @@ export default async function chooseContents(input = {}, options = {}) {
116
114
  }
117
115
 
118
116
  try {
119
- // Get and invoke the specific agent using context
120
117
  const clearAgent = options.context?.agents?.[metadata.agent];
121
118
  if (!clearAgent) {
122
- throw new Error(`Clear agent '${metadata.agent}' not found in context`);
119
+ throw new Error(`The clear agent '${metadata.agent}' was not found.`);
123
120
  }
124
121
 
125
122
  const result = await options.context.invoke(clearAgent, rest);
@@ -139,7 +136,6 @@ export default async function chooseContents(input = {}, options = {}) {
139
136
  suggestions: result.suggestions,
140
137
  });
141
138
 
142
- // Track if document config was cleared
143
139
  if (target === "documentConfig" && result.cleared) {
144
140
  configCleared = true;
145
141
  }
@@ -153,13 +149,11 @@ export default async function chooseContents(input = {}, options = {}) {
153
149
  }
154
150
  }
155
151
 
156
- // Prepare response message
157
152
  const header = hasError
158
153
  ? "Cleanup finished with some issues."
159
154
  : "Cleanup completed successfully!";
160
155
  const detailLines = results.map((item) => `- ${item.message}`).join("\n");
161
156
 
162
- // Collect suggestions
163
157
  const suggestions = [];
164
158
  results.forEach((result) => {
165
159
  if (result.suggestions) {
@@ -167,7 +161,6 @@ export default async function chooseContents(input = {}, options = {}) {
167
161
  }
168
162
  });
169
163
 
170
- // Add default suggestion if config was cleared
171
164
  if (configCleared && !suggestions.some((s) => s.includes("aigne doc init"))) {
172
165
  suggestions.push("Run `aigne doc init` to generate a fresh configuration file.");
173
166
  }
@@ -186,7 +179,7 @@ chooseContents.input_schema = {
186
179
  properties: {
187
180
  targets: {
188
181
  type: "array",
189
- description: "Items to clear without confirmation",
182
+ description: "A list of items to clear without confirmation.",
190
183
  items: {
191
184
  type: "string",
192
185
  enum: TARGET_KEYS,
@@ -195,6 +188,6 @@ chooseContents.input_schema = {
195
188
  },
196
189
  };
197
190
 
198
- chooseContents.taskTitle = "Choose contents to clear";
191
+ chooseContents.taskTitle = "Select and clear project contents";
199
192
  chooseContents.description =
200
- "Choose contents to clear and execute the appropriate clearing operations";
193
+ "Select and clear project contents, such as generated documents, configuration, and authorization tokens.";
@@ -6,6 +6,7 @@ skills:
6
6
  default_input:
7
7
  skipIfExists: true
8
8
  checkOnly: true
9
+ - url: ../init/check.mjs
9
10
  - ../utils/load-sources.mjs
10
11
  - ../utils/format-document-structure.mjs
11
12
  - type: transform
@@ -9,7 +9,7 @@ export default async function checkNeedGenerateStructure(
9
9
  // Check if originalDocumentStructure is empty and prompt user
10
10
  if (!originalDocumentStructure) {
11
11
  const choice = await options.prompts.select({
12
- message: "Project configured successfully. Generate the documentation structure now?",
12
+ message: "Project configured. Generate documentation structure now?",
13
13
  choices: [
14
14
  {
15
15
  name: "Yes, generate now",
@@ -24,9 +24,7 @@ export default async function checkNeedGenerateStructure(
24
24
 
25
25
  if (choice === "later") {
26
26
  console.log(`\nConfiguration file: ${chalk.cyan("./.aigne/doc-smith/config.yaml")}`);
27
- console.log(
28
- "Review and edit your configuration as needed, then run 'aigne doc generate' to continue.",
29
- );
27
+ console.log("Review and edit your configuration, then run `aigne doc generate` to continue.");
30
28
 
31
29
  // In test environment, return a special result instead of exiting
32
30
  if (process.env.NODE_ENV === "test") {
@@ -40,39 +38,33 @@ export default async function checkNeedGenerateStructure(
40
38
  }
41
39
  }
42
40
 
43
- // Check if we need to regenerate documentation structure
44
41
  let finalFeedback = "";
45
42
 
46
- // user requested regeneration
43
+ // User requested regeneration
47
44
  if (forceRegenerate) {
48
45
  finalFeedback = `
49
46
  User requested forced regeneration of documentation structure. Please regenerate based on the latest Data Sources and user requirements, **allowing any modifications**.
50
47
  `;
51
48
  }
52
49
 
53
- // If no regeneration needed, return original documentation structure
54
50
  if (originalDocumentStructure && !forceRegenerate) {
55
51
  return {
56
52
  documentStructure: originalDocumentStructure,
57
53
  };
58
54
  }
59
55
 
60
- // Performance optimization:
61
- // Using both structured output and Tool with Gemini model causes redundant calls
62
- // Only use Tool when context is very large
56
+ // Performance optimization: Using both structured output and tools with the Gemini model can cause redundant calls.
57
+ // Only use tools when the context is very large.
63
58
  const generateStructureAgent = isLargeContext
64
59
  ? options.context.agents["generateStructure"]
65
60
  : options.context.agents["generateStructureWithoutTools"];
66
61
 
67
- // Get user preferences for documentation structure and global scope
68
62
  const structureRules = getActiveRulesForScope("structure", []);
69
63
  const globalRules = getActiveRulesForScope("global", []);
70
64
 
71
- // Combine structure and global rules, extract only rule text
72
65
  const allApplicableRules = [...structureRules, ...globalRules];
73
66
  const ruleTexts = allApplicableRules.map((rule) => rule.rule);
74
67
 
75
- // Convert rule texts to string format for passing to the agent
76
68
  const userPreferences = ruleTexts.length > 0 ? ruleTexts.join("\n\n") : "";
77
69
 
78
70
  const result = await options.context.invoke(generateStructureAgent, {
@@ -85,22 +77,21 @@ export default async function checkNeedGenerateStructure(
85
77
 
86
78
  let message = "";
87
79
 
88
- // Check and save project information if user hasn't modified it
80
+ // Check and save project information
89
81
  if (result.projectName || result.projectDesc) {
90
82
  try {
91
83
  const currentConfig = await loadConfigFromFile();
92
84
  const projectInfo = await getProjectInfo();
93
85
 
94
- // Check if user has modified project information
95
86
  const userModifiedProjectName =
96
87
  currentConfig?.projectName && currentConfig.projectName !== projectInfo.name;
97
88
  const userModifiedProjectDesc =
98
89
  currentConfig?.projectDesc && currentConfig.projectDesc !== projectInfo.description;
99
90
 
100
- // If user hasn't modified project info and it's not from GitHub, save AI output
91
+ // Save AI-generated project info if not modified by the user and not from GitHub
101
92
  if (!userModifiedProjectName && !userModifiedProjectDesc) {
102
93
  let hasUpdated = false;
103
- // Don't update if the current info is from GitHub (meaningful repository info)
94
+ // Don't update if the current info is from GitHub
104
95
  if (
105
96
  result.projectName &&
106
97
  result.projectName !== projectInfo.name &&
@@ -140,4 +131,5 @@ export default async function checkNeedGenerateStructure(
140
131
  };
141
132
  }
142
133
 
143
- checkNeedGenerateStructure.taskTitle = "Check if documentation structure needs generate or update";
134
+ checkNeedGenerateStructure.taskTitle =
135
+ "Check if documentation structure needs to be generated or updated";
@@ -2,7 +2,7 @@ import { getActiveRulesForScope } from "../../utils/preferences-utils.mjs";
2
2
  import { recordUpdate } from "../../utils/history-utils.mjs";
3
3
 
4
4
  function formatDocumentStructure(structure) {
5
- // Build a tree structure for better display
5
+ // Create a map of nodes for easy lookup
6
6
  const nodeMap = new Map();
7
7
  const rootNodes = [];
8
8
 
@@ -14,7 +14,7 @@ function formatDocumentStructure(structure) {
14
14
  });
15
15
  });
16
16
 
17
- // Second pass: build tree structure
17
+ // Build the tree structure
18
18
  structure.forEach((node) => {
19
19
  if (node.parentId) {
20
20
  const parent = nodeMap.get(node.parentId);
@@ -76,7 +76,7 @@ export default async function userReviewDocumentStructure({ documentStructure, .
76
76
 
77
77
  // Ask user if they want to review the documentation structure
78
78
  const needReview = await options.prompts.select({
79
- message: "Would you like to optimize the documentation structure?",
79
+ message: "Would you like to refine the documentation structure?",
80
80
  choices: [
81
81
  {
82
82
  name: "No, looks good",
@@ -156,7 +156,7 @@ export default async function userReviewDocumentStructure({ documentStructure, .
156
156
  stage: "structure",
157
157
  });
158
158
  } catch (refinerError) {
159
- console.warn("Could not save feedback as user preference:", refinerError.message);
159
+ console.warn("Could not save feedback as a user preference:", refinerError.message);
160
160
  console.warn("Your feedback was applied but not saved as a preference.");
161
161
  }
162
162
  }
@@ -0,0 +1,14 @@
1
+ import chalk from "chalk";
2
+ import { getMainLanguageFiles } from "../../utils/docs-finder-utils.mjs";
3
+
4
+ export default async function checkNeedGenerate({ docsDir, locale, documentExecutionStructure }) {
5
+ const mainLanguageFiles = await getMainLanguageFiles(docsDir, locale, documentExecutionStructure);
6
+
7
+ if (mainLanguageFiles.length === 0) {
8
+ console.log(
9
+ `No documents found in the docs directory. Please run ${chalk.yellow("`aigne doc generate`")} to generate the documents`,
10
+ );
11
+ process.exit(0);
12
+ }
13
+ return {};
14
+ }