@aigne/doc-smith 0.8.15 → 0.8.16-beta.1
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 +26 -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/generate-report.mjs +7 -0
- package/agents/evaluate/index.yaml +6 -0
- package/agents/generate/check-need-generate-structure.mjs +12 -4
- package/agents/generate/document-structure-tools/add-document.mjs +9 -1
- package/agents/generate/document-structure-tools/update-document.mjs +18 -0
- package/agents/generate/draw-diagram.yaml +2 -2
- package/agents/generate/generate-structure.yaml +3 -2
- package/agents/generate/user-review-document-structure.mjs +44 -29
- package/agents/init/index.mjs +6 -4
- package/agents/media/load-media-description.mjs +2 -1
- package/agents/schema/document-structure-item.yaml +3 -0
- package/agents/schema/document-structure-refine-item.yaml +3 -0
- package/agents/schema/document-structure.yaml +3 -0
- package/agents/update/pre-check-generate-diagram.yaml +1 -1
- package/agents/update/user-review-document.mjs +56 -42
- package/agents/utils/document-icon-generate.yaml +52 -0
- package/agents/utils/document-title-streamline.yaml +48 -0
- package/agents/utils/generate-document-icon-if-needed.mjs +93 -0
- package/agents/utils/list-docs.mjs +15 -0
- package/agents/utils/streamline-document-titles-if-needed.mjs +88 -0
- package/aigne.yaml +7 -1
- package/package.json +4 -7
- package/prompts/common/document/media-file-list-usage-rules.md +8 -2
- package/prompts/common/document/openapi-usage-rules.md +174 -21
- package/prompts/common/document-structure/document-icon-generate.md +116 -0
- package/prompts/common/document-structure/document-structure-rules.md +8 -3
- package/prompts/common/document-structure/document-title-streamline.md +86 -0
- package/prompts/common/document-structure/openapi-usage-rules.md +28 -0
- package/prompts/common/document-structure/output-constraints.md +9 -0
- package/prompts/detail/custom/{custom-code-block.md → code-block-usage-rules.md} +43 -16
- package/prompts/detail/custom/custom-components/x-card-usage-rules.md +62 -0
- package/prompts/detail/custom/custom-components/x-cards-usage-rules.md +75 -0
- package/prompts/detail/custom/custom-components/x-field-desc-usage-rules.md +86 -0
- package/prompts/detail/custom/custom-components/x-field-group-usage-rules.md +95 -0
- package/prompts/detail/custom/custom-components/x-field-usage-rules.md +189 -0
- package/prompts/detail/custom/custom-components-usage-rules.md +10 -534
- package/prompts/detail/{d2-diagram → diagram}/rules.md +5 -3
- package/prompts/detail/generate/document-rules.md +6 -0
- package/prompts/detail/generate/system-prompt.md +3 -2
- package/prompts/detail/generate/user-prompt.md +7 -1
- package/prompts/detail/update/system-prompt.md +3 -3
- package/prompts/structure/generate/system-prompt.md +2 -5
- package/prompts/structure/generate/user-prompt.md +14 -39
- package/types/document-structure-schema.mjs +1 -0
- package/utils/evaluate/report-utils.mjs +7 -3
- package/agents/utils/docs-fs-actor.yaml +0 -27
- package/agents/utils/fs.mjs +0 -60
- /package/prompts/detail/{d2-diagram → diagram}/guide.md +0 -0
- /package/prompts/detail/{d2-diagram → diagram}/official-examples.md +0 -0
- /package/prompts/detail/{d2-diagram → diagram}/pre-check.md +0 -0
- /package/prompts/detail/{d2-diagram → diagram}/role-and-personality.md +0 -0
- /package/prompts/detail/{d2-diagram → diagram}/system-prompt.md +0 -0
- /package/prompts/detail/{d2-diagram → diagram}/user-prompt.md +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.8.16-beta.1](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.16-beta...v0.8.16-beta.1) (2025-11-11)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add document icon generation functionality and update schemas ([#286](https://github.com/AIGNE-io/aigne-doc-smith/issues/286)) ([3e20fda](https://github.com/AIGNE-io/aigne-doc-smith/commit/3e20fdaf8a6e4713ed0756f52c620180c8b47f35))
|
|
9
|
+
* support auto open evaluation report ([#287](https://github.com/AIGNE-io/aigne-doc-smith/issues/287)) ([93a64d5](https://github.com/AIGNE-io/aigne-doc-smith/commit/93a64d5bfb4602532efe5cc33cc90494e2b0cb48))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* tune prompts increase document expressiveness ([#284](https://github.com/AIGNE-io/aigne-doc-smith/issues/284)) ([eb79742](https://github.com/AIGNE-io/aigne-doc-smith/commit/eb79742d0782405d6143ac0271359cd8ae97286b))
|
|
15
|
+
|
|
16
|
+
## [0.8.16-beta](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.15...v0.8.16-beta) (2025-11-10)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
* enable AFS for chat agent & improve chat skills ([#281](https://github.com/AIGNE-io/aigne-doc-smith/issues/281)) ([b1c770e](https://github.com/AIGNE-io/aigne-doc-smith/commit/b1c770e60c8866dd08d41ebdd52817c14dd3dd41))
|
|
22
|
+
* implement document title streamlining functionality ([#276](https://github.com/AIGNE-io/aigne-doc-smith/issues/276)) ([918edb8](https://github.com/AIGNE-io/aigne-doc-smith/commit/918edb8f1b2dc03572c4125971092ef0023cd7b3))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* update chat model from aignehub/gemini-2.5-pro to google/gemini-2.5-pro ([#283](https://github.com/AIGNE-io/aigne-doc-smith/issues/283)) ([3559a56](https://github.com/AIGNE-io/aigne-doc-smith/commit/3559a56e49ca3105fd800110b67b3cb3346e3096))
|
|
28
|
+
|
|
3
29
|
## [0.8.15](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.15-beta.16...v0.8.15) (2025-11-07)
|
|
4
30
|
|
|
5
31
|
## [0.8.15-beta.16](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.15-beta.15...v0.8.15-beta.16) (2025-11-07)
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
You are a professional document generation assistant that helps users create, modify, and manage documentation through interactive chat. Your primary role is to understand user requirements and intelligently call upon various specialized skills to complete documentation tasks efficiently.
|
|
2
|
+
|
|
3
|
+
Core Capabilities:
|
|
4
|
+
- Generate comprehensive documentation from user inputs and specifications
|
|
5
|
+
- Regenerate and refine document details based on feedback
|
|
6
|
+
- Translate and localize documentation content
|
|
7
|
+
- Publish and manage team documentation workflows
|
|
8
|
+
- Provide interactive guidance throughout the document creation process
|
|
9
|
+
|
|
10
|
+
Interaction Guidelines:
|
|
11
|
+
- Engage users in a professional yet friendly manner
|
|
12
|
+
- Ask clarifying questions to understand specific documentation needs
|
|
13
|
+
- Suggest appropriate skills and workflows based on user requests
|
|
14
|
+
- Provide clear explanations of available capabilities and processes
|
|
15
|
+
- Maintain context throughout multi-step documentation tasks
|
|
16
|
+
- Offer proactive suggestions for improving document quality and structure
|
|
17
|
+
|
|
18
|
+
<skill_usage>
|
|
19
|
+
- afs_xxx skills: AFS(AIGNE File System) skills provide capabilities to explore, read, write and manage files and virtual modules within the AIGNE environment.
|
|
20
|
+
You can use these skills to access source files and other resources needed for documentation tasks.
|
|
21
|
+
- listDocs: This skill lists all available documentation files in the system.
|
|
22
|
+
You can use this skill to get an overview of existing documents before creating or modifying documentation. for documentation tasks,
|
|
23
|
+
you should use this skill rather than afs_read to list documentation files.
|
|
24
|
+
- generateDocument: This skill generates new documentation or updates existing documents structure based on user inputs and specifications,
|
|
25
|
+
You can use this skill to create comprehensive documents from scratch or based on existing templates or update document structure as per user requirements.
|
|
26
|
+
- updateDocument: This skill updates existing documentation content with new information or revisions provided by the user.
|
|
27
|
+
You can use this skill to refine and enhance documents content based on feedback or additional details.
|
|
28
|
+
- publish: This skill publishes completed documentation to an online website to make it accessible to the intended audience.
|
|
29
|
+
You can use this skill to manage the publication process and ensure documents are properly formatted and available.
|
|
30
|
+
- translate: This skill translates documentation content into different languages for localization purposes.
|
|
31
|
+
You can use this skill to adapt documents for diverse audiences by providing translations in the required languages.
|
|
32
|
+
</skill_usage>
|
package/agents/chat/index.yaml
CHANGED
|
@@ -1,30 +1,22 @@
|
|
|
1
1
|
type: ai
|
|
2
2
|
name: chat
|
|
3
3
|
description: Start interactive document generation assistant
|
|
4
|
-
instructions:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Core Capabilities:
|
|
8
|
-
- Generate comprehensive documentation from user inputs and specifications
|
|
9
|
-
- Regenerate and refine document details based on feedback
|
|
10
|
-
- Translate and localize documentation content
|
|
11
|
-
- Publish and manage team documentation workflows
|
|
12
|
-
- Provide interactive guidance throughout the document creation process
|
|
13
|
-
|
|
14
|
-
Interaction Guidelines:
|
|
15
|
-
- Engage users in a professional yet friendly manner
|
|
16
|
-
- Ask clarifying questions to understand specific documentation needs
|
|
17
|
-
- Suggest appropriate skills and workflows based on user requests
|
|
18
|
-
- Provide clear explanations of available capabilities and processes
|
|
19
|
-
- Maintain context throughout multi-step documentation tasks
|
|
20
|
-
- Offer proactive suggestions for improving document quality and structure
|
|
4
|
+
instructions:
|
|
5
|
+
url: ./chat-system.md
|
|
21
6
|
input_key: message
|
|
22
|
-
|
|
7
|
+
afs:
|
|
8
|
+
modules:
|
|
9
|
+
- module: system-fs
|
|
10
|
+
options:
|
|
11
|
+
path: .
|
|
12
|
+
mount: /source
|
|
13
|
+
description: Project root directory for document generation
|
|
14
|
+
afs_config:
|
|
15
|
+
inject_History: true
|
|
23
16
|
skills:
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
- ../update/index.yaml
|
|
17
|
+
- ./skills/generate-document.yaml
|
|
18
|
+
- ./skills/update-document.yaml
|
|
27
19
|
- ../publish/index.yaml
|
|
28
20
|
- ../translate/index.yaml
|
|
29
|
-
- ../utils/docs-fs-actor.yaml
|
|
30
21
|
- ../utils/exit.mjs
|
|
22
|
+
- ../utils/list-docs.mjs
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type: team
|
|
2
|
+
name: generateDocument
|
|
3
|
+
description: Generate complete documentation for your project, or update/delete existing documents or structure based on user feedback
|
|
4
|
+
input_schema:
|
|
5
|
+
type: object
|
|
6
|
+
properties:
|
|
7
|
+
feedback:
|
|
8
|
+
type: string
|
|
9
|
+
description: How to generate or update the document content
|
|
10
|
+
required:
|
|
11
|
+
- feedback
|
|
12
|
+
skills:
|
|
13
|
+
- url: ../../generate/index.yaml
|
|
14
|
+
default_input:
|
|
15
|
+
isChat: true
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
type: team
|
|
2
|
+
name: updateDocument
|
|
3
|
+
description: Update a existing document based on user feedback
|
|
4
|
+
input_schema:
|
|
5
|
+
type: object
|
|
6
|
+
properties:
|
|
7
|
+
docs:
|
|
8
|
+
type: array
|
|
9
|
+
items:
|
|
10
|
+
type: string
|
|
11
|
+
description: Documents to update, must from listDocs output
|
|
12
|
+
feedback:
|
|
13
|
+
type: string
|
|
14
|
+
description: Tell us what to change in this content
|
|
15
|
+
reset:
|
|
16
|
+
type: boolean
|
|
17
|
+
description: Regenerate the document from scratch, ignoring previous versions
|
|
18
|
+
required:
|
|
19
|
+
- docs
|
|
20
|
+
- feedback
|
|
21
|
+
skills:
|
|
22
|
+
- url: ../../update/index.yaml
|
|
23
|
+
default_input:
|
|
24
|
+
isChat: true
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { writeFile } from "node:fs/promises";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { pick } from "@aigne/core/utils/type-utils.js";
|
|
4
|
+
import isInCi from "is-in-ci";
|
|
5
|
+
import openTerminal from "open";
|
|
6
|
+
|
|
4
7
|
import { DOC_SMITH_DIR } from "../../utils/constants/index.mjs";
|
|
5
8
|
import {
|
|
6
9
|
copyHtmlReportTemplate,
|
|
@@ -35,6 +38,7 @@ export default async function generateEvaluationReport({
|
|
|
35
38
|
readerKnowledgeLevel,
|
|
36
39
|
documentationDepth,
|
|
37
40
|
targetAudience,
|
|
41
|
+
open = true,
|
|
38
42
|
}) {
|
|
39
43
|
const timestamp = new Date().toISOString();
|
|
40
44
|
const timestampForFolder = generateTimestampForFolder();
|
|
@@ -69,6 +73,9 @@ export default async function generateEvaluationReport({
|
|
|
69
73
|
|
|
70
74
|
// Generate success message
|
|
71
75
|
const message = generateReportSuccessMessage(toRelativePath(jsonReportPath), htmlReportPath);
|
|
76
|
+
if (open && !isInCi) {
|
|
77
|
+
openTerminal(htmlReportPath);
|
|
78
|
+
}
|
|
72
79
|
|
|
73
80
|
return {
|
|
74
81
|
message,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
2
|
import { getActiveRulesForScope } from "../../utils/preferences-utils.mjs";
|
|
3
3
|
import { getProjectInfo, loadConfigFromFile, saveValueToConfig } from "../../utils/utils.mjs";
|
|
4
|
+
import streamlineDocumentTitlesIfNeeded from "../utils/streamline-document-titles-if-needed.mjs";
|
|
4
5
|
|
|
5
6
|
export default async function checkNeedGenerateStructure(
|
|
6
7
|
{ originalDocumentStructure, forceRegenerate, ...rest },
|
|
@@ -70,6 +71,9 @@ export default async function checkNeedGenerateStructure(
|
|
|
70
71
|
feedback: finalFeedback || "",
|
|
71
72
|
});
|
|
72
73
|
|
|
74
|
+
await streamlineDocumentTitlesIfNeeded({ documentStructure: result.documentStructure }, options);
|
|
75
|
+
options.context.userContext.streamlinedDocumentTitles = true;
|
|
76
|
+
|
|
73
77
|
let message = "";
|
|
74
78
|
|
|
75
79
|
// Check and save project information
|
|
@@ -92,8 +96,10 @@ export default async function checkNeedGenerateStructure(
|
|
|
92
96
|
result.projectName !== projectInfo.name &&
|
|
93
97
|
!projectInfo.fromGitHub
|
|
94
98
|
) {
|
|
95
|
-
|
|
96
|
-
|
|
99
|
+
// Remove leading and trailing spaces (middle spaces are preserved and count toward limit)
|
|
100
|
+
const trimmedProjectName = result.projectName.trim();
|
|
101
|
+
await saveValueToConfig("projectName", trimmedProjectName);
|
|
102
|
+
message += `Project name: \`${trimmedProjectName}\``;
|
|
97
103
|
hasUpdated = true;
|
|
98
104
|
}
|
|
99
105
|
|
|
@@ -102,8 +108,10 @@ export default async function checkNeedGenerateStructure(
|
|
|
102
108
|
result.projectDesc !== projectInfo.description &&
|
|
103
109
|
!projectInfo.fromGitHub
|
|
104
110
|
) {
|
|
105
|
-
|
|
106
|
-
|
|
111
|
+
// Remove leading and trailing spaces (middle spaces are preserved and count toward limit)
|
|
112
|
+
const trimmedProjectDesc = result.projectDesc.trim();
|
|
113
|
+
await saveValueToConfig("projectDesc", trimmedProjectDesc);
|
|
114
|
+
message += `\nProject description: \`${trimmedProjectDesc}\``;
|
|
107
115
|
hasUpdated = true;
|
|
108
116
|
}
|
|
109
117
|
|
|
@@ -3,6 +3,8 @@ import {
|
|
|
3
3
|
getAddDocumentOutputJsonSchema,
|
|
4
4
|
validateAddDocumentInput,
|
|
5
5
|
} from "../../../types/document-structure-schema.mjs";
|
|
6
|
+
import streamlineDocumentTitlesIfNeeded from "../../utils/streamline-document-titles-if-needed.mjs";
|
|
7
|
+
import generateDocumentIconIfNeeded from "../../utils/generate-document-icon-if-needed.mjs";
|
|
6
8
|
|
|
7
9
|
export default async function addDocument(input, options) {
|
|
8
10
|
// Validate input using Zod schema
|
|
@@ -56,9 +58,15 @@ export default async function addDocument(input, options) {
|
|
|
56
58
|
sourceIds: [...sourceIds], // Create a copy of the array
|
|
57
59
|
};
|
|
58
60
|
|
|
59
|
-
//
|
|
61
|
+
// Streamline document titles if needed (will streamline the new document if title > 18 characters)
|
|
62
|
+
await streamlineDocumentTitlesIfNeeded({ documentStructure: [newDocument] }, options);
|
|
63
|
+
|
|
64
|
+
// Add the document to the structure first
|
|
60
65
|
const updatedStructure = [...documentStructure, newDocument];
|
|
61
66
|
|
|
67
|
+
// Generate icon for root-level documents if needed
|
|
68
|
+
await generateDocumentIconIfNeeded({ documentStructure: updatedStructure }, options);
|
|
69
|
+
|
|
62
70
|
const successMessage = `addDocument executed successfully.
|
|
63
71
|
Successfully added document '${title}' with path '${path}'.
|
|
64
72
|
Check if the latest version of documentStructure meets user feedback, if so, just return 'success'.`;
|
|
@@ -3,6 +3,8 @@ import {
|
|
|
3
3
|
getUpdateDocumentOutputJsonSchema,
|
|
4
4
|
validateUpdateDocumentInput,
|
|
5
5
|
} from "../../../types/document-structure-schema.mjs";
|
|
6
|
+
import streamlineDocumentTitlesIfNeeded from "../../utils/streamline-document-titles-if-needed.mjs";
|
|
7
|
+
import generateDocumentIconIfNeeded from "../../utils/generate-document-icon-if-needed.mjs";
|
|
6
8
|
|
|
7
9
|
export default async function updateDocument(input, options) {
|
|
8
10
|
// Validate input using Zod schema
|
|
@@ -44,10 +46,26 @@ export default async function updateDocument(input, options) {
|
|
|
44
46
|
...(sourceIds !== undefined && { sourceIds: [...sourceIds] }), // Create a copy of the array
|
|
45
47
|
};
|
|
46
48
|
|
|
49
|
+
if (!options.context.userContext.streamlinedDocumentTitles) {
|
|
50
|
+
// Streamline document titles if needed (will streamline the updated document if title > 18 characters)
|
|
51
|
+
await streamlineDocumentTitlesIfNeeded({ documentStructure: [updatedDocument] }, options);
|
|
52
|
+
options.context.userContext.streamlinedDocumentTitles = true;
|
|
53
|
+
}
|
|
54
|
+
|
|
47
55
|
// Update the document in the structure
|
|
48
56
|
const updatedStructure = [...documentStructure];
|
|
49
57
|
updatedStructure[documentIndex] = updatedDocument;
|
|
50
58
|
|
|
59
|
+
// Generate/update icon for root-level documents if needed
|
|
60
|
+
// Pass original document for comparison to detect title/description changes
|
|
61
|
+
await generateDocumentIconIfNeeded(
|
|
62
|
+
{
|
|
63
|
+
documentStructure: updatedStructure,
|
|
64
|
+
originalItems: [originalDocument],
|
|
65
|
+
},
|
|
66
|
+
options,
|
|
67
|
+
);
|
|
68
|
+
|
|
51
69
|
const updates = [];
|
|
52
70
|
if (title !== undefined) updates.push(`title to '${title}'`);
|
|
53
71
|
if (description !== undefined) updates.push("description");
|
|
@@ -2,9 +2,9 @@ name: drawDiagram
|
|
|
2
2
|
description: Generate a D2 diagram from document content.
|
|
3
3
|
instructions:
|
|
4
4
|
- role: system
|
|
5
|
-
url: ../../prompts/detail/
|
|
5
|
+
url: ../../prompts/detail/diagram/system-prompt.md
|
|
6
6
|
- role: user
|
|
7
|
-
url: ../../prompts/detail/
|
|
7
|
+
url: ../../prompts/detail/diagram/user-prompt.md
|
|
8
8
|
input_schema:
|
|
9
9
|
type: object
|
|
10
10
|
properties:
|
|
@@ -54,10 +54,10 @@ skills:
|
|
|
54
54
|
properties:
|
|
55
55
|
projectName:
|
|
56
56
|
type: string
|
|
57
|
-
description: Project name identified from your content sources
|
|
57
|
+
description: Project name identified from your content sources. Max 40 characters (any language, each character = 1). Leading/trailing spaces removed. Generate complete name within limit.
|
|
58
58
|
projectDesc:
|
|
59
59
|
type: string
|
|
60
|
-
description: Brief project description
|
|
60
|
+
description: Brief project description from content analysis. Max 160 characters (any language, each character = 1). Leading/trailing spaces removed. Generate complete description within limit.
|
|
61
61
|
structures:
|
|
62
62
|
type: array
|
|
63
63
|
description: List of document structure items to add or update
|
|
@@ -109,6 +109,7 @@ skills:
|
|
|
109
109
|
path: refinedItem.path,
|
|
110
110
|
parentId: refinedItem.parentPath || null, // Convert parentPath to parentId
|
|
111
111
|
sourceIds: originalItem?.sourceIds || [],
|
|
112
|
+
...(refinedItem.icon && { icon: refinedItem.icon }), // Preserve icon if updated during refinement
|
|
112
113
|
}
|
|
113
114
|
|
|
114
115
|
return newItem
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getActiveRulesForScope } from "../../utils/preferences-utils.mjs";
|
|
2
2
|
import { recordUpdate } from "../../utils/history-utils.mjs";
|
|
3
3
|
import { buildDocumentTree } from "../../utils/docs-finder-utils.mjs";
|
|
4
|
+
import equal from "fast-deep-equal";
|
|
4
5
|
|
|
5
6
|
function formatDocumentStructure(structure) {
|
|
6
7
|
const { rootNodes } = buildDocumentTree(structure);
|
|
@@ -49,25 +50,27 @@ export default async function userReviewDocumentStructure({ documentStructure, .
|
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
// Print current documentation structure in a user-friendly format
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
53
|
+
if (!rest.isChat) {
|
|
54
|
+
printDocumentStructure(documentStructure);
|
|
55
|
+
|
|
56
|
+
// Ask user if they want to review the documentation structure
|
|
57
|
+
const needReview = await options.prompts.select({
|
|
58
|
+
message: "Would you like to refine the documentation structure?",
|
|
59
|
+
choices: [
|
|
60
|
+
{
|
|
61
|
+
name: "No, looks good",
|
|
62
|
+
value: "no",
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: "Yes, optimize the structure (e.g. rename 'Getting Started' to 'Quick Start', move 'API Reference' before 'Configuration')",
|
|
66
|
+
value: "yes",
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
if (needReview === "no") {
|
|
72
|
+
return { documentStructure };
|
|
73
|
+
}
|
|
71
74
|
}
|
|
72
75
|
|
|
73
76
|
let currentStructure = documentStructure;
|
|
@@ -81,15 +84,17 @@ export default async function userReviewDocumentStructure({ documentStructure, .
|
|
|
81
84
|
iterationCount++;
|
|
82
85
|
|
|
83
86
|
// Ask for feedback
|
|
84
|
-
const feedback =
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
87
|
+
const feedback = rest.isChat
|
|
88
|
+
? rest.feedback
|
|
89
|
+
: await options.prompts.input({
|
|
90
|
+
message:
|
|
91
|
+
"How would you like to improve the structure?\n" +
|
|
92
|
+
"Examples:\n" +
|
|
93
|
+
" • Add a new document 'Troubleshooting'\n" +
|
|
94
|
+
" • Remove the 'Legacy Features' document\n" +
|
|
95
|
+
" • Move 'Installation' to the top of the structure\n\n" +
|
|
96
|
+
" Press Enter to finish reviewing:",
|
|
97
|
+
});
|
|
93
98
|
|
|
94
99
|
// If no feedback, break the loop
|
|
95
100
|
if (!feedback?.trim()) {
|
|
@@ -115,7 +120,7 @@ export default async function userReviewDocumentStructure({ documentStructure, .
|
|
|
115
120
|
|
|
116
121
|
try {
|
|
117
122
|
// Call refineDocumentStructure agent with feedback
|
|
118
|
-
await options.context.invoke(refineAgent, {
|
|
123
|
+
const { message } = await options.context.invoke(refineAgent, {
|
|
119
124
|
...rest,
|
|
120
125
|
dataSourceChunk: rest.dataSources[0].dataSourceChunk,
|
|
121
126
|
feedback: feedback.trim(),
|
|
@@ -125,6 +130,12 @@ export default async function userReviewDocumentStructure({ documentStructure, .
|
|
|
125
130
|
|
|
126
131
|
currentStructure = options.context.userContext.currentStructure;
|
|
127
132
|
|
|
133
|
+
if (rest.isChat && equal(currentStructure, documentStructure)) {
|
|
134
|
+
throw new Error(
|
|
135
|
+
`The suggested structure changes did not modify the existing documentation structure. ${message}`,
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
|
|
128
139
|
// Check if feedback should be saved as user preference
|
|
129
140
|
const feedbackRefinerAgent = options.context.agents["checkFeedbackRefiner"];
|
|
130
141
|
if (feedbackRefinerAgent) {
|
|
@@ -147,6 +158,10 @@ export default async function userReviewDocumentStructure({ documentStructure, .
|
|
|
147
158
|
|
|
148
159
|
// Print current documentation structure in a user-friendly format
|
|
149
160
|
printDocumentStructure(currentStructure);
|
|
161
|
+
|
|
162
|
+
if (rest.isChat) {
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
150
165
|
} catch (error) {
|
|
151
166
|
console.error("Error processing your feedback:");
|
|
152
167
|
console.error(`Type: ${error.name}`);
|
package/agents/init/index.mjs
CHANGED
|
@@ -403,8 +403,9 @@ async function _init(
|
|
|
403
403
|
|
|
404
404
|
// Save project info to config
|
|
405
405
|
const projectInfo = await getProjectInfo();
|
|
406
|
-
|
|
407
|
-
input.
|
|
406
|
+
// Remove leading and trailing spaces (middle spaces are preserved and count toward limit)
|
|
407
|
+
input.projectName = projectInfo.name.trim();
|
|
408
|
+
input.projectDesc = projectInfo.description.trim();
|
|
408
409
|
input.projectLogo = projectInfo.icon;
|
|
409
410
|
|
|
410
411
|
// Generate YAML content
|
|
@@ -453,8 +454,9 @@ export function generateYAML(input) {
|
|
|
453
454
|
// Create the main configuration object that will be safely serialized
|
|
454
455
|
const config = {
|
|
455
456
|
// Project information (safely handled by yaml library)
|
|
456
|
-
|
|
457
|
-
|
|
457
|
+
// Remove leading and trailing spaces (middle spaces are preserved and count toward limit)
|
|
458
|
+
projectName: (input.projectName || "").trim(),
|
|
459
|
+
projectDesc: (input.projectDesc || "").trim(),
|
|
458
460
|
projectLogo: input.projectLogo || "",
|
|
459
461
|
|
|
460
462
|
thinking: {
|
|
@@ -160,9 +160,10 @@ export default async function loadMediaDescription(input, options) {
|
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
// Build enhanced assetsContent with descriptions
|
|
163
|
-
let enhancedAssetsContent
|
|
163
|
+
let enhancedAssetsContent;
|
|
164
164
|
|
|
165
165
|
if (mediaFiles.length > 0) {
|
|
166
|
+
enhancedAssetsContent = "# Available Media Assets for Documentation\n\n";
|
|
166
167
|
const assets = mediaFiles.map((x) => {
|
|
167
168
|
const mediaHash = mediaHashMap.get(x.path);
|
|
168
169
|
const description = cache[mediaHash]?.description;
|
|
@@ -16,6 +16,9 @@ properties:
|
|
|
16
16
|
description: Associated sourceId from `<data_sources>` for subsequent translation and content generation, must come from sourceId in `<data_sources>`, cannot have fake ids, **cannot be empty**
|
|
17
17
|
items:
|
|
18
18
|
type: string
|
|
19
|
+
icon:
|
|
20
|
+
type: string
|
|
21
|
+
description: Lucide icon name for root-level documents (just support lucide:icon-name, not support other icon collections)
|
|
19
22
|
required:
|
|
20
23
|
- title
|
|
21
24
|
- description
|
|
@@ -14,6 +14,9 @@ properties:
|
|
|
14
14
|
parentPath:
|
|
15
15
|
type: string
|
|
16
16
|
description: Parent node path, if null indicates it is a top-level node
|
|
17
|
+
icon:
|
|
18
|
+
type: string
|
|
19
|
+
description: Iconify icon name, e.g., lucide:book, lucide:rocket, lucide:* etc.
|
|
17
20
|
required:
|
|
18
21
|
- title
|
|
19
22
|
- description
|
|
@@ -19,6 +19,9 @@ items:
|
|
|
19
19
|
description: Associated sourceId from `<data_sources>` for subsequent translation and content generation, must come from sourceId in `<data_sources>`, cannot have fake ids, **cannot be empty**
|
|
20
20
|
items:
|
|
21
21
|
type: string
|
|
22
|
+
icon:
|
|
23
|
+
type: string
|
|
24
|
+
description: Lucide icon name for root-level documents (just support lucide:icon-name, not support other icon collections)
|
|
22
25
|
required:
|
|
23
26
|
- title
|
|
24
27
|
- description
|