@aigne/doc-smith 0.8.11-beta.6 → 0.8.11

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 (116) hide show
  1. package/.aigne/doc-smith/config.yaml +2 -0
  2. package/.aigne/doc-smith/output/structure-plan.json +2 -2
  3. package/.aigne/doc-smith/preferences.yml +28 -20
  4. package/.aigne/doc-smith/upload-cache.yaml +702 -0
  5. package/.release-please-manifest.json +1 -1
  6. package/CHANGELOG.md +20 -0
  7. package/README.md +1 -1
  8. package/agents/generate/document-structure-tools/add-document.mjs +35 -10
  9. package/agents/generate/document-structure-tools/delete-document.mjs +35 -12
  10. package/agents/generate/document-structure-tools/move-document.mjs +43 -17
  11. package/agents/generate/document-structure-tools/update-document.mjs +37 -10
  12. package/agents/generate/update-document-structure.yaml +1 -7
  13. package/agents/generate/user-review-document-structure.mjs +5 -4
  14. package/agents/translate/translate-document.yaml +1 -9
  15. package/agents/update/check-update-is-single.mjs +2 -1
  16. package/agents/update/document-tools/update-document-content.mjs +24 -14
  17. package/agents/update/fs-tools/glob.mjs +184 -0
  18. package/agents/update/fs-tools/grep.mjs +317 -0
  19. package/agents/update/fs-tools/read-file.mjs +307 -0
  20. package/agents/update/generate-document.yaml +4 -7
  21. package/agents/update/update-document-detail.yaml +6 -10
  22. package/agents/update/user-review-document.mjs +13 -13
  23. package/assets/screenshots/doc-complete-setup.png +0 -0
  24. package/assets/screenshots/doc-generate-docs.png +0 -0
  25. package/assets/screenshots/doc-generate.png +0 -0
  26. package/assets/screenshots/doc-generated-successfully.png +0 -0
  27. package/assets/screenshots/doc-publish.png +0 -0
  28. package/assets/screenshots/doc-regenerate.png +0 -0
  29. package/assets/screenshots/doc-translate-langs.png +0 -0
  30. package/assets/screenshots/doc-translate.png +0 -0
  31. package/assets/screenshots/doc-update.png +0 -0
  32. package/docs/advanced-how-it-works.ja.md +31 -31
  33. package/docs/advanced-how-it-works.md +9 -9
  34. package/docs/advanced-how-it-works.zh-TW.md +24 -24
  35. package/docs/advanced-how-it-works.zh.md +20 -20
  36. package/docs/advanced-quality-assurance.ja.md +57 -61
  37. package/docs/advanced-quality-assurance.md +57 -61
  38. package/docs/advanced-quality-assurance.zh-TW.md +57 -61
  39. package/docs/advanced-quality-assurance.zh.md +57 -61
  40. package/docs/advanced.ja.md +8 -4
  41. package/docs/advanced.md +7 -3
  42. package/docs/advanced.zh-TW.md +9 -5
  43. package/docs/advanced.zh.md +9 -5
  44. package/docs/changelog.ja.md +206 -29
  45. package/docs/changelog.md +177 -0
  46. package/docs/changelog.zh-TW.md +229 -52
  47. package/docs/changelog.zh.md +204 -27
  48. package/docs/cli-reference.ja.md +82 -52
  49. package/docs/cli-reference.md +56 -26
  50. package/docs/cli-reference.zh-TW.md +82 -52
  51. package/docs/cli-reference.zh.md +70 -40
  52. package/docs/configuration-interactive-setup.ja.md +45 -42
  53. package/docs/configuration-interactive-setup.md +8 -5
  54. package/docs/configuration-interactive-setup.zh-TW.md +26 -23
  55. package/docs/configuration-interactive-setup.zh.md +25 -22
  56. package/docs/configuration-language-support.ja.md +33 -63
  57. package/docs/configuration-language-support.md +32 -62
  58. package/docs/configuration-language-support.zh-TW.md +35 -65
  59. package/docs/configuration-language-support.zh.md +32 -62
  60. package/docs/configuration-llm-setup.ja.md +25 -23
  61. package/docs/configuration-llm-setup.md +20 -18
  62. package/docs/configuration-llm-setup.zh-TW.md +21 -19
  63. package/docs/configuration-llm-setup.zh.md +20 -18
  64. package/docs/configuration-preferences.ja.md +67 -52
  65. package/docs/configuration-preferences.md +56 -41
  66. package/docs/configuration-preferences.zh-TW.md +69 -54
  67. package/docs/configuration-preferences.zh.md +68 -53
  68. package/docs/configuration.ja.md +65 -81
  69. package/docs/configuration.md +19 -35
  70. package/docs/configuration.zh-TW.md +62 -79
  71. package/docs/configuration.zh.md +50 -67
  72. package/docs/features-generate-documentation.ja.md +44 -69
  73. package/docs/features-generate-documentation.md +36 -61
  74. package/docs/features-generate-documentation.zh-TW.md +42 -67
  75. package/docs/features-generate-documentation.zh.md +41 -67
  76. package/docs/features-publish-your-docs.ja.md +36 -36
  77. package/docs/features-publish-your-docs.md +2 -2
  78. package/docs/features-publish-your-docs.zh-TW.md +21 -21
  79. package/docs/features-publish-your-docs.zh.md +23 -23
  80. package/docs/features-translate-documentation.ja.md +40 -31
  81. package/docs/features-translate-documentation.md +15 -6
  82. package/docs/features-translate-documentation.zh-TW.md +37 -28
  83. package/docs/features-translate-documentation.zh.md +23 -14
  84. package/docs/features-update-and-refine.ja.md +68 -118
  85. package/docs/features-update-and-refine.md +58 -108
  86. package/docs/features-update-and-refine.zh-TW.md +67 -116
  87. package/docs/features-update-and-refine.zh.md +64 -114
  88. package/docs/features.ja.md +29 -19
  89. package/docs/features.md +25 -15
  90. package/docs/features.zh-TW.md +28 -18
  91. package/docs/features.zh.md +31 -21
  92. package/docs/getting-started.ja.md +40 -43
  93. package/docs/getting-started.md +36 -39
  94. package/docs/getting-started.zh-TW.md +38 -41
  95. package/docs/getting-started.zh.md +45 -48
  96. package/docs/overview.ja.md +63 -11
  97. package/docs/overview.md +60 -8
  98. package/docs/overview.zh-TW.md +67 -15
  99. package/docs/overview.zh.md +62 -10
  100. package/media.md +9 -9
  101. package/package.json +1 -1
  102. package/prompts/detail/custom/custom-components.md +304 -188
  103. package/prompts/detail/document-rules.md +4 -4
  104. package/prompts/detail/generate-document.md +21 -8
  105. package/prompts/detail/update-document.md +8 -12
  106. package/prompts/structure/update-document-structure.md +12 -8
  107. package/prompts/utils/feedback-refiner.md +3 -3
  108. package/tests/agents/generate/document-structure-tools/move-document.test.mjs +9 -9
  109. package/tests/agents/generate/user-review-document-structure.test.mjs +29 -8
  110. package/tests/agents/update/document-tools/update-document-content.test.mjs +115 -112
  111. package/tests/agents/update/fs-tools/glob.test.mjs +438 -0
  112. package/tests/agents/update/fs-tools/grep.test.mjs +279 -0
  113. package/tests/agents/update/fs-tools/read-file.test.mjs +553 -0
  114. package/tests/agents/update/user-review-document.test.mjs +48 -27
  115. package/types/document-schema.mjs +5 -6
  116. package/types/document-structure-schema.mjs +20 -8
