@aigne/doc-smith 0.8.5 → 0.8.7
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/output/structure-plan.json +1 -5
- package/CHANGELOG.md +25 -0
- package/README.md +3 -3
- package/agents/{chat.yaml → chat/index.yaml} +7 -7
- package/agents/generate/check-document-structure.yaml +30 -0
- package/agents/{check-structure-plan.mjs → generate/check-need-generate-structure.mjs} +21 -21
- package/agents/generate/generate-structure.yaml +58 -0
- package/agents/{docs-generator.yaml → generate/index.yaml} +15 -16
- package/agents/generate/refine-document-structure.yaml +12 -0
- package/agents/{input-generator.mjs → init/index.mjs} +34 -27
- package/agents/{manage-prefs.mjs → prefs/index.mjs} +16 -16
- package/agents/publish/index.yaml +17 -0
- package/agents/{publish-docs.mjs → publish/publish-docs.mjs} +15 -16
- package/agents/schema/{structure-plan-result.yaml → document-execution-structure.yaml} +3 -3
- package/agents/schema/document-structure.yaml +26 -0
- package/agents/{language-selector.mjs → translate/choose-language.mjs} +5 -5
- package/agents/{retranslate.yaml → translate/index.yaml} +17 -18
- package/agents/translate/translate-document.yaml +32 -0
- package/agents/{batch-translate.yaml → translate/translate-multilingual.yaml} +5 -5
- package/agents/update/batch-generate-document.yaml +19 -0
- package/agents/{check-detail.mjs → update/check-document.mjs} +16 -16
- package/agents/{detail-generator-and-translate.yaml → update/generate-and-translate-document.yaml} +23 -23
- package/agents/update/generate-document.yaml +50 -0
- package/agents/{detail-regenerator.yaml → update/index.yaml} +16 -17
- package/agents/{action-success.mjs → utils/action-success.mjs} +2 -2
- package/agents/{check-detail-result.mjs → utils/check-detail-result.mjs} +3 -3
- package/agents/{check-feedback-refiner.mjs → utils/check-feedback-refiner.mjs} +6 -6
- package/agents/{find-items-by-paths.mjs → utils/choose-docs.mjs} +25 -10
- package/agents/{docs-fs.yaml → utils/docs-fs-actor.yaml} +3 -1
- package/agents/utils/feedback-refiner.yaml +50 -0
- package/agents/{find-item-by-path.mjs → utils/find-item-by-path.mjs} +17 -7
- package/agents/{find-user-preferences-by-path.mjs → utils/find-user-preferences-by-path.mjs} +1 -1
- package/agents/utils/format-document-structure.mjs +25 -0
- package/agents/{load-sources.mjs → utils/load-sources.mjs} +41 -28
- package/agents/{save-docs.mjs → utils/save-docs.mjs} +16 -16
- package/agents/{save-single-doc.mjs → utils/save-single-doc.mjs} +2 -2
- package/agents/{transform-detail-datasources.mjs → utils/transform-detail-datasources.mjs} +1 -1
- package/aigne.yaml +35 -35
- package/docs/cli-reference.md +1 -1
- package/docs/features-generate-documentation.md +1 -1
- package/docs/features-update-and-refine.md +2 -2
- package/docs-mcp/analyze-docs-relevance.yaml +10 -10
- package/docs-mcp/docs-search.yaml +5 -3
- package/package.json +10 -8
- package/prompts/{document → detail/custom}/custom-code-block.md +6 -6
- package/prompts/detail/custom/custom-components.md +172 -0
- package/prompts/{document → detail}/d2-chart/rules.md +95 -1
- package/prompts/{document → detail}/detail-example.md +80 -61
- package/prompts/{document/detail-generator.md → detail/document-rules.md} +4 -8
- package/prompts/{content-detail-generator.md → detail/generate-document.md} +48 -25
- package/prompts/{check-structure-planning-result.md → structure/check-document-structure.md} +23 -17
- package/prompts/{document/structure-planning.md → structure/document-rules.md} +0 -2
- package/prompts/{structure-planning.md → structure/generate-structure.md} +51 -30
- package/prompts/{document → structure}/structure-example.md +2 -2
- package/prompts/{document → structure}/structure-getting-started.md +2 -2
- package/prompts/translate/glossary.md +6 -0
- package/prompts/{translator.md → translate/translate-document.md} +29 -10
- package/prompts/{feedback-refiner.md → utils/feedback-refiner.md} +8 -8
- package/tests/agents/chat/chat.test.mjs +46 -0
- package/tests/agents/generate/check-document-structure.test.mjs +51 -0
- package/tests/agents/generate/check-need-generate-structure.test.mjs +292 -0
- package/tests/agents/generate/generate-structure.test.mjs +51 -0
- package/tests/{input-generator.test.mjs → agents/init/init.test.mjs} +19 -17
- package/tests/agents/prefs/prefs.test.mjs +431 -0
- package/tests/agents/publish/publish-docs.test.mjs +642 -0
- package/tests/agents/translate/choose-language.test.mjs +311 -0
- package/tests/agents/translate/translate-document.test.mjs +51 -0
- package/tests/agents/update/check-document.test.mjs +523 -0
- package/tests/agents/update/generate-document.test.mjs +51 -0
- package/tests/agents/utils/action-success.test.mjs +54 -0
- package/tests/{check-detail-result.test.mjs → agents/utils/check-detail-result.test.mjs} +98 -98
- package/tests/agents/utils/check-feedback-refiner.test.mjs +478 -0
- package/tests/agents/utils/choose-docs.test.mjs +417 -0
- package/tests/agents/utils/exit.test.mjs +70 -0
- package/tests/agents/utils/feedback-refiner.test.mjs +51 -0
- package/tests/agents/utils/find-item-by-path.test.mjs +526 -0
- package/tests/agents/utils/find-user-preferences-by-path.test.mjs +382 -0
- package/tests/agents/utils/format-document-structure.test.mjs +264 -0
- package/tests/agents/utils/fs.test.mjs +267 -0
- package/tests/{load-sources.test.mjs → agents/utils/load-sources.test.mjs} +153 -25
- package/tests/{save-docs.test.mjs → agents/utils/save-docs.test.mjs} +11 -5
- package/tests/agents/utils/save-output.test.mjs +315 -0
- package/tests/agents/utils/save-single-doc.test.mjs +364 -0
- package/tests/agents/utils/transform-detail-datasources.test.mjs +363 -0
- package/tests/utils/auth-utils.test.mjs +358 -0
- package/tests/utils/blocklet.test.mjs +334 -0
- package/tests/{conflict-resolution.test.mjs → utils/conflict-detector.test.mjs} +3 -3
- package/tests/utils/constants.test.mjs +295 -0
- package/tests/utils/d2-utils.test.mjs +423 -0
- package/tests/utils/deploy.test.mjs +365 -0
- package/tests/utils/docs-finder-utils.test.mjs +625 -0
- package/tests/utils/file-utils.test.mjs +213 -0
- package/tests/{kroki-utils.test.mjs → utils/kroki-utils.test.mjs} +2 -2
- package/tests/utils/load-config.test.mjs +141 -0
- package/tests/{mermaid-validation.test.mjs → utils/mermaid-validator.test.mjs} +2 -2
- package/tests/utils/mock-chat-model.mjs +12 -0
- package/tests/{preferences-utils.test.mjs → utils/preferences-utils.test.mjs} +1 -1
- package/tests/{save-value-to-config.test.mjs → utils/save-value-to-config.test.mjs} +61 -4
- package/tests/utils/utils.test.mjs +939 -0
- package/utils/auth-utils.mjs +1 -1
- package/utils/conflict-detector.mjs +1 -1
- package/utils/constants.mjs +5 -3
- package/utils/d2-utils.mjs +194 -0
- package/utils/deploy.mjs +3 -3
- package/utils/docs-finder-utils.mjs +26 -26
- package/utils/icon-map.mjs +26 -0
- package/{agents → utils}/load-config.mjs +2 -18
- package/utils/markdown-checker.mjs +5 -5
- package/agents/batch-docs-detail-generator.yaml +0 -19
- package/agents/check-structure-planning-result.yaml +0 -30
- package/agents/content-detail-generator.yaml +0 -50
- package/agents/feedback-refiner.yaml +0 -52
- package/agents/format-structure-plan.mjs +0 -25
- package/agents/reflective-structure-planner.yaml +0 -12
- package/agents/schema/structure-plan.yaml +0 -26
- package/agents/structure-planning.yaml +0 -58
- package/agents/team-publish-docs.yaml +0 -18
- package/agents/translate.yaml +0 -31
- package/prompts/document/custom-components.md +0 -104
- package/tests/README.md +0 -93
- package/tests/utils.test.mjs +0 -2067
- /package/agents/{exit.mjs → utils/exit.mjs} +0 -0
- /package/agents/{fs.mjs → utils/fs.mjs} +0 -0
- /package/agents/{save-output.mjs → utils/save-output.mjs} +0 -0
- /package/prompts/{document → detail}/d2-chart/official-examples.md +0 -0
- /package/prompts/{document → detail}/jsx/rules.md +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type: team
|
|
2
|
+
name: publish
|
|
3
|
+
alias:
|
|
4
|
+
- pub
|
|
5
|
+
- p
|
|
6
|
+
description: Publish your documentation online
|
|
7
|
+
skills:
|
|
8
|
+
- url: ../init/index.mjs
|
|
9
|
+
default_input:
|
|
10
|
+
skipIfExists: true
|
|
11
|
+
- publish-docs.mjs
|
|
12
|
+
input_schema:
|
|
13
|
+
type: object
|
|
14
|
+
properties:
|
|
15
|
+
appUrl:
|
|
16
|
+
type: string
|
|
17
|
+
description: Website URL where docs will be published (optional - leave empty for interactive setup)
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { basename, join } from "node:path";
|
|
2
|
+
|
|
2
3
|
import { publishDocs as publishDocsFn } from "@aigne/publish-docs";
|
|
3
4
|
import chalk from "chalk";
|
|
4
5
|
import fs from "fs-extra";
|
|
5
6
|
|
|
6
|
-
import { getAccessToken } from "
|
|
7
|
-
import { DISCUSS_KIT_STORE_URL, TMP_DIR, TMP_DOCS_DIR } from "
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { getGithubRepoUrl, loadConfigFromFile, saveValueToConfig } from "
|
|
7
|
+
import { getAccessToken } from "../../utils/auth-utils.mjs";
|
|
8
|
+
import { DISCUSS_KIT_STORE_URL, TMP_DIR, TMP_DOCS_DIR } from "../../utils/constants.mjs";
|
|
9
|
+
import { beforePublishHook, ensureTmpDir } from "../../utils/d2-utils.mjs";
|
|
10
|
+
import { deploy } from "../../utils/deploy.mjs";
|
|
11
|
+
import { getGithubRepoUrl, loadConfigFromFile, saveValueToConfig } from "../../utils/utils.mjs";
|
|
11
12
|
|
|
12
13
|
const DEFAULT_APP_URL = "https://docsmith.aigne.io";
|
|
13
14
|
|
|
@@ -53,21 +54,17 @@ export default async function publishDocs(
|
|
|
53
54
|
message: "Select platform to publish your documents:",
|
|
54
55
|
choices: [
|
|
55
56
|
{
|
|
56
|
-
name:
|
|
57
|
-
chalk.blue("Publish to docsmith.aigne.io") +
|
|
58
|
-
" - free, but your documents will be publicly accessible, recommended for open-source projects",
|
|
57
|
+
name: `${chalk.blue("DocSmith Cloud (docsmith.aigne.io)")} – ${chalk.green("Free")} hosting. Your documents will be publicly accessible. Best for open-source projects or community sharing.`,
|
|
59
58
|
value: "default",
|
|
60
59
|
},
|
|
61
60
|
{
|
|
62
|
-
name: `${chalk.blue("
|
|
61
|
+
name: `${chalk.blue("Your existing website")} - Integrate and publish directly on your current site (setup required)`,
|
|
63
62
|
value: "custom",
|
|
64
63
|
},
|
|
65
64
|
...(hasCachedCheckoutId && hasDocSmithBaseUrl
|
|
66
65
|
? [
|
|
67
66
|
{
|
|
68
|
-
name:
|
|
69
|
-
chalk.yellow("Continue your previous website setup") +
|
|
70
|
-
" - resume from where you left off",
|
|
67
|
+
name: `${chalk.yellow("Resume previous website setup")} - ${chalk.green("Already paid.")} Continue where you left off. Your payment is already processed.`,
|
|
71
68
|
value: "new-instance-continue",
|
|
72
69
|
},
|
|
73
70
|
]
|
|
@@ -75,7 +72,7 @@ export default async function publishDocs(
|
|
|
75
72
|
...(hasDocSmithBaseUrl
|
|
76
73
|
? [
|
|
77
74
|
{
|
|
78
|
-
name: `${chalk.blue("
|
|
75
|
+
name: `${chalk.blue("New website")} - ${chalk.yellow("Paid service.")} We'll help you set up a brand-new website with custom domain and hosting. Great if you want a professional presence.`,
|
|
79
76
|
value: "new-instance",
|
|
80
77
|
},
|
|
81
78
|
]
|
|
@@ -113,7 +110,7 @@ export default async function publishDocs(
|
|
|
113
110
|
paymentUrl = config?.paymentUrl;
|
|
114
111
|
console.log(`\nResuming your previous website setup...`);
|
|
115
112
|
} else {
|
|
116
|
-
console.log(`\nCreating
|
|
113
|
+
console.log(`\nCreating new website for your documentation...`);
|
|
117
114
|
}
|
|
118
115
|
const { appUrl: homeUrl, token: ltToken } = (await deploy(id, paymentUrl)) || {};
|
|
119
116
|
|
|
@@ -127,6 +124,8 @@ export default async function publishDocs(
|
|
|
127
124
|
}
|
|
128
125
|
}
|
|
129
126
|
|
|
127
|
+
console.log(`\nPublishing docs to ${chalk.cyan(appUrl)}\n`);
|
|
128
|
+
|
|
130
129
|
const accessToken = await getAccessToken(appUrl, token);
|
|
131
130
|
|
|
132
131
|
process.env.DOC_ROOT_DIR = docsDir;
|
|
@@ -185,7 +184,7 @@ export default async function publishDocs(
|
|
|
185
184
|
} catch (error) {
|
|
186
185
|
message = `❌ Failed to publish docs: ${error.message}`;
|
|
187
186
|
}
|
|
188
|
-
saveValueToConfig("checkoutId", "", "Checkout ID for document deployment service");
|
|
187
|
+
await saveValueToConfig("checkoutId", "", "Checkout ID for document deployment service");
|
|
189
188
|
|
|
190
189
|
// clean up tmp work dir
|
|
191
190
|
await fs.rm(docsDir, { recursive: true, force: true });
|
|
@@ -211,4 +210,4 @@ publishDocs.input_schema = {
|
|
|
211
210
|
},
|
|
212
211
|
};
|
|
213
212
|
|
|
214
|
-
publishDocs.description = "Publish the documentation to
|
|
213
|
+
publishDocs.description = "Publish the documentation to website";
|
|
@@ -8,7 +8,7 @@ items:
|
|
|
8
8
|
type: string
|
|
9
9
|
path:
|
|
10
10
|
type: string
|
|
11
|
-
description:
|
|
11
|
+
description: Path in URL format, cannot be empty, must start with /, no need to include language level, e.g., /zh/about should return /about
|
|
12
12
|
parentId:
|
|
13
13
|
type:
|
|
14
14
|
- string
|
|
@@ -20,12 +20,12 @@ items:
|
|
|
20
20
|
properties:
|
|
21
21
|
language:
|
|
22
22
|
type: string
|
|
23
|
-
description:
|
|
23
|
+
description: Language code, such as zh, en, ja, etc.
|
|
24
24
|
sourceIds:
|
|
25
25
|
type: array
|
|
26
26
|
items:
|
|
27
27
|
type: string
|
|
28
|
-
description:
|
|
28
|
+
description: Associated sourceId from dataSources for subsequent translation and content generation, must come from sourceId in datasources, cannot have fake ids, cannot be empty
|
|
29
29
|
required:
|
|
30
30
|
- title
|
|
31
31
|
- description
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
type: array
|
|
2
|
+
items:
|
|
3
|
+
type: object
|
|
4
|
+
properties:
|
|
5
|
+
title:
|
|
6
|
+
type: string
|
|
7
|
+
description:
|
|
8
|
+
type: string
|
|
9
|
+
path:
|
|
10
|
+
type: string
|
|
11
|
+
description: Path in URL format, cannot be empty, cannot contain spaces or special characters, must start with /, no need to include language level, e.g., /zh/about should return /about
|
|
12
|
+
parentId:
|
|
13
|
+
type:
|
|
14
|
+
- string
|
|
15
|
+
- "null"
|
|
16
|
+
description: Parent node path, if null indicates it is a top-level node
|
|
17
|
+
sourceIds:
|
|
18
|
+
type: array
|
|
19
|
+
description: Associated sourceId from dataSources for subsequent translation and content generation, must come from sourceId in datasources, cannot have fake ids, **cannot be empty**
|
|
20
|
+
items:
|
|
21
|
+
type: string
|
|
22
|
+
required:
|
|
23
|
+
- title
|
|
24
|
+
- description
|
|
25
|
+
- path
|
|
26
|
+
- sourceIds
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SUPPORTED_LANGUAGES } from "
|
|
2
|
-
import { loadConfigFromFile, saveValueToConfig } from "
|
|
1
|
+
import { SUPPORTED_LANGUAGES } from "../../utils/constants.mjs";
|
|
2
|
+
import { loadConfigFromFile, saveValueToConfig } from "../../utils/utils.mjs";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Interactive language selector for translation from configured languages
|
|
@@ -9,7 +9,7 @@ import { loadConfigFromFile, saveValueToConfig } from "../utils/utils.mjs";
|
|
|
9
9
|
* @param {Object} options - Options object with prompts
|
|
10
10
|
* @returns {Promise<Object>} Selected languages
|
|
11
11
|
*/
|
|
12
|
-
export default async function
|
|
12
|
+
export default async function chooseLanguage({ langs, locale, selectedDocs }, options) {
|
|
13
13
|
let selectedLanguages = [];
|
|
14
14
|
|
|
15
15
|
// Load existing config to get current translation languages
|
|
@@ -19,7 +19,7 @@ export default async function languageSelector({ langs, locale, selectedDocs },
|
|
|
19
19
|
// Get primary language from config or parameter
|
|
20
20
|
const primaryLanguage = locale || existingConfig?.locale || "en";
|
|
21
21
|
|
|
22
|
-
// Filter out the primary language from available choices (like
|
|
22
|
+
// Filter out the primary language from available choices (like init.mjs)
|
|
23
23
|
const availableTranslationLanguages = SUPPORTED_LANGUAGES.filter(
|
|
24
24
|
(lang) => lang.code !== primaryLanguage,
|
|
25
25
|
);
|
|
@@ -90,7 +90,7 @@ export default async function languageSelector({ langs, locale, selectedDocs },
|
|
|
90
90
|
};
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
chooseLanguage.input_schema = {
|
|
94
94
|
type: "object",
|
|
95
95
|
properties: {
|
|
96
96
|
langs: {
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
type: team
|
|
2
2
|
name: translate
|
|
3
|
-
description: Translate
|
|
3
|
+
description: Translate documents into other languages
|
|
4
4
|
skills:
|
|
5
|
-
- url:
|
|
5
|
+
- url: ../init/index.mjs
|
|
6
6
|
default_input:
|
|
7
7
|
skipIfExists: true
|
|
8
|
-
-
|
|
9
|
-
- ./load-sources.mjs
|
|
8
|
+
- ../utils/load-sources.mjs
|
|
10
9
|
- type: transform
|
|
11
10
|
task_render_mode: hide
|
|
12
11
|
jsonata: |
|
|
13
12
|
$merge([
|
|
14
13
|
$,
|
|
15
14
|
{
|
|
16
|
-
'
|
|
17
|
-
'
|
|
15
|
+
'documentStructure': originalDocumentStructure,
|
|
16
|
+
'documentExecutionStructure': $map(originalDocumentStructure, function($item) {
|
|
18
17
|
$merge([
|
|
19
18
|
$item,
|
|
20
19
|
{
|
|
@@ -24,42 +23,42 @@ skills:
|
|
|
24
23
|
})
|
|
25
24
|
}
|
|
26
25
|
])
|
|
27
|
-
- url:
|
|
26
|
+
- url: ../utils/choose-docs.mjs
|
|
28
27
|
default_input:
|
|
29
28
|
isTranslate: true
|
|
30
|
-
-
|
|
29
|
+
- ../translate/choose-language.mjs
|
|
31
30
|
- type: team
|
|
32
|
-
name:
|
|
31
|
+
name: batchTranslateDocument
|
|
33
32
|
skills:
|
|
34
|
-
-
|
|
35
|
-
- url:
|
|
33
|
+
- ../translate/translate-multilingual.yaml
|
|
34
|
+
- url: ../utils/save-single-doc.mjs
|
|
36
35
|
default_input:
|
|
37
36
|
isTranslate: true
|
|
38
37
|
iterate_on: selectedDocs
|
|
39
38
|
concurrency: 3
|
|
40
|
-
- url:
|
|
39
|
+
- url: ../utils/check-feedback-refiner.mjs
|
|
41
40
|
default_input:
|
|
42
41
|
stage: translation_refine
|
|
43
|
-
- url:
|
|
42
|
+
- url: ../utils/action-success.mjs
|
|
44
43
|
default_input:
|
|
45
|
-
action: "
|
|
44
|
+
action: "✅ Translation completed"
|
|
46
45
|
input_schema:
|
|
47
46
|
type: object
|
|
48
47
|
properties:
|
|
49
48
|
glossary:
|
|
50
49
|
type: string
|
|
51
|
-
description: Glossary
|
|
50
|
+
description: Glossary file for consistent terminology (use @filename.md)
|
|
52
51
|
docs:
|
|
53
52
|
type: array
|
|
54
53
|
items:
|
|
55
54
|
type: string
|
|
56
|
-
description:
|
|
55
|
+
description: Documents to translate
|
|
57
56
|
langs:
|
|
58
57
|
type: array
|
|
59
58
|
items:
|
|
60
59
|
type: string
|
|
61
|
-
description: "
|
|
60
|
+
description: "Target languages (available: en, zh, zh-TW, ja, fr, de, es, it, ru, ko, pt, ar)"
|
|
62
61
|
feedback:
|
|
63
62
|
type: string
|
|
64
|
-
description:
|
|
63
|
+
description: Tell us how to improve the translation style
|
|
65
64
|
mode: sequential
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
name: translateDocument
|
|
2
|
+
description: Translate content to another language
|
|
3
|
+
instructions:
|
|
4
|
+
url: ../../prompts/translate/translate-document.md
|
|
5
|
+
task_render_mode: collapse
|
|
6
|
+
input_schema:
|
|
7
|
+
type: object
|
|
8
|
+
properties:
|
|
9
|
+
language:
|
|
10
|
+
type: string
|
|
11
|
+
description: Target language (e.g., 'zh' for Chinese, 'ja' for Japanese)
|
|
12
|
+
content:
|
|
13
|
+
type: string
|
|
14
|
+
description: Text content to translate
|
|
15
|
+
glossary:
|
|
16
|
+
type: string
|
|
17
|
+
description: Glossary for consistent terminology
|
|
18
|
+
feedback:
|
|
19
|
+
type: string
|
|
20
|
+
description: Tell us how to improve the translation style
|
|
21
|
+
required:
|
|
22
|
+
- language
|
|
23
|
+
- content
|
|
24
|
+
output_schema:
|
|
25
|
+
type: object
|
|
26
|
+
properties:
|
|
27
|
+
translation:
|
|
28
|
+
type: string
|
|
29
|
+
description: Translated text
|
|
30
|
+
language:
|
|
31
|
+
type: string
|
|
32
|
+
description: Language code of the translation
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
type: team
|
|
2
|
-
name:
|
|
3
|
-
description:
|
|
2
|
+
name: translateMultilingual
|
|
3
|
+
description: Batch translate documents to multiple languages
|
|
4
4
|
skills:
|
|
5
5
|
- type: team
|
|
6
6
|
task_render_mode: collapse
|
|
7
7
|
name: translate
|
|
8
8
|
skills:
|
|
9
|
-
- url:
|
|
9
|
+
- url: ../utils/find-user-preferences-by-path.mjs
|
|
10
10
|
default_input:
|
|
11
11
|
scope: translation
|
|
12
|
-
-
|
|
12
|
+
- ../translate/translate-document.yaml
|
|
13
13
|
- type: transform
|
|
14
14
|
jsonata: |
|
|
15
15
|
$merge([
|
|
@@ -17,7 +17,7 @@ skills:
|
|
|
17
17
|
{ "reviewContent": translation }
|
|
18
18
|
])
|
|
19
19
|
reflection:
|
|
20
|
-
reviewer:
|
|
20
|
+
reviewer: ../utils/check-detail-result.mjs
|
|
21
21
|
is_approved: isApproved
|
|
22
22
|
max_iterations: 5
|
|
23
23
|
return_last_on_max_iterations: true
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
type: team
|
|
2
|
+
name: batchGenerateDocument
|
|
3
|
+
description: Batch generate document details
|
|
4
|
+
skills:
|
|
5
|
+
- ./check-document.mjs
|
|
6
|
+
input_schema:
|
|
7
|
+
type: object
|
|
8
|
+
properties:
|
|
9
|
+
datasources:
|
|
10
|
+
type: string
|
|
11
|
+
description: Context for document structure generation, used to assist generate document structure
|
|
12
|
+
documentExecutionStructure: ../schema/document-execution-structure.yaml
|
|
13
|
+
modifiedFiles:
|
|
14
|
+
type: array
|
|
15
|
+
items: { type: string }
|
|
16
|
+
description: Array of modified files since last generation
|
|
17
|
+
iterate_on: documentExecutionStructure
|
|
18
|
+
concurrency: 3
|
|
19
|
+
mode: sequential
|
|
@@ -2,19 +2,19 @@ import { access, readFile } from "node:fs/promises";
|
|
|
2
2
|
import { dirname, join } from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
4
|
import { TeamAgent } from "@aigne/core";
|
|
5
|
-
import { hasSourceFilesChanged } from "
|
|
6
|
-
import checkDetailResult from "
|
|
5
|
+
import { hasSourceFilesChanged } from "../../utils/utils.mjs";
|
|
6
|
+
import checkDetailResult from "../utils/check-detail-result.mjs";
|
|
7
7
|
|
|
8
8
|
// Get current script directory
|
|
9
9
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
10
10
|
|
|
11
|
-
export default async function
|
|
11
|
+
export default async function checkDocument(
|
|
12
12
|
{
|
|
13
13
|
path,
|
|
14
14
|
docsDir,
|
|
15
15
|
sourceIds,
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
originalDocumentStructure,
|
|
17
|
+
documentStructure,
|
|
18
18
|
modifiedFiles,
|
|
19
19
|
forceRegenerate,
|
|
20
20
|
...rest
|
|
@@ -36,11 +36,11 @@ export default async function checkDetail(
|
|
|
36
36
|
detailGenerated = false;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
// Check if sourceIds have changed by comparing with original structure
|
|
39
|
+
// Check if sourceIds have changed by comparing with original document structure
|
|
40
40
|
let sourceIdsChanged = false;
|
|
41
|
-
if (
|
|
42
|
-
// Find the original node in the structure
|
|
43
|
-
const originalNode =
|
|
41
|
+
if (originalDocumentStructure && sourceIds) {
|
|
42
|
+
// Find the original node in the document structure
|
|
43
|
+
const originalNode = originalDocumentStructure.find((node) => node.path === path);
|
|
44
44
|
|
|
45
45
|
if (originalNode?.sourceIds) {
|
|
46
46
|
const originalSourceIds = originalNode.sourceIds;
|
|
@@ -82,9 +82,9 @@ export default async function checkDetail(
|
|
|
82
82
|
// If file exists, check content validation
|
|
83
83
|
let contentValidationFailed = false;
|
|
84
84
|
let validationResult = {};
|
|
85
|
-
if (detailGenerated && fileContent &&
|
|
85
|
+
if (detailGenerated && fileContent && documentStructure) {
|
|
86
86
|
validationResult = await checkDetailResult({
|
|
87
|
-
|
|
87
|
+
documentStructure,
|
|
88
88
|
reviewContent: fileContent,
|
|
89
89
|
docsDir,
|
|
90
90
|
});
|
|
@@ -111,8 +111,8 @@ export default async function checkDetail(
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
const teamAgent = TeamAgent.from({
|
|
114
|
-
name: "
|
|
115
|
-
skills: [options.context.agents["
|
|
114
|
+
name: "generateDocument",
|
|
115
|
+
skills: [options.context.agents["generateAndTranslateDocument"]],
|
|
116
116
|
});
|
|
117
117
|
|
|
118
118
|
const result = await options.context.invoke(teamAgent, {
|
|
@@ -120,8 +120,8 @@ export default async function checkDetail(
|
|
|
120
120
|
docsDir,
|
|
121
121
|
path,
|
|
122
122
|
sourceIds,
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
originalDocumentStructure,
|
|
124
|
+
documentStructure,
|
|
125
125
|
detailFeedback: contentValidationFailed ? validationResult.detailFeedback : "",
|
|
126
126
|
});
|
|
127
127
|
|
|
@@ -133,4 +133,4 @@ export default async function checkDetail(
|
|
|
133
133
|
};
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
|
|
136
|
+
checkDocument.taskTitle = "Check if '{{ title }}' needs generate or update";
|
package/agents/{detail-generator-and-translate.yaml → update/generate-and-translate-document.yaml}
RENAMED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
type: team
|
|
2
|
-
name:
|
|
3
|
-
description:
|
|
2
|
+
name: generateAndTranslateDocument
|
|
3
|
+
description: Generate document and translate
|
|
4
4
|
skills:
|
|
5
|
-
-
|
|
5
|
+
- ../utils/transform-detail-datasources.mjs
|
|
6
6
|
- type: team
|
|
7
7
|
task_render_mode: collapse
|
|
8
|
-
name:
|
|
8
|
+
name: generateDocumentContent
|
|
9
9
|
skills:
|
|
10
|
-
- url:
|
|
10
|
+
- url: ../utils/find-user-preferences-by-path.mjs
|
|
11
11
|
default_input:
|
|
12
12
|
scope: document
|
|
13
|
-
-
|
|
13
|
+
- ../update/generate-document.yaml
|
|
14
14
|
- type: transform
|
|
15
15
|
jsonata: |
|
|
16
16
|
$merge([
|
|
@@ -18,11 +18,11 @@ skills:
|
|
|
18
18
|
{ "reviewContent": content }
|
|
19
19
|
])
|
|
20
20
|
reflection:
|
|
21
|
-
reviewer:
|
|
21
|
+
reviewer: ../utils/check-detail-result.mjs
|
|
22
22
|
is_approved: isApproved
|
|
23
23
|
max_iterations: 5
|
|
24
24
|
return_last_on_max_iterations: true
|
|
25
|
-
task_title: Generate
|
|
25
|
+
task_title: Generate document for '{{ title }}'
|
|
26
26
|
- type: transform
|
|
27
27
|
task_render_mode: hide
|
|
28
28
|
jsonata: |
|
|
@@ -30,63 +30,63 @@ skills:
|
|
|
30
30
|
$,
|
|
31
31
|
{ "feedback": "" }
|
|
32
32
|
])
|
|
33
|
-
-
|
|
34
|
-
-
|
|
33
|
+
- ../translate/translate-multilingual.yaml
|
|
34
|
+
- ../utils/save-single-doc.mjs
|
|
35
35
|
input_schema:
|
|
36
36
|
type: object
|
|
37
37
|
properties:
|
|
38
38
|
nodeName:
|
|
39
39
|
type: string
|
|
40
|
-
description:
|
|
40
|
+
description: Node name
|
|
41
41
|
default: Section
|
|
42
42
|
locale:
|
|
43
43
|
type: string
|
|
44
|
-
description:
|
|
44
|
+
description: Language
|
|
45
45
|
targetAudience:
|
|
46
46
|
type: string
|
|
47
|
-
description:
|
|
47
|
+
description: Target audience
|
|
48
48
|
glossary:
|
|
49
49
|
type: string
|
|
50
|
-
description:
|
|
50
|
+
description: Glossary
|
|
51
51
|
doc-path:
|
|
52
52
|
type: string
|
|
53
|
-
description:
|
|
53
|
+
description: Current path
|
|
54
54
|
feedback:
|
|
55
55
|
type: string
|
|
56
|
-
description:
|
|
56
|
+
description: Feedback
|
|
57
57
|
sources:
|
|
58
58
|
type: array
|
|
59
59
|
items:
|
|
60
60
|
type: string
|
|
61
|
-
description:
|
|
61
|
+
description: Source code path
|
|
62
62
|
sourcesPath:
|
|
63
63
|
type: array
|
|
64
64
|
items:
|
|
65
65
|
type: string
|
|
66
|
-
description:
|
|
66
|
+
description: Source code path
|
|
67
67
|
default:
|
|
68
68
|
- ./
|
|
69
69
|
includePatterns:
|
|
70
70
|
type: array
|
|
71
71
|
items:
|
|
72
72
|
type: string
|
|
73
|
-
description:
|
|
73
|
+
description: Included file names
|
|
74
74
|
excludePatterns:
|
|
75
75
|
type: array
|
|
76
76
|
items:
|
|
77
77
|
type: string
|
|
78
|
-
description:
|
|
78
|
+
description: Excluded file names
|
|
79
79
|
outputDir:
|
|
80
80
|
type: string
|
|
81
|
-
description:
|
|
81
|
+
description: Output directory
|
|
82
82
|
default: ./aigne-docs/output
|
|
83
83
|
docsDir:
|
|
84
84
|
type: string
|
|
85
|
-
description:
|
|
85
|
+
description: Documentation directory
|
|
86
86
|
default: ./aigne-docs/docs
|
|
87
87
|
additionalInformation:
|
|
88
88
|
type: string
|
|
89
|
-
description:
|
|
89
|
+
description: Additional information
|
|
90
90
|
output_schema:
|
|
91
91
|
type: object
|
|
92
92
|
properties:
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
name: generateDocument
|
|
2
|
+
description: Comprehensive content generator for documentation that creates detailed, high-quality document content from various data sources with intelligent analysis.
|
|
3
|
+
instructions:
|
|
4
|
+
url: ../../prompts/detail/generate-document.md
|
|
5
|
+
input_schema:
|
|
6
|
+
type: object
|
|
7
|
+
properties:
|
|
8
|
+
rules:
|
|
9
|
+
type: string
|
|
10
|
+
description: User's content generation rules and requirements
|
|
11
|
+
locale:
|
|
12
|
+
type: string
|
|
13
|
+
description: User language, such as zh, en
|
|
14
|
+
datasources:
|
|
15
|
+
type: string
|
|
16
|
+
description: Source data and context for document content generation
|
|
17
|
+
targetAudience:
|
|
18
|
+
type: string
|
|
19
|
+
description: Target audience for document content
|
|
20
|
+
nodeName:
|
|
21
|
+
type: string
|
|
22
|
+
description: Document node name for content generation
|
|
23
|
+
originalDocumentStructure: ../schema/document-structure.yaml
|
|
24
|
+
title:
|
|
25
|
+
type: string
|
|
26
|
+
description:
|
|
27
|
+
type: string
|
|
28
|
+
path:
|
|
29
|
+
type: string
|
|
30
|
+
parentId:
|
|
31
|
+
type:
|
|
32
|
+
- string
|
|
33
|
+
- "null"
|
|
34
|
+
glossary:
|
|
35
|
+
type: string
|
|
36
|
+
description: Glossary
|
|
37
|
+
additionalInformation:
|
|
38
|
+
type: string
|
|
39
|
+
description: Additional supplementary information
|
|
40
|
+
required:
|
|
41
|
+
- rules
|
|
42
|
+
- datasources
|
|
43
|
+
- originalDocumentStructure
|
|
44
|
+
output_schema:
|
|
45
|
+
type: object
|
|
46
|
+
properties:
|
|
47
|
+
content:
|
|
48
|
+
type: string
|
|
49
|
+
required:
|
|
50
|
+
- content
|