@aigne/doc-smith 0.8.15-beta.1 → 0.8.15-beta.11

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.
Files changed (89) hide show
  1. package/CHANGELOG.md +89 -0
  2. package/agents/clear/choose-contents.mjs +4 -4
  3. package/agents/clear/clear-auth-tokens.mjs +8 -8
  4. package/agents/clear/clear-deployment-config.mjs +2 -2
  5. package/agents/clear/clear-document-config.mjs +3 -3
  6. package/agents/clear/clear-document-structure.mjs +10 -10
  7. package/agents/clear/clear-generated-docs.mjs +103 -14
  8. package/agents/clear/clear-media-description.mjs +7 -7
  9. package/agents/evaluate/document-structure.yaml +3 -1
  10. package/agents/evaluate/document.yaml +3 -1
  11. package/agents/evaluate/index.yaml +1 -3
  12. package/agents/generate/check-diagram.mjs +1 -1
  13. package/agents/generate/check-need-generate-structure.mjs +2 -7
  14. package/agents/generate/draw-diagram.yaml +4 -0
  15. package/agents/generate/generate-structure.yaml +117 -65
  16. package/agents/generate/index.yaml +3 -3
  17. package/agents/generate/{merge-d2-diagram.yaml → merge-diagram.yaml} +7 -6
  18. package/agents/generate/update-document-structure.yaml +1 -1
  19. package/agents/generate/user-review-document-structure.mjs +3 -25
  20. package/agents/generate/utils/merge-document-structures.mjs +30 -0
  21. package/agents/init/check.mjs +4 -2
  22. package/agents/init/index.mjs +37 -7
  23. package/agents/media/load-media-description.mjs +12 -24
  24. package/agents/publish/publish-docs.mjs +3 -8
  25. package/agents/schema/document-execution-structure.yaml +1 -1
  26. package/agents/schema/document-structure-item.yaml +23 -0
  27. package/agents/schema/document-structure-refine-item.yaml +20 -0
  28. package/agents/schema/document-structure.yaml +1 -1
  29. package/agents/translate/index.yaml +1 -4
  30. package/agents/translate/record-translation-history.mjs +6 -2
  31. package/agents/translate/translate-multilingual.yaml +1 -1
  32. package/agents/update/batch-generate-document.yaml +1 -1
  33. package/agents/update/batch-update-document.yaml +1 -1
  34. package/agents/update/check-document.mjs +35 -13
  35. package/agents/update/check-generate-diagram.mjs +29 -0
  36. package/agents/update/generate-diagram.yaml +29 -0
  37. package/agents/update/generate-document.yaml +17 -30
  38. package/agents/update/handle-document-update.yaml +10 -1
  39. package/agents/update/save-and-translate-document.mjs +18 -47
  40. package/agents/update/update-document-detail.yaml +2 -1
  41. package/agents/update/update-single-document.yaml +1 -1
  42. package/agents/update/user-review-document.mjs +6 -5
  43. package/agents/utils/choose-docs.mjs +16 -5
  44. package/agents/utils/find-item-by-path.mjs +4 -2
  45. package/agents/utils/load-sources.mjs +63 -46
  46. package/agents/utils/{save-docs.mjs → post-generate.mjs} +2 -51
  47. package/agents/utils/save-doc-translation.mjs +27 -0
  48. package/agents/utils/{save-single-doc.mjs → save-doc.mjs} +17 -12
  49. package/agents/utils/save-sidebar.mjs +38 -0
  50. package/agents/utils/{transform-detail-datasources.mjs → transform-detail-data-sources.mjs} +7 -7
  51. package/aigne.yaml +16 -8
  52. package/package.json +3 -1
  53. package/prompts/common/document/content-rules-core.md +6 -6
  54. package/prompts/common/document/media-file-list-usage-rules.md +12 -0
  55. package/prompts/common/document/openapi-usage-rules.md +36 -0
  56. package/prompts/common/document/role-and-personality.md +1 -2
  57. package/prompts/common/document-structure/conflict-resolution-guidance.md +2 -2
  58. package/prompts/common/document-structure/document-structure-rules.md +8 -8
  59. package/prompts/common/document-structure/output-constraints.md +3 -3
  60. package/prompts/detail/custom/custom-components.md +38 -3
  61. package/prompts/detail/d2-diagram/rules.md +11 -14
  62. package/prompts/detail/d2-diagram/system-prompt.md +0 -14
  63. package/prompts/detail/d2-diagram/user-prompt.md +39 -0
  64. package/prompts/detail/generate/document-rules.md +3 -3
  65. package/prompts/detail/generate/system-prompt.md +2 -6
  66. package/prompts/detail/generate/user-prompt.md +20 -61
  67. package/prompts/detail/update/system-prompt.md +2 -6
  68. package/prompts/detail/update/user-prompt.md +7 -6
  69. package/prompts/evaluate/document.md +0 -4
  70. package/prompts/structure/check-document-structure.md +4 -4
  71. package/prompts/structure/generate/system-prompt.md +0 -31
  72. package/prompts/structure/generate/user-prompt.md +73 -29
  73. package/prompts/structure/review/structure-review-system.md +81 -0
  74. package/prompts/structure/update/system-prompt.md +1 -1
  75. package/prompts/structure/update/user-prompt.md +4 -4
  76. package/prompts/translate/code-block.md +13 -3
  77. package/prompts/translate/translate-document.md +3 -3
  78. package/types/document-structure-schema.mjs +3 -3
  79. package/utils/constants/index.mjs +6 -0
  80. package/utils/docs-finder-utils.mjs +85 -3
  81. package/utils/extract-api.mjs +32 -0
  82. package/utils/file-utils.mjs +153 -101
  83. package/utils/history-utils.mjs +20 -8
  84. package/utils/load-config.mjs +20 -1
  85. package/utils/markdown-checker.mjs +35 -1
  86. package/utils/utils.mjs +67 -65
  87. package/agents/generate/document-structure-tools/generate-sub-structure.mjs +0 -131
  88. package/agents/generate/generate-structure-without-tools.yaml +0 -65
  89. package/prompts/common/document/media-handling-rules.md +0 -9
