@aigne/doc-smith 0.8.12-beta.2 → 0.8.12-beta.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.
Files changed (170) hide show
  1. package/.aigne/doc-smith/config.yaml +9 -6
  2. package/.aigne/doc-smith/output/structure-plan.json +123 -109
  3. package/.aigne/doc-smith/upload-cache.yaml +48 -0
  4. package/.github/workflows/publish-docs.yml +4 -7
  5. package/.release-please-manifest.json +1 -1
  6. package/CHANGELOG.md +20 -0
  7. package/agents/clear/choose-contents.mjs +22 -5
  8. package/agents/clear/clear-auth-tokens.mjs +2 -4
  9. package/agents/clear/clear-deployment-config.mjs +49 -0
  10. package/agents/clear/clear-document-config.mjs +2 -5
  11. package/agents/clear/clear-document-structure.mjs +2 -6
  12. package/agents/clear/clear-generated-docs.mjs +0 -1
  13. package/agents/generate/check-need-generate-structure.mjs +15 -60
  14. package/agents/generate/document-structure-tools/generate-sub-structure.mjs +131 -0
  15. package/agents/generate/generate-structure-without-tools.yaml +65 -0
  16. package/agents/generate/generate-structure.yaml +7 -1
  17. package/agents/generate/index.yaml +0 -3
  18. package/agents/generate/update-document-structure.yaml +3 -0
  19. package/agents/generate/user-review-document-structure.mjs +7 -5
  20. package/agents/init/index.mjs +15 -15
  21. package/agents/publish/publish-docs.mjs +132 -113
  22. package/agents/translate/index.yaml +1 -1
  23. package/agents/update/batch-generate-document.yaml +1 -1
  24. package/agents/update/batch-update-document.yaml +1 -1
  25. package/agents/update/check-document.mjs +3 -19
  26. package/agents/update/user-review-document.mjs +4 -3
  27. package/agents/utils/load-sources.mjs +54 -151
  28. package/agents/utils/transform-detail-datasources.mjs +14 -18
  29. package/aigne.yaml +2 -0
  30. package/biome.json +1 -1
  31. package/docs/_sidebar.md +13 -15
  32. package/docs/configuration-initial-setup.ja.md +179 -0
  33. package/docs/configuration-initial-setup.md +179 -0
  34. package/docs/configuration-initial-setup.zh-TW.md +179 -0
  35. package/docs/configuration-initial-setup.zh.md +179 -0
  36. package/docs/configuration-managing-preferences.ja.md +100 -0
  37. package/docs/configuration-managing-preferences.md +100 -0
  38. package/docs/configuration-managing-preferences.zh-TW.md +100 -0
  39. package/docs/configuration-managing-preferences.zh.md +100 -0
  40. package/docs/configuration.ja.md +68 -184
  41. package/docs/configuration.md +62 -178
  42. package/docs/configuration.zh-TW.md +70 -186
  43. package/docs/configuration.zh.md +67 -183
  44. package/docs/getting-started.ja.md +46 -78
  45. package/docs/getting-started.md +46 -78
  46. package/docs/getting-started.zh-TW.md +47 -79
  47. package/docs/getting-started.zh.md +47 -79
  48. package/docs/guides-cleaning-up.ja.md +50 -0
  49. package/docs/guides-cleaning-up.md +50 -0
  50. package/docs/guides-cleaning-up.zh-TW.md +50 -0
  51. package/docs/guides-cleaning-up.zh.md +50 -0
  52. package/docs/guides-evaluating-documents.ja.md +66 -0
  53. package/docs/guides-evaluating-documents.md +66 -0
  54. package/docs/guides-evaluating-documents.zh-TW.md +66 -0
  55. package/docs/guides-evaluating-documents.zh.md +66 -0
  56. package/docs/guides-generating-documentation.ja.md +149 -0
  57. package/docs/guides-generating-documentation.md +149 -0
  58. package/docs/guides-generating-documentation.zh-TW.md +149 -0
  59. package/docs/guides-generating-documentation.zh.md +149 -0
  60. package/docs/guides-interactive-chat.ja.md +85 -0
  61. package/docs/guides-interactive-chat.md +85 -0
  62. package/docs/guides-interactive-chat.zh-TW.md +85 -0
  63. package/docs/guides-interactive-chat.zh.md +85 -0
  64. package/docs/guides-managing-history.ja.md +51 -0
  65. package/docs/guides-managing-history.md +51 -0
  66. package/docs/guides-managing-history.zh-TW.md +51 -0
  67. package/docs/guides-managing-history.zh.md +51 -0
  68. package/docs/guides-publishing-your-docs.ja.md +78 -0
  69. package/docs/guides-publishing-your-docs.md +78 -0
  70. package/docs/guides-publishing-your-docs.zh-TW.md +78 -0
  71. package/docs/guides-publishing-your-docs.zh.md +78 -0
  72. package/docs/guides-translating-documentation.ja.md +95 -0
  73. package/docs/guides-translating-documentation.md +95 -0
  74. package/docs/guides-translating-documentation.zh-TW.md +95 -0
  75. package/docs/guides-translating-documentation.zh.md +95 -0
  76. package/docs/guides-updating-documentation.ja.md +77 -0
  77. package/docs/guides-updating-documentation.md +77 -0
  78. package/docs/guides-updating-documentation.zh-TW.md +77 -0
  79. package/docs/guides-updating-documentation.zh.md +77 -0
  80. package/docs/guides.ja.md +32 -0
  81. package/docs/guides.md +32 -0
  82. package/docs/guides.zh-TW.md +32 -0
  83. package/docs/guides.zh.md +32 -0
  84. package/docs/overview.ja.md +39 -60
  85. package/docs/overview.md +39 -60
  86. package/docs/overview.zh-TW.md +39 -60
  87. package/docs/overview.zh.md +39 -60
  88. package/docs/release-notes.ja.md +255 -0
  89. package/docs/release-notes.md +255 -0
  90. package/docs/release-notes.zh-TW.md +255 -0
  91. package/docs/release-notes.zh.md +255 -0
  92. package/package.json +4 -2
  93. package/prompts/common/document/content-rules-core.md +1 -0
  94. package/prompts/common/document-structure/document-structure-rules.md +8 -9
  95. package/prompts/common/document-structure/output-constraints.md +1 -1
  96. package/prompts/structure/document-rules.md +8 -2
  97. package/prompts/structure/generate/system-prompt.md +27 -2
  98. package/prompts/structure/generate/user-prompt.md +18 -0
  99. package/prompts/structure/update/system-prompt.md +12 -0
  100. package/prompts/structure/update/user-prompt.md +3 -0
  101. package/tests/agents/clear/choose-contents.test.mjs +8 -4
  102. package/tests/agents/generate/check-need-generate-structure.test.mjs +53 -63
  103. package/tests/agents/generate/document-structure-tools/generate-sub-structure.test.mjs +277 -0
  104. package/tests/agents/init/init.test.mjs +18 -18
  105. package/tests/agents/publish/publish-docs.test.mjs +79 -0
  106. package/tests/agents/update/check-document.test.mjs +7 -67
  107. package/tests/agents/utils/load-sources.test.mjs +90 -90
  108. package/tests/agents/utils/transform-detail-datasources.test.mjs +153 -196
  109. package/tests/utils/file-utils.test.mjs +309 -1
  110. package/utils/auth-utils.mjs +12 -5
  111. package/utils/constants/index.mjs +5 -2
  112. package/utils/deploy.mjs +2 -2
  113. package/utils/file-utils.mjs +315 -0
  114. package/utils/utils.mjs +89 -50
  115. package/docs/advanced-how-it-works.ja.md +0 -101
  116. package/docs/advanced-how-it-works.md +0 -101
  117. package/docs/advanced-how-it-works.zh-TW.md +0 -101
  118. package/docs/advanced-how-it-works.zh.md +0 -101
  119. package/docs/advanced-quality-assurance.ja.md +0 -92
  120. package/docs/advanced-quality-assurance.md +0 -92
  121. package/docs/advanced-quality-assurance.zh-TW.md +0 -92
  122. package/docs/advanced-quality-assurance.zh.md +0 -92
  123. package/docs/advanced.ja.md +0 -20
  124. package/docs/advanced.md +0 -20
  125. package/docs/advanced.zh-TW.md +0 -20
  126. package/docs/advanced.zh.md +0 -20
  127. package/docs/changelog.ja.md +0 -486
  128. package/docs/changelog.md +0 -486
  129. package/docs/changelog.zh-TW.md +0 -486
  130. package/docs/changelog.zh.md +0 -486
  131. package/docs/cli-reference.ja.md +0 -311
  132. package/docs/cli-reference.md +0 -311
  133. package/docs/cli-reference.zh-TW.md +0 -311
  134. package/docs/cli-reference.zh.md +0 -311
  135. package/docs/configuration-interactive-setup.ja.md +0 -138
  136. package/docs/configuration-interactive-setup.md +0 -138
  137. package/docs/configuration-interactive-setup.zh-TW.md +0 -138
  138. package/docs/configuration-interactive-setup.zh.md +0 -138
  139. package/docs/configuration-language-support.ja.md +0 -64
  140. package/docs/configuration-language-support.md +0 -64
  141. package/docs/configuration-language-support.zh-TW.md +0 -64
  142. package/docs/configuration-language-support.zh.md +0 -64
  143. package/docs/configuration-llm-setup.ja.md +0 -56
  144. package/docs/configuration-llm-setup.md +0 -56
  145. package/docs/configuration-llm-setup.zh-TW.md +0 -56
  146. package/docs/configuration-llm-setup.zh.md +0 -56
  147. package/docs/configuration-preferences.ja.md +0 -144
  148. package/docs/configuration-preferences.md +0 -144
  149. package/docs/configuration-preferences.zh-TW.md +0 -144
  150. package/docs/configuration-preferences.zh.md +0 -144
  151. package/docs/features-generate-documentation.ja.md +0 -95
  152. package/docs/features-generate-documentation.md +0 -95
  153. package/docs/features-generate-documentation.zh-TW.md +0 -95
  154. package/docs/features-generate-documentation.zh.md +0 -95
  155. package/docs/features-publish-your-docs.ja.md +0 -130
  156. package/docs/features-publish-your-docs.md +0 -130
  157. package/docs/features-publish-your-docs.zh-TW.md +0 -130
  158. package/docs/features-publish-your-docs.zh.md +0 -130
  159. package/docs/features-translate-documentation.ja.md +0 -90
  160. package/docs/features-translate-documentation.md +0 -90
  161. package/docs/features-translate-documentation.zh-TW.md +0 -90
  162. package/docs/features-translate-documentation.zh.md +0 -90
  163. package/docs/features-update-and-refine.ja.md +0 -142
  164. package/docs/features-update-and-refine.md +0 -142
  165. package/docs/features-update-and-refine.zh-TW.md +0 -143
  166. package/docs/features-update-and-refine.zh.md +0 -142
  167. package/docs/features.ja.md +0 -62
  168. package/docs/features.md +0 -62
  169. package/docs/features.zh-TW.md +0 -62
  170. package/docs/features.zh.md +0 -62
