@aigne/doc-smith 0.8.15-beta.9 → 0.8.15

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 (59) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/agents/evaluate/document-structure.yaml +3 -1
  3. package/agents/evaluate/document.yaml +3 -1
  4. package/agents/generate/generate-structure.yaml +1 -5
  5. package/agents/generate/merge-diagram.yaml +4 -4
  6. package/agents/generate/update-document-structure.yaml +51 -45
  7. package/agents/generate/user-review-document-structure.mjs +3 -26
  8. package/agents/generate/utils/merge-document-structures.mjs +4 -4
  9. package/agents/init/check.mjs +1 -1
  10. package/agents/init/index.mjs +52 -2
  11. package/agents/init/validate.mjs +16 -0
  12. package/agents/publish/publish-docs.mjs +16 -10
  13. package/agents/schema/document-execution-structure.yaml +1 -1
  14. package/agents/schema/document-structure-item.yaml +1 -1
  15. package/agents/schema/document-structure.yaml +4 -2
  16. package/agents/update/check-generate-diagram.mjs +74 -16
  17. package/agents/update/generate-document.yaml +1 -13
  18. package/agents/update/handle-document-update.yaml +1 -1
  19. package/agents/update/pre-check-generate-diagram.yaml +44 -0
  20. package/agents/update/update-document-detail.yaml +64 -58
  21. package/agents/update/update-single-document.yaml +1 -1
  22. package/agents/update/user-review-document.mjs +2 -1
  23. package/agents/utils/analyze-feedback-intent.yaml +29 -0
  24. package/agents/utils/choose-docs.mjs +16 -6
  25. package/agents/utils/find-item-by-path.mjs +4 -2
  26. package/agents/utils/load-sources.mjs +4 -4
  27. package/agents/utils/map-reasoning-effort-level.mjs +15 -0
  28. package/agents/utils/save-sidebar.mjs +12 -33
  29. package/agents/utils/{transform-detail-datasources.mjs → transform-detail-data-sources.mjs} +2 -2
  30. package/aigne.yaml +7 -3
  31. package/package.json +10 -9
  32. package/prompts/common/document/content-rules-core.md +5 -5
  33. package/prompts/common/document-structure/conflict-resolution-guidance.md +2 -2
  34. package/prompts/common/document-structure/document-structure-rules.md +8 -8
  35. package/prompts/common/document-structure/output-constraints.md +3 -3
  36. package/prompts/detail/custom/custom-code-block.md +36 -1
  37. package/prompts/detail/custom/{custom-components.md → custom-components-usage-rules.md} +29 -7
  38. package/prompts/detail/d2-diagram/pre-check.md +23 -0
  39. package/prompts/detail/d2-diagram/rules.md +42 -24
  40. package/prompts/detail/d2-diagram/user-prompt.md +0 -20
  41. package/prompts/detail/generate/document-rules.md +2 -2
  42. package/prompts/detail/generate/system-prompt.md +3 -3
  43. package/prompts/detail/generate/user-prompt.md +5 -5
  44. package/prompts/detail/update/system-prompt.md +4 -3
  45. package/prompts/detail/update/user-prompt.md +8 -4
  46. package/prompts/evaluate/document.md +0 -4
  47. package/prompts/structure/check-document-structure.md +4 -4
  48. package/prompts/structure/generate/system-prompt.md +0 -1
  49. package/prompts/structure/generate/user-prompt.md +14 -9
  50. package/prompts/structure/review/structure-review-system.md +5 -2
  51. package/prompts/structure/update/system-prompt.md +0 -13
  52. package/prompts/structure/update/user-prompt.md +6 -5
  53. package/prompts/translate/translate-document.md +3 -3
  54. package/prompts/utils/analyze-feedback-intent.md +55 -0
  55. package/utils/constants/index.mjs +38 -0
  56. package/utils/deploy.mjs +3 -1
  57. package/utils/docs-finder-utils.mjs +37 -3
  58. package/utils/file-utils.mjs +97 -0
  59. package/utils/load-config.mjs +19 -0
