@aigne/doc-smith 0.8.10 → 0.8.11-beta.1

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 (260) hide show
  1. package/.aigne/doc-smith/config.yaml +2 -0
  2. package/.aigne/doc-smith/output/structure-plan.json +3 -3
  3. package/.aigne/doc-smith/upload-cache.yaml +252 -0
  4. package/.github/workflows/create-release-pr.yaml +21 -0
  5. package/.github/workflows/publish-docs.yml +67 -0
  6. package/.github/workflows/release.yml +3 -7
  7. package/.release-please-manifest.json +1 -1
  8. package/CHANGELOG.md +22 -0
  9. package/README.md +48 -115
  10. package/RELEASE.md +1 -2
  11. package/agents/clear/choose-contents.mjs +170 -0
  12. package/agents/clear/clear-auth-tokens.mjs +111 -0
  13. package/agents/clear/clear-document-config.mjs +39 -0
  14. package/agents/clear/clear-document-structure.mjs +106 -0
  15. package/agents/clear/clear-generated-docs.mjs +51 -0
  16. package/agents/clear/index.yaml +23 -0
  17. package/agents/evaluate/code-snippet.mjs +93 -0
  18. package/agents/evaluate/document-structure.yaml +70 -0
  19. package/agents/evaluate/document.yaml +79 -0
  20. package/agents/evaluate/generate-report.mjs +78 -0
  21. package/agents/evaluate/index.yaml +39 -0
  22. package/agents/generate/document-structure-tools/add-document.mjs +56 -0
  23. package/agents/generate/document-structure-tools/delete-document.mjs +49 -0
  24. package/agents/generate/document-structure-tools/move-document.mjs +82 -0
  25. package/agents/generate/document-structure-tools/update-document.mjs +50 -0
  26. package/agents/generate/generate-structure.yaml +1 -1
  27. package/agents/generate/update-document-structure.yaml +42 -0
  28. package/agents/generate/user-review-document-structure.mjs +6 -4
  29. package/agents/init/index.mjs +1 -1
  30. package/agents/publish/publish-docs.mjs +12 -3
  31. package/agents/translate/choose-language.mjs +1 -1
  32. package/agents/update/batch-update-document.yaml +7 -0
  33. package/agents/update/check-update-is-single.mjs +38 -0
  34. package/agents/update/document-tools/update-document-content.mjs +293 -0
  35. package/agents/update/index.yaml +4 -10
  36. package/agents/update/update-document-detail.yaml +52 -0
  37. package/agents/update/update-single-document.yaml +15 -0
  38. package/agents/update/user-review-document.mjs +248 -0
  39. package/agents/utils/choose-docs.mjs +4 -2
  40. package/agents/utils/format-document-structure.mjs +12 -2
  41. package/agents/utils/load-document-all-content.mjs +84 -0
  42. package/agents/utils/load-sources.mjs +4 -1
  43. package/aigne.yaml +59 -20
  44. package/assets/report-template/report.html +198 -0
  45. package/biome.json +14 -2
  46. package/docs/advanced-how-it-works.ja.md +101 -0
  47. package/docs/advanced-how-it-works.zh-TW.md +101 -0
  48. package/docs/advanced-how-it-works.zh.md +20 -20
  49. package/docs/advanced-quality-assurance.ja.md +96 -0
  50. package/docs/advanced-quality-assurance.zh-TW.md +96 -0
  51. package/docs/advanced-quality-assurance.zh.md +18 -18
  52. package/docs/advanced.ja.md +16 -0
  53. package/docs/advanced.zh-TW.md +16 -0
  54. package/docs/advanced.zh.md +4 -4
  55. package/docs/changelog.ja.md +309 -0
  56. package/docs/changelog.zh-TW.md +309 -0
  57. package/docs/changelog.zh.md +23 -23
  58. package/docs/cli-reference.ja.md +210 -0
  59. package/docs/cli-reference.zh-TW.md +210 -0
  60. package/docs/cli-reference.zh.md +21 -21
  61. package/docs/configuration-interactive-setup.ja.md +135 -0
  62. package/docs/configuration-interactive-setup.zh-TW.md +135 -0
  63. package/docs/configuration-interactive-setup.zh.md +29 -29
  64. package/docs/configuration-language-support.ja.md +94 -0
  65. package/docs/configuration-language-support.zh-TW.md +94 -0
  66. package/docs/configuration-language-support.zh.md +13 -13
  67. package/docs/configuration-llm-setup.ja.md +54 -0
  68. package/docs/configuration-llm-setup.zh-TW.md +54 -0
  69. package/docs/configuration-llm-setup.zh.md +12 -12
  70. package/docs/configuration-preferences.ja.md +129 -0
  71. package/docs/configuration-preferences.zh-TW.md +129 -0
  72. package/docs/configuration-preferences.zh.md +36 -36
  73. package/docs/configuration.ja.md +172 -0
  74. package/docs/configuration.zh-TW.md +172 -0
  75. package/docs/configuration.zh.md +49 -49
  76. package/docs/features-generate-documentation.ja.md +101 -0
  77. package/docs/features-generate-documentation.zh-TW.md +101 -0
  78. package/docs/features-generate-documentation.zh.md +17 -17
  79. package/docs/features-publish-your-docs.ja.md +107 -0
  80. package/docs/features-publish-your-docs.zh-TW.md +107 -0
  81. package/docs/features-publish-your-docs.zh.md +22 -22
  82. package/docs/features-translate-documentation.ja.md +79 -0
  83. package/docs/features-translate-documentation.zh-TW.md +79 -0
  84. package/docs/features-translate-documentation.zh.md +12 -12
  85. package/docs/features-update-and-refine.ja.md +138 -0
  86. package/docs/features-update-and-refine.zh-TW.md +138 -0
  87. package/docs/features-update-and-refine.zh.md +21 -21
  88. package/docs/features.ja.md +52 -0
  89. package/docs/features.zh-TW.md +52 -0
  90. package/docs/features.zh.md +8 -8
  91. package/docs/getting-started.ja.md +123 -0
  92. package/docs/getting-started.zh-TW.md +123 -0
  93. package/docs/getting-started.zh.md +24 -24
  94. package/docs/overview.ja.md +30 -0
  95. package/docs/overview.zh-TW.md +30 -0
  96. package/docs/overview.zh.md +8 -8
  97. package/package.json +19 -11
  98. package/prompts/common/document/content-rules-core.md +19 -0
  99. package/prompts/common/document/media-handling-rules.md +9 -0
  100. package/prompts/common/document/role-and-personality.md +15 -0
  101. package/prompts/common/document/user-preferences.md +9 -0
  102. package/prompts/common/document-structure/conflict-resolution-guidance.md +16 -0
  103. package/prompts/common/document-structure/document-structure-rules.md +45 -0
  104. package/prompts/common/document-structure/glossary.md +7 -0
  105. package/prompts/common/document-structure/intj-traits.md +5 -0
  106. package/prompts/common/document-structure/output-constraints.md +9 -0
  107. package/prompts/common/document-structure/user-locale-rules.md +10 -0
  108. package/prompts/common/document-structure/user-preferences.md +9 -0
  109. package/prompts/detail/custom/custom-components.md +9 -1
  110. package/prompts/detail/document-rules.md +6 -6
  111. package/prompts/detail/generate-document.md +5 -45
  112. package/prompts/detail/update-document.md +145 -0
  113. package/prompts/evaluate/document-structure.md +94 -0
  114. package/prompts/evaluate/document.md +149 -0
  115. package/prompts/structure/document-rules.md +1 -1
  116. package/prompts/structure/generate-structure-system.md +74 -0
  117. package/prompts/structure/generate-structure-user.md +41 -0
  118. package/prompts/structure/update-document-structure.md +118 -0
  119. package/prompts/translate/translate-document.md +1 -1
  120. package/prompts/utils/feedback-refiner.md +3 -3
  121. package/release-please-config.json +4 -3
  122. package/tests/agents/clear/choose-contents.test.mjs +280 -0
  123. package/tests/agents/clear/clear-auth-tokens.test.mjs +268 -0
  124. package/tests/agents/clear/clear-document-config.test.mjs +167 -0
  125. package/tests/agents/clear/clear-document-structure.test.mjs +374 -0
  126. package/tests/agents/clear/clear-generated-docs.test.mjs +222 -0
  127. package/tests/agents/evaluate/code-snippet.test.mjs +163 -0
  128. package/tests/agents/evaluate/fixtures/api-services.md +87 -0
  129. package/tests/agents/evaluate/fixtures/js-sdk.md +94 -0
  130. package/tests/agents/evaluate/generate-report.test.mjs +312 -0
  131. package/tests/agents/generate/check-document-structure.test.mjs +0 -6
  132. package/tests/agents/generate/document-structure-tools/add-document.test.mjs +449 -0
  133. package/tests/agents/generate/document-structure-tools/delete-document.test.mjs +410 -0
  134. package/tests/agents/generate/document-structure-tools/move-document.test.mjs +476 -0
  135. package/tests/agents/generate/document-structure-tools/update-document.test.mjs +548 -0
  136. package/tests/agents/generate/generate-structure.test.mjs +0 -6
  137. package/tests/agents/generate/user-review-document-structure.test.mjs +9 -9
  138. package/tests/agents/publish/publish-docs.test.mjs +2 -2
  139. package/tests/agents/update/check-update-is-single.test.mjs +300 -0
  140. package/tests/agents/update/document-tools/update-document-content.test.mjs +326 -0
  141. package/tests/agents/update/user-review-document.test.mjs +561 -0
  142. package/tests/agents/utils/format-document-structure.test.mjs +100 -0
  143. package/tests/utils/auth-utils.test.mjs +239 -1
  144. package/tests/utils/blocklet.test.mjs +9 -7
  145. package/tests/utils/constants.test.mjs +1 -1
  146. package/tests/utils/d2-utils.test.mjs +1 -1
  147. package/tests/utils/deploy.test.mjs +310 -366
  148. package/tests/utils/kroki-utils.test.mjs +2 -15
  149. package/tests/utils/linter/fixtures/css/keyword-error.css +1 -0
  150. package/tests/utils/linter/fixtures/css/missing-semicolon.css +1 -0
  151. package/tests/utils/linter/fixtures/css/syntax-error.css +1 -0
  152. package/tests/utils/linter/fixtures/css/undeclare-variable.css +1 -0
  153. package/tests/utils/linter/fixtures/css/unused-variable.css +2 -0
  154. package/tests/utils/linter/fixtures/css/valid-code.css +1 -0
  155. package/tests/utils/linter/fixtures/dockerfile/keyword-error.dockerfile +1 -0
  156. package/tests/utils/linter/fixtures/dockerfile/missing-semicolon.dockerfile +2 -0
  157. package/tests/utils/linter/fixtures/dockerfile/syntax-error.dockerfile +2 -0
  158. package/tests/utils/linter/fixtures/dockerfile/undeclare-variable.dockerfile +1 -0
  159. package/tests/utils/linter/fixtures/dockerfile/unused-variable.dockerfile +1 -0
  160. package/tests/utils/linter/fixtures/dockerfile/valid-code.dockerfile +2 -0
  161. package/tests/utils/linter/fixtures/go/keyword-error.go +5 -0
  162. package/tests/utils/linter/fixtures/go/missing-semicolon.go +5 -0
  163. package/tests/utils/linter/fixtures/go/syntax-error.go +6 -0
  164. package/tests/utils/linter/fixtures/go/undeclare-variable.go +5 -0
  165. package/tests/utils/linter/fixtures/go/unused-variable.go +5 -0
  166. package/tests/utils/linter/fixtures/go/valid-code.go +7 -0
  167. package/tests/utils/linter/fixtures/js/keyword-error.js +3 -0
  168. package/tests/utils/linter/fixtures/js/missing-semicolon.js +6 -0
  169. package/tests/utils/linter/fixtures/js/syntax-error.js +4 -0
  170. package/tests/utils/linter/fixtures/js/undeclare-variable.js +3 -0
  171. package/tests/utils/linter/fixtures/js/unused-variable.js +7 -0
  172. package/tests/utils/linter/fixtures/js/valid-code.js +15 -0
  173. package/tests/utils/linter/fixtures/json/keyword-error.json +1 -0
  174. package/tests/utils/linter/fixtures/json/missing-semicolon.json +1 -0
  175. package/tests/utils/linter/fixtures/json/syntax-error.json +1 -0
  176. package/tests/utils/linter/fixtures/json/undeclare-variable.json +1 -0
  177. package/tests/utils/linter/fixtures/json/unused-variable.json +1 -0
  178. package/tests/utils/linter/fixtures/json/valid-code.json +1 -0
  179. package/tests/utils/linter/fixtures/jsx/keyword-error.jsx +5 -0
  180. package/tests/utils/linter/fixtures/jsx/missing-semicolon.jsx +5 -0
  181. package/tests/utils/linter/fixtures/jsx/syntax-error.jsx +5 -0
  182. package/tests/utils/linter/fixtures/jsx/undeclare-variable.jsx +5 -0
  183. package/tests/utils/linter/fixtures/jsx/unused-variable.jsx +4 -0
  184. package/tests/utils/linter/fixtures/jsx/valid-code.jsx +5 -0
  185. package/tests/utils/linter/fixtures/python/keyword-error.py +3 -0
  186. package/tests/utils/linter/fixtures/python/missing-semicolon.py +2 -0
  187. package/tests/utils/linter/fixtures/python/syntax-error.py +3 -0
  188. package/tests/utils/linter/fixtures/python/undeclare-variable.py +3 -0
  189. package/tests/utils/linter/fixtures/python/unused-variable.py +6 -0
  190. package/tests/utils/linter/fixtures/python/valid-code.py +12 -0
  191. package/tests/utils/linter/fixtures/ruby/keyword-error.rb +2 -0
  192. package/tests/utils/linter/fixtures/ruby/missing-semicolon.rb +1 -0
  193. package/tests/utils/linter/fixtures/ruby/syntax-error.rb +2 -0
  194. package/tests/utils/linter/fixtures/ruby/undeclare-variable.rb +1 -0
  195. package/tests/utils/linter/fixtures/ruby/unused-variable.rb +2 -0
  196. package/tests/utils/linter/fixtures/ruby/valid-code.rb +1 -0
  197. package/tests/utils/linter/fixtures/sass/keyword-error.sass +2 -0
  198. package/tests/utils/linter/fixtures/sass/missing-semicolon.sass +3 -0
  199. package/tests/utils/linter/fixtures/sass/syntax-error.sass +3 -0
  200. package/tests/utils/linter/fixtures/sass/undeclare-variable.sass +2 -0
  201. package/tests/utils/linter/fixtures/sass/unused-variable.sass +4 -0
  202. package/tests/utils/linter/fixtures/sass/valid-code.sass +2 -0
  203. package/tests/utils/linter/fixtures/scss/keyword-error.scss +1 -0
  204. package/tests/utils/linter/fixtures/scss/missing-semicolon.scss +1 -0
  205. package/tests/utils/linter/fixtures/scss/syntax-error.scss +1 -0
  206. package/tests/utils/linter/fixtures/scss/undeclare-variable.scss +1 -0
  207. package/tests/utils/linter/fixtures/scss/unused-variable.scss +2 -0
  208. package/tests/utils/linter/fixtures/scss/valid-code.scss +1 -0
  209. package/tests/utils/linter/fixtures/shell/keyword-error.sh +5 -0
  210. package/tests/utils/linter/fixtures/shell/missing-semicolon.sh +3 -0
  211. package/tests/utils/linter/fixtures/shell/syntax-error.sh +4 -0
  212. package/tests/utils/linter/fixtures/shell/undeclare-variable.sh +3 -0
  213. package/tests/utils/linter/fixtures/shell/unused-variable.sh +4 -0
  214. package/tests/utils/linter/fixtures/shell/valid-code.sh +3 -0
  215. package/tests/utils/linter/fixtures/ts/keyword-error.ts +1 -0
  216. package/tests/utils/linter/fixtures/ts/missing-semicolon.ts +1 -0
  217. package/tests/utils/linter/fixtures/ts/syntax-error.ts +1 -0
  218. package/tests/utils/linter/fixtures/ts/undeclare-variable.ts +1 -0
  219. package/tests/utils/linter/fixtures/ts/unused-variable.ts +3 -0
  220. package/tests/utils/linter/fixtures/ts/valid-code.ts +3 -0
  221. package/tests/utils/linter/fixtures/tsx/keyword-error.tsx +5 -0
  222. package/tests/utils/linter/fixtures/tsx/missing-semicolon.tsx +5 -0
  223. package/tests/utils/linter/fixtures/tsx/syntax-error.tsx +5 -0
  224. package/tests/utils/linter/fixtures/tsx/undeclare-variable.tsx +6 -0
  225. package/tests/utils/linter/fixtures/tsx/unused-variable.tsx +6 -0
  226. package/tests/utils/linter/fixtures/tsx/valid-code.tsx +5 -0
  227. package/tests/utils/linter/fixtures/vue/keyword-error.vue +6 -0
  228. package/tests/utils/linter/fixtures/vue/missing-semicolon.vue +6 -0
  229. package/tests/utils/linter/fixtures/vue/syntax-error.vue +6 -0
  230. package/tests/utils/linter/fixtures/vue/undeclare-variable.vue +6 -0
  231. package/tests/utils/linter/fixtures/vue/unused-variable.vue +7 -0
  232. package/tests/utils/linter/fixtures/vue/valid-code.vue +6 -0
  233. package/tests/utils/linter/fixtures/yaml/keyword-error.yml +1 -0
  234. package/tests/utils/linter/fixtures/yaml/missing-semicolon.yml +2 -0
  235. package/tests/utils/linter/fixtures/yaml/syntax-error.yml +1 -0
  236. package/tests/utils/linter/fixtures/yaml/undeclare-variable.yml +1 -0
  237. package/tests/utils/linter/fixtures/yaml/unused-variable.yml +2 -0
  238. package/tests/utils/linter/fixtures/yaml/valid-code.yml +3 -0
  239. package/tests/utils/linter/index.test.mjs +440 -0
  240. package/tests/utils/linter/scan-results.mjs +42 -0
  241. package/tests/utils/markdown/index.test.mjs +478 -0
  242. package/tests/utils/mermaid-validator.test.mjs +2 -2
  243. package/tests/utils/utils.test.mjs +3 -1
  244. package/types/document-schema.mjs +54 -0
  245. package/types/document-structure-schema.mjs +244 -0
  246. package/utils/auth-utils.mjs +131 -6
  247. package/utils/conflict-detector.mjs +5 -1
  248. package/utils/{constants.mjs → constants/index.mjs} +109 -0
  249. package/utils/constants/linter.mjs +102 -0
  250. package/utils/d2-utils.mjs +2 -4
  251. package/utils/debug.mjs +3 -0
  252. package/utils/deploy.mjs +81 -385
  253. package/utils/evaluate/report-utils.mjs +131 -0
  254. package/utils/file-utils.mjs +36 -1
  255. package/utils/kroki-utils.mjs +1 -1
  256. package/utils/linter/index.mjs +50 -0
  257. package/utils/markdown/index.mjs +26 -0
  258. package/utils/markdown-checker.mjs +1 -1
  259. package/utils/utils.mjs +19 -7
  260. package/prompts/structure/generate-structure.md +0 -161