package/CHANGELOG.md CHANGED
@@ -1,5 +1,94 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.8.15-beta.11](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.15-beta.10...v0.8.15-beta.11) (2025-11-04)
4
+
5
+
6
+ ### Features
7
+
8
+ * warn on invalid sources and tuning translate messages ([#241](https://github.com/AIGNE-io/aigne-doc-smith/issues/241)) ([bd786ca](https://github.com/AIGNE-io/aigne-doc-smith/commit/bd786cad8b0c6fa837511fdc2982c83b7f0095dd))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * avoid useless diagram generate ([#245](https://github.com/AIGNE-io/aigne-doc-smith/issues/245)) ([de7600f](https://github.com/AIGNE-io/aigne-doc-smith/commit/de7600fb5839be9d1f0743adc34fd08c4c11729d))
14
+ * iterate on chunk of datasource to generate structure ([#242](https://github.com/AIGNE-io/aigne-doc-smith/issues/242)) ([0b4db2a](https://github.com/AIGNE-io/aigne-doc-smith/commit/0b4db2a8cac77d6f4a1c197374b9dadbe078346b))
15
+
16
+ ## [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)
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * 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))
22
+ * 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))
23
+
24
+ ## [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)
25
+
26
+
27
+ ### Bug Fixes
28
+
29
+ * 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))
30
+ * 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))
31
+
32
+ ## [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)
33
+
34
+
35
+ ### Features
36
+
37
+ * 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))
38
+
39
+ ## [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)
40
+
41
+
42
+ ### Features
43
+
44
+ * 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))
45
+ * 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))
46
+
47
+
48
+ ### Bug Fixes
49
+
50
+ * 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))
51
+
52
+ ## [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)
53
+
54
+
55
+ ### Bug Fixes
56
+
57
+ * 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))
58
+
59
+ ## [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)
60
+
61
+
62
+ ### Bug Fixes
63
+
64
+ * 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))
65
+
66
+ ## [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)
67
+
68
+
69
+ ### Bug Fixes
70
+
71
+ * 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))
72
+
73
+ ## [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)
74
+
75
+
76
+ ### Features
77
+
78
+ * 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))
79
+
80
+
81
+ ### Bug Fixes
82
+
83
+ * 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))
84
+
85
+ ## [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)
86
+
87
+
88
+ ### Bug Fixes
89
+
90
+ * 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))
91
+
3
92
  ## [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)
