@aigne/doc-smith 0.8.15-beta.8 → 0.8.15-beta.9
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 +8 -0
- package/agents/evaluate/index.yaml +1 -3
- package/agents/generate/check-diagram.mjs +1 -1
- package/agents/generate/generate-structure.yaml +24 -66
- package/agents/generate/index.yaml +1 -2
- 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 -1
- package/agents/generate/utils/merge-document-structures.mjs +8 -32
- package/agents/schema/document-structure-refine-item.yaml +20 -0
- package/agents/update/batch-generate-document.yaml +1 -1
- package/agents/update/check-generate-diagram.mjs +26 -0
- package/agents/update/generate-diagram.yaml +0 -1
- package/agents/update/generate-document.yaml +17 -5
- package/agents/update/handle-document-update.yaml +8 -0
- package/agents/update/update-document-detail.yaml +2 -2
- package/agents/update/update-single-document.yaml +0 -1
- package/agents/update/user-review-document.mjs +6 -5
- package/agents/utils/load-sources.mjs +2 -2
- package/agents/utils/transform-detail-datasources.mjs +3 -3
- package/aigne.yaml +8 -1
- package/package.json +1 -1
- package/prompts/common/document/content-rules-core.md +4 -4
- package/prompts/common/document/openapi-usage-rules.md +36 -0
- package/prompts/common/document/role-and-personality.md +1 -2
- package/prompts/detail/d2-diagram/rules.md +11 -14
- package/prompts/detail/d2-diagram/system-prompt.md +0 -14
- package/prompts/detail/d2-diagram/user-prompt.md +30 -1
- package/prompts/detail/generate/document-rules.md +1 -1
- package/prompts/detail/generate/system-prompt.md +0 -6
- package/prompts/detail/generate/user-prompt.md +13 -60
- package/prompts/detail/update/system-prompt.md +0 -6
- package/prompts/detail/update/user-prompt.md +3 -3
- package/prompts/structure/generate/user-prompt.md +8 -10
- package/prompts/structure/review/structure-review-system.md +19 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.8.15-beta.9](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.15-beta.8...v0.8.15-beta.9) (2025-11-03)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* optimize the draw diagram process ([#234](https://github.com/AIGNE-io/aigne-doc-smith/issues/234)) ([7bdc0d9](https://github.com/AIGNE-io/aigne-doc-smith/commit/7bdc0d939df05b9d31e06ea0f0285ed0eafe74ae))
|
|
9
|
+
* simplify document structure merging and add deletion support ([#235](https://github.com/AIGNE-io/aigne-doc-smith/issues/235)) ([7f10242](https://github.com/AIGNE-io/aigne-doc-smith/commit/7f1024294bde241f41034d3e01a542451030cbdc))
|
|
10
|
+
|
|
3
11
|
## [0.8.15-beta.8](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.15-beta.7...v0.8.15-beta.8) (2025-11-01)
|
|
4
12
|
|
|
5
13
|
|
|
@@ -26,7 +26,7 @@ skills:
|
|
|
26
26
|
locale:
|
|
27
27
|
type: string
|
|
28
28
|
description: Primary language for documentation (e.g., zh, en, ja)
|
|
29
|
-
|
|
29
|
+
dataSourceChunk:
|
|
30
30
|
type: string
|
|
31
31
|
description: Project content and context to help generate documentation structure
|
|
32
32
|
targetAudience:
|
|
@@ -50,7 +50,7 @@ skills:
|
|
|
50
50
|
default: general
|
|
51
51
|
required:
|
|
52
52
|
- rules
|
|
53
|
-
-
|
|
53
|
+
- dataSourceChunk
|
|
54
54
|
output_schema:
|
|
55
55
|
type: object
|
|
56
56
|
properties:
|
|
@@ -60,31 +60,10 @@ skills:
|
|
|
60
60
|
projectDesc:
|
|
61
61
|
type: string
|
|
62
62
|
description: Brief project description generated from content analysis (under 50 words)
|
|
63
|
-
|
|
63
|
+
structures:
|
|
64
64
|
type: array
|
|
65
|
-
description: List of document structure items to add
|
|
66
|
-
items:
|
|
67
|
-
type: object
|
|
68
|
-
properties:
|
|
69
|
-
index:
|
|
70
|
-
type: integer
|
|
71
|
-
description: Position to insert the new item, null means append to the end
|
|
72
|
-
item: ../schema/document-structure-item.yaml
|
|
73
|
-
required:
|
|
74
|
-
- item
|
|
75
|
-
update:
|
|
76
|
-
type: array
|
|
77
|
-
description: List of document structure items to update, replace the item with the same path, null or empty array means no update
|
|
78
|
-
items:
|
|
79
|
-
type: object
|
|
80
|
-
properties:
|
|
81
|
-
path:
|
|
82
|
-
type: string
|
|
83
|
-
description: Path of the document structure item to update or replace
|
|
84
|
-
item: ../schema/document-structure-item.yaml
|
|
85
|
-
required:
|
|
86
|
-
- path
|
|
87
|
-
- item
|
|
65
|
+
description: List of document structure items to add or update
|
|
66
|
+
items: ../schema/document-structure-item.yaml
|
|
88
67
|
|
|
89
68
|
- ./utils/merge-document-structures.mjs
|
|
90
69
|
|
|
@@ -92,9 +71,10 @@ skills:
|
|
|
92
71
|
name: aggregateDocumentStructure
|
|
93
72
|
process: |
|
|
94
73
|
return {
|
|
95
|
-
documentStructure: options.context.userContext.originalDocumentStructure.map(i => ({
|
|
74
|
+
documentStructure: options.context.userContext.originalDocumentStructure.map((i, index) => ({
|
|
96
75
|
...i,
|
|
97
76
|
id: i.title.toLowerCase().replace(/\s+/g, '-'),
|
|
77
|
+
index
|
|
98
78
|
})),
|
|
99
79
|
projectName: options.context.userContext.projectName,
|
|
100
80
|
projectDesc: options.context.userContext.projectDesc,
|
|
@@ -110,29 +90,12 @@ skills:
|
|
|
110
90
|
output_schema:
|
|
111
91
|
type: object
|
|
112
92
|
properties:
|
|
113
|
-
|
|
93
|
+
structures:
|
|
114
94
|
type: array
|
|
115
|
-
description:
|
|
116
|
-
items:
|
|
117
|
-
type: object
|
|
118
|
-
description: Document structure item representing a node in the document hierarchy
|
|
119
|
-
properties:
|
|
120
|
-
id:
|
|
121
|
-
type: string
|
|
122
|
-
description: Unique identifier for the document structure item
|
|
123
|
-
newIndex:
|
|
124
|
-
type: integer
|
|
125
|
-
description: Used for ordering purposes, indicates the new position index of the document structure item
|
|
126
|
-
newPath:
|
|
127
|
-
type: string
|
|
128
|
-
description: The new path of the document structure item if it has been changed, otherwise can be omitted
|
|
129
|
-
newParentPath:
|
|
130
|
-
type: string
|
|
131
|
-
description: The new parentPath of the document structure item if it has been changed, otherwise can be omitted
|
|
132
|
-
required:
|
|
133
|
-
- id
|
|
95
|
+
description: Document structure items that need to be updated or changed
|
|
96
|
+
items: ../schema/document-structure-refine-item.yaml
|
|
134
97
|
required:
|
|
135
|
-
-
|
|
98
|
+
- structures
|
|
136
99
|
|
|
137
100
|
- type: function
|
|
138
101
|
name: finalizeDocumentStructure
|
|
@@ -140,23 +103,18 @@ skills:
|
|
|
140
103
|
return {
|
|
141
104
|
projectName: input.projectName,
|
|
142
105
|
projectDesc: input.projectDesc,
|
|
143
|
-
documentStructure: input.
|
|
144
|
-
|
|
145
|
-
|
|
106
|
+
documentStructure: input.structures.map(refinedItem => {
|
|
107
|
+
// Find original item to get sourceIds and other fields
|
|
108
|
+
const originalItem = input.documentStructure.find(orig => orig.id === refinedItem.id)
|
|
109
|
+
|
|
110
|
+
const newItem = {
|
|
111
|
+
title: refinedItem.title,
|
|
112
|
+
description: refinedItem.description,
|
|
113
|
+
path: refinedItem.path,
|
|
114
|
+
parentId: refinedItem.parentPath || null, // Convert parentPath to parentId
|
|
115
|
+
sourceIds: originalItem?.sourceIds || [],
|
|
116
|
+
}
|
|
146
117
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
index: refined?.newIndex || item.index,
|
|
150
|
-
path: refined?.newPath || item.path,
|
|
151
|
-
parentId: refined?.newParentPath || item.parentPath,
|
|
152
|
-
}
|
|
153
|
-
})
|
|
154
|
-
.sort((a, b) => a.index - b.index)
|
|
155
|
-
.map(i => {
|
|
156
|
-
const newItem = { ...i }
|
|
157
|
-
delete newItem.index
|
|
158
|
-
delete newItem.id
|
|
159
|
-
delete newItem.parentPath
|
|
160
|
-
return newItem
|
|
161
|
-
}),
|
|
118
|
+
return newItem
|
|
119
|
+
})
|
|
162
120
|
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
name:
|
|
2
|
-
description: Merge
|
|
1
|
+
name: mergeDiagramToDocument
|
|
2
|
+
description: Merge Diagram source code into document
|
|
3
3
|
instructions: |
|
|
4
4
|
You are an AI assistant that helps to merge d2 diagram into document.
|
|
5
5
|
|
|
6
|
-
<
|
|
6
|
+
<detail_dataSource>
|
|
7
7
|
{{ content }}
|
|
8
|
-
</
|
|
9
|
-
|
|
8
|
+
</detail_dataSource>
|
|
9
|
+
|
|
10
|
+
<diagramSourceCode>
|
|
10
11
|
{{ diagramSourceCode }}
|
|
11
|
-
</
|
|
12
|
+
</diagramSourceCode>
|
|
12
13
|
|
|
13
14
|
Given the source content of a document and the D2 diagram source code, your task is to:
|
|
14
15
|
- **Keep the original content as soon as possible.**
|
|
@@ -140,7 +140,7 @@ export default async function userReviewDocumentStructure({ documentStructure, .
|
|
|
140
140
|
// Call refineDocumentStructure agent with feedback
|
|
141
141
|
await options.context.invoke(refineAgent, {
|
|
142
142
|
...rest,
|
|
143
|
-
|
|
143
|
+
dataSourceChunk: rest.datasources[0].dataSourceChunk,
|
|
144
144
|
feedback: feedback.trim(),
|
|
145
145
|
documentStructure: currentStructure,
|
|
146
146
|
userPreferences,
|
|
@@ -11,44 +11,20 @@ export default async function mergeDocumentStructures(input, options) {
|
|
|
11
11
|
|
|
12
12
|
options.context.userContext.originalDocumentStructure ??= [];
|
|
13
13
|
|
|
14
|
-
const
|
|
14
|
+
const originalStructures = options.context.userContext.originalDocumentStructure;
|
|
15
15
|
|
|
16
|
-
if (input.
|
|
17
|
-
for (const
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
if (input.structures) {
|
|
17
|
+
for (const item of input.structures) {
|
|
18
|
+
const old = originalStructures.find((s) => s.path === item.path);
|
|
19
|
+
if (old) {
|
|
20
|
+
Object.assign(old, item);
|
|
20
21
|
} else {
|
|
21
|
-
|
|
22
|
+
originalStructures.push(item);
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
for (const upd of input.update) {
|
|
28
|
-
const idx = structure.findIndex((i) => i.path === upd.path);
|
|
29
|
-
if (idx !== -1) {
|
|
30
|
-
structure[idx] = upd.item;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if (input.delete) {
|
|
36
|
-
for (const del of input.delete) {
|
|
37
|
-
const idx = structure.findIndex((i) => i.path === del.path);
|
|
38
|
-
if (idx !== -1) {
|
|
39
|
-
structure.splice(idx, 1);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
options.context.userContext.originalDocumentStructure = structure.map((i, index) => {
|
|
45
|
-
delete i.index;
|
|
46
|
-
|
|
47
|
-
return {
|
|
48
|
-
index,
|
|
49
|
-
...i,
|
|
50
|
-
};
|
|
51
|
-
});
|
|
27
|
+
options.context.userContext.originalDocumentStructure = originalStructures;
|
|
52
28
|
|
|
53
29
|
return {};
|
|
54
30
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type: object
|
|
2
|
+
description: Document structure item representing a node in the document hierarchy
|
|
3
|
+
properties:
|
|
4
|
+
id:
|
|
5
|
+
type: string
|
|
6
|
+
description: Unique identifier for the document structure item
|
|
7
|
+
title:
|
|
8
|
+
type: string
|
|
9
|
+
description:
|
|
10
|
+
type: string
|
|
11
|
+
path:
|
|
12
|
+
type: string
|
|
13
|
+
description: Path in URL format, cannot be empty, cannot contain spaces or special characters, must start with /, no need to include language level, e.g., /zh/about should return /about
|
|
14
|
+
parentPath:
|
|
15
|
+
type: string
|
|
16
|
+
description: Parent node path, if null indicates it is a top-level node
|
|
17
|
+
required:
|
|
18
|
+
- title
|
|
19
|
+
- description
|
|
20
|
+
- path
|
|
@@ -6,7 +6,7 @@ skills:
|
|
|
6
6
|
input_schema:
|
|
7
7
|
type: object
|
|
8
8
|
properties:
|
|
9
|
-
|
|
9
|
+
detailDataSource:
|
|
10
10
|
type: string
|
|
11
11
|
description: Context for documentation structure generation, used to assist generate documentation structure
|
|
12
12
|
documentExecutionStructure: ../schema/document-execution-structure.yaml
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const placeholder = "DIAGRAM_PLACEHOLDER";
|
|
2
|
+
|
|
3
|
+
export default async function checkGenerateDiagram(
|
|
4
|
+
{ needDiagram, documentContent, locale },
|
|
5
|
+
options,
|
|
6
|
+
) {
|
|
7
|
+
if (!needDiagram) {
|
|
8
|
+
return {};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const generateAgent = options.context?.agents?.["generateDiagram"];
|
|
12
|
+
let content = documentContent;
|
|
13
|
+
|
|
14
|
+
try {
|
|
15
|
+
const { diagramSourceCode } = await options.context.invoke(generateAgent, {
|
|
16
|
+
documentContent,
|
|
17
|
+
locale,
|
|
18
|
+
});
|
|
19
|
+
content = content.replace(placeholder, diagramSourceCode);
|
|
20
|
+
} catch (error) {
|
|
21
|
+
// FIXME: @zhanghan should regenerate document without diagram
|
|
22
|
+
content = content.replace(placeholder, "");
|
|
23
|
+
console.log(`⚠️ Skip generate any diagram: ${error.message}`);
|
|
24
|
+
}
|
|
25
|
+
return { content };
|
|
26
|
+
}
|
|
@@ -16,7 +16,7 @@ input_schema:
|
|
|
16
16
|
locale:
|
|
17
17
|
type: string
|
|
18
18
|
description: User language, such as zh, en
|
|
19
|
-
|
|
19
|
+
detailDataSource:
|
|
20
20
|
type: string
|
|
21
21
|
description: Source data and context for document content generation
|
|
22
22
|
targetAudience:
|
|
@@ -44,9 +44,21 @@ input_schema:
|
|
|
44
44
|
description: Additional supplementary information
|
|
45
45
|
required:
|
|
46
46
|
- rules
|
|
47
|
-
-
|
|
47
|
+
- detailDataSource
|
|
48
48
|
- originalDocumentStructure
|
|
49
|
-
output_key: content
|
|
49
|
+
# output_key: content
|
|
50
|
+
output_schema:
|
|
51
|
+
type: object
|
|
52
|
+
properties:
|
|
53
|
+
content:
|
|
54
|
+
type: string
|
|
55
|
+
description: Document content
|
|
56
|
+
needDiagram:
|
|
57
|
+
type: boolean
|
|
58
|
+
description: Does this document need to generate diagram?
|
|
59
|
+
required:
|
|
60
|
+
- content
|
|
61
|
+
- detailDataSource
|
|
50
62
|
afs:
|
|
51
63
|
modules:
|
|
52
64
|
- module: system-fs
|
|
@@ -57,5 +69,5 @@ afs:
|
|
|
57
69
|
Codebase of the project to be documented used as context for document generation,
|
|
58
70
|
should search and read as needed while generating document content
|
|
59
71
|
keep_text_in_tool_uses: false
|
|
60
|
-
skills:
|
|
61
|
-
|
|
72
|
+
# skills:
|
|
73
|
+
# - ./generate-diagram.yaml
|
|
@@ -23,6 +23,14 @@ skills:
|
|
|
23
23
|
max_iterations: 5
|
|
24
24
|
return_last_on_max_iterations: true
|
|
25
25
|
task_title: Generate document for '{{ title }}'
|
|
26
|
+
- type: transform
|
|
27
|
+
jsonata: |
|
|
28
|
+
$merge([
|
|
29
|
+
$,
|
|
30
|
+
{ "documentContent": content }
|
|
31
|
+
])
|
|
32
|
+
- ./check-generate-diagram.mjs
|
|
33
|
+
# - ../generate/merge-diagram.yaml
|
|
26
34
|
- ../utils/save-doc.mjs
|
|
27
35
|
input_schema:
|
|
28
36
|
type: object
|
|
@@ -23,7 +23,7 @@ input_schema:
|
|
|
23
23
|
locale:
|
|
24
24
|
type: string
|
|
25
25
|
description: User language, e.g. zh, en
|
|
26
|
-
|
|
26
|
+
detailDataSource:
|
|
27
27
|
type: string
|
|
28
28
|
description: Context for document content
|
|
29
29
|
glossary:
|
|
@@ -57,5 +57,5 @@ afs:
|
|
|
57
57
|
keep_text_in_tool_uses: false
|
|
58
58
|
skills:
|
|
59
59
|
- ./document-tools/update-document-content.mjs
|
|
60
|
-
- ./generate-diagram.yaml
|
|
60
|
+
# - ./generate-diagram.yaml
|
|
61
61
|
task_render_mode: collapse
|
|
@@ -105,6 +105,7 @@ async function showDocumentDetail(content, title) {
|
|
|
105
105
|
renderer: new markedTerminal(),
|
|
106
106
|
});
|
|
107
107
|
|
|
108
|
+
// FIXME: @zhanghan fix error "Could not find the language 'd2', did you forget to load/include a language module?"
|
|
108
109
|
const renderedMarkdown = marked(content);
|
|
109
110
|
|
|
110
111
|
// Restore original console.error
|
|
@@ -121,16 +122,15 @@ async function showDocumentDetail(content, title) {
|
|
|
121
122
|
}
|
|
122
123
|
}
|
|
123
124
|
|
|
124
|
-
export default async function userReviewDocument(
|
|
125
|
-
{ content, title, description, ...rest },
|
|
126
|
-
options,
|
|
127
|
-
) {
|
|
125
|
+
export default async function userReviewDocument({ content, description, ...rest }, options) {
|
|
128
126
|
// Check if document content exists
|
|
129
127
|
if (!content || typeof content !== "string" || content.trim().length === 0) {
|
|
130
128
|
console.log("Please provide document content to review.");
|
|
131
129
|
return { content };
|
|
132
130
|
}
|
|
133
131
|
|
|
132
|
+
const title = rest.documentStructure?.find((x) => x.path === rest.path)?.title;
|
|
133
|
+
|
|
134
134
|
// Print current document headings structure
|
|
135
135
|
printDocumentHeadings(content, title || "Untitled Document");
|
|
136
136
|
|
|
@@ -190,7 +190,7 @@ export default async function userReviewDocument(
|
|
|
190
190
|
feedbacks.push(feedback.trim());
|
|
191
191
|
|
|
192
192
|
// Get the updateDocument agent
|
|
193
|
-
const updateAgent = options.context.agents["
|
|
193
|
+
const updateAgent = options.context.agents["handleDocumentUpdate"];
|
|
194
194
|
if (!updateAgent) {
|
|
195
195
|
console.log(
|
|
196
196
|
"We can't process your feedback right now. The document update feature is temporarily unavailable.",
|
|
@@ -213,6 +213,7 @@ export default async function userReviewDocument(
|
|
|
213
213
|
originalContent: options.context.userContext.currentContent,
|
|
214
214
|
feedback: feedback.trim(),
|
|
215
215
|
userPreferences,
|
|
216
|
+
title,
|
|
216
217
|
});
|
|
217
218
|
|
|
218
219
|
// Check if feedback should be saved as user preference
|
|
@@ -219,7 +219,7 @@ export default async function loadSources(
|
|
|
219
219
|
);
|
|
220
220
|
|
|
221
221
|
const datasources = splitSourcesToChunks(sourceFiles, INTELLIGENT_SUGGESTION_TOKEN_THRESHOLD).map(
|
|
222
|
-
(i) => ({
|
|
222
|
+
(i) => ({ dataSourceChunk: buildSourcesContent(i) }),
|
|
223
223
|
);
|
|
224
224
|
|
|
225
225
|
const remoteFileList = [];
|
|
@@ -350,7 +350,7 @@ loadSources.output_schema = {
|
|
|
350
350
|
items: {
|
|
351
351
|
type: "object",
|
|
352
352
|
properties: {
|
|
353
|
-
|
|
353
|
+
dataSourceChunk: { type: "string" },
|
|
354
354
|
},
|
|
355
355
|
},
|
|
356
356
|
},
|
|
@@ -2,7 +2,7 @@ import fs from "node:fs";
|
|
|
2
2
|
import { isRemoteFile } from "../../utils/file-utils.mjs";
|
|
3
3
|
import { normalizePath, toRelativePath } from "../../utils/utils.mjs";
|
|
4
4
|
|
|
5
|
-
export default function
|
|
5
|
+
export default function transformDetailDatasource({ sourceIds }, options = {}) {
|
|
6
6
|
// Read file content for each sourceId, ignoring failures
|
|
7
7
|
let openAPISpec;
|
|
8
8
|
const remoteFileList = options?.context?.userContext?.remoteFileList || [];
|
|
@@ -37,9 +37,9 @@ export default function transformDetailDatasources({ sourceIds }, options = {})
|
|
|
37
37
|
.filter(Boolean);
|
|
38
38
|
|
|
39
39
|
return {
|
|
40
|
-
|
|
40
|
+
detailDataSource: contents.join(""),
|
|
41
41
|
openAPISpec,
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
transformDetailDatasource.task_render_mode = "hide";
|
package/aigne.yaml
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env aigne
|
|
2
2
|
|
|
3
3
|
model:
|
|
4
|
-
model:
|
|
4
|
+
model: aignehub/gemini-2.5-pro # reasoning_effort 128-32768
|
|
5
|
+
# https://github.com/AIGNE-io/aigne-framework/blob/main/models/gemini/src/gemini-chat-model.ts#L115
|
|
6
|
+
reasoning_effort: 502
|
|
5
7
|
# name: gemini-2.5-flash
|
|
6
8
|
temperature: 0.8
|
|
7
9
|
agents:
|
|
@@ -93,6 +95,11 @@ agents:
|
|
|
93
95
|
- ./agents/evaluate/document-structure.yaml
|
|
94
96
|
- ./agents/evaluate/document.yaml
|
|
95
97
|
- ./agents/evaluate/code-snippet.mjs
|
|
98
|
+
|
|
99
|
+
# Diagram
|
|
100
|
+
- ./agents/generate/merge-diagram.yaml
|
|
101
|
+
- ./agents/update/generate-diagram.yaml
|
|
102
|
+
- ./agents/update/check-generate-diagram.mjs
|
|
96
103
|
cli:
|
|
97
104
|
chat: ./agents/chat/index.yaml
|
|
98
105
|
agents:
|
package/package.json
CHANGED
|
@@ -2,12 +2,12 @@ Target Audience: {{targetAudience}}
|
|
|
2
2
|
|
|
3
3
|
Content Generation Rules:
|
|
4
4
|
|
|
5
|
-
- Use only information from
|
|
5
|
+
- Use only information from detailDataSource, never fabricate or supplement content not present in the sources
|
|
6
6
|
- Combine the current {{nodeName}} title and description to create a well-structured content plan that is rich, organized, and engaging
|
|
7
7
|
- Content style must match the target audience
|
|
8
8
|
- Clearly differentiate content from other {{nodeName}} items in the documentStructure to avoid duplication and highlight this {{nodeName}}'s unique value
|
|
9
9
|
{% if enforceInfoCompleteness %}
|
|
10
|
-
- If
|
|
10
|
+
- If detailDataSource lack sufficient information, return an error message requesting users to provide additional content. Ensure page content is sufficiently rich, don't hesitate to ask users for supplementary information
|
|
11
11
|
- Display only valuable, engaging information. If information is insufficient, prompt users to provide more details
|
|
12
12
|
{% endif %}
|
|
13
13
|
- Output complete information including all content planned for the {{nodeName}}
|
|
@@ -15,6 +15,6 @@ Content Generation Rules:
|
|
|
15
15
|
- Maintain a strict, sequential heading hierarchy; no skipping (e.g., no jump from level-1 to level-3).
|
|
16
16
|
- Format markdown output with proper line breaks and spacing for easy reading
|
|
17
17
|
- For list data with many items, prioritize using markdown table for cleaner, more readable presentation
|
|
18
|
-
- Do not mention '
|
|
18
|
+
- Do not mention 'detailDataSource' in output, your content is for user consumption, and users are unaware of detailDataSource
|
|
19
19
|
- Do not include file paths from Data Sources in output as they are meaningless to users
|
|
20
|
-
- Avoid phrases like 'current {{nodeName}}'
|
|
20
|
+
- Avoid phrases like 'current {{nodeName}}'
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{% if openAPISpec %}
|
|
2
|
+
<openapi_usage_rules>
|
|
3
|
+
|
|
4
|
+
**Goal:** Use the provided OpenAPI (Swagger) specification, align it with the current page objective, and leverage it to refine this document.
|
|
5
|
+
|
|
6
|
+
**OpenAPI File Content:**
|
|
7
|
+
<openapi_doc>
|
|
8
|
+
|
|
9
|
+
{{ openAPISpec }}
|
|
10
|
+
|
|
11
|
+
</openapi_doc>
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
### **Documentation Requirements and Constraints**
|
|
16
|
+
|
|
17
|
+
1. **Extract the core content:**
|
|
18
|
+
* Organize the document by functional modules.
|
|
19
|
+
* For each path item, include the following elements:
|
|
20
|
+
* HTTP method and path.
|
|
21
|
+
* Concise summary.
|
|
22
|
+
* Detailed description.
|
|
23
|
+
* Request parameters: name, location (`in`), type, required flag, description.
|
|
24
|
+
* Request body: describe its structure when present.
|
|
25
|
+
* Responses: at least the key status codes (e.g., 200, 201, 400, 500) and their schemas.
|
|
26
|
+
|
|
27
|
+
2. **Mandatory API description constraints (deduplication rule):**
|
|
28
|
+
* **Ensure that throughout the document (including preface, overview, etc.), any introduction to the project APIs appears only within this OpenAPI-generated "API reference" section.**
|
|
29
|
+
* **Never** repeat or expand the interface list elsewhere in the document (for example, "Quick Start" or "Architecture Overview" sections).
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
**Expected output format:** A concise, clear, and easy-to-scan Markdown document.
|
|
34
|
+
|
|
35
|
+
</openapi_usage_rules>
|
|
36
|
+
{% endif %}
|
|
@@ -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,13 +1,14 @@
|
|
|
1
|
-
<
|
|
1
|
+
<diagram_generation_rules>
|
|
2
|
+
**Generation Workflow**
|
|
3
|
+
1. Use the current `<detail_dataSource>`, `<content_review_feedback>`, and `<feedback>` to decide whether this document requires a diagram.
|
|
4
|
+
2. When a diagram is needed, call the `generateDiagram` tool to create it and insert the returned content at the most fitting location in the document.
|
|
5
|
+
3. Check whether the data sources include `diagramSourceCode`. If not, remove any embedded diagram from the document.
|
|
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 `diagramSourceCode` 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
|
|
|
@@ -12,6 +12,35 @@ 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
|
+
|
|
15
35
|
<document_content>
|
|
16
36
|
{{documentContent}}
|
|
17
|
-
</document_content>
|
|
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
|
|
@@ -43,14 +43,8 @@ Custom component generation rules:
|
|
|
43
43
|
Custom code block generation rules:
|
|
44
44
|
{% include "../custom/custom-code-block.md" %}
|
|
45
45
|
|
|
46
|
-
{% include "../d2-diagram/guide.md" %}
|
|
47
|
-
|
|
48
46
|
{% include "../../common/document/media-file-list-usage-rules.md" %}
|
|
49
47
|
|
|
50
|
-
Tool result usage rules:
|
|
51
|
-
- Only use the `"role": "tool"` result as the datasource for document enhancement.
|
|
52
|
-
- Do not include `"role": "agent"` content in the final output.
|
|
53
|
-
|
|
54
48
|
</content_generation_rules>
|
|
55
49
|
|
|
56
50
|
|
|
@@ -2,20 +2,21 @@
|
|
|
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
11
|
|
|
12
|
+
- **Necessary**: Generate diagrams only when necessary.
|
|
13
|
+
</user_rules>
|
|
12
14
|
|
|
13
15
|
{% set operation_type = "generating" %}
|
|
14
16
|
{% include "../../common/document/user-preferences.md" %}
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
{{ detailDataSources }}
|
|
18
|
+
<detail_dataSource>
|
|
19
|
+
{{ detailDataSource }}
|
|
19
20
|
|
|
20
21
|
{{ additionalInformation }}
|
|
21
22
|
|
|
@@ -23,66 +24,25 @@
|
|
|
23
24
|
{{ assetsContent }}
|
|
24
25
|
</media_file_list>
|
|
25
26
|
|
|
27
|
+
</detail_dataSource>
|
|
26
28
|
|
|
27
29
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
{% if openAPISpec %}
|
|
31
|
-
<openapi>
|
|
32
|
-
|
|
33
|
-
**Goal:** Use the provided OpenAPI (Swagger) specification, align it with the current page objective, and leverage it to refine this document.
|
|
34
|
-
|
|
35
|
-
**OpenAPI File Content:**
|
|
36
|
-
<openapi_doc>
|
|
37
|
-
|
|
38
|
-
{{ openAPISpec }}
|
|
39
|
-
|
|
40
|
-
</openapi_doc>
|
|
41
|
-
|
|
42
|
-
---
|
|
43
|
-
|
|
44
|
-
### **Documentation Requirements and Constraints**
|
|
45
|
-
|
|
46
|
-
1. **Extract the core content:**
|
|
47
|
-
* Organize the document by functional modules.
|
|
48
|
-
* For each path item, include the following elements:
|
|
49
|
-
* HTTP method and path.
|
|
50
|
-
* Concise summary.
|
|
51
|
-
* Detailed description.
|
|
52
|
-
* Request parameters: name, location (`in`), type, required flag, description.
|
|
53
|
-
* Request body: describe its structure when present.
|
|
54
|
-
* Responses: at least the key status codes (e.g., 200, 201, 400, 500) and their schemas.
|
|
55
|
-
|
|
56
|
-
2. **Mandatory API description constraints (deduplication rule):**
|
|
57
|
-
* **Ensure that throughout the document (including preface, overview, etc.), any introduction to the project APIs appears only within this OpenAPI-generated "API reference" section.**
|
|
58
|
-
* **Never** repeat or expand the interface list elsewhere in the document (for example, "Quick Start" or "Architecture Overview" sections).
|
|
59
|
-
|
|
60
|
-
---
|
|
61
|
-
|
|
62
|
-
**Expected output format:** A concise, clear, and easy-to-scan Markdown document.
|
|
63
|
-
|
|
64
|
-
</openapi>
|
|
65
|
-
{% endif %}
|
|
66
|
-
|
|
30
|
+
{% include "../../common/document/openapi-usage-rules.md" %}
|
|
67
31
|
|
|
68
32
|
{% include "./detail-example.md" %}
|
|
69
33
|
|
|
70
|
-
|
|
71
34
|
{% if content %}
|
|
72
|
-
|
|
73
|
-
<last_content>
|
|
35
|
+
<previous_generation_content>
|
|
74
36
|
{{content}}
|
|
75
|
-
</
|
|
37
|
+
</previous_generation_content>
|
|
76
38
|
{% endif %}
|
|
77
39
|
|
|
78
|
-
|
|
79
40
|
{% if detailFeedback %}
|
|
80
41
|
<content_review_feedback>
|
|
81
42
|
{{ detailFeedback }}
|
|
82
43
|
</content_review_feedback>
|
|
83
44
|
{% endif %}
|
|
84
45
|
|
|
85
|
-
|
|
86
46
|
{% if feedback %}
|
|
87
47
|
User feedback on previous generation:
|
|
88
48
|
<feedback>
|
|
@@ -90,19 +50,12 @@ User feedback on previous generation:
|
|
|
90
50
|
</feedback>
|
|
91
51
|
{% endif %}
|
|
92
52
|
|
|
93
|
-
|
|
94
53
|
<instructions>
|
|
95
|
-
Generate detailed and well-structured document for the current {{nodeName}} based on user-provided information: current {{nodeName}} details (including title, description, path),
|
|
96
|
-
|
|
97
|
-
YOU SHOULD:
|
|
98
|
-
- Use AFS tools `afs_list` `afs_search` or `afs_read` to gather relevant and accurate information to enhance the content.
|
|
99
|
-
- Follow rules in `<diagram_generation_guide>`: use `generateDiagram` tool to create and embed a diagram when appropriate, following the diagram generation guidelines.
|
|
100
|
-
- If the `generateDiagram` tool is not called, do not attempt to add any diagrams.
|
|
54
|
+
Generate detailed and well-structured document for the current {{nodeName}} based on user-provided information: current {{nodeName}} details (including title, description, path), detailDataSource, documentStructure (overall structural planning), and other relevant information.
|
|
101
55
|
|
|
102
56
|
<steps>
|
|
103
57
|
1. Analyze the provided document structure and user requirements to plan the content.
|
|
104
58
|
2. Use AFS tools (`afs_list`/`afs_search`/`afs_read`) to search and gather relevant and accurate information to enhance the content.
|
|
105
|
-
3.
|
|
106
|
-
4. Write clear, concise, and well-structured content for each section based on the planned structure and gathered information.
|
|
59
|
+
3. Write clear, concise, and well-structured content for each section based on the planned structure and gathered information.
|
|
107
60
|
</steps>
|
|
108
61
|
</instructions>
|
|
@@ -40,12 +40,6 @@ Custom code block optimization rules:
|
|
|
40
40
|
|
|
41
41
|
{% include "../../common/document/media-file-list-usage-rules.md" %}
|
|
42
42
|
|
|
43
|
-
Diagram generation rules:
|
|
44
|
-
{% include "../d2-diagram/guide.md" %}
|
|
45
|
-
<diagram_generation_rules>
|
|
46
|
-
{% include "../d2-diagram/system-prompt.md" %}
|
|
47
|
-
</diagram_generation_rules>
|
|
48
|
-
|
|
49
43
|
</content_optimization_rules>
|
|
50
44
|
|
|
51
45
|
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
{{originalContent}}
|
|
16
16
|
</original_page_content>
|
|
17
17
|
|
|
18
|
-
<
|
|
18
|
+
<detail_dataSource>
|
|
19
19
|
|
|
20
|
-
{{
|
|
20
|
+
{{ detailDataSource }}
|
|
21
21
|
|
|
22
22
|
{{ additionalInformation }}
|
|
23
23
|
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
{{ assetsContent }}
|
|
26
26
|
</media_file_list>
|
|
27
27
|
|
|
28
|
-
</
|
|
28
|
+
</detail_dataSource>
|
|
29
29
|
|
|
30
30
|
<user_feedback>
|
|
31
31
|
{{feedback}}
|
|
@@ -50,7 +50,8 @@ projectDesc: |
|
|
|
50
50
|
|
|
51
51
|
{% if originalDocumentStructure %}
|
|
52
52
|
{{ originalDocumentStructure | yaml.stringify }}
|
|
53
|
-
{%
|
|
53
|
+
{% elseif userContext.originalDocumentStructure %}
|
|
54
|
+
{{ userContext.originalDocumentStructure | yaml.stringify }}
|
|
54
55
|
No previous document structure provided. generate a new structure based on the data sources!
|
|
55
56
|
{% endif %}
|
|
56
57
|
|
|
@@ -117,14 +118,11 @@ You are not creating a structure from scratch, but rather **performing intellige
|
|
|
117
118
|
|
|
118
119
|
## Objective
|
|
119
120
|
|
|
120
|
-
Your output should
|
|
121
|
+
Your output should contain a `structures` array with document structure items that need to be added or updated:
|
|
121
122
|
|
|
122
|
-
- **
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
- **update**: Structure items that need modification (array), each item is an object containing:
|
|
126
|
-
- `path`: Path pointing to the node being updated;
|
|
127
|
-
- `update`: New structure definition
|
|
123
|
+
- **structures**: Array of document structure items representing incremental changes to the existing document structure. Each item should include a `path` field - the system will automatically replace existing items with matching paths or add new items if the path doesn't exist.
|
|
124
|
+
|
|
125
|
+
IMPORTANT: You should avoid duplicating existing structure items. Only include items that are genuinely new or need updates. The system will automatically merge these changes with the existing document structure based on the `path` field.
|
|
128
126
|
|
|
129
127
|
## Behavior Rules
|
|
130
128
|
|
|
@@ -138,8 +136,8 @@ Your output should be a structured change plan containing the following three se
|
|
|
138
136
|
- Identify which parts represent new concepts, APIs, modules, configurations, or features; determine if they require adding or modifying corresponding sections in the document structure.
|
|
139
137
|
|
|
140
138
|
3. **Structure Adjustment Strategy**
|
|
141
|
-
- If new content supplements details of existing sections,
|
|
142
|
-
- If new content introduces new topics, modules, or hierarchies,
|
|
139
|
+
- If new content supplements details of existing sections, include the updated item in the `structures` array with the same path.
|
|
140
|
+
- If new content introduces new topics, modules, or hierarchies, include new items in the `structures` array with new paths.
|
|
143
141
|
- Ensure the position, hierarchy, and naming of new nodes align with the overall document logic.
|
|
144
142
|
|
|
145
143
|
4. **Consistency and Clarity**
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<role_and_goal>
|
|
2
|
-
You are
|
|
3
|
-
|
|
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.
|
|
4
3
|
</role_and_goal>
|
|
5
4
|
|
|
6
5
|
<document_structure>
|
|
@@ -14,11 +13,10 @@ documentStructure:
|
|
|
14
13
|
</document_structure>
|
|
15
14
|
|
|
16
15
|
<instructions>
|
|
17
|
-
You are a Documentation Structure Refiner — an expert in technical documentation architecture and information design.
|
|
18
16
|
|
|
19
17
|
Your task:
|
|
20
18
|
Given an existing document structure (a JSON array or tree of sections), refine and optimize its **hierarchy and order** to improve clarity, usability, and conventional organization.
|
|
21
|
-
️ You must not add
|
|
19
|
+
️ You must not add or rename any nodes. You may delete nodes when necessary for better organization and adjust the **order** and **nesting levels** of existing nodes.
|
|
22
20
|
|
|
23
21
|
---
|
|
24
22
|
|
|
@@ -35,11 +33,11 @@ Given an existing document structure (a JSON array or tree of sections), refine
|
|
|
35
33
|
- “Overview” and “Quick Start” should have **1–2 levels max**.
|
|
36
34
|
- Remove deeply nested technical details from “Overview” or “Quick Start”.
|
|
37
35
|
- Relocate such details under “Architecture”, “API Reference”, or “Modules”.
|
|
38
|
-
-
|
|
36
|
+
- Keep beneficial nodes — you may delete duplicated, redundant, or harmful nodes when needed for clarity.
|
|
39
37
|
|
|
40
38
|
3. **Grouping and Alignment**
|
|
41
39
|
- Align similar nodes logically (e.g., group “Usage”, “Examples”, “Tutorials” together).
|
|
42
|
-
- Avoid duplication or overlap by reordering
|
|
40
|
+
- Avoid duplication or overlap by reordering or strategic deletion when necessary.
|
|
43
41
|
|
|
44
42
|
4. **Naming and Identity**
|
|
45
43
|
- You are **not allowed to rename or reword** any section titles or descriptions.
|
|
@@ -55,19 +53,26 @@ Given an existing document structure (a JSON array or tree of sections), refine
|
|
|
55
53
|
## Behavior Rules
|
|
56
54
|
|
|
57
55
|
- Do **not** add new nodes.
|
|
58
|
-
-
|
|
56
|
+
- You **may** delete nodes when they are redundant, duplicated, or detrimental to documentation clarity.
|
|
59
57
|
- Do **not** rename or rewrite content.
|
|
60
58
|
- You **may** move nodes to different parents or reorder siblings to achieve better logical flow.
|
|
61
|
-
- You **must** maintain
|
|
62
|
-
- The
|
|
59
|
+
- You **must** maintain structural integrity for all remaining nodes.
|
|
60
|
+
- The output must be a complete, valid document structure array matching the expected schema.
|
|
63
61
|
|
|
64
62
|
---
|
|
65
63
|
|
|
66
64
|
## Objective
|
|
67
65
|
|
|
68
|
-
Output a
|
|
69
|
-
1.
|
|
70
|
-
2.
|
|
71
|
-
3.
|
|
72
|
-
4.
|
|
66
|
+
Output a complete `structures` array containing the optimized document structure:
|
|
67
|
+
1. Include ALL nodes from the input structure (whether modified or not)
|
|
68
|
+
2. Each item must include: `id`, `title`, `description`, `path`, `parentPath` (if not top-level)
|
|
69
|
+
3. Apply your optimizations through proper ordering, hierarchy changes, and selective deletion
|
|
70
|
+
4. Maintain all required fields and ensure paths are valid (start with /, no spaces/special chars)
|
|
71
|
+
5. **Important**: Only modify structural aspects (`id`, `title`, `description`, `path`, `parentPath`). Do NOT modify `sourceIds` or other data fields
|
|
72
|
+
|
|
73
|
+
**Optimization Approach:**
|
|
74
|
+
- Reorder nodes by adjusting their position in the array
|
|
75
|
+
- Change hierarchy by modifying `parentPath` values (use the path of the new parent node)
|
|
76
|
+
- Delete problematic nodes by simply omitting them from the output array
|
|
77
|
+
- Keep beneficial nodes with their original content intact
|
|
73
78
|
</instructions>
|