@aigne/doc-smith 0.8.6 → 0.8.8

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 (117) hide show
  1. package/.aigne/doc-smith/output/structure-plan.json +1 -5
  2. package/CHANGELOG.md +14 -0
  3. package/README.md +3 -3
  4. package/agents/{chat.yaml → chat/index.yaml} +7 -7
  5. package/agents/generate/check-document-structure.yaml +30 -0
  6. package/agents/{check-structure-plan.mjs → generate/check-need-generate-structure.mjs} +20 -20
  7. package/agents/{structure-planning.yaml → generate/generate-structure.yaml} +6 -6
  8. package/agents/{docs-generator.yaml → generate/index.yaml} +11 -12
  9. package/agents/generate/refine-document-structure.yaml +12 -0
  10. package/agents/{input-generator.mjs → init/index.mjs} +12 -5
  11. package/agents/{manage-prefs.mjs → prefs/index.mjs} +1 -1
  12. package/agents/{team-publish-docs.yaml → publish/index.yaml} +1 -2
  13. package/agents/{publish-docs.mjs → publish/publish-docs.mjs} +6 -5
  14. package/agents/schema/{structure-plan-result.yaml → document-execution-structure.yaml} +3 -3
  15. package/agents/schema/document-structure.yaml +26 -0
  16. package/agents/{language-selector.mjs → translate/choose-language.mjs} +5 -5
  17. package/agents/{retranslate.yaml → translate/index.yaml} +11 -12
  18. package/agents/{translate.yaml → translate/translate-document.yaml} +3 -2
  19. package/agents/{batch-translate.yaml → translate/translate-multilingual.yaml} +5 -5
  20. package/agents/update/batch-generate-document.yaml +19 -0
  21. package/agents/{check-detail.mjs → update/check-document.mjs} +16 -16
  22. package/agents/{detail-generator-and-translate.yaml → update/generate-and-translate-document.yaml} +23 -23
  23. package/agents/update/generate-document.yaml +50 -0
  24. package/agents/{detail-regenerator.yaml → update/index.yaml} +10 -11
  25. package/agents/{action-success.mjs → utils/action-success.mjs} +1 -1
  26. package/agents/{check-detail-result.mjs → utils/check-detail-result.mjs} +3 -3
  27. package/agents/{check-feedback-refiner.mjs → utils/check-feedback-refiner.mjs} +6 -6
  28. package/agents/{find-items-by-paths.mjs → utils/choose-docs.mjs} +25 -13
  29. package/agents/{docs-fs.yaml → utils/docs-fs-actor.yaml} +3 -1
  30. package/agents/{feedback-refiner.yaml → utils/feedback-refiner.yaml} +2 -4
  31. package/agents/{find-item-by-path.mjs → utils/find-item-by-path.mjs} +17 -11
  32. package/agents/{find-user-preferences-by-path.mjs → utils/find-user-preferences-by-path.mjs} +1 -1
  33. package/agents/utils/format-document-structure.mjs +25 -0
  34. package/agents/{load-sources.mjs → utils/load-sources.mjs} +41 -28
  35. package/agents/{save-docs.mjs → utils/save-docs.mjs} +16 -16
  36. package/agents/{save-single-doc.mjs → utils/save-single-doc.mjs} +2 -2
  37. package/agents/{transform-detail-datasources.mjs → utils/transform-detail-datasources.mjs} +1 -1
  38. package/aigne.yaml +35 -35
  39. package/docs-mcp/analyze-docs-relevance.yaml +10 -10
  40. package/docs-mcp/docs-search.yaml +5 -3
  41. package/package.json +10 -8
  42. package/prompts/{document → detail/custom}/custom-code-block.md +6 -6
  43. package/prompts/detail/custom/custom-components.md +172 -0
  44. package/prompts/{document → detail}/d2-chart/rules.md +95 -1
  45. package/prompts/{document → detail}/detail-example.md +80 -61
  46. package/prompts/{document/detail-generator.md → detail/document-rules.md} +4 -8
  47. package/prompts/{content-detail-generator.md → detail/generate-document.md} +48 -25
  48. package/prompts/{check-structure-planning-result.md → structure/check-document-structure.md} +23 -17
  49. package/prompts/{document/structure-planning.md → structure/document-rules.md} +0 -2
  50. package/prompts/{structure-planning.md → structure/generate-structure.md} +51 -30
  51. package/prompts/{document → structure}/structure-example.md +2 -2
  52. package/prompts/{document → structure}/structure-getting-started.md +2 -2
  53. package/prompts/translate/glossary.md +6 -0
  54. package/prompts/{translator.md → translate/translate-document.md} +29 -10
  55. package/prompts/{feedback-refiner.md → utils/feedback-refiner.md} +8 -8
  56. package/tests/agents/chat/chat.test.mjs +46 -0
  57. package/tests/agents/generate/check-document-structure.test.mjs +51 -0
  58. package/tests/agents/generate/check-need-generate-structure.test.mjs +292 -0
  59. package/tests/agents/generate/generate-structure.test.mjs +51 -0
  60. package/tests/{input-generator.test.mjs → agents/init/init.test.mjs} +13 -13
  61. package/tests/agents/prefs/prefs.test.mjs +431 -0
  62. package/tests/agents/publish/publish-docs.test.mjs +642 -0
  63. package/tests/agents/translate/choose-language.test.mjs +311 -0
  64. package/tests/agents/translate/translate-document.test.mjs +51 -0
  65. package/tests/agents/update/check-document.test.mjs +523 -0
  66. package/tests/agents/update/generate-document.test.mjs +51 -0
  67. package/tests/agents/utils/action-success.test.mjs +54 -0
  68. package/tests/{check-detail-result.test.mjs → agents/utils/check-detail-result.test.mjs} +98 -98
  69. package/tests/agents/utils/check-feedback-refiner.test.mjs +478 -0
  70. package/tests/agents/utils/choose-docs.test.mjs +413 -0
  71. package/tests/agents/utils/exit.test.mjs +70 -0
  72. package/tests/agents/utils/feedback-refiner.test.mjs +51 -0
  73. package/tests/agents/utils/find-item-by-path.test.mjs +517 -0
  74. package/tests/agents/utils/find-user-preferences-by-path.test.mjs +382 -0
  75. package/tests/agents/utils/format-document-structure.test.mjs +264 -0
  76. package/tests/agents/utils/fs.test.mjs +267 -0
  77. package/tests/{load-sources.test.mjs → agents/utils/load-sources.test.mjs} +153 -25
  78. package/tests/{save-docs.test.mjs → agents/utils/save-docs.test.mjs} +11 -5
  79. package/tests/agents/utils/save-output.test.mjs +315 -0
  80. package/tests/agents/utils/save-single-doc.test.mjs +364 -0
  81. package/tests/agents/utils/transform-detail-datasources.test.mjs +363 -0
  82. package/tests/utils/auth-utils.test.mjs +358 -0
  83. package/tests/utils/blocklet.test.mjs +334 -0
  84. package/tests/{conflict-resolution.test.mjs → utils/conflict-detector.test.mjs} +3 -3
  85. package/tests/utils/constants.test.mjs +295 -0
  86. package/tests/utils/d2-utils.test.mjs +423 -0
  87. package/tests/{deploy.test.mjs → utils/deploy.test.mjs} +25 -36
  88. package/tests/utils/docs-finder-utils.test.mjs +625 -0
  89. package/tests/utils/file-utils.test.mjs +213 -0
  90. package/tests/{kroki-utils.test.mjs → utils/kroki-utils.test.mjs} +2 -2
  91. package/tests/utils/load-config.test.mjs +141 -0
  92. package/tests/{mermaid-validation.test.mjs → utils/mermaid-validator.test.mjs} +2 -2
  93. package/tests/utils/mock-chat-model.mjs +12 -0
  94. package/tests/{preferences-utils.test.mjs → utils/preferences-utils.test.mjs} +1 -1
  95. package/tests/{save-value-to-config.test.mjs → utils/save-value-to-config.test.mjs} +61 -4
  96. package/tests/utils/utils.test.mjs +939 -0
  97. package/utils/conflict-detector.mjs +1 -1
  98. package/utils/constants.mjs +5 -3
  99. package/utils/d2-utils.mjs +194 -0
  100. package/utils/docs-finder-utils.mjs +26 -26
  101. package/utils/icon-map.mjs +26 -0
  102. package/{agents → utils}/load-config.mjs +2 -18
  103. package/utils/markdown-checker.mjs +5 -5
  104. package/agents/batch-docs-detail-generator.yaml +0 -19
  105. package/agents/check-structure-planning-result.yaml +0 -30
  106. package/agents/content-detail-generator.yaml +0 -50
  107. package/agents/format-structure-plan.mjs +0 -25
  108. package/agents/reflective-structure-planner.yaml +0 -12
  109. package/agents/schema/structure-plan.yaml +0 -26
  110. package/prompts/document/custom-components.md +0 -104
  111. package/tests/README.md +0 -93
  112. package/tests/utils.test.mjs +0 -2067
  113. /package/agents/{exit.mjs → utils/exit.mjs} +0 -0
  114. /package/agents/{fs.mjs → utils/fs.mjs} +0 -0
  115. /package/agents/{save-output.mjs → utils/save-output.mjs} +0 -0
  116. /package/prompts/{document → detail}/d2-chart/official-examples.md +0 -0
  117. /package/prompts/{document → detail}/jsx/rules.md +0 -0