@@ -1,275 +1,391 @@
1
1
  <custom_components_usage>
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
  - `<x-card>`
4
5
  - `<x-cards>`
5
6
  - `<x-field>`
7
+ - `<x-field-desc>`
8
+ - `<x-field-group>`
6
9
 
10
+ ## `<x-card>` Single Card Component
7
11
 
8
- ### 1. <x-card> Single Card Component
9
12
  Suitable for displaying individual links with a richer and more visually appealing presentation format.
10
13
 
11
- Example:
14
+ ### Syntax Rules
15
+
16
+ Attributes:
17
+
18
+ - `data-title` (required): Card title.
19
+ - `data-icon` (optional): Icon identifier (e.g., lucide:icon-name or material-symbols:rocket-outline).
20
+ - Icons should prioritize Lucide (lucide:icon-name). If not available in Lucide, use Iconify (collection:icon-name, e.g., material-symbols:rocket-outline).
21
+ - `data-image` (optional): Image URL, can coexist with icon.
22
+ - **Requirement**: At least one of `data-icon` or `data-image` must be provided.
23
+ - It's recommended to always provide data-icon.
24
+ - `data-href` (optional): Navigation link for clicking the card or button.
25
+ - `data-horizontal` (optional): Whether to use horizontal layout.
26
+ - `data-cta` (optional): Button text (call to action).
27
+
28
+ Body content:
29
+
30
+ - Must be written within `<x-card>...</x-card>` children.
31
+ - must be **plain text only**. Any markdown formatting will cause rendering errors and must be avoided.
32
+
33
+ ### Examples
34
+
35
+ <card_good_examples>
36
+ Example 1: Basic card with icon and description
37
+
38
+ ```
39
+ <x-card data-title="alarm()" data-icon="lucide:alarm-clock"> SIGALRM: Sent when a real-time timer has expired. </x-card>
40
+ ```
41
+
42
+ Example 2: Horizontal card layout
12
43
 
13
44
  ```
14
- <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" >
15
- Card body content
45
+ <x-card data-title="Horizontal card" data-icon="lucide:atom" data-horizontal="true">
46
+ This is an example of a horizontal card.
16
47
  </x-card>
17
48
  ```
18
49
 
19
- Attribute Rules:
50
+ </card_good_examples>
20
51
 
21
- - data-title (required): Card title.
22
- - data-icon / data-image (choose one, at least one must be provided):
23
- - It's recommended to always provide data-icon.
24
- - Icons should prioritize Lucide (lucide:icon-name). If not available in Lucide, use Iconify (collection:icon-name, e.g., material-symbols:rocket-outline).
25
- - data-image (optional): Image URL, can coexist with icon.
26
- - data-href (optional): Navigation link for clicking the card or button.
27
- - data-horizontal (optional): Whether to use horizontal layout.
28
- - data-cta (optional): Button text (call to action).
29
- - Body content:
30
- - Must be written within <x-card>...</x-card> children.
31
- - **Markdown format rendering is not supported**
32
- - **Code block rendering is not supported**
33
- - Only supports plain text format without styling
52
+ <card_bad_examples>
53
+ Example 1: Markdown formatting in card content
34
54
 
