@aigne/doc-smith 0.8.15-beta.9 → 0.8.15
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 +65 -0
- package/agents/evaluate/document-structure.yaml +3 -1
- package/agents/evaluate/document.yaml +3 -1
- 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 +3 -26
- 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 +2 -1
- package/agents/utils/analyze-feedback-intent.yaml +29 -0
- package/agents/utils/choose-docs.mjs +16 -6
- package/agents/utils/find-item-by-path.mjs +4 -2
- 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/{transform-detail-datasources.mjs → transform-detail-data-sources.mjs} +2 -2
- package/aigne.yaml +7 -3
- package/package.json +10 -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/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
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
name: preCheckGenerateDiagram
|
|
2
|
+
description: Pre-check for generating diagram
|
|
3
|
+
model:
|
|
4
|
+
reasoning_effort: 1
|
|
5
|
+
instructions:
|
|
6
|
+
url: ../../prompts/detail/d2-diagram/pre-check.md
|
|
7
|
+
input_schema:
|
|
8
|
+
type: object
|
|
9
|
+
properties:
|
|
10
|
+
documentContent:
|
|
11
|
+
type: string
|
|
12
|
+
description: Source content of the document
|
|
13
|
+
feedback:
|
|
14
|
+
type: string
|
|
15
|
+
description: User generation feedback
|
|
16
|
+
detailFeedback:
|
|
17
|
+
type: string
|
|
18
|
+
description: Current document detail feedback
|
|
19
|
+
previousGenerationContent:
|
|
20
|
+
type: string
|
|
21
|
+
description: Previous document content
|
|
22
|
+
required:
|
|
23
|
+
- documentContent
|
|
24
|
+
output_schema:
|
|
25
|
+
type: object
|
|
26
|
+
properties:
|
|
27
|
+
content:
|
|
28
|
+
type: string
|
|
29
|
+
description: Document content
|
|
30
|
+
details:
|
|
31
|
+
type: array
|
|
32
|
+
description: Detailed needDiagram score
|
|
33
|
+
items:
|
|
34
|
+
type: object
|
|
35
|
+
properties:
|
|
36
|
+
type:
|
|
37
|
+
type: string
|
|
38
|
+
score:
|
|
39
|
+
type: number
|
|
40
|
+
reason:
|
|
41
|
+
type: string
|
|
42
|
+
required:
|
|
43
|
+
- content
|
|
44
|
+
|
|
@@ -1,61 +1,67 @@
|
|
|
1
|
-
type:
|
|
1
|
+
type: team
|
|
2
2
|
name: updateDocumentDetail
|
|
3
3
|
description: Update and optimize document content based on user feedback using diff patches
|
|
4
|
-
instructions:
|
|
5
|
-
- role: system
|
|
6
|
-
url: ../../prompts/detail/update/system-prompt.md
|
|
7
|
-
- role: user
|
|
8
|
-
url: ../../prompts/detail/update/user-prompt.md
|
|
9
|
-
auto_reorder_system_messages: true
|
|
10
|
-
auto_merge_system_messages: true
|
|
11
|
-
input_schema:
|
|
12
|
-
type: object
|
|
13
|
-
properties:
|
|
14
|
-
originalContent:
|
|
15
|
-
type: string
|
|
16
|
-
description: Original markdown content to be updated
|
|
17
|
-
feedback:
|
|
18
|
-
type: string
|
|
19
|
-
description: User feedback for content improvements
|
|
20
|
-
rules:
|
|
21
|
-
type: string
|
|
22
|
-
description: User configuration rules
|
|
23
|
-
locale:
|
|
24
|
-
type: string
|
|
25
|
-
description: User language, e.g. zh, en
|
|
26
|
-
detailDataSource:
|
|
27
|
-
type: string
|
|
28
|
-
description: Context for document content
|
|
29
|
-
glossary:
|
|
30
|
-
type: string
|
|
31
|
-
description: Glossary of terms
|
|
32
|
-
userPreferences:
|
|
33
|
-
type: string
|
|
34
|
-
description: User's saved preferences for content and documentation style
|
|
35
|
-
targetAudience:
|
|
36
|
-
type: string
|
|
37
|
-
description: Target audience for the documentation
|
|
38
|
-
title:
|
|
39
|
-
type: string
|
|
40
|
-
description: Document title
|
|
41
|
-
description:
|
|
42
|
-
type: string
|
|
43
|
-
description: Document description
|
|
44
|
-
required:
|
|
45
|
-
- originalContent
|
|
46
|
-
- feedback
|
|
47
|
-
output_key: message
|
|
48
|
-
afs:
|
|
49
|
-
modules:
|
|
50
|
-
- module: system-fs
|
|
51
|
-
options:
|
|
52
|
-
mount: /sources
|
|
53
|
-
path: .
|
|
54
|
-
description: |
|
|
55
|
-
Codebase of the project to be documented used as context for document generation,
|
|
56
|
-
should search and read as needed while generating document content
|
|
57
|
-
keep_text_in_tool_uses: false
|
|
58
|
-
skills:
|
|
59
|
-
- ./document-tools/update-document-content.mjs
|
|
60
|
-
# - ./generate-diagram.yaml
|
|
61
4
|
task_render_mode: collapse
|
|
5
|
+
skills:
|
|
6
|
+
- url: ../utils/analyze-feedback-intent.yaml
|
|
7
|
+
- type: ai
|
|
8
|
+
instructions:
|
|
9
|
+
- role: system
|
|
10
|
+
url: ../../prompts/detail/update/system-prompt.md
|
|
11
|
+
- role: user
|
|
12
|
+
url: ../../prompts/detail/update/user-prompt.md
|
|
13
|
+
auto_reorder_system_messages: true
|
|
14
|
+
auto_merge_system_messages: true
|
|
15
|
+
input_schema:
|
|
16
|
+
type: object
|
|
17
|
+
properties:
|
|
18
|
+
originalContent:
|
|
19
|
+
type: string
|
|
20
|
+
description: Original markdown content to be updated
|
|
21
|
+
feedback:
|
|
22
|
+
type: string
|
|
23
|
+
description: User feedback for content improvements
|
|
24
|
+
rules:
|
|
25
|
+
type: string
|
|
26
|
+
description: User configuration rules
|
|
27
|
+
locale:
|
|
28
|
+
type: string
|
|
29
|
+
description: User language, e.g. zh, en
|
|
30
|
+
detailDataSource:
|
|
31
|
+
type: string
|
|
32
|
+
description: Context for document content
|
|
33
|
+
glossary:
|
|
34
|
+
type: string
|
|
35
|
+
description: Glossary of terms
|
|
36
|
+
userPreferences:
|
|
37
|
+
type: string
|
|
38
|
+
description: User's saved preferences for content and documentation style
|
|
39
|
+
targetAudience:
|
|
40
|
+
type: string
|
|
41
|
+
description: Target audience for the documentation
|
|
42
|
+
title:
|
|
43
|
+
type: string
|
|
44
|
+
description: Document title
|
|
45
|
+
description:
|
|
46
|
+
type: string
|
|
47
|
+
description: Document description
|
|
48
|
+
needDataSources:
|
|
49
|
+
type: boolean
|
|
50
|
+
description: Whether data sources are needed for content modifications
|
|
51
|
+
required:
|
|
52
|
+
- originalContent
|
|
53
|
+
- feedback
|
|
54
|
+
output_key: message
|
|
55
|
+
afs:
|
|
56
|
+
modules:
|
|
57
|
+
- module: system-fs
|
|
58
|
+
options:
|
|
59
|
+
mount: /sources
|
|
60
|
+
path: .
|
|
61
|
+
description: |
|
|
62
|
+
Codebase of the project to be documented used as context for document generation,
|
|
63
|
+
should search and read as needed while generating document content
|
|
64
|
+
keep_text_in_tool_uses: false
|
|
65
|
+
skills:
|
|
66
|
+
- ./document-tools/update-document-content.mjs
|
|
67
|
+
# - ./generate-diagram.yaml
|
|
@@ -208,13 +208,14 @@ export default async function userReviewDocument({ content, description, ...rest
|
|
|
208
208
|
|
|
209
209
|
try {
|
|
210
210
|
// Call updateDocument agent with feedback
|
|
211
|
-
await options.context.invoke(updateAgent, {
|
|
211
|
+
const result = await options.context.invoke(updateAgent, {
|
|
212
212
|
...rest,
|
|
213
213
|
originalContent: options.context.userContext.currentContent,
|
|
214
214
|
feedback: feedback.trim(),
|
|
215
215
|
userPreferences,
|
|
216
216
|
title,
|
|
217
217
|
});
|
|
218
|
+
options.context.userContext.currentContent = result.content;
|
|
218
219
|
|
|
219
220
|
// Check if feedback should be saved as user preference
|
|
220
221
|
const feedbackRefinerAgent = options.context.agents["checkFeedbackRefiner"];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: analyzeFeedbackIntent
|
|
2
|
+
description: Analyze user feedback to determine if data sources are needed for content modifications
|
|
3
|
+
task_render_mode: hide
|
|
4
|
+
instructions:
|
|
5
|
+
url: ../../prompts/utils/analyze-feedback-intent.md
|
|
6
|
+
input_schema:
|
|
7
|
+
type: object
|
|
8
|
+
properties:
|
|
9
|
+
feedback:
|
|
10
|
+
type: string
|
|
11
|
+
description: User feedback for content modifications
|
|
12
|
+
required:
|
|
13
|
+
- feedback
|
|
14
|
+
output_schema:
|
|
15
|
+
type: object
|
|
16
|
+
properties:
|
|
17
|
+
needDataSources:
|
|
18
|
+
type: boolean
|
|
19
|
+
description: Whether data sources are needed - true for add/edit operations that need context, false for delete/move/reorder operations
|
|
20
|
+
intentType:
|
|
21
|
+
type: string
|
|
22
|
+
description: The primary type of user intention
|
|
23
|
+
reason:
|
|
24
|
+
type: string
|
|
25
|
+
description: Explanation of why data sources are or aren't needed
|
|
26
|
+
required:
|
|
27
|
+
- needDataSources
|
|
28
|
+
- intentType
|
|
29
|
+
- reason
|
|
@@ -6,6 +6,14 @@ import {
|
|
|
6
6
|
getMainLanguageFiles,
|
|
7
7
|
processSelectedFiles,
|
|
8
8
|
} from "../../utils/docs-finder-utils.mjs";
|
|
9
|
+
import { DOC_ACTION } from "../../utils/constants/index.mjs";
|
|
10
|
+
|
|
11
|
+
function getFeedbackMessage(action) {
|
|
12
|
+
if (action === DOC_ACTION.translate) {
|
|
13
|
+
return "Any specific translation preferences or instructions? (Press Enter to skip):";
|
|
14
|
+
}
|
|
15
|
+
return "How would you like to improve this document? (Press Enter to skip)";
|
|
16
|
+
}
|
|
9
17
|
|
|
10
18
|
export default async function chooseDocs(
|
|
11
19
|
{
|
|
@@ -18,12 +26,13 @@ export default async function chooseDocs(
|
|
|
18
26
|
locale,
|
|
19
27
|
reset = false,
|
|
20
28
|
requiredFeedback = true,
|
|
21
|
-
|
|
29
|
+
action,
|
|
22
30
|
},
|
|
23
31
|
options,
|
|
24
32
|
) {
|
|
25
33
|
let foundItems = [];
|
|
26
34
|
let selectedFiles = [];
|
|
35
|
+
const docAction = action || (isTranslate ? DOC_ACTION.translate : DOC_ACTION.update);
|
|
27
36
|
|
|
28
37
|
// If docs is empty or not provided, let user select multiple documents
|
|
29
38
|
if (!docs || docs.length === 0) {
|
|
@@ -37,7 +46,9 @@ export default async function chooseDocs(
|
|
|
37
46
|
|
|
38
47
|
if (mainLanguageFiles.length === 0) {
|
|
39
48
|
throw new Error(
|
|
40
|
-
`No documents found in the docs directory.
|
|
49
|
+
`No documents found in the docs directory. You can generate them with ${chalk.yellow(
|
|
50
|
+
"`aigne doc generate`",
|
|
51
|
+
)}`,
|
|
41
52
|
);
|
|
42
53
|
}
|
|
43
54
|
|
|
@@ -66,7 +77,7 @@ export default async function chooseDocs(
|
|
|
66
77
|
|
|
67
78
|
// Let user select multiple files
|
|
68
79
|
selectedFiles = await options.prompts.checkbox({
|
|
69
|
-
message:
|
|
80
|
+
message: getActionText("Select documents to {action}:", docAction),
|
|
70
81
|
source: (term) => {
|
|
71
82
|
if (!term) return choices;
|
|
72
83
|
|
|
@@ -88,7 +99,7 @@ export default async function chooseDocs(
|
|
|
88
99
|
foundItems = await processSelectedFiles(selectedFiles, documentExecutionStructure, docsDir);
|
|
89
100
|
} catch (error) {
|
|
90
101
|
console.log(
|
|
91
|
-
getActionText(
|
|
102
|
+
getActionText(`\nFailed to select documents to {action}: ${error.message}`, docAction),
|
|
92
103
|
);
|
|
93
104
|
process.exit(0);
|
|
94
105
|
}
|
|
@@ -123,8 +134,7 @@ export default async function chooseDocs(
|
|
|
123
134
|
// Prompt for feedback if not provided
|
|
124
135
|
let userFeedback = feedback;
|
|
125
136
|
if (!userFeedback && (requiredFeedback || foundItems?.length > 1)) {
|
|
126
|
-
const feedbackMessage =
|
|
127
|
-
"How should we improve this document? (Enter to skip, will auto-update from content sources):";
|
|
137
|
+
const feedbackMessage = getFeedbackMessage(docAction);
|
|
128
138
|
|
|
129
139
|
userFeedback = await options.prompts.input({
|
|
130
140
|
message: feedbackMessage,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DOC_ACTION } from "../../utils/constants/index.mjs";
|
|
1
2
|
import {
|
|
2
3
|
fileNameToFlatPath,
|
|
3
4
|
findItemByFlatName,
|
|
@@ -14,6 +15,7 @@ export default async function findItemByPath(
|
|
|
14
15
|
let foundItem = null;
|
|
15
16
|
let selectedFileContent = null;
|
|
16
17
|
let docPath = doc;
|
|
18
|
+
const docAction = isTranslate ? DOC_ACTION.translate : DOC_ACTION.update;
|
|
17
19
|
|
|
18
20
|
// If docPath is empty, let user select from available documents
|
|
19
21
|
if (!docPath) {
|
|
@@ -31,7 +33,7 @@ export default async function findItemByPath(
|
|
|
31
33
|
|
|
32
34
|
// Let user select a file
|
|
33
35
|
const selectedFile = await options.prompts.search({
|
|
34
|
-
message: getActionText(
|
|
36
|
+
message: getActionText("Select a document to {action}:", docAction),
|
|
35
37
|
source: async (input) => {
|
|
36
38
|
if (!input || input.trim() === "") {
|
|
37
39
|
return mainLanguageFiles.map((file) => ({
|
|
@@ -74,8 +76,8 @@ export default async function findItemByPath(
|
|
|
74
76
|
console.debug(error?.message);
|
|
75
77
|
throw new Error(
|
|
76
78
|
getActionText(
|
|
77
|
-
isTranslate,
|
|
78
79
|
"Please run 'aigne doc generate' first to generate documents, then select which document to {action}",
|
|
80
|
+
docAction,
|
|
79
81
|
),
|
|
80
82
|
);
|
|
81
83
|
}
|
|
@@ -171,7 +171,7 @@ export default async function loadSources(
|
|
|
171
171
|
if (dimensions.width < minImageWidth) {
|
|
172
172
|
filteredImageCount++;
|
|
173
173
|
console.log(
|
|
174
|
-
`
|
|
174
|
+
`Ignored image: ${fileName} (${dimensions.width}x${dimensions.height}px < ${minImageWidth}px minimum)`,
|
|
175
175
|
);
|
|
176
176
|
return;
|
|
177
177
|
}
|
|
@@ -218,7 +218,7 @@ export default async function loadSources(
|
|
|
218
218
|
0,
|
|
219
219
|
);
|
|
220
220
|
|
|
221
|
-
const
|
|
221
|
+
const dataSources = splitSourcesToChunks(sourceFiles, INTELLIGENT_SUGGESTION_TOKEN_THRESHOLD).map(
|
|
222
222
|
(i) => ({ dataSourceChunk: buildSourcesContent(i) }),
|
|
223
223
|
);
|
|
224
224
|
|
|
@@ -290,7 +290,7 @@ export default async function loadSources(
|
|
|
290
290
|
}
|
|
291
291
|
|
|
292
292
|
return {
|
|
293
|
-
|
|
293
|
+
dataSources,
|
|
294
294
|
content,
|
|
295
295
|
originalDocumentStructure,
|
|
296
296
|
files,
|
|
@@ -345,7 +345,7 @@ loadSources.input_schema = {
|
|
|
345
345
|
loadSources.output_schema = {
|
|
346
346
|
type: "object",
|
|
347
347
|
properties: {
|
|
348
|
-
|
|
348
|
+
dataSources: {
|
|
349
349
|
type: "array",
|
|
350
350
|
items: {
|
|
351
351
|
type: "object",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_REASONING_EFFORT_LEVEL,
|
|
3
|
+
DEFAULT_REASONING_EFFORT_VALUE,
|
|
4
|
+
REASONING_EFFORT_LEVELS,
|
|
5
|
+
} from "../../utils/constants/index.mjs";
|
|
6
|
+
|
|
7
|
+
export default function mapReasoningEffortLevel({ level }, options) {
|
|
8
|
+
const g =
|
|
9
|
+
REASONING_EFFORT_LEVELS[level] || REASONING_EFFORT_LEVELS[DEFAULT_REASONING_EFFORT_LEVEL];
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
reasoningEffort:
|
|
13
|
+
g[options.context.userContext.thinkingEffort] ?? DEFAULT_REASONING_EFFORT_VALUE,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
2
|
import fs from "fs-extra";
|
|
3
|
+
import { buildDocumentTree } from "../../utils/docs-finder-utils.mjs";
|
|
3
4
|
|
|
4
5
|
export default async function saveSidebar({ documentStructure, docsDir }) {
|
|
5
6
|
// Generate _sidebar.md
|
|
@@ -16,44 +17,22 @@ export default async function saveSidebar({ documentStructure, docsDir }) {
|
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
// Recursively generate sidebar text, the link path is the flattened file name
|
|
19
|
-
function walk(
|
|
20
|
+
function walk(nodes, indent = "") {
|
|
20
21
|
let out = "";
|
|
21
|
-
for (const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const children = item.__children;
|
|
30
|
-
if (Object.keys(children).length > 0) {
|
|
31
|
-
out += walk(children, fullSegments, `${indent} `);
|
|
22
|
+
for (const node of nodes) {
|
|
23
|
+
const relPath = node.path.replace(/^\//, "");
|
|
24
|
+
const flatFile = `${relPath.split("/").join("-")}.md`;
|
|
25
|
+
const realIndent = node.parentId === null ? "" : indent;
|
|
26
|
+
out += `${realIndent}* [${node.title}](/${flatFile})\n`;
|
|
27
|
+
|
|
28
|
+
if (node.children && node.children.length > 0) {
|
|
29
|
+
out += walk(node.children, `${indent} `);
|
|
32
30
|
}
|
|
33
31
|
}
|
|
34
32
|
return out;
|
|
35
33
|
}
|
|
36
34
|
|
|
37
35
|
function generateSidebar(documentStructure) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
for (const { path, title, parentId } of documentStructure) {
|
|
41
|
-
const relPath = path.replace(/^\//, "");
|
|
42
|
-
const segments = relPath.split("/");
|
|
43
|
-
let node = root;
|
|
44
|
-
for (let i = 0; i < segments.length; i++) {
|
|
45
|
-
const seg = segments[i];
|
|
46
|
-
if (!node[seg])
|
|
47
|
-
node[seg] = {
|
|
48
|
-
__children: {},
|
|
49
|
-
__title: null,
|
|
50
|
-
__fullPath: segments.slice(0, i + 1).join("/"),
|
|
51
|
-
__parentId: parentId,
|
|
52
|
-
};
|
|
53
|
-
if (i === segments.length - 1) node[seg].__title = title;
|
|
54
|
-
node = node[seg].__children;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return walk(root).replace(/\n+$/, "");
|
|
36
|
+
const { rootNodes } = buildDocumentTree(documentStructure);
|
|
37
|
+
return walk(rootNodes).replace(/\n+$/, "");
|
|
59
38
|
}
|
|
@@ -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 || [];
|
|
@@ -42,4 +42,4 @@ export default function transformDetailDatasource({ sourceIds }, options = {}) {
|
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
transformDetailDataSource.task_render_mode = "hide";
|
package/aigne.yaml
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env aigne
|
|
2
2
|
|
|
3
3
|
model:
|
|
4
|
+
# model: aignehub/gpt-5
|
|
5
|
+
# model: aignehub/claude-sonnet-4-0
|
|
4
6
|
model: aignehub/gemini-2.5-pro # reasoning_effort 128-32768
|
|
5
7
|
# https://github.com/AIGNE-io/aigne-framework/blob/main/models/gemini/src/gemini-chat-model.ts#L115
|
|
6
|
-
reasoning_effort:
|
|
7
|
-
|
|
8
|
+
reasoning_effort:
|
|
9
|
+
$get: reasoningEffort
|
|
8
10
|
temperature: 0.8
|
|
9
11
|
agents:
|
|
10
12
|
# Initialization
|
|
@@ -68,7 +70,7 @@ agents:
|
|
|
68
70
|
- ./agents/utils/load-sources.mjs
|
|
69
71
|
- ./agents/utils/post-generate.mjs
|
|
70
72
|
- ./agents/utils/save-sidebar.mjs
|
|
71
|
-
- ./agents/utils/transform-detail-
|
|
73
|
+
- ./agents/utils/transform-detail-data-sources.mjs
|
|
72
74
|
- ./agents/utils/save-doc.mjs
|
|
73
75
|
- ./agents/utils/save-doc-translation.mjs
|
|
74
76
|
- ./agents/utils/save-output.mjs
|
|
@@ -76,6 +78,7 @@ agents:
|
|
|
76
78
|
- ./agents/utils/find-item-by-path.mjs
|
|
77
79
|
- ./agents/utils/check-feedback-refiner.mjs
|
|
78
80
|
- ./agents/utils/feedback-refiner.yaml
|
|
81
|
+
- ./agents/utils/analyze-feedback-intent.yaml
|
|
79
82
|
|
|
80
83
|
# User Preferences & Chat
|
|
81
84
|
- ./agents/prefs/index.mjs
|
|
@@ -100,6 +103,7 @@ agents:
|
|
|
100
103
|
- ./agents/generate/merge-diagram.yaml
|
|
101
104
|
- ./agents/update/generate-diagram.yaml
|
|
102
105
|
- ./agents/update/check-generate-diagram.mjs
|
|
106
|
+
- ./agents/update/pre-check-generate-diagram.yaml
|
|
103
107
|
cli:
|
|
104
108
|
chat: ./agents/chat/index.yaml
|
|
105
109
|
agents:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/doc-smith",
|
|
3
|
-
"version": "0.8.15
|
|
3
|
+
"version": "0.8.15",
|
|
4
4
|
"description": "AI-driven documentation generation tool built on the AIGNE Framework",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -24,14 +24,14 @@
|
|
|
24
24
|
"author": "Arcblock <blocklet@arcblock.io> https://github.com/blocklet",
|
|
25
25
|
"license": "Elastic-2.0",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@aigne/aigne-hub": "^0.10.
|
|
28
|
-
"@aigne/anthropic": "^0.14.
|
|
29
|
-
"@aigne/cli": "^1.
|
|
30
|
-
"@aigne/core": "^1.
|
|
31
|
-
"@aigne/gemini": "^0.14.
|
|
32
|
-
"@aigne/openai": "^0.16.
|
|
33
|
-
"@aigne/publish-docs": "^0.12.
|
|
34
|
-
"@blocklet/payment-broker-client": "^1.
|
|
27
|
+
"@aigne/aigne-hub": "^0.10.5-beta.3",
|
|
28
|
+
"@aigne/anthropic": "^0.14.5-beta.3",
|
|
29
|
+
"@aigne/cli": "^1.53.1-beta.4",
|
|
30
|
+
"@aigne/core": "^1.65.1-beta.3",
|
|
31
|
+
"@aigne/gemini": "^0.14.5-beta.3",
|
|
32
|
+
"@aigne/openai": "^0.16.5-beta.3",
|
|
33
|
+
"@aigne/publish-docs": "^0.12.1",
|
|
34
|
+
"@blocklet/payment-broker-client": "^1.22.8",
|
|
35
35
|
"@terrastruct/d2": "^0.1.33",
|
|
36
36
|
"chalk": "^5.5.0",
|
|
37
37
|
"cli-highlight": "^2.1.11",
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"marked": "^15.0.12",
|
|
49
49
|
"marked-terminal": "^7.3.0",
|
|
50
50
|
"mermaid": "^11.9.0",
|
|
51
|
+
"minimatch": "^10.1.1",
|
|
51
52
|
"open": "^10.2.0",
|
|
52
53
|
"p-limit": "^7.1.1",
|
|
53
54
|
"p-map": "^7.0.3",
|
|
@@ -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 `<detail_data_source>`, 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
|
-
- Clearly differentiate content from other {{nodeName}} items in the
|
|
8
|
+
- Clearly differentiate content from other {{nodeName}} items in the `<document_structure>` to avoid duplication and highlight this {{nodeName}}'s unique value
|
|
9
9
|
{% if enforceInfoCompleteness %}
|
|
10
|
-
- If
|
|
10
|
+
- If `<detail_data_source>` 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
|
|
19
|
-
- Do not include file paths from
|
|
18
|
+
- Do not mention `<detail_data_source>` in output, your content is for user consumption, and users are unaware of detailDataSource
|
|
19
|
+
- Do not include file paths from `<data_sources>` in output as they are meaningless to users
|
|
20
20
|
- Avoid phrases like 'current {{nodeName}}'
|
|
@@ -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>
|