@aigne/doc-smith 0.8.15-beta.9 → 0.8.16-beta
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 +78 -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/document-structure.yaml +3 -1
- package/agents/evaluate/document.yaml +3 -1
- package/agents/generate/check-need-generate-structure.mjs +4 -0
- package/agents/generate/document-structure-tools/add-document.mjs +5 -1
- package/agents/generate/document-structure-tools/update-document.mjs +7 -0
- package/agents/generate/generate-structure.yaml +1 -5
- package/agents/generate/merge-diagram.yaml +4 -4
- package/agents/generate/update-document-structure.yaml +51 -45
- package/agents/generate/user-review-document-structure.mjs +47 -55
- package/agents/generate/utils/merge-document-structures.mjs +4 -4
- package/agents/init/check.mjs +1 -1
- package/agents/init/index.mjs +52 -2
- package/agents/init/validate.mjs +16 -0
- package/agents/publish/publish-docs.mjs +16 -10
- package/agents/schema/document-execution-structure.yaml +1 -1
- package/agents/schema/document-structure-item.yaml +1 -1
- package/agents/schema/document-structure.yaml +4 -2
- package/agents/update/check-generate-diagram.mjs +74 -16
- package/agents/update/generate-document.yaml +1 -13
- package/agents/update/handle-document-update.yaml +1 -1
- package/agents/update/pre-check-generate-diagram.yaml +44 -0
- package/agents/update/update-document-detail.yaml +64 -58
- package/agents/update/update-single-document.yaml +1 -1
- package/agents/update/user-review-document.mjs +58 -43
- package/agents/utils/analyze-feedback-intent.yaml +29 -0
- package/agents/utils/choose-docs.mjs +16 -6
- package/agents/utils/document-title-streamline.yaml +48 -0
- package/agents/utils/find-item-by-path.mjs +4 -2
- package/agents/utils/list-docs.mjs +15 -0
- package/agents/utils/load-sources.mjs +4 -4
- package/agents/utils/map-reasoning-effort-level.mjs +15 -0
- package/agents/utils/save-sidebar.mjs +12 -33
- package/agents/utils/streamline-document-titles-if-needed.mjs +88 -0
- package/agents/utils/{transform-detail-datasources.mjs → transform-detail-data-sources.mjs} +2 -2
- package/aigne.yaml +12 -4
- package/package.json +11 -9
- package/prompts/common/document/content-rules-core.md +5 -5
- 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/document-title-streamline.md +86 -0
- package/prompts/common/document-structure/output-constraints.md +3 -3
- package/prompts/detail/custom/custom-code-block.md +36 -1
- package/prompts/detail/custom/{custom-components.md → custom-components-usage-rules.md} +29 -7
- package/prompts/detail/d2-diagram/pre-check.md +23 -0
- package/prompts/detail/d2-diagram/rules.md +42 -24
- package/prompts/detail/d2-diagram/user-prompt.md +0 -20
- package/prompts/detail/generate/document-rules.md +2 -2
- package/prompts/detail/generate/system-prompt.md +3 -3
- package/prompts/detail/generate/user-prompt.md +5 -5
- package/prompts/detail/update/system-prompt.md +4 -3
- package/prompts/detail/update/user-prompt.md +8 -4
- package/prompts/evaluate/document.md +0 -4
- package/prompts/structure/check-document-structure.md +4 -4
- package/prompts/structure/generate/system-prompt.md +0 -1
- package/prompts/structure/generate/user-prompt.md +14 -9
- package/prompts/structure/review/structure-review-system.md +5 -2
- package/prompts/structure/update/system-prompt.md +0 -13
- package/prompts/structure/update/user-prompt.md +6 -5
- package/prompts/translate/translate-document.md +3 -3
- package/prompts/utils/analyze-feedback-intent.md +55 -0
- package/utils/constants/index.mjs +38 -0
- package/utils/deploy.mjs +3 -1
- package/utils/docs-finder-utils.mjs +37 -3
- package/utils/file-utils.mjs +97 -0
- package/utils/load-config.mjs +19 -0
- package/agents/utils/docs-fs-actor.yaml +0 -27
- package/agents/utils/fs.mjs +0 -60
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Document Title Streamline
|
|
2
|
+
|
|
3
|
+
<role>
|
|
4
|
+
You are a document title optimizer. Your task is to streamline document titles by shortening them while preserving their original meaning and clarity. The primary goal is to make sidebar navigation less crowded and easier to scan at a glance.
|
|
5
|
+
</role>
|
|
6
|
+
|
|
7
|
+
<input>
|
|
8
|
+
|
|
9
|
+
- documentList: {{documentList}}
|
|
10
|
+
|
|
11
|
+
</input>
|
|
12
|
+
|
|
13
|
+
<streamlining_rules>
|
|
14
|
+
|
|
15
|
+
**Core Requirements:**
|
|
16
|
+
|
|
17
|
+
1. **Title Constraints (Optimized for Sidebar Display):**
|
|
18
|
+
|
|
19
|
+
- **Character-based limits** (not word-based, as character count determines visual width):
|
|
20
|
+
- **For English titles: Maximum 24 characters**
|
|
21
|
+
- **For character-based languages (Chinese, Japanese, etc.): Maximum 12 characters** (half of English limit)
|
|
22
|
+
- **Purpose**: These limits are specifically designed for sidebar navigation display to prevent crowding and improve readability
|
|
23
|
+
- **Why character count, not word count**:
|
|
24
|
+
- Character width is what determines visual space in sidebar navigation
|
|
25
|
+
- English words vary greatly in length (e.g., "API" = 3 chars, "Configuration" = 13 chars)
|
|
26
|
+
- Character count provides more accurate control over sidebar display width
|
|
27
|
+
- Ensures consistent visual width across different languages
|
|
28
|
+
- Must capture the core concept
|
|
29
|
+
- Use concise, clear terminology
|
|
30
|
+
- Preserve key technical terms or proper nouns when essential
|
|
31
|
+
- Remove unnecessary articles (a, an, the) and filler words
|
|
32
|
+
- Keep titles scannable and user-friendly
|
|
33
|
+
- Optimize specifically for sidebar navigation display
|
|
34
|
+
|
|
35
|
+
2. **General Guidelines:**
|
|
36
|
+
|
|
37
|
+
- Maintain consistency in terminology across all items
|
|
38
|
+
- Prioritize clarity over brevity when there's a conflict
|
|
39
|
+
- Keep technical accuracy intact
|
|
40
|
+
- Preserve brand names, product names, and critical keywords
|
|
41
|
+
- Use title case for document titles
|
|
42
|
+
- Consider the document's context and hierarchy when streamlining
|
|
43
|
+
- Focus on making titles easy to scan in a sidebar navigation menu
|
|
44
|
+
|
|
45
|
+
**Optimization Strategies:**
|
|
46
|
+
|
|
47
|
+
- Replace long phrases with shorter equivalents
|
|
48
|
+
- Use common abbreviations when widely understood
|
|
49
|
+
- Remove redundant modifiers
|
|
50
|
+
- Combine related concepts when possible
|
|
51
|
+
- Focus on the most important information
|
|
52
|
+
- Remove unnecessary words that don't add meaning
|
|
53
|
+
|
|
54
|
+
**Important Notes:**
|
|
55
|
+
|
|
56
|
+
- Only streamline the title, descriptions are not modified
|
|
57
|
+
- **Sidebar Display Consideration**: Character-based limits (24 for English, 12 for other languages) are specifically chosen to optimize sidebar navigation display
|
|
58
|
+
- Sidebar navigation typically has limited horizontal space
|
|
59
|
+
- Character count determines visual width, not word count
|
|
60
|
+
- English: 24 characters ≈ 4-5 average words, fits standard sidebar width (250-300px)
|
|
61
|
+
- Character-based languages: 12 characters ≈ same visual width as 24 English characters
|
|
62
|
+
- Shorter titles prevent text wrapping and improve visual scanning
|
|
63
|
+
- These limits ensure titles remain readable and don't crowd the navigation menu
|
|
64
|
+
- The goal is to make sidebar navigation less crowded and more readable
|
|
65
|
+
- Titles should be immediately understandable without reading the full description
|
|
66
|
+
- **Language detection**: Determine the primary language of the title and apply the appropriate character limit
|
|
67
|
+
|
|
68
|
+
</streamlining_rules>
|
|
69
|
+
|
|
70
|
+
<output_rules>
|
|
71
|
+
|
|
72
|
+
Return a JSON object with:
|
|
73
|
+
|
|
74
|
+
- `documentList`: array of streamlined document items, each containing:
|
|
75
|
+
- `path`: the same path from input (for mapping purposes)
|
|
76
|
+
- `title`: shortened title (maximum 24 characters for English, 12 characters for character-based languages, optimized for sidebar display)
|
|
77
|
+
|
|
78
|
+
Ensure each streamlined item:
|
|
79
|
+
- Preserves the exact `path` value from the corresponding input item
|
|
80
|
+
- Maintains the original intent and meaning
|
|
81
|
+
- Uses clear, scannable language
|
|
82
|
+
- Fits within the word/character count constraints
|
|
83
|
+
- Provides enough context for users to understand the document's purpose at a glance
|
|
84
|
+
- Is optimized for sidebar navigation display
|
|
85
|
+
|
|
86
|
+
</output_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>
|
|
@@ -18,6 +18,11 @@ The following are the available enhanced attributes and their descriptions:
|
|
|
18
18
|
* `language` and `title` are written directly after \`\`\`, separated by spaces.
|
|
19
19
|
* Other attributes (`icon`) must be provided in **key=value** format, separated by spaces.
|
|
20
20
|
|
|
21
|
+
### Special Rules
|
|
22
|
+
- If the language is a shell (includes `sh`, `bash`, `zsh`, etc.):
|
|
23
|
+
- Executable shell code blocks must be a single-line command to make copying and running easier.
|
|
24
|
+
- Do not include comments inside executable shell code blocks; place explanatory comments outside the code block.
|
|
25
|
+
|
|
21
26
|
### Examples
|
|
22
27
|
|
|
23
28
|
<code_block_good_examples>
|
|
@@ -70,9 +75,26 @@ class ShoppingCart {
|
|
|
70
75
|
}
|
|
71
76
|
}
|
|
72
77
|
```
|
|
78
|
+
|
|
79
|
+
**Example 5: Shell code block should in one line**
|
|
80
|
+
|
|
81
|
+
```sh Install aigne deps icon=lucide:terminal
|
|
82
|
+
npm i -g @aigne/cli @aigne/doc-smith @aigne/websmith-smith
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
**Example 6: Shell code block use `\` to split multiple lines**
|
|
86
|
+
```bash Deploying with Access Keys icon=lucide:terminal
|
|
87
|
+
blocklet deploy . \
|
|
88
|
+
--endpoint https://my-server.arcblock.io \
|
|
89
|
+
--access-key 'your_access_key_id' \
|
|
90
|
+
--access-secret 'your_access_key_secret' \
|
|
91
|
+
--app-id z2qa9sD2tFAP8gM7C1i8iETg3a1T3A3aT3bQ
|
|
92
|
+
```
|
|
93
|
+
|
|
73
94
|
</code_block_good_examples>
|
|
74
95
|
|
|
75
96
|
<code_block_bad_examples>
|
|
97
|
+
|
|
76
98
|
**Example 1**
|
|
77
99
|
|
|
78
100
|
There are two errors in this example:
|
|
@@ -97,5 +119,18 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
|
97
119
|
}
|
|
98
120
|
```
|
|
99
121
|
|
|
122
|
+
**Example 2: shell code block have multiple lines**
|
|
123
|
+
```sh
|
|
124
|
+
npm i -g @aigne/cli
|
|
125
|
+
npm i -g @aigne/doc-smith
|
|
126
|
+
npm i -g @aigne/websmith-smith
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
**Example 3: shell code block comments**
|
|
130
|
+
```sh
|
|
131
|
+
# add aigne deps
|
|
132
|
+
npm i -g @aigne/cli
|
|
133
|
+
```
|
|
134
|
+
|
|
100
135
|
</code_block_bad_examples>
|
|
101
|
-
</enhanced_code_block_rules>
|
|
136
|
+
</enhanced_code_block_rules>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<
|
|
1
|
+
<custom_components_usage_rules>
|
|
2
2
|
When generating document details, you can use the following custom components at appropriate locations based on their descriptions and functionality to enhance document presentation:
|
|
3
3
|
|
|
4
4
|
## XCard: Individual link display card
|
|
@@ -48,11 +48,11 @@ Example 1: Inline Markdown formatting in card content
|
|
|
48
48
|
|
|
49
49
|
Example 2: Code block inside card content
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
````md
|
|
52
52
|
<x-card data-title="ctrl_break()" data-icon="lucide:keyboard">
|
|
53
53
|
Creates a listener for "ctrl-break" events.
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
```rust
|
|
56
56
|
use tokio::signal::windows::ctrl_break;
|
|
57
57
|
|
|
58
58
|
#[tokio::main]
|
|
@@ -62,10 +62,11 @@ stream.recv().await;
|
|
|
62
62
|
println!("got ctrl-break");
|
|
63
63
|
Ok(())
|
|
64
64
|
}
|
|
65
|
-
\`\`\`
|
|
66
|
-
</x-card>
|
|
67
65
|
```
|
|
68
66
|
|
|
67
|
+
````
|
|
68
|
+
|
|
69
|
+
|
|
69
70
|
## XCards: Multiple cards container
|
|
70
71
|
|
|
71
72
|
Suitable for displaying multiple links using a card list format, providing a richer and more visually appealing presentation.
|
|
@@ -80,7 +81,7 @@ Suitable for displaying multiple links using a card list format, providing a ric
|
|
|
80
81
|
|
|
81
82
|
### Usage Rules
|
|
82
83
|
|
|
83
|
-
- **Visual Consistency**: All
|
|
84
|
+
- **Visual Consistency**: All `<x-card>` elements within the same `<x-cards>` must maintain visual consistency:
|
|
84
85
|
- It's recommended to always provide data-icon for each card.
|
|
85
86
|
- Or all cards should have data-image.
|
|
86
87
|
- Avoid mixing (some with icons, some with only images).
|
|
@@ -106,6 +107,18 @@ Example 2: Two-column cards with images
|
|
|
106
107
|
</x-cards>
|
|
107
108
|
```
|
|
108
109
|
|
|
110
|
+
Example 3: Replace markdown format multiple links
|
|
111
|
+
|
|
112
|
+
```md
|
|
113
|
+
For more detailed information on specific features, please refer to the following sections:
|
|
114
|
+
|
|
115
|
+
<x-cards data-columns="3">
|
|
116
|
+
<x-card data-title="Using Discussions" data-href="/discussions">Introduce how to use discussions</x-card>
|
|
117
|
+
<x-card data-title="Using the Blog" data-href="/blog">Introduce how to use the Blog</x-card>
|
|
118
|
+
<x-card data-title="Using Chat" data-href="/chat">Introduce how to use Chat</x-card>
|
|
119
|
+
</x-cards>
|
|
120
|
+
```
|
|
121
|
+
|
|
109
122
|
### Bad Examples
|
|
110
123
|
|
|
111
124
|
Example 1: Using a single-column layout (`data-columns="1"`) is not allowed
|
|
@@ -125,6 +138,15 @@ Example 2: Contains only one `<x-card>` (must include multiple cards)
|
|
|
125
138
|
</x-cards>
|
|
126
139
|
```
|
|
127
140
|
|
|
141
|
+
Example 3: Markdown format multiple links
|
|
142
|
+
|
|
143
|
+
```md
|
|
144
|
+
For more detailed information on specific features, please refer to the following sections:
|
|
145
|
+
- [Using Discussions](./discussions.md)
|
|
146
|
+
- [Using the Blog](./blog.md)
|
|
147
|
+
- [Using Chat](./chat.md)
|
|
148
|
+
```
|
|
149
|
+
|
|
128
150
|
## XField: Structured data field
|
|
129
151
|
|
|
130
152
|
Suitable for displaying API parameters, return values, context data, and any structured data with metadata in a clean, organized format. Supports nested structures for complex data types.
|
|
@@ -517,4 +539,4 @@ Example 6: Missing blank line before x-field-group (violates "Spacing Around" ru
|
|
|
517
539
|
</x-field-group>
|
|
518
540
|
```
|
|
519
541
|
|
|
520
|
-
</
|
|
542
|
+
</custom_components_usage_rules>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<document_content>
|
|
2
|
+
{{documentContent}}
|
|
3
|
+
</document_content>
|
|
4
|
+
|
|
5
|
+
{% if feedback %}
|
|
6
|
+
<feedback>
|
|
7
|
+
{{feedback}}
|
|
8
|
+
</feedback>
|
|
9
|
+
{% endif %}
|
|
10
|
+
|
|
11
|
+
{% if detailFeedback %}
|
|
12
|
+
<content_review_feedback>
|
|
13
|
+
{{ detailFeedback }}
|
|
14
|
+
</content_review_feedback>
|
|
15
|
+
{% endif %}
|
|
16
|
+
|
|
17
|
+
{% if previousGenerationContent %}
|
|
18
|
+
<previous_generation_content>
|
|
19
|
+
{{ previousGenerationContent }}
|
|
20
|
+
</previous_generation_content>
|
|
21
|
+
{% endif %}
|
|
22
|
+
|
|
23
|
+
{% include "./rules.md" %}
|
|
@@ -1,26 +1,44 @@
|
|
|
1
1
|
<diagram_generation_rules>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
2
|
+
|
|
3
|
+
You must analyze the provided inputs to determine if a diagram is needed and where to insert a placeholder. You must not generate the diagram itself (e.g., no Mermaid, PlantUML, or other code). You are only deciding and placing the placeholder.
|
|
4
|
+
|
|
5
|
+
## Inputs
|
|
6
|
+
|
|
7
|
+
- `<document_content>`: The main body of text to be evaluated.
|
|
8
|
+
- `<previous_generation_content>`: The content from the previous run, which may contain DIAGRAM_PLACEHOLDER.
|
|
9
|
+
- `<feedback>`: Specific user instructions for this run (e.g., "add a diagram," "remove the diagram").
|
|
10
|
+
- `<content_review_feedback>`: General automated or human feedback on the content.
|
|
11
|
+
|
|
12
|
+
## Scoring conditions
|
|
13
|
+
|
|
14
|
+
- `add`: If `<feedback>` explicitly requests to add a diagram, ignore other conditions, +30000
|
|
15
|
+
- `remove`: If `<feedback>` explicitly requests to remove a diagram, ignore other conditions, -30000
|
|
16
|
+
- `previous-exists`: If `<previous_generation_content>` contains diagram, +21000
|
|
17
|
+
- `path-exclude`: If the document path or filename matches excluded patterns (e.g., `/faq/`, `CHANGELOG`, `release-notes`), -10000
|
|
18
|
+
- `less-words`: If document length <= 200 words AND less than 2 headings, -10000
|
|
19
|
+
- `overview`: If `<document_content>` provides a high-level overview, +3
|
|
20
|
+
- `architectural`: If `<document_content>` contains an architectural description (components/services/layers/modules), +3
|
|
21
|
+
- `workflow`: If `<document_content>` describes a workflow, sequence, user interactions, or data flow, +2
|
|
22
|
+
- `hierarchy`: If `<document_content>` describes a clear hierarchy (linked sub-docs / deeply nested sections), +1
|
|
23
|
+
- `introductory-major`: If `<document_content>` is an introductory page for a major section, +1
|
|
24
|
+
|
|
25
|
+
## Output Requirements
|
|
26
|
+
- `details` is an array. Each element must include:
|
|
27
|
+
- `type`: matched scoring condition's type name
|
|
28
|
+
- `score`: matched scoring condition's score
|
|
29
|
+
- `reason`: text explaining why this scoring condition is matched
|
|
30
|
+
- `content`: `<document_content>` with placeholder inserted
|
|
31
|
+
- Identify the most logical insertion point in the `<document_content>`. (This is often after an introductory paragraph or before a list/section that the diagram will explain).
|
|
32
|
+
- Insert the exact placeholder string: DIAGRAM_PLACEHOLDER
|
|
33
|
+
- Crucially: Adjust the surrounding text to integrate the placeholder smoothly. Add a lead-in sentence.
|
|
34
|
+
- Good example: "The following diagram illustrates this data flow:"
|
|
35
|
+
- Good example: "This architecture is shown in the overview below:"
|
|
36
|
+
- Bad example: (Just inserting the placeholder with no context).
|
|
37
|
+
- Return the modified document content.
|
|
38
|
+
- Keep the original structure of the document, including page headings and hierarchy
|
|
39
|
+
- Only modify parts of the document text to improve the alignment between diagrams and their context
|
|
40
|
+
- The output must not include the `document_content` tag
|
|
41
|
+
- Do not provide any explanations; include only the document content itself
|
|
42
|
+
|
|
26
43
|
</diagram_generation_rules>
|
|
44
|
+
|
|
@@ -12,26 +12,6 @@ Generate a d2 diagram that represents the following document content:
|
|
|
12
12
|
|
|
13
13
|
</user_rules>
|
|
14
14
|
|
|
15
|
-
<diagram_rules>
|
|
16
|
-
|
|
17
|
-
1. Diagram Triggers and Types: Select the most appropriate type when describing the following specific content
|
|
18
|
-
- Architecture Diagram (High-Level)
|
|
19
|
-
- **Trigger**: When the document provides a high-level overview of a system, project, or the overall documentation set.
|
|
20
|
-
- **Content**: Must illustrate the main components, their relationships, and the overall structure.
|
|
21
|
-
- Structural Diagram (Module-Level)
|
|
22
|
-
- **Trigger**: When generating the introductory document for a major section or module.
|
|
23
|
-
- **Content**: Must show the key sub-components, files, or core concepts within that specific module.
|
|
24
|
-
- Process and Interaction Diagrams (Detailed)
|
|
25
|
-
- **Trigger**: When the document describes a workflow, a sequence of events, user interactions, or data flow.
|
|
26
|
-
- **Diagram Type Selection**:
|
|
27
|
-
- **Flowchart**: Use for step-by-step processes, algorithms, or decision-making logic.
|
|
28
|
-
- **Sequence Diagram**: Use for time-ordered interactions between different components or actors (e.g., API calls).
|
|
29
|
-
2. Constraints and Best Practices
|
|
30
|
-
- **Keep it Simple**: Avoid overcomplicating the diagram.
|
|
31
|
-
- **Relevance**: Ensure every diagram **directly** illustrates a concept explained in the surrounding text. Avoid generating diagrams for simple concepts that are easily understood through text alone.
|
|
32
|
-
|
|
33
|
-
</diagram_rules>
|
|
34
|
-
|
|
35
15
|
<document_content>
|
|
36
16
|
{{documentContent}}
|
|
37
17
|
</document_content>
|
|
@@ -28,7 +28,7 @@ Documentation Generation Rules:
|
|
|
28
28
|
|
|
29
29
|
</document_rules>
|
|
30
30
|
|
|
31
|
-
<
|
|
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>
|
|
@@ -37,14 +37,14 @@ Glossary of specialized terms. Please ensure correct spelling when using these t
|
|
|
37
37
|
Documentation content generation rules:
|
|
38
38
|
{% include "./document-rules.md" %}
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
{% include "../custom/custom-components.md" %}
|
|
40
|
+
{% include "../custom/custom-components-usage-rules.md" %}
|
|
42
41
|
|
|
43
42
|
Custom code block generation rules:
|
|
44
43
|
{% include "../custom/custom-code-block.md" %}
|
|
45
44
|
|
|
46
45
|
{% include "../../common/document/media-file-list-usage-rules.md" %}
|
|
47
46
|
|
|
47
|
+
|
|
48
48
|
</content_generation_rules>
|
|
49
49
|
|
|
50
50
|
|
|
@@ -52,7 +52,7 @@ Custom code block generation rules:
|
|
|
52
52
|
<output_constraints>
|
|
53
53
|
|
|
54
54
|
1. Output the complete Markdown content for {{nodeName}}, only the content itself—no explanations or extra information.
|
|
55
|
-
2. Follow the format, structure, tone, and level of detail shown in the examples, strictly adhering to
|
|
55
|
+
2. Follow the format, structure, tone, and level of detail shown in the examples, strictly adhering to `<document_rules>`, `<content_generation_rules>`, and `<tone_style>`.
|
|
56
56
|
3. Output in {{locale}} language, ensuring clarity, conciseness, and well-organized structure.
|
|
57
57
|
4. Do not include any self-introduction or conversational text. Output only the documentation content itself.
|
|
58
58
|
|
|
@@ -7,24 +7,24 @@
|
|
|
7
7
|
|
|
8
8
|
** Output content in {{ locale }} language. **
|
|
9
9
|
|
|
10
|
-
** Don't generate any diagram in the document, give boolean value in `needDiagram` field & plan a placeholder in document content for diagram (use `DIAGRAM_PLACEHOLDER` as placeholder text). **
|
|
11
10
|
|
|
12
|
-
- **Necessary**: Generate diagrams only when necessary.
|
|
13
11
|
</user_rules>
|
|
14
12
|
|
|
15
13
|
{% set operation_type = "generating" %}
|
|
16
14
|
{% include "../../common/document/user-preferences.md" %}
|
|
17
15
|
|
|
18
|
-
<
|
|
16
|
+
<detail_data_source>
|
|
19
17
|
{{ detailDataSource }}
|
|
20
18
|
|
|
21
19
|
{{ additionalInformation }}
|
|
22
20
|
|
|
21
|
+
{% if assetsContent %}
|
|
23
22
|
<media_file_list>
|
|
24
23
|
{{ assetsContent }}
|
|
25
24
|
</media_file_list>
|
|
25
|
+
{% endif %}
|
|
26
26
|
|
|
27
|
-
</
|
|
27
|
+
</detail_data_source>
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
{% include "../../common/document/openapi-usage-rules.md" %}
|
|
@@ -51,7 +51,7 @@ User feedback on previous generation:
|
|
|
51
51
|
{% endif %}
|
|
52
52
|
|
|
53
53
|
<instructions>
|
|
54
|
-
Generate detailed and well-structured document for the current {{nodeName}} based on user-provided information: current {{nodeName}} details (including title, description, path),
|
|
54
|
+
Generate detailed and well-structured document for the current {{nodeName}} based on user-provided information: current {{nodeName}} details (including title, description, path), `<detail_data_source>`, `<document_structure>` (overall structural planning), and other relevant information.
|
|
55
55
|
|
|
56
56
|
<steps>
|
|
57
57
|
1. Analyze the provided document structure and user requirements to plan the content.
|
|
@@ -32,14 +32,15 @@ Glossary of specialized terms. Please ensure correct spelling when using these t
|
|
|
32
32
|
Documentation content optimization rules:
|
|
33
33
|
{% include "../generate/document-rules.md" %}
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
{% include "../custom/custom-components.md" %}
|
|
35
|
+
{% include "../custom/custom-components-usage-rules.md" %}
|
|
37
36
|
|
|
38
37
|
Custom code block optimization rules:
|
|
39
38
|
{% include "../custom/custom-code-block.md" %}
|
|
40
39
|
|
|
41
40
|
{% include "../../common/document/media-file-list-usage-rules.md" %}
|
|
42
41
|
|
|
42
|
+
{% include "../d2-diagram/rules.md" %}
|
|
43
|
+
|
|
43
44
|
</content_optimization_rules>
|
|
44
45
|
|
|
45
46
|
|
|
@@ -91,7 +92,7 @@ Tool usage guidelines:
|
|
|
91
92
|
**updateDocumentContent**: Use this tool to apply changes to the document content
|
|
92
93
|
- Generate a precise unified diff patch based on the user feedback
|
|
93
94
|
- The diff should include context lines for accurate application
|
|
94
|
-
- Only consider content within
|
|
95
|
+
- Only consider content within `<page_content>` tag when calculating line numbers, ensure line number calculation is accurate
|
|
95
96
|
- Test the patch application to ensure it works correctly
|
|
96
97
|
|
|
97
98
|
Error handling:
|
|
@@ -11,21 +11,25 @@
|
|
|
11
11
|
{% set operation_type = "optimizing" %}
|
|
12
12
|
{% include "../../common/document/user-preferences.md" %}
|
|
13
13
|
|
|
14
|
-
<
|
|
14
|
+
<original_document_content>
|
|
15
15
|
{{originalContent}}
|
|
16
|
-
</
|
|
16
|
+
</original_document_content>
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
{% if needDataSources %}
|
|
19
|
+
<detail_data_source>
|
|
19
20
|
|
|
20
21
|
{{ detailDataSource }}
|
|
21
22
|
|
|
22
23
|
{{ additionalInformation }}
|
|
23
24
|
|
|
25
|
+
{% if assetsContent %}
|
|
24
26
|
<media_file_list>
|
|
25
27
|
{{ assetsContent }}
|
|
26
28
|
</media_file_list>
|
|
29
|
+
{% endif %}
|
|
27
30
|
|
|
28
|
-
</
|
|
31
|
+
</detail_data_source>
|
|
32
|
+
{% endif %}
|
|
29
33
|
|
|
30
34
|
<user_feedback>
|
|
31
35
|
{{feedback}}
|
|
@@ -21,10 +21,6 @@ Please **strictly adhere** to the evaluation standards defined in `<standards>`
|
|
|
21
21
|
{{ content }}
|
|
22
22
|
</document_content>
|
|
23
23
|
|
|
24
|
-
<document_translation>
|
|
25
|
-
{{ translationsString }}
|
|
26
|
-
</document_translation>
|
|
27
|
-
|
|
28
24
|
<document_content_plan>
|
|
29
25
|
{{ description }}
|
|
30
26
|
</document_content_plan>
|
|
@@ -38,9 +38,9 @@ This is the primary scenario. You must perform a detailed comparison.
|
|
|
38
38
|
|
|
39
39
|
**Step-by-step Analysis**:
|
|
40
40
|
1. **Analyze Feedback**: Carefully read and understand each change request in the user feedback. Identify which nodes need to be modified, added, or deleted.
|
|
41
|
-
2. **Verify Feedback Implementation**: Confirm that all requested changes have been executed in
|
|
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>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
<
|
|
1
|
+
<data_sources>
|
|
2
2
|
Following are the partial or complete data sources provided by the user to help you design the document structure. Use these data sources to inform your structural planning.
|
|
3
3
|
|
|
4
|
-
{{
|
|
4
|
+
{{ dataSourceChunk }}
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
NOTICE: There are additional data source contents not displayed. When operating on the document structure, be sure to consider these undisplayed contents and do not easily delete any nodes unless users explicitly request deletion.
|
|
8
|
-
</
|
|
8
|
+
</data_sources>
|
|
9
9
|
|
|
10
10
|
{% if userContext.openAPISpec %}
|
|
11
11
|
<openapi>
|
|
@@ -41,17 +41,22 @@ NOTICE: There are additional data source contents not displayed. When operating
|
|
|
41
41
|
</openapi>
|
|
42
42
|
{% endif %}
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
<last_document_structure>
|
|
44
|
+
<document_info>
|
|
46
45
|
projectName: |
|
|
47
46
|
{{projectName}}
|
|
47
|
+
{% if projectDesc %}
|
|
48
48
|
projectDesc: |
|
|
49
49
|
{{projectDesc}}
|
|
50
|
+
{% endif %}
|
|
51
|
+
</document_info>
|
|
52
|
+
|
|
53
|
+
<last_document_structure>
|
|
50
54
|
|
|
51
55
|
{% if originalDocumentStructure %}
|
|
52
56
|
{{ originalDocumentStructure | yaml.stringify }}
|
|
53
57
|
{% elseif userContext.originalDocumentStructure %}
|
|
54
58
|
{{ userContext.originalDocumentStructure | yaml.stringify }}
|
|
59
|
+
{% else %}
|
|
55
60
|
No previous document structure provided. generate a new structure based on the data sources!
|
|
56
61
|
{% endif %}
|
|
57
62
|
|
|
@@ -96,7 +101,7 @@ The current process is planning sub-structures for the following section:
|
|
|
96
101
|
{{parentDocument}}
|
|
97
102
|
|
|
98
103
|
Sub-structures must meet the following requirements:
|
|
99
|
-
- Sub-structures are planned based on
|
|
104
|
+
- Sub-structures are planned based on `<data_sources>` and the parent document's description
|
|
100
105
|
- The parent document provides an overview of the planned content, while sub-structures directly plan the specific content to be displayed
|
|
101
106
|
- Further break down and comprehensively display the content planned in the parent document
|
|
102
107
|
- All sub-structures must have their parentPath value set to {{parentDocument.path}}
|
|
@@ -107,7 +112,7 @@ Sub-structures must meet the following requirements:
|
|
|
107
112
|
Your task is to **analyze, refine, and adjust** the existing document structure (`last_document_structure`) based on the partial code repository content currently provided, generating a structural update plan.
|
|
108
113
|
You are not creating a structure from scratch, but rather **performing intelligent updates based on understanding the existing structure** to make the document structure more accurately reflect the latest code content, architectural changes, and logical relationships.
|
|
109
114
|
|
|
110
|
-
## When using
|
|
115
|
+
## When using `<data_sources>` data sources, please note the following:
|
|
111
116
|
|
|
112
117
|
- Fully respect the project descriptions and usage instructions in README files, as these typically summarize the project's core functionality and objectives.
|
|
113
118
|
- Pay attention to comments and docstrings in source code files, as these reveal the design intent and usage methods of the code.
|
|
@@ -127,7 +132,7 @@ IMPORTANT: You should avoid duplicating existing structure items. Only include i
|
|
|
127
132
|
## Behavior Rules
|
|
128
133
|
|
|
129
134
|
1. **Understanding and Inheritance**
|
|
130
|
-
- Fully understand the hierarchical logic, section divisions, and naming style in
|
|
135
|
+
- Fully understand the hierarchical logic, section divisions, and naming style in `<last_document_structure>`.
|
|
131
136
|
- Perform incremental updates based on this foundation, not complete rewrites.
|
|
132
137
|
- Preserve existing reasonable structures, only modify or extend when there is clear justification.
|
|
133
138
|
|
|
@@ -148,7 +153,7 @@ IMPORTANT: You should avoid duplicating existing structure items. Only include i
|
|
|
148
153
|
- Maintain clear hierarchy, avoid duplication, ensure logical coherence. Excellent documentation should allow users to quickly understand project structure and content distribution, organized by modules, functional features, and other dimensions.
|
|
149
154
|
|
|
150
155
|
5. **Requirements**
|
|
151
|
-
- Follow all rules and guidelines in
|
|
156
|
+
- Follow all rules and guidelines in `<document_structure_rules>`.
|
|
152
157
|
- Generate rich document structure where functional modules must have sub-documents, comprehensively covering the codebase's functionality and modules, ensuring users can easily get started, understand, and use various modules and main features of the project through documentation.
|
|
153
158
|
|
|
154
159
|
{% include "../../common/document-structure/intj-traits.md" %}
|
|
@@ -2,13 +2,16 @@
|
|
|
2
2
|
You are a **Documentation Structure Refiner** with the analytical mindset of an **INTJ (The Architect)**. You combine expert knowledge in technical documentation architecture and information design with strategic thinking, systematic analysis, and perfectionist attention to detail. Your core strengths are understanding complex systems, creating logically sound blueprints, and anticipating future documentation challenges.
|
|
3
3
|
</role_and_goal>
|
|
4
4
|
|
|
5
|
-
<
|
|
5
|
+
<document_info>
|
|
6
6
|
projectName: |
|
|
7
7
|
{{projectName}}
|
|
8
|
+
{% if projectDesc %}
|
|
8
9
|
projectDesc: |
|
|
9
10
|
{{projectDesc}}
|
|
11
|
+
{% endif %}
|
|
12
|
+
</document_info>
|
|
10
13
|
|
|
11
|
-
|
|
14
|
+
<document_structure>
|
|
12
15
|
{{ documentStructure | yaml.stringify }}
|
|
13
16
|
</document_structure>
|
|
14
17
|
|