55
+ ```
56
+ <x-card data-title="alarm()" data-icon="lucide:alarm-clock"> `SIGALRM`: Sent when a real-time timer has expired. </x-card>
57
+ ```
35
58
 
36
- ### 2. `<x-field>` Structured Field Component
59
+ Example 2: Code block inside card content
37
60
 
38
- 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.
61
+ ```
62
+ <x-card data-title="ctrl_break()" data-icon="lucide:keyboard">
63
+ Creates a listener for "ctrl-break" events.
64
+
65
+ \`\`\`rust
66
+ use tokio::signal::windows::ctrl_break;
67
+
68
+ #[tokio::main]
69
+ async fn main() -> std::io::Result<()> {
70
+ let mut stream = ctrl_break()?;
71
+ stream.recv().await;
72
+ println!("got ctrl-break");
73
+ Ok(())
74
+ }
75
+ \`\`\`
76
+ </x-card>
77
+ ```
39
78
 
40
- ### 2.1. `<x-field-group>` Field Group Component
79
+ </card_bad_examples>
41
80
 
42
- Used to group multiple related `<x-field>` elements at the top level, indicating they belong to the same object or context. This provides better organization and visual grouping for related parameters.
81
+ ## `<x-cards>` Card List Component
43
82
 
44
- Syntax:
83
+ Suitable for displaying multiple links using a card list format, providing a richer and more visually appealing presentation.
45
84
 
46
- ```
47
- <x-field-group>
48
- <x-field data-name="field1" data-type="string" data-desc="First field description"></x-field>
49
- <x-field data-name="field2" data-type="number" data-desc="Second field description"></x-field>
50
- <x-field data-name="field3" data-type="boolean" data-desc="Third field description"></x-field>
51
- </x-field-group>
52
- ```
85
+ ### Syntax Rules
53
86
 
54
- Attribute Rules:
87
+ Attributes:
55
88
 
56
- - No attributes required
57
- - Must contain multiple `<x-field>` elements
58
- - Only `<x-field>` elements are allowed as children
59
- - Cannot be nested inside other `<x-field>` or `<x-field-group>` elements
60
- - Used only at the top level for grouping related fields
89
+ - data-columns (optional): Number of columns, integer (e.g., 2, 3). Default is 2.
90
+ - Must contain multiple <x-card> elements internally.
91
+
92
+ Body content:
61
93
 
62
- ### 2.2. `<x-field>` Individual Field Component
94
+ - Must contain multiple <x-card> elements internally.
95
+ - **Consistency requirement**: All <x-card> elements within the same <x-cards> must maintain visual consistency:
96
+ - It's recommended to always provide data-icon for each card.
97
+ - Or all cards should have data-image.
98
+ - Avoid mixing (some with icons, some with only images).
63
99
 
64
- Syntax:
100
+ ### Examples
101
+
102
+ <cards_good_examples>
103
+ Example 1: Three-column cards with icons
65
104
 
66
105
  ```
67
- <x-field data-name="field_name" data-type="string" data-default="default_value" data-required="true" data-deprecated="false" data-desc="Field description">
68
- <!-- For complex types, children can only be other x-field elements -->
69
- <x-field data-name="nested_field" data-type="string" data-desc="Nested field description"></x-field>
70
- <!-- Optional: Use x-field-desc for rich text descriptions with inline markdown -->
71
- <x-field-desc markdown>This field supports **bold text**, `inline code`, and other inline markdown formatting.</x-field-desc>
72
- </x-field>
106
+ <x-cards data-columns="3">
107
+ <x-card data-title="Feature 1" data-icon="lucide:rocket">Description of Feature 1.</x-card>
108
+ <x-card data-title="Feature 2" data-icon="lucide:bolt">Description of Feature 2.</x-card>
109
+ <x-card data-title="Feature 3" data-icon="material-symbols:rocket-outline">Description of Feature 3.</x-card>
110
+ </x-cards>
111
+ ```
112
+
113
+ Example 2: Two-column cards with images
114
+
73
115
  ```
116
+ <x-cards data-columns="2">
117
+ <x-card data-title="Card A" data-image="https://picsum.photos/id/10/300/300">Content A</x-card>
118
+ <x-card data-title="Card B" data-image="https://picsum.photos/id/11/300/300">Content B</x-card>
119
+ </x-cards>
120
+ ```
121
+
122
+ </cards_good_examples>
123
+
124
+ ## `<x-field>` Individual Field Component
125
+
126
+ 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.
74
127
 
75
- Attribute Rules:
128
+ ### Syntax Rules
76
129
 
77
- - `data-name` (required): The name of the field/parameter
78
- - `data-type` (required): The data type of the field (e.g., "string", "number", "boolean", "object", "array")
130
+ Attributes:
131
+
132
+ - `data-name` (optional): The name of the field/parameter
133
+ - `data-type` (optional): The data type of the field (e.g., "string", "number", "boolean", "object", "array")
79
134
  - `data-default` (optional): Default value for the field
