@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
@@ -1,10 +1,10 @@
1
1
  import fs from "node:fs/promises";
2
2
  import path from "node:path";
3
3
  import { parse } from "yaml";
4
- import { processConfigFields, resolveFileReferences } from "../utils/utils.mjs";
4
+ import { processConfigFields, resolveFileReferences } from "./utils.mjs";
5
5
 
6
6
  export default async function loadConfig({ config, appUrl }) {
7
- const configPath = path.join(process.cwd(), config);
7
+ const configPath = path.isAbsolute(config) ? config : path.join(process.cwd(), config);
8
8
 
9
9
  try {
10
10
  // Check if config file exists
@@ -40,19 +40,3 @@ export default async function loadConfig({ config, appUrl }) {
40
40
  throw new Error(`Failed to parse config file: ${error.message}`);
41
41
  }
42
42
  }
43
-
44
- loadConfig.input_schema = {
45
- type: "object",
46
- properties: {
47
- config: {
48
- type: "string",
49
- default: "./.aigne/doc-smith/config.yaml",
50
- },
51
- appUrl: {
52
- type: "string",
53
- description: "Application URL to override config",
54
- },
55
- },
56
- };
57
-
58
- loadConfig.task_render_mode = "hide";
@@ -8,7 +8,7 @@ import { unified } from "unified";
8
8
  import { visit } from "unist-util-visit";
9
9
  import { VFile } from "vfile";
10
10
  import { KROKI_CONCURRENCY } from "./constants.mjs";
11
- import { checkD2Content } from "./kroki-utils.mjs";
11
+ import { checkContent, isValidCode } from "./d2-utils.mjs";
12
12
  import { validateMermaidSyntax } from "./mermaid-validator.mjs";
13
13
 
14
14
  /**
@@ -90,7 +90,7 @@ function checkDeadLinks(markdown, source, allowedLinks, errorMessages) {
90
90
  // Check if this link is in the allowed links set
91
91
  if (!allowedLinks.has(path)) {
92
92
  errorMessages.push(
93
- `Found a dead link in ${source}: [${match[1]}](${trimLink}), ensure the link exists in the structure plan path`,
93
+ `Found a dead link in ${source}: [${match[1]}](${trimLink}), ensure the link exists in the document structure path`,
94
94
  );
95
95
  }
96
96
  }
@@ -300,7 +300,7 @@ function checkContentStructure(markdown, source, errorMessages) {
300
300
  }
301
301
 
302
302
  // Check if content ends with proper punctuation (indicating completeness)
303
- const validEndingPunctuation = [".", "。", ")", "|", "*", ">", "`"];
303
+ const validEndingPunctuation = [".", "。", ")", "|", "*", ">", "`", "!"];
304
304
  const trimmedText = markdown.trim();
305
305
  const hasValidEnding = validEndingPunctuation.some((punct) => trimmedText.endsWith(punct));
306
306
 
@@ -467,7 +467,7 @@ export async function checkMarkdown(markdown, source = "content", options = {})
467
467
  specialCharMatch = nodeWithSpecialCharsRegex.exec(mermaidContent);
468
468
  }
469
469
  }
470
- if (node.lang.toLowerCase() === "d2") {
470
+ if (isValidCode(node.lang)) {
471
471
  d2ChecksList.push({
472
472
  content: node.value,
473
473
  line,
@@ -527,7 +527,7 @@ export async function checkMarkdown(markdown, source = "content", options = {})
527
527
  await pMap(
528
528
  d2ChecksList,
529
529
  async ({ content, line }) =>
530
- checkD2Content({ content }).catch((err) => {
530
+ checkContent({ content }).catch((err) => {
531
531
  const errorMessage = err?.message || String(err) || "Unknown d2 syntax error";
532
532
  errorMessages.push(`Found D2 syntax error in ${source} at line ${line}: ${errorMessage}`);
533
533
  }),
@@ -1,19 +0,0 @@
1
- type: team
2
- name: batchDocsDetailGenerate
3
- description: 批量生成文档详情
4
- skills:
5
- - ./check-detail.mjs
6
- input_schema:
7
- type: object
8
- properties:
9
- datasources:
10
- type: string
11
- description: 结构规划的上下文,用于辅助结构规划
12
- structurePlanResult: ./schema/structure-plan-result.yaml
13
- modifiedFiles:
14
- type: array
15
- items: { type: string }
16
- description: Array of modified files since last generation
17
- iterate_on: structurePlanResult
18
- concurrency: 3
19
- mode: sequential
@@ -1,30 +0,0 @@
1
- name: checkStructurePlanResult
2
- description: 对 structure-planning agent 生成的结果进行检查,确保其符合预期,特别是在有上一轮生成结果和用户反馈的场景下。
3
- instructions:
4
- url: ../prompts/check-structure-planning-result.md
5
- input_schema:
6
- type: object
7
- properties:
8
- structurePlan:
9
- $ref: ./schema/structure-plan.yaml
10
- description: 新一轮生成的结构规划。
11
- originalStructurePlan:
12
- $ref: ./schema/structure-plan.yaml
13
- description: 上一轮生成的结构规划,用于对比。如果不存在,则检查默认通过。
14
- feedback:
15
- type: string
16
- description: 用户针对上一轮结果提供的反馈。
17
- required:
18
- - structurePlan
19
- output_schema:
20
- type: object
21
- properties:
22
- isValid:
23
- type: boolean
24
- description: 检查是否通过。true 表示通过,false 表示不通过。
25
- structureReviewFeedback:
26
- type: string
27
- description: 检查结果的详细说明。如果不通过,需要明确指出哪里不符合要求。
28
- required:
29
- - isValid
30
- - structureReviewFeedback
@@ -1,50 +0,0 @@
1
- name: contentDetailGenerator
2
- description: 通用内容详情生成器,支持网站、文档、书籍、演示文稿等多种场景
3
- instructions:
4
- url: ../prompts/content-detail-generator.md
5
- input_schema:
6
- type: object
7
- properties:
8
- rules:
9
- type: string
10
- description: 用户的结构规划的要求
11
- locale:
12
- type: string
13
- description: 用户语言,如 zh、en
14
- datasources:
15
- type: string
16
- description: 结构规划的上下文,用于辅助结构规划
17
- targetAudience:
18
- type: string
19
- description: 结构规划的目标受众
20
- nodeName:
21
- type: string
22
- description: 结构规划的节点名称
23
- originalStructurePlan: ./schema/structure-plan.yaml
24
- title:
25
- type: string
26
- description:
27
- type: string
28
- path:
29
- type: string
30
- parentId:
31
- type:
32
- - string
33
- - "null"
34
- glossary:
35
- type: string
36
- description: 术语表
37
- additionalInformation:
38
- type: string
39
- description: 额外补充信息
40
- required:
41
- - rules
42
- - datasources
43
- - originalStructurePlan
44
- output_schema:
45
- type: object
46
- properties:
47
- content:
48
- type: string
49
- required:
50
- - content
@@ -1,25 +0,0 @@
1
- import { stringify } from "yaml";
2
-
3
- export default async function formatStructurePlan({ structurePlan }) {
4
- // Extract required fields from each item in structurePlan
5
- const formattedData = structurePlan.map((item) => ({
6
- title: item.title,
7
- path: item.path,
8
- parentId: item.parentId,
9
- description: item.description,
10
- }));
11
-
12
- // Convert to YAML string
13
- const yamlString = stringify(formattedData, {
14
- indent: 2,
15
- lineWidth: 120,
16
- minContentWidth: 20,
17
- });
18
-
19
- return {
20
- structurePlanYaml: yamlString,
21
- structurePlan,
22
- };
23
- }
24
-
25
- formatStructurePlan.task_render_mode = "hide";
@@ -1,12 +0,0 @@
1
- type: team
2
- name: structurePlanning
3
- description: A team of agents that plan the structure of the documentation.
4
- skills:
5
- - structure-planning.yaml
6
- task_title: Plan the structure of the documentation
7
- task_render_mode: collapse
8
- reflection:
9
- reviewer: check-structure-planning-result.yaml
10
- is_approved: isValid
11
- max_iterations: 3
12
- return_last_on_max_iterations: true
@@ -1,26 +0,0 @@
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: 路径,以 RUL 的格式返回,不能为空, 不能包含空格等特殊字符, 必须以 / 开头,不需要包含语言层级,比如 /zh/about 直接返回 /about
12
- parentId:
13
- type:
14
- - string
15
- - "null"
16
- description: 父节点 path,如果为 null 则表示是顶级节点
17
- sourceIds:
18
- type: array
19
- description: 关联的 dataSources 中的 sourceId,用于后续的翻译和内容生成,必须来自 datasources 中的 sourceId,不能有虚假的 id, **不能为空**
20
- items:
21
- type: string
22
- required:
23
- - title
24
- - description
25
- - path
26
- - sourceIds
@@ -1,104 +0,0 @@
1
- <custom_component>
2
- When generating document details, you can use the following custom components at appropriate locations based on their descriptions and functionality to enhance document presentation:
3
- - `<x-card>`
4
- - `<x-cards>`
5
-
6
-
7
- ### 1. <x-card> Single Card Component
8
- Suitable for displaying individual links with a richer and more visually appealing presentation format.
9
-
10
- Example:
11
-
12
- ```
13
- <x-card data-title="Required Title" data-image="Image URL" data-icon="Icon identifier (e.g., lucide:rocket or material-symbols:rocket-outline)" data-href="Navigation link URL" data-horizontal="true/false" data-cta="Button text" >
14
- Card body content
15
- </x-card>
16
- ```
17
-
18
- Attribute Rules:
19
-
20
- - data-title (required): Card title.
21
- - data-icon / data-image (choose one, at least one must be provided):
22
- - It's recommended to always provide data-icon.
23
- - Icons should prioritize Lucide (lucide:icon-name). If not available in Lucide, use Iconify (collection:icon-name, e.g., material-symbols:rocket-outline).
24
- - data-image (optional): Image URL, can coexist with icon.
25
- - data-href (optional): Navigation link for clicking the card or button.
26
- - data-horizontal (optional): Whether to use horizontal layout.
27
- - data-cta (optional): Button text (call to action).
28
- - Body content:
29
- - Must be written within <x-card>...</x-card> children.
30
- - **Markdown format rendering is not supported**
31
- - **Code block rendering is not supported**
32
- - Only supports plain text format without styling
33
-
34
-
35
- ### 2. `<x-cards>` Card List Component
36
-
37
- Suitable for displaying multiple links using a card list format, providing a richer and more visually appealing presentation.
38
-
39
- Syntax:
40
-
41
- ```
42
- <x-cards data-columns="Number of columns">
43
- <x-card data-title="Title 1" data-icon="lucide:rocket">Content 1</x-card>
44
- <x-card data-title="Title 2" data-icon="lucide:bolt">Content 2</x-card>
45
- <x-card data-title="Title 3" data-icon="material-symbols:rocket-outline">Content 3</x-card>
46
- </x-cards>
47
- ```
48
-
49
- Attribute Rules:
50
- - data-columns (optional): Number of columns, integer (e.g., 2, 3). Default is 2.
51
- - Must contain multiple <x-card> elements internally.
52
- - Consistency requirement: All <x-card> elements within the same <x-cards> must maintain visual consistency:
53
- - Recommended to always provide data-icon for each card.
54
- - Or all cards should have data-image.
55
- - Avoid mixing (some with icons, some with only images).
56
-
57
- <good_example>
58
- Use plain text without any styling
59
- <x-card data-title="alarm()" data-icon="lucide:alarm-clock"> SIGALRM: Sent when a real-time timer has expired. </x-card>
60
-
61
- Single card:
62
- <x-card data-title="Horizontal card" data-icon="lucide:atom" data-horizontal="true">
63
- This is an example of a horizontal card.
64
- </x-card>
65
-
66
- Card list (all using icons, recommended approach):
67
- <x-cards data-columns="3">
68
- <x-card data-title="Feature 1" data-icon="lucide:rocket">Description of Feature 1.</x-card>
69
- <x-card data-title="Feature 2" data-icon="lucide:bolt">Description of Feature 2.</x-card>
70
- <x-card data-title="Feature 3" data-icon="material-symbols:rocket-outline">Description of Feature 3.</x-card>
71
- </x-cards>
72
-
73
- Card list (all using images):
74
- <x-cards data-columns="2">
75
- <x-card data-title="Card A" data-image="https://picsum.photos/id/10/300/300">Content A</x-card>
76
- <x-card data-title="Card B" data-image="https://picsum.photos/id/11/300/300">Content B</x-card>
77
- </x-cards>
78
- </good_example>
79
-
80
- <bad_example>
81
-
82
- `x-card` component body does not support markdown formatting inline code block
83
- <x-card data-title="alarm()" data-icon="lucide:alarm-clock"> `SIGALRM`: Sent when a real-time timer has expired. </x-card>
84
-
85
-
86
- `x-card` component body does not support code blocks
87
- <x-card data-title="ctrl_break()" data-icon="lucide:keyboard">
88
- Creates a listener for "ctrl-break" events.
89
- ```rust,no_run
90
- use tokio::signal::windows::ctrl_break;
91
-
92
- #[tokio::main]
93
- async fn main() -> std::io::Result<()> {
94
- let mut stream = ctrl_break()?;
95
- stream.recv().await;
96
- println!("got ctrl-break");
97
- Ok(())
98
- }
99
- ```
100
- </x-card>
101
-
102
- </bad_example>
103
-
104
- </custom_component>
package/tests/README.md DELETED
@@ -1,93 +0,0 @@
1
- # Tests
2
-
3
- This directory contains test files for AIGNE DocSmith.
4
-
5
- ## Test Files
6
-
7
- ### test-save-docs.mjs
8
-
9
- Tests the file cleanup functionality of the `saveDocs` method.
10
-
11
- **Test Content:**
12
- - Verify the generation of `_sidebar.md` file
13
- - Verify cleanup of invalid .md files (including main files and translation files)
14
- - Verify retention of valid files
15
-
16
- **Run Method:**
17
- ```bash
18
- node tests/test-save-docs.mjs
19
- ```
20
-
21
- **Test Scenarios:**
22
- 1. Create test directory containing valid and invalid files
23
- 2. Run the `saveDocs` method
24
- 3. Verify that only files in the structure plan are retained
25
- 4. Verify that `_sidebar.md` file is correctly generated
26
- 5. Verify that invalid files are deleted
27
-
28
- **Expected Results:**
29
- - Main files in the structure plan are retained
30
- - Translation files in the structure plan are retained
31
- - Files not in the structure plan are deleted
32
- - `_sidebar.md` file is generated
33
-
34
- ### load-sources.test.mjs
35
-
36
- Tests the file loading and filtering functionality of the `loadSources` method.
37
-
38
- **Test Content:**
39
- - Verify the operation of default include/exclude patterns
40
- - Verify handling of custom patterns
41
- - Verify processing of .gitignore files
42
- - Verify handling of multi-level directory structures
43
- - Verify filtering of multiple file types
44
- - Verify handling of path patterns
45
-
46
- **Run Method:**
47
- ```bash
48
- node tests/load-sources.test.mjs
49
- ```
50
-
51
- **Test Scenarios:**
52
- 1. Create complex test directory structure
53
- 2. Test different include/exclude pattern combinations
54
- 3. Verify accuracy of file filtering
55
- 4. Verify robustness of error handling
56
-
57
- **Expected Results:**
58
- - Correctly include specified file types
59
- - Correctly exclude unwanted files and directories
60
- - Correctly process .gitignore rules
61
- - Correctly handle multi-level directory structures
62
- - Correctly handle non-existent directories
63
-
64
- ### check-detail-result.test.mjs
65
-
66
- Tests the content validation functionality of the `checkDetailResult` method.
67
-
68
- **Test Content:**
69
- - Verify approval of valid content (e.g., correct links)
70
- - Verify rejection of content with dead links
71
- - Verify rejection of content with incorrect table separators
72
- - Verify approval of external links
73
- - Verify correct reporting of multiple issues simultaneously
74
-
75
- **Run Method:**
76
- ```bash
77
- node tests/check-detail-result.test.mjs
78
- ```
79
-
80
- **Test Scenarios:**
81
- 1. Define a `structurePlan` with a list of valid internal link paths.
82
- 2. Call `checkDetailResult` with various content strings that include:
83
- - A valid internal link.
84
- - An invalid or "dead" internal link.
85
- - An incorrectly formatted Markdown table separator.
86
- - A valid external (HTTP) link.
87
- - A combination of the above issues.
88
- 3. Assert the `isApproved` boolean and the `detailFeedback` string in the result.
89
-
90
- **Expected Results:**
91
- - `isApproved` is `true` if no issues are found.
92
- - `isApproved` is `false` if any validation rule is violated.
93
- - `detailFeedback` provides a descriptive message for each validation issue found.