@aigne/doc-smith 0.9.8-alpha.3 → 0.9.8-alpha.4

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 (257) hide show
  1. package/CLAUDE.md +43 -0
  2. package/README.md +94 -250
  3. package/aigne.yaml +2 -149
  4. package/doc-smith/SKILL.md +117 -0
  5. package/doc-smith/references/changeset_schema.md +118 -0
  6. package/doc-smith/references/document_structure_schema.md +139 -0
  7. package/doc-smith/references/document_update_guide.md +193 -0
  8. package/doc-smith/references/structure_confirmation_guide.md +133 -0
  9. package/doc-smith/references/structure_planning_guide.md +146 -0
  10. package/doc-smith/references/user_intent_guide.md +172 -0
  11. package/doc-smith.yaml +114 -0
  12. package/main-system-prompt.md +56 -0
  13. package/package.json +3 -69
  14. package/scripts/README.md +90 -0
  15. package/scripts/install.sh +86 -0
  16. package/scripts/uninstall.sh +52 -0
  17. package/CHANGELOG.md +0 -994
  18. package/LICENSE +0 -93
  19. package/agentic-agents/common/base-info.md +0 -53
  20. package/agentic-agents/common/completer.md +0 -54
  21. package/agentic-agents/common/planner.md +0 -168
  22. package/agentic-agents/common/worker.md +0 -93
  23. package/agentic-agents/create/index.yaml +0 -129
  24. package/agentic-agents/create/objective.md +0 -44
  25. package/agentic-agents/create/set-custom-prompt.mjs +0 -27
  26. package/agentic-agents/detail/index.yaml +0 -95
  27. package/agentic-agents/detail/objective.md +0 -9
  28. package/agentic-agents/detail/set-custom-prompt.mjs +0 -88
  29. package/agentic-agents/predict-resources/index.yaml +0 -44
  30. package/agentic-agents/predict-resources/instructions.md +0 -61
  31. package/agentic-agents/structure/design-rules.md +0 -39
  32. package/agentic-agents/structure/index.yaml +0 -86
  33. package/agentic-agents/structure/objective.md +0 -14
  34. package/agentic-agents/structure/review-criteria.md +0 -55
  35. package/agentic-agents/structure/set-custom-prompt.mjs +0 -78
  36. package/agentic-agents/utils/init-workspace-cache.mjs +0 -171
  37. package/agentic-agents/utils/load-base-sources.mjs +0 -20
  38. package/agentic-agents/workspace-cache-sharing-design.md +0 -671
  39. package/agents/chat/chat-system.md +0 -38
  40. package/agents/chat/index.mjs +0 -59
  41. package/agents/chat/skills/generate-document.yaml +0 -15
  42. package/agents/chat/skills/list-documents.mjs +0 -15
  43. package/agents/chat/skills/update-document.yaml +0 -24
  44. package/agents/clear/choose-contents.mjs +0 -192
  45. package/agents/clear/clear-auth-tokens.mjs +0 -88
  46. package/agents/clear/clear-deployment-config.mjs +0 -49
  47. package/agents/clear/clear-document-config.mjs +0 -36
  48. package/agents/clear/clear-document-structure.mjs +0 -102
  49. package/agents/clear/clear-generated-docs.mjs +0 -142
  50. package/agents/clear/clear-media-description.mjs +0 -129
  51. package/agents/clear/index.yaml +0 -26
  52. package/agents/create/analyze-diagram-type-llm.yaml +0 -160
  53. package/agents/create/analyze-diagram-type.mjs +0 -297
  54. package/agents/create/check-document-structure.yaml +0 -30
  55. package/agents/create/check-need-generate-structure.mjs +0 -105
  56. package/agents/create/document-structure-tools/add-document.mjs +0 -85
  57. package/agents/create/document-structure-tools/delete-document.mjs +0 -116
  58. package/agents/create/document-structure-tools/move-document.mjs +0 -109
  59. package/agents/create/document-structure-tools/update-document.mjs +0 -84
  60. package/agents/create/generate-diagram-image.yaml +0 -60
  61. package/agents/create/generate-structure.yaml +0 -117
  62. package/agents/create/index.yaml +0 -49
  63. package/agents/create/refine-document-structure.yaml +0 -12
  64. package/agents/create/replace-d2-with-image.mjs +0 -625
  65. package/agents/create/update-document-structure.yaml +0 -54
  66. package/agents/create/user-add-document/add-documents-to-structure.mjs +0 -90
  67. package/agents/create/user-add-document/find-documents-to-add-links.yaml +0 -47
  68. package/agents/create/user-add-document/index.yaml +0 -46
  69. package/agents/create/user-add-document/prepare-documents-to-translate.mjs +0 -22
  70. package/agents/create/user-add-document/print-add-document-summary.mjs +0 -63
  71. package/agents/create/user-add-document/review-documents-with-new-links.mjs +0 -110
  72. package/agents/create/user-remove-document/find-documents-with-invalid-links.mjs +0 -78
  73. package/agents/create/user-remove-document/index.yaml +0 -40
  74. package/agents/create/user-remove-document/prepare-documents-to-translate.mjs +0 -22
  75. package/agents/create/user-remove-document/print-remove-document-summary.mjs +0 -53
  76. package/agents/create/user-remove-document/remove-documents-from-structure.mjs +0 -99
  77. package/agents/create/user-remove-document/review-documents-with-invalid-links.mjs +0 -115
  78. package/agents/create/user-review-document-structure.mjs +0 -140
  79. package/agents/create/utils/init-current-content.mjs +0 -34
  80. package/agents/create/utils/merge-document-structures.mjs +0 -30
  81. package/agents/evaluate/code-snippet.mjs +0 -97
  82. package/agents/evaluate/document-structure.yaml +0 -67
  83. package/agents/evaluate/document.yaml +0 -82
  84. package/agents/evaluate/generate-report.mjs +0 -85
  85. package/agents/evaluate/index.yaml +0 -46
  86. package/agents/history/index.yaml +0 -6
  87. package/agents/history/view.mjs +0 -78
  88. package/agents/init/check.mjs +0 -16
  89. package/agents/init/index.mjs +0 -275
  90. package/agents/init/validate.mjs +0 -16
  91. package/agents/localize/choose-language.mjs +0 -107
  92. package/agents/localize/index.yaml +0 -58
  93. package/agents/localize/record-translation-history.mjs +0 -23
  94. package/agents/localize/translate-document.yaml +0 -24
  95. package/agents/localize/translate-multilingual.yaml +0 -51
  96. package/agents/media/batch-generate-media-description.yaml +0 -46
  97. package/agents/media/generate-media-description.yaml +0 -50
  98. package/agents/media/load-media-description.mjs +0 -256
  99. package/agents/prefs/index.mjs +0 -203
  100. package/agents/publish/index.yaml +0 -26
  101. package/agents/publish/publish-docs.mjs +0 -356
  102. package/agents/publish/translate-meta.mjs +0 -103
  103. package/agents/schema/document-structure-item.yaml +0 -26
  104. package/agents/schema/document-structure-refine-item.yaml +0 -23
  105. package/agents/schema/document-structure.yaml +0 -29
  106. package/agents/update/batch-generate-document.yaml +0 -27
  107. package/agents/update/batch-update-document.yaml +0 -7
  108. package/agents/update/check-diagram-flag.mjs +0 -116
  109. package/agents/update/check-document.mjs +0 -162
  110. package/agents/update/check-generate-diagram.mjs +0 -106
  111. package/agents/update/check-sync-image-flag.mjs +0 -55
  112. package/agents/update/check-update-is-single.mjs +0 -53
  113. package/agents/update/document-tools/update-document-content.mjs +0 -303
  114. package/agents/update/generate-diagram.yaml +0 -63
  115. package/agents/update/generate-document.yaml +0 -70
  116. package/agents/update/handle-document-update.yaml +0 -103
  117. package/agents/update/index.yaml +0 -79
  118. package/agents/update/pre-check-generate-diagram.yaml +0 -44
  119. package/agents/update/save-and-translate-document.mjs +0 -76
  120. package/agents/update/sync-images-and-exit.mjs +0 -148
  121. package/agents/update/update-document-detail.yaml +0 -71
  122. package/agents/update/update-single/update-single-document-detail.mjs +0 -280
  123. package/agents/update/update-single-document.yaml +0 -7
  124. package/agents/update/user-review-document.mjs +0 -272
  125. package/agents/utils/action-success.mjs +0 -16
  126. package/agents/utils/analyze-document-feedback-intent.yaml +0 -32
  127. package/agents/utils/analyze-feedback-intent.mjs +0 -136
  128. package/agents/utils/analyze-structure-feedback-intent.yaml +0 -29
  129. package/agents/utils/check-detail-result.mjs +0 -38
  130. package/agents/utils/check-feedback-refiner.mjs +0 -81
  131. package/agents/utils/choose-docs.mjs +0 -293
  132. package/agents/utils/document-icon-generate.yaml +0 -52
  133. package/agents/utils/document-title-streamline.yaml +0 -48
  134. package/agents/utils/ensure-document-icons.mjs +0 -129
  135. package/agents/utils/exit.mjs +0 -6
  136. package/agents/utils/feedback-refiner.yaml +0 -50
  137. package/agents/utils/find-item-by-path.mjs +0 -114
  138. package/agents/utils/find-user-preferences-by-path.mjs +0 -37
  139. package/agents/utils/format-document-structure.mjs +0 -35
  140. package/agents/utils/generate-document-or-skip.mjs +0 -41
  141. package/agents/utils/handle-diagram-operations.mjs +0 -263
  142. package/agents/utils/load-all-document-content.mjs +0 -30
  143. package/agents/utils/load-document-all-content.mjs +0 -84
  144. package/agents/utils/load-sources.mjs +0 -405
  145. package/agents/utils/map-reasoning-effort-level.mjs +0 -15
  146. package/agents/utils/post-generate.mjs +0 -144
  147. package/agents/utils/read-current-document-content.mjs +0 -46
  148. package/agents/utils/save-doc-translation.mjs +0 -61
  149. package/agents/utils/save-doc.mjs +0 -88
  150. package/agents/utils/save-output.mjs +0 -26
  151. package/agents/utils/save-sidebar.mjs +0 -51
  152. package/agents/utils/skip-if-content-exists.mjs +0 -27
  153. package/agents/utils/streamline-document-titles-if-needed.mjs +0 -88
  154. package/agents/utils/transform-detail-data-sources.mjs +0 -45
  155. package/agents/utils/update-branding.mjs +0 -84
  156. package/assets/report-template/report.html +0 -198
  157. package/docs-mcp/analyze-content-relevance.yaml +0 -50
  158. package/docs-mcp/analyze-docs-relevance.yaml +0 -59
  159. package/docs-mcp/docs-search.yaml +0 -42
  160. package/docs-mcp/get-docs-detail.mjs +0 -41
  161. package/docs-mcp/get-docs-structure.mjs +0 -16
  162. package/docs-mcp/read-doc-content.mjs +0 -119
  163. package/prompts/common/document/content-rules-core.md +0 -20
  164. package/prompts/common/document/markdown-syntax-rules.md +0 -65
  165. package/prompts/common/document/media-file-list-usage-rules.md +0 -18
  166. package/prompts/common/document/openapi-usage-rules.md +0 -189
  167. package/prompts/common/document/role-and-personality.md +0 -16
  168. package/prompts/common/document/user-preferences.md +0 -9
  169. package/prompts/common/document-structure/conflict-resolution-guidance.md +0 -16
  170. package/prompts/common/document-structure/document-icon-generate.md +0 -116
  171. package/prompts/common/document-structure/document-structure-rules.md +0 -43
  172. package/prompts/common/document-structure/document-title-streamline.md +0 -86
  173. package/prompts/common/document-structure/glossary.md +0 -7
  174. package/prompts/common/document-structure/intj-traits.md +0 -5
  175. package/prompts/common/document-structure/openapi-usage-rules.md +0 -28
  176. package/prompts/common/document-structure/output-constraints.md +0 -18
  177. package/prompts/common/document-structure/user-locale-rules.md +0 -10
  178. package/prompts/common/document-structure/user-preferences.md +0 -9
  179. package/prompts/detail/custom/admonition-usage-rules.md +0 -94
  180. package/prompts/detail/custom/code-block-usage-rules.md +0 -163
  181. package/prompts/detail/custom/custom-components/x-card-usage-rules.md +0 -63
  182. package/prompts/detail/custom/custom-components/x-cards-usage-rules.md +0 -83
  183. package/prompts/detail/custom/custom-components/x-field-desc-usage-rules.md +0 -120
  184. package/prompts/detail/custom/custom-components/x-field-group-usage-rules.md +0 -80
  185. package/prompts/detail/custom/custom-components/x-field-usage-rules.md +0 -189
  186. package/prompts/detail/custom/custom-components-usage-rules.md +0 -18
  187. package/prompts/detail/diagram/generate-image-system.md +0 -135
  188. package/prompts/detail/diagram/generate-image-user.md +0 -32
  189. package/prompts/detail/diagram/guide.md +0 -29
  190. package/prompts/detail/diagram/official-examples.md +0 -712
  191. package/prompts/detail/diagram/pre-check.md +0 -23
  192. package/prompts/detail/diagram/role-and-personality.md +0 -2
  193. package/prompts/detail/diagram/rules.md +0 -46
  194. package/prompts/detail/diagram/system-prompt.md +0 -1139
  195. package/prompts/detail/diagram/user-prompt.md +0 -43
  196. package/prompts/detail/generate/detail-example.md +0 -457
  197. package/prompts/detail/generate/document-rules.md +0 -45
  198. package/prompts/detail/generate/system-prompt.md +0 -61
  199. package/prompts/detail/generate/user-prompt.md +0 -99
  200. package/prompts/detail/jsx/rules.md +0 -6
  201. package/prompts/detail/update/system-prompt.md +0 -121
  202. package/prompts/detail/update/user-prompt.md +0 -41
  203. package/prompts/evaluate/document-structure.md +0 -93
  204. package/prompts/evaluate/document.md +0 -149
  205. package/prompts/media/media-description/system-prompt.md +0 -43
  206. package/prompts/media/media-description/user-prompt.md +0 -17
  207. package/prompts/structure/check-document-structure.md +0 -93
  208. package/prompts/structure/document-rules.md +0 -21
  209. package/prompts/structure/find-documents-to-add-links.md +0 -52
  210. package/prompts/structure/generate/system-prompt.md +0 -13
  211. package/prompts/structure/generate/user-prompt.md +0 -137
  212. package/prompts/structure/review/structure-review-system.md +0 -81
  213. package/prompts/structure/structure-example.md +0 -89
  214. package/prompts/structure/structure-getting-started.md +0 -10
  215. package/prompts/structure/update/system-prompt.md +0 -93
  216. package/prompts/structure/update/user-prompt.md +0 -43
  217. package/prompts/translate/admonition.md +0 -20
  218. package/prompts/translate/code-block.md +0 -33
  219. package/prompts/translate/glossary.md +0 -6
  220. package/prompts/translate/translate-document.md +0 -305
  221. package/prompts/utils/analyze-document-feedback-intent.md +0 -54
  222. package/prompts/utils/analyze-structure-feedback-intent.md +0 -43
  223. package/prompts/utils/feedback-refiner.md +0 -105
  224. package/types/document-schema.mjs +0 -55
  225. package/types/document-structure-schema.mjs +0 -261
  226. package/utils/auth-utils.mjs +0 -275
  227. package/utils/blocklet.mjs +0 -104
  228. package/utils/check-document-has-diagram.mjs +0 -95
  229. package/utils/conflict-detector.mjs +0 -149
  230. package/utils/constants/index.mjs +0 -620
  231. package/utils/constants/linter.mjs +0 -102
  232. package/utils/d2-utils.mjs +0 -198
  233. package/utils/debug.mjs +0 -3
  234. package/utils/delete-diagram-images.mjs +0 -99
  235. package/utils/deploy.mjs +0 -86
  236. package/utils/docs-finder-utils.mjs +0 -623
  237. package/utils/evaluate/report-utils.mjs +0 -132
  238. package/utils/extract-api.mjs +0 -32
  239. package/utils/file-utils.mjs +0 -960
  240. package/utils/history-utils.mjs +0 -203
  241. package/utils/icon-map.mjs +0 -26
  242. package/utils/image-compress.mjs +0 -75
  243. package/utils/kroki-utils.mjs +0 -173
  244. package/utils/linter/index.mjs +0 -50
  245. package/utils/load-config.mjs +0 -107
  246. package/utils/markdown/index.mjs +0 -26
  247. package/utils/markdown-checker.mjs +0 -694
  248. package/utils/mermaid-validator.mjs +0 -140
  249. package/utils/mermaid-worker-pool.mjs +0 -250
  250. package/utils/mermaid-worker.mjs +0 -233
  251. package/utils/openapi/index.mjs +0 -28
  252. package/utils/preferences-utils.mjs +0 -175
  253. package/utils/request.mjs +0 -10
  254. package/utils/store/index.mjs +0 -45
  255. package/utils/sync-diagram-to-translations.mjs +0 -262
  256. package/utils/upload-files.mjs +0 -231
  257. package/utils/utils.mjs +0 -1354