80
135
  - `data-required` (optional): Whether the field is required ("true" or "false")
81
136
  - `data-deprecated` (optional): Whether the field is deprecated ("true" or "false")
82
137
  - `data-desc` (optional): Simple description of the field (plain text only)
83
- - Children: For complex types (object, array), children can contain multiple `<x-field>` elements and optionally one `<x-field-desc>` element. For simple types, children can be empty or contain one `<x-field-desc>` element.
84
-
85
- Child Elements:
138
+ - Mutually exclusive with `data-desc`: Use either `data-desc` attribute OR `<x-field-desc>` element, not both
86
139
 
87
- - `<x-field-desc>` (optional): Rich text description supporting inline markdown formatting
88
- - `markdown` (required): **MUST** be set to "markdown" - this attribute is mandatory and cannot be omitted
89
- - Supports **bold text**, `inline code`, *italic text*, and other inline markdown
90
- - Cannot contain block-level elements (no code blocks, headers, lists)
91
- - **Mutually exclusive with `data-desc`**: Use either `data-desc` attribute OR `<x-field-desc>` element, not both
92
- - Only one `<x-field-desc>` element per `<x-field>` is allowed
93
- - **Validation**: `<x-field-desc>` without `markdown` attribute will be rejected
140
+ Body content:
94
141
 
95
- Nesting Rules:
96
-
97
- - Maximum nesting depth: 5 levels (to avoid overly complex structures)
98
- - **Top-level organization**: Use `<x-field-group>` to group related `<x-field>` elements at the top level
99
- - **Field component children**: Children elements must only be `<x-field>` and `<x-field-desc>` components
100
- - **Group component children**: `<x-field-group>` can only contain `<x-field>` elements
101
- - **Mutually exclusive descriptions**: Use either `data-desc` attribute OR `<x-field-desc>` element, not both
102
- - **Child element limits**:
103
- - For simple types: children can be empty or contain exactly one `<x-field-desc>` element
104
- - For complex types: children can contain multiple `<x-field>` elements and optionally one `<x-field-desc>` element
105
- - **Always use opening/closing tags format**: `<x-field ...></x-field>` and `<x-field-group>...</x-field-group>` for all types
106
- - **Mandatory markdown attribute**: Every `<x-field-desc>` element **MUST** include `markdown` attribute - elements without this attribute will be rejected
107
- - **Grouping rules**:
108
- - `<x-field-group>` can only be used at the top level
109
- - Cannot be nested inside `<x-field>` or other `<x-field-group>` elements
110
- - Must contain multiple `<x-field>` elements
111
- - For simple types (string, number, boolean), children can be empty or contain one `<x-field-desc>`: `<x-field ...></x-field>` or `<x-field ...><x-field-desc markdown>...</x-field-desc></x-field>`
142
+ - For simple types (string, number, boolean): children can be empty or contain exactly one `<x-field-desc>` element
112
143
  - For complex types (object, array), children contain nested `<x-field>` elements and optionally one `<x-field-desc>` element
144
+ - Maximum nesting depth: 5 levels (to avoid overly complex structures)
145
+ - Only one `<x-field-desc>` element per `<x-field>` is allowed
146
+ - **Always use opening/closing tags format**: `<x-field ...></x-field>` for all types
113
147
 
114
- **Usage Rules:**
148
+ ### Examples
115
149
 
116
- - **Context types must use `<x-field>` instead of tables** for consistent formatting
117
- - **Mandatory markdown attribute**: Every `<x-field-desc>` element must include `markdown` attribute
118
- - **Description text as child content**: Description text must be provided as child content of `<x-field-desc>`, not as the value of the `markdown` attribute
150
+ <field_good_examples>
151
+ Example 1: Simple field with all attributes
152
+
153
+ ```
154
+ <x-field data-name="user_id" data-type="string" data-default="u0911" data-required="true" data-deprecated="true" data-desc="Unique identifier for the user. Must be a valid UUID v4 format."></x-field>
155
+ ```
119
156
 
120
- **Error Examples:**
157
+ Example 2: Field with markdown description
121
158
 
122
- ❌ **INCORRECT** - Missing `markdown` attribute:
123
159
  ```
124
160
  <x-field data-name="api_key" data-type="string" data-required="true">
125
- <x-field-desc>Your **API key** for authentication.</x-field-desc>
161
+ <x-field-desc markdown>Your **API key** for authentication. Generate one from the `Settings > API Keys` section. Keep it secure and never expose it in client-side code.</x-field-desc>
126
162
  </x-field>
127
163
  ```
128
164
 
