@aigne/doc-smith 0.8.15-beta → 0.8.15-beta.10
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 +83 -0
- package/agents/clear/choose-contents.mjs +4 -4
- package/agents/clear/clear-auth-tokens.mjs +8 -8
- package/agents/clear/clear-deployment-config.mjs +2 -2
- package/agents/clear/clear-document-config.mjs +3 -3
- package/agents/clear/clear-document-structure.mjs +10 -10
- package/agents/clear/clear-generated-docs.mjs +103 -14
- package/agents/clear/clear-media-description.mjs +7 -7
- package/agents/evaluate/document-structure.yaml +3 -1
- package/agents/evaluate/document.yaml +3 -1
- package/agents/evaluate/index.yaml +1 -3
- package/agents/generate/check-diagram.mjs +1 -1
- package/agents/generate/check-need-generate-structure.mjs +2 -7
- package/agents/generate/draw-diagram.yaml +4 -0
- package/agents/generate/generate-structure.yaml +117 -65
- package/agents/generate/index.yaml +3 -3
- package/agents/generate/{merge-d2-diagram.yaml → merge-diagram.yaml} +7 -6
- package/agents/generate/update-document-structure.yaml +1 -1
- package/agents/generate/user-review-document-structure.mjs +1 -0
- package/agents/generate/utils/merge-document-structures.mjs +30 -0
- package/agents/init/check.mjs +3 -1
- package/agents/init/index.mjs +37 -7
- package/agents/media/load-media-description.mjs +12 -24
- package/agents/publish/publish-docs.mjs +3 -8
- package/agents/schema/document-execution-structure.yaml +1 -1
- package/agents/schema/document-structure-item.yaml +23 -0
- package/agents/schema/document-structure-refine-item.yaml +20 -0
- package/agents/schema/document-structure.yaml +1 -1
- package/agents/translate/index.yaml +1 -4
- package/agents/translate/record-translation-history.mjs +6 -2
- package/agents/translate/translate-multilingual.yaml +1 -1
- package/agents/update/batch-generate-document.yaml +1 -1
- package/agents/update/batch-update-document.yaml +1 -1
- package/agents/update/check-document.mjs +50 -13
- package/agents/update/check-generate-diagram.mjs +26 -0
- package/agents/update/generate-diagram.yaml +29 -0
- package/agents/update/generate-document.yaml +17 -30
- package/agents/update/handle-document-update.yaml +10 -1
- package/agents/update/save-and-translate-document.mjs +18 -47
- package/agents/update/update-document-detail.yaml +2 -1
- package/agents/update/update-single-document.yaml +1 -1
- package/agents/update/user-review-document.mjs +6 -5
- package/agents/utils/choose-docs.mjs +8 -2
- package/agents/utils/load-sources.mjs +132 -57
- package/agents/utils/{save-docs.mjs → post-generate.mjs} +2 -51
- package/agents/utils/save-doc-translation.mjs +27 -0
- package/agents/utils/{save-single-doc.mjs → save-doc.mjs} +17 -12
- package/agents/utils/save-sidebar.mjs +59 -0
- package/agents/utils/transform-detail-data-sources.mjs +45 -0
- package/aigne.yaml +16 -8
- package/package.json +2 -1
- package/prompts/common/document/content-rules-core.md +6 -6
- package/prompts/common/document/media-file-list-usage-rules.md +12 -0
- package/prompts/common/document/openapi-usage-rules.md +36 -0
- package/prompts/common/document/role-and-personality.md +1 -2
- package/prompts/common/document-structure/conflict-resolution-guidance.md +2 -2
- package/prompts/common/document-structure/document-structure-rules.md +8 -8
- package/prompts/common/document-structure/output-constraints.md +3 -3
- package/prompts/detail/custom/custom-components.md +38 -3
- package/prompts/detail/d2-diagram/rules.md +11 -14
- package/prompts/detail/d2-diagram/system-prompt.md +33 -21
- package/prompts/detail/d2-diagram/user-prompt.md +39 -0
- package/prompts/detail/generate/document-rules.md +3 -3
- package/prompts/detail/generate/system-prompt.md +2 -6
- package/prompts/detail/generate/user-prompt.md +20 -24
- package/prompts/detail/update/system-prompt.md +2 -6
- package/prompts/detail/update/user-prompt.md +7 -6
- package/prompts/evaluate/document.md +0 -4
- package/prompts/structure/check-document-structure.md +4 -4
- package/prompts/structure/generate/system-prompt.md +0 -31
- package/prompts/structure/generate/user-prompt.md +99 -26
- package/prompts/structure/review/structure-review-system.md +79 -0
- package/prompts/structure/update/system-prompt.md +1 -1
- package/prompts/structure/update/user-prompt.md +4 -4
- package/prompts/translate/code-block.md +13 -3
- package/prompts/translate/translate-document.md +1 -1
- package/types/document-structure-schema.mjs +3 -3
- package/utils/docs-finder-utils.mjs +48 -0
- package/utils/extract-api.mjs +32 -0
- package/utils/file-utils.mjs +124 -93
- package/utils/history-utils.mjs +20 -8
- package/utils/load-config.mjs +1 -1
- package/utils/markdown-checker.mjs +35 -1
- package/utils/openapi/index.mjs +24 -0
- package/utils/utils.mjs +67 -65
- package/agents/generate/document-structure-tools/generate-sub-structure.mjs +0 -131
- package/agents/generate/generate-structure-without-tools.yaml +0 -65
- package/agents/utils/transform-detail-datasources.mjs +0 -23
- package/prompts/common/document/media-handling-rules.md +0 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,88 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.8.15-beta.10](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.15-beta.9...v0.8.15-beta.10) (2025-11-03)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* remove empty xml tag in prompt ([#239](https://github.com/AIGNE-io/aigne-doc-smith/issues/239)) ([1ec771e](https://github.com/AIGNE-io/aigne-doc-smith/commit/1ec771eb8855bca3730f732a1b68404275633787))
|
|
9
|
+
* standardized variable names and xml tag usage ([#237](https://github.com/AIGNE-io/aigne-doc-smith/pull/237))([00f18b9](https://github.com/AIGNE-io/aigne-doc-smith/commit/00f18b95ba21cd376e369eefb102d2d258e95529))
|
|
10
|
+
|
|
11
|
+
## [0.8.15-beta.9](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.15-beta.8...v0.8.15-beta.9) (2025-11-03)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* optimize the draw diagram process ([#234](https://github.com/AIGNE-io/aigne-doc-smith/issues/234)) ([7bdc0d9](https://github.com/AIGNE-io/aigne-doc-smith/commit/7bdc0d939df05b9d31e06ea0f0285ed0eafe74ae))
|
|
17
|
+
* simplify document structure merging and add deletion support ([#235](https://github.com/AIGNE-io/aigne-doc-smith/issues/235)) ([7f10242](https://github.com/AIGNE-io/aigne-doc-smith/commit/7f1024294bde241f41034d3e01a542451030cbdc))
|
|
18
|
+
|
|
19
|
+
## [0.8.15-beta.8](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.15-beta.7...v0.8.15-beta.8) (2025-11-01)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
* smarter structure generation with team-based architecture ([#225](https://github.com/AIGNE-io/aigne-doc-smith/issues/225)) ([eb3404a](https://github.com/AIGNE-io/aigne-doc-smith/commit/eb3404a8889364912a077e84688cfcd48d69ef47))
|
|
25
|
+
|
|
26
|
+
## [0.8.15-beta.7](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.15-beta.6...v0.8.15-beta.7) (2025-10-31)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Features
|
|
30
|
+
|
|
31
|
+
* add web-smith powered web-pages ([#229](https://github.com/AIGNE-io/aigne-doc-smith/issues/229)) ([c3c00c1](https://github.com/AIGNE-io/aigne-doc-smith/commit/c3c00c12f092b125b6adb1a13ed5ff9720fbdab7))
|
|
32
|
+
* support cleaning specific documents ([#231](https://github.com/AIGNE-io/aigne-doc-smith/issues/231)) ([67607c9](https://github.com/AIGNE-io/aigne-doc-smith/commit/67607c9ff3852cc81a29e5a11b2151d26879b000))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### Bug Fixes
|
|
36
|
+
|
|
37
|
+
* tune custom component prompt and batch update history ([#228](https://github.com/AIGNE-io/aigne-doc-smith/issues/228)) ([ab13b97](https://github.com/AIGNE-io/aigne-doc-smith/commit/ab13b9737e5f111d0939f9c39ee76e13c0692a68))
|
|
38
|
+
|
|
39
|
+
## [0.8.15-beta.6](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.15-beta.5...v0.8.15-beta.6) (2025-10-30)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### Bug Fixes
|
|
43
|
+
|
|
44
|
+
* ensure document embed image is accessible ([#226](https://github.com/AIGNE-io/aigne-doc-smith/issues/226)) ([47dfc5d](https://github.com/AIGNE-io/aigne-doc-smith/commit/47dfc5d48440f435258c7d4b5629712c7eb886e7))
|
|
45
|
+
|
|
46
|
+
## [0.8.15-beta.5](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.15-beta.4...v0.8.15-beta.5) (2025-10-29)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
### Bug Fixes
|
|
50
|
+
|
|
51
|
+
* simplify data source input and select tips ([#223](https://github.com/AIGNE-io/aigne-doc-smith/issues/223)) ([069928b](https://github.com/AIGNE-io/aigne-doc-smith/commit/069928bce2b4a70ee5a0444ecff34501e1158e5c))
|
|
52
|
+
|
|
53
|
+
## [0.8.15-beta.4](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.15-beta.3...v0.8.15-beta.4) (2025-10-28)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
### Bug Fixes
|
|
57
|
+
|
|
58
|
+
* fix update translate not working ([#221](https://github.com/AIGNE-io/aigne-doc-smith/issues/221)) ([95bc49e](https://github.com/AIGNE-io/aigne-doc-smith/commit/95bc49ec8b1e18fe20dd1360d9707afdd6629bad))
|
|
59
|
+
|
|
60
|
+
## [0.8.15-beta.3](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.15-beta.2...v0.8.15-beta.3) (2025-10-28)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
### Features
|
|
64
|
+
|
|
65
|
+
* glossary support load from remote-url ([#220](https://github.com/AIGNE-io/aigne-doc-smith/issues/220)) ([5d52746](https://github.com/AIGNE-io/aigne-doc-smith/commit/5d527469819a4dc08f17338b1d1fb2cd7ccf07c0))
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
### Bug Fixes
|
|
69
|
+
|
|
70
|
+
* polish generate/update/translate save doc logic ([#218](https://github.com/AIGNE-io/aigne-doc-smith/issues/218)) ([dada1a4](https://github.com/AIGNE-io/aigne-doc-smith/commit/dada1a422d589512f2a0f6e5c69df4845eca44ae))
|
|
71
|
+
|
|
72
|
+
## [0.8.15-beta.2](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.15-beta.1...v0.8.15-beta.2) (2025-10-24)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
### Bug Fixes
|
|
76
|
+
|
|
77
|
+
* locale not applied when generating D2 diagrams ([#215](https://github.com/AIGNE-io/aigne-doc-smith/issues/215)) ([7e6f42f](https://github.com/AIGNE-io/aigne-doc-smith/commit/7e6f42faf15a115e53c57dbc2d5a19a82cf44295))
|
|
78
|
+
|
|
79
|
+
## [0.8.15-beta.1](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.15-beta...v0.8.15-beta.1) (2025-10-23)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
### Features
|
|
83
|
+
|
|
84
|
+
* support openapi datasource, generate better api docs ([#212](https://github.com/AIGNE-io/aigne-doc-smith/issues/212)) ([6a683f1](https://github.com/AIGNE-io/aigne-doc-smith/commit/6a683f117aa94f265383be6e1b3b957803004032))
|
|
85
|
+
|
|
3
86
|
## [0.8.15-beta](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.14...v0.8.15-beta) (2025-10-21)
|
|
4
87
|
|
|
5
88
|
|
|
@@ -10,7 +10,7 @@ const TARGET_METADATA = {
|
|
|
10
10
|
generatedDocs: {
|
|
11
11
|
label: "Generated Documents",
|
|
12
12
|
description: ({ docsDir }) =>
|
|
13
|
-
`
|
|
13
|
+
`Select and delete specific generated documents in './${toDisplayPath(docsDir)}'. The documentation structure will be preserved.`,
|
|
14
14
|
agent: "clearGeneratedDocs",
|
|
15
15
|
},
|
|
16
16
|
documentStructure: {
|
|
@@ -150,9 +150,9 @@ export default async function chooseContents(input = {}, options = {}) {
|
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
const header = hasError
|
|
153
|
-
? "Cleanup finished with some issues
|
|
154
|
-
: "Cleanup completed successfully
|
|
155
|
-
const detailLines = results.map((item) =>
|
|
153
|
+
? "🧹 Cleanup finished with some issues.\n"
|
|
154
|
+
: "🧹 Cleanup completed successfully!\n";
|
|
155
|
+
const detailLines = results.map((item) => `${item.message}`).join("\n\n");
|
|
156
156
|
|
|
157
157
|
const suggestions = [];
|
|
158
158
|
results.forEach((result) => {
|
|
@@ -9,7 +9,7 @@ export default async function clearAuthTokens(_input = {}, options = {}) {
|
|
|
9
9
|
// Check if the file exists
|
|
10
10
|
if (!existsSync(DOC_SMITH_ENV_FILE)) {
|
|
11
11
|
return {
|
|
12
|
-
message: "No site authorizations found to clear",
|
|
12
|
+
message: "🔑 No site authorizations found to clear",
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -23,7 +23,7 @@ export default async function clearAuthTokens(_input = {}, options = {}) {
|
|
|
23
23
|
|
|
24
24
|
if (siteHostnames.length === 0) {
|
|
25
25
|
return {
|
|
26
|
-
message: "No site authorizations found to clear",
|
|
26
|
+
message: "🔑 No site authorizations found to clear",
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -58,7 +58,7 @@ export default async function clearAuthTokens(_input = {}, options = {}) {
|
|
|
58
58
|
|
|
59
59
|
if (selectedSites.length === 0) {
|
|
60
60
|
return {
|
|
61
|
-
message: "No sites selected for clearing authorization",
|
|
61
|
+
message: "🔑 No sites selected for clearing authorization",
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
|
|
@@ -68,7 +68,7 @@ export default async function clearAuthTokens(_input = {}, options = {}) {
|
|
|
68
68
|
if (selectedSites.includes("__ALL__")) {
|
|
69
69
|
// Clear all site authorizations
|
|
70
70
|
await writeFile(DOC_SMITH_ENV_FILE, stringify({}));
|
|
71
|
-
results.push(
|
|
71
|
+
results.push(`✔ Cleared site authorization for all sites (${siteHostnames.length} sites)`);
|
|
72
72
|
clearedCount = siteHostnames.length;
|
|
73
73
|
} else {
|
|
74
74
|
// Clear site authorizations for selected sites
|
|
@@ -79,7 +79,7 @@ export default async function clearAuthTokens(_input = {}, options = {}) {
|
|
|
79
79
|
// Remove the entire site object
|
|
80
80
|
delete updatedEnvs[hostname];
|
|
81
81
|
|
|
82
|
-
results.push(
|
|
82
|
+
results.push(`✔ Cleared site authorization for ${chalk.cyan(hostname)}`);
|
|
83
83
|
clearedCount++;
|
|
84
84
|
}
|
|
85
85
|
}
|
|
@@ -87,8 +87,8 @@ export default async function clearAuthTokens(_input = {}, options = {}) {
|
|
|
87
87
|
await writeFile(DOC_SMITH_ENV_FILE, stringify(updatedEnvs));
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
const header =
|
|
91
|
-
const detailLines = results.join("\n");
|
|
90
|
+
const header = `🔑 Successfully cleared site authorizations!`;
|
|
91
|
+
const detailLines = results.map((item) => ` ${item}`).join("\n");
|
|
92
92
|
|
|
93
93
|
const message = [header, "", detailLines, ""].filter(Boolean).join("\n");
|
|
94
94
|
|
|
@@ -99,7 +99,7 @@ export default async function clearAuthTokens(_input = {}, options = {}) {
|
|
|
99
99
|
};
|
|
100
100
|
} catch (error) {
|
|
101
101
|
return {
|
|
102
|
-
message:
|
|
102
|
+
message: `⚠️ Failed to clear site authorizations: ${error.message}`,
|
|
103
103
|
error: true,
|
|
104
104
|
};
|
|
105
105
|
}
|
|
@@ -36,12 +36,12 @@ export default async function clearDeploymentConfig(input = {}) {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
return {
|
|
39
|
-
message:
|
|
39
|
+
message: `📦 Cleared appUrl from config file (${displayPath})`,
|
|
40
40
|
};
|
|
41
41
|
} catch (error) {
|
|
42
42
|
return {
|
|
43
43
|
error: true,
|
|
44
|
-
message:
|
|
44
|
+
message: `⚠️ Failed to clear deployment config: ${error.message}`,
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -10,8 +10,8 @@ export default async function clearDocumentConfig({ workDir }) {
|
|
|
10
10
|
await rm(documentConfigPath, { recursive: true, force: true });
|
|
11
11
|
|
|
12
12
|
const message = existed
|
|
13
|
-
?
|
|
14
|
-
:
|
|
13
|
+
? `⚙️ Cleared document configuration (${displayPath})`
|
|
14
|
+
: `⚙️ Document configuration already empty (${displayPath})`;
|
|
15
15
|
|
|
16
16
|
const suggestions = existed
|
|
17
17
|
? ["Run `aigne doc init` to generate a fresh configuration file."]
|
|
@@ -25,7 +25,7 @@ export default async function clearDocumentConfig({ workDir }) {
|
|
|
25
25
|
};
|
|
26
26
|
} catch (error) {
|
|
27
27
|
return {
|
|
28
|
-
message:
|
|
28
|
+
message: `⚠️ Failed to clear document configuration: ${error.message}`,
|
|
29
29
|
error: true,
|
|
30
30
|
path: displayPath,
|
|
31
31
|
};
|
|
@@ -16,8 +16,8 @@ export default async function clearDocumentStructure(input = {}, _options = {})
|
|
|
16
16
|
|
|
17
17
|
const structureDisplayPath = toDisplayPath(structurePlanPath);
|
|
18
18
|
const structureMessage = structureExists
|
|
19
|
-
?
|
|
20
|
-
:
|
|
19
|
+
? `✔ Cleared documentation structure (${structureDisplayPath})`
|
|
20
|
+
: `• Documentation structure already empty (${structureDisplayPath})`;
|
|
21
21
|
|
|
22
22
|
results.push({
|
|
23
23
|
type: "structure",
|
|
@@ -29,7 +29,7 @@ export default async function clearDocumentStructure(input = {}, _options = {})
|
|
|
29
29
|
results.push({
|
|
30
30
|
type: "structure",
|
|
31
31
|
error: true,
|
|
32
|
-
message:
|
|
32
|
+
message: `✗ Failed to clear documentation structure: ${error.message}`,
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -41,8 +41,8 @@ export default async function clearDocumentStructure(input = {}, _options = {})
|
|
|
41
41
|
|
|
42
42
|
const docsDisplayPath = toDisplayPath(docsDir);
|
|
43
43
|
const docsMessage = docsExists
|
|
44
|
-
?
|
|
45
|
-
:
|
|
44
|
+
? `✔ Cleared documents directory (${docsDisplayPath})`
|
|
45
|
+
: `• Documents directory already empty (${docsDisplayPath})`;
|
|
46
46
|
|
|
47
47
|
results.push({
|
|
48
48
|
type: "documents",
|
|
@@ -54,7 +54,7 @@ export default async function clearDocumentStructure(input = {}, _options = {})
|
|
|
54
54
|
results.push({
|
|
55
55
|
type: "documents",
|
|
56
56
|
error: true,
|
|
57
|
-
message:
|
|
57
|
+
message: `✗ Failed to clear documents directory: ${error.message}`,
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
60
|
}
|
|
@@ -65,14 +65,14 @@ export default async function clearDocumentStructure(input = {}, _options = {})
|
|
|
65
65
|
|
|
66
66
|
let header;
|
|
67
67
|
if (errorItems > 0) {
|
|
68
|
-
header = "Documentation Structure cleanup finished with some issues.";
|
|
68
|
+
header = "⚠️ Documentation Structure cleanup finished with some issues.";
|
|
69
69
|
} else if (clearedItems > 0) {
|
|
70
|
-
header = "Documentation Structure cleared successfully!";
|
|
70
|
+
header = "📖 Documentation Structure cleared successfully!";
|
|
71
71
|
} else {
|
|
72
|
-
header = "Documentation Structure already empty.";
|
|
72
|
+
header = "📖 Documentation Structure already empty.";
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
const detailLines = results.map((item) =>
|
|
75
|
+
const detailLines = results.map((item) => ` ${item.message}`).join("\n");
|
|
76
76
|
const message = [header, "", detailLines].filter(Boolean).join("\n");
|
|
77
77
|
|
|
78
78
|
return {
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { rm } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
2
3
|
import { pathExists, resolveToAbsolute, toDisplayPath } from "../../utils/file-utils.mjs";
|
|
4
|
+
import {
|
|
5
|
+
pathToFlatName,
|
|
6
|
+
generateFileName,
|
|
7
|
+
loadDocumentStructure,
|
|
8
|
+
} from "../../utils/docs-finder-utils.mjs";
|
|
9
|
+
import chooseDocs from "../utils/choose-docs.mjs";
|
|
3
10
|
|
|
4
|
-
export default async function clearGeneratedDocs(input = {},
|
|
5
|
-
const { docsDir } = input;
|
|
11
|
+
export default async function clearGeneratedDocs(input = {}, options = {}) {
|
|
12
|
+
const { docsDir, outputDir, locale, translateLanguages } = input;
|
|
6
13
|
|
|
7
14
|
if (!docsDir) {
|
|
8
15
|
return {
|
|
9
|
-
message: "No generated documents directory specified",
|
|
16
|
+
message: "📁 No generated documents directory specified",
|
|
10
17
|
};
|
|
11
18
|
}
|
|
12
19
|
|
|
@@ -14,23 +21,104 @@ export default async function clearGeneratedDocs(input = {}, _options = {}) {
|
|
|
14
21
|
const displayPath = toDisplayPath(generatedDocsPath);
|
|
15
22
|
|
|
16
23
|
try {
|
|
17
|
-
const
|
|
18
|
-
|
|
24
|
+
const dirExists = await pathExists(generatedDocsPath);
|
|
25
|
+
if (!dirExists) {
|
|
26
|
+
return {
|
|
27
|
+
message: `📁 Generated documents directory does not exist (${displayPath})`,
|
|
28
|
+
cleared: false,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
19
31
|
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
32
|
+
const documentExecutionStructure = (await loadDocumentStructure(outputDir)) || [];
|
|
33
|
+
// select documents interactively
|
|
34
|
+
const chooseResult = await chooseDocs(
|
|
35
|
+
{
|
|
36
|
+
docs: [], // Empty to trigger interactive selection
|
|
37
|
+
documentExecutionStructure,
|
|
38
|
+
docsDir: generatedDocsPath,
|
|
39
|
+
locale: locale || "en",
|
|
40
|
+
isTranslate: false,
|
|
41
|
+
title: "Select documents to delete:",
|
|
42
|
+
feedback: "Skip feedback",
|
|
43
|
+
requiredFeedback: false,
|
|
44
|
+
},
|
|
45
|
+
options,
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
if (!chooseResult?.selectedDocs || chooseResult.selectedDocs.length === 0) {
|
|
49
|
+
return {
|
|
50
|
+
message: "📁 No documents selected for deletion",
|
|
51
|
+
cleared: false,
|
|
52
|
+
path: displayPath,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Extract file names
|
|
57
|
+
const filesToDelete = new Set();
|
|
58
|
+
const allLanguages = [locale || "en", ...(translateLanguages || [])];
|
|
59
|
+
|
|
60
|
+
for (const selectedDoc of chooseResult.selectedDocs) {
|
|
61
|
+
// Convert path to flat filename format using utility function
|
|
62
|
+
const flatName = pathToFlatName(selectedDoc.path);
|
|
63
|
+
|
|
64
|
+
// Generate file names for all languages
|
|
65
|
+
for (const lang of allLanguages) {
|
|
66
|
+
const fileName = generateFileName(flatName, lang);
|
|
67
|
+
filesToDelete.add(fileName);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (filesToDelete.size === 0) {
|
|
72
|
+
return {
|
|
73
|
+
message: "📁 No documents were deleted.",
|
|
74
|
+
cleared: false,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Delete selected files (including all language versions)
|
|
79
|
+
const deletedFiles = [];
|
|
80
|
+
const failedFiles = [];
|
|
81
|
+
let hasError = false;
|
|
82
|
+
|
|
83
|
+
for (const file of filesToDelete) {
|
|
84
|
+
try {
|
|
85
|
+
const filePath = join(generatedDocsPath, file);
|
|
86
|
+
await rm(filePath, { force: true });
|
|
87
|
+
deletedFiles.push(file);
|
|
88
|
+
} catch (error) {
|
|
89
|
+
hasError = true;
|
|
90
|
+
failedFiles.push({ file, error: error.message });
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Build result message
|
|
95
|
+
const deletedCount = deletedFiles.length;
|
|
96
|
+
const failedCount = failedFiles.length;
|
|
97
|
+
|
|
98
|
+
let message = "";
|
|
99
|
+
if (deletedCount > 0) {
|
|
100
|
+
const lastIndex = deletedFiles.length - 1;
|
|
101
|
+
message = `📁 Deleted ${deletedCount} document(s) in "${displayPath}":\n${deletedFiles
|
|
102
|
+
.map((f, i) => ` ${i === lastIndex ? "└─" : "├─"} ${f}`)
|
|
103
|
+
.join("\n")}`;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (failedCount > 0) {
|
|
107
|
+
const lastIndex = failedFiles.length - 1;
|
|
108
|
+
message = `⚠️ Failed to delete ${failedCount} document(s) in "${displayPath}":\n${failedFiles
|
|
109
|
+
.map((f, i) => ` ${i === lastIndex ? "└─" : "├─"} ${f.file}: ${f.error}`)
|
|
110
|
+
.join("\n")}`;
|
|
111
|
+
}
|
|
23
112
|
|
|
24
113
|
return {
|
|
25
114
|
message,
|
|
26
|
-
cleared:
|
|
27
|
-
|
|
115
|
+
cleared: deletedCount > 0,
|
|
116
|
+
error: hasError,
|
|
28
117
|
};
|
|
29
118
|
} catch (error) {
|
|
30
119
|
return {
|
|
31
|
-
message:
|
|
120
|
+
message: `⚠️ Failed to clear generated documents: ${error.message}`,
|
|
32
121
|
error: true,
|
|
33
|
-
path: displayPath,
|
|
34
122
|
};
|
|
35
123
|
}
|
|
36
124
|
}
|
|
@@ -46,5 +134,6 @@ clearGeneratedDocs.input_schema = {
|
|
|
46
134
|
required: ["docsDir"],
|
|
47
135
|
};
|
|
48
136
|
|
|
49
|
-
clearGeneratedDocs.taskTitle = "Clear
|
|
50
|
-
clearGeneratedDocs.description =
|
|
137
|
+
clearGeneratedDocs.taskTitle = "Clear generated documents";
|
|
138
|
+
clearGeneratedDocs.description =
|
|
139
|
+
"Select and delete specific generated documents from the docs directory";
|
|
@@ -11,7 +11,7 @@ export default async function clearMediaDescription(_input = {}, options = {}) {
|
|
|
11
11
|
// Check if the cache file exists
|
|
12
12
|
if (!existsSync(cacheFilePath)) {
|
|
13
13
|
return {
|
|
14
|
-
message: "No media descriptions found to clear",
|
|
14
|
+
message: "🖼️ No media descriptions found to clear",
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -26,7 +26,7 @@ export default async function clearMediaDescription(_input = {}, options = {}) {
|
|
|
26
26
|
|
|
27
27
|
if (mediaHashes.length === 0) {
|
|
28
28
|
return {
|
|
29
|
-
message: "No media descriptions found to clear",
|
|
29
|
+
message: "🖼️ No media descriptions found to clear",
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -68,7 +68,7 @@ export default async function clearMediaDescription(_input = {}, options = {}) {
|
|
|
68
68
|
|
|
69
69
|
if (selectedHashes.length === 0) {
|
|
70
70
|
return {
|
|
71
|
-
message: "No media files selected for clearing descriptions",
|
|
71
|
+
message: "🖼️ No media files selected for clearing descriptions",
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
74
|
|
|
@@ -84,7 +84,7 @@ export default async function clearMediaDescription(_input = {}, options = {}) {
|
|
|
84
84
|
lastUpdated: new Date().toISOString(),
|
|
85
85
|
}),
|
|
86
86
|
);
|
|
87
|
-
results.push(
|
|
87
|
+
results.push(`✔ Cleared descriptions for all media files (${mediaHashes.length} files)`);
|
|
88
88
|
clearedCount = mediaHashes.length;
|
|
89
89
|
} else {
|
|
90
90
|
// Clear descriptions for selected files
|
|
@@ -94,7 +94,7 @@ export default async function clearMediaDescription(_input = {}, options = {}) {
|
|
|
94
94
|
if (updatedCache[hash]) {
|
|
95
95
|
const filename = path.basename(updatedCache[hash].path);
|
|
96
96
|
delete updatedCache[hash];
|
|
97
|
-
results.push(
|
|
97
|
+
results.push(`✔ Cleared description for ${chalk.cyan(filename)}`);
|
|
98
98
|
clearedCount++;
|
|
99
99
|
}
|
|
100
100
|
}
|
|
@@ -108,8 +108,8 @@ export default async function clearMediaDescription(_input = {}, options = {}) {
|
|
|
108
108
|
);
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
const header =
|
|
112
|
-
const detailLines = results.join("\n");
|
|
111
|
+
const header = `🖼️ Successfully cleared media descriptions`;
|
|
112
|
+
const detailLines = results.map((item) => ` ${item}`).join("\n");
|
|
113
113
|
|
|
114
114
|
const message = [header, "", detailLines, ""].filter(Boolean).join("\n");
|
|
115
115
|
|
|
@@ -2,7 +2,9 @@ name: evaluateDocumentStructure
|
|
|
2
2
|
description: Evaluates the results generated by the document-structure agent to ensure they meet expectations, especially in scenarios with previous generation results and user feedback.
|
|
3
3
|
instructions:
|
|
4
4
|
url: ../../prompts/evaluate/document-structure.md
|
|
5
|
-
model:
|
|
5
|
+
model:
|
|
6
|
+
model: openai/gpt-5
|
|
7
|
+
temperature: 1
|
|
6
8
|
# model: anthropic/claude-opus-4-0
|
|
7
9
|
task_render_mode: collapse
|
|
8
10
|
task_title: Evaluate the structure of the documentation
|
|
@@ -2,7 +2,9 @@ name: evaluateDocument
|
|
|
2
2
|
description: Evaluates the quality of generated document content, ensuring compliance with user-configured goals, audiences, and knowledge level requirements.
|
|
3
3
|
instructions:
|
|
4
4
|
url: ../../prompts/evaluate/document.md
|
|
5
|
-
model:
|
|
5
|
+
model:
|
|
6
|
+
model: openai/gpt-5
|
|
7
|
+
temperature: 1
|
|
6
8
|
# model: anthropic/claude-opus-4-0
|
|
7
9
|
task_render_mode: collapse
|
|
8
10
|
task_title: Evaluate document for '{{ title }}'
|
|
@@ -3,7 +3,7 @@ import { getActiveRulesForScope } from "../../utils/preferences-utils.mjs";
|
|
|
3
3
|
import { getProjectInfo, loadConfigFromFile, saveValueToConfig } from "../../utils/utils.mjs";
|
|
4
4
|
|
|
5
5
|
export default async function checkNeedGenerateStructure(
|
|
6
|
-
{ originalDocumentStructure, forceRegenerate,
|
|
6
|
+
{ originalDocumentStructure, forceRegenerate, ...rest },
|
|
7
7
|
options,
|
|
8
8
|
) {
|
|
9
9
|
// Check if originalDocumentStructure is empty and prompt user
|
|
@@ -53,11 +53,7 @@ export default async function checkNeedGenerateStructure(
|
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
// Only use tools when the context is very large.
|
|
58
|
-
const generateStructureAgent = isLargeContext
|
|
59
|
-
? options.context.agents["generateStructure"]
|
|
60
|
-
: options.context.agents["generateStructureWithoutTools"];
|
|
56
|
+
const generateStructureAgent = options.context.agents["generateStructure"];
|
|
61
57
|
|
|
62
58
|
const structureRules = getActiveRulesForScope("structure", []);
|
|
63
59
|
const globalRules = getActiveRulesForScope("global", []);
|
|
@@ -72,7 +68,6 @@ export default async function checkNeedGenerateStructure(
|
|
|
72
68
|
originalDocumentStructure,
|
|
73
69
|
userPreferences,
|
|
74
70
|
feedback: finalFeedback || "",
|
|
75
|
-
isLargeContext,
|
|
76
71
|
});
|
|
77
72
|
|
|
78
73
|
let message = "";
|
|
@@ -11,6 +11,10 @@ input_schema:
|
|
|
11
11
|
documentContent:
|
|
12
12
|
type: string
|
|
13
13
|
description: The **raw text content** of the current document. (**Note:** This is the original document and **does not include** any diagram source code.)
|
|
14
|
+
locale:
|
|
15
|
+
type: string
|
|
16
|
+
description: Language for diagram labels and text
|
|
17
|
+
default: en
|
|
14
18
|
required:
|
|
15
19
|
- documentContent
|
|
16
20
|
output_schema:
|