@@ -18,6 +18,11 @@ The following are the available enhanced attributes and their descriptions:
18
18
  * `language` and `title` are written directly after \`\`\`, separated by spaces.
19
19
  * Other attributes (`icon`) must be provided in **key=value** format, separated by spaces.
20
20
 
21
+ ### Special Rules
22
+ - If the language is a shell (includes `sh`, `bash`, `zsh`, etc.):
23
+ - Executable shell code blocks must be a single-line command to make copying and running easier.
24
+ - Do not include comments inside executable shell code blocks; place explanatory comments outside the code block.
25
+
21
26
  ### Examples
22
27
 
23
28
  <code_block_good_examples>
@@ -70,9 +75,26 @@ class ShoppingCart {
70
75
  }
71
76
  }
72
77
  ```
78
+
79
+ **Example 5: Shell code block should in one line**
80
+
81
+ ```sh Install aigne deps icon=lucide:terminal
82
+ npm i -g @aigne/cli @aigne/doc-smith @aigne/websmith-smith
83
+ ```
84
+
85
+ **Example 6: Shell code block use `\` to split multiple lines**
86
+ ```bash Deploying with Access Keys icon=lucide:terminal
87
+ blocklet deploy . \
88
+ --endpoint https://my-server.arcblock.io \
89
+ --access-key 'your_access_key_id' \
90
+ --access-secret 'your_access_key_secret' \
91
+ --app-id z2qa9sD2tFAP8gM7C1i8iETg3a1T3A3aT3bQ
92
+ ```
93
+
73
94
  </code_block_good_examples>
74
95
 
75
96
  <code_block_bad_examples>
97
+
76
98
  **Example 1**
77
99
 
78
100
  There are two errors in this example:
@@ -97,5 +119,18 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
97
119
  }
98
120
  ```
99
121
 
122
+ **Example 2: shell code block have multiple lines**
123
+ ```sh
124
+ npm i -g @aigne/cli
125
+ npm i -g @aigne/doc-smith
126
+ npm i -g @aigne/websmith-smith
127
+ ```
128
+
129
+ **Example 3: shell code block comments**
130
+ ```sh
131
+ # add aigne deps
132
+ npm i -g @aigne/cli
133
+ ```
134
+
100
135
  </code_block_bad_examples>
101
- </enhanced_code_block_rules>
136
+ </enhanced_code_block_rules>
@@ -1,4 +1,4 @@
1
- <custom_components_usage>
1
+ <custom_components_usage_rules>
2
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
3
 
4
4
  ## XCard: Individual link display card
@@ -48,11 +48,11 @@ Example 1: Inline Markdown formatting in card content
48
48
 
49
49
  Example 2: Code block inside card content
50
50
 
51
- ```md
51
+ ````md
52
52
  <x-card data-title="ctrl_break()" data-icon="lucide:keyboard">
53
53
  Creates a listener for "ctrl-break" events.
54
54
 
55
- \`\`\`rust
55
+ ```rust
56
56
  use tokio::signal::windows::ctrl_break;
57
57
 
58
58
  #[tokio::main]
@@ -62,10 +62,11 @@ stream.recv().await;
62
62
  println!("got ctrl-break");
63
63
  Ok(())
64
64
  }
65
- \`\`\`
66
- </x-card>
67
65
  ```
68
66
 
67
+ ````
68
+
69
+
69
70
  ## XCards: Multiple cards container
70
71
 
71
72
  Suitable for displaying multiple links using a card list format, providing a richer and more visually appealing presentation.
@@ -80,7 +81,7 @@ Suitable for displaying multiple links using a card list format, providing a ric
80
81
 
81
82
  ### Usage Rules
82
83
 
83
- - **Visual Consistency**: All <x-card> elements within the same <x-cards> must maintain visual consistency:
84
+ - **Visual Consistency**: All `<x-card>` elements within the same `<x-cards>` must maintain visual consistency:
84
85
  - It's recommended to always provide data-icon for each card.
85
86
  - Or all cards should have data-image.
86
87
  - Avoid mixing (some with icons, some with only images).
@@ -106,6 +107,18 @@ Example 2: Two-column cards with images
106
107
  </x-cards>
107
108
  ```
108
109
 
110
+ Example 3: Replace markdown format multiple links
111
+
112
+ ```md
113
+ For more detailed information on specific features, please refer to the following sections:
114
+
115
+ <x-cards data-columns="3">
116
+ <x-card data-title="Using Discussions" data-href="/discussions">Introduce how to use discussions</x-card>
117
+ <x-card data-title="Using the Blog" data-href="/blog">Introduce how to use the Blog</x-card>
118
+ <x-card data-title="Using Chat" data-href="/chat">Introduce how to use Chat</x-card>
119
+ </x-cards>
120
+ ```
121
+
109
122
  ### Bad Examples
110
123
 
111
124
  Example 1: Using a single-column layout (`data-columns="1"`) is not allowed
@@ -125,6 +138,15 @@ Example 2: Contains only one `<x-card>` (must include multiple cards)
125
138
  </x-cards>
126
139
  ```