@@ -1,142 +0,0 @@
1
- import { rm } from "node:fs/promises";
2
- import { join } from "node:path";
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";
10
-
11
- export default async function clearGeneratedDocs(input = {}, options = {}) {
12
- const { docsDir, outputDir, locale, translateLanguages } = input;
13
-
14
- if (!docsDir) {
15
- return {
16
- message: "📁 No generated documents directory specified",
17
- };
18
- }
19
-
20
- const generatedDocsPath = resolveToAbsolute(docsDir);
21
- const displayPath = toDisplayPath(generatedDocsPath);
22
-
23
- try {
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
- }
31
-
32
- const documentStructure = (await loadDocumentStructure(outputDir)) || [];
33
- // select documents interactively
34
- const chooseResult = await chooseDocs(
35
- {
36
- docs: [], // Empty to trigger interactive selection
37
- documentStructure,
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);
87
- deletedFiles.push(file);
88
- } catch (error) {
89
- // ignore if file not found
90
- if (!["ENOENT"].includes(error.code)) {
91
- hasError = true;
92
- failedFiles.push({ file, error: error.message });
93
- }
94
- }
95
- }
96
-
97
- // Build result message
98
- const deletedCount = deletedFiles.length;
99
- const failedCount = failedFiles.length;
100
-
101
- let message = "";
102
- if (deletedCount > 0) {
103
- const lastIndex = deletedFiles.length - 1;
104
- message = `📁 Deleted ${deletedCount} document(s) in "${displayPath}":\n${deletedFiles
105
- .map((f, i) => ` ${i === lastIndex ? "└─" : "├─"} ${f}`)
106
- .join("\n")}`;
107
- }
108
-
109
- if (failedCount > 0) {
110
- const lastIndex = failedFiles.length - 1;
111
- message = `⚠️ Failed to delete ${failedCount} document(s) in "${displayPath}":\n${failedFiles
112
- .map((f, i) => ` ${i === lastIndex ? "└─" : "├─"} ${f.file}: ${f.error}`)
113
- .join("\n")}`;
114
- }
115
-
116
- return {
117
- message,
118
- cleared: deletedCount > 0,
119
- error: hasError,
120
- };
121
- } catch (error) {
122
- return {
123
- message: `⚠️ Failed to clear generated documents: ${error.message}`,
124
- error: true,
125
- };
126
- }
127
- }
128
-
129
- clearGeneratedDocs.input_schema = {
130
- type: "object",
131
- properties: {
132
- docsDir: {
133
- type: "string",
134
- description: "The generated documents directory to clear",
135
- },
136
- },
137
- required: ["docsDir"],
138
- };
139
-
140
- clearGeneratedDocs.taskTitle = "Clear generated documents";
141
- clearGeneratedDocs.description =
142
- "Select and delete specific generated documents from the docs directory";
@@ -1,129 +0,0 @@
1
- import { existsSync } from "node:fs";
2
- import { readFile, writeFile } from "node:fs/promises";
3
- import path from "node:path";
4
- import chalk from "chalk";
5
- import { parse, stringify } from "yaml";
6
- import { getMediaDescriptionCachePath } from "../../utils/file-utils.mjs";
7
-
8
- export default async function clearMediaDescription(_input = {}, options = {}) {
9
- const cacheFilePath = getMediaDescriptionCachePath();
10
-
11
- // Check if the cache file exists
12
- if (!existsSync(cacheFilePath)) {
13
- return {
14
- message: "🖼️ No media descriptions found to clear",
15
- };
16
- }
17
-
18
- try {
19
- // Read existing cache
20
- const cacheContent = await readFile(cacheFilePath, "utf8");
21
- const parsedCache = parse(cacheContent);
22
- const cache = parsedCache?.descriptions || {};
23
-
24
- // Get all media files from cache
25
- const mediaHashes = Object.keys(cache);
26
-
27
- if (mediaHashes.length === 0) {
28
- return {
29
- message: "🖼️ No media descriptions found to clear",
30
- };
31
- }
32
-
33
- // Build choices from cache - extract filename from path
34
- const choices = mediaHashes.map((hash) => {
35
- const mediaPath = cache[hash]?.path || "unknown";
36
- const filename = path.basename(mediaPath);
37
- const description = cache[hash]?.description || "";
38
- const truncatedDesc =
39
- description.length > 80 ? `${description.slice(0, 80)}...` : description;
40
-
41
- return {
42
- name: filename,
43
- description: truncatedDesc,
44
- value: hash,
45
- checked: false,
46
- };
47
- });
48
-
49
- // Add an option to clear all media descriptions
50
- choices.push({
51
- name: chalk.red("🗑️ Clear ALL media descriptions"),
52
- value: "__ALL__",
53
- checked: false,
54
- });
55
-
56
- let selectedHashes = [];
57
-
58
- if (options?.prompts?.checkbox) {
59
- selectedHashes = await options.prompts.checkbox({
60
- message: "Select media files to clear descriptions:",
61
- choices,
62
- validate: (answer) => (answer.length > 0 ? true : "Please select at least one item."),
63
- });
64
- } else {
65
- // If no prompts available, clear all
66
- selectedHashes = ["__ALL__"];
67
- }
68
-
69
- if (selectedHashes.length === 0) {
70
- return {
71
- message: "🖼️ No media files selected for clearing descriptions",
72
- };
73
- }
74
-
75
- const results = [];
76
- let clearedCount = 0;
77
-
78
- if (selectedHashes.includes("__ALL__")) {
79
- // Clear all media descriptions
80
- await writeFile(
81
- cacheFilePath,
82
- stringify({
83
- descriptions: {},
84
- lastUpdated: new Date().toISOString(),
85
- }),
86
- );
87
- results.push(`✔ Cleared descriptions for all media files (${mediaHashes.length} files)`);
88
- clearedCount = mediaHashes.length;
89
- } else {
90
- // Clear descriptions for selected files
91
- const updatedCache = { ...cache };
92
-
93
- for (const hash of selectedHashes) {
94
- if (updatedCache[hash]) {
95
- const filename = path.basename(updatedCache[hash].path);
96
- delete updatedCache[hash];
97
- results.push(`✔ Cleared description for ${chalk.cyan(filename)}`);
98
- clearedCount++;
99
- }
100
- }
101
-
102
- await writeFile(
103
- cacheFilePath,
104
- stringify({
105
- descriptions: updatedCache,
106
- lastUpdated: new Date().toISOString(),
107
- }),
108
- );
109
- }
110
-
111
- const header = `🖼️ Successfully cleared media descriptions`;
112
- const detailLines = results.map((item) => ` ${item}`).join("\n");
113
-
114
- const message = [header, "", detailLines, ""].filter(Boolean).join("\n");
115
-
116
- return {
117
- message,
118
- clearedCount,
119
- };
120
- } catch (error) {
121
- return {
122
- message: `Error clearing media descriptions: ${error.message}`,
123
- error: true,
124
- };
125
- }
126
- }
127
-
128
- clearMediaDescription.taskTitle = "Clear media file descriptions";
129
- clearMediaDescription.description = "Clear AI-generated descriptions for media files";
@@ -1,26 +0,0 @@
1
- type: team
2
- name: clear
3
- alias:
4
- - clear
5
- description: Clear various types of data including documentation structure, generated documents, configuration, and authorization tokens
6
- skills:
7
- - url: ../init/index.mjs
8
- default_input:
9
- skipIfExists: true
10
- checkOnly: true
11
- - ./choose-contents.mjs
12
- input_schema:
13
- type: object
14
- properties:
15
- targets:
16
- type: array
17
- description: Items to clear without confirmation
18
- items:
19
- type: string
20
- enum:
21
- - documentStructure
22
- - generatedDocs
23
- - documentConfig
24
- - authTokens
25
- - deploymentConfig
26
- - mediaDescription
@@ -1,160 +0,0 @@
1
- name: analyzeDiagramTypeLLM
2
- description: Analyze document content using LLM to determine diagram type and select appropriate style
3
- model:
4
- reasoning_effort: 1
5
- instructions: |
6
- You are an AI assistant specialized in technical documentation visualization. Your task is to analyze a document segment and generate a structured visual plan for an image generator.
7
-
8
- {% if feedback %}
9
- **CRITICAL: User Feedback (HIGHEST PRIORITY)**
10
- <feedback>
11
- {{ feedback }}
12
- </feedback>
13
-
14
- **IMPORTANT**: User feedback has the **HIGHEST PRIORITY** in all decision-making. Any explicit requests in the feedback (e.g., diagram type, style, colors, aspect ratio, size, layout preferences) must be respected and applied. Additionally, extract and note any other feedback information (such as color preferences, size requirements, layout specifications, etc.) that should be passed to subsequent image generation steps.
15
- {% endif %}
16
-
17
- Your responsibilities:
18
-
19
- 1. **Analyze Context**: Understand the document’s content, structure, and its purpose, especially around where the diagram will be inserted.
20
-
21
- 2. **Generate Document Summary**:
22
- **CRITICAL**: The documentSummary will be the **only input** passed to the image generation model. Preserve as much information as possible, only removing content that is truly useless for diagram generation.
23
-
24
- **What to PRESERVE (keep as much as possible):**
25
- - **All structural elements**: Headings, sections, hierarchy, ordering, and document structure
26
- - **All entities and components**: Names, roles, services, modules, actors, objects, and any elements that could appear as nodes
27
- - **All relationships and connections**: How entities relate, data flows, dependencies, interactions, and any connections
28
- - **All process flows and steps**: Sequential steps, decision points, workflows, logical order, and any process information
29
- - **All labels and names**: All names, labels, identifiers, and terminology used in the document
30
- - **Technical details**: Specifications, protocols, interfaces, configurations, and technical information
31
- - **Examples and use cases**: Concrete examples, scenarios, and use cases that illustrate the concepts
32
- - **Contextual information**: Explanatory text, background context, and descriptions that help understand relationships
33
- - **All content that could inform diagram structure**: Any information that might be relevant for creating accurate diagrams
34
-
35
- **What to REMOVE (only truly useless content):**
36
- - **Verbatim duplicates**: Exact duplicate sentences or paragraphs that repeat the same information
37
- - **Completely off-topic content**: Content that has no relation to the diagram subject matter
38
- - **Pure marketing/promotional text**: Sales language that doesn't contain technical or structural information
39
- - **Unrelated notes or comments**: Comments that are completely unrelated to the document's main content
40
-
41
- **Summary Guidelines:**
42
- - **Preserve the vast majority of content** - only remove content that is clearly redundant or completely unrelated
43
- - Keep the original document structure, hierarchy, and organization
44
- - Maintain all technical details, examples, and contextual information
45
- - When in doubt, **keep the content** rather than removing it
46
- - The summary should be comprehensive and contain all information that could be useful for diagram generation
47
-
48
- 3. **Determine Diagram Type**:
49
- Choose one of the following types based on the content:
50
- - **architecture**: Static system structure (components, containers, services)
51
- - **flowchart**: Decision logic, workflows, process steps
52
- - **guide**: Tutorials, step-by-step user journeys
53
- - **intro**: Concept overviews, mind maps
54
- - **sequence**: Time-based interactions between entities
55
- - **network**: Logical or physical network topologies
56
-
57
- **Decision Priority (in order):**
58
- {% if feedback %}
59
- 0. **HIGHEST PRIORITY**: Analyze the user feedback carefully. If the feedback explicitly or implicitly specifies a diagram type (e.g., "architecture diagram", "flowchart", "sequence diagram", "流程图", "架构图") → **MUST use that type and override any other considerations**. Use your understanding of natural language to identify the user's intent. The feedback type takes absolute precedence.
60
- {% endif %}
61
- 1. **Content Analysis**: If no type preference is found in feedback, analyze the document content structure and characteristics:
62
- - If the document is an **overview** (e.g. titled `# Overview`, describes whole system/project) → use `"architecture"`.
63
- - Sequential flow with time-based interactions → `sequence`
64
- - Branching logic, decision points, workflows → `flowchart`
65
- - User steps/tutorials, guided processes → `guide`
66
- - Concept maps, high-level introductions → `intro`
67
- - Infrastructure, network topologies → `network`
68
-
69
- 4. **Select Diagram Style**:
70
- **Decision Priority (in order):**
71
- {% if feedback %}
72
- 0. **HIGHEST PRIORITY**: Analyze the user feedback carefully. If the feedback explicitly or implicitly specifies a diagram style (e.g., "modern style", "hand-drawn", "anthropomorphic", "3d", "flat design", "现代风格", "手绘风格") → **MUST use that style and override any default style**. Use your understanding of natural language to identify the user's style preference. The feedback style takes absolute precedence.
73
- {% endif %}
74
- {% if defaultStyle %}
75
- 1. **Default Style**: If no style preference is found in feedback, use the configured default style: `{{ defaultStyle }}`. This is the user's preferred default style from configuration.
76
- {% endif %}
77
- 2. **Content-Based Selection**: If no feedback style and no default style, choose a style appropriate for technical documentation tone based on the content characteristics. You can use any style name that best fits the content, including but not limited to:
78
- - Common styles: `modern`, `standard`, `hand-drawn`, `anthropomorphic`, `flat`, `minimalist`, `3d`
79
- - Other creative styles: `watercolor`, `sketch`, `vintage`, `cyberpunk`, `minimal`, `realistic`, `cartoon`, `isometric`, `neon`, `pastel`, etc.
80
- - You are not limited to predefined styles - use your knowledge of visual styles to select the most appropriate one
81
- 3. **Available Styles Reference**: If `availableStyles` is provided and not empty, prefer styles from that list. However, if a better style is needed and not in the list, you can still use it. The `styleDescriptions` object provides descriptions of common styles for reference, but you are not restricted to only those styles.
82
-
83
- 5. **Recommend Aspect Ratio**:
84
- {% if feedback %}
85
- **HIGHEST PRIORITY**: If user feedback explicitly specifies an aspect ratio (e.g., "16:9", "4:3", "use landscape", "make it square") → **MUST use that aspect ratio**.
86
- {% endif %}
87
-
88
- Otherwise, select the most suitable aspect ratio based on layout direction:
89
- - `"1:1"`: Radial layouts, mind maps, central concepts
90
- - `"5:4"` or `"4:3"`: Vertical flows (step-by-step, guides)
91
- - `"3:2"`, `"16:9"`, `"21:9"`: Horizontal flows (timelines, architecture)
92
-
93
- **Decision Logic:**
94
- - Vertical flows → use `"4:3"` (default), or `"5:4"` for taller needs
95
- - Horizontal flows → `"16:9"` (default), `"21:9"` for very wide, `"3:2"` for moderate width
96
- - Central hub structures → use `"1:1"`
97
-
98
- **Never** mismatch direction and ratio:
99
- - Don't use portrait for horizontal content or vice versa
100
- - Don't use `"1:1"` unless layout is truly radial
101
-
102
- Document Content:
103
- <document_content>
104
- {{ documentContent }}
105
- </document_content>
106
-
107
-
108
- input_schema:
109
- type: object
110
- properties:
111
- documentContent:
112
- type: string
113
- description: The document content to analyze
114
- availableStyles:
115
- type: array
116
- description: List of available diagram styles
117
- items:
118
- type: string
119
- styleDescriptions:
120
- type: object
121
- description: Style descriptions
122
- additionalProperties:
123
- type: string
124
- locale:
125
- type: string
126
- description: Language for labels
127
- default: en
128
- feedback:
129
- type: string
130
- description: User feedback that may contain style, type, or other preferences. You should analyze this feedback carefully to extract any explicit or implicit preferences. If feedback specifies a style or type, it MUST override the defaultStyle.
131
- default: ""
132
- defaultStyle:
133
- type: string
134
- description: Default diagram style from configuration. Use this only if no style preference is found in feedback. If feedback specifies a style, it takes precedence over this default.
135
- nullable: true
136
- required:
137
- - documentContent
138
- - availableStyles
139
- output_schema:
140
- type: object
141
- properties:
142
- documentSummary:
143
- type: string
144
- description: A comprehensive summary that preserves the vast majority of the original document content. Only remove verbatim duplicates, completely off-topic content, or pure marketing text. Keep all structural elements, entities, relationships, processes, technical details, examples, and contextual information. This summary will be the only content passed to the image generation model.
145
- diagramType:
146
- type: string
147
- description: The selected diagram type
148
- diagramStyle:
149
- type: string
150
- description: The selected diagram style. Can be any style name (e.g., 'modern', 'hand-drawn', 'watercolor', 'cyberpunk', 'isometric', etc.). Not limited to predefined styles - use your knowledge of visual styles to select the most appropriate one.
151
- aspectRatio:
152
- type: string
153
- description: Recommended aspect ratio for the image based on content structure analysis. MUST match the primary flow direction (vertical→portrait, horizontal→landscape, radial→square)
154
- enum: ["1:1", "5:4", "4:3", "3:2", "16:9", "21:9"]
155
- required:
156
- - documentSummary
157
- - diagramType
158
- - diagramStyle
159
- - aspectRatio
160
-