4
93
 
5
94
 
@@ -10,7 +10,7 @@ const TARGET_METADATA = {
10
10
  generatedDocs: {
11
11
  label: "Generated Documents",
12
12
  description: ({ docsDir }) =>
13
- `Delete all generated documents in './${toDisplayPath(docsDir)}'. The documentation structure will be preserved.`,
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) => `- ${item.message}`).join("\n");
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(`Cleared site authorization for all sites (${siteHostnames.length} sites)`);
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(`Cleared site authorization for ${chalk.cyan(hostname)}`);
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 = `Successfully cleared site authorizations!`;
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: `Failed to clear site authorizations: ${error.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: `🧹 Cleared appUrl from config file (${displayPath})`,
39
+ message: `📦 Cleared appUrl from config file (${displayPath})`,
40
40
  };
41
41
  } catch (error) {
42
42
  return {
43
43
  error: true,
44
- message: `❌ Failed to clear deployment config: ${error.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
- ? `Cleared document configuration (${displayPath})`
14
- : `Document configuration already empty (${displayPath})`;
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: `Failed to clear document configuration: ${error.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
- ? `Cleared documentation structure (${structureDisplayPath})`
20
- : `Documentation structure already empty (${structureDisplayPath})`;
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: `Failed to clear documentation structure: ${error.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
- ? `Cleared documents directory (${docsDisplayPath})`
45
- : `Documents directory already empty (${docsDisplayPath})`;
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: `Failed to clear documents directory: ${error.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) => `- ${item.message}`).join("\n");
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 = {}, _options = {}) {
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 existed = await pathExists(generatedDocsPath);
18
- await rm(generatedDocsPath, { recursive: true, force: true });
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 message = existed
21
- ? `Cleared generated documents (${displayPath})`
22
- : `Generated documents already empty (${displayPath})`;
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: existed,
27
- path: displayPath,
115
+ cleared: deletedCount > 0,
116
+ error: hasError,
28
117
  };
29
118
  } catch (error) {
30
119
  return {
31
- message: `Failed to clear generated documents: ${error.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 all generated documents";
50
- clearGeneratedDocs.description = "Clear the generated documents directory";
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(`Cleared descriptions for all media files (${mediaHashes.length} files)`);
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(`Cleared description for ${chalk.cyan(filename)}`);
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 = `✨ Successfully cleared media descriptions`;
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: openai/gpt-5
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: openai/gpt-5
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 }}'
@@ -16,9 +16,7 @@ skills:
16
16
  $merge([
17
17
  $,
18
18
  {
19
- "documentStructure": originalDocumentStructure,
20
- "datasources": "",
21
- "datasourcesList": ""
19
+ "documentStructure": originalDocumentStructure
22
20
  }
23
21
  ])
24
22
  - ./document-structure.yaml
@@ -9,7 +9,7 @@ export default async function checkD2DiagramIsValid({ diagramSourceCode }) {
9
9
  } catch (err) {
10
10
  return {
11
11
  isValid: false,
12
- error: err.message,
12
+ diagramError: err.message,
13
13
  };
14
14
  }
15
15
  }
@@ -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, isLargeContext, ...rest },
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
- // Performance optimization: Using both structured output and tools with the Gemini model can cause redundant calls.
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: