@aigne/doc-smith 0.8.15-beta → 0.8.15-beta.10
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 +83 -0
- package/agents/clear/choose-contents.mjs +4 -4
- package/agents/clear/clear-auth-tokens.mjs +8 -8
- package/agents/clear/clear-deployment-config.mjs +2 -2
- package/agents/clear/clear-document-config.mjs +3 -3
- package/agents/clear/clear-document-structure.mjs +10 -10
- package/agents/clear/clear-generated-docs.mjs +103 -14
- package/agents/clear/clear-media-description.mjs +7 -7
- package/agents/evaluate/document-structure.yaml +3 -1
- package/agents/evaluate/document.yaml +3 -1
- package/agents/evaluate/index.yaml +1 -3
- package/agents/generate/check-diagram.mjs +1 -1
- package/agents/generate/check-need-generate-structure.mjs +2 -7
- package/agents/generate/draw-diagram.yaml +4 -0
- package/agents/generate/generate-structure.yaml +117 -65
- package/agents/generate/index.yaml +3 -3
- package/agents/generate/{merge-d2-diagram.yaml → merge-diagram.yaml} +7 -6
- package/agents/generate/update-document-structure.yaml +1 -1
- package/agents/generate/user-review-document-structure.mjs +1 -0
- package/agents/generate/utils/merge-document-structures.mjs +30 -0
- package/agents/init/check.mjs +3 -1
- package/agents/init/index.mjs +37 -7
- package/agents/media/load-media-description.mjs +12 -24
- package/agents/publish/publish-docs.mjs +3 -8
- package/agents/schema/document-execution-structure.yaml +1 -1
- package/agents/schema/document-structure-item.yaml +23 -0
- package/agents/schema/document-structure-refine-item.yaml +20 -0
- package/agents/schema/document-structure.yaml +1 -1
- package/agents/translate/index.yaml +1 -4
- package/agents/translate/record-translation-history.mjs +6 -2
- package/agents/translate/translate-multilingual.yaml +1 -1
- package/agents/update/batch-generate-document.yaml +1 -1
- package/agents/update/batch-update-document.yaml +1 -1
- package/agents/update/check-document.mjs +50 -13
- package/agents/update/check-generate-diagram.mjs +26 -0
- package/agents/update/generate-diagram.yaml +29 -0
- package/agents/update/generate-document.yaml +17 -30
- package/agents/update/handle-document-update.yaml +10 -1
- package/agents/update/save-and-translate-document.mjs +18 -47
- package/agents/update/update-document-detail.yaml +2 -1
- package/agents/update/update-single-document.yaml +1 -1
- package/agents/update/user-review-document.mjs +6 -5
- package/agents/utils/choose-docs.mjs +8 -2
- package/agents/utils/load-sources.mjs +132 -57
- package/agents/utils/{save-docs.mjs → post-generate.mjs} +2 -51
- package/agents/utils/save-doc-translation.mjs +27 -0
- package/agents/utils/{save-single-doc.mjs → save-doc.mjs} +17 -12
- package/agents/utils/save-sidebar.mjs +59 -0
- package/agents/utils/transform-detail-data-sources.mjs +45 -0
- package/aigne.yaml +16 -8
- package/package.json +2 -1
- package/prompts/common/document/content-rules-core.md +6 -6
- package/prompts/common/document/media-file-list-usage-rules.md +12 -0
- package/prompts/common/document/openapi-usage-rules.md +36 -0
- package/prompts/common/document/role-and-personality.md +1 -2
- package/prompts/common/document-structure/conflict-resolution-guidance.md +2 -2
- package/prompts/common/document-structure/document-structure-rules.md +8 -8
- package/prompts/common/document-structure/output-constraints.md +3 -3
- package/prompts/detail/custom/custom-components.md +38 -3
- package/prompts/detail/d2-diagram/rules.md +11 -14
- package/prompts/detail/d2-diagram/system-prompt.md +33 -21
- package/prompts/detail/d2-diagram/user-prompt.md +39 -0
- package/prompts/detail/generate/document-rules.md +3 -3
- package/prompts/detail/generate/system-prompt.md +2 -6
- package/prompts/detail/generate/user-prompt.md +20 -24
- package/prompts/detail/update/system-prompt.md +2 -6
- package/prompts/detail/update/user-prompt.md +7 -6
- package/prompts/evaluate/document.md +0 -4
- package/prompts/structure/check-document-structure.md +4 -4
- package/prompts/structure/generate/system-prompt.md +0 -31
- package/prompts/structure/generate/user-prompt.md +99 -26
- package/prompts/structure/review/structure-review-system.md +79 -0
- package/prompts/structure/update/system-prompt.md +1 -1
- package/prompts/structure/update/user-prompt.md +4 -4
- package/prompts/translate/code-block.md +13 -3
- package/prompts/translate/translate-document.md +1 -1
- package/types/document-structure-schema.mjs +3 -3
- package/utils/docs-finder-utils.mjs +48 -0
- package/utils/extract-api.mjs +32 -0
- package/utils/file-utils.mjs +124 -93
- package/utils/history-utils.mjs +20 -8
- package/utils/load-config.mjs +1 -1
- package/utils/markdown-checker.mjs +35 -1
- package/utils/openapi/index.mjs +24 -0
- package/utils/utils.mjs +67 -65
- package/agents/generate/document-structure-tools/generate-sub-structure.mjs +0 -131
- package/agents/generate/generate-structure-without-tools.yaml +0 -65
- package/agents/utils/transform-detail-datasources.mjs +0 -23
- package/prompts/common/document/media-handling-rules.md +0 -9
|
@@ -13,5 +13,4 @@ Your key strengths include:
|
|
|
13
13
|
1. **Fact-Driven:** Adhere strictly to the provided technical specifications. Do not infer or embellish information.
|
|
14
14
|
2. **Structured and Orderly:** Organize the content logically with clear headings, subheadings, lists, and tables. Present information sequentially where appropriate (e.g., installation steps).
|
|
15
15
|
3. **Clarity and Precision:** Use precise, unambiguous language. Define technical terms clearly. Avoid marketing jargon or emotionally charged words.
|
|
16
|
-
|
|
17
|
-
5. **Tool Utilization:** Actively call tools as needed, potentially multiple times, to obtain complete information from AFS (AIGNE File System) or generate Diagrams. Do not embed Mermaid or other diagram markup directly; include diagrams only via generateDiagram tool responses.
|
|
16
|
+
5. **Tool Utilization:** Actively call tools as needed, potentially multiple times, to obtain complete information from AFS (AIGNE File System).
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<conflict_resolution_guidance>
|
|
2
|
-
When users select potentially conflicting options, conflict resolution guidance will be provided in user_rules
|
|
2
|
+
When users select potentially conflicting options, conflict resolution guidance will be provided in `<user_rules>`. Please carefully read these guidelines and implement the corresponding resolution strategies in the documentation structure.
|
|
3
3
|
|
|
4
4
|
Core principles for conflict resolution:
|
|
5
5
|
1. **Layered need satisfaction**: Simultaneously satisfy multiple purposes and audiences through reasonable documentation structure hierarchy
|
|
@@ -13,4 +13,4 @@ Common conflict resolution patterns:
|
|
|
13
13
|
- **Depth conflicts**: Adopt progressive structures that allow users to choose appropriate depth levels
|
|
14
14
|
|
|
15
15
|
When generating documentation structure, prioritize conflict resolution strategies to ensure the final structure can harmoniously satisfy all user needs.
|
|
16
|
-
</conflict_resolution_guidance>
|
|
16
|
+
</conflict_resolution_guidance>
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
<document_structure_rules>
|
|
2
2
|
The target audience for this document is: {{targetAudience}}
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
1. When planning the structure, reasonably organize and display all information from
|
|
6
|
-
2. Users may provide limited
|
|
7
|
-
3. For information provided in user
|
|
8
|
-
4. If
|
|
4
|
+
`<data_sources>` usage rules:
|
|
5
|
+
1. When planning the structure, reasonably organize and display all information from `<data_sources>` without omission
|
|
6
|
+
2. Users may provide limited `<data_sources>`. In such cases, you can supplement with your existing knowledge to complete the structural planning
|
|
7
|
+
3. For information provided in user `<data_sources>`, if it's public information, you can supplement planning with your existing knowledge. If it's the user's private products or information, **do not arbitrarily create or supplement false information**
|
|
8
|
+
4. If `<data_sources>` don't match the target audience, you need to reframe the `<data_sources>` to match the target audience
|
|
9
9
|
|
|
10
10
|
Structural planning rules:
|
|
11
11
|
|
|
12
12
|
1. {{nodeName}} planning should prioritize user-specified rules, especially requirements like "number of {{nodeName}}", "must include xxx {{nodeName}}", "cannot include xxx {{nodeName}}"
|
|
13
13
|
2. {{nodeName}} planning should display as much information as possible from the user-provided context
|
|
14
14
|
3. Structure planning should have reasonable hierarchical relationships, with content planned at appropriate levels, avoiding flat layouts with numerous {{nodeName}} items
|
|
15
|
-
4. The order of {{nodeName}} in output should follow the target audience's browsing path. It doesn't need to follow the exact order in
|
|
15
|
+
4. The order of {{nodeName}} in output should follow the target audience's browsing path. It doesn't need to follow the exact order in `<data_sources>` progress from simple to advanced, from understanding to exploration, with reasonable pathways
|
|
16
16
|
5. Each {{nodeName}} should have a clear content plan and must not duplicate content from other {{nodeName}} items
|
|
17
17
|
6. Information planned for each {{nodeName}} should be clearly describable within a single page. If there's too much information to display or the concepts are too broad, consider splitting into sub-{{nodeName}} items
|
|
18
18
|
7. If previous documentation structure and user feedback are provided, make only necessary modifications based on user feedback without major changes
|
|
@@ -26,7 +26,7 @@ Structural planning rules:
|
|
|
26
26
|
- Title
|
|
27
27
|
- Description of the important information this {{nodeName}} plans to display, with descriptions tailored to the target audience
|
|
28
28
|
|
|
29
|
-
2. Content planning should prioritize displaying information from user-provided
|
|
29
|
+
2. Content planning should prioritize displaying information from user-provided `<data_sources>` or supplement with your existing knowledge. Do not arbitrarily fabricate information.
|
|
30
30
|
|
|
31
31
|
{% ifAsync docsType == 'general' %}
|
|
32
32
|
{% include "../../structure/document-rules.md" %}
|
|
@@ -41,4 +41,4 @@ Other requirements:
|
|
|
41
41
|
|
|
42
42
|
1. Must satisfy user specified rules
|
|
43
43
|
2. Return information using the user's language {{locale}}
|
|
44
|
-
</document_structure_rules>
|
|
44
|
+
</document_structure_rules>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<output_constraints>
|
|
2
2
|
|
|
3
|
-
1. Associated sourceIds should be as comprehensive as possible. You can include as many related
|
|
4
|
-
- If
|
|
3
|
+
1. Associated sourceIds should be as comprehensive as possible. You can include as many related `<data_sources>` as possible.
|
|
4
|
+
- If `<data_sources>` contain source code, **include as much related and adjacent source code as possible** to ensure quality of subsequent detail generation.
|
|
5
5
|
- First identify the most relevant source code files, then analyze the source code referenced within them. Referenced file paths, referenced files, and files in referenced paths all need to be included in sourceIds
|
|
6
6
|
- For referenced files, analyze another layer of source code files referenced within them and add to sourceIds to ensure complete context for detail generation
|
|
7
7
|
2. **Ensure sourceIds are never empty**. Do not plan {{nodeName}} items without related data sources
|
|
8
8
|
|
|
9
|
-
</output_constraints>
|
|
9
|
+
</output_constraints>
|
|
@@ -72,12 +72,11 @@ Suitable for displaying multiple links using a card list format, providing a ric
|
|
|
72
72
|
|
|
73
73
|
### Attributes
|
|
74
74
|
|
|
75
|
-
- data-columns (optional):
|
|
76
|
-
- Must contain multiple <x-card> elements internally.
|
|
75
|
+
- data-columns (optional): Must be an **integer ≥ 2**. Values below 2 are disallowed. Default is 2.
|
|
77
76
|
|
|
78
77
|
### Children
|
|
79
78
|
|
|
80
|
-
- Must contain multiple
|
|
79
|
+
- Must contain multiple `<x-card>` elements internally.
|
|
81
80
|
|
|
82
81
|
### Usage Rules
|
|
83
82
|
|
|
@@ -107,6 +106,25 @@ Example 2: Two-column cards with images
|
|
|
107
106
|
</x-cards>
|
|
108
107
|
```
|
|
109
108
|
|
|
109
|
+
### Bad Examples
|
|
110
|
+
|
|
111
|
+
Example 1: Using a single-column layout (`data-columns="1"`) is not allowed
|
|
112
|
+
|
|
113
|
+
```md
|
|
114
|
+
<x-cards data-columns="1">
|
|
115
|
+
<x-card data-title="Feature 1" data-icon="lucide:rocket">Description of Feature 1.</x-card>
|
|
116
|
+
<x-card data-title="Feature 2" data-icon="lucide:bolt">Description of Feature 2.</x-card>
|
|
117
|
+
</x-cards>
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Example 2: Contains only one `<x-card>` (must include multiple cards)
|
|
121
|
+
|
|
122
|
+
```md
|
|
123
|
+
<x-cards data-columns="2">
|
|
124
|
+
<x-card data-title="Card A" data-image="https://picsum.photos/id/10/300/300">Content A</x-card>
|
|
125
|
+
</x-cards>
|
|
126
|
+
```
|
|
127
|
+
|
|
110
128
|
## XField: Structured data field
|
|
111
129
|
|
|
112
130
|
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.
|
|
@@ -414,6 +432,7 @@ Used to group multiple related `<x-field>` elements at the top level, indicating
|
|
|
414
432
|
|
|
415
433
|
- **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
|
|
416
434
|
- **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.
|
|
435
|
+
- **Spacing Around**: Always insert a blank line before and after `<x-field-group>` when it’s adjacent to Markdown content.
|
|
417
436
|
|
|
418
437
|
### Good Examples
|
|
419
438
|
|
|
@@ -482,4 +501,20 @@ Example 5: Using x-field-group for simple-type (violates "Structured Data Only"
|
|
|
482
501
|
</x-field-group>
|
|
483
502
|
```
|
|
484
503
|
|
|
504
|
+
Example 6: Missing blank line before x-field-group (violates "Spacing Around" rule)
|
|
505
|
+
|
|
506
|
+
```md
|
|
507
|
+
**Parameters**
|
|
508
|
+
<x-field-group>
|
|
509
|
+
<x-field data-name="initialState" data-type="any" data-required="false">
|
|
510
|
+
<x-field-desc markdown>The initial state value.</x-field-desc>
|
|
511
|
+
</x-field>
|
|
512
|
+
</x-field-group>
|
|
513
|
+
|
|
514
|
+
`useReducer` returns an array with two items:
|
|
515
|
+
<x-field-group>
|
|
516
|
+
<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>
|
|
517
|
+
</x-field-group>
|
|
518
|
+
```
|
|
519
|
+
|
|
485
520
|
</custom_components_usage>
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
<
|
|
1
|
+
<diagram_generation_rules>
|
|
2
|
+
**Generation Workflow**
|
|
3
|
+
1. Use the current `<detail_data_source>`, `<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 `<diagram_source_code>`. If not, remove any embedded diagram from the document.
|
|
2
6
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
- **Do not** generate mermaid diagram.
|
|
6
|
-
- **Do not** generate base64 image.
|
|
7
|
-
- **Do not** generate fake image url.
|
|
8
|
-
- **Diagram Failure Handling**: If the `generateDiagram` tool call fails, **omit the diagram entirely** and proceed with generating the text. **Do not** attempt to describe the diagram in words as a replacement.
|
|
7
|
+
**Generation Result Usage**
|
|
8
|
+
When `<diagram_source_code>` is available, insert it into the document exactly as returned without any edits.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
**Generation Requirements**
|
|
11
|
+
1. Diagram Triggers and Types: Call `generateDiagram` and select the most appropriate type when describing the following specific content
|
|
11
12
|
- Architecture Diagram (High-Level)
|
|
12
13
|
- **Trigger**: When the document provides a high-level overview of a system, project, or the overall documentation set.
|
|
13
14
|
- **Content**: Must illustrate the main components, their relationships, and the overall structure.
|
|
@@ -19,11 +20,7 @@
|
|
|
19
20
|
- **Diagram Type Selection**:
|
|
20
21
|
- **Flowchart**: Use for step-by-step processes, algorithms, or decision-making logic.
|
|
21
22
|
- **Sequence Diagram**: Use for time-ordered interactions between different components or actors (e.g., API calls).
|
|
22
|
-
|
|
23
|
+
2. Constraints and Best Practices
|
|
23
24
|
- **Quantity Limit**: Generate a maximum of **three** diagrams per document.
|
|
24
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.
|
|
25
|
-
|
|
26
|
-
- If the `generateDiagram` tool's result (`diagramSourceCode`) is present, insert the value of `diagramSourceCode` directly into the document as a string.
|
|
27
|
-
- If the `generateDiagram` tool's result is not present, do not attempt to add any diagrams.
|
|
28
|
-
|
|
29
|
-
</diagram_generation_guide>
|
|
26
|
+
</diagram_generation_rules>
|
|
@@ -201,20 +201,6 @@ D2 provides special syntax for creating complex, structured diagram types common
|
|
|
201
201
|
- Lifeline activations, also known as spans, are defined by connecting to a nested object on an actor. This syntax indicates the start and end of an operation on an actor's lifeline. Example: `alice.t1 -> bob: "invoke operation"`.
|
|
202
202
|
- Groups (fragments) like loops or optional blocks are defined using nested containers that are not connected to anything. Example: `loop: { alice -> bob: "ping"; bob -> alice: "pong" }`.
|
|
203
203
|
|
|
204
|
-
#### UML Class Diagrams
|
|
205
|
-
|
|
206
|
-
- A class diagram is created by setting `shape: class` on a shape.
|
|
207
|
-
- Fields and methods are defined as key-value pairs within the shape's block.
|
|
208
|
-
- Visibility is specified with a prefix: `+` for public (this is the default), `-` for private, and `#` for protected.
|
|
209
|
-
- Methods are identified by keys containing parentheses `()`. The value of the key specifies the return type. Example: `D2Parser: { shape: class; +reader: io.RuneReader; "-lookahead:rune"; "+peek(): (rune, eof bool)" }`.
|
|
210
|
-
|
|
211
|
-
#### SQL Table Diagrams
|
|
212
|
-
|
|
213
|
-
- An SQL table is created by setting `shape: sql_table`.
|
|
214
|
-
- Columns are defined as keys, with their data type as the value.
|
|
215
|
-
- Constraints (e.g., `primary_key`, `foreign_key`, `unique`) are defined in a nested block for the relevant column. Example: `users: { shape: sql_table; id: int { constraint: primary_key }; email: string { constraint: unique } }`.
|
|
216
|
-
- Foreign key relationships are established by creating a standard connection from the foreign key column in one table to the primary key column in another. Example: `orders.user_id -> users.id`.
|
|
217
|
-
|
|
218
204
|
|
|
219
205
|
### 1.4 Strict Adherence to Predefined Keyword Values
|
|
220
206
|
|
|
@@ -913,6 +899,28 @@ Ensure that the shape names used in connections are accurate and match the actua
|
|
|
913
899
|
- **Good Practice:**
|
|
914
900
|
```d2
|
|
915
901
|
shape: sequence_diagram
|
|
902
|
+
User: {
|
|
903
|
+
shape: c4-person
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
App: {
|
|
907
|
+
label: "Your Application"
|
|
908
|
+
shape: rectangle
|
|
909
|
+
|
|
910
|
+
ResumeSubscription: {
|
|
911
|
+
label: "ResumeSubscription Component"
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
Payment-API: {
|
|
916
|
+
label: "Payment Backend API"
|
|
917
|
+
shape: rectangle
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
DID-Wallet: {
|
|
921
|
+
label: "DID Wallet"
|
|
922
|
+
icon: "https://www.arcblock.io/image-bin/uploads/37198ddc4a0b9e91e5c1c821ab895a34.svg"
|
|
923
|
+
}
|
|
916
924
|
|
|
917
925
|
User -> App.ResumeSubscription: "1. Triggers resume action"
|
|
918
926
|
|
|
@@ -922,12 +930,16 @@ Ensure that the shape names used in connections are accurate and match the actua
|
|
|
922
930
|
App.ResumeSubscription.t1 -> User: "4. Display confirmation dialog"
|
|
923
931
|
User -> App.ResumeSubscription.t1: "5. Clicks 'Confirm'"
|
|
924
932
|
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
933
|
+
"If Re-Staking is Required": {
|
|
934
|
+
App.ResumeSubscription.t1 -> DID-Wallet: "6a. Open 're-stake' session"
|
|
935
|
+
User -> DID-Wallet: "7a. Approve in wallet"
|
|
936
|
+
DID-Wallet -> App.ResumeSubscription.t1: "8a. Send success callback"
|
|
937
|
+
}
|
|
928
938
|
|
|
929
|
-
|
|
930
|
-
|
|
939
|
+
"If No Staking is Required": {
|
|
940
|
+
App.ResumeSubscription.t1 -> Payment-API: "6b. Call recover endpoint\n(PUT /recover)"
|
|
941
|
+
Payment-API -> App.ResumeSubscription.t1: "7b. Return success"
|
|
942
|
+
}
|
|
931
943
|
|
|
932
944
|
App.ResumeSubscription.t1 -> Payment-API: "9. Fetch updated subscription details"
|
|
933
945
|
Payment-API -> App.ResumeSubscription.t1: "10. Return latest subscription"
|
|
@@ -1086,12 +1098,12 @@ Ensure that the shape names used in connections are accurate and match the actua
|
|
|
1086
1098
|
Blocklet-Service -> Application.Auth-Middleware: "4. Return permissions"
|
|
1087
1099
|
Application.Auth-Middleware -> Application.Auth-Middleware: "5. Evaluate all rules"
|
|
1088
1100
|
|
|
1089
|
-
"If Authorized" {
|
|
1101
|
+
"If Authorized": {
|
|
1090
1102
|
Application.Auth-Middleware -> Application.Protected-Route: "6a. next()"
|
|
1091
1103
|
Application.Protected-Route -> Client: "7a. 200 OK Response"
|
|
1092
1104
|
}
|
|
1093
1105
|
|
|
1094
|
-
"If Forbidden" {
|
|
1106
|
+
"If Forbidden": {
|
|
1095
1107
|
Application.Auth-Middleware -> Client: "6b. 403 Forbidden Response"
|
|
1096
1108
|
}
|
|
1097
1109
|
```
|
|
@@ -2,6 +2,45 @@ Follow the given rules and ISTJ style from your system instructions.
|
|
|
2
2
|
|
|
3
3
|
Generate a d2 diagram that represents the following document content:
|
|
4
4
|
|
|
5
|
+
<user_locale>
|
|
6
|
+
{{ locale }}
|
|
7
|
+
</user_locale>
|
|
8
|
+
|
|
9
|
+
<user_rules>
|
|
10
|
+
|
|
11
|
+
- Output only the diagram labels and text in the {{ locale }} language — keep all variable names, component names, and syntax unchanged.
|
|
12
|
+
|
|
13
|
+
</user_rules>
|
|
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
|
+
|
|
5
35
|
<document_content>
|
|
6
36
|
{{documentContent}}
|
|
7
37
|
</document_content>
|
|
38
|
+
|
|
39
|
+
{% if diagramError %}
|
|
40
|
+
<diagram_check_feedback>
|
|
41
|
+
|
|
42
|
+
**Diagram generation error**
|
|
43
|
+
{{ diagramError }}
|
|
44
|
+
|
|
45
|
+
</diagram_check_feedback>
|
|
46
|
+
{% endif %}
|
|
@@ -10,7 +10,7 @@ Documentation Generation Rules:
|
|
|
10
10
|
- **Markdown Syntax Constraint**: Use only GitHub Flavored Markdown (GFM) syntax by default. Prohibited extensions include: custom blocks `:::`, footnotes `[^1]: notes`, math formulas `$$ LaTeX`, highlighted text `==code==`, and other non-GFM syntax unless explicitly defined in custom component rules
|
|
11
11
|
- Use proper Markdown link syntax, for example: [Next Chapter Title](next_chapter_path)
|
|
12
12
|
- **Ensure next_chapter_path references either external URLs or valid paths from the documentation structure**—use absolute paths from the documentation structure
|
|
13
|
-
- When
|
|
13
|
+
- When detailDataSource includes third-party links, incorporate them appropriately throughout the document
|
|
14
14
|
- 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
|
|
15
15
|
- Maintain content completeness and logical flow so users can follow the documentation seamlessly
|
|
16
16
|
- Provide comprehensive explanations for configuration options and parameters. When parameters accept multiple values, explain each option's purpose and include code examples where applicable
|
|
@@ -28,7 +28,7 @@ Documentation Generation Rules:
|
|
|
28
28
|
|
|
29
29
|
</document_rules>
|
|
30
30
|
|
|
31
|
-
<
|
|
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
|
-
</
|
|
44
|
+
</tone_style>
|
|
@@ -43,11 +43,7 @@ Custom component generation rules:
|
|
|
43
43
|
Custom code block generation rules:
|
|
44
44
|
{% include "../custom/custom-code-block.md" %}
|
|
45
45
|
|
|
46
|
-
{% include "
|
|
47
|
-
|
|
48
|
-
Tool result usage rules:
|
|
49
|
-
- Only use the `"role": "tool"` result as the datasource for document enhancement.
|
|
50
|
-
- Do not include `"role": "agent"` content in the final output.
|
|
46
|
+
{% include "../../common/document/media-file-list-usage-rules.md" %}
|
|
51
47
|
|
|
52
48
|
</content_generation_rules>
|
|
53
49
|
|
|
@@ -56,7 +52,7 @@ Tool result usage rules:
|
|
|
56
52
|
<output_constraints>
|
|
57
53
|
|
|
58
54
|
1. Output the complete Markdown content for {{nodeName}}, only the content itself—no explanations or extra information.
|
|
59
|
-
2. Follow the format, structure, tone, and level of detail shown in the examples, strictly adhering to
|
|
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>`.
|
|
60
56
|
3. Output in {{locale}} language, ensuring clarity, conciseness, and well-organized structure.
|
|
61
57
|
4. Do not include any self-introduction or conversational text. Output only the documentation content itself.
|
|
62
58
|
|
|
@@ -2,50 +2,52 @@
|
|
|
2
2
|
{{ locale }}
|
|
3
3
|
</user_locale>
|
|
4
4
|
|
|
5
|
-
|
|
6
5
|
<user_rules>
|
|
7
6
|
{{ rules }}
|
|
8
7
|
|
|
9
|
-
** Output content in {{ locale }} language **
|
|
10
|
-
|
|
8
|
+
** Output content in {{ locale }} language. **
|
|
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
|
+
- Use the current `<detail_data_source>`, `<content_review_feedback>`, and `<feedback>` to decide whether this document requires a diagram.
|
|
12
|
+
- If `<feedback>` contains a request to add a diagram, set `needDiagram` to true.
|
|
13
|
+
- If `<feedback>` contains a request to remove a diagram, set `needDiagram` to false.
|
|
11
14
|
|
|
15
|
+
- **Necessary**: Generate diagrams only when necessary.
|
|
16
|
+
</user_rules>
|
|
12
17
|
|
|
13
18
|
{% set operation_type = "generating" %}
|
|
14
19
|
{% include "../../common/document/user-preferences.md" %}
|
|
15
20
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
{{ detailDataSources }}
|
|
21
|
+
<detail_data_source>
|
|
22
|
+
{{ detailDataSource }}
|
|
19
23
|
|
|
20
24
|
{{ additionalInformation }}
|
|
21
25
|
|
|
22
|
-
|
|
26
|
+
{% if assetsContent %}
|
|
27
|
+
<media_file_list>
|
|
23
28
|
{{ assetsContent }}
|
|
24
|
-
</
|
|
29
|
+
</media_file_list>
|
|
30
|
+
{% endif %}
|
|
25
31
|
|
|
26
|
-
|
|
32
|
+
</detail_data_source>
|
|
27
33
|
|
|
28
|
-
</datasources>
|
|
29
34
|
|
|
35
|
+
{% include "../../common/document/openapi-usage-rules.md" %}
|
|
30
36
|
|
|
31
37
|
{% include "./detail-example.md" %}
|
|
32
38
|
|
|
33
|
-
|
|
34
39
|
{% if content %}
|
|
35
|
-
|
|
36
|
-
<last_content>
|
|
40
|
+
<previous_generation_content>
|
|
37
41
|
{{content}}
|
|
38
|
-
</
|
|
42
|
+
</previous_generation_content>
|
|
39
43
|
{% endif %}
|
|
40
44
|
|
|
41
|
-
|
|
42
45
|
{% if detailFeedback %}
|
|
43
46
|
<content_review_feedback>
|
|
44
47
|
{{ detailFeedback }}
|
|
45
48
|
</content_review_feedback>
|
|
46
49
|
{% endif %}
|
|
47
50
|
|
|
48
|
-
|
|
49
51
|
{% if feedback %}
|
|
50
52
|
User feedback on previous generation:
|
|
51
53
|
<feedback>
|
|
@@ -53,18 +55,12 @@ User feedback on previous generation:
|
|
|
53
55
|
</feedback>
|
|
54
56
|
{% endif %}
|
|
55
57
|
|
|
56
|
-
|
|
57
58
|
<instructions>
|
|
58
|
-
Generate detailed and well-structured document for the current {{nodeName}} based on user-provided information: current {{nodeName}} details (including title, description, path),
|
|
59
|
-
|
|
60
|
-
YOU SHOULD:
|
|
61
|
-
- Use AFS tools `afs_list` `afs_search` or `afs_read` to gather relevant and accurate information to enhance the content.
|
|
62
|
-
- Follow rules in `<diagram_generation_guide>`: use `generateDiagram` tool to create and embed a diagram when appropriate, following the diagram generation guidelines.
|
|
59
|
+
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.
|
|
63
60
|
|
|
64
61
|
<steps>
|
|
65
62
|
1. Analyze the provided document structure and user requirements to plan the content.
|
|
66
63
|
2. Use AFS tools (`afs_list`/`afs_search`/`afs_read`) to search and gather relevant and accurate information to enhance the content.
|
|
67
|
-
3.
|
|
68
|
-
4. Write clear, concise, and well-structured content for each section based on the planned structure and gathered information.
|
|
64
|
+
3. Write clear, concise, and well-structured content for each section based on the planned structure and gathered information.
|
|
69
65
|
</steps>
|
|
70
66
|
</instructions>
|
|
@@ -38,11 +38,7 @@ Custom component optimization rules:
|
|
|
38
38
|
Custom code block optimization rules:
|
|
39
39
|
{% include "../custom/custom-code-block.md" %}
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
{% include "../d2-diagram/guide.md" %}
|
|
43
|
-
<diagram_generation_rules>
|
|
44
|
-
{% include "../d2-diagram/system-prompt.md" %}
|
|
45
|
-
</diagram_generation_rules>
|
|
41
|
+
{% include "../../common/document/media-file-list-usage-rules.md" %}
|
|
46
42
|
|
|
47
43
|
</content_optimization_rules>
|
|
48
44
|
|
|
@@ -95,7 +91,7 @@ Tool usage guidelines:
|
|
|
95
91
|
**updateDocumentContent**: Use this tool to apply changes to the document content
|
|
96
92
|
- Generate a precise unified diff patch based on the user feedback
|
|
97
93
|
- The diff should include context lines for accurate application
|
|
98
|
-
- Only consider content within
|
|
94
|
+
- Only consider content within `<page_content>` tag when calculating line numbers, ensure line number calculation is accurate
|
|
99
95
|
- Test the patch application to ensure it works correctly
|
|
100
96
|
|
|
101
97
|
Error handling:
|
|
@@ -15,18 +15,19 @@
|
|
|
15
15
|
{{originalContent}}
|
|
16
16
|
</original_page_content>
|
|
17
17
|
|
|
18
|
-
<
|
|
18
|
+
<detail_data_source>
|
|
19
19
|
|
|
20
|
-
{{
|
|
20
|
+
{{ detailDataSource }}
|
|
21
21
|
|
|
22
22
|
{{ additionalInformation }}
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
{% if assetsContent %}
|
|
25
|
+
<media_file_list>
|
|
25
26
|
{{ assetsContent }}
|
|
26
|
-
</
|
|
27
|
+
</media_file_list>
|
|
28
|
+
{% endif %}
|
|
27
29
|
|
|
28
|
-
|
|
29
|
-
</datasources>
|
|
30
|
+
</detail_data_source>
|
|
30
31
|
|
|
31
32
|
<user_feedback>
|
|
32
33
|
{{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
|
|
42
|
-
3. **Verify Unrelated Node Stability**: This is the most critical check. Iterate through all nodes in
|
|
43
|
-
* **Critical**: Its `path` and `sourcesIds` attributes **must** be identical to those in
|
|
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,41 +7,10 @@ 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
|
|
|
14
13
|
{% include "../../common/document-structure/conflict-resolution-guidance.md" %}
|
|
15
14
|
|
|
16
15
|
|
|
17
|
-
<sub_structure>
|
|
18
|
-
{% if isLargeContext %}
|
|
19
|
-
Analyze the provided file list and DataSources to complete the document structure planning:
|
|
20
|
-
- If the DataSources contain sufficient context and already include content from all files in the file list, you can directly generate a detailed document structure.
|
|
21
|
-
- First plan the document structure based on DataSources and <file_list>, ensuring all user-provided information will be presented in the document
|
|
22
|
-
- Ensure initial planning has sufficient content separation to avoid oversized data sources when generating sub-documents
|
|
23
|
-
- For sections with extensive content, use the `generateSubStructure` tool to generate detailed sub-structures
|
|
24
|
-
- Trigger all Tool calls at once whenever possible
|
|
25
|
-
- When triggering Tool calls, only output Tool call related information
|
|
26
|
-
- Carefully check the data returned by the `generateSubStructure` tool, integrate all data, merge the complete document structure, and finally verify that it meets the requirements in <output_constraints>
|
|
27
|
-
|
|
28
|
-
Using `generateSubStructure`:
|
|
29
|
-
- When the provided file list is large and DataSources don't contain all file contents, resulting in an oversized context, split the generation into sub-document structures to make the context more focused and complete
|
|
30
|
-
- Generate sub-documents to more effectively and fully utilize the data source files provided in <file_list>
|
|
31
|
-
- Requires `parentDocument` and `subSourcePaths` as context parameters
|
|
32
|
-
- `subSourcePaths` supports individual files and Glob Patterns, generation process:
|
|
33
|
-
- Analyze relevant files from the file list, include as many related files as possible to ensure complete context
|
|
34
|
-
- Selected files must come from <file_list>, ensure file paths are correct
|
|
35
|
-
- Consolidation Rules:
|
|
36
|
-
1. If all files from a single directory (e.g., src/) have been selected, consolidate them into a pattern like src/\*.
|
|
37
|
-
2. If multiple files with a common naming convention are selected (e.g., README.md, README-dockerfile.md, README-turbo.md), consolidate them into a pattern like README\*.md.
|
|
38
|
-
3. Ensure only files correctly matched by the pattern are removed, while unmatched files must be preserved
|
|
39
|
-
- Merge the returned subStructure into the overall document structure plan, **ensuring all subStructures returned by the tool are included**.
|
|
40
|
-
|
|
41
|
-
{% else %}
|
|
42
|
-
The current context is sufficient, proceed directly with document structure planning based on DataSources.
|
|
43
|
-
{% endif %}
|
|
44
|
-
</sub_structure>
|
|
45
|
-
|
|
46
|
-
|
|
47
16
|
{% include "../../common/document-structure/output-constraints.md" %}
|