@aigne/doc-smith 0.8.15-beta.3 → 0.8.15-beta.5

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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [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)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * 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))
9
+
10
+ ## [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)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * 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))
16
+
3
17
  ## [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)
4
18
 
5
19
 
@@ -245,25 +245,21 @@ export default async function init(
245
245
  input.docsDir = docsDirInput.trim() || `${outputPath}/docs`;
246
246
 
247
247
  // 8. Content sources
248
- console.log("\nšŸ” [8/9]: Content Sources");
248
+ console.log("\nšŸ” [8/9]: Data Sources");
249
+ console.log("Please specify the data source we should analyze to generate your documentation.");
249
250
  console.log(
250
- "Please specify the folders and files we should analyze to generate your documentation.",
251
+ ` 1. Use paths like ${chalk.green("./src")}, ${chalk.green("./README.md")} or ${chalk.green("!./src/private")}.`,
251
252
  );
252
253
  console.log(
253
- ` 1. You can use local file paths like ${chalk.green("./src")}, ${chalk.green("./docs")}, ${chalk.green("./README.md")} (prefix with '!' to ignore a file or folder like ${chalk.green("!./src/private")}).`,
254
- );
255
- console.log(
256
- ` 2. You can also use glob patterns like ${chalk.green("src/**/*.js")} or ${chalk.green("docs/**/*.md")} for more specific file matching. (prefix with '!' to ignore a file or folder like ${chalk.green("!private/**/*.js")}).`,
257
- );
258
- console.log(
259
- ` 3. You can also use remote url like ${chalk.green("https://example.com/openapi.yaml")}.`,
254
+ ` 2. Use globs like ${chalk.green("src/**/*.js")} or ${chalk.green("!private/**/*.js")} for more specific file matching.`,
260
255
  );
256
+ console.log(` 3. Use URLs like ${chalk.green("https://example.com/openapi.yaml")}.`);
261
257
  console.log("šŸ’” If you leave this empty, we will scan the entire directory.");
262
258
 
263
259
  const sourcePaths = [];
264
260
  while (true) {
265
261
  const selectedPath = await options.prompts.search({
266
- message: "Please enter a file or folder path, or a glob pattern or remote url:",
262
+ message: "Please enter a valid data source:",
267
263
  source: async (input) => {
268
264
  if (!input || input.trim() === "") {
269
265
  return [
@@ -0,0 +1,30 @@
1
+ type: team
2
+ task_render_mode: collapse
3
+ name: generateDiagram
4
+ skills:
5
+ - ../generate/draw-diagram.yaml
6
+ - ../generate/wrap-diagram-code.mjs
7
+ reflection:
8
+ reviewer: ../generate/check-diagram.mjs
9
+ is_approved: isValid
10
+ max_iterations: 5
11
+ return_last_on_max_iterations: false
12
+ custom_error_message: "MUST NOT generate any diagram: validation failed after max iterations."
13
+ input_schema:
14
+ type: object
15
+ properties:
16
+ documentContent:
17
+ type: string
18
+ description: The **raw text content** of the current document. (**Note:** This is the original document and **does not include** any diagram source code.)
19
+ locale:
20
+ type: string
21
+ description: Language for diagram labels and text
22
+ default: en
23
+ required:
24
+ - documentContent
25
+ output_schema:
26
+ type: object
27
+ properties:
28
+ diagramSourceCode:
29
+ type: string
30
+ description: The **diagram source code** generated from the input text.
@@ -58,33 +58,4 @@ afs:
58
58
  should search and read as needed while generating document content
59
59
  keep_text_in_tool_uses: false
60
60
  skills:
61
- - type: team
62
- task_render_mode: collapse
63
- name: generateDiagram
64
- skills:
65
- - ../generate/draw-diagram.yaml
66
- - ../generate/wrap-diagram-code.mjs
67
- reflection:
68
- reviewer: ../generate/check-diagram.mjs
69
- is_approved: isValid
70
- max_iterations: 5
71
- return_last_on_max_iterations: false
72
- custom_error_message: "MUST NOT generate any diagram: validation failed after max iterations."
73
- input_schema:
74
- type: object
75
- properties:
76
- documentContent:
77
- type: string
78
- description: The **raw text content** of the current document. (**Note:** This is the original document and **does not include** any diagram source code.)
79
- locale:
80
- type: string
81
- description: Language for diagram labels and text
82
- default: en
83
- required:
84
- - documentContent
85
- output_schema:
86
- type: object
87
- properties:
88
- diagramSourceCode:
89
- type: string
90
- description: The **diagram source code** generated from the input text.
61
+ - ./generate-diagram.yaml
@@ -47,20 +47,13 @@ export default async function saveAndTranslateDocument(input, options) {
47
47
  // Clear feedback to ensure translation is not affected by update feedback
48
48
  doc.feedback = "";
49
49
 
50
- const result = await options.context.invoke(translateAgent, {
50
+ await options.context.invoke(translateAgent, {
51
51
  ...input, // context is required
52
52
  content: doc.content,
53
53
  translates: doc.translates,
54
54
  title: doc.title,
55
- });
56
-
57
- // Save the translated content
58
- const saveTranslationsAgent = options.context.agents["saveDocTranslations"];
59
- await options.context.invoke(saveTranslationsAgent, {
60
55
  path: doc.path,
61
- docsDir: docsDir,
62
- translates: result.translates || doc.translates,
63
- labels: doc.labels,
56
+ docsDir,
64
57
  });
65
58
  } catch (error) {
66
59
  console.error(`āŒ Failed to translate document ${doc.path}:`, error.message);
@@ -57,4 +57,5 @@ afs:
57
57
  keep_text_in_tool_uses: false
58
58
  skills:
59
59
  - ./document-tools/update-document-content.mjs
60
+ - ./generate-diagram.yaml
60
61
  task_render_mode: collapse
@@ -1,6 +1,6 @@
1
1
  import { saveDocTranslation as _saveDocTranslation } from "../../utils/utils.mjs";
2
2
 
3
- export default async function saveDocTranslations({
3
+ export default async function saveDocTranslation({
4
4
  path,
5
5
  docsDir,
6
6
  translation,
@@ -24,4 +24,4 @@ export default async function saveDocTranslations({
24
24
  return {};
25
25
  }
26
26
 
27
- saveDocTranslations.task_render_mode = "hide";
27
+ saveDocTranslation.task_render_mode = "hide";
package/aigne.yaml CHANGED
@@ -71,7 +71,6 @@ agents:
71
71
  - ./agents/utils/transform-detail-datasources.mjs
72
72
  - ./agents/utils/save-doc.mjs
73
73
  - ./agents/utils/save-doc-translation.mjs
74
- - ./agents/utils/save-doc-translations.mjs
75
74
  - ./agents/utils/save-output.mjs
76
75
  - ./agents/utils/format-document-structure.mjs
77
76
  - ./agents/utils/find-item-by-path.mjs
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/doc-smith",
3
- "version": "0.8.15-beta.3",
3
+ "version": "0.8.15-beta.5",
4
4
  "description": "AI-driven documentation generation tool built on the AIGNE Framework",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -97,6 +97,7 @@ Generate detailed and well-structured document for the current {{nodeName}} base
97
97
  YOU SHOULD:
98
98
  - Use AFS tools `afs_list` `afs_search` or `afs_read` to gather relevant and accurate information to enhance the content.
99
99
  - Follow rules in `<diagram_generation_guide>`: use `generateDiagram` tool to create and embed a diagram when appropriate, following the diagram generation guidelines.
100
+ - If the `generateDiagram` tool is not called, do not attempt to add any diagrams.
100
101
 
101
102
  <steps>
102
103
  1. Analyze the provided document structure and user requirements to plan the content.
package/utils/utils.mjs CHANGED
@@ -111,44 +111,6 @@ export async function saveDoc({ path: docPath, content, docsDir, locale, labels
111
111
  }
112
112
  }
113
113
 
114
- /**
115
- * Save a single document's translations to files
116
- * @param {Object} params
117
- * @param {string} params.path - Relative path (without extension)
118
- * @param {string} params.docsDir - Root directory
119
- * @param {Array<{language: string, translation: string}>} [params.translates] - Translation content
120
- * @param {Array<string>} [params.labels] - Document labels for front matter
121
- * @returns {Promise<Array<{ path: string, success: boolean, error?: string }>>}
122
- */
123
- export async function saveDocTranslations({ path: docPath, docsDir, translates = [], labels }) {
124
- const results = [];
125
- try {
126
- await fs.mkdir(docsDir, { recursive: true });
127
-
128
- // Process all translations
129
- for (const translate of translates) {
130
- const translateFileName = getFileName(docPath, translate.language);
131
- const translatePath = path.join(docsDir, translateFileName);
132
-
133
- // Add labels front matter to translation content if labels are provided
134
- let finalTranslationContent = processContent({
135
- content: translate.translation,
136
- });
137
-
138
- if (labels && labels.length > 0) {
139
- const frontMatter = `---\nlabels: ${JSON.stringify(labels)}\n---\n\n`;
140
- finalTranslationContent = frontMatter + finalTranslationContent;
141
- }
142
-
143
- await fs.writeFile(translatePath, finalTranslationContent, "utf8");
144
- results.push({ path: translatePath, success: true });
145
- }
146
- } catch (err) {
147
- results.push({ path: docPath, success: false, error: err.message });
148
- }
149
- return results;
150
- }
151
-
152
114
  export async function saveDocTranslation({
153
115
  path: docPath,
154
116
  docsDir,
@@ -1,33 +0,0 @@
1
- import { shutdownMermaidWorkerPool } from "../../utils/mermaid-worker-pool.mjs";
2
- import { saveDocTranslations as _saveDocTranslations } from "../../utils/utils.mjs";
3
-
4
- export default async function saveDocTranslations({
5
- path,
6
- docsDir,
7
- translates,
8
- labels,
9
- isShowMessage = false,
10
- }) {
11
- await _saveDocTranslations({
12
- path,
13
- docsDir,
14
- translates,
15
- labels,
16
- });
17
-
18
- if (isShowMessage) {
19
- // Shutdown mermaid worker pool to ensure clean exit
20
- try {
21
- await shutdownMermaidWorkerPool();
22
- } catch (error) {
23
- console.warn("Failed to shutdown mermaid worker pool:", error.message);
24
- }
25
-
26
- const message = `āœ… Translation completed successfully.`;
27
- return { message };
28
- }
29
-
30
- return {};
31
- }
32
-
33
- saveDocTranslations.task_render_mode = "hide";