@aigne/doc-smith 0.8.11-beta → 0.8.11-beta.2
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/.aigne/doc-smith/config.yaml +2 -0
- package/.aigne/doc-smith/output/structure-plan.json +3 -3
- package/.aigne/doc-smith/upload-cache.yaml +252 -0
- package/.github/workflows/publish-docs.yml +67 -0
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +22 -0
- package/README.md +45 -115
- package/agents/clear/choose-contents.mjs +170 -0
- package/agents/clear/clear-auth-tokens.mjs +111 -0
- package/agents/clear/clear-document-config.mjs +39 -0
- package/agents/clear/clear-document-structure.mjs +106 -0
- package/agents/clear/clear-generated-docs.mjs +51 -0
- package/agents/clear/index.yaml +23 -0
- package/agents/evaluate/code-snippet.mjs +93 -0
- package/agents/evaluate/document-structure.yaml +70 -0
- package/agents/evaluate/document.yaml +79 -0
- package/agents/evaluate/generate-report.mjs +78 -0
- package/agents/evaluate/index.yaml +39 -0
- package/agents/generate/document-structure-tools/add-document.mjs +56 -0
- package/agents/generate/document-structure-tools/delete-document.mjs +49 -0
- package/agents/generate/document-structure-tools/move-document.mjs +82 -0
- package/agents/generate/document-structure-tools/update-document.mjs +50 -0
- package/agents/generate/generate-structure.yaml +1 -1
- package/agents/generate/update-document-structure.yaml +42 -0
- package/agents/generate/user-review-document-structure.mjs +6 -4
- package/agents/init/index.mjs +1 -1
- package/agents/publish/publish-docs.mjs +12 -3
- package/agents/translate/choose-language.mjs +1 -1
- package/agents/update/batch-update-document.yaml +7 -0
- package/agents/update/check-update-is-single.mjs +38 -0
- package/agents/update/document-tools/update-document-content.mjs +293 -0
- package/agents/update/index.yaml +4 -10
- package/agents/update/update-document-detail.yaml +52 -0
- package/agents/update/update-single-document.yaml +15 -0
- package/agents/update/user-review-document.mjs +248 -0
- package/agents/utils/choose-docs.mjs +4 -2
- package/agents/utils/format-document-structure.mjs +12 -2
- package/agents/utils/load-document-all-content.mjs +84 -0
- package/agents/utils/load-sources.mjs +4 -1
- package/aigne.yaml +59 -20
- package/assets/report-template/report.html +198 -0
- package/biome.json +14 -2
- package/docs/advanced-how-it-works.ja.md +101 -0
- package/docs/advanced-how-it-works.zh-TW.md +101 -0
- package/docs/advanced-how-it-works.zh.md +20 -20
- package/docs/advanced-quality-assurance.ja.md +96 -0
- package/docs/advanced-quality-assurance.zh-TW.md +96 -0
- package/docs/advanced-quality-assurance.zh.md +18 -18
- package/docs/advanced.ja.md +16 -0
- package/docs/advanced.zh-TW.md +16 -0
- package/docs/advanced.zh.md +4 -4
- package/docs/changelog.ja.md +309 -0
- package/docs/changelog.zh-TW.md +309 -0
- package/docs/changelog.zh.md +23 -23
- package/docs/cli-reference.ja.md +210 -0
- package/docs/cli-reference.zh-TW.md +210 -0
- package/docs/cli-reference.zh.md +21 -21
- package/docs/configuration-interactive-setup.ja.md +135 -0
- package/docs/configuration-interactive-setup.zh-TW.md +135 -0
- package/docs/configuration-interactive-setup.zh.md +29 -29
- package/docs/configuration-language-support.ja.md +94 -0
- package/docs/configuration-language-support.zh-TW.md +94 -0
- package/docs/configuration-language-support.zh.md +13 -13
- package/docs/configuration-llm-setup.ja.md +54 -0
- package/docs/configuration-llm-setup.zh-TW.md +54 -0
- package/docs/configuration-llm-setup.zh.md +12 -12
- package/docs/configuration-preferences.ja.md +129 -0
- package/docs/configuration-preferences.zh-TW.md +129 -0
- package/docs/configuration-preferences.zh.md +36 -36
- package/docs/configuration.ja.md +172 -0
- package/docs/configuration.zh-TW.md +172 -0
- package/docs/configuration.zh.md +49 -49
- package/docs/features-generate-documentation.ja.md +101 -0
- package/docs/features-generate-documentation.zh-TW.md +101 -0
- package/docs/features-generate-documentation.zh.md +17 -17
- package/docs/features-publish-your-docs.ja.md +107 -0
- package/docs/features-publish-your-docs.zh-TW.md +107 -0
- package/docs/features-publish-your-docs.zh.md +22 -22
- package/docs/features-translate-documentation.ja.md +79 -0
- package/docs/features-translate-documentation.zh-TW.md +79 -0
- package/docs/features-translate-documentation.zh.md +12 -12
- package/docs/features-update-and-refine.ja.md +138 -0
- package/docs/features-update-and-refine.zh-TW.md +138 -0
- package/docs/features-update-and-refine.zh.md +21 -21
- package/docs/features.ja.md +52 -0
- package/docs/features.zh-TW.md +52 -0
- package/docs/features.zh.md +8 -8
- package/docs/getting-started.ja.md +123 -0
- package/docs/getting-started.zh-TW.md +123 -0
- package/docs/getting-started.zh.md +24 -24
- package/docs/overview.ja.md +30 -0
- package/docs/overview.zh-TW.md +30 -0
- package/docs/overview.zh.md +8 -8
- package/package.json +19 -11
- package/prompts/common/document/content-rules-core.md +19 -0
- package/prompts/common/document/media-handling-rules.md +9 -0
- package/prompts/common/document/role-and-personality.md +15 -0
- package/prompts/common/document/user-preferences.md +9 -0
- package/prompts/common/document-structure/conflict-resolution-guidance.md +16 -0
- package/prompts/common/document-structure/document-structure-rules.md +45 -0
- package/prompts/common/document-structure/glossary.md +7 -0
- package/prompts/common/document-structure/intj-traits.md +5 -0
- package/prompts/common/document-structure/output-constraints.md +9 -0
- package/prompts/common/document-structure/user-locale-rules.md +10 -0
- package/prompts/common/document-structure/user-preferences.md +9 -0
- package/prompts/detail/custom/custom-components.md +9 -1
- package/prompts/detail/document-rules.md +6 -6
- package/prompts/detail/generate-document.md +5 -45
- package/prompts/detail/update-document.md +145 -0
- package/prompts/evaluate/document-structure.md +94 -0
- package/prompts/evaluate/document.md +149 -0
- package/prompts/structure/document-rules.md +1 -1
- package/prompts/structure/generate-structure-system.md +74 -0
- package/prompts/structure/generate-structure-user.md +41 -0
- package/prompts/structure/update-document-structure.md +118 -0
- package/prompts/translate/translate-document.md +1 -1
- package/prompts/utils/feedback-refiner.md +3 -3
- package/release-please-config.json +1 -7
- package/tests/agents/clear/choose-contents.test.mjs +280 -0
- package/tests/agents/clear/clear-auth-tokens.test.mjs +268 -0
- package/tests/agents/clear/clear-document-config.test.mjs +167 -0
- package/tests/agents/clear/clear-document-structure.test.mjs +374 -0
- package/tests/agents/clear/clear-generated-docs.test.mjs +222 -0
- package/tests/agents/evaluate/code-snippet.test.mjs +163 -0
- package/tests/agents/evaluate/fixtures/api-services.md +87 -0
- package/tests/agents/evaluate/fixtures/js-sdk.md +94 -0
- package/tests/agents/evaluate/generate-report.test.mjs +312 -0
- package/tests/agents/generate/check-document-structure.test.mjs +0 -6
- package/tests/agents/generate/document-structure-tools/add-document.test.mjs +449 -0
- package/tests/agents/generate/document-structure-tools/delete-document.test.mjs +410 -0
- package/tests/agents/generate/document-structure-tools/move-document.test.mjs +476 -0
- package/tests/agents/generate/document-structure-tools/update-document.test.mjs +548 -0
- package/tests/agents/generate/generate-structure.test.mjs +0 -6
- package/tests/agents/generate/user-review-document-structure.test.mjs +9 -9
- package/tests/agents/publish/publish-docs.test.mjs +2 -2
- package/tests/agents/update/check-update-is-single.test.mjs +300 -0
- package/tests/agents/update/document-tools/update-document-content.test.mjs +326 -0
- package/tests/agents/update/user-review-document.test.mjs +561 -0
- package/tests/agents/utils/format-document-structure.test.mjs +100 -0
- package/tests/utils/auth-utils.test.mjs +239 -1
- package/tests/utils/blocklet.test.mjs +9 -7
- package/tests/utils/constants.test.mjs +1 -1
- package/tests/utils/d2-utils.test.mjs +1 -1
- package/tests/utils/deploy.test.mjs +310 -366
- package/tests/utils/kroki-utils.test.mjs +2 -15
- package/tests/utils/linter/fixtures/css/keyword-error.css +1 -0
- package/tests/utils/linter/fixtures/css/missing-semicolon.css +1 -0
- package/tests/utils/linter/fixtures/css/syntax-error.css +1 -0
- package/tests/utils/linter/fixtures/css/undeclare-variable.css +1 -0
- package/tests/utils/linter/fixtures/css/unused-variable.css +2 -0
- package/tests/utils/linter/fixtures/css/valid-code.css +1 -0
- package/tests/utils/linter/fixtures/dockerfile/keyword-error.dockerfile +1 -0
- package/tests/utils/linter/fixtures/dockerfile/missing-semicolon.dockerfile +2 -0
- package/tests/utils/linter/fixtures/dockerfile/syntax-error.dockerfile +2 -0
- package/tests/utils/linter/fixtures/dockerfile/undeclare-variable.dockerfile +1 -0
- package/tests/utils/linter/fixtures/dockerfile/unused-variable.dockerfile +1 -0
- package/tests/utils/linter/fixtures/dockerfile/valid-code.dockerfile +2 -0
- package/tests/utils/linter/fixtures/go/keyword-error.go +5 -0
- package/tests/utils/linter/fixtures/go/missing-semicolon.go +5 -0
- package/tests/utils/linter/fixtures/go/syntax-error.go +6 -0
- package/tests/utils/linter/fixtures/go/undeclare-variable.go +5 -0
- package/tests/utils/linter/fixtures/go/unused-variable.go +5 -0
- package/tests/utils/linter/fixtures/go/valid-code.go +7 -0
- package/tests/utils/linter/fixtures/js/keyword-error.js +3 -0
- package/tests/utils/linter/fixtures/js/missing-semicolon.js +6 -0
- package/tests/utils/linter/fixtures/js/syntax-error.js +4 -0
- package/tests/utils/linter/fixtures/js/undeclare-variable.js +3 -0
- package/tests/utils/linter/fixtures/js/unused-variable.js +7 -0
- package/tests/utils/linter/fixtures/js/valid-code.js +15 -0
- package/tests/utils/linter/fixtures/json/keyword-error.json +1 -0
- package/tests/utils/linter/fixtures/json/missing-semicolon.json +1 -0
- package/tests/utils/linter/fixtures/json/syntax-error.json +1 -0
- package/tests/utils/linter/fixtures/json/undeclare-variable.json +1 -0
- package/tests/utils/linter/fixtures/json/unused-variable.json +1 -0
- package/tests/utils/linter/fixtures/json/valid-code.json +1 -0
- package/tests/utils/linter/fixtures/jsx/keyword-error.jsx +5 -0
- package/tests/utils/linter/fixtures/jsx/missing-semicolon.jsx +5 -0
- package/tests/utils/linter/fixtures/jsx/syntax-error.jsx +5 -0
- package/tests/utils/linter/fixtures/jsx/undeclare-variable.jsx +5 -0
- package/tests/utils/linter/fixtures/jsx/unused-variable.jsx +4 -0
- package/tests/utils/linter/fixtures/jsx/valid-code.jsx +5 -0
- package/tests/utils/linter/fixtures/python/keyword-error.py +3 -0
- package/tests/utils/linter/fixtures/python/missing-semicolon.py +2 -0
- package/tests/utils/linter/fixtures/python/syntax-error.py +3 -0
- package/tests/utils/linter/fixtures/python/undeclare-variable.py +3 -0
- package/tests/utils/linter/fixtures/python/unused-variable.py +6 -0
- package/tests/utils/linter/fixtures/python/valid-code.py +12 -0
- package/tests/utils/linter/fixtures/ruby/keyword-error.rb +2 -0
- package/tests/utils/linter/fixtures/ruby/missing-semicolon.rb +1 -0
- package/tests/utils/linter/fixtures/ruby/syntax-error.rb +2 -0
- package/tests/utils/linter/fixtures/ruby/undeclare-variable.rb +1 -0
- package/tests/utils/linter/fixtures/ruby/unused-variable.rb +2 -0
- package/tests/utils/linter/fixtures/ruby/valid-code.rb +1 -0
- package/tests/utils/linter/fixtures/sass/keyword-error.sass +2 -0
- package/tests/utils/linter/fixtures/sass/missing-semicolon.sass +3 -0
- package/tests/utils/linter/fixtures/sass/syntax-error.sass +3 -0
- package/tests/utils/linter/fixtures/sass/undeclare-variable.sass +2 -0
- package/tests/utils/linter/fixtures/sass/unused-variable.sass +4 -0
- package/tests/utils/linter/fixtures/sass/valid-code.sass +2 -0
- package/tests/utils/linter/fixtures/scss/keyword-error.scss +1 -0
- package/tests/utils/linter/fixtures/scss/missing-semicolon.scss +1 -0
- package/tests/utils/linter/fixtures/scss/syntax-error.scss +1 -0
- package/tests/utils/linter/fixtures/scss/undeclare-variable.scss +1 -0
- package/tests/utils/linter/fixtures/scss/unused-variable.scss +2 -0
- package/tests/utils/linter/fixtures/scss/valid-code.scss +1 -0
- package/tests/utils/linter/fixtures/shell/keyword-error.sh +5 -0
- package/tests/utils/linter/fixtures/shell/missing-semicolon.sh +3 -0
- package/tests/utils/linter/fixtures/shell/syntax-error.sh +4 -0
- package/tests/utils/linter/fixtures/shell/undeclare-variable.sh +3 -0
- package/tests/utils/linter/fixtures/shell/unused-variable.sh +4 -0
- package/tests/utils/linter/fixtures/shell/valid-code.sh +3 -0
- package/tests/utils/linter/fixtures/ts/keyword-error.ts +1 -0
- package/tests/utils/linter/fixtures/ts/missing-semicolon.ts +1 -0
- package/tests/utils/linter/fixtures/ts/syntax-error.ts +1 -0
- package/tests/utils/linter/fixtures/ts/undeclare-variable.ts +1 -0
- package/tests/utils/linter/fixtures/ts/unused-variable.ts +3 -0
- package/tests/utils/linter/fixtures/ts/valid-code.ts +3 -0
- package/tests/utils/linter/fixtures/tsx/keyword-error.tsx +5 -0
- package/tests/utils/linter/fixtures/tsx/missing-semicolon.tsx +5 -0
- package/tests/utils/linter/fixtures/tsx/syntax-error.tsx +5 -0
- package/tests/utils/linter/fixtures/tsx/undeclare-variable.tsx +6 -0
- package/tests/utils/linter/fixtures/tsx/unused-variable.tsx +6 -0
- package/tests/utils/linter/fixtures/tsx/valid-code.tsx +5 -0
- package/tests/utils/linter/fixtures/vue/keyword-error.vue +6 -0
- package/tests/utils/linter/fixtures/vue/missing-semicolon.vue +6 -0
- package/tests/utils/linter/fixtures/vue/syntax-error.vue +6 -0
- package/tests/utils/linter/fixtures/vue/undeclare-variable.vue +6 -0
- package/tests/utils/linter/fixtures/vue/unused-variable.vue +7 -0
- package/tests/utils/linter/fixtures/vue/valid-code.vue +6 -0
- package/tests/utils/linter/fixtures/yaml/keyword-error.yml +1 -0
- package/tests/utils/linter/fixtures/yaml/missing-semicolon.yml +2 -0
- package/tests/utils/linter/fixtures/yaml/syntax-error.yml +1 -0
- package/tests/utils/linter/fixtures/yaml/undeclare-variable.yml +1 -0
- package/tests/utils/linter/fixtures/yaml/unused-variable.yml +2 -0
- package/tests/utils/linter/fixtures/yaml/valid-code.yml +3 -0
- package/tests/utils/linter/index.test.mjs +440 -0
- package/tests/utils/linter/scan-results.mjs +42 -0
- package/tests/utils/markdown/index.test.mjs +478 -0
- package/tests/utils/mermaid-validator.test.mjs +2 -2
- package/tests/utils/utils.test.mjs +3 -1
- package/types/document-schema.mjs +54 -0
- package/types/document-structure-schema.mjs +244 -0
- package/utils/auth-utils.mjs +131 -6
- package/utils/conflict-detector.mjs +5 -1
- package/utils/{constants.mjs → constants/index.mjs} +109 -0
- package/utils/constants/linter.mjs +102 -0
- package/utils/d2-utils.mjs +2 -4
- package/utils/debug.mjs +3 -0
- package/utils/deploy.mjs +81 -385
- package/utils/evaluate/report-utils.mjs +131 -0
- package/utils/file-utils.mjs +36 -1
- package/utils/kroki-utils.mjs +1 -1
- package/utils/linter/index.mjs +50 -0
- package/utils/markdown/index.mjs +26 -0
- package/utils/markdown-checker.mjs +1 -1
- package/utils/utils.mjs +19 -7
- package/prompts/structure/generate-structure.md +0 -161
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getMoveDocumentInputJsonSchema,
|
|
3
|
+
getMoveDocumentOutputJsonSchema,
|
|
4
|
+
validateMoveDocumentInput,
|
|
5
|
+
} from "../../../types/document-structure-schema.mjs";
|
|
6
|
+
|
|
7
|
+
export default async function moveDocument(input) {
|
|
8
|
+
// Validate input using Zod schema
|
|
9
|
+
const validation = validateMoveDocumentInput(input);
|
|
10
|
+
if (!validation.success) {
|
|
11
|
+
console.log(`Error: Cannot move document - ${validation.error}`);
|
|
12
|
+
return { documentStructure: input.documentStructure };
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const { documentStructure, path, newParentId } = validation.data;
|
|
16
|
+
|
|
17
|
+
// Find the document to move
|
|
18
|
+
const documentIndex = documentStructure.findIndex((item) => item.path === path);
|
|
19
|
+
if (documentIndex === -1) {
|
|
20
|
+
console.log(
|
|
21
|
+
`Error: Cannot move document - Document '${path}' does not exist. Please select an existing document to move.`,
|
|
22
|
+
);
|
|
23
|
+
return { documentStructure };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const documentToMove = documentStructure[documentIndex];
|
|
27
|
+
|
|
28
|
+
// Validate new parent exists if newParentId is provided
|
|
29
|
+
if (
|
|
30
|
+
newParentId !== null &&
|
|
31
|
+
newParentId !== undefined &&
|
|
32
|
+
newParentId !== "null" &&
|
|
33
|
+
newParentId !== ""
|
|
34
|
+
) {
|
|
35
|
+
const newParentExists = documentStructure.some((item) => item.path === newParentId);
|
|
36
|
+
if (!newParentExists) {
|
|
37
|
+
console.log(
|
|
38
|
+
`Error: Cannot move document - Target parent document '${newParentId}' does not exist. Please select an existing parent document.`,
|
|
39
|
+
);
|
|
40
|
+
return { documentStructure };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Check for circular dependency: the new parent cannot be a descendant of the document being moved
|
|
44
|
+
const isDescendant = (parentPath, childPath) => {
|
|
45
|
+
const children = documentStructure.filter((item) => item.parentId === parentPath);
|
|
46
|
+
for (const child of children) {
|
|
47
|
+
if (child.path === childPath || isDescendant(child.path, childPath)) {
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return false;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
if (isDescendant(path, newParentId)) {
|
|
55
|
+
console.log(
|
|
56
|
+
`Error: Cannot move document - Moving '${path}' under '${newParentId}' would create an invalid hierarchy. Please select a parent that is not nested under the document being moved.`,
|
|
57
|
+
);
|
|
58
|
+
return { documentStructure };
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Create updated document object with new parent
|
|
63
|
+
const updatedDocument = {
|
|
64
|
+
...documentToMove,
|
|
65
|
+
parentId: newParentId || null,
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// Update the document structure
|
|
69
|
+
const updatedStructure = [...documentStructure];
|
|
70
|
+
updatedStructure[documentIndex] = updatedDocument;
|
|
71
|
+
|
|
72
|
+
return {
|
|
73
|
+
documentStructure: updatedStructure,
|
|
74
|
+
originalDocument: documentToMove,
|
|
75
|
+
updatedDocument,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
moveDocument.taskTitle = "Move document";
|
|
80
|
+
moveDocument.description = "Move a document to a different parent in the document structure";
|
|
81
|
+
moveDocument.inputSchema = getMoveDocumentInputJsonSchema();
|
|
82
|
+
moveDocument.outputSchema = getMoveDocumentOutputJsonSchema();
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getUpdateDocumentInputJsonSchema,
|
|
3
|
+
getUpdateDocumentOutputJsonSchema,
|
|
4
|
+
validateUpdateDocumentInput,
|
|
5
|
+
} from "../../../types/document-structure-schema.mjs";
|
|
6
|
+
|
|
7
|
+
export default async function updateDocument(input) {
|
|
8
|
+
// Validate input using Zod schema
|
|
9
|
+
const validation = validateUpdateDocumentInput(input);
|
|
10
|
+
if (!validation.success) {
|
|
11
|
+
console.log(`⚠️ Cannot update document: ${validation.error}`);
|
|
12
|
+
return { documentStructure: input.documentStructure };
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const { documentStructure, path, title, description, sourceIds } = validation.data;
|
|
16
|
+
|
|
17
|
+
// Find the document to update
|
|
18
|
+
const documentIndex = documentStructure.findIndex((item) => item.path === path);
|
|
19
|
+
if (documentIndex === -1) {
|
|
20
|
+
console.log(
|
|
21
|
+
`⚠️ Cannot update document: Document '${path}' does not exist. Choose an existing document to update.`,
|
|
22
|
+
);
|
|
23
|
+
return { documentStructure };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const originalDocument = documentStructure[documentIndex];
|
|
27
|
+
|
|
28
|
+
// Create updated document object
|
|
29
|
+
const updatedDocument = {
|
|
30
|
+
...originalDocument,
|
|
31
|
+
...(title !== undefined && { title }),
|
|
32
|
+
...(description !== undefined && { description }),
|
|
33
|
+
...(sourceIds !== undefined && { sourceIds: [...sourceIds] }), // Create a copy of the array
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// Update the document structure
|
|
37
|
+
const updatedStructure = [...documentStructure];
|
|
38
|
+
updatedStructure[documentIndex] = updatedDocument;
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
documentStructure: updatedStructure,
|
|
42
|
+
originalDocument,
|
|
43
|
+
updatedDocument,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
updateDocument.taskTitle = "Update document";
|
|
48
|
+
updateDocument.description = "Update properties of an existing document in the document structure";
|
|
49
|
+
updateDocument.inputSchema = getUpdateDocumentInputJsonSchema();
|
|
50
|
+
updateDocument.outputSchema = getUpdateDocumentOutputJsonSchema();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
name: generateStructure
|
|
2
2
|
description: Generate the structure and organization of your documentation
|
|
3
3
|
instructions:
|
|
4
|
-
url: ../../prompts/structure/generate-structure.md
|
|
4
|
+
url: ../../prompts/structure/generate-structure-system.md
|
|
5
5
|
input_schema:
|
|
6
6
|
type: object
|
|
7
7
|
properties:
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
type: ai
|
|
2
|
+
name: updateDocumentStructure
|
|
3
|
+
description: Update document structure based on user feedback and intentions using structure modification tools
|
|
4
|
+
instructions:
|
|
5
|
+
url: ../../prompts/structure/update-document-structure.md
|
|
6
|
+
input_schema:
|
|
7
|
+
type: object
|
|
8
|
+
properties:
|
|
9
|
+
documentStructure: ../schema/document-structure.yaml
|
|
10
|
+
rules:
|
|
11
|
+
type: string
|
|
12
|
+
description: User configuration rules
|
|
13
|
+
locale:
|
|
14
|
+
type: string
|
|
15
|
+
description: User language, e.g. zh, en
|
|
16
|
+
datasources:
|
|
17
|
+
type: string
|
|
18
|
+
description: Context for document structure
|
|
19
|
+
glossary:
|
|
20
|
+
type: string
|
|
21
|
+
description: Glossary of terms
|
|
22
|
+
feedback:
|
|
23
|
+
type: string
|
|
24
|
+
description: User feedback for structure modifications
|
|
25
|
+
userPreferences:
|
|
26
|
+
type: string
|
|
27
|
+
description: Your saved preferences for structure and documentation style
|
|
28
|
+
required:
|
|
29
|
+
- documentStructure
|
|
30
|
+
- feedback
|
|
31
|
+
output_schema:
|
|
32
|
+
type: object
|
|
33
|
+
properties:
|
|
34
|
+
documentStructure: ../schema/document-structure.yaml
|
|
35
|
+
operationSummary:
|
|
36
|
+
type: string
|
|
37
|
+
description: Summary of the operations performed on the document structure
|
|
38
|
+
skills:
|
|
39
|
+
- ./document-structure-tools/add-document.mjs
|
|
40
|
+
- ./document-structure-tools/delete-document.mjs
|
|
41
|
+
- ./document-structure-tools/update-document.mjs
|
|
42
|
+
- ./document-structure-tools/move-document.mjs
|
|
@@ -56,7 +56,9 @@ function printDocumentStructure(structure) {
|
|
|
56
56
|
if (rootNodes.length === 0) {
|
|
57
57
|
console.log(" No document structure found.");
|
|
58
58
|
} else {
|
|
59
|
-
rootNodes.forEach((node) =>
|
|
59
|
+
rootNodes.forEach((node) => {
|
|
60
|
+
printNode(node);
|
|
61
|
+
});
|
|
60
62
|
}
|
|
61
63
|
console.log();
|
|
62
64
|
}
|
|
@@ -112,10 +114,10 @@ export default async function userReviewDocumentStructure({ documentStructure, .
|
|
|
112
114
|
}
|
|
113
115
|
|
|
114
116
|
// Get the refineDocumentStructure agent
|
|
115
|
-
const refineAgent = options.context.agents["
|
|
117
|
+
const refineAgent = options.context.agents["updateDocumentStructure"];
|
|
116
118
|
if (!refineAgent) {
|
|
117
119
|
console.log(
|
|
118
|
-
"Unable to process your feedback - the structure
|
|
120
|
+
"Unable to process your feedback - the document structure update feature is unavailable.",
|
|
119
121
|
);
|
|
120
122
|
console.log("Please try again later or contact support if this continues.");
|
|
121
123
|
break;
|
|
@@ -133,7 +135,7 @@ export default async function userReviewDocumentStructure({ documentStructure, .
|
|
|
133
135
|
const result = await options.context.invoke(refineAgent, {
|
|
134
136
|
...rest,
|
|
135
137
|
feedback: feedback.trim(),
|
|
136
|
-
|
|
138
|
+
documentStructure: currentStructure,
|
|
137
139
|
userPreferences,
|
|
138
140
|
});
|
|
139
141
|
|
package/agents/init/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import chalk from "chalk";
|
|
|
5
5
|
import fs from "fs-extra";
|
|
6
6
|
|
|
7
7
|
import { getAccessToken } from "../../utils/auth-utils.mjs";
|
|
8
|
-
import { DISCUSS_KIT_STORE_URL, TMP_DIR, TMP_DOCS_DIR } from "../../utils/constants.mjs";
|
|
8
|
+
import { DISCUSS_KIT_STORE_URL, TMP_DIR, TMP_DOCS_DIR } from "../../utils/constants/index.mjs";
|
|
9
9
|
import { beforePublishHook, ensureTmpDir } from "../../utils/d2-utils.mjs";
|
|
10
10
|
import { deploy } from "../../utils/deploy.mjs";
|
|
11
11
|
import { getGithubRepoUrl, loadConfigFromFile, saveValueToConfig } from "../../utils/utils.mjs";
|
|
@@ -153,7 +153,11 @@ export default async function publishDocs(
|
|
|
153
153
|
let message;
|
|
154
154
|
|
|
155
155
|
try {
|
|
156
|
-
const {
|
|
156
|
+
const {
|
|
157
|
+
success,
|
|
158
|
+
boardId: newBoardId,
|
|
159
|
+
error,
|
|
160
|
+
} = await publishDocsFn({
|
|
157
161
|
sidebarPath,
|
|
158
162
|
accessToken,
|
|
159
163
|
appUrl,
|
|
@@ -179,7 +183,12 @@ export default async function publishDocs(
|
|
|
179
183
|
if (boardId !== newBoardId) {
|
|
180
184
|
await saveValueToConfig("boardId", newBoardId);
|
|
181
185
|
}
|
|
182
|
-
message = `✅ Documentation
|
|
186
|
+
message = `✅ Documentation published successfully!`;
|
|
187
|
+
} else {
|
|
188
|
+
// If the error is 401 or 403, it means the access token is invalid
|
|
189
|
+
if (error?.includes("401") || error?.includes("403")) {
|
|
190
|
+
message = `❌ Publishing failed: you don’t have valid authorization.\n Run ${chalk.cyan("aigne doc clear")} to reset it, then publish again.`;
|
|
191
|
+
}
|
|
183
192
|
}
|
|
184
193
|
} catch (error) {
|
|
185
194
|
message = `❌ Failed to publish docs: ${error.message}`;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export default async function checkUpdateIsSingle({ selectedDocs, ...rest }, options) {
|
|
2
|
+
if (!selectedDocs || !Array.isArray(selectedDocs)) {
|
|
3
|
+
throw new Error("selectedDocs must be provided as an array");
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
if (selectedDocs.length === 0) {
|
|
7
|
+
throw new Error("selectedDocs cannot be empty");
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
let targetAgent;
|
|
11
|
+
let agentName;
|
|
12
|
+
|
|
13
|
+
if (selectedDocs.length === 1) {
|
|
14
|
+
agentName = "updateSingleDocument";
|
|
15
|
+
targetAgent = options.context.agents["updateSingleDocument"];
|
|
16
|
+
} else {
|
|
17
|
+
agentName = "batchUpdateDocument";
|
|
18
|
+
targetAgent = options.context.agents["batchUpdateDocument"];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (!targetAgent) {
|
|
22
|
+
throw new Error(`Agent "${agentName}" is not available`);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
try {
|
|
26
|
+
const result = await options.context.invoke(targetAgent, {
|
|
27
|
+
selectedDocs,
|
|
28
|
+
...rest,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
return result;
|
|
32
|
+
} catch (error) {
|
|
33
|
+
console.error(`Error invoking ${agentName}:`, error.message);
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
checkUpdateIsSingle.taskTitle = "Check document count and route to appropriate update agent";
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import { applyPatch } from "diff";
|
|
2
|
+
import {
|
|
3
|
+
getUpdateDocumentContentInputJsonSchema,
|
|
4
|
+
getUpdateDocumentContentOutputJsonSchema,
|
|
5
|
+
validateUpdateDocumentContentInput,
|
|
6
|
+
} from "../../../types/document-schema.mjs";
|
|
7
|
+
|
|
8
|
+
export default async function updateDocumentContent(input) {
|
|
9
|
+
// Validate input using Zod schema
|
|
10
|
+
const validation = validateUpdateDocumentContentInput(input);
|
|
11
|
+
if (!validation.success) {
|
|
12
|
+
return {
|
|
13
|
+
success: false,
|
|
14
|
+
error: validation.error,
|
|
15
|
+
message: "Invalid input parameters",
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const { originalContent, diffPatch } = validation.data;
|
|
20
|
+
|
|
21
|
+
try {
|
|
22
|
+
// Parse and validate diff patch
|
|
23
|
+
const parsedDiff = parseDiffPatch(diffPatch);
|
|
24
|
+
if (!parsedDiff.success) {
|
|
25
|
+
return {
|
|
26
|
+
success: false,
|
|
27
|
+
error: parsedDiff.error,
|
|
28
|
+
message: "Invalid diff format: No valid hunks found or parsing failed",
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Check and fix line number issues
|
|
33
|
+
const fixedDiff = fixLineNumberIssues(originalContent, parsedDiff.hunks);
|
|
34
|
+
if (!fixedDiff.success) {
|
|
35
|
+
return {
|
|
36
|
+
success: false,
|
|
37
|
+
error: fixedDiff.error,
|
|
38
|
+
message: "Cannot fix diff line number issues",
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Reconstruct the fixed diff patch
|
|
43
|
+
const fixedPatch = reconstructDiffPatch(fixedDiff.hunks);
|
|
44
|
+
|
|
45
|
+
// Apply the diff patch using the diff library
|
|
46
|
+
const result = applyPatch(originalContent, fixedPatch);
|
|
47
|
+
|
|
48
|
+
if (result === false) {
|
|
49
|
+
return {
|
|
50
|
+
success: false,
|
|
51
|
+
error: "Failed to apply patch",
|
|
52
|
+
message: "Diff patch could not be applied",
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
success: true,
|
|
58
|
+
updatedContent: result,
|
|
59
|
+
message: "Document content updated successfully",
|
|
60
|
+
};
|
|
61
|
+
} catch (error) {
|
|
62
|
+
return {
|
|
63
|
+
success: false,
|
|
64
|
+
error: error.message,
|
|
65
|
+
message: "Failed to update document content",
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function parseDiffPatch(diffPatch) {
|
|
71
|
+
try {
|
|
72
|
+
const hunks = [];
|
|
73
|
+
const lines = diffPatch.split("\n");
|
|
74
|
+
let currentHunk = null;
|
|
75
|
+
|
|
76
|
+
for (let i = 0; i < lines.length; i++) {
|
|
77
|
+
const line = lines[i];
|
|
78
|
+
|
|
79
|
+
// Parse hunk header: @@ -oldStart,oldCount +newStart,newCount @@
|
|
80
|
+
const hunkMatch = line.match(/^@@\s+-(\d+)(?:,(\d+))?\s+\+(\d+)(?:,(\d+))?\s+@@/);
|
|
81
|
+
if (hunkMatch) {
|
|
82
|
+
if (currentHunk) {
|
|
83
|
+
hunks.push(currentHunk);
|
|
84
|
+
}
|
|
85
|
+
currentHunk = {
|
|
86
|
+
oldStart: parseInt(hunkMatch[1], 10),
|
|
87
|
+
oldCount: parseInt(hunkMatch[2], 10) || 1,
|
|
88
|
+
newStart: parseInt(hunkMatch[3], 10),
|
|
89
|
+
newCount: parseInt(hunkMatch[4], 10) || 1,
|
|
90
|
+
changes: [],
|
|
91
|
+
};
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Parse changes
|
|
96
|
+
if (currentHunk && line.length > 0) {
|
|
97
|
+
const changeType = line[0];
|
|
98
|
+
const content = line.slice(1);
|
|
99
|
+
|
|
100
|
+
if (changeType === "-") {
|
|
101
|
+
currentHunk.changes.push({ type: "remove", content });
|
|
102
|
+
} else if (changeType === "+") {
|
|
103
|
+
currentHunk.changes.push({ type: "add", content });
|
|
104
|
+
} else if (changeType === " ") {
|
|
105
|
+
currentHunk.changes.push({ type: "context", content });
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (currentHunk) {
|
|
111
|
+
hunks.push(currentHunk);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (hunks.length === 0) {
|
|
115
|
+
return { success: false, error: "No valid hunks found in diff" };
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return { success: true, hunks };
|
|
119
|
+
} catch (error) {
|
|
120
|
+
return { success: false, error: `Failed to parse diff: ${error.message}` };
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function fixLineNumberIssues(originalContent, hunks) {
|
|
125
|
+
try {
|
|
126
|
+
const originalLines = originalContent.split("\n");
|
|
127
|
+
const fixedHunks = [];
|
|
128
|
+
|
|
129
|
+
for (const hunk of hunks) {
|
|
130
|
+
// Extract context and removed lines to find best match
|
|
131
|
+
const contextAndRemoved = hunk.changes
|
|
132
|
+
.filter((change) => change.type === "context" || change.type === "remove")
|
|
133
|
+
.map((change) => change.content);
|
|
134
|
+
|
|
135
|
+
if (contextAndRemoved.length === 0) {
|
|
136
|
+
// No context to match against, keep original
|
|
137
|
+
fixedHunks.push(hunk);
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// Find best matching position in original content
|
|
142
|
+
const bestMatch = findBestMatch(originalLines, contextAndRemoved, hunk.oldStart - 1);
|
|
143
|
+
|
|
144
|
+
if (bestMatch.found) {
|
|
145
|
+
const fixedHunk = {
|
|
146
|
+
...hunk,
|
|
147
|
+
oldStart: bestMatch.position + 1,
|
|
148
|
+
newStart: bestMatch.position + 1,
|
|
149
|
+
// Fix line counts based on actual changes
|
|
150
|
+
oldCount: calculateOldCount(hunk.changes),
|
|
151
|
+
newCount: calculateNewCount(hunk.changes),
|
|
152
|
+
};
|
|
153
|
+
fixedHunks.push(fixedHunk);
|
|
154
|
+
} else {
|
|
155
|
+
// Try fuzzy matching
|
|
156
|
+
const fuzzyMatch = findFuzzyMatch(originalLines, contextAndRemoved);
|
|
157
|
+
if (fuzzyMatch.found) {
|
|
158
|
+
const fixedHunk = {
|
|
159
|
+
...hunk,
|
|
160
|
+
oldStart: fuzzyMatch.position + 1,
|
|
161
|
+
newStart: fuzzyMatch.position + 1,
|
|
162
|
+
// Fix line counts based on actual changes
|
|
163
|
+
oldCount: calculateOldCount(hunk.changes),
|
|
164
|
+
newCount: calculateNewCount(hunk.changes),
|
|
165
|
+
};
|
|
166
|
+
fixedHunks.push(fixedHunk);
|
|
167
|
+
} else {
|
|
168
|
+
return {
|
|
169
|
+
success: false,
|
|
170
|
+
error: `Cannot find matching context for hunk at line ${hunk.oldStart}`,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return { success: true, hunks: fixedHunks };
|
|
177
|
+
} catch (error) {
|
|
178
|
+
return { success: false, error: `Failed to fix line numbers: ${error.message}` };
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function findBestMatch(originalLines, targetLines, startPosition) {
|
|
183
|
+
// Try exact match at expected position first
|
|
184
|
+
if (startPosition >= 0 && startPosition + targetLines.length <= originalLines.length) {
|
|
185
|
+
let matches = 0;
|
|
186
|
+
for (let i = 0; i < targetLines.length; i++) {
|
|
187
|
+
if (originalLines[startPosition + i] === targetLines[i]) {
|
|
188
|
+
matches++;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (matches === targetLines.length) {
|
|
193
|
+
return { found: true, position: startPosition };
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// Try nearby positions (within 10 lines)
|
|
198
|
+
const NEARBY_SEARCH_RANGE = 10; // Maximum number of lines to search before/after expected position
|
|
199
|
+
for (let offset = 1; offset <= NEARBY_SEARCH_RANGE; offset++) {
|
|
200
|
+
// Try before
|
|
201
|
+
const beforePos = startPosition - offset;
|
|
202
|
+
if (beforePos >= 0 && beforePos + targetLines.length <= originalLines.length) {
|
|
203
|
+
let matches = 0;
|
|
204
|
+
for (let i = 0; i < targetLines.length; i++) {
|
|
205
|
+
if (originalLines[beforePos + i] === targetLines[i]) {
|
|
206
|
+
matches++;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
if (matches === targetLines.length) {
|
|
210
|
+
return { found: true, position: beforePos };
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// Try after
|
|
215
|
+
const afterPos = startPosition + offset;
|
|
216
|
+
if (afterPos >= 0 && afterPos + targetLines.length <= originalLines.length) {
|
|
217
|
+
let matches = 0;
|
|
218
|
+
for (let i = 0; i < targetLines.length; i++) {
|
|
219
|
+
if (originalLines[afterPos + i] === targetLines[i]) {
|
|
220
|
+
matches++;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
if (matches === targetLines.length) {
|
|
224
|
+
return { found: true, position: afterPos };
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
return { found: false };
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
function findFuzzyMatch(originalLines, targetLines) {
|
|
233
|
+
// Find the best partial match
|
|
234
|
+
let bestMatch = { found: false, position: 0, score: 0 };
|
|
235
|
+
|
|
236
|
+
for (let pos = 0; pos <= originalLines.length - targetLines.length; pos++) {
|
|
237
|
+
let matches = 0;
|
|
238
|
+
for (let i = 0; i < targetLines.length; i++) {
|
|
239
|
+
if (originalLines[pos + i] === targetLines[i]) {
|
|
240
|
+
matches++;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
const score = matches / targetLines.length;
|
|
245
|
+
const FUZZY_MATCH_THRESHOLD = 0.7; // 70% similarity threshold for fuzzy matching
|
|
246
|
+
if (score > bestMatch.score && score >= FUZZY_MATCH_THRESHOLD) {
|
|
247
|
+
bestMatch = { found: true, position: pos, score };
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
return bestMatch;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
function calculateOldCount(changes) {
|
|
255
|
+
const contextCount = changes.filter((c) => c.type === "context").length;
|
|
256
|
+
const removeCount = changes.filter((c) => c.type === "remove").length;
|
|
257
|
+
return contextCount + removeCount;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
function calculateNewCount(changes) {
|
|
261
|
+
const contextCount = changes.filter((c) => c.type === "context").length;
|
|
262
|
+
const addCount = changes.filter((c) => c.type === "add").length;
|
|
263
|
+
return contextCount + addCount;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
function reconstructDiffPatch(hunks) {
|
|
267
|
+
let patchContent = "";
|
|
268
|
+
|
|
269
|
+
for (const hunk of hunks) {
|
|
270
|
+
// Add hunk header
|
|
271
|
+
const oldRange = hunk.oldCount === 1 ? hunk.oldStart : `${hunk.oldStart},${hunk.oldCount}`;
|
|
272
|
+
const newRange = hunk.newCount === 1 ? hunk.newStart : `${hunk.newStart},${hunk.newCount}`;
|
|
273
|
+
patchContent += `@@ -${oldRange} +${newRange} @@\n`;
|
|
274
|
+
|
|
275
|
+
// Add changes
|
|
276
|
+
for (const change of hunk.changes) {
|
|
277
|
+
if (change.type === "context") {
|
|
278
|
+
patchContent += ` ${change.content}\n`;
|
|
279
|
+
} else if (change.type === "remove") {
|
|
280
|
+
patchContent += `-${change.content}\n`;
|
|
281
|
+
} else if (change.type === "add") {
|
|
282
|
+
patchContent += `+${change.content}\n`;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
return patchContent;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
updateDocumentContent.inputSchema = getUpdateDocumentContentInputJsonSchema();
|
|
291
|
+
updateDocumentContent.outputSchema = getUpdateDocumentContentOutputJsonSchema();
|
|
292
|
+
|
|
293
|
+
updateDocumentContent.description = "Apply diff patch to update markdown document content";
|
package/agents/update/index.yaml
CHANGED
|
@@ -25,17 +25,11 @@ skills:
|
|
|
25
25
|
})
|
|
26
26
|
}
|
|
27
27
|
])
|
|
28
|
-
- ../utils/choose-docs.mjs
|
|
29
|
-
- ../utils/format-document-structure.mjs
|
|
30
|
-
- type: team
|
|
31
|
-
name: batchUpdateDocument
|
|
32
|
-
skills:
|
|
33
|
-
- ../update/generate-and-translate-document.yaml
|
|
34
|
-
iterate_on: selectedDocs
|
|
35
|
-
concurrency: 3
|
|
36
|
-
- url: ../utils/check-feedback-refiner.mjs
|
|
28
|
+
- url: ../utils/choose-docs.mjs
|
|
37
29
|
default_input:
|
|
38
|
-
|
|
30
|
+
requiredFeedback: false
|
|
31
|
+
- ../utils/format-document-structure.mjs
|
|
32
|
+
- ../update/check-update-is-single.mjs
|
|
39
33
|
- url: ../utils/action-success.mjs
|
|
40
34
|
default_input:
|
|
41
35
|
action: "✅ Documents updated successfully"
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
type: ai
|
|
2
|
+
name: updateDocumentDetail
|
|
3
|
+
description: Update and optimize document content based on user feedback using diff patches
|
|
4
|
+
instructions:
|
|
5
|
+
url: ../../prompts/detail/update-document.md
|
|
6
|
+
input_schema:
|
|
7
|
+
type: object
|
|
8
|
+
properties:
|
|
9
|
+
originalContent:
|
|
10
|
+
type: string
|
|
11
|
+
description: Original markdown content to be updated
|
|
12
|
+
feedback:
|
|
13
|
+
type: string
|
|
14
|
+
description: User feedback for content improvements
|
|
15
|
+
rules:
|
|
16
|
+
type: string
|
|
17
|
+
description: User configuration rules
|
|
18
|
+
locale:
|
|
19
|
+
type: string
|
|
20
|
+
description: User language, e.g. zh, en
|
|
21
|
+
datasources:
|
|
22
|
+
type: string
|
|
23
|
+
description: Context for document content
|
|
24
|
+
glossary:
|
|
25
|
+
type: string
|
|
26
|
+
description: Glossary of terms
|
|
27
|
+
userPreferences:
|
|
28
|
+
type: string
|
|
29
|
+
description: User's saved preferences for content and documentation style
|
|
30
|
+
targetAudience:
|
|
31
|
+
type: string
|
|
32
|
+
description: Target audience for the documentation
|
|
33
|
+
title:
|
|
34
|
+
type: string
|
|
35
|
+
description: Document title
|
|
36
|
+
description:
|
|
37
|
+
type: string
|
|
38
|
+
description: Document description
|
|
39
|
+
required:
|
|
40
|
+
- originalContent
|
|
41
|
+
- feedback
|
|
42
|
+
output_schema:
|
|
43
|
+
type: object
|
|
44
|
+
properties:
|
|
45
|
+
updatedContent:
|
|
46
|
+
type: string
|
|
47
|
+
description: Final updated markdown content after applying modifications
|
|
48
|
+
operationSummary:
|
|
49
|
+
type: string
|
|
50
|
+
description: Summary of the operations performed on the document content
|
|
51
|
+
skills:
|
|
52
|
+
- ./document-tools/update-document-content.mjs
|