129
- **INCORRECT** - Description text as attribute value:
165
+ Example 3: Nested object structure
166
+
130
167
  ```
131
- <x-field data-name="api_key" data-type="string" data-required="true">
132
- <x-field-desc markdown="Your **API key** for authentication."></x-field-desc>
168
+ <x-field data-name="session" data-type="object" data-required="true">
169
+ <x-field-desc markdown>Contains all **authentication** and **authorization** data for the current user session. This object is automatically populated after successful login.</x-field-desc>
170
+ <x-field data-name="user" data-type="object" data-required="true" data-desc="User basic information">
171
+ <x-field data-name="name" data-type="string" data-required="true" data-default="John Doe" data-desc="User name"></x-field>
172
+ <x-field data-name="email" data-type="string" data-required="true" data-default="john.doe@example.com">
173
+ <x-field-desc markdown>Primary email address used for **login** and **notifications**. Must be a valid email format.</x-field-desc>
174
+ </x-field>
175
+ <x-field data-name="avatar" data-type="string" data-required="false" data-default="https://example.com/avatars/john-doe.jpg" data-desc="User avatar URL"></x-field>
176
+ </x-field>
177
+ <x-field data-name="permissions" data-type="array" data-required="true" data-default='["read", "write", "admin"]'>
178
+ <x-field-desc markdown>Array of **permission strings** that determine what actions the user can perform. Common values: `"read"`, `"write"`, `"admin"`, `"delete"`.</x-field-desc>
179
+ </x-field>
133
180
  </x-field>
134
181
  ```
135
182
 
136
- ✅ **CORRECT** - Includes the required `markdown` attribute, with the description provided as child text:
183
+ </field_good_examples>
184
+
185
+ <field_bad_examples>
186
+ Example 1: Using multiple `<x-field-desc>` elements
187
+
137
188
  ```
138
189
  <x-field data-name="api_key" data-type="string" data-required="true">
139
190
  <x-field-desc markdown>Your **API key** for authentication.</x-field-desc>
191
+ <x-field-desc markdown>Keep it secure and never expose it.</x-field-desc>
140
192
  </x-field>
141
193
  ```
142
194
 
143
- Example:
195
+ Example 2: Using self-closing tag
144
196
 
145
197
  ```
146
- <!-- Single field with simple description (using data-desc) -->
147
- <x-field data-name="user_id" data-type="string" data-default="u0911" data-required="true" data-deprecated="true" data-desc="Unique identifier for the user. Must be a valid UUID v4 format."></x-field>
198
+ <x-field data-name="user_id" data-type="string" data-required="true" data-desc="User identifier" />
199
+ ```
200
+
201
+ Example 3: Using both `data-desc` and `<x-field-desc>`
202
+
203
+ ```
204
+ <x-field data-name="api_key" data-type="string" data-required="true" data-desc="API key for authentication">
205
+ <x-field-desc markdown>Your **API key** for authentication. Keep it secure and never expose it.</x-field-desc>
206
+ </x-field>
207
+ ```
208
+
209
+ Example 4: Nesting other child elements
210
+
211
+ ```
212
+ <x-field data-name="user" data-type="object" data-required="true">
213
+ <div>User information</div>
214
+ <x-field data-name="name" data-type="string" data-required="true" data-desc="User name"></x-field>
215
+ </x-field>
216
+ ```
217
+
218
+ </field_bad_examples>
219
+
220
+ ## `<x-field-desc>` Field Description Component
221
+
222
+ Used to provide rich text descriptions for `<x-field>` elements, supporting inline markdown formatting for enhanced readability.
223
+
224
+ ### Syntax Rules
225
+
226
+ Attributes:
227
+
228
+ - `markdown` (required): **MUST** be set to "markdown" . This attribute is mandatory and cannot be omitted
229
+ - **Validation**: `<x-field-desc>` without `markdown` attribute will be rejected
230
+
231
+ Body content:
232
+
233
+ - Supports **bold text**, `inline code`, _italic text_, and other inline markdown
234
+ - Cannot contain block-level elements (no code blocks, headers, lists)
235
+ - **Description text as child content**: Description text must be provided as child content of `<x-field-desc>`, not as the value of the `markdown` attribute
236
+
237
+ Structure constraints:
238
+
239
+ - Must be child of `<x-field>`: `<x-field-desc>` can only appear as a child element of `<x-field>` components
240
+
241
+ ### Examples
242
+
243
+ <field_desc_good_examples>
244
+ Example 1: Basic markdown description
148
245
 
149
- <!-- Single field with rich text description (using x-field-desc) -->
246
+ ```
247
+ <x-field-desc markdown>Your **API key** for authentication. Generate one from the `Settings > API Keys` section. Keep it secure and never expose it in client-side code.</x-field-desc>
248
+ ```
249
+
250
+ Example 2: Description with inline code
251
+
252
+ ```
253
+ <x-field-desc markdown>**JWT token** containing user identity and permissions. Expires in `24 hours` by default. Use the `refresh_token` to obtain a new one.</x-field-desc>
254
+ ```
255
+
256
+ </field_desc_good_examples>
257
+
258
+ <field_desc_bad_examples>
259
+ Example 1: Missing markdown attribute
260
+
261
+ ```
150
262
  <x-field data-name="api_key" data-type="string" data-required="true">
151
- <x-field-desc markdown>Your **API key** for authentication. Generate one from the `Settings > API Keys` section. Keep it secure and never expose it in client-side code.</x-field-desc>
263
+ <x-field-desc>Your **API key** for authentication.</x-field-desc>
152
264
  </x-field>
265
+ ```
153
266
 
154
- <!-- Multiple related fields grouped together (Props, Parameters, Returns, Context) -->
155
- <x-field-group>
156
- <x-field data-name="name" data-type="string" data-required="true" data-desc="The name of the product."></x-field>
157
- <x-field data-name="description" data-type="string" data-required="false" data-desc="An optional description for the product."></x-field>
158
- <x-field data-name="type" data-type="string" data-required="false" data-desc="The type of product (e.g., 'service', 'good')."></x-field>
159
- <x-field data-name="price" data-type="number" data-required="true" data-default="0">
160
- <x-field-desc markdown>Product price in **USD**. Must be a positive number with up to 2 decimal places.</x-field-desc>
161
- </x-field>
162
- </x-field-group>
267
+ Example 2: Incorrect markdown attribute usage
163
268
 
164
- <!-- Multiple field groups for different contexts -->
165
- <x-field-group>
166
- <x-field data-name="username" data-type="string" data-required="true" data-desc="User login name"></x-field>
167
- <x-field data-name="email" data-type="string" data-required="true" data-desc="User email address"></x-field>
168
- <x-field data-name="password" data-type="string" data-required="true" data-desc="User password"></x-field>
169
- </x-field-group>
269
+ ```
270
+ <x-field data-name="api_key" data-type="string" data-required="true">
271
+ <x-field-desc markdown="Your **API key** for authentication."></x-field-desc>
272
+ </x-field>
273
+ ```
170
274
 
171
- <x-field-group>
172
- <x-field data-name="host" data-type="string" data-required="true" data-default="localhost" data-desc="Database host address"></x-field>
173
- <x-field data-name="port" data-type="number" data-required="true" data-default="5432" data-desc="Database port number"></x-field>
174
- <x-field data-name="ssl" data-type="boolean" data-required="false" data-default="false" data-desc="Enable SSL connection"></x-field>
175
- </x-field-group>
275
+ Example 3: Using self-closing tag
176
276
 
177
- <!-- Complex nested object with rich descriptions -->
178
- <x-field data-name="session" data-type="object" data-required="true">
179
- <x-field-desc markdown>Contains all **authentication** and **authorization** data for the current user session. This object is automatically populated after successful login.</x-field-desc>
180
- <x-field data-name="auth" data-type="object" data-required="true" data-desc="User authentication information">
181
- <x-field data-name="token" data-type="object" data-required="true" data-desc="Access token information">
182
- <x-field data-name="access_token" data-type="string" data-required="true" data-default="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...">
183
- <x-field-desc markdown>**JWT token** containing user identity and permissions. Expires in `24 hours` by default. Use the `refresh_token` to obtain a new one.</x-field-desc>
184
- </x-field>
185
- <x-field data-name="refresh_token" data-type="string" data-required="false" data-default="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...">
186
- <x-field-desc markdown>Used to obtain new `access_token` when the current one expires. Valid for **30 days**.</x-field-desc>
187
- </x-field>
188
- <x-field data-name="expires_at" data-type="number" data-required="true" data-default="1704067200" data-desc="Token expiration timestamp (Unix timestamp)"></x-field>
189
- </x-field>
190
- <x-field data-name="user" data-type="object" data-required="true" data-desc="User basic information">
191
- <x-field data-name="profile" data-type="object" data-required="true" data-desc="User profile information">
192
- <x-field data-name="name" data-type="string" data-required="true" data-default="John Doe" data-desc="User name"></x-field>
193
- <x-field data-name="email" data-type="string" data-required="true" data-default="john.doe@example.com">
194
- <x-field-desc markdown>Primary email address used for **login** and **notifications**. Must be a valid email format.</x-field-desc>
195
- </x-field>
196
- <x-field data-name="avatar" data-type="string" data-required="false" data-default="https://example.com/avatars/john-doe.jpg" data-desc="User avatar URL"></x-field>
197
- </x-field>
198
- <x-field data-name="permissions" data-type="array" data-required="true" data-default='["read", "write", "admin"]'>
199
- <x-field-desc markdown>Array of **permission strings** that determine what actions the user can perform. Common values: `"read"`, `"write"`, `"admin"`, `"delete"`.</x-field-desc>
200
- </x-field>
201
- </x-field>
202
- </x-field>
277
+ ```
278
+ <x-field data-name="user_id" data-type="string" data-required="true">
279
+ <x-field-desc markdown />
203
280
  </x-field>
204
281
  ```
205
282
 
206
- ### 3. `<x-cards>` Card List Component
283
+ Example 4: Containing block-level elements
207
284
 
208
- Suitable for displaying multiple links using a card list format, providing a richer and more visually appealing presentation.
285
+ ```
286
+ <x-field data-name="config" data-type="object" data-required="true">
287
+ <x-field-desc markdown>
288
+ Configuration object for the application.
289
+
290
+ # Important Notes
291
+ - Set debug to true for development
292
+ - Use production database in production
293
+
294
+ \`\`\`javascript
295
+ const config = { debug: true };
296
+ \`\`\`
297
+ </x-field-desc>
298
+ </x-field>
299
+ ```
209
300
 
210
- Syntax:
301
+ Example 5: Used outside of x-field component
211
302
 
212
303
  ```
213
- <x-cards data-columns="Number of columns">
214
- <x-card data-title="Title 1" data-icon="lucide:rocket">Content 1</x-card>
215
- <x-card data-title="Title 2" data-icon="lucide:bolt">Content 2</x-card>
216
- <x-card data-title="Title 3" data-icon="material-symbols:rocket-outline">Content 3</x-card>
217
- </x-cards>
304
+ <x-field-desc markdown>This description is not inside an x-field component.</x-field-desc>
218
305
  ```
