@aigne/doc-smith 0.8.15 → 0.8.16-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/agents/chat/chat-system.md +32 -0
- package/agents/chat/index.yaml +14 -22
- package/agents/chat/skills/generate-document.yaml +15 -0
- package/agents/chat/skills/update-document.yaml +24 -0
- package/agents/evaluate/generate-report.mjs +7 -0
- package/agents/evaluate/index.yaml +6 -0
- package/agents/generate/check-need-generate-structure.mjs +12 -4
- package/agents/generate/document-structure-tools/add-document.mjs +9 -1
- package/agents/generate/document-structure-tools/update-document.mjs +18 -0
- package/agents/generate/draw-diagram.yaml +2 -2
- package/agents/generate/generate-structure.yaml +3 -2
- package/agents/generate/user-review-document-structure.mjs +44 -29
- package/agents/init/index.mjs +6 -4
- package/agents/media/load-media-description.mjs +2 -1
- package/agents/schema/document-structure-item.yaml +3 -0
- package/agents/schema/document-structure-refine-item.yaml +3 -0
- package/agents/schema/document-structure.yaml +3 -0
- package/agents/update/pre-check-generate-diagram.yaml +1 -1
- package/agents/update/user-review-document.mjs +56 -42
- package/agents/utils/document-icon-generate.yaml +52 -0
- package/agents/utils/document-title-streamline.yaml +48 -0
- package/agents/utils/generate-document-icon-if-needed.mjs +93 -0
- package/agents/utils/list-docs.mjs +15 -0
- package/agents/utils/streamline-document-titles-if-needed.mjs +88 -0
- package/aigne.yaml +7 -1
- package/package.json +4 -7
- package/prompts/common/document/media-file-list-usage-rules.md +8 -2
- package/prompts/common/document/openapi-usage-rules.md +174 -21
- package/prompts/common/document-structure/document-icon-generate.md +116 -0
- package/prompts/common/document-structure/document-structure-rules.md +8 -3
- package/prompts/common/document-structure/document-title-streamline.md +86 -0
- package/prompts/common/document-structure/openapi-usage-rules.md +28 -0
- package/prompts/common/document-structure/output-constraints.md +9 -0
- package/prompts/detail/custom/{custom-code-block.md → code-block-usage-rules.md} +43 -16
- package/prompts/detail/custom/custom-components/x-card-usage-rules.md +62 -0
- package/prompts/detail/custom/custom-components/x-cards-usage-rules.md +75 -0
- package/prompts/detail/custom/custom-components/x-field-desc-usage-rules.md +86 -0
- package/prompts/detail/custom/custom-components/x-field-group-usage-rules.md +95 -0
- package/prompts/detail/custom/custom-components/x-field-usage-rules.md +189 -0
- package/prompts/detail/custom/custom-components-usage-rules.md +10 -534
- package/prompts/detail/{d2-diagram → diagram}/rules.md +5 -3
- package/prompts/detail/generate/document-rules.md +6 -0
- package/prompts/detail/generate/system-prompt.md +3 -2
- package/prompts/detail/generate/user-prompt.md +7 -1
- package/prompts/detail/update/system-prompt.md +3 -3
- package/prompts/structure/generate/system-prompt.md +2 -5
- package/prompts/structure/generate/user-prompt.md +14 -39
- package/types/document-structure-schema.mjs +1 -0
- package/utils/evaluate/report-utils.mjs +7 -3
- package/agents/utils/docs-fs-actor.yaml +0 -27
- package/agents/utils/fs.mjs +0 -60
- /package/prompts/detail/{d2-diagram → diagram}/guide.md +0 -0
- /package/prompts/detail/{d2-diagram → diagram}/official-examples.md +0 -0
- /package/prompts/detail/{d2-diagram → diagram}/pre-check.md +0 -0
- /package/prompts/detail/{d2-diagram → diagram}/role-and-personality.md +0 -0
- /package/prompts/detail/{d2-diagram → diagram}/system-prompt.md +0 -0
- /package/prompts/detail/{d2-diagram → diagram}/user-prompt.md +0 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<x-card-usage-rules>
|
|
2
|
+
## XCard Usage Rules
|
|
3
|
+
|
|
4
|
+
XCards is multiple `<x-card>` container, suitable for displaying multiple links using a card list format, providing a richer and more visually appealing presentation.
|
|
5
|
+
|
|
6
|
+
### Attributes
|
|
7
|
+
|
|
8
|
+
- `data-columns` (optional): Must be an **integer ≥ 2**. Values below 2 are disallowed. Default is 2.
|
|
9
|
+
|
|
10
|
+
### Children
|
|
11
|
+
|
|
12
|
+
- Must contain multiple `<x-card>` elements internally.
|
|
13
|
+
|
|
14
|
+
### Usage Rules
|
|
15
|
+
|
|
16
|
+
- **Visual Consistency**: All `<x-card>` elements within the same `<x-cards>` must maintain visual consistency:
|
|
17
|
+
- It's recommended to always provide data-icon for each card.
|
|
18
|
+
- Or all cards should have data-image.
|
|
19
|
+
- Avoid mixing (some with icons, some with only images).
|
|
20
|
+
|
|
21
|
+
### Good Examples
|
|
22
|
+
|
|
23
|
+
- Example 1: Three-column cards with icons
|
|
24
|
+
```md
|
|
25
|
+
<x-cards data-columns="3">
|
|
26
|
+
<x-card data-title="Feature 1" data-icon="lucide:rocket">Description of Feature 1.</x-card>
|
|
27
|
+
<x-card data-title="Feature 2" data-icon="lucide:bolt">Description of Feature 2.</x-card>
|
|
28
|
+
<x-card data-title="Feature 3" data-icon="material-symbols:rocket-outline">Description of Feature 3.</x-card>
|
|
29
|
+
</x-cards>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
- Example 2: Two-column cards with images
|
|
33
|
+
```md
|
|
34
|
+
<x-cards data-columns="2">
|
|
35
|
+
<x-card data-title="Card A" data-image="https://picsum.photos/id/10/300/300">Content A</x-card>
|
|
36
|
+
<x-card data-title="Card B" data-image="https://picsum.photos/id/11/300/300">Content B</x-card>
|
|
37
|
+
</x-cards>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
- Example 3: Replace markdown format multiple links
|
|
41
|
+
```md
|
|
42
|
+
For more detailed information on specific features, please refer to the following sections:
|
|
43
|
+
|
|
44
|
+
<x-cards data-columns="3">
|
|
45
|
+
<x-card data-title="Using Discussions" data-href="/discussions">Introduce how to use discussions</x-card>
|
|
46
|
+
<x-card data-title="Using the Blog" data-href="/blog">Introduce how to use the Blog</x-card>
|
|
47
|
+
<x-card data-title="Using Chat" data-href="/chat">Introduce how to use Chat</x-card>
|
|
48
|
+
</x-cards>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Bad Examples
|
|
52
|
+
|
|
53
|
+
- Example 1: Using a single-column layout (`data-columns="1"`) is not allowed
|
|
54
|
+
```md
|
|
55
|
+
<x-cards data-columns="1">
|
|
56
|
+
<x-card data-title="Feature 1" data-icon="lucide:rocket">Description of Feature 1.</x-card>
|
|
57
|
+
<x-card data-title="Feature 2" data-icon="lucide:bolt">Description of Feature 2.</x-card>
|
|
58
|
+
</x-cards>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
- Example 2: Contains only one `<x-card>` (must include multiple cards)
|
|
62
|
+
```md
|
|
63
|
+
<x-cards data-columns="2">
|
|
64
|
+
<x-card data-title="Card A" data-image="https://picsum.photos/id/10/300/300">Content A</x-card>
|
|
65
|
+
</x-cards>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
- Example 3: Markdown format multiple links
|
|
69
|
+
```md
|
|
70
|
+
For more detailed information on specific features, please refer to the following sections:
|
|
71
|
+
- [Using Discussions](./discussions.md)
|
|
72
|
+
- [Using the Blog](./blog.md)
|
|
73
|
+
- [Using Chat](./chat.md)
|
|
74
|
+
```
|
|
75
|
+
</x-card-usage-rules>
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<x-field-desc-usage-rules>
|
|
2
|
+
## XFieldDesc Usage Rules
|
|
3
|
+
|
|
4
|
+
XFieldDesc is rich field description. Used to provide rich text descriptions for `<x-field>` elements, supporting inline markdown formatting for enhanced readability.
|
|
5
|
+
|
|
6
|
+
### Attributes
|
|
7
|
+
|
|
8
|
+
- `markdown` (required): **MUST** be set to "markdown" . This attribute is mandatory and cannot be omitted
|
|
9
|
+
- **Validation**: `<x-field-desc>` without `markdown` attribute will be rejected
|
|
10
|
+
|
|
11
|
+
### Children
|
|
12
|
+
|
|
13
|
+
- Supports **bold text**, `inline code`, _italic text_, and other inline markdown
|
|
14
|
+
- Description text must be provided as child content of `<x-field-desc>`, not as the value of the `markdown` attribute
|
|
15
|
+
- **Inline Markdown Only**: Allow only inline Markdown (e.g., `**bold**`, *italic*, `inline code`); block elements like code blocks, headings, lists, or tables are **not allowed**.
|
|
16
|
+
|
|
17
|
+
### Usage Rules
|
|
18
|
+
|
|
19
|
+
- **Parent Requirement**: Must be child of `<x-field>`: `<x-field-desc>` can only appear as a child element of `<x-field>` components
|
|
20
|
+
|
|
21
|
+
### Good Examples
|
|
22
|
+
|
|
23
|
+
- Example 1: Basic markdown description
|
|
24
|
+
```md
|
|
25
|
+
<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>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
- Example 2: Description with inline code
|
|
29
|
+
```md
|
|
30
|
+
<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>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Bad Examples
|
|
34
|
+
|
|
35
|
+
- Example 1: Missing markdown attribute (violates "markdown attribute required" rule)
|
|
36
|
+
```md
|
|
37
|
+
<x-field data-name="api_key" data-type="string" data-required="true">
|
|
38
|
+
<x-field-desc>Your **API key** for authentication.</x-field-desc>
|
|
39
|
+
</x-field>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
- Example 2: Incorrect markdown attribute usage (violates "markdown attribute format" rule)
|
|
43
|
+
```md
|
|
44
|
+
<x-field data-name="api_key" data-type="string" data-required="true">
|
|
45
|
+
<x-field-desc markdown="Your **API key** for authentication."></x-field-desc>
|
|
46
|
+
</x-field>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
- Example 3: Using self-closing tag (violates "opening/closing tags format" rule)
|
|
50
|
+
```md
|
|
51
|
+
<x-field data-name="user_id" data-type="string" data-required="true">
|
|
52
|
+
<x-field-desc markdown />
|
|
53
|
+
</x-field>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
- Example 4: Containing block-level elements (violates "Inline Content Only" rule)
|
|
57
|
+
````md
|
|
58
|
+
<x-field data-name="config" data-type="object" data-required="true">
|
|
59
|
+
<x-field-desc markdown>
|
|
60
|
+
**Configuration settings** for the application.
|
|
61
|
+
|
|
62
|
+
## Important Notes
|
|
63
|
+
- Set debug to true for development
|
|
64
|
+
- Use production database in production
|
|
65
|
+
|
|
66
|
+
```javascript
|
|
67
|
+
const config = { debug: true };
|
|
68
|
+
```
|
|
69
|
+
</x-field-desc>
|
|
70
|
+
</x-field>
|
|
71
|
+
````
|
|
72
|
+
|
|
73
|
+
- Example 5: Used outside of x-field component (violates "Parent Requirement" rule)
|
|
74
|
+
```md
|
|
75
|
+
<x-field-desc markdown>This description is not inside an x-field component.</x-field-desc>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
- Example 6: Used as child of other components (violates "Parent Requirement" rule)
|
|
79
|
+
```md
|
|
80
|
+
<x-field-group>
|
|
81
|
+
<x-field data-name="name" data-type="string" data-required="true" data-desc="User name"></x-field>
|
|
82
|
+
<x-field-desc markdown>This description is not inside an x-field component.</x-field-desc>
|
|
83
|
+
</x-field-group>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
</x-field-desc-usage-rules>
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
<x-field-group-usage-rules>
|
|
2
|
+
## XFieldGroup Usage Rules
|
|
3
|
+
|
|
4
|
+
XFieldGroup is `<x-field>` grouping container. 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.
|
|
5
|
+
|
|
6
|
+
### Attributes
|
|
7
|
+
|
|
8
|
+
- No attributes required
|
|
9
|
+
|
|
10
|
+
### Children
|
|
11
|
+
|
|
12
|
+
- Only `<x-field>` elements are allowed as children
|
|
13
|
+
|
|
14
|
+
### Usage Rules
|
|
15
|
+
|
|
16
|
+
- **Top-Level Only**: Used only at the top level for grouping related `<x-field>` elements. Cannot be nested inside other `<x-field>` or `<x-field-group>` elements
|
|
17
|
+
- **Structured Data Only**: Use `<x-field-group>` for fields **other than simple types** (`string`, `number`, `boolean`, `symbol`), e.g., Properties, Context, Parameters, Return values. For simple-type fields, use plain Markdown text.
|
|
18
|
+
- **Spacing Around**: Always insert a blank line before and after `<x-field-group>` when it’s adjacent to Markdown content.
|
|
19
|
+
|
|
20
|
+
### Good Examples
|
|
21
|
+
|
|
22
|
+
- Example 1: Product information fields
|
|
23
|
+
```md
|
|
24
|
+
<x-field-group>
|
|
25
|
+
<x-field data-name="name" data-type="string" data-required="true" data-desc="The name of the product."></x-field>
|
|
26
|
+
<x-field data-name="description" data-type="string" data-required="false" data-desc="An optional description for the product."></x-field>
|
|
27
|
+
<x-field data-name="type" data-type="string" data-required="false" data-desc="The type of product (e.g., 'service', 'good')."></x-field>
|
|
28
|
+
<x-field data-name="price" data-type="number" data-required="true" data-default="0">
|
|
29
|
+
<x-field-desc markdown>Product price in **USD**. Must be a positive number with up to 2 decimal places.</x-field-desc>
|
|
30
|
+
</x-field>
|
|
31
|
+
</x-field-group>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Bad Examples
|
|
35
|
+
|
|
36
|
+
- Example 1: Nested inside x-field component (violates "Top-Level Only" rule)
|
|
37
|
+
```md
|
|
38
|
+
<x-field data-name="user" data-type="object" data-required="true">
|
|
39
|
+
<x-field-group>
|
|
40
|
+
<x-field data-name="name" data-type="string" data-required="true" data-desc="User name"></x-field>
|
|
41
|
+
<x-field data-name="email" data-type="string" data-required="true" data-desc="User email"></x-field>
|
|
42
|
+
</x-field-group>
|
|
43
|
+
</x-field>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
- Example 2: Nested inside another x-field-group (violates "Top-Level Only" rule)
|
|
47
|
+
```md
|
|
48
|
+
<x-field-group>
|
|
49
|
+
<x-field data-name="user" data-type="object" data-required="true" data-desc="User information"></x-field>
|
|
50
|
+
<x-field-group>
|
|
51
|
+
<x-field data-name="name" data-type="string" data-required="true" data-desc="User name"></x-field>
|
|
52
|
+
<x-field data-name="email" data-type="string" data-required="true" data-desc="User email"></x-field>
|
|
53
|
+
</x-field-group>
|
|
54
|
+
</x-field-group>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
- Example 3: Containing non-x-field elements (violates "Only x-field elements allowed" rule)
|
|
58
|
+
```md
|
|
59
|
+
<x-field-group>
|
|
60
|
+
<x-field data-name="name" data-type="string" data-required="true" data-desc="User name"></x-field>
|
|
61
|
+
<div>Additional information</div>
|
|
62
|
+
<x-field data-name="email" data-type="string" data-required="true" data-desc="User email"></x-field>
|
|
63
|
+
</x-field-group>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
- Example 4: Empty x-field-group (violates "Must contain x-field elements" rule)
|
|
67
|
+
```md
|
|
68
|
+
<x-field-group>
|
|
69
|
+
</x-field-group>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
- Example 5: Using x-field-group for simple-type (violates "Structured Data Only" rule)
|
|
73
|
+
```md
|
|
74
|
+
### appName
|
|
75
|
+
|
|
76
|
+
<x-field-group>
|
|
77
|
+
<x-field data-name="appName" data-type="string" data-required="true" data-desc="specifies the name of the application"></x-field>
|
|
78
|
+
</x-field-group>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
- Example 6: Missing blank line before x-field-group (violates "Spacing Around" rule)
|
|
82
|
+
```md
|
|
83
|
+
**Parameters**
|
|
84
|
+
<x-field-group>
|
|
85
|
+
<x-field data-name="initialState" data-type="any" data-required="false">
|
|
86
|
+
<x-field-desc markdown>The initial state value.</x-field-desc>
|
|
87
|
+
</x-field>
|
|
88
|
+
</x-field-group>
|
|
89
|
+
|
|
90
|
+
`useReducer` returns an array with two items:
|
|
91
|
+
<x-field-group>
|
|
92
|
+
<x-field data-name="dispatch" data-type="function" data-desc="A function that you can call with an action to update the state."></x-field>
|
|
93
|
+
</x-field-group>
|
|
94
|
+
```
|
|
95
|
+
</x-field-group-usage-rules>
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
<x-field-usage-rules>
|
|
2
|
+
## XField Usage Rules
|
|
3
|
+
|
|
4
|
+
XField is structured data field, 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.
|
|
5
|
+
|
|
6
|
+
### Attributes
|
|
7
|
+
|
|
8
|
+
- `data-name` (optional): The name of the field/parameter
|
|
9
|
+
- `data-type` (optional): The data type of the field (e.g., "string", "number", "boolean", "symbol", "object", "array", "function")
|
|
10
|
+
- `data-default` (optional): Default value for the field
|
|
11
|
+
- `data-required` (optional): Whether the field is required ("true" or "false")
|
|
12
|
+
- `data-deprecated` (optional): Whether the field is deprecated ("true" or "false")
|
|
13
|
+
- `data-desc` (optional): Simple description of the field (plain text only)
|
|
14
|
+
|
|
15
|
+
### Children
|
|
16
|
+
|
|
17
|
+
- For simple types (string, number, boolean): children can be empty or contain exactly one `<x-field-desc>` element
|
|
18
|
+
- For complex types (object, array), children contain nested `<x-field>` elements and optionally one `<x-field-desc>` element
|
|
19
|
+
|
|
20
|
+
### Usage Rules
|
|
21
|
+
|
|
22
|
+
- **Opening/Closing Tags Format**: `<x-field ...></x-field>` for all types
|
|
23
|
+
- **Maximum Nesting Depth**: 5 levels (to avoid overly complex structures)
|
|
24
|
+
- **Description Mutually Exclusive**: Use either `data-desc` attribute OR `<x-field-desc>` element, not both
|
|
25
|
+
- **Single Description Rule**: Only one `<x-field-desc>` element per `<x-field>` is allowed
|
|
26
|
+
- **Grouping Requirement**: Wrap the outermost `<x-field>` elements with `<x-field-group>`, even if there's only one `<x-field>` element
|
|
27
|
+
- **Recursive Structure**: Use recursive `<x-field>` structures to fully express complex object type hierarchies, decomposing all nested properties into more fundamental types
|
|
28
|
+
- **Fixed Value Fields**: For fields that accept a limited set of predefined values (including enums, constants, or fixed strings), use `<x-field>` with the base data type (e.g., "string", "number") in the `data-type` attribute, and list all possible values in the description.
|
|
29
|
+
- **Function-Type Fields**: For fields with `data-type="function"`, nest `<x-field>` elements for parameters (`data-name="parameters"`) and return value (`data-name="returnValue"`) **whenever their types are available**.
|
|
30
|
+
|
|
31
|
+
### Good Examples
|
|
32
|
+
|
|
33
|
+
- Example 1: Simple field with all attributes
|
|
34
|
+
```md
|
|
35
|
+
### Returns
|
|
36
|
+
|
|
37
|
+
<x-field-group>
|
|
38
|
+
<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>
|
|
39
|
+
</x-field-group>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
- Example 2: Field with markdown description
|
|
43
|
+
```md
|
|
44
|
+
### Context
|
|
45
|
+
|
|
46
|
+
<x-field-group>
|
|
47
|
+
<x-field data-name="api_key" data-type="string" data-required="true">
|
|
48
|
+
<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>
|
|
49
|
+
</x-field>
|
|
50
|
+
</x-field-group>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
- Example 3: Nested object structure
|
|
54
|
+
```md
|
|
55
|
+
### Properties
|
|
56
|
+
|
|
57
|
+
<x-field-group>
|
|
58
|
+
<x-field data-name="session" data-type="object" data-required="true">
|
|
59
|
+
<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>
|
|
60
|
+
<x-field data-name="user" data-type="object" data-required="true" data-desc="User basic information">
|
|
61
|
+
<x-field data-name="name" data-type="string" data-required="true" data-default="John Doe" data-desc="User name"></x-field>
|
|
62
|
+
<x-field data-name="email" data-type="string" data-required="true" data-default="john.doe@example.com">
|
|
63
|
+
<x-field-desc markdown>Primary email address used for **login** and **notifications**. Must be a valid email format.</x-field-desc>
|
|
64
|
+
</x-field>
|
|
65
|
+
<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>
|
|
66
|
+
</x-field>
|
|
67
|
+
<x-field data-name="permissions" data-type="array" data-required="true" data-default='["read", "write", "admin"]'>
|
|
68
|
+
<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>
|
|
69
|
+
</x-field>
|
|
70
|
+
</x-field>
|
|
71
|
+
</x-field-group>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
- Example 4: Multiple fields for Parameters
|
|
75
|
+
```md
|
|
76
|
+
### Parameters
|
|
77
|
+
|
|
78
|
+
<x-field-group>
|
|
79
|
+
<x-field data-name="user_id" data-type="string" data-required="true" data-desc="Unique identifier for the user. Must be a valid UUID v4 format."></x-field>
|
|
80
|
+
<x-field data-name="include_profile" data-type="boolean" data-required="false" data-default="false" data-desc="Whether to include the user's profile information in the response"></x-field>
|
|
81
|
+
<x-field data-name="options" data-type="object" data-required="false" data-desc="Additional options for the request">
|
|
82
|
+
<x-field data-name="format" data-type="string" data-required="false" data-default="json">
|
|
83
|
+
<x-field-desc>Response format: `json` or `xml`</x-field-desc>
|
|
84
|
+
</x-field>
|
|
85
|
+
<x-field data-name="locale" data-type="string" data-required="false" data-default="en" data-desc="Language locale for localized content"></x-field>
|
|
86
|
+
</x-field>
|
|
87
|
+
</x-field-group>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
- Example 5: Enum values with base type and description
|
|
91
|
+
```md
|
|
92
|
+
### Status
|
|
93
|
+
|
|
94
|
+
<x-field-group>
|
|
95
|
+
<x-field data-name="status" data-type="string" data-required="true" data-default="pending" data-desc="Current status of the request. Possible values: 'pending', 'processing', 'completed', 'failed'"></x-field>
|
|
96
|
+
<x-field data-name="priority" data-type="number" data-required="false" data-default="1">
|
|
97
|
+
<x-field-desc markdown>Priority level for the task. **Valid values**: `1` (low), `2` (medium), `3` (high), `4` (urgent)</x-field-desc>
|
|
98
|
+
</x-field>
|
|
99
|
+
</x-field-group>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
- Example 6: Function type field with nested parameters and return value
|
|
103
|
+
```md
|
|
104
|
+
### API Methods
|
|
105
|
+
|
|
106
|
+
<x-field-group>
|
|
107
|
+
<x-field data-name="authenticate" data-type="function" data-required="true" data-desc="Authenticates a user with email and password">
|
|
108
|
+
<x-field data-name="parameters" data-type="object" data-desc="Function parameters">
|
|
109
|
+
<x-field data-name="email" data-type="string" data-required="true" data-desc="User's email address"></x-field>
|
|
110
|
+
<x-field data-name="password" data-type="string" data-required="true" data-desc="User's password"></x-field>
|
|
111
|
+
<x-field data-name="rememberMe" data-type="boolean" data-required="false" data-default="false" data-desc="Whether to keep user logged in"></x-field>
|
|
112
|
+
</x-field>
|
|
113
|
+
<x-field data-name="returnValue" data-type="object" data-desc="Function return value">
|
|
114
|
+
<x-field data-name="success" data-type="boolean" data-required="true" data-desc="Whether authentication was successful"></x-field>
|
|
115
|
+
<x-field data-name="token" data-type="string" data-required="false" data-desc="JWT token if authentication successful"></x-field>
|
|
116
|
+
<x-field data-name="user" data-type="object" data-required="false" data-desc="User information if authentication successful">
|
|
117
|
+
<x-field data-name="id" data-type="string" data-required="true" data-desc="User ID"></x-field>
|
|
118
|
+
<x-field data-name="name" data-type="string" data-required="true" data-desc="User's display name"></x-field>
|
|
119
|
+
<x-field data-name="email" data-type="string" data-required="true" data-desc="User's email address"></x-field>
|
|
120
|
+
</x-field>
|
|
121
|
+
</x-field>
|
|
122
|
+
</x-field>
|
|
123
|
+
</x-field-group>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Bad Examples
|
|
127
|
+
|
|
128
|
+
- Example 1: Using self-closing tag (violates "Opening/Closing Tags Format" rule)
|
|
129
|
+
```md
|
|
130
|
+
<x-field-group>
|
|
131
|
+
<x-field data-name="user_id" data-type="string" data-required="true" data-desc="User identifier" />
|
|
132
|
+
</x-field-group>
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
- Example 2: Using both `data-desc` and `<x-field-desc>` (violates "Description Mutually Exclusive" rule)
|
|
136
|
+
```md
|
|
137
|
+
<x-field-group>
|
|
138
|
+
<x-field data-name="api_key" data-type="string" data-required="true" data-desc="API key for authentication">
|
|
139
|
+
<x-field-desc markdown>Your **API key** for authentication. Keep it secure and never expose it.</x-field-desc>
|
|
140
|
+
</x-field>
|
|
141
|
+
</x-field-group>
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
- Example 3: Using multiple `<x-field-desc>` elements (violates "Single Description Rule")
|
|
145
|
+
```md
|
|
146
|
+
<x-field-group>
|
|
147
|
+
<x-field data-name="config" data-type="object" data-required="true">
|
|
148
|
+
<x-field-desc markdown>Configuration object for the application.</x-field-desc>
|
|
149
|
+
<x-field-desc markdown>Contains all runtime settings and preferences.</x-field-desc>
|
|
150
|
+
</x-field>
|
|
151
|
+
</x-field-group>
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
- Example 4: Nesting other child elements (violates "Children" rule)
|
|
155
|
+
```md
|
|
156
|
+
<x-field-group>
|
|
157
|
+
<x-field data-name="user" data-type="object" data-required="true">
|
|
158
|
+
<div>User information</div>
|
|
159
|
+
<x-field data-name="name" data-type="string" data-required="true" data-desc="User name"></x-field>
|
|
160
|
+
</x-field>
|
|
161
|
+
</x-field-group>
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
- Example 5: Missing x-field-group wrapper (violates "Grouping Requirement" rule)
|
|
165
|
+
```md
|
|
166
|
+
<x-field data-name="apiConfig" data-type="object" data-required="true" data-desc="API configuration object">
|
|
167
|
+
<x-field data-name="baseUrl" data-type="string" data-required="true" data-desc="Base URL for API calls"></x-field>
|
|
168
|
+
<x-field data-name="timeout" data-type="number" data-required="false" data-default="5000" data-desc="Request timeout in milliseconds"></x-field>
|
|
169
|
+
</x-field>
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
- Example 6: Exceeding maximum nesting depth (violates "Maximum Nesting Depth" rule)
|
|
173
|
+
```md
|
|
174
|
+
<x-field-group>
|
|
175
|
+
<x-field data-name="level1" data-type="object" data-required="true">
|
|
176
|
+
<x-field data-name="level2" data-type="object" data-required="true">
|
|
177
|
+
<x-field data-name="level3" data-type="object" data-required="true">
|
|
178
|
+
<x-field data-name="level4" data-type="object" data-required="true">
|
|
179
|
+
<x-field data-name="level5" data-type="object" data-required="true">
|
|
180
|
+
<x-field data-name="level6" data-type="string" data-required="true" data-desc="Too deep nesting"></x-field>
|
|
181
|
+
</x-field>
|
|
182
|
+
</x-field>
|
|
183
|
+
</x-field>
|
|
184
|
+
</x-field>
|
|
185
|
+
</x-field>
|
|
186
|
+
</x-field-group>
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
</x-field-usage-rules>
|