@@ -0,0 +1,50 @@
1
+ import { LINTER_API_URL } from "../constants/linter.mjs";
2
+
3
+ export async function lintCode({ code, linter = "biome-lint", suffix = ".js" }) {
4
+ if (!code) {
5
+ throw new Error("Code parameter is required");
6
+ }
7
+ const timeout = 30 * 1000;
8
+ let filename = `code${suffix}`;
9
+ if (suffix === ".dockerfile") {
10
+ filename = "Dockerfile";
11
+ }
12
+ const testData = {
13
+ filename,
14
+ content: code,
15
+ options: {
16
+ validate_all: true,
17
+ fix: false,
18
+ log_level: "INFO",
19
+ timeout,
20
+ },
21
+ };
22
+ try {
23
+ const controller = new AbortController();
24
+ const timeoutId = setTimeout(() => controller.abort(), timeout);
25
+
26
+ const response = await fetch(`${LINTER_API_URL}/${linter}/json`, {
27
+ method: "POST",
28
+ headers: {
29
+ "Content-Type": "application/json",
30
+ },
31
+ body: JSON.stringify(testData),
32
+ signal: controller.signal,
33
+ });
34
+
35
+ clearTimeout(timeoutId);
36
+
37
+ if (!response.ok) {
38
+ throw new Error(`HTTP error! status: ${response.status}`);
39
+ }
40
+
41
+ const data = await response.json();
42
+ if (!data) {
43
+ throw new Error("Invalid response data");
44
+ }
45
+
46
+ return data;
47
+ } catch (error) {
48
+ throw new Error(`Linting failed: ${error.message}`);
49
+ }
50
+ }
@@ -0,0 +1,26 @@
1
+ import remarkGfm from "remark-gfm";
2
+ import remarkParse from "remark-parse";
3
+ import { unified } from "unified";
4
+ import { visit } from "unist-util-visit";
5
+ import { VFile } from "vfile";
6
+
7
+ export function traverseMarkdownAst({ ast, test, visitor }) {
8
+ if (!ast || !test || !visitor) {
9
+ throw new Error("Required parameters missing: ast, test, and visitor must be provided");
10
+ }
11
+ visit(ast, test, visitor);
12
+ }
13
+
14
+ export function getMarkdownAst({ markdown }) {
15
+ if (!markdown || typeof markdown !== "string") {
16
+ throw new Error("Invalid markdown input: must be a non-empty string");
17
+ }
18
+ const file = new VFile({ value: markdown });
19
+ const processor = unified().use(remarkParse).use(remarkGfm);
20
+ try {
21
+ const ast = processor.parse(file);
22
+ return ast;
23
+ } catch (error) {
24
+ throw new Error(`Failed to parse markdown: ${error.message}`);
25
+ }
26
+ }
@@ -7,7 +7,7 @@ import remarkParse from "remark-parse";
7
7
  import { unified } from "unified";