219
306
 
220
- Attribute Rules:
221
- - data-columns (optional): Number of columns, integer (e.g., 2, 3). Default is 2.
222
- - Must contain multiple <x-card> elements internally.
223
- - Consistency requirement: All <x-card> elements within the same <x-cards> must maintain visual consistency:
224
- - It's recommended to always provide data-icon for each card.
225
- - Or all cards should have data-image.
226
- - Avoid mixing (some with icons, some with only images).
307
+ Example 6: Used as child of other components
227
308
 
228
- <custom_components_good_example>
229
- Use plain text without any styling
230
- <x-card data-title="alarm()" data-icon="lucide:alarm-clock"> SIGALRM: Sent when a real-time timer has expired. </x-card>
309
+ ```
310
+ <x-field-group>
311
+ <x-field data-name="name" data-type="string" data-required="true" data-desc="User name"></x-field>
312
+ <x-field-desc markdown>This description is not inside an x-field component.</x-field-desc>
313
+ </x-field-group>
314
+ ```
231
315
 
232
- Single card:
233
- <x-card data-title="Horizontal card" data-icon="lucide:atom" data-horizontal="true">
234
- This is an example of a horizontal card.
235
- </x-card>
316
+ </field_desc_bad_examples>
236
317
 
237
- Card list (all using icons, recommended approach):
238
- <x-cards data-columns="3">
239
- <x-card data-title="Feature 1" data-icon="lucide:rocket">Description of Feature 1.</x-card>
240
- <x-card data-title="Feature 2" data-icon="lucide:bolt">Description of Feature 2.</x-card>
241
- <x-card data-title="Feature 3" data-icon="material-symbols:rocket-outline">Description of Feature 3.</x-card>
242
- </x-cards>
318
+ ## `<x-field-group>` Field Group Component
243
319
 
244
- Card list (all using images):
245
- <x-cards data-columns="2">
246
- <x-card data-title="Card A" data-image="https://picsum.photos/id/10/300/300">Content A</x-card>
247
- <x-card data-title="Card B" data-image="https://picsum.photos/id/11/300/300">Content B</x-card>
248
- </x-cards>
249
- </custom_components_good_example>
320
+ Used to group multiple related `<x-field>` elements at the top level, indicating they belong to the same object or context. This provides better organization and visual grouping for related parameters.
250
321
 
251
- <custom_components_bad_example>
322
+ ### Syntax Rules
252
323
 
253
- `x-card` component body does not support markdown formatting inline code block
254
- <x-card data-title="alarm()" data-icon="lucide:alarm-clock"> `SIGALRM`: Sent when a real-time timer has expired. </x-card>
324
+ Attributes:
255
325
 
326
+ - No attributes required
327
+
328
+ Body content:
329
+
330
+ - Only `<x-field>` elements are allowed as children
331
+
332
+ Structure:
333
+
334
+ - Top-level organization: Used only at the top level for grouping related `<x-field>`
335
+ - Cannot be nested inside other `<x-field>` or `<x-field-group>` elements
336
+
337
+ ### Examples
338
+
339
+ <field_group_good_examples>
340
+ Example 1: Product information fields
256
341
 
257
- `x-card` component body does not support code blocks
258
- <x-card data-title="ctrl_break()" data-icon="lucide:keyboard">
259
- Creates a listener for "ctrl-break" events.
260
- ```rust,no_run
261
- use tokio::signal::windows::ctrl_break;
262
-
263
- #[tokio::main]
264
- async fn main() -> std::io::Result<()> {
265
- let mut stream = ctrl_break()?;
266
- stream.recv().await;
267
- println!("got ctrl-break");
268
- Ok(())
269
- }
270
342
  ```