@@ -1,31 +1,22 @@
1
- import { access } from "node:fs/promises";
2
- import { join } from "node:path";
3
1
  import chalk from "chalk";
4
2
  import { getActiveRulesForScope } from "../../utils/preferences-utils.mjs";
5
- import {
6
- getCurrentGitHead,
7
- getProjectInfo,
8
- hasFileChangesBetweenCommits,
9
- loadConfigFromFile,
10
- saveValueToConfig,
11
- } from "../../utils/utils.mjs";
3
+ import { getProjectInfo, loadConfigFromFile, saveValueToConfig } from "../../utils/utils.mjs";
12
4
 
13
5
  export default async function checkNeedGenerateStructure(
14
- { originalDocumentStructure, feedback, lastGitHead, docsDir, forceRegenerate, ...rest },
6
+ { originalDocumentStructure, forceRegenerate, isLargeContext, ...rest },
15
7
  options,
16
8
  ) {
17
9
  // Check if originalDocumentStructure is empty and prompt user
18
10
  if (!originalDocumentStructure) {
19
11
  const choice = await options.prompts.select({
20
- message:
21
- "Your project configuration is complete. Would you like to generate the documentation structure now?",
12
+ message: "Project configured successfully. Generate the documentation structure now?",
22
13
  choices: [
23
14
  {
24
- name: "Generate now - Start generating the documentation structure",
15
+ name: "Yes, generate now",
25
16
  value: "generate",
26
17
  },
27
18
  {
28
- name: "Review configuration first - Edit configuration before generating",
19
+ name: "No, review configuration first",
29
20
  value: "later",
30
21
  },
31
22
  ],
@@ -50,65 +41,28 @@ export default async function checkNeedGenerateStructure(
50
41
  }
51
42
 
52
43
  // Check if we need to regenerate documentation structure
53
- let shouldRegenerate = false;
54
- let finalFeedback = feedback;
55
-
56
- // If no feedback and originalDocumentStructure exists, check for git changes
57
- if (originalDocumentStructure) {
58
- // If no lastGitHead, check if _sidebar.md exists to determine if we should regenerate
59
- if (!lastGitHead) {
60
- try {
61
- // Check if _sidebar.md exists in docsDir
62
- const sidebarPath = join(docsDir, "_sidebar.md");
63
- await access(sidebarPath);
64
- // If _sidebar.md exists, it means last execution was completed, need to regenerate
65
- shouldRegenerate = true;
66
- } catch {
67
- // If _sidebar.md doesn't exist, it means last execution was interrupted, no need to regenerate
68
- shouldRegenerate = false;
69
- }
70
- } else {
71
- // Check if there are relevant file changes since last generation
72
- const currentGitHead = getCurrentGitHead();
73
- if (currentGitHead && currentGitHead !== lastGitHead) {
74
- const hasChanges = hasFileChangesBetweenCommits(lastGitHead, currentGitHead);
75
- if (hasChanges) {
76
- shouldRegenerate = true;
77
- }
78
- }
79
- }
80
-
81
- if (shouldRegenerate) {
82
- finalFeedback = `
83
- ${finalFeedback || ""}
84
-
85
- Update documentation structure based on the latest DataSources:
86
- 1. For new content, add new sections as needed or supplement existing section displays
87
- 2. Be cautious when deleting sections, unless all associated sourceIds have been removed
88
- 3. Do not modify the path of existing sections
89
- 4. Update section sourceIds as needed based on the latest Data Sources
90
- `;
91
- }
92
- }
44
+ let finalFeedback = "";
93
45
 
94
46
  // user requested regeneration
95
47
  if (forceRegenerate) {
96
- shouldRegenerate = true;
97
48
  finalFeedback = `
98
- ${finalFeedback || ""}
99
-
100
49
  User requested forced regeneration of documentation structure. Please regenerate based on the latest Data Sources and user requirements, **allowing any modifications**.
101
50
  `;
102
51
  }
103
52
 
104
53
  // If no regeneration needed, return original documentation structure
105
- if (originalDocumentStructure && !finalFeedback && !shouldRegenerate) {
54
+ if (originalDocumentStructure && !forceRegenerate) {
106
55
  return {
107
56
  documentStructure: originalDocumentStructure,
108
57
  };
109
58
  }
110
59
 
111
- const planningAgent = options.context.agents["refineDocumentStructure"];
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
63
+ const generateStructureAgent = isLargeContext
64
+ ? options.context.agents["generateStructure"]
65
+ : options.context.agents["generateStructureWithoutTools"];
112
66
 
113
67
  // Get user preferences for documentation structure and global scope
114
68
  const structureRules = getActiveRulesForScope("structure", []);
@@ -121,11 +75,12 @@ export default async function checkNeedGenerateStructure(
121
75
  // Convert rule texts to string format for passing to the agent
122
76
  const userPreferences = ruleTexts.length > 0 ? ruleTexts.join("\n\n") : "";
123
77
 
124
- const result = await options.context.invoke(planningAgent, {
78
+ const result = await options.context.invoke(generateStructureAgent, {
125
79
  ...rest,
126
80
  originalDocumentStructure,
127
81
  userPreferences,
128
82
  feedback: finalFeedback || "",
83
+ isLargeContext,
129
84
  });
130
85
 
131
86
  let message = "";
@@ -0,0 +1,131 @@
1
+ import {
2
+ buildSourcesContent,
3
+ calculateFileStats,
4
+ loadFilesFromPaths,
5
+ readFileContents,
6
+ } from "../../../utils/file-utils.mjs";
7
+ import {
8
+ INTELLIGENT_SUGGESTION_TOKEN_THRESHOLD,
9
+ DEFAULT_EXCLUDE_PATTERNS,
10
+ DEFAULT_INCLUDE_PATTERNS,
11
+ } from "../../../utils/constants/index.mjs";
12
+ import { toRelativePath } from "../../../utils/utils.mjs";
13
+
14
+ export default async function generateSubStructure(
15
+ {
16
+ parentDocument,
17
+ subSourcePaths,
18
+ includePatterns,
19
+ excludePatterns,
20
+ useDefaultPatterns = true,
21
+ ...rest
22
+ },
23
+ options,
24
+ ) {
25
+ const sourcePaths = subSourcePaths?.map((item) => item.path);
26
+ if (!sourcePaths || sourcePaths.length === 0) {
27
+ return {
28
+ subStructure: [],
29
+ };
30
+ }
31
+
32
+ let files = await loadFilesFromPaths(sourcePaths, {
33
+ includePatterns,
34
+ excludePatterns,
35
+ useDefaultPatterns,
36
+ defaultIncludePatterns: DEFAULT_INCLUDE_PATTERNS,
37
+ defaultExcludePatterns: DEFAULT_EXCLUDE_PATTERNS,
38
+ });
39
+ files = [...new Set(files)];
40
+
41
+ // all files path
42
+ const allFilesPaths = files.map((file) => `- ${toRelativePath(file)}`).join("\n");
43
+
44
+ // Read all source files using the utility function
45
+ const sourceFiles = await readFileContents(files, process.cwd());
46
+
47
+ // Count tokens and lines using utility function
48
+ const { totalTokens } = calculateFileStats(sourceFiles);
49
+
50
+ // check if totalTokens is too large
51
+ let isLargeContext = false;
52
+ if (totalTokens > INTELLIGENT_SUGGESTION_TOKEN_THRESHOLD) {
53
+ isLargeContext = true;
54
+ }
55
+
56
+ // Build allSources string using utility function
57
+ const allSources = buildSourcesContent(sourceFiles, isLargeContext);
58
+
59
+ // Performance optimization:
60
+ // Using both structured output and Tool with Gemini model causes redundant calls
61
+ // Only use Tool when context is very large
62
+ const generateStructureAgent = isLargeContext
63
+ ? options.context.agents["generateStructure"]
64
+ : options.context.agents["generateStructureWithoutTools"];
65
+ const result = await options.context.invoke(generateStructureAgent, {
66
+ ...rest,
67
+ isSubStructure: true,
68
+ parentDocument,
69
+ datasources: allSources,
70
+ allFilesPaths,
71
+ isLargeContext,
72
+ files,
73
+ totalTokens,
74
+ });
75
+
76
+ return {
77
+ subStructure: result.documentStructure || [],
78
+ message: `Generated a sub structure for '${parentDocument.path}' successfully. Please merge all sub-structures to output the complete document structure.`,
79
+ };
80
+ }
81
+
82
+ generateSubStructure.description = `
83
+ Generates a sub-structure.
84
+ Handles large file sets by splitting them into smaller sub-document structures when the context size exceeds limits. This approach ensures more focused and complete documentation generation.
85
+ `;
86
+
87
+ generateSubStructure.inputSchema = {
88
+ type: "object",
89
+ properties: {
90
+ parentDocument: {
91
+ type: "object",
92
+ description: "The parent node to generate a sub structure for",
93
+ properties: {
94
+ title: { type: "string", description: "The title of the parent node" },
95
+ description: { type: "string", description: "The description of the parent node" },
96
+ path: {
97
+ type: "string",
98
+ description:
99
+ "The path of the parent node, 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 ",
100
+ },
101
+ parentId: { type: "string", description: "The parent ID of the parent node" },
102
+ sourceIds: { type: "array", description: "The source IDs of the parent node" },
103
+ },
104
+ },
105
+ subSourcePaths: {
106
+ type: "array",
107
+ description: "The source paths of the sub structure",
108
+ items: {
109
+ type: "object",
110
+ properties: {
111
+ path: { type: "string", description: "The source path of the sub structure" },
112
+ reason: { type: "string", description: "The reason for selecting the source path" },
113
+ },
114
+ required: ["path", "reason"],
115
+ },
116
+ },
117
+ },
118
+ };
119
+
120
+ generateSubStructure.outputSchema = {
121
+ type: "object",
122
+ properties: {
123
+ subStructure: {
124
+ type: "array",
125
+ description:
126
+ "The sub structure of the parent node, need merge all sub-structures and output the complete document structure.",
127
+ },
128
+ message: { type: "string", description: "The message of the sub structure" },
129
+ },
130
+ required: ["subStructure"],
131
+ };
@@ -0,0 +1,65 @@
1
+ name: generateStructureWithoutTools
2
+ description: Generate the structure and organization of your documentation
3
+ instructions:
4
+ - role: system
5
+ url: ../../prompts/structure/generate/system-prompt.md
6
+ - role: user
7
+ url: ../../prompts/structure/generate/user-prompt.md
8
+ task_render_mode: collapse
9
+ task_title: Generate the structure of the documentation
10
+ input_schema:
11
+ type: object
12
+ properties:
13
+ rules:
14
+ type: string
15
+ description: Your specific requirements for documentation structure
16
+ locale:
17
+ type: string
18
+ description: Primary language for documentation (e.g., zh, en, ja)
19
+ datasources:
20
+ type: string
21
+ description: Project content and context to help generate documentation structure
22
+ targetAudience:
23
+ type: string
24
+ description: Target audience for the documentation
25
+ nodeName:
26
+ type: string
27
+ description: Specific section or page name to focus on
28
+ glossary:
29
+ type: string
30
+ description: Glossary for consistent terminology
31
+ feedback:
32
+ type: string
33
+ description: Tell us how to improve the documentation structure
34
+ userPreferences:
35
+ type: string
36
+ description: Your saved preferences for structure and documentation style
37
+ docsType:
38
+ type: string
39
+ description: "Documentation type (options: general, getting-started, reference, faq)"
40
+ default: general
41
+ required:
42
+ - rules
43
+ - datasources
44
+ output_schema:
45
+ type: object
46
+ properties:
47
+ projectName:
48
+ type: string
49
+ description: Project name identified from your content sources
50
+ projectDesc:
51
+ type: string
52
+ description: Brief project description generated from content analysis (under 50 words)
53
+ documentStructure: ../schema/document-structure.yaml
54
+ documentStructureTree:
55
+ type: string
56
+ description: |
57
+ Visual tree structure showing documentation hierarchy with indented levels for easy review:
58
+ ```
59
+ - Home
60
+ - Getting Started
61
+ - Installation
62
+ - Requirements
63
+ ```
64
+ required:
65
+ - documentStructure
@@ -5,7 +5,11 @@ instructions:
5
5
  url: ../../prompts/structure/generate/system-prompt.md
6
6
  - role: user
7
7
  url: ../../prompts/structure/generate/user-prompt.md
8
-
8
+ skills:
9
+ - ./document-structure-tools/generate-sub-structure.mjs
10
+ task_render_mode: collapse
11
+ task_title: Generate the structure of the documentation
12
+ tool_calls_concurrency: 5
9
13
  input_schema:
10
14
  type: object
11
15
  properties:
@@ -60,3 +64,5 @@ output_schema:
60
64
  - Installation
61
65
  - Requirements
62
66
  ```
67
+ required:
68
+ - documentStructure
@@ -54,9 +54,6 @@ input_schema:
54
54
  glossary:
55
55
  type: string
56
56
  description: Glossary file for consistent terminology (use @filename.md)
57
- feedback:
58
- type: string
59
- description: Tell us how to improve the documentation structure
60
57
  forceRegenerate:
61
58
  type: boolean
62
59
  description: Rebuild all documentation from scratch
@@ -37,3 +37,6 @@ skills:
37
37
  - ./document-structure-tools/delete-document.mjs
38
38
  - ./document-structure-tools/update-document.mjs
39
39
  - ./document-structure-tools/move-document.mjs
40
+ - ../update/fs-tools/glob.mjs
41
+ - ../update/fs-tools/grep.mjs
42
+ - ../update/fs-tools/read-file.mjs
@@ -76,15 +76,14 @@ 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:
80
- "Would you like to optimize the documentation structure?\n You can edit titles, reorganize sections.",
79
+ message: "Would you like to optimize the documentation structure?",
81
80
  choices: [
82
81
  {
83
- name: "Looks good - proceed with current structure",
82
+ name: "No, looks good",
84
83
  value: "no",
85
84
  },
86
85
  {
87
- name: "Yes, optimize the structure",
86
+ name: "Yes, optimize the structure (e.g. rename 'Getting Started' to 'Quick Start', move 'API Reference' before 'Configuration')",
88
87
  value: "yes",
89
88
  },
90
89
  ],
@@ -108,7 +107,10 @@ export default async function userReviewDocumentStructure({ documentStructure, .
108
107
  const feedback = await options.prompts.input({
109
108
  message:
110
109
  "How would you like to improve the structure?\n" +
111
- " • Rename, reorganize, add, or remove sections\n\n" +
110
+ "Examples:\n" +
111
+ " • Add a new document 'Troubleshooting'\n" +
112
+ " • Remove the 'Legacy Features' document\n" +
113
+ " • Move 'Installation' to the top of the structure\n\n" +
112
114
  " Press Enter to finish reviewing:",
113
115
  });
114
116
 
@@ -143,15 +143,7 @@ export default async function init(
143
143
  // Save target audience choices as keys
144
144
  input.targetAudienceTypes = audienceChoices;
145
145
 
146
- // 3. Custom rules - any specific requirements for the documentation?
147
- const rulesInput = await options.prompts.input({
148
- message:
149
- "📋 [3/9]: Any custom rules or requirements for your documentation? (Optional, press Enter to skip)",
150
- default: "",
151
- });
152
- input.rules = rulesInput.trim();
153
-
154
- // 4. Reader knowledge level - what do readers typically know when they arrive?
146
+ // 3. Reader knowledge level - what do readers typically know when they arrive?
155
147
  // Determine default based on selected purposes using mapping
156
148
  const mappedPurpose = prioritizedPurposes.find(
157
149
  (purpose) => PURPOSE_TO_KNOWLEDGE_MAPPING[purpose],
@@ -166,7 +158,7 @@ export default async function init(
166
158
  );
167
159
 
168
160
  const knowledgeChoice = await options.prompts.select({
169
- message: "🧠 [4/9]: How much do readers already know about your project?",
161
+ message: "🧠 [3/9]: How much do readers already know about your project?",
170
162
  choices: Object.entries(filteredKnowledgeOptions).map(([key, level]) => ({
171
163
  name: `${level.name}`,
172
164
  description: level.description,
@@ -211,7 +203,7 @@ export default async function init(
211
203
  );
212
204
 
213
205
  const depthChoice = await options.prompts.select({
214
- message: "📊 [5/9]: How detailed should your documentation be?",
206
+ message: "📊 [4/9]: How detailed should your documentation be?",
215
207
  choices: Object.entries(filteredDepthOptions).map(([key, depth]) => ({
216
208
  name: `${depth.name}`,
217
209
  description: depth.description,
@@ -229,7 +221,7 @@ export default async function init(
229
221
 
230
222
  // Let user select primary language from supported list
231
223
  const primaryLanguageChoice = await options.prompts.select({
232
- message: "🌐 [6/9]: What's your main documentation language?",
224
+ message: "🌐 [5/9]: What's your main documentation language?",
233
225
  choices: SUPPORTED_LANGUAGES.map((lang) => ({
234
226
  name: `${lang.label} - ${lang.sample}`,
235
227
  value: lang.code,
@@ -246,7 +238,7 @@ export default async function init(
246
238
  );
247
239
 
248
240
  const translateLanguageChoices = await options.prompts.checkbox({
249
- message: "🔄 [7/9]: Which languages should we translate to?",
241
+ message: "🔄 [6/9]: Which languages should we translate to?",
250
242
  choices: availableTranslationLanguages.map((lang) => ({
251
243
  name: `${lang.label} - ${lang.sample}`,
252
244
  value: lang.code,
@@ -257,13 +249,13 @@ export default async function init(
257
249
 
258
250
  // 7. Documentation directory
259
251
  const docsDirInput = await options.prompts.input({
260
- message: `📁 [8/9]: Where should we save your documentation?`,
252
+ message: `📁 [7/9]: Where should we save your documentation?`,
261
253
  default: `${outputPath}/docs`,
262
254
  });
263
255
  input.docsDir = docsDirInput.trim() || `${outputPath}/docs`;
264
256
 
265
257
  // 8. Content sources
266
- console.log("\n🔍 [9/9]: Content Sources");
258
+ console.log("\n🔍 [8/9]: Content Sources");
267
259
  console.log(
268
260
  "What folders/files should we analyze for documentation? (e.g., ./src, ./docs, ./README.md)",
269
261
  );
@@ -347,6 +339,14 @@ export default async function init(
347
339
  // If no paths entered, use default
348
340
  input.sourcesPath = sourcePaths.length > 0 ? sourcePaths : ["./"];
349
341
 
342
+ // 9. Custom rules - any specific requirements for the documentation?
343
+ const rulesInput = await options.prompts.input({
344
+ message:
345
+ "📋 [9/9]: Any custom rules or requirements for your documentation? (Optional, press Enter to skip)",
346
+ default: "",
347
+ });
348
+ input.rules = rulesInput.trim();
349
+
350
350
  // Save project info to config
351
351
  const projectInfo = await getProjectInfo();
352
352
  input.projectName = projectInfo.name;