@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,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,
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
name: documentTitleStreamline
|
|
2
|
+
description: Streamline document titles by shortening them while preserving meaning for better sidebar navigation
|
|
3
|
+
model:
|
|
4
|
+
reasoning_effort: low
|
|
5
|
+
task_render_mode: hide
|
|
6
|
+
instructions:
|
|
7
|
+
url: ../../prompts/common/document-structure/document-title-streamline.md
|
|
8
|
+
input_schema:
|
|
9
|
+
type: object
|
|
10
|
+
properties:
|
|
11
|
+
documentList:
|
|
12
|
+
type: array
|
|
13
|
+
items:
|
|
14
|
+
type: object
|
|
15
|
+
properties:
|
|
16
|
+
path:
|
|
17
|
+
type: string
|
|
18
|
+
description: Document path for mapping purposes
|
|
19
|
+
title:
|
|
20
|
+
type: string
|
|
21
|
+
description: Document title to streamline
|
|
22
|
+
required:
|
|
23
|
+
- path
|
|
24
|
+
- title
|
|
25
|
+
description: List of document items with titles to streamline
|
|
26
|
+
required:
|
|
27
|
+
- documentList
|
|
28
|
+
output_schema:
|
|
29
|
+
type: object
|
|
30
|
+
properties:
|
|
31
|
+
documentList:
|
|
32
|
+
type: array
|
|
33
|
+
items:
|
|
34
|
+
type: object
|
|
35
|
+
properties:
|
|
36
|
+
path:
|
|
37
|
+
type: string
|
|
38
|
+
description: Document path (same as input for mapping)
|
|
39
|
+
title:
|
|
40
|
+
type: string
|
|
41
|
+
description: Streamlined document title (max 24 characters for English, 12 characters for character-based languages)
|
|
42
|
+
required:
|
|
43
|
+
- path
|
|
44
|
+
- title
|
|
45
|
+
description: List of streamlined document items with shortened titles
|
|
46
|
+
required:
|
|
47
|
+
- documentList
|
|
48
|
+
|
|
@@ -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
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { getMainLanguageFiles } from "../../utils/docs-finder-utils.mjs";
|
|
2
|
+
import init from "../init/index.mjs";
|
|
3
|
+
|
|
4
|
+
export default async function listDocs(_, options) {
|
|
5
|
+
const config = await init({ checkOnly: true }, options);
|
|
6
|
+
|
|
7
|
+
// Get all main language .md files in docsDir
|
|
8
|
+
const mainLanguageFiles = await getMainLanguageFiles(config.docsDir, config.locale);
|
|
9
|
+
|
|
10
|
+
return {
|
|
11
|
+
documents: mainLanguageFiles,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
listDocs.description = "List all available documentation files";
|
|
@@ -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
|
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check if a string contains character-based language characters (Chinese, Japanese, Korean, etc.)
|
|
3
|
+
* @param {string} str - String to check
|
|
4
|
+
* @returns {boolean} - True if string contains character-based language characters
|
|
5
|
+
*/
|
|
6
|
+
function isCharacterBasedLanguage(str) {
|
|
7
|
+
if (!str) return false;
|
|
8
|
+
// Check for Chinese, Japanese, Korean, and other character-based languages
|
|
9
|
+
// Chinese: \u4e00-\u9fff (CJK Unified Ideographs)
|
|
10
|
+
// Japanese: \u3040-\u309f (Hiragana), \u30a0-\u30ff (Katakana)
|
|
11
|
+
// Korean: \uac00-\ud7a3 (Hangul Syllables)
|
|
12
|
+
// Thai: \u0e00-\u0e7f
|
|
13
|
+
// Arabic: \u0600-\u06ff
|
|
14
|
+
const characterBasedPattern =
|
|
15
|
+
/[\u4e00-\u9fff\u3040-\u309f\u30a0-\u30ff\uac00-\ud7a3\u0e00-\u0e7f\u0600-\u06ff]/;
|
|
16
|
+
return characterBasedPattern.test(str);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Get character limit based on language type
|
|
21
|
+
* @param {string} title - Title to check
|
|
22
|
+
* @returns {number} - Character limit (24 for English, 12 for character-based languages)
|
|
23
|
+
*/
|
|
24
|
+
function getCharacterLimit(title) {
|
|
25
|
+
return isCharacterBasedLanguage(title) ? 12 : 24;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Streamline document titles if they exceed length limits
|
|
30
|
+
* Reusable function for streamlining document titles in various contexts
|
|
31
|
+
* @param {Object} params
|
|
32
|
+
* @param {Array<{title: string, path: string}>} params.documentStructure - Document structure array
|
|
33
|
+
* @param {Object} options - Agent options with context
|
|
34
|
+
* @returns {Promise<void>} - Modifies documentStructure in place
|
|
35
|
+
*/
|
|
36
|
+
export default async function streamlineDocumentTitlesIfNeeded({ documentStructure }, options) {
|
|
37
|
+
if (!documentStructure || !Array.isArray(documentStructure)) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Filter items that need streamlining based on character count and language type
|
|
42
|
+
// English: > 24 characters, Character-based languages (Chinese, Japanese, etc.): > 12 characters
|
|
43
|
+
const itemsNeedingStreamline = documentStructure.filter((item) => {
|
|
44
|
+
if (!item.title) return false;
|
|
45
|
+
const limit = getCharacterLimit(item.title);
|
|
46
|
+
return item.title.length > limit;
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
if (itemsNeedingStreamline.length === 0) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const documentList = itemsNeedingStreamline.map((item) => ({
|
|
54
|
+
path: item.path,
|
|
55
|
+
title: item.title,
|
|
56
|
+
}));
|
|
57
|
+
|
|
58
|
+
const streamlineAgent = options?.context?.agents?.["documentTitleStreamline"];
|
|
59
|
+
if (!streamlineAgent) {
|
|
60
|
+
console.warn("⚠️ documentTitleStreamline agent not found. Skipping title streamlining.");
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
try {
|
|
65
|
+
const streamlineResult = await options.context.invoke(streamlineAgent, {
|
|
66
|
+
documentList,
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
// Update the document items with streamlined titles using path as the key
|
|
70
|
+
if (streamlineResult.documentList && Array.isArray(streamlineResult.documentList)) {
|
|
71
|
+
const streamlineMap = new Map(streamlineResult.documentList.map((item) => [item.path, item]));
|
|
72
|
+
|
|
73
|
+
for (const item of documentStructure) {
|
|
74
|
+
const streamlined = streamlineMap.get(item.path);
|
|
75
|
+
if (streamlined) {
|
|
76
|
+
item.title = streamlined.title;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
} catch (error) {
|
|
81
|
+
console.warn("⚠️ Failed to streamline document titles:", error.message);
|
|
82
|
+
console.warn("Continuing with original titles.");
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
streamlineDocumentTitlesIfNeeded.taskTitle = "Streamline document titles if needed";
|
|
87
|
+
streamlineDocumentTitlesIfNeeded.description =
|
|
88
|
+
"Shorten document titles that exceed length limits to make sidebar navigation less crowded";
|
|
@@ -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/
|
|
4
|
+
# model: aignehub/gpt-5
|
|
5
|
+
# model: aignehub/claude-sonnet-4-0
|
|
6
|
+
model: google/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,11 @@ 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
|
|
82
|
+
- ./agents/utils/list-docs.mjs
|
|
83
|
+
|
|
84
|
+
- ./agents/utils/document-title-streamline.yaml
|
|
85
|
+
- ./agents/utils/streamline-document-titles-if-needed.mjs
|
|
79
86
|
|
|
80
87
|
# User Preferences & Chat
|
|
81
88
|
- ./agents/prefs/index.mjs
|
|
@@ -100,6 +107,7 @@ agents:
|
|
|
100
107
|
- ./agents/generate/merge-diagram.yaml
|
|
101
108
|
- ./agents/update/generate-diagram.yaml
|
|
102
109
|
- ./agents/update/check-generate-diagram.mjs
|
|
110
|
+
- ./agents/update/pre-check-generate-diagram.yaml
|
|
103
111
|
cli:
|
|
104
112
|
chat: ./agents/chat/index.yaml
|
|
105
113
|
agents:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/doc-smith",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.16-beta",
|
|
4
4
|
"description": "AI-driven documentation generation tool built on the AIGNE Framework",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -24,20 +24,21 @@
|
|
|
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",
|
|
38
38
|
"debug": "^4.4.1",
|
|
39
39
|
"diff": "^8.0.2",
|
|
40
40
|
"dompurify": "^3.2.6",
|
|
41
|
+
"fast-deep-equal": "^3.1.3",
|
|
41
42
|
"file-type": "^21.0.0",
|
|
42
43
|
"fs-extra": "^11.3.1",
|
|
43
44
|
"glob": "^11.0.3",
|
|
@@ -48,6 +49,7 @@
|
|
|
48
49
|
"marked": "^15.0.12",
|
|
49
50
|
"marked-terminal": "^7.3.0",
|
|
50
51
|
"mermaid": "^11.9.0",
|
|
52
|
+
"minimatch": "^10.1.1",
|
|
51
53
|
"open": "^10.2.0",
|
|
52
54
|
"p-limit": "^7.1.1",
|
|
53
55
|
"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>
|