@@ -136,11 +136,7 @@
136
136
  "description": "Understand the built-in checks DocSmith performs to ensure high-quality, well-formatted, and error-free documentation, including link checking and diagram validation.",
137
137
  "path": "/advanced/quality-assurance",
138
138
  "parentId": "/advanced",
139
- "sourceIds": [
140
- "utils/markdown-checker.mjs",
141
- "utils/mermaid-validator.mjs",
142
- "utils/kroki-utils.mjs"
143
- ]
139
+ "sourceIds": ["utils/markdown-checker.mjs", "utils/mermaid-validator.mjs", "utils/d2-utils.mjs"]
144
140
  },
145
141
  {
146
142
  "title": "Changelog",
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.8.8](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.7...v0.8.8) (2025-09-13)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * optimize the copy for inquiry feedback ([#106](https://github.com/AIGNE-io/aigne-doc-smith/issues/106)) ([d219ab8](https://github.com/AIGNE-io/aigne-doc-smith/commit/d219ab8e49fedfb2fbe1d3746e30f36751a924df))
9
+
10
+ ## [0.8.7](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.6...v0.9.0) (2025-09-12)
11
+
12
+
13
+ ### Features
14
+
15
+ * support defining API parameters with field element ([#104](https://github.com/AIGNE-io/aigne-doc-smith/issues/104)) ([2296ead](https://github.com/AIGNE-io/aigne-doc-smith/commit/2296ead15a00aaf809b3854bf349361f0213f522))
16
+
3
17
  ## [0.8.6](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.5...v0.8.6) (2025-09-11)
4
18
 
5
19
 
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  [![GitHub star chart](https://img.shields.io/github/stars/AIGNE-io/aigne-doc-smith?style=flat-square)](https://star-history.com/#AIGNE-io/aigne-doc-smith)
2
2
  [![Open Issues](https://img.shields.io/github/issues-raw/AIGNE-io/aigne-doc-smith?style=flat-square)](https://github.com/AIGNE-io/aigne-doc-smith/issues)
3
3
  [![codecov](https://codecov.io/gh/AIGNE-io/aigne-doc-smith/graph/badge.svg?token=95TQO2NKYC)](https://codecov.io/gh/AIGNE-io/aigne-doc-smith)
4
- [![NPM Version](https://img.shields.io/npm/v/@aigne/core)](https://www.npmjs.com/package/@aigne/doc-smith)
4
+ [![NPM Version](https://img.shields.io/npm/v/@aigne/doc-smith)](https://www.npmjs.com/package/@aigne/doc-smith)
5
5
 
6
6
  # AIGNE DocSmith
7
7
 
@@ -17,7 +17,7 @@ As shown in the diagram, DocSmith integrates seamlessly with other [AIGNE](https
17
17
 
18
18
  ## Features
19
19
 
20
- - **Automated Structure Planning:** Intelligently analyzes your codebase to generate a comprehensive and logical document structure.
20
+ - **Automated Generate Document Structure:** Intelligently analyzes your codebase to generate a comprehensive and logical document structure.
21
21
  - **AI-Powered Content Generation:** Populates the document structure with detailed, high-quality content.
22
22
  - **Multi-Language Support:** Seamlessly translates your documentation into 12 languages including English, Chinese, Japanese, Korean, Spanish, French, German, Portuguese, Russian, Italian, and Arabic.
23
23
  - **AIGNE Hub Integration:** Use [AIGNE Hub](https://www.aigne.io/en/hub) as your LLM provider without needing your own API keys, with easy switching between different large language models.
@@ -185,7 +185,7 @@ aigne doc update --docs overview.md --feedback "Add more comprehensive FAQ entri
185
185
 
186
186
  **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.
187
187
 
188
- #### Optimize Structure Planning
188
+ #### Optimize Document Structure
189
189
 
190
190
  Improve the overall documentation structure based on feedback:
191
191
 
@@ -21,10 +21,10 @@ instructions: |
21
21
  input_key: message
22
22
  memory: true
23
23
  skills:
24
- - ./input-generator.mjs
25
- - ./docs-generator.yaml
26
- - ./detail-regenerator.yaml
27
- - ./team-publish-docs.yaml
28
- - ./retranslate.yaml
29
- - ./docs-fs.yaml
30
- - ./exit.mjs
24
+ - ../init/index.mjs
25
+ - ../generate/index.yaml
26
+ - ../update/index.yaml
27
+ - ../publish/index.yaml
28
+ - ../translate/index.yaml
29
+ - ../utils/docs-fs-actor.yaml
30
+ - ../utils/exit.mjs
@@ -0,0 +1,30 @@
1
+ name: checkDocumentStructure
2
+ description: Check the Document Structure to ensure it meets expectations, especially in scenarios with previous generation results and user feedback.
3
+ instructions:
4
+ url: ../../prompts/structure/check-document-structure.md
5
+ input_schema:
6
+ type: object
7
+ properties:
8
+ documentStructure:
9
+ $ref: ../schema/document-structure.yaml
10
+ description: Newly generated document structure.
11
+ originalDocumentStructure:
12
+ $ref: ../schema/document-structure.yaml
13
+ description: Previous generation's document structure for comparison. If it doesn't exist, the check passes by default.
14
+ feedback:
15
+ type: string
16
+ description: User feedback provided for the previous generation's results.
17
+ required:
18
+ - documentStructure
19
+ output_schema:
20
+ type: object
21
+ properties:
22
+ isValid:
23
+ type: boolean
24
+ description: Whether the check passes. true indicates pass, false indicates failure.
25
+ structureReviewFeedback:
26
+ type: string
27
+ description: Detailed explanation of the check results. If it fails, clearly specify which parts do not meet requirements.
28
+ required:
29
+ - isValid
30
+ - structureReviewFeedback
@@ -1,25 +1,25 @@
1
1
  import { access } from "node:fs/promises";
2
2
  import { join } from "node:path";
3
- import { getActiveRulesForScope } from "../utils/preferences-utils.mjs";
3
+ import { getActiveRulesForScope } from "../../utils/preferences-utils.mjs";
4
4
  import {
5
5
  getCurrentGitHead,
6
6
  getProjectInfo,
7
7
  hasFileChangesBetweenCommits,
8
8
  loadConfigFromFile,
9
9
  saveValueToConfig,
10
- } from "../utils/utils.mjs";
10
+ } from "../../utils/utils.mjs";
11
11
 
12
- export default async function checkStructurePlan(
13
- { originalStructurePlan, feedback, lastGitHead, docsDir, forceRegenerate, ...rest },
12
+ export default async function checkNeedGenerateStructure(
13
+ { originalDocumentStructure, feedback, lastGitHead, docsDir, forceRegenerate, ...rest },
14
14
  options,
15
15
  ) {
16
- // Check if we need to regenerate structure plan
16
+ // Check if we need to regenerate document structure
17
17
  let shouldRegenerate = false;
18
18
  let finalFeedback = feedback;
19
19
  let submittedFeedback = feedback;
20
20
 
21
- // Prompt for feedback if originalStructurePlan exists and no feedback provided
22
- if (originalStructurePlan && !feedback) {
21
+ // Prompt for feedback if originalDocumentStructure exists and no feedback provided
22
+ if (originalDocumentStructure && !feedback) {
23
23
  const userFeedback = await options.prompts.input({
24
24
  message: "How can we improve the documentation structure? (press Enter to skip):",
25
25
  });
@@ -30,8 +30,8 @@ export default async function checkStructurePlan(
30
30
  }
31
31
  }
32
32
 
33
- // If no feedback and originalStructurePlan exists, check for git changes
34
- if (originalStructurePlan) {
33
+ // If no feedback and originalDocumentStructure exists, check for git changes
34
+ if (originalDocumentStructure) {
35
35
  // If no lastGitHead, check if _sidebar.md exists to determine if we should regenerate
36
36
  if (!lastGitHead) {
37
37
  try {
@@ -78,16 +78,16 @@ export default async function checkStructurePlan(
78
78
  `;
79
79
  }
80
80
 
81
- // If no regeneration needed, return original structure plan
82
- if (originalStructurePlan && !finalFeedback && !shouldRegenerate) {
81
+ // If no regeneration needed, return original document structure
82
+ if (originalDocumentStructure && !finalFeedback && !shouldRegenerate) {
83
83
  return {
84
- structurePlan: originalStructurePlan,
84
+ documentStructure: originalDocumentStructure,
85
85
  };
86
86
  }
87
87
 
88
- const panningAgent = options.context.agents["structurePlanning"];
88
+ const panningAgent = options.context.agents["refineDocumentStructure"];
89
89
 
90
- // Get user preferences for structure planning and global scope
90
+ // Get user preferences for document structure and global scope
91
91
  const structureRules = getActiveRulesForScope("structure", []);
92
92
  const globalRules = getActiveRulesForScope("global", []);
93
93
 
@@ -100,7 +100,7 @@ export default async function checkStructurePlan(
100
100
 
101
101
  const result = await options.context.invoke(panningAgent, {
102
102
  feedback: finalFeedback || "",
103
- originalStructurePlan,
103
+ originalDocumentStructure,
104
104
  userPreferences,
105
105
  ...rest,
106
106
  });
@@ -155,12 +155,12 @@ export default async function checkStructurePlan(
155
155
  return {
156
156
  ...result,
157
157
  feedback: "", // clear feedback
158
- structurePlanFeedback: submittedFeedback,
158
+ documentStructureFeedback: submittedFeedback,
159
159
  projectInfoMessage: message,
160
- originalStructurePlan: originalStructurePlan
161
- ? originalStructurePlan
162
- : JSON.parse(JSON.stringify(result.structurePlan || [])),
160
+ originalDocumentStructure: originalDocumentStructure
161
+ ? originalDocumentStructure
162
+ : JSON.parse(JSON.stringify(result.documentStructure || [])),
163
163
  };
164
164
  }
165
165
 
166
- checkStructurePlan.taskTitle = "Check if structure plan needs regeneration";
166
+ checkNeedGenerateStructure.taskTitle = "Check if document structure needs generate or update";
@@ -1,7 +1,7 @@
1
- name: structurePlanGenerator
2
- description: Plan the structure and organization of your documentation
1
+ name: generateStructure
2
+ description: Generate the structure and organization of your documentation
3
3
  instructions:
4
- url: ../prompts/structure-planning.md
4
+ url: ../../prompts/structure/generate-structure.md
5
5
  input_schema:
6
6
  type: object
7
7
  properties:
@@ -13,7 +13,7 @@ input_schema:
13
13
  description: Primary language for documentation (e.g., zh, en, ja)
14
14
  datasources:
15
15
  type: string
16
- description: Project content and context to help plan structure
16
+ description: Project content and context to help generate document structure
17
17
  targetAudience:
18
18
  type: string
19
19
  description: Target audience for the documentation
@@ -45,8 +45,8 @@ output_schema:
45
45
  projectDesc:
46
46
  type: string
47
47
  description: Brief project description generated from content analysis (under 50 words)
48
- structurePlan: ./schema/structure-plan.yaml
49
- structurePlanTree:
48
+ documentStructure: ../schema/document-structure.yaml
49
+ documentStructureTree:
50
50
  type: string
51
51
  description: |
52
52
  Visual tree structure showing documentation hierarchy with indented levels for easy review:
@@ -5,15 +5,14 @@ alias:
5
5
  - g
6
6
  description: Generate complete documentation for your project
7
7
  skills:
8
- - url: ./input-generator.mjs
8
+ - url: ../init/index.mjs
9
9
  default_input:
10
10
  skipIfExists: true
11
- - ./load-config.mjs
12
- - ./load-sources.mjs
13
- - ./check-structure-plan.mjs
14
- - url: ./save-output.mjs
11
+ - ../utils/load-sources.mjs
12
+ - ./check-need-generate-structure.mjs
13
+ - url: ../utils/save-output.mjs
15
14
  default_input:
16
- saveKey: structurePlan
15
+ saveKey: documentStructure
17
16
  savePath:
18
17
  $get: outputDir
19
18
  fileName: structure-plan.json
@@ -24,7 +23,7 @@ skills:
24
23
  $merge([
25
24
  $,
26
25
  {
27
- 'structurePlanResult': $map(structurePlan, function($item) {
26
+ 'documentExecutionStructure': $map(documentStructure, function($item) {
28
27
  $merge([
29
28
  $item,
30
29
  {
@@ -35,12 +34,12 @@ skills:
35
34
  "datasources": ""
36
35
  }
37
36
  ])
38
- - ./format-structure-plan.mjs
39
- - ./batch-docs-detail-generator.yaml
40
- - url: ./check-feedback-refiner.mjs
37
+ - ../utils/format-document-structure.mjs
38
+ - ../update/batch-generate-document.yaml
39
+ - url: ../utils/check-feedback-refiner.mjs
41
40
  default_input:
42
- stage: structure_planning
43
- - ./save-docs.mjs
41
+ stage: document_structure
42
+ - ../utils/save-docs.mjs
44
43
 
45
44
  input_schema:
46
45
  type: object
@@ -0,0 +1,12 @@
1
+ type: team
2
+ name: refineDocumentStructure
3
+ description: A team of agents that generate the structure of the documentation.
4
+ skills:
5
+ - generate-structure.yaml
6
+ task_title: Generate the structure of the documentation
7
+ task_render_mode: collapse
8
+ reflection:
9
+ reviewer: check-document-structure.yaml
10
+ is_approved: isValid
11
+ max_iterations: 3
12
+ return_last_on_max_iterations: true
@@ -2,7 +2,7 @@ import { mkdir, readFile, writeFile } from "node:fs/promises";
2
2
  import { dirname, join } from "node:path";
3
3
  import chalk from "chalk";
4
4
  import { stringify as yamlStringify } from "yaml";
5
- import { getFilteredOptions } from "../utils/conflict-detector.mjs";
5
+ import { getFilteredOptions } from "../../utils/conflict-detector.mjs";
6
6
  import {
7
7
  DEPTH_RECOMMENDATION_LOGIC,
8
8
  DOCUMENT_STYLES,
@@ -11,14 +11,15 @@ import {
11
11
  READER_KNOWLEDGE_LEVELS,
12
12
  SUPPORTED_LANGUAGES,
13
13
  TARGET_AUDIENCES,
14
- } from "../utils/constants.mjs";
14
+ } from "../../utils/constants.mjs";
15
+ import loadConfig from "../../utils/load-config.mjs";
15
16
  import {
16
17
  detectSystemLanguage,
17
18
  getAvailablePaths,
18
19
  getProjectInfo,
19
20
  isGlobPattern,
20
21
  validatePath,
21
- } from "../utils/utils.mjs";
22
+ } from "../../utils/utils.mjs";
22
23
 
23
24
  // UI constants
24
25
  const _PRESS_ENTER_TO_FINISH = "Press Enter to finish";
@@ -31,7 +32,7 @@ const _PRESS_ENTER_TO_FINISH = "Press Enter to finish";
31
32
  * @returns {Promise<Object>}
32
33
  */
33
34
  export default async function init(
34
- { outputPath = ".aigne/doc-smith", fileName = "config.yaml", skipIfExists = false },
35
+ { outputPath = ".aigne/doc-smith", fileName = "config.yaml", skipIfExists = false, appUrl },
35
36
  options,
36
37
  ) {
37
38
  if (skipIfExists) {
@@ -39,7 +40,8 @@ export default async function init(
39
40
  const configContent = await readFile(filePath, "utf8").catch(() => null);
40
41
  // Only skip if file exists AND has non-empty content
41
42
  if (configContent && configContent.trim() !== "") {
42
- return {};
43
+ // load config from file
44
+ return loadConfig({ config: filePath, appUrl });
43
45
  }
44
46
  }
45
47
 
@@ -340,6 +342,11 @@ export default async function init(
340
342
  console.log("💡 You can edit the configuration file anytime to modify settings.\n");
341
343
  console.log(`🚀 Ready to generate docs? Run: ${chalk.cyan("aigne doc generate")}\n`);
342
344
 
345
+ // load config from file
346
+ if (skipIfExists) {
347
+ return loadConfig({ config: filePath, appUrl });
348
+ }
349
+
343
350
  return {};
344
351
  } catch (error) {
345
352
  console.error(`❌ Failed to save configuration file: ${error.message}`);
@@ -1,4 +1,4 @@
1
- import { readPreferences, removeRule, writePreferences } from "../utils/preferences-utils.mjs";
1
+ import { readPreferences, removeRule, writePreferences } from "../../utils/preferences-utils.mjs";
2
2
 
3
3
  /**
4
4
  * List all user preferences with formatted display
@@ -5,10 +5,9 @@ alias:
5
5
  - p
6
6
  description: Publish your documentation online
7
7
  skills:
8
- - url: ./input-generator.mjs
8
+ - url: ../init/index.mjs
9
9
  default_input:
10
10
  skipIfExists: true
11
- - load-config.mjs
12
11
  - publish-docs.mjs
13
12
  input_schema:
14
13
  type: object
@@ -1,13 +1,14 @@
1
1
  import { basename, join } from "node:path";
2
+
2
3
  import { publishDocs as publishDocsFn } from "@aigne/publish-docs";
3
4
  import chalk from "chalk";
4
5
  import fs from "fs-extra";
5
6
 
6
- import { getAccessToken } from "../utils/auth-utils.mjs";
7
- import { DISCUSS_KIT_STORE_URL, TMP_DIR, TMP_DOCS_DIR } from "../utils/constants.mjs";
8
- import { deploy } from "../utils/deploy.mjs";
9
- import { beforePublishHook, ensureTmpDir } from "../utils/kroki-utils.mjs";
10
- import { getGithubRepoUrl, loadConfigFromFile, saveValueToConfig } from "../utils/utils.mjs";
7
+ import { getAccessToken } from "../../utils/auth-utils.mjs";
8
+ import { DISCUSS_KIT_STORE_URL, TMP_DIR, TMP_DOCS_DIR } from "../../utils/constants.mjs";
9
+ import { beforePublishHook, ensureTmpDir } from "../../utils/d2-utils.mjs";
10
+ import { deploy } from "../../utils/deploy.mjs";
11
+ import { getGithubRepoUrl, loadConfigFromFile, saveValueToConfig } from "../../utils/utils.mjs";
11
12
 
12
13
  const DEFAULT_APP_URL = "https://docsmith.aigne.io";
13
14
 
@@ -8,7 +8,7 @@ items:
8
8
  type: string
9
9
  path:
10
10
  type: string
11
- description: 路径,以 RUL 的格式返回,不能为空, 必须以 / 开头,不需要包含语言层级,比如 /zh/about 直接返回 /about
11
+ description: Path in URL format, cannot be empty, must start with /, no need to include language level, e.g., /zh/about should return /about
12
12
  parentId:
13
13
  type:
14
14
  - string
@@ -20,12 +20,12 @@ items:
20
20
  properties:
21
21
  language:
22
22
  type: string
23
- description: 语言代码,比如 zh, en, ja
23
+ description: Language code, such as zh, en, ja, etc.
24
24
  sourceIds:
25
25
  type: array
26
26
  items:
27
27
  type: string
28
- description: 关联的 dataSources 中的 sourceId,用于后续的翻译和内容生成,必须来自 datasources 中的 sourceId,不能有虚假的 id, 不能为空
28
+ description: Associated sourceId from dataSources for subsequent translation and content generation, must come from sourceId in datasources, cannot have fake ids, cannot be empty
29
29
  required:
30
30
  - title
31
31
  - description
@@ -0,0 +1,26 @@
1
+ type: array
2
+ items:
3
+ type: object
4
+ properties:
5
+ title:
6
+ type: string
7
+ description:
8
+ type: string
9
+ path:
10
+ type: string
11
+ description: Path in URL format, cannot be empty, cannot contain spaces or special characters, must start with /, no need to include language level, e.g., /zh/about should return /about
12
+ parentId:
13
+ type:
14
+ - string
15
+ - "null"
16
+ description: Parent node path, if null indicates it is a top-level node
17
+ sourceIds:
18
+ type: array
19
+ description: Associated sourceId from dataSources for subsequent translation and content generation, must come from sourceId in datasources, cannot have fake ids, **cannot be empty**
20
+ items:
21
+ type: string
22
+ required:
23
+ - title
24
+ - description
25
+ - path
26
+ - sourceIds
@@ -1,5 +1,5 @@
1
- import { SUPPORTED_LANGUAGES } from "../utils/constants.mjs";
2
- import { loadConfigFromFile, saveValueToConfig } from "../utils/utils.mjs";
1
+ import { SUPPORTED_LANGUAGES } from "../../utils/constants.mjs";
2
+ import { loadConfigFromFile, saveValueToConfig } from "../../utils/utils.mjs";
3
3
 
4
4
  /**
5
5
  * Interactive language selector for translation from configured languages
@@ -9,7 +9,7 @@ import { loadConfigFromFile, saveValueToConfig } from "../utils/utils.mjs";
9
9
  * @param {Object} options - Options object with prompts
10
10
  * @returns {Promise<Object>} Selected languages
11
11
  */
12
- export default async function languageSelector({ langs, locale, selectedDocs }, options) {
12
+ export default async function chooseLanguage({ langs, locale, selectedDocs }, options) {
13
13
  let selectedLanguages = [];
14
14
 
15
15
  // Load existing config to get current translation languages
@@ -19,7 +19,7 @@ export default async function languageSelector({ langs, locale, selectedDocs },
19
19
  // Get primary language from config or parameter
20
20
  const primaryLanguage = locale || existingConfig?.locale || "en";
21
21
 
22
- // Filter out the primary language from available choices (like input-generator.mjs)
22
+ // Filter out the primary language from available choices (like init.mjs)
23
23
  const availableTranslationLanguages = SUPPORTED_LANGUAGES.filter(
24
24
  (lang) => lang.code !== primaryLanguage,
25
25
  );
@@ -90,7 +90,7 @@ export default async function languageSelector({ langs, locale, selectedDocs },
90
90
  };
91
91
  }
92
92
 
93
- languageSelector.input_schema = {
93
+ chooseLanguage.input_schema = {
94
94
  type: "object",
95
95
  properties: {
96
96
  langs: {
@@ -2,19 +2,18 @@ type: team
2
2
  name: translate
3
3
  description: Translate documents into other languages
4
4
  skills:
5
- - url: ./input-generator.mjs
5
+ - url: ../init/index.mjs
6
6
  default_input:
7
7
  skipIfExists: true
8
- - ./load-config.mjs
9
- - ./load-sources.mjs
8
+ - ../utils/load-sources.mjs
10
9
  - type: transform
11
10
  task_render_mode: hide
12
11
  jsonata: |
13
12
  $merge([
14
13
  $,
15
14
  {
16
- 'structurePlan': originalStructurePlan,
17
- 'structurePlanResult': $map(originalStructurePlan, function($item) {
15
+ 'documentStructure': originalDocumentStructure,
16
+ 'documentExecutionStructure': $map(originalDocumentStructure, function($item) {
18
17
  $merge([
19
18
  $item,
20
19
  {
@@ -24,23 +23,23 @@ skills:
24
23
  })
25
24
  }
26
25
  ])
27
- - url: ./find-items-by-paths.mjs
26
+ - url: ../utils/choose-docs.mjs
28
27
  default_input:
29
28
  isTranslate: true
30
- - ./language-selector.mjs
29
+ - ../translate/choose-language.mjs
31
30
  - type: team
32
- name: batchDocsTranslate
31
+ name: batchTranslateDocument
33
32
  skills:
34
- - ./batch-translate.yaml
35
- - url: ./save-single-doc.mjs
33
+ - ../translate/translate-multilingual.yaml
34
+ - url: ../utils/save-single-doc.mjs
36
35
  default_input:
37
36
  isTranslate: true
38
37
  iterate_on: selectedDocs
39
38
  concurrency: 3
40
- - url: ./check-feedback-refiner.mjs
39
+ - url: ../utils/check-feedback-refiner.mjs
41
40
  default_input:
42
41
  stage: translation_refine
43
- - url: ./action-success.mjs
42
+ - url: ../utils/action-success.mjs
44
43
  default_input:
45
44
  action: "✅ Translation completed"
46
45
  input_schema:
@@ -1,7 +1,8 @@
1
- name: translateDoc
1
+ name: translateDocument
2
2
  description: Translate content to another language
3
3
  instructions:
4
- url: ../prompts/translator.md
4
+ url: ../../prompts/translate/translate-document.md
5
+ task_render_mode: collapse
5
6
  input_schema:
6
7
  type: object
7
8
  properties:
@@ -1,15 +1,15 @@
1
1
  type: team
2
- name: batchTranslate
3
- description: 批量翻译文档到多个语言
2
+ name: translateMultilingual
3
+ description: Batch translate documents to multiple languages
4
4
  skills:
5
5
  - type: team
6
6
  task_render_mode: collapse
7
7
  name: translate
8
8
  skills:
9
- - url: ./find-user-preferences-by-path.mjs
9
+ - url: ../utils/find-user-preferences-by-path.mjs
10
10
  default_input:
11
11
  scope: translation
12
- - ./translate.yaml
12
+ - ../translate/translate-document.yaml
13
13
  - type: transform
14
14
  jsonata: |
15
15
  $merge([
@@ -17,7 +17,7 @@ skills:
17
17
  { "reviewContent": translation }
18
18
  ])
19
19
  reflection:
20
- reviewer: ./check-detail-result.mjs
20
+ reviewer: ../utils/check-detail-result.mjs
21
21
  is_approved: isApproved
22
22
  max_iterations: 5
23
23
  return_last_on_max_iterations: true
@@ -0,0 +1,19 @@
1
+ type: team
2
+ name: batchGenerateDocument
3
+ description: Batch generate document details
4
+ skills:
5
+ - ./check-document.mjs
6
+ input_schema:
7
+ type: object
8
+ properties:
9
+ datasources:
10
+ type: string
11
+ description: Context for document structure generation, used to assist generate document structure
12
+ documentExecutionStructure: ../schema/document-execution-structure.yaml
13
+ modifiedFiles:
14
+ type: array
15
+ items: { type: string }
16
+ description: Array of modified files since last generation
17
+ iterate_on: documentExecutionStructure
18
+ concurrency: 3
19
+ mode: sequential