8
8
  import { visit } from "unist-util-visit";
9
9
  import { VFile } from "vfile";
10
- import { KROKI_CONCURRENCY } from "./constants.mjs";
10
+ import { KROKI_CONCURRENCY } from "./constants/index.mjs";
11
11
  import { checkContent, isValidCode } from "./d2-utils.mjs";
12
12
  import { validateMermaidSyntax } from "./mermaid-validator.mjs";
13
13
 
package/utils/utils.mjs CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  SUPPORTED_FILE_EXTENSIONS,
18
18
  SUPPORTED_LANGUAGES,
19
19
  TARGET_AUDIENCES,
20
- } from "./constants.mjs";
20
+ } from "./constants/index.mjs";
21
21
 
22
22
  /**
23
23
  * Normalize path to absolute path for consistent comparison
@@ -934,7 +934,10 @@ export function processConfigFields(config) {
934
934
  .filter(Boolean);
935
935
 
936
936
  if (purposeRules.length > 0) {
937
- allRulesContent.push(purposeRules.join("\n\n"));
937
+ const purposes = purposeRules.join("\n\n");
938
+ allRulesContent.push(purposes);
939
+
940
+ processed.purposes = purposes;
938
941
  }
939
942
  }
940
943
 
@@ -951,7 +954,10 @@ export function processConfigFields(config) {
951
954
  .filter(Boolean);
952
955
 
953
956
  if (audienceRules.length > 0) {
954
- allRulesContent.push(audienceRules.join("\n\n"));
957
+ const audiences = audienceRules.join("\n\n");
958
+ allRulesContent.push(audiences);
959
+
960
+ processed.audiences = audiences;
955
961
  }
956
962
 
957
963
  // Get names for targetAudience field
@@ -976,20 +982,26 @@ export function processConfigFields(config) {
976
982
  // Process reader knowledge level (single value)
977
983
  let knowledgeContent = "";
978
984
  if (config.readerKnowledgeLevel) {
979
- knowledgeContent = READER_KNOWLEDGE_LEVELS[config.readerKnowledgeLevel]?.content;
980
- if (knowledgeContent) {
985
+ const knowledgeLevel = READER_KNOWLEDGE_LEVELS[config.readerKnowledgeLevel];
986
+ if (knowledgeLevel) {
987
+ knowledgeContent = knowledgeLevel.content;
981
988
  processed.readerKnowledgeContent = knowledgeContent;
982
989
  allRulesContent.push(`Reader Knowledge Level:\n${knowledgeContent}`);
990
+
991
+ processed.readerKnowledgeLevel = `Reader Knowledge Level - ${knowledgeLevel.name} : ${knowledgeLevel.description} \n${knowledgeContent}`;
983
992
  }
984
993
  }
985
994
 
986
995
  // Process documentation depth (single value)
987
996
  let depthContent = "";
988
997
  if (config.documentationDepth) {
989
- depthContent = DOCUMENTATION_DEPTH[config.documentationDepth]?.content;
990
- if (depthContent) {
998
+ const depthLevel = DOCUMENTATION_DEPTH[config.documentationDepth];
999
+ if (depthLevel) {
1000
+ depthContent = depthLevel.content;
991
1001
  processed.documentationDepthContent = depthContent;
992
1002
  allRulesContent.push(`Documentation Depth:\n${depthContent}`);
1003
+
1004
+ processed.coverageDepth = `Documentation Depth - ${depthLevel.name} : ${depthLevel.description} \n${depthContent}`;
993
1005
  }
994
1006
  }
995
1007
 
@@ -1,161 +0,0 @@
1
- <role_and_goal>
2
- You are an experienced document structure architect with expertise in information organization and logical structuring. Your specialty lies in deeply understanding various forms of data sources (including but not limited to source code, API definitions, database schemas, configuration information, business logic descriptions, user stories, etc.) and extracting core information and key relationships from them.
3
-
4
- Your task is to design a detailed structural plan for the document to be generated. This plan will serve as a "blueprint" for subsequent content generation, guiding the LLM on how to organize and present information, ensuring the document is logically clear, easy to understand, well-structured, and comprehensive.
5
-
6
- Key capabilities and behavioral principles:
7
- - Data Comprehension: Ability to parse and understand structured and unstructured data, identifying key concepts, entities, attributes, relationships, and processes within them.
8
- - Structured Thinking: Strong logical analysis capabilities to decompose complex information into clear chapters, sections, and items, establishing reasonable hierarchical relationships.
9
- - User-Oriented Approach: Ability to flexibly adjust the focus and level of detail in structural planning based on document objectives and audience characteristics provided by users.
10
- - Modular Design: Tendency to divide documents into independent, reusable modules or sections for easy content population and subsequent maintenance.
11
- - Flexibility and Adaptability: Ability to handle multiple types of data sources and design the most suitable document structure based on data source characteristics (such as code function/class structures, API endpoints/parameters, text paragraphs/themes).
12
- - Clarity and Completeness: Ensure the final structural plan is easy to understand and can guide the LLM to generate a comprehensive and well-organized document.
13
-
14
-
15
- Objectives:
16
- - This structural plan should be reasonable and clear, capable of comprehensively displaying information from the user-provided context while providing users with logical browsing paths.
17
- - Each {{nodeName}} should include: {{nodeName}} title, a one-sentence introduction to the main information this {{nodeName}} displays, with information presentation and organization methods matching the target audience.
18
-
19
- Always follow one principle: You must ensure the final structural plan meets user requirements.
20
- </role_and_goal>
21
-
22
- <user_locale>
23
- {{ locale }}
24
- </user_locale>
25
-
26
-
27
- <user_rules>
28
- {{ rules }}
29
-
30
- ** Output content in {{ locale }} language **
31
- </user_rules>
32
-
33
- {% if userPreferences %}
34
- <user_preferences>
35
- {{userPreferences}}
36
-
37
- User preference guidelines:
38
- - User preferences are derived from feedback provided in previous user interactions. When generating structural planning, consider user preferences to avoid repeating issues mentioned in user feedback
39
- - User preferences carry less weight than current user feedback
40
- </user_preferences>
41
- {% endif %}
42
-
43
- {% if feedback %}
44
- <document_structure_user_feedback>
45
- {{ feedback }}
46
- </document_structure_user_feedback>
47
- {% endif %}
48
-
49
- {% if originalDocumentStructure %}
50
- <last_document_structure>
51
- {{originalDocumentStructure}}
52
- </last_document_structure>
53
-
54
- <last_document_structure_rule>
55
- If a previous structural plan (last_document_structure) is provided, follow these rules:
56
- 1. **Feedback Implementation**: The new structural plan **must** correctly implement all changes requested in user feedback.
57
- 2. **Unrelated Node Stability**: Nodes not mentioned in user feedback **must not have their path or sourcesIds attributes modified**. `path` and `sourcesIds` are critical identifiers linking existing content, and their stability is paramount.
58
- Ideally, other attributes (such as `title`, `description`) should also remain stable, unless these changes are directly caused by a requested modification or result from DataSource updates.
59
- </last_document_structure_rule>
60
- {% endif %}
61
-
62
- {% if documentStructure %}
63
- <review_document_structure>
64
- {{ documentStructure }}
65
- </review_document_structure>
66
- {% endif %}
67
-
68
- {% if structureReviewFeedback %}
69
- <document_structure_review_feedback>
70
- {{ structureReviewFeedback }}
71
- </document_structure_review_feedback>
72
- {% endif %}
73
-
74
- <document_structure_rules>
75
- The target audience for this document is: {{targetAudience}}
76
-
77
- DataSources usage rules:
78
- 1. When planning the structure, reasonably organize and display all information from DataSources without omission
79
- 2. Users may provide limited DataSources. In such cases, you can supplement with your existing knowledge to complete the structural planning
80
- 3. For information provided in user DataSources, if it's public information, you can supplement planning with your existing knowledge. If it's the user's private products or information, **do not arbitrarily create or supplement false information**
81
- 4. If DataSources don't match the target audience, you need to reframe the DataSources to match the target audience
82
-
83
- Structural planning rules:
84
-
85
- 1. {{nodeName}} planning should prioritize user-specified rules, especially requirements like "number of {{nodeName}}", "must include xxx {{nodeName}}", "cannot include xxx {{nodeName}}"
86
- 2. Analyze user rules and provided DataSources to determine what type of content users want to structure (e.g., websites, documentation, books, etc.) and design appropriate structures for different content types
87
- 3. {{nodeName}} planning should display as much information as possible from the user-provided context
88
- 4. Structure planning should have reasonable hierarchical relationships, with content planned at appropriate levels, avoiding flat layouts with numerous {{nodeName}} items
89
- 5. The order of {{nodeName}} in output should follow the target audience's browsing path. It doesn't need to follow the exact order in DataSources—progress from simple to advanced, from understanding to exploration, with reasonable pathways
90
- 6. Each {{nodeName}} should have a clear content plan and must not duplicate content from other {{nodeName}} items
91
- 7. Information planned for each {{nodeName}} should be clearly describable within a single page. If there's too much information to display or the concepts are too broad, consider splitting into sub-{{nodeName}} items
92
- 8. If previous document structure and user feedback are provided, make only necessary modifications based on user feedback without major changes
93
- 9. If previous document structure is provided but no feedback is given, **directly return the previous document structure**
94
- 10. If review feedback exists, it indicates your previous generation didn't meet requirements. Optimize your output based on the review feedback
95
-
96
- {{nodeName}} planning rules:
97
-
98
- 1. Each {{nodeName}} should include this information:
99
-
100
- - Title
101
- - Description of the important information this {{nodeName}} plans to display, with descriptions tailored to the target audience
102
-
103
- 2. Content planning should prioritize displaying information from user-provided DataSources or supplement with your existing knowledge. Do not arbitrarily fabricate information.
104
-
105
- {% ifAsync docsType == 'general' %}
106
- {% include "./document-rules.md" %}
107
-
108
- {% endif %}
109
-
110
- {% ifAsync docsType == 'getting-started' %}
111
- {% include "./structure-getting-started.md" %}
112
- {% endif %}
113
-
114
- Other requirements:
115
-
116
- 1. Must satisfy user specified rules
117
- 2. Return information using the user's language {{locale}}
118
- </document_structure_rules>
119
-
120
- <conflict_resolution_guidance>
121
- When users select potentially conflicting options, conflict resolution guidance will be provided in user_rules. Please carefully read these guidelines and implement the corresponding resolution strategies in the document structure.
122
-
123
- Core principles for conflict resolution:
124
- 1. **Layered need satisfaction**: Simultaneously satisfy multiple purposes and audiences through reasonable document structure hierarchy
125
- 2. **Clear navigation paths**: Provide clear document usage paths for users with different needs
126
- 3. **Avoid content duplication**: Ensure content across different sections is complementary rather than repetitive
127
- 4. **Progressive disclosure**: From high-level overview to specific details, meeting needs at different depth levels
128
-
129
- Common conflict resolution patterns:
130
- - **Purpose conflicts**: Create hierarchical structures
131
- - **Audience conflicts**: Design role-oriented sections or paths
132
- - **Depth conflicts**: Adopt progressive structures that allow users to choose appropriate depth levels
133
-
134
- When generating document structure, prioritize conflict resolution strategies to ensure the final structure can harmoniously satisfy all user needs.
135
- </conflict_resolution_guidance>
136
-
137
- {% if glossary %}
138
- <terms>
139
- Glossary of specialized terms. Please ensure correct spelling when using these terms.
140
-
141
- {{glossary}}
142
- </terms>
143
- {% endif %}
144
-
145
- <datasources>
146
- {{ datasources }}
147
- </datasources>
148
-
149
- {% ifAsync docsType == 'general' %}
150
- {% include "./structure-example.md" %}
151
- {% endif %}
152
-
153
- <output_constraints>
154
-
155
- 1. Associated sourceIds should be as comprehensive as possible. You can include as many related datasources as possible.
156
- - If datasources contain source code, **include as much related and adjacent source code as possible** to ensure quality of subsequent detail generation.
157
- - First identify the most relevant source code files, then analyze the source code referenced within them. Referenced file paths, referenced files, and files in referenced paths all need to be included in sourceIds
158
- - For referenced files, analyze another layer of source code files referenced within them and add to sourceIds to ensure complete context for detail generation
159
- 2. Ensure sourceIds are never empty. Do not plan {{nodeName}} items without related data sources
160
-
161
- </output_constraints>