@aigne/doc-smith 0.9.10 → 0.9.11-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 +12 -0
- package/README.md +189 -219
- package/README.zh.md +270 -0
- package/agents/bash-executor/index.mjs +347 -0
- package/agents/clear/ai/intent.md +142 -0
- package/agents/clear/choose-contents.mjs +13 -65
- package/agents/clear/clear-auth-tokens.mjs +17 -21
- package/agents/clear/clear-deployment-config.mjs +33 -24
- package/agents/clear/index.yaml +1 -9
- package/agents/content-checker/ai/intent.md +209 -0
- package/agents/content-checker/clean-invalid-docs.mjs +254 -0
- package/agents/content-checker/index.mjs +191 -0
- package/agents/content-checker/validate-content.mjs +983 -0
- package/agents/generate-images/generate-image.yaml +75 -0
- package/agents/generate-images/generate-summary.mjs +213 -0
- package/agents/generate-images/index.yaml +39 -0
- package/agents/generate-images/prepare-generation.mjs +286 -0
- package/agents/generate-images/prepare-image-generation.mjs +130 -0
- package/{prompts/detail/diagram/generate-image-system.md → agents/generate-images/prompts/system.md} +22 -56
- package/agents/generate-images/prompts/user.md +85 -0
- package/agents/generate-images/save-image-result.mjs +247 -0
- package/agents/generate-images/scan-image-slots.mjs +247 -0
- package/agents/localize/index.yaml +19 -42
- package/{prompts/translate → agents/localize/prompts}/translate-document.md +0 -139
- package/agents/localize/translate-documents/generate-summary.mjs +163 -0
- package/agents/localize/translate-documents/load-glossary.mjs +52 -0
- package/agents/localize/translate-documents/prepare-translation.mjs +249 -0
- package/agents/localize/translate-documents/save-translation.mjs +171 -0
- package/agents/localize/translate-documents/translate-document-to-language.mjs +209 -0
- package/agents/localize/translate-documents/translate-document.yaml +23 -0
- package/agents/localize/translate-documents/translate-to-languages.yaml +10 -0
- package/agents/localize/translate-images/check-image-translation.mjs +225 -0
- package/agents/localize/translate-images/detect-text/detect-and-update-shared.mjs +148 -0
- package/agents/localize/translate-images/detect-text/detect-image-text.yaml +44 -0
- package/agents/localize/translate-images/detect-text/detect-images-text.yaml +21 -0
- package/agents/localize/translate-images/detect-text/prompts/detect-image-text-system.md +43 -0
- package/agents/localize/translate-images/detect-text/prompts/detect-image-text-user.md +14 -0
- package/agents/localize/translate-images/detect-text/save-text-detection.mjs +105 -0
- package/agents/localize/translate-images/prepare-image-input.mjs +124 -0
- package/agents/localize/translate-images/save-image-translation.mjs +172 -0
- package/agents/localize/translate-images/scan-doc-images.mjs +165 -0
- package/agents/localize/translate-images/translate-doc-images.yaml +24 -0
- package/agents/localize/{translate-diagram.yaml → translate-images/translate-image.yaml} +25 -14
- package/agents/publish/ai/intent.md +182 -0
- package/agents/publish/check.mjs +107 -0
- package/agents/publish/index.yaml +9 -14
- package/agents/publish/publish-docs.mjs +81 -61
- package/agents/publish/translate-meta.mjs +79 -58
- package/agents/save-document/index.mjs +260 -0
- package/agents/structure-checker/index.mjs +307 -0
- package/agents/structure-checker/validate-structure.mjs +477 -0
- package/agents/update-image/analyze-feedback.yaml +37 -0
- package/agents/update-image/index.yaml +78 -0
- package/agents/update-image/load-existing-image.mjs +211 -0
- package/agents/update-image/prompts/analyze-feedback-system.md +43 -0
- package/agents/update-image/prompts/analyze-feedback-user.md +15 -0
- package/aigne.yaml +26 -139
- package/package.json +16 -48
- package/scripts/README.md +90 -0
- package/scripts/install.sh +86 -0
- package/scripts/uninstall.sh +52 -0
- package/skills/doc-smith/SKILL.md +285 -0
- package/skills/doc-smith/ai/intent/sources-improve.md +290 -0
- package/skills/doc-smith/references/changeset-guide.md +171 -0
- package/skills/doc-smith/references/document-content-guide.md +214 -0
- package/skills/doc-smith/references/document-structure-schema.md +138 -0
- package/skills/doc-smith/references/patch-guide.md +96 -0
- package/skills/doc-smith/references/structure-confirmation-guide.md +133 -0
- package/skills/doc-smith/references/structure-planning-guide.md +149 -0
- package/skills/doc-smith/references/update-workflow.md +108 -0
- package/skills/doc-smith/references/user-intent-guide.md +175 -0
- package/skills/doc-smith/references/workspace-initialization.md +376 -0
- package/skills/doc-smith-docs-detail/SKILL.md +356 -0
- package/skills/doc-smith-docs-detail/ai/intent.md +271 -0
- package/skills-entry/doc-smith/ai/intent.md +260 -0
- package/skills-entry/doc-smith/index.mjs +66 -0
- package/skills-entry/doc-smith/prompt.md +57 -0
- package/skills-entry/doc-smith/utils.mjs +27 -0
- package/skills-entry/doc-smith-docs-detail/batch.yaml +56 -0
- package/skills-entry/doc-smith-docs-detail/index.mjs +95 -0
- package/skills-entry/doc-smith-docs-detail/prompt.md +64 -0
- package/utils/afs-factory.mjs +183 -0
- package/utils/agent-constants.mjs +97 -0
- package/utils/{auth-utils.mjs → auth.mjs} +6 -9
- package/{agents/utils/update-branding.mjs → utils/branding.mjs} +3 -4
- package/utils/config.mjs +261 -0
- package/utils/constants.mjs +32 -0
- package/utils/deploy.mjs +3 -3
- package/utils/docs-converter.mjs +454 -0
- package/utils/docs.mjs +212 -0
- package/utils/document-paths.mjs +172 -0
- package/utils/files.mjs +74 -0
- package/utils/git.mjs +65 -0
- package/utils/{blocklet.mjs → http.mjs} +18 -0
- package/utils/image-slots.mjs +57 -0
- package/utils/image-utils.mjs +114 -0
- package/utils/project.mjs +95 -0
- package/utils/sources-path-resolver.mjs +76 -0
- package/utils/{upload-files.mjs → upload.mjs} +3 -3
- package/utils/workspace.mjs +371 -0
- package/agents/chat/chat-system.md +0 -38
- package/agents/chat/index.mjs +0 -59
- package/agents/chat/skills/generate-document.yaml +0 -15
- package/agents/chat/skills/list-documents.mjs +0 -15
- package/agents/chat/skills/update-document.yaml +0 -24
- package/agents/clear/clear-document-config.mjs +0 -36
- package/agents/clear/clear-document-structure.mjs +0 -102
- package/agents/clear/clear-generated-docs.mjs +0 -142
- package/agents/clear/clear-media-description.mjs +0 -129
- package/agents/create/aggregate-document-structure.mjs +0 -21
- package/agents/create/analyze-diagram-type-llm.yaml +0 -159
- package/agents/create/analyze-diagram-type.mjs +0 -455
- package/agents/create/check-document-structure.yaml +0 -30
- package/agents/create/check-need-generate-structure.mjs +0 -138
- package/agents/create/document-structure-tools/add-document.mjs +0 -85
- package/agents/create/document-structure-tools/delete-document.mjs +0 -116
- package/agents/create/document-structure-tools/move-document.mjs +0 -109
- package/agents/create/document-structure-tools/update-document.mjs +0 -84
- package/agents/create/generate-diagram-image.yaml +0 -91
- package/agents/create/generate-structure.yaml +0 -106
- package/agents/create/index.yaml +0 -45
- package/agents/create/refine-document-structure.yaml +0 -12
- package/agents/create/replace-d2-with-image.mjs +0 -610
- package/agents/create/update-document-structure.yaml +0 -54
- package/agents/create/user-add-document/add-documents-to-structure.mjs +0 -90
- package/agents/create/user-add-document/find-documents-to-add-links.yaml +0 -47
- package/agents/create/user-add-document/index.yaml +0 -46
- package/agents/create/user-add-document/prepare-documents-to-translate.mjs +0 -22
- package/agents/create/user-add-document/print-add-document-summary.mjs +0 -63
- package/agents/create/user-add-document/review-documents-with-new-links.mjs +0 -110
- package/agents/create/user-remove-document/find-documents-with-invalid-links.mjs +0 -78
- package/agents/create/user-remove-document/index.yaml +0 -40
- package/agents/create/user-remove-document/prepare-documents-to-translate.mjs +0 -22
- package/agents/create/user-remove-document/print-remove-document-summary.mjs +0 -53
- package/agents/create/user-remove-document/remove-documents-from-structure.mjs +0 -99
- package/agents/create/user-remove-document/review-documents-with-invalid-links.mjs +0 -115
- package/agents/create/user-review-document-structure.mjs +0 -139
- package/agents/create/utils/init-current-content.mjs +0 -34
- package/agents/create/utils/merge-document-structures.mjs +0 -36
- package/agents/evaluate/code-snippet.mjs +0 -97
- package/agents/evaluate/document-structure.yaml +0 -67
- package/agents/evaluate/document.yaml +0 -82
- package/agents/evaluate/generate-report.mjs +0 -85
- package/agents/evaluate/index.yaml +0 -46
- package/agents/history/index.yaml +0 -6
- package/agents/history/view.mjs +0 -78
- package/agents/init/check.mjs +0 -16
- package/agents/init/index.mjs +0 -643
- package/agents/init/validate.mjs +0 -16
- package/agents/localize/choose-language.mjs +0 -107
- package/agents/localize/record-translation-history.mjs +0 -23
- package/agents/localize/save-doc-translation-or-skip.mjs +0 -18
- package/agents/localize/set-review-content.mjs +0 -58
- package/agents/localize/translate-document-wrapper.mjs +0 -34
- package/agents/localize/translate-document.yaml +0 -24
- package/agents/localize/translate-multilingual.yaml +0 -57
- package/agents/localize/translate-or-skip-diagram.mjs +0 -52
- package/agents/media/batch-generate-media-description.yaml +0 -46
- package/agents/media/generate-media-description.yaml +0 -50
- package/agents/media/load-media-description.mjs +0 -454
- package/agents/prefs/index.mjs +0 -203
- package/agents/schema/document-structure-item.yaml +0 -26
- package/agents/schema/document-structure-refine-item.yaml +0 -23
- package/agents/schema/document-structure.yaml +0 -29
- package/agents/update/batch-generate-document.yaml +0 -27
- package/agents/update/batch-update-document.yaml +0 -7
- package/agents/update/check-diagram-flag.mjs +0 -116
- package/agents/update/check-document.mjs +0 -162
- package/agents/update/check-generate-diagram.mjs +0 -106
- package/agents/update/check-update-is-single.mjs +0 -53
- package/agents/update/document-tools/update-document-content.mjs +0 -303
- package/agents/update/generate-diagram.yaml +0 -80
- package/agents/update/generate-document.yaml +0 -70
- package/agents/update/handle-document-update.yaml +0 -103
- package/agents/update/index.yaml +0 -69
- package/agents/update/pre-check-generate-diagram.yaml +0 -44
- package/agents/update/save-and-translate-document.mjs +0 -80
- package/agents/update/update-document-detail.yaml +0 -71
- package/agents/update/update-single/update-single-document-detail.mjs +0 -322
- package/agents/update/update-single-document.yaml +0 -7
- package/agents/update/user-review-document.mjs +0 -272
- package/agents/utils/action-success.mjs +0 -16
- package/agents/utils/analyze-document-feedback-intent.yaml +0 -32
- package/agents/utils/analyze-feedback-intent.mjs +0 -253
- package/agents/utils/analyze-structure-feedback-intent.yaml +0 -29
- package/agents/utils/check-detail-result.mjs +0 -51
- package/agents/utils/check-feedback-refiner.mjs +0 -81
- package/agents/utils/choose-docs.mjs +0 -251
- package/agents/utils/document-icon-generate.yaml +0 -52
- package/agents/utils/document-title-streamline.yaml +0 -48
- package/agents/utils/ensure-document-icons.mjs +0 -129
- package/agents/utils/exit.mjs +0 -6
- package/agents/utils/feedback-refiner.yaml +0 -50
- package/agents/utils/find-item-by-path.mjs +0 -114
- package/agents/utils/find-user-preferences-by-path.mjs +0 -37
- package/agents/utils/format-document-structure.mjs +0 -35
- package/agents/utils/generate-document-or-skip.mjs +0 -41
- package/agents/utils/handle-diagram-operations.mjs +0 -263
- package/agents/utils/load-all-document-content.mjs +0 -30
- package/agents/utils/load-document-all-content.mjs +0 -96
- package/agents/utils/load-sources.mjs +0 -405
- package/agents/utils/map-reasoning-effort-level.mjs +0 -15
- package/agents/utils/post-generate.mjs +0 -133
- package/agents/utils/read-current-document-content.mjs +0 -46
- package/agents/utils/save-doc-translation.mjs +0 -30
- package/agents/utils/save-doc.mjs +0 -54
- package/agents/utils/save-output.mjs +0 -26
- package/agents/utils/save-sidebar.mjs +0 -38
- package/agents/utils/skip-if-content-exists.mjs +0 -27
- package/agents/utils/streamline-document-titles-if-needed.mjs +0 -88
- package/agents/utils/transform-detail-data-sources.mjs +0 -45
- package/assets/report-template/report.html +0 -198
- package/docs-mcp/analyze-content-relevance.yaml +0 -50
- package/docs-mcp/analyze-docs-relevance.yaml +0 -59
- package/docs-mcp/docs-search.yaml +0 -42
- package/docs-mcp/get-docs-detail.mjs +0 -41
- package/docs-mcp/get-docs-structure.mjs +0 -16
- package/docs-mcp/read-doc-content.mjs +0 -119
- package/prompts/common/document/content-rules-core.md +0 -20
- package/prompts/common/document/markdown-syntax-rules.md +0 -65
- package/prompts/common/document/media-file-list-usage-rules.md +0 -18
- package/prompts/common/document/openapi-usage-rules.md +0 -189
- package/prompts/common/document/role-and-personality.md +0 -16
- package/prompts/common/document/user-preferences.md +0 -9
- package/prompts/common/document-structure/conflict-resolution-guidance.md +0 -16
- package/prompts/common/document-structure/document-icon-generate.md +0 -116
- package/prompts/common/document-structure/document-structure-rules.md +0 -43
- package/prompts/common/document-structure/document-title-streamline.md +0 -86
- package/prompts/common/document-structure/glossary.md +0 -7
- package/prompts/common/document-structure/intj-traits.md +0 -5
- package/prompts/common/document-structure/openapi-usage-rules.md +0 -28
- package/prompts/common/document-structure/output-constraints.md +0 -18
- package/prompts/common/document-structure/user-locale-rules.md +0 -10
- package/prompts/common/document-structure/user-preferences.md +0 -9
- package/prompts/detail/custom/admonition-usage-rules.md +0 -94
- package/prompts/detail/custom/code-block-usage-rules.md +0 -163
- package/prompts/detail/custom/custom-components/x-card-usage-rules.md +0 -63
- package/prompts/detail/custom/custom-components/x-cards-usage-rules.md +0 -83
- package/prompts/detail/custom/custom-components/x-field-desc-usage-rules.md +0 -120
- package/prompts/detail/custom/custom-components/x-field-group-usage-rules.md +0 -80
- package/prompts/detail/custom/custom-components/x-field-usage-rules.md +0 -189
- package/prompts/detail/custom/custom-components-usage-rules.md +0 -18
- package/prompts/detail/diagram/generate-image-user.md +0 -81
- package/prompts/detail/diagram/guide.md +0 -29
- package/prompts/detail/diagram/official-examples.md +0 -712
- package/prompts/detail/diagram/pre-check.md +0 -23
- package/prompts/detail/diagram/role-and-personality.md +0 -2
- package/prompts/detail/diagram/rules.md +0 -46
- package/prompts/detail/diagram/system-prompt.md +0 -1139
- package/prompts/detail/diagram/user-prompt.md +0 -43
- package/prompts/detail/generate/detail-example.md +0 -457
- package/prompts/detail/generate/document-rules.md +0 -45
- package/prompts/detail/generate/system-prompt.md +0 -61
- package/prompts/detail/generate/user-prompt.md +0 -99
- package/prompts/detail/jsx/rules.md +0 -6
- package/prompts/detail/update/system-prompt.md +0 -121
- package/prompts/detail/update/user-prompt.md +0 -41
- package/prompts/evaluate/document-structure.md +0 -93
- package/prompts/evaluate/document.md +0 -149
- package/prompts/media/media-description/system-prompt.md +0 -43
- package/prompts/media/media-description/user-prompt.md +0 -17
- package/prompts/structure/check-document-structure.md +0 -93
- package/prompts/structure/document-rules.md +0 -21
- package/prompts/structure/find-documents-to-add-links.md +0 -52
- package/prompts/structure/generate/system-prompt.md +0 -13
- package/prompts/structure/generate/user-prompt.md +0 -137
- package/prompts/structure/review/structure-review-system.md +0 -81
- package/prompts/structure/structure-example.md +0 -89
- package/prompts/structure/structure-getting-started.md +0 -10
- package/prompts/structure/update/system-prompt.md +0 -93
- package/prompts/structure/update/user-prompt.md +0 -43
- package/prompts/translate/admonition.md +0 -20
- package/prompts/translate/code-block.md +0 -33
- package/prompts/utils/analyze-document-feedback-intent.md +0 -54
- package/prompts/utils/analyze-structure-feedback-intent.md +0 -43
- package/prompts/utils/feedback-refiner.md +0 -105
- package/types/document-schema.mjs +0 -55
- package/types/document-structure-schema.mjs +0 -261
- package/utils/check-document-has-diagram.mjs +0 -95
- package/utils/conflict-detector.mjs +0 -149
- package/utils/constants/index.mjs +0 -620
- package/utils/constants/linter.mjs +0 -102
- package/utils/d2-utils.mjs +0 -205
- package/utils/debug.mjs +0 -3
- package/utils/delete-diagram-images.mjs +0 -99
- package/utils/diagram-version-utils.mjs +0 -14
- package/utils/docs-finder-utils.mjs +0 -548
- package/utils/evaluate/report-utils.mjs +0 -132
- package/utils/extract-api.mjs +0 -32
- package/utils/file-utils.mjs +0 -960
- package/utils/history-utils.mjs +0 -203
- package/utils/icon-map.mjs +0 -26
- package/utils/image-compress.mjs +0 -154
- package/utils/kroki-utils.mjs +0 -173
- package/utils/linter/index.mjs +0 -50
- package/utils/load-config.mjs +0 -78
- package/utils/markdown/index.mjs +0 -26
- package/utils/markdown-checker.mjs +0 -694
- package/utils/mermaid-validator.mjs +0 -140
- package/utils/mermaid-worker-pool.mjs +0 -250
- package/utils/mermaid-worker.mjs +0 -233
- package/utils/openapi/index.mjs +0 -28
- package/utils/preferences-utils.mjs +0 -175
- package/utils/request.mjs +0 -10
- package/utils/sync-diagram-to-translations.mjs +0 -272
- package/utils/translate-diagram-images.mjs +0 -807
- package/utils/utils.mjs +0 -1354
- /package/{prompts/translate → agents/localize/prompts}/glossary.md +0 -0
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getAddDocumentInputJsonSchema,
|
|
3
|
-
getAddDocumentOutputJsonSchema,
|
|
4
|
-
validateAddDocumentInput,
|
|
5
|
-
} from "../../../types/document-structure-schema.mjs";
|
|
6
|
-
import streamlineDocumentTitlesIfNeeded from "../../utils/streamline-document-titles-if-needed.mjs";
|
|
7
|
-
|
|
8
|
-
export default async function addDocument(input, options) {
|
|
9
|
-
// Validate input using Zod schema
|
|
10
|
-
const validation = validateAddDocumentInput(input);
|
|
11
|
-
if (!validation.success) {
|
|
12
|
-
const errorMessage = `Cannot add document: ${validation.error}`;
|
|
13
|
-
console.log(`⚠️ ${errorMessage}`);
|
|
14
|
-
return {
|
|
15
|
-
documentStructure: input.documentStructure,
|
|
16
|
-
error: { message: errorMessage },
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const { title, description, path, parentId, sourceIds } = validation.data;
|
|
21
|
-
let documentStructure = options?.context?.userContext?.currentStructure;
|
|
22
|
-
|
|
23
|
-
if (!documentStructure) {
|
|
24
|
-
documentStructure = input.documentStructure;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// Validate parent exists if parentId is provided
|
|
28
|
-
if (parentId && parentId !== "null") {
|
|
29
|
-
const parentExists = documentStructure.some((item) => item.path === parentId);
|
|
30
|
-
if (!parentExists) {
|
|
31
|
-
const errorMessage = `Cannot add document: Parent document '${parentId}' not found.`;
|
|
32
|
-
console.log(`⚠️ ${errorMessage}`);
|
|
33
|
-
return {
|
|
34
|
-
documentStructure,
|
|
35
|
-
error: { message: errorMessage },
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Check if document with same path already exists
|
|
41
|
-
const existingDocument = documentStructure.find((item) => item.path === path);
|
|
42
|
-
if (existingDocument) {
|
|
43
|
-
const errorMessage = `Cannot add document: A document with path '${path}' already exists. Choose a different path.`;
|
|
44
|
-
console.log(`⚠️ ${errorMessage}`);
|
|
45
|
-
return {
|
|
46
|
-
documentStructure,
|
|
47
|
-
error: { message: errorMessage },
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// Create new document object
|
|
52
|
-
const newDocument = {
|
|
53
|
-
title,
|
|
54
|
-
description,
|
|
55
|
-
path,
|
|
56
|
-
parentId: parentId || null,
|
|
57
|
-
sourceIds: [...sourceIds], // Create a copy of the array
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
// Streamline document titles if needed (will streamline the new document if title > 18 characters)
|
|
61
|
-
await streamlineDocumentTitlesIfNeeded({ documentStructure: [newDocument] }, options);
|
|
62
|
-
|
|
63
|
-
// Add the document to the structure
|
|
64
|
-
const updatedStructure = [...documentStructure, newDocument];
|
|
65
|
-
|
|
66
|
-
const successMessage = `addDocument executed successfully.
|
|
67
|
-
Successfully added document '${title}' with path '${path}'.
|
|
68
|
-
Check if the latest version of documentStructure meets user feedback, if so, just return 'success'.`;
|
|
69
|
-
|
|
70
|
-
// update shared document structure
|
|
71
|
-
if (options?.context?.userContext) {
|
|
72
|
-
options.context.userContext.currentStructure = updatedStructure;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return {
|
|
76
|
-
documentStructure: updatedStructure,
|
|
77
|
-
message: successMessage,
|
|
78
|
-
addedDocument: newDocument,
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
addDocument.taskTitle = "Add document";
|
|
83
|
-
addDocument.description = "Add a document to the documentation structure";
|
|
84
|
-
addDocument.inputSchema = getAddDocumentInputJsonSchema();
|
|
85
|
-
addDocument.outputSchema = getAddDocumentOutputJsonSchema();
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getDeleteDocumentInputJsonSchema,
|
|
3
|
-
getDeleteDocumentOutputJsonSchema,
|
|
4
|
-
validateDeleteDocumentInput,
|
|
5
|
-
} from "../../../types/document-structure-schema.mjs";
|
|
6
|
-
import { userContextAt } from "../../../utils/utils.mjs";
|
|
7
|
-
|
|
8
|
-
export default async function deleteDocument(input, options) {
|
|
9
|
-
// Validate input using Zod schema
|
|
10
|
-
const validation = validateDeleteDocumentInput(input);
|
|
11
|
-
if (!validation.success) {
|
|
12
|
-
const errorMessage = `Cannot delete document: ${validation.error}`;
|
|
13
|
-
console.log(`⚠️ ${errorMessage}`);
|
|
14
|
-
return {
|
|
15
|
-
documentStructure: input.documentStructure,
|
|
16
|
-
error: { message: errorMessage },
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const { path, recursive = false } = validation.data;
|
|
21
|
-
let documentStructure = options?.context?.userContext?.currentStructure;
|
|
22
|
-
|
|
23
|
-
if (!documentStructure) {
|
|
24
|
-
documentStructure = input.documentStructure;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const deletedPathsContext = userContextAt(options, "deletedPaths");
|
|
28
|
-
const deletedPaths = deletedPathsContext.get() || [];
|
|
29
|
-
|
|
30
|
-
// Check if path has already been deleted
|
|
31
|
-
if (recursive) {
|
|
32
|
-
if (deletedPaths.includes(path)) {
|
|
33
|
-
const message = `Skipping duplicate deletion. Document '${path}' has already been deleted.`;
|
|
34
|
-
return {
|
|
35
|
-
documentStructure,
|
|
36
|
-
message,
|
|
37
|
-
deletedDocuments: [],
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// Find the document to delete
|
|
43
|
-
const documentIndex = documentStructure.findIndex((item) => item.path === path);
|
|
44
|
-
if (documentIndex === -1) {
|
|
45
|
-
const errorMessage = `Cannot delete document: Document '${path}' does not exist. Please choose an existing document to delete.`;
|
|
46
|
-
console.log(`⚠️ ${errorMessage}`);
|
|
47
|
-
return {
|
|
48
|
-
documentStructure,
|
|
49
|
-
error: { message: errorMessage },
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const documentToDelete = documentStructure[documentIndex];
|
|
54
|
-
|
|
55
|
-
// Find all child documents (direct and indirect)
|
|
56
|
-
const findAllChildren = (parentPath, structure) => {
|
|
57
|
-
const children = structure.filter((item) => item.parentId === parentPath);
|
|
58
|
-
const allChildren = [...children];
|
|
59
|
-
for (const child of children) {
|
|
60
|
-
allChildren.push(...findAllChildren(child.path, structure));
|
|
61
|
-
}
|
|
62
|
-
return allChildren;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const childDocuments = findAllChildren(path, documentStructure);
|
|
66
|
-
|
|
67
|
-
// If recursive is false and there are child documents, return error
|
|
68
|
-
if (!recursive && childDocuments.length > 0) {
|
|
69
|
-
const errorMessage = `Cannot delete document: Document '${path}' has ${
|
|
70
|
-
childDocuments.length
|
|
71
|
-
} child document(s): ${childDocuments
|
|
72
|
-
.map((p) => p.path)
|
|
73
|
-
.join(
|
|
74
|
-
", ",
|
|
75
|
-
)}. Please first move or delete these child documents, or set recursive=true to delete them all.`;
|
|
76
|
-
console.log(`⚠️ ${errorMessage}`);
|
|
77
|
-
return {
|
|
78
|
-
documentStructure,
|
|
79
|
-
error: { message: errorMessage },
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// Collect all documents to delete (children first, then parent)
|
|
84
|
-
const documentsToDelete = recursive ? [...childDocuments, documentToDelete] : [documentToDelete];
|
|
85
|
-
const pathsToDelete = new Set(documentsToDelete.map((doc) => doc.path));
|
|
86
|
-
const deletedCount = pathsToDelete.size - 1;
|
|
87
|
-
|
|
88
|
-
// Remove all documents from the structure
|
|
89
|
-
const updatedStructure = documentStructure.filter((item) => !pathsToDelete.has(item.path));
|
|
90
|
-
|
|
91
|
-
// Add paths to deleted paths
|
|
92
|
-
if (recursive) {
|
|
93
|
-
deletedPathsContext.set(deletedPaths.concat(Array.from(pathsToDelete)));
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// Build success message
|
|
97
|
-
const successMessage = `deleteDocument executed successfully.
|
|
98
|
-
Successfully deleted document '${documentToDelete.title}' with path '${path}'${recursive && deletedCount > 0 ? ` along with ${deletedCount} child document(s)` : ""}.
|
|
99
|
-
Check if the latest version of documentStructure meets user feedback, if so, just return 'success'.`;
|
|
100
|
-
|
|
101
|
-
// update shared document structure
|
|
102
|
-
if (options?.context?.userContext) {
|
|
103
|
-
options.context.userContext.currentStructure = updatedStructure;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
return {
|
|
107
|
-
documentStructure: updatedStructure,
|
|
108
|
-
message: successMessage,
|
|
109
|
-
deletedDocuments: documentsToDelete,
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
deleteDocument.taskTitle = "Delete document";
|
|
114
|
-
deleteDocument.description = "Remove a document from the documentation structure";
|
|
115
|
-
deleteDocument.inputSchema = getDeleteDocumentInputJsonSchema();
|
|
116
|
-
deleteDocument.outputSchema = getDeleteDocumentOutputJsonSchema();
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getMoveDocumentInputJsonSchema,
|
|
3
|
-
getMoveDocumentOutputJsonSchema,
|
|
4
|
-
validateMoveDocumentInput,
|
|
5
|
-
} from "../../../types/document-structure-schema.mjs";
|
|
6
|
-
|
|
7
|
-
export default async function moveDocument(input, options) {
|
|
8
|
-
// Validate input using Zod schema
|
|
9
|
-
const validation = validateMoveDocumentInput(input);
|
|
10
|
-
if (!validation.success) {
|
|
11
|
-
const errorMessage = `Cannot move document: ${validation.error}`;
|
|
12
|
-
console.log(`⚠️ ${errorMessage}`);
|
|
13
|
-
return {
|
|
14
|
-
documentStructure: input.documentStructure,
|
|
15
|
-
error: { message: errorMessage },
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const { path, newParentId } = validation.data;
|
|
20
|
-
let documentStructure = options?.context?.userContext?.currentStructure;
|
|
21
|
-
|
|
22
|
-
if (!documentStructure) {
|
|
23
|
-
documentStructure = input.documentStructure;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// Find the document to move
|
|
27
|
-
const documentIndex = documentStructure.findIndex((item) => item.path === path);
|
|
28
|
-
if (documentIndex === -1) {
|
|
29
|
-
const errorMessage = `Cannot move document: Document '${path}' does not exist. Please select an existing document to move.`;
|
|
30
|
-
console.log(`⚠️ ${errorMessage}`);
|
|
31
|
-
return {
|
|
32
|
-
documentStructure,
|
|
33
|
-
error: { message: errorMessage },
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const documentToMove = documentStructure[documentIndex];
|
|
38
|
-
|
|
39
|
-
// Validate new parent exists if newParentId is provided
|
|
40
|
-
if (
|
|
41
|
-
newParentId !== null &&
|
|
42
|
-
newParentId !== undefined &&
|
|
43
|
-
newParentId !== "null" &&
|
|
44
|
-
newParentId !== ""
|
|
45
|
-
) {
|
|
46
|
-
const newParentExists = documentStructure.some((item) => item.path === newParentId);
|
|
47
|
-
if (!newParentExists) {
|
|
48
|
-
const errorMessage = `Cannot move document: Target parent document '${newParentId}' does not exist. Please select an existing parent document.`;
|
|
49
|
-
console.log(`⚠️ ${errorMessage}`);
|
|
50
|
-
return {
|
|
51
|
-
documentStructure,
|
|
52
|
-
error: { message: errorMessage },
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// Check for circular dependency: the new parent cannot be a descendant of the document being moved
|
|
57
|
-
const isDescendant = (parentPath, childPath) => {
|
|
58
|
-
const children = documentStructure.filter((item) => item.parentId === parentPath);
|
|
59
|
-
for (const child of children) {
|
|
60
|
-
if (child.path === childPath || isDescendant(child.path, childPath)) {
|
|
61
|
-
return true;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
return false;
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
if (isDescendant(path, newParentId)) {
|
|
68
|
-
const errorMessage = `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.`;
|
|
69
|
-
console.log(`⚠️ ${errorMessage}`);
|
|
70
|
-
return {
|
|
71
|
-
documentStructure,
|
|
72
|
-
error: { message: errorMessage },
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// Create updated document object with new parent
|
|
78
|
-
const updatedDocument = {
|
|
79
|
-
...documentToMove,
|
|
80
|
-
parentId: newParentId || null,
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
// Update the document's position in the structure
|
|
84
|
-
const updatedStructure = [...documentStructure];
|
|
85
|
-
updatedStructure[documentIndex] = updatedDocument;
|
|
86
|
-
|
|
87
|
-
const newParentText = newParentId ? `'${newParentId}'` : "root level";
|
|
88
|
-
const successMessage = `moveDocument executed successfully.
|
|
89
|
-
Successfully moved document '${documentToMove.title}' to ${newParentText}.
|
|
90
|
-
Check if the latest version of documentStructure meets user feedback, if so, just return 'success'.`;
|
|
91
|
-
|
|
92
|
-
// update shared document structure
|
|
93
|
-
if (options?.context?.userContext) {
|
|
94
|
-
options.context.userContext.currentStructure = updatedStructure;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
return {
|
|
98
|
-
documentStructure: updatedStructure,
|
|
99
|
-
message: successMessage,
|
|
100
|
-
originalDocument: documentToMove,
|
|
101
|
-
updatedDocument: updatedDocument,
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
moveDocument.taskTitle = "Move document";
|
|
106
|
-
moveDocument.description =
|
|
107
|
-
"Relocate a document to a different parent in the documentation structure";
|
|
108
|
-
moveDocument.inputSchema = getMoveDocumentInputJsonSchema();
|
|
109
|
-
moveDocument.outputSchema = getMoveDocumentOutputJsonSchema();
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getUpdateDocumentInputJsonSchema,
|
|
3
|
-
getUpdateDocumentOutputJsonSchema,
|
|
4
|
-
validateUpdateDocumentInput,
|
|
5
|
-
} from "../../../types/document-structure-schema.mjs";
|
|
6
|
-
import streamlineDocumentTitlesIfNeeded from "../../utils/streamline-document-titles-if-needed.mjs";
|
|
7
|
-
|
|
8
|
-
export default async function updateDocument(input, options) {
|
|
9
|
-
// Validate input using Zod schema
|
|
10
|
-
const validation = validateUpdateDocumentInput(input);
|
|
11
|
-
if (!validation.success) {
|
|
12
|
-
const errorMessage = `Cannot update document: ${validation.error}`;
|
|
13
|
-
console.log(`⚠️ ${errorMessage}`);
|
|
14
|
-
return {
|
|
15
|
-
documentStructure: input.documentStructure,
|
|
16
|
-
error: { message: errorMessage },
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const { path, title, description, sourceIds } = validation.data;
|
|
21
|
-
let documentStructure = options?.context?.userContext?.currentStructure;
|
|
22
|
-
|
|
23
|
-
if (!documentStructure) {
|
|
24
|
-
documentStructure = input.documentStructure;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// Find the document to update
|
|
28
|
-
const documentIndex = documentStructure.findIndex((item) => item.path === path);
|
|
29
|
-
if (documentIndex === -1) {
|
|
30
|
-
const errorMessage = `Cannot update document: Document '${path}' does not exist. Choose an existing document to update.`;
|
|
31
|
-
console.log(`⚠️ ${errorMessage}`);
|
|
32
|
-
return {
|
|
33
|
-
documentStructure,
|
|
34
|
-
error: { message: errorMessage },
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const originalDocument = documentStructure[documentIndex];
|
|
39
|
-
|
|
40
|
-
// Create updated document object
|
|
41
|
-
const updatedDocument = {
|
|
42
|
-
...originalDocument,
|
|
43
|
-
...(title !== undefined && { title }),
|
|
44
|
-
...(description !== undefined && { description }),
|
|
45
|
-
...(sourceIds !== undefined && { sourceIds: [...sourceIds] }), // Create a copy of the array
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
if (!options.context.userContext.streamlinedDocumentTitles) {
|
|
49
|
-
// Streamline document titles if needed (will streamline the updated document if title > 18 characters)
|
|
50
|
-
await streamlineDocumentTitlesIfNeeded({ documentStructure: [updatedDocument] }, options);
|
|
51
|
-
options.context.userContext.streamlinedDocumentTitles = true;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// Update the document in the structure
|
|
55
|
-
const updatedStructure = [...documentStructure];
|
|
56
|
-
updatedStructure[documentIndex] = updatedDocument;
|
|
57
|
-
|
|
58
|
-
const updates = [];
|
|
59
|
-
if (title !== undefined) updates.push(`title to '${title}'`);
|
|
60
|
-
if (description !== undefined) updates.push("description");
|
|
61
|
-
if (sourceIds !== undefined) updates.push("sourceIds");
|
|
62
|
-
const updatesText = updates.length > 0 ? updates.join(", ") : "properties";
|
|
63
|
-
|
|
64
|
-
const successMessage = `updateDocument executed successfully.
|
|
65
|
-
Successfully updated ${updatesText} for document '${path}'.
|
|
66
|
-
Check if the latest version of documentStructure meets user feedback, if so, just return 'success'.`;
|
|
67
|
-
|
|
68
|
-
// update shared document structure
|
|
69
|
-
if (options?.context?.userContext) {
|
|
70
|
-
options.context.userContext.currentStructure = updatedStructure;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return {
|
|
74
|
-
documentStructure: updatedStructure,
|
|
75
|
-
message: successMessage,
|
|
76
|
-
originalDocument: originalDocument,
|
|
77
|
-
updatedDocument: updatedDocument,
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
updateDocument.taskTitle = "Update document";
|
|
82
|
-
updateDocument.description = "Modify properties of a document in the documentation structure";
|
|
83
|
-
updateDocument.inputSchema = getUpdateDocumentInputJsonSchema();
|
|
84
|
-
updateDocument.outputSchema = getUpdateDocumentOutputJsonSchema();
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
type: image
|
|
2
|
-
name: generateDiagramImage
|
|
3
|
-
image_model:
|
|
4
|
-
model: google/gemini-3-pro-image-preview
|
|
5
|
-
# The cues that come with thought patterns are actually not obvious
|
|
6
|
-
# thinkingConfig:
|
|
7
|
-
# includeThoughts: true
|
|
8
|
-
# responseModalities:
|
|
9
|
-
# - 'TEXT'
|
|
10
|
-
# - 'IMAGE'
|
|
11
|
-
imageConfig:
|
|
12
|
-
imageSize:
|
|
13
|
-
$get: size
|
|
14
|
-
aspectRatio:
|
|
15
|
-
$get: ratio
|
|
16
|
-
|
|
17
|
-
instructions:
|
|
18
|
-
- role: system
|
|
19
|
-
url: ../../prompts/detail/diagram/generate-image-system.md
|
|
20
|
-
- role: user
|
|
21
|
-
url: ../../prompts/detail/diagram/generate-image-user.md
|
|
22
|
-
|
|
23
|
-
# Support image-to-image generation by passing existing image via input_file_key
|
|
24
|
-
# If existingImage is provided (array of mediaFile objects), it will be passed to the model
|
|
25
|
-
input_file_key: existingImage
|
|
26
|
-
|
|
27
|
-
input_schema:
|
|
28
|
-
type: object
|
|
29
|
-
properties:
|
|
30
|
-
documentContent:
|
|
31
|
-
type: string
|
|
32
|
-
description: The full original document content
|
|
33
|
-
documentSummary:
|
|
34
|
-
type: string
|
|
35
|
-
description: A comprehensive summary of the document content for diagram generation (preferred over documentContent if available)
|
|
36
|
-
diagramType:
|
|
37
|
-
type: string
|
|
38
|
-
description: The type of diagram to generate (architecture, flowchart, guide, intro, sequence, network)
|
|
39
|
-
diagramStyle:
|
|
40
|
-
type: string
|
|
41
|
-
description: The visual style for the diagram (modern, standard, hand-drawn, anthropomorphic, flat, minimalist, 3d)
|
|
42
|
-
locale:
|
|
43
|
-
type: string
|
|
44
|
-
description: Language for diagram labels
|
|
45
|
-
default: en
|
|
46
|
-
size:
|
|
47
|
-
type: string
|
|
48
|
-
description: Size of the generated image (e.g., "1K", "2K")
|
|
49
|
-
default: "1K"
|
|
50
|
-
ratio:
|
|
51
|
-
type: string
|
|
52
|
-
description: Aspect ratio of the generated image (must match content flow direction)
|
|
53
|
-
enum: ["1:1", "5:4", "4:3", "3:2", "16:9", "21:9"]
|
|
54
|
-
aspectRatio:
|
|
55
|
-
type: string
|
|
56
|
-
description: Aspect ratio of the generated image (alias for ratio, used in prompt templates)
|
|
57
|
-
enum: ["1:1", "5:4", "4:3", "3:2", "16:9", "21:9"]
|
|
58
|
-
existingImage:
|
|
59
|
-
type: array
|
|
60
|
-
nullable: true
|
|
61
|
-
description: Array of mediaFile objects for existing diagram image (for image-to-image generation). If provided, the model will use this as reference and update based on document content and feedback.
|
|
62
|
-
items:
|
|
63
|
-
type: object
|
|
64
|
-
properties:
|
|
65
|
-
type:
|
|
66
|
-
type: string
|
|
67
|
-
description: File type, should be "local"
|
|
68
|
-
path:
|
|
69
|
-
type: string
|
|
70
|
-
description: Absolute path to the image file
|
|
71
|
-
filename:
|
|
72
|
-
type: string
|
|
73
|
-
description: Image filename
|
|
74
|
-
mimeType:
|
|
75
|
-
type: string
|
|
76
|
-
description: MIME type of the image (e.g., "image/png", "image/jpeg")
|
|
77
|
-
useImageToImage:
|
|
78
|
-
type: boolean
|
|
79
|
-
description: Whether to use image-to-image generation mode. If true and existingImage is provided, the model will update the existing image based on document content and feedback.
|
|
80
|
-
default: false
|
|
81
|
-
feedback:
|
|
82
|
-
type: string
|
|
83
|
-
description: User feedback for diagram updates. Used in image-to-image mode to guide modifications.
|
|
84
|
-
default: ""
|
|
85
|
-
required:
|
|
86
|
-
- documentContent
|
|
87
|
-
- diagramType
|
|
88
|
-
- diagramStyle
|
|
89
|
-
- ratio
|
|
90
|
-
include_input_in_output: true
|
|
91
|
-
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
type: team
|
|
2
|
-
name: generateStructure
|
|
3
|
-
description: Generate the structure and organization of your documentation
|
|
4
|
-
skills:
|
|
5
|
-
- type: team
|
|
6
|
-
name: generateStructureWorker
|
|
7
|
-
iterate_on: dataSources
|
|
8
|
-
skills:
|
|
9
|
-
- type: ai
|
|
10
|
-
instructions:
|
|
11
|
-
- role: system
|
|
12
|
-
url: ../../prompts/structure/generate/system-prompt.md
|
|
13
|
-
- role: user
|
|
14
|
-
url: ../../prompts/structure/generate/user-prompt.md
|
|
15
|
-
task_render_mode: collapse
|
|
16
|
-
task_title: Generate the structure of the documentation
|
|
17
|
-
tool_calls_concurrency: 5
|
|
18
|
-
input_schema:
|
|
19
|
-
type: object
|
|
20
|
-
properties:
|
|
21
|
-
rules:
|
|
22
|
-
type: string
|
|
23
|
-
description: Your specific requirements for documentation structure
|
|
24
|
-
locale:
|
|
25
|
-
type: string
|
|
26
|
-
description: Primary language for documentation (e.g., zh, en, ja)
|
|
27
|
-
dataSourceChunk:
|
|
28
|
-
type: string
|
|
29
|
-
description: Project content and context to help generate documentation structure
|
|
30
|
-
targetAudience:
|
|
31
|
-
type: string
|
|
32
|
-
description: Target audience for the documentation
|
|
33
|
-
nodeName:
|
|
34
|
-
type: string
|
|
35
|
-
description: Specific section or page name to focus on
|
|
36
|
-
glossary:
|
|
37
|
-
type: string
|
|
38
|
-
description: Glossary for consistent terminology
|
|
39
|
-
feedback:
|
|
40
|
-
type: string
|
|
41
|
-
description: Tell us how to improve the documentation structure
|
|
42
|
-
userPreferences:
|
|
43
|
-
type: string
|
|
44
|
-
description: Your saved preferences for structure and documentation style
|
|
45
|
-
docsType:
|
|
46
|
-
type: string
|
|
47
|
-
description: "Documentation type (options: general, getting-started, reference, faq)"
|
|
48
|
-
default: general
|
|
49
|
-
required:
|
|
50
|
-
- rules
|
|
51
|
-
- dataSourceChunk
|
|
52
|
-
output_schema:
|
|
53
|
-
type: object
|
|
54
|
-
properties:
|
|
55
|
-
projectName:
|
|
56
|
-
type: string
|
|
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
|
-
projectDesc:
|
|
59
|
-
type: string
|
|
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
|
-
structures:
|
|
62
|
-
type: array
|
|
63
|
-
description: List of document structure items to add or update
|
|
64
|
-
items: ../schema/document-structure-item.yaml
|
|
65
|
-
|
|
66
|
-
- ./utils/merge-document-structures.mjs
|
|
67
|
-
|
|
68
|
-
- ./aggregate-document-structure.mjs
|
|
69
|
-
|
|
70
|
-
- type: ai
|
|
71
|
-
name: refineStructure
|
|
72
|
-
instructions:
|
|
73
|
-
- role: system
|
|
74
|
-
url: ../../prompts/structure/review/structure-review-system.md
|
|
75
|
-
output_schema:
|
|
76
|
-
type: object
|
|
77
|
-
properties:
|
|
78
|
-
structures:
|
|
79
|
-
type: array
|
|
80
|
-
description: Document structure items that need to be updated or changed
|
|
81
|
-
items: ../schema/document-structure-refine-item.yaml
|
|
82
|
-
required:
|
|
83
|
-
- structures
|
|
84
|
-
|
|
85
|
-
- type: function
|
|
86
|
-
name: finalizeDocumentStructure
|
|
87
|
-
process: |
|
|
88
|
-
return {
|
|
89
|
-
projectName: input.projectName,
|
|
90
|
-
projectDesc: input.projectDesc,
|
|
91
|
-
documentStructure: input.structures.map(refinedItem => {
|
|
92
|
-
// Find original item to get sourceIds and other fields
|
|
93
|
-
const originalItem = input.documentStructure.find(orig => orig.id === refinedItem.id)
|
|
94
|
-
|
|
95
|
-
const newItem = {
|
|
96
|
-
title: refinedItem.title,
|
|
97
|
-
description: refinedItem.description,
|
|
98
|
-
path: refinedItem.path,
|
|
99
|
-
parentId: refinedItem.parentPath || null, // Convert parentPath to parentId
|
|
100
|
-
sourceIds: originalItem?.sourceIds || [],
|
|
101
|
-
...(refinedItem.icon && { icon: refinedItem.icon }), // Preserve icon if updated during refinement
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
return newItem
|
|
105
|
-
})
|
|
106
|
-
}
|
package/agents/create/index.yaml
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
type: team
|
|
2
|
-
name: create
|
|
3
|
-
alias:
|
|
4
|
-
- generate
|
|
5
|
-
- gen
|
|
6
|
-
description: Create complete documentation for your project
|
|
7
|
-
skills:
|
|
8
|
-
- url: ../init/index.mjs
|
|
9
|
-
default_input:
|
|
10
|
-
skipIfExists: true
|
|
11
|
-
- ../utils/load-sources.mjs
|
|
12
|
-
- ./check-need-generate-structure.mjs
|
|
13
|
-
- url: ../utils/save-output.mjs
|
|
14
|
-
default_input:
|
|
15
|
-
saveKey: documentStructure
|
|
16
|
-
savePath:
|
|
17
|
-
$get: outputDir
|
|
18
|
-
fileName: structure-plan.json
|
|
19
|
-
- ./user-review-document-structure.mjs
|
|
20
|
-
- url: ../utils/save-output.mjs
|
|
21
|
-
default_input:
|
|
22
|
-
saveKey: documentStructure
|
|
23
|
-
savePath:
|
|
24
|
-
$get: outputDir
|
|
25
|
-
fileName: structure-plan.json
|
|
26
|
-
- ../utils/save-sidebar.mjs
|
|
27
|
-
- ../utils/ensure-document-icons.mjs
|
|
28
|
-
- ../utils/format-document-structure.mjs
|
|
29
|
-
- ../media/load-media-description.mjs
|
|
30
|
-
- ../update/batch-generate-document.yaml
|
|
31
|
-
- url: ../utils/check-feedback-refiner.mjs
|
|
32
|
-
default_input:
|
|
33
|
-
stage: document_structure
|
|
34
|
-
- ../utils/post-generate.mjs
|
|
35
|
-
|
|
36
|
-
input_schema:
|
|
37
|
-
type: object
|
|
38
|
-
properties:
|
|
39
|
-
glossary:
|
|
40
|
-
type: string
|
|
41
|
-
description: Glossary file for consistent terminology (use @filename.md)
|
|
42
|
-
forceRegenerate:
|
|
43
|
-
type: boolean
|
|
44
|
-
description: Rebuild all documentation from scratch
|
|
45
|
-
mode: sequential
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
type: team
|
|
2
|
-
name: refineDocumentStructure
|
|
3
|
-
description: A team of agents that generate the structure of the documentation.
|
|
4
|
-
skills:
|
|
5
|
-
- generate-structure.yaml
|
|
6
|
-
task_title: Generate the structure of the documentation
|
|
7
|
-
task_render_mode: collapse
|
|
8
|
-
reflection:
|
|
9
|
-
reviewer: check-document-structure.yaml
|
|
10
|
-
is_approved: isValid
|
|
11
|
-
max_iterations: 3
|
|
12
|
-
return_last_on_max_iterations: true
|