271
- </x-card>
343
+ <x-field-group>
344
+ <x-field data-name="name" data-type="string" data-required="true" data-desc="The name of the product."></x-field>
345
+ <x-field data-name="description" data-type="string" data-required="false" data-desc="An optional description for the product."></x-field>
346
+ <x-field data-name="type" data-type="string" data-required="false" data-desc="The type of product (e.g., 'service', 'good')."></x-field>
347
+ <x-field data-name="price" data-type="number" data-required="true" data-default="0">
348
+ <x-field-desc markdown>Product price in **USD**. Must be a positive number with up to 2 decimal places.</x-field-desc>
349
+ </x-field>
350
+ </x-field-group>
351
+ ```
352
+
353
+ </field_group_good_examples>
354
+
355
+ <field_group_bad_examples>
356
+ Example 1: Nested inside x-field component
357
+
358
+ ```
359
+ <x-field data-name="user" data-type="object" data-required="true">
360
+ <x-field-group>
361
+ <x-field data-name="name" data-type="string" data-required="true" data-desc="User name"></x-field>
362
+ <x-field data-name="email" data-type="string" data-required="true" data-desc="User email"></x-field>
363
+ </x-field-group>
364
+ </x-field>
365
+ ```
366
+
367
+ Example 2: Nested inside another x-field-group
368
+
369
+ ```
370
+ <x-field-group>
371
+ <x-field data-name="user" data-type="object" data-required="true" data-desc="User information"></x-field>
372
+ <x-field-group>
373
+ <x-field data-name="name" data-type="string" data-required="true" data-desc="User name"></x-field>
374
+ <x-field data-name="email" data-type="string" data-required="true" data-desc="User email"></x-field>
375
+ </x-field-group>
376
+ </x-field-group>
377
+ ```
378
+
379
+ Example 3: Containing non-x-field elements
380
+
381
+ ```
382
+ <x-field-group>
383
+ <x-field data-name="name" data-type="string" data-required="true" data-desc="User name"></x-field>
384
+ <div>Additional information</div>
385
+ <x-field data-name="email" data-type="string" data-required="true" data-desc="User email"></x-field>
386
+ </x-field-group>
387
+ ```
272
388
 
273
- </custom_components_bad_example>
389
+ </field_group_bad_examples>
274
390
 
275
391
  </custom_components_usage>
@@ -13,10 +13,10 @@ Documentation Generation Rules:
13
13
  - Structure each section with: title, introduction, code examples, response data samples, and explanatory notes. Place explanations directly after code examples without separate "Example Description" subheadings
14
14
  - Maintain content completeness and logical flow so users can follow the documentation seamlessly
15
15
  - Provide comprehensive explanations for configuration options and parameters. When parameters accept multiple values, explain each option's purpose and include code examples where applicable
16
- - Use the `<x-field>` custom component for displaying parameters, return values, context data, props, and other type-related information. Support nested structures for complex data types
17
- - For complex objects, use nested `<x-field>` structures to describe parameter hierarchies recursively, limiting nesting to 5 levels maximum
18
- - Format all types with proper opening and closing tags `<x-field ...></x-field>`—leave simple types empty, include nested fields for complex types
19
- - When describing multiple properties of the same object, wrap the outermost `<x-field>` elements with `<x-field-group>` elements. Note that nested `<x-field>` elements do not need wrapping
16
+ - Use the `<x-field>` custom component only for displaying structured object data such as API parameters, return values, network request body/query/headers, and complex object properties (e.g., ContextType). This component does not exist independently but represents complete object structures
17
+ - Do not use `<x-field>` for individual field descriptions (e.g., name or version in package.json, logo or appUrl in config.yaml) - use regular Markdown text instead
18
+ - Wrap the outermost `<x-field>` elements with `<x-field-group>` when describing multiple properties of the same object, even if there's only one `<x-field>` element
19
+ - Use recursive `<x-field>` structures to fully express complex object type hierarchies, decomposing all nested properties into more fundamental types. Limit nesting to 5 levels maximum
20
20
  - All interface and method documentation must include **response data examples**
21
21
  - For simple list data, use Markdown tables to present information clearly and improve readability
22
22
  - Validate output Markdown for completeness, ensuring tables are properly formatted
@@ -37,14 +37,6 @@ Custom component generation rules:
37
37
  Custom code block generation rules:
38
38
  {% include "custom/custom-code-block.md" %}
39
39
 
40
- Diagram generate guide:
41
- Evaluate for each document whether diagrams are necessary.
42
- - Use diagrams to clarify complex concepts and diversify the presentation of the page.
43
- - The document overview page must include an architecture diagram that illustrates the entire documentation structure.
44
- - For the first page of each section, include a structural diagram of the current module when it adds clarity.
45
- - For individual article pages, consider detailed flowcharts when the content or overall architecture warrants them.
46
- - The number of diagrams is flexible, but aim for 0-3 diagrams as a practical range.
47
-
48
40
  </content_generation_rules>
49
41
 
50
42
  {% if glossary %}
@@ -110,3 +102,24 @@ User feedback on previous generation:
110
102
  3. Reference the style from examples only, **output content in {{locale}} language**
111
103
 
112
104
  </output_constraints>
105
+
106
+
107
+ <tool-usage>
108
+ 1. generateD2DiagramContent: Generate D2 diagram for the given document content
109
+ - Use diagrams to clarify complex concepts and diversify the presentation of the page.
110
+ - The document overview page must include an architecture diagram that illustrates the entire documentation structure.
111
+ - For the first page of each section, include a structural diagram of the current module when it adds clarity.
112
+ - For individual article pages, consider detailed flowcharts when the content or overall architecture warrants them.
113
+ - The number of diagrams is flexible, but aim for 0-3 diagrams as a practical range.
114
+
115
+ 2. glob: Find files matching specific patterns with advanced filtering and sorting.
116
+
117
+ 3. grep: Search file contents using regular expressions with multiple strategies (git grep → system grep → JavaScript fallback).
118
+
119
+ 4. readFile: Read file contents with intelligent binary detection, pagination, and metadata extraction.
120
+
121
+ When to use Tools:
122
+ - For each document, evaluate whether D2 diagrams are needed. If so, always use generateD2DiagramContent to add diagrams to the document
123
+ - During document generation, if the given context is missing or lacks referenced content, use glob/grep/readFile to obtain more context
124
+ - Code examples in generated documents must use APIs and packages defined in the input data sources. Do not generate non-existent code out of thin air. Use glob/grep/readFile to query related code or references
125
+ </tool-usage>