127
140
 
141
+ Example 3: Markdown format multiple links
142
+
143
+ ```md
144
+ For more detailed information on specific features, please refer to the following sections:
145
+ - [Using Discussions](./discussions.md)
146
+ - [Using the Blog](./blog.md)
147
+ - [Using Chat](./chat.md)
148
+ ```
149
+
128
150
  ## XField: Structured data field
129
151
 
130
152
  Suitable for displaying API parameters, return values, context data, and any structured data with metadata in a clean, organized format. Supports nested structures for complex data types.
@@ -517,4 +539,4 @@ Example 6: Missing blank line before x-field-group (violates "Spacing Around" ru
517
539
  </x-field-group>
518
540
  ```
519
541
 
520
- </custom_components_usage>
542
+ </custom_components_usage_rules>
@@ -0,0 +1,23 @@
1
+ <document_content>
2
+ {{documentContent}}
3
+ </document_content>
4
+
5
+ {% if feedback %}
6
+ <feedback>
7
+ {{feedback}}
8
+ </feedback>
9
+ {% endif %}
10
+
11
+ {% if detailFeedback %}
12
+ <content_review_feedback>
13
+ {{ detailFeedback }}
14
+ </content_review_feedback>
15
+ {% endif %}
16
+
17
+ {% if previousGenerationContent %}
18
+ <previous_generation_content>
19
+ {{ previousGenerationContent }}
20
+ </previous_generation_content>
21
+ {% endif %}
22
+
23
+ {% include "./rules.md" %}
@@ -1,26 +1,44 @@
1
1
  <diagram_generation_rules>
2
- **Generation Workflow**
3
- 1. Use the current `<detail_dataSource>`, `<content_review_feedback>`, and `<feedback>` to decide whether this document requires a diagram.
4
- 2. When a diagram is needed, call the `generateDiagram` tool to create it and insert the returned content at the most fitting location in the document.
5
- 3. Check whether the data sources include `diagramSourceCode`. If not, remove any embedded diagram from the document.
6
-
7
- **Generation Result Usage**
8
- When `diagramSourceCode` is available, insert it into the document exactly as returned without any edits.
9
-
10
- **Generation Requirements**
11
- 1. Diagram Triggers and Types: Call `generateDiagram` and select the most appropriate type when describing the following specific content
12
- - Architecture Diagram (High-Level)
13
- - **Trigger**: When the document provides a high-level overview of a system, project, or the overall documentation set.
14
- - **Content**: Must illustrate the main components, their relationships, and the overall structure.
15
- - Structural Diagram (Module-Level)
16
- - **Trigger**: When generating the introductory document for a major section or module.
17
- - **Content**: Must show the key sub-components, files, or core concepts within that specific module.
18
- - Process and Interaction Diagrams (Detailed)
19
- - **Trigger**: When the document describes a workflow, a sequence of events, user interactions, or data flow.
20
- - **Diagram Type Selection**:
21
- - **Flowchart**: Use for step-by-step processes, algorithms, or decision-making logic.
22
- - **Sequence Diagram**: Use for time-ordered interactions between different components or actors (e.g., API calls).
23
- 2. Constraints and Best Practices
24
- - **Quantity Limit**: Generate a maximum of **three** diagrams per document.
25
- - **Relevance**: Ensure every diagram **directly** illustrates a concept explained in the surrounding text. Avoid generating diagrams for simple concepts that are easily understood through text alone.
2
+
3
+ You must analyze the provided inputs to determine if a diagram is needed and where to insert a placeholder. You must not generate the diagram itself (e.g., no Mermaid, PlantUML, or other code). You are only deciding and placing the placeholder.
4
+
5
+ ## Inputs
6
+
7
+ - `<document_content>`: The main body of text to be evaluated.
8
+ - `<previous_generation_content>`: The content from the previous run, which may contain DIAGRAM_PLACEHOLDER.
9
+ - `<feedback>`: Specific user instructions for this run (e.g., "add a diagram," "remove the diagram").
10
+ - `<content_review_feedback>`: General automated or human feedback on the content.
11
+
12
+ ## Scoring conditions
13
+
14
+ - `add`: If `<feedback>` explicitly requests to add a diagram, ignore other conditions, +30000
15
+ - `remove`: If `<feedback>` explicitly requests to remove a diagram, ignore other conditions, -30000
16
+ - `previous-exists`: If `<previous_generation_content>` contains diagram, +21000
17
+ - `path-exclude`: If the document path or filename matches excluded patterns (e.g., `/faq/`, `CHANGELOG`, `release-notes`), -10000
18
+ - `less-words`: If document length <= 200 words AND less than 2 headings, -10000
19
+ - `overview`: If `<document_content>` provides a high-level overview, +3
20
+ - `architectural`: If `<document_content>` contains an architectural description (components/services/layers/modules), +3
21
+ - `workflow`: If `<document_content>` describes a workflow, sequence, user interactions, or data flow, +2
22
+ - `hierarchy`: If `<document_content>` describes a clear hierarchy (linked sub-docs / deeply nested sections), +1
23
+ - `introductory-major`: If `<document_content>` is an introductory page for a major section, +1
24
+
25
+ ## Output Requirements
26
+ - `details` is an array. Each element must include:
27
+ - `type`: matched scoring condition's type name
28
+ - `score`: matched scoring condition's score
29
+ - `reason`: text explaining why this scoring condition is matched
30
+ - `content`: `<document_content>` with placeholder inserted
31
+ - Identify the most logical insertion point in the `<document_content>`. (This is often after an introductory paragraph or before a list/section that the diagram will explain).
32
+ - Insert the exact placeholder string: DIAGRAM_PLACEHOLDER
33
+ - Crucially: Adjust the surrounding text to integrate the placeholder smoothly. Add a lead-in sentence.
34
+ - Good example: "The following diagram illustrates this data flow:"
35
+ - Good example: "This architecture is shown in the overview below:"
36
+ - Bad example: (Just inserting the placeholder with no context).
37
+ - Return the modified document content.
38
+ - Keep the original structure of the document, including page headings and hierarchy
39
+ - Only modify parts of the document text to improve the alignment between diagrams and their context
40
+ - The output must not include the `document_content` tag
41
+ - Do not provide any explanations; include only the document content itself
42
+
26
43
  </diagram_generation_rules>
44
+
@@ -12,26 +12,6 @@ Generate a d2 diagram that represents the following document content:
12
12
 
13
13
  </user_rules>
14
14
 
15
- <diagram_rules>
16
-
17
- 1. Diagram Triggers and Types: Select the most appropriate type when describing the following specific content
18
- - Architecture Diagram (High-Level)
19
- - **Trigger**: When the document provides a high-level overview of a system, project, or the overall documentation set.
20
- - **Content**: Must illustrate the main components, their relationships, and the overall structure.
21
- - Structural Diagram (Module-Level)
22
- - **Trigger**: When generating the introductory document for a major section or module.
23
- - **Content**: Must show the key sub-components, files, or core concepts within that specific module.
24
- - Process and Interaction Diagrams (Detailed)
25
- - **Trigger**: When the document describes a workflow, a sequence of events, user interactions, or data flow.
26
- - **Diagram Type Selection**:
27
- - **Flowchart**: Use for step-by-step processes, algorithms, or decision-making logic.
28
- - **Sequence Diagram**: Use for time-ordered interactions between different components or actors (e.g., API calls).
29
- 2. Constraints and Best Practices
30
- - **Keep it Simple**: Avoid overcomplicating the diagram.
31
- - **Relevance**: Ensure every diagram **directly** illustrates a concept explained in the surrounding text. Avoid generating diagrams for simple concepts that are easily understood through text alone.
32
-
33
- </diagram_rules>
34
-
35
15
  <document_content>
36
16
  {{documentContent}}
37
17
  </document_content>
@@ -28,7 +28,7 @@ Documentation Generation Rules:
28
28
 
29
29
  </document_rules>
30
30
 
31
- <TONE_STYLE>
31
+ <tone_style>
32
32
  - Documentation should be plain, rigorous and accurate, avoiding grandiose or empty vocabulary
33
33
  - You are writing for humans, not algorithms
34
34
  - Clarity and Flow
@@ -41,4 +41,4 @@ Documentation Generation Rules:
41
41
  - Use contractions and idioms sparingly to maintain an informal, yet credible tone
42
42
  - Blend technical precision with relatable language
43
43
  - Be direct: say what happened, why it matters, and how it helps
44
- </TONE_STYLE>
44
+ </tone_style>
@@ -37,14 +37,14 @@ Glossary of specialized terms. Please ensure correct spelling when using these t
37
37
  Documentation content generation rules:
38
38
  {% include "./document-rules.md" %}
39
39
 
40
- Custom component generation rules:
41
- {% include "../custom/custom-components.md" %}
40
+ {% include "../custom/custom-components-usage-rules.md" %}
42
41
 
43
42
  Custom code block generation rules:
44
43
  {% include "../custom/custom-code-block.md" %}
45
44
 
46
45
  {% include "../../common/document/media-file-list-usage-rules.md" %}
47
46
 
47
+
48
48
  </content_generation_rules>
49
49
 
50
50
 
@@ -52,7 +52,7 @@ Custom code block generation rules:
52
52
  <output_constraints>
53
53
 
54
54
  1. Output the complete Markdown content for {{nodeName}}, only the content itself—no explanations or extra information.
55
- 2. Follow the format, structure, tone, and level of detail shown in the examples, strictly adhering to <document_rules>, <content_generation_rules>, and <TONE_STYLE>.
55
+ 2. Follow the format, structure, tone, and level of detail shown in the examples, strictly adhering to `<document_rules>`, `<content_generation_rules>`, and `<tone_style>`.
56
56
  3. Output in {{locale}} language, ensuring clarity, conciseness, and well-organized structure.
57
57
  4. Do not include any self-introduction or conversational text. Output only the documentation content itself.
58
58
 
@@ -7,24 +7,24 @@
7
7
 
8
8
  ** Output content in {{ locale }} language. **
9
9
 
10
- ** Don't generate any diagram in the document, give boolean value in `needDiagram` field & plan a placeholder in document content for diagram (use `DIAGRAM_PLACEHOLDER` as placeholder text). **
11
10
 
12
- - **Necessary**: Generate diagrams only when necessary.
13
11
  </user_rules>
14
12
 
15
13
  {% set operation_type = "generating" %}
16
14
  {% include "../../common/document/user-preferences.md" %}
17
15
 
18
- <detail_dataSource>
16
+ <detail_data_source>
19
17
  {{ detailDataSource }}
20
18
 
21
19
  {{ additionalInformation }}
22
20
 
21
+ {% if assetsContent %}
23
22
  <media_file_list>
24
23
  {{ assetsContent }}
25
24
  </media_file_list>
25
+ {% endif %}
26
26
 
27
- </detail_dataSource>
27
+ </detail_data_source>
28
28
 
29
29
 
30
30
  {% include "../../common/document/openapi-usage-rules.md" %}
@@ -51,7 +51,7 @@ User feedback on previous generation:
51
51
  {% endif %}
52
52
 
53
53
  <instructions>
54
- Generate detailed and well-structured document for the current {{nodeName}} based on user-provided information: current {{nodeName}} details (including title, description, path), detailDataSource, documentStructure (overall structural planning), and other relevant information.
54
+ Generate detailed and well-structured document for the current {{nodeName}} based on user-provided information: current {{nodeName}} details (including title, description, path), `<detail_data_source>`, `<document_structure>` (overall structural planning), and other relevant information.
55
55
 
56
56
  <steps>
57
57
  1. Analyze the provided document structure and user requirements to plan the content.
@@ -32,14 +32,15 @@ Glossary of specialized terms. Please ensure correct spelling when using these t
32
32
  Documentation content optimization rules:
33
33
  {% include "../generate/document-rules.md" %}
34
34
 
35
- Custom component optimization rules:
36
- {% include "../custom/custom-components.md" %}
35
+ {% include "../custom/custom-components-usage-rules.md" %}
37
36
 
38
37
  Custom code block optimization rules:
39
38
  {% include "../custom/custom-code-block.md" %}
40
39
 
41
40
  {% include "../../common/document/media-file-list-usage-rules.md" %}
42
41
 
42
+ {% include "../d2-diagram/rules.md" %}
43
+
43
44
  </content_optimization_rules>
44
45
 
45
46
 
@@ -91,7 +92,7 @@ Tool usage guidelines:
91
92
  **updateDocumentContent**: Use this tool to apply changes to the document content
92
93
  - Generate a precise unified diff patch based on the user feedback
93
94
  - The diff should include context lines for accurate application
94
- - Only consider content within <page_content> tag when calculating line numbers, ensure line number calculation is accurate
95
+ - Only consider content within `<page_content>` tag when calculating line numbers, ensure line number calculation is accurate
95
96
  - Test the patch application to ensure it works correctly
96
97
 
97
98
  Error handling:
@@ -11,21 +11,25 @@
11
11
  {% set operation_type = "optimizing" %}
12
12
  {% include "../../common/document/user-preferences.md" %}
13
13
 
14
- <original_page_content>
14
+ <original_document_content>
15
15
  {{originalContent}}
16
- </original_page_content>
16
+ </original_document_content>
17
17
 
18
- <detail_dataSource>
18
+ {% if needDataSources %}
19
+ <detail_data_source>
19
20
 
20
21
  {{ detailDataSource }}
21
22
 
22
23
  {{ additionalInformation }}
23
24
 
25
+ {% if assetsContent %}
24
26
  <media_file_list>
25
27
  {{ assetsContent }}
26
28
  </media_file_list>
29
+ {% endif %}
27
30
 
28
- </detail_dataSource>
31
+ </detail_data_source>
32
+ {% endif %}
29
33
 
30
34
  <user_feedback>
31
35
  {{feedback}}
@@ -21,10 +21,6 @@ Please **strictly adhere** to the evaluation standards defined in `<standards>`
21
21
  {{ content }}
22
22
  </document_content>
23
23
 
24
- <document_translation>
25
- {{ translationsString }}
26
- </document_translation>
27
-
28
24
  <document_content_plan>
29
25
  {{ description }}
30
26
  </document_content_plan>
@@ -38,9 +38,9 @@ This is the primary scenario. You must perform a detailed comparison.
38
38
 
39
39
  **Step-by-step Analysis**:
40
40
  1. **Analyze Feedback**: Carefully read and understand each change request in the user feedback. Identify which nodes need to be modified, added, or deleted.
41
- 2. **Verify Feedback Implementation**: Confirm that all requested changes have been executed in `document_structure`. For example, if feedback requests "remove the 'Examples' section," you must verify that this section no longer exists in `document_structure`.
42
- 3. **Verify Unrelated Node Stability**: This is the most critical check. Iterate through all nodes in `document_structure`. For each node that exists in `original_document_structure` but was not mentioned in the feedback:
43
- * **Critical**: Its `path` and `sourcesIds` attributes **must** be identical to those in `original_document_structure`.
41
+ 2. **Verify Feedback Implementation**: Confirm that all requested changes have been executed in `<document_structure>`. For example, if feedback requests "remove the 'Examples' section," you must verify that this section no longer exists in `<document_structure>`.
42
+ 3. **Verify Unrelated Node Stability**: This is the most critical check. Iterate through all nodes in `<document_structure>`. For each node that exists in `<original_document_structure>` but was not mentioned in the feedback:
43
+ * **Critical**: Its `path` and `sourcesIds` attributes **must** be identical to those in `<original_document_structure>`.
44
44
  * 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.
45
45
  </quality_control_rules>
46
46
 
@@ -90,4 +90,4 @@ Your output must be a valid JSON object containing `isValid` and `reason`, retur
90
90
  "reason": "Initial documentation structure generation with no previous version for comparison."
91
91
  }
92
92
  ```
93
- </output_constraints>
93
+ </output_constraints>
@@ -7,7 +7,6 @@ You are an AI document strategist with the personality of an **INTJ (The Archite
7
7
  {% include "../../common/document-structure/glossary.md" %}
8
8
 
9
9
 
10
-
11
10
  {% include "../../common/document-structure/document-structure-rules.md" %}
12
11
 
13
12
 
@@ -1,11 +1,11 @@
1
- <datasources>
1
+ <data_sources>
2
2
  Following are the partial or complete data sources provided by the user to help you design the document structure. Use these data sources to inform your structural planning.
3
3
 
4
- {{ datasources }}
4
+ {{ dataSourceChunk }}
5
5
 
6
6
 
7
7
  NOTICE: There are additional data source contents not displayed. When operating on the document structure, be sure to consider these undisplayed contents and do not easily delete any nodes unless users explicitly request deletion.
8
- </datasources>
8
+ </data_sources>
9
9
 
10
10
  {% if userContext.openAPISpec %}
11
11
  <openapi>
@@ -41,17 +41,22 @@ NOTICE: There are additional data source contents not displayed. When operating
41
41
  </openapi>
42
42
  {% endif %}
43
43
 
44
-
45
- <last_document_structure>
44
+ <document_info>
46
45
  projectName: |
47
46
  {{projectName}}
47
+ {% if projectDesc %}
48
48
  projectDesc: |
49
49
  {{projectDesc}}
50
+ {% endif %}
51
+ </document_info>
52
+
53
+ <last_document_structure>
50
54
 
51
55
  {% if originalDocumentStructure %}
52
56
  {{ originalDocumentStructure | yaml.stringify }}
53
57
  {% elseif userContext.originalDocumentStructure %}
54
58
  {{ userContext.originalDocumentStructure | yaml.stringify }}
59
+ {% else %}
55
60
  No previous document structure provided. generate a new structure based on the data sources!
56
61
  {% endif %}
57
62
 
@@ -96,7 +101,7 @@ The current process is planning sub-structures for the following section:
96
101
  {{parentDocument}}
97
102
 
98
103
  Sub-structures must meet the following requirements:
99
- - Sub-structures are planned based on DataSources and the parent document's description
104
+ - Sub-structures are planned based on `<data_sources>` and the parent document's description
100
105
  - The parent document provides an overview of the planned content, while sub-structures directly plan the specific content to be displayed
101
106
  - Further break down and comprehensively display the content planned in the parent document
102
107
  - All sub-structures must have their parentPath value set to {{parentDocument.path}}
@@ -107,7 +112,7 @@ Sub-structures must meet the following requirements:
107
112
  Your task is to **analyze, refine, and adjust** the existing document structure (`last_document_structure`) based on the partial code repository content currently provided, generating a structural update plan.
108
113
  You are not creating a structure from scratch, but rather **performing intelligent updates based on understanding the existing structure** to make the document structure more accurately reflect the latest code content, architectural changes, and logical relationships.
109
114
 
110
- ## When using <datasource> data sources, please note the following:
115
+ ## When using `<data_sources>` data sources, please note the following:
111
116
 
112
117
  - Fully respect the project descriptions and usage instructions in README files, as these typically summarize the project's core functionality and objectives.
113
118
  - Pay attention to comments and docstrings in source code files, as these reveal the design intent and usage methods of the code.
@@ -127,7 +132,7 @@ IMPORTANT: You should avoid duplicating existing structure items. Only include i
127
132
  ## Behavior Rules
128
133
 
129
134
  1. **Understanding and Inheritance**
130
- - Fully understand the hierarchical logic, section divisions, and naming style in <last_document_structure>.
135
+ - Fully understand the hierarchical logic, section divisions, and naming style in `<last_document_structure>`.
131
136
  - Perform incremental updates based on this foundation, not complete rewrites.
132
137
  - Preserve existing reasonable structures, only modify or extend when there is clear justification.
133
138
 
@@ -148,7 +153,7 @@ IMPORTANT: You should avoid duplicating existing structure items. Only include i
148
153
  - Maintain clear hierarchy, avoid duplication, ensure logical coherence. Excellent documentation should allow users to quickly understand project structure and content distribution, organized by modules, functional features, and other dimensions.
149
154
 
150
155
  5. **Requirements**
151
- - Follow all rules and guidelines in <document_structure_rules>.
156
+ - Follow all rules and guidelines in `<document_structure_rules>`.
152
157
  - Generate rich document structure where functional modules must have sub-documents, comprehensively covering the codebase's functionality and modules, ensuring users can easily get started, understand, and use various modules and main features of the project through documentation.
153
158
 
154
159
  {% include "../../common/document-structure/intj-traits.md" %}
@@ -2,13 +2,16 @@
2
2
  You are a **Documentation Structure Refiner** with the analytical mindset of an **INTJ (The Architect)**. You combine expert knowledge in technical documentation architecture and information design with strategic thinking, systematic analysis, and perfectionist attention to detail. Your core strengths are understanding complex systems, creating logically sound blueprints, and anticipating future documentation challenges.
3
3
  </role_and_goal>
4
4
 
5
- <document_structure>
5
+ <document_info>
6
6
  projectName: |
7
7
  {{projectName}}
8
+ {% if projectDesc %}
8
9
  projectDesc: |
9
10
  {{projectDesc}}
11
+ {% endif %}
12
+ </document_info>
10
13
 
11
- documentStructure:
14
+ <document_structure>
12
15
  {{ documentStructure | yaml.stringify }}
13
16
  </document_structure>
14
17
 
@@ -90,17 +90,4 @@ Analyze the user feedback to determine the intended operation:
90
90
  </operation_output_constraints>
91
91
  </operation_execution_rules>
92
92
 
93
- <file_tool_usage>
94
- 1. glob: Find files matching specific patterns with advanced filtering and sorting.
95
-
96
- 2. grep: Search file contents using regular expressions with multiple strategies (git grep → system grep → JavaScript fallback).
97
-
98
- 3. readFile: Read file contents with intelligent binary detection, pagination, and metadata extraction.
99
-
100
- When to use Tools:
101
- - During document structure update, if the given context is missing or lacks referenced content, use glob/grep/readFile to obtain more context
102
- - When sourceIds or file content from <file_list> is needed but not provided in DataSources, use readFile to read the file content
103
- </file_tool_usage>
104
-
105
-
106
93
  {% include "../../common/document-structure/output-constraints.md" %}
@@ -6,10 +6,11 @@
6
6
  {{allFilesPaths}}
7
7
  </file_list>
8
8
 
9
- <datasources>
10
- {{ datasources }}
11
- </datasources>
12
-
9
+ {% if needDataSources %}
10
+ <data_sources>
11
+ {{ dataSourceChunk }}
12
+ </data_sources>
13
+ {% endif %}
13
14
 
14
15
  Initial Documentation Structure:
15
16
  <initial_document_structure>
@@ -38,5 +39,5 @@ Processing workflow:
38
39
 
39
40
  Rules:
40
41
  ** All changes must be made using Tools. **
41
- ** Carefully check if the latest version of documentStructure data meets user requirements, must avoid duplicate Tool calls. **
42
+ ** Carefully check if the latest version of `<document_structure>` data meets user requirements, must avoid duplicate Tool calls. **
42
43
  </instructions>
@@ -5,10 +5,10 @@ You are an **Elite Polyglot Localization and Translation Specialist** with exten
5
5
  Core Mandates:
6
6
 
7
7
  1. Semantic Fidelity (Accuracy): The translation must perfectly and comprehensively convey the **entire meaning, tone, and nuance** of the source text. **No omission, addition, or distortion of the original content** is permitted.
8
- 2. Native Fluency and Style: The resulting text must adhere strictly to the target language's **grammar, syntax, and idiomatic expressions**. The translation must **sound like it was originally written by a native speaker**, completely **free of grammatical errors** or "translationese" (literal, stiff, or unnatural phrasing).
8
+ 2. Native Fluency and Style: The resulting text must adhere strictly to the target language's **grammar, syntax, and idiomatic expressions**. The translation must **sound like it was originally written by a native speaker**, completely **free of grammatical errors**, avoid "translationese" (literal, stiff, or unnatural phrasing).
9
9
  3. Readability and Flow: The final output must be **smooth, logical, and highly readable**. Sentences must flow naturally, ensuring a pleasant and coherent reading experience for the target audience.
10
10
  4. Localization and Clarity: Where a **literal (word-for-word) translation** of a term, phrase, or idiom would be **uncommon, confusing, or ambiguous** in the target language, you must apply **localization best practices**. This means translating the **concept** into the most **idiomatic, common, and easily understandable expression** in the target language.
11
- 5. Versatility and Scope: You are proficient in handling **any pair of requested languages** (e.g., Chinese $\leftrightarrow$ English, English $\leftrightarrow$ Japanese) and are adept at translating diverse **document types**, including but not limited to: **Technical Manuals, Business Reports, Marketing Copy/Ads, Legal Documents, Academic Papers, and General Correspondence.**
11
+ 5. Versatility and Scope: You are proficient in handling **any pair of requested languages** (e.g., Chinese <--> English, English <--> Japanese) and are adept at translating diverse **document types**, including but not limited to: **Technical Manuals, Business Reports, Marketing Copy/Ads, Legal Documents, Academic Papers, and General Correspondence.**
12
12
 
13
13
  </role_and_goal>
14
14
 
@@ -299,5 +299,5 @@ Original text as follows:
299
299
  </content>
300
300
 
301
301
  <output_constraints>
302
- Please **accurately** translate the content within <content> tags (excluding the outermost <content> tags) into **{{ language }}**, strictly following the translation requirements.
302
+ Please **accurately** translate the content within `<content>` tags (excluding the outermost `<content>` tags) into **{{ language }}**, strictly following the translation requirements.
303
303
  </output_constraints>