@aigne/doc-smith 0.8.11-beta.5 → 0.8.11-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/.aigne/doc-smith/config.yaml +3 -1
  2. package/.aigne/doc-smith/output/structure-plan.json +2 -2
  3. package/.aigne/doc-smith/preferences.yml +28 -20
  4. package/.aigne/doc-smith/upload-cache.yaml +702 -0
  5. package/.release-please-manifest.json +1 -1
  6. package/CHANGELOG.md +22 -2
  7. package/README.md +2 -2
  8. package/agents/clear/choose-contents.mjs +2 -2
  9. package/agents/clear/clear-document-structure.mjs +8 -8
  10. package/agents/clear/index.yaml +1 -1
  11. package/agents/evaluate/document-structure.yaml +1 -1
  12. package/agents/generate/check-document-structure.yaml +3 -3
  13. package/agents/generate/check-need-generate-structure.mjs +8 -8
  14. package/agents/generate/document-structure-tools/add-document.mjs +38 -13
  15. package/agents/generate/document-structure-tools/delete-document.mjs +37 -14
  16. package/agents/generate/document-structure-tools/move-document.mjs +46 -19
  17. package/agents/generate/document-structure-tools/update-document.mjs +39 -12
  18. package/agents/generate/generate-structure.yaml +1 -1
  19. package/agents/generate/update-document-structure.yaml +3 -9
  20. package/agents/generate/user-review-document-structure.mjs +15 -14
  21. package/agents/translate/translate-document.yaml +1 -9
  22. package/agents/update/batch-generate-document.yaml +1 -1
  23. package/agents/update/check-document.mjs +2 -2
  24. package/agents/update/check-update-is-single.mjs +2 -1
  25. package/agents/update/document-tools/update-document-content.mjs +24 -14
  26. package/agents/update/fs-tools/glob.mjs +184 -0
  27. package/agents/update/fs-tools/grep.mjs +317 -0
  28. package/agents/update/fs-tools/read-file.mjs +307 -0
  29. package/agents/update/generate-document.yaml +4 -7
  30. package/agents/update/update-document-detail.yaml +6 -10
  31. package/agents/update/user-review-document.mjs +13 -13
  32. package/agents/utils/check-feedback-refiner.mjs +1 -1
  33. package/agents/utils/choose-docs.mjs +1 -1
  34. package/agents/utils/load-document-all-content.mjs +3 -3
  35. package/agents/utils/load-sources.mjs +1 -1
  36. package/agents/utils/save-docs.mjs +7 -28
  37. package/aigne.yaml +2 -2
  38. package/assets/screenshots/doc-complete-setup.png +0 -0
  39. package/assets/screenshots/doc-generate-docs.png +0 -0
  40. package/assets/screenshots/doc-generate.png +0 -0
  41. package/assets/screenshots/doc-generated-successfully.png +0 -0
  42. package/assets/screenshots/doc-publish.png +0 -0
  43. package/assets/screenshots/doc-regenerate.png +0 -0
  44. package/assets/screenshots/doc-translate-langs.png +0 -0
  45. package/assets/screenshots/doc-translate.png +0 -0
  46. package/assets/screenshots/doc-update.png +0 -0
  47. package/docs/_sidebar.md +1 -1
  48. package/docs/advanced-how-it-works.ja.md +31 -31
  49. package/docs/advanced-how-it-works.md +10 -10
  50. package/docs/advanced-how-it-works.zh-TW.md +24 -24
  51. package/docs/advanced-how-it-works.zh.md +20 -20
  52. package/docs/advanced-quality-assurance.ja.md +57 -61
  53. package/docs/advanced-quality-assurance.md +57 -61
  54. package/docs/advanced-quality-assurance.zh-TW.md +57 -61
  55. package/docs/advanced-quality-assurance.zh.md +57 -61
  56. package/docs/advanced.ja.md +8 -4
  57. package/docs/advanced.md +7 -3
  58. package/docs/advanced.zh-TW.md +9 -5
  59. package/docs/advanced.zh.md +9 -5
  60. package/docs/changelog.ja.md +206 -29
  61. package/docs/changelog.md +177 -0
  62. package/docs/changelog.zh-TW.md +229 -52
  63. package/docs/changelog.zh.md +204 -27
  64. package/docs/cli-reference.ja.md +181 -80
  65. package/docs/cli-reference.md +168 -67
  66. package/docs/cli-reference.zh-TW.md +177 -76
  67. package/docs/cli-reference.zh.md +172 -71
  68. package/docs/configuration-interactive-setup.ja.md +45 -42
  69. package/docs/configuration-interactive-setup.md +9 -6
  70. package/docs/configuration-interactive-setup.zh-TW.md +26 -23
  71. package/docs/configuration-interactive-setup.zh.md +25 -22
  72. package/docs/configuration-language-support.ja.md +33 -63
  73. package/docs/configuration-language-support.md +32 -62
  74. package/docs/configuration-language-support.zh-TW.md +35 -65
  75. package/docs/configuration-language-support.zh.md +32 -62
  76. package/docs/configuration-llm-setup.ja.md +25 -23
  77. package/docs/configuration-llm-setup.md +20 -18
  78. package/docs/configuration-llm-setup.zh-TW.md +21 -19
  79. package/docs/configuration-llm-setup.zh.md +20 -18
  80. package/docs/configuration-preferences.ja.md +67 -52
  81. package/docs/configuration-preferences.md +55 -40
  82. package/docs/configuration-preferences.zh-TW.md +69 -54
  83. package/docs/configuration-preferences.zh.md +68 -53
  84. package/docs/configuration.ja.md +98 -58
  85. package/docs/configuration.md +42 -2
  86. package/docs/configuration.zh-TW.md +86 -46
  87. package/docs/configuration.zh.md +76 -36
  88. package/docs/features-generate-documentation.ja.md +49 -55
  89. package/docs/features-generate-documentation.md +49 -55
  90. package/docs/features-generate-documentation.zh-TW.md +54 -60
  91. package/docs/features-generate-documentation.zh.md +48 -54
  92. package/docs/features-publish-your-docs.ja.md +68 -45
  93. package/docs/features-publish-your-docs.md +65 -42
  94. package/docs/features-publish-your-docs.zh-TW.md +74 -51
  95. package/docs/features-publish-your-docs.zh.md +67 -44
  96. package/docs/features-translate-documentation.ja.md +46 -35
  97. package/docs/features-translate-documentation.md +39 -28
  98. package/docs/features-translate-documentation.zh-TW.md +45 -34
  99. package/docs/features-translate-documentation.zh.md +39 -28
  100. package/docs/features-update-and-refine.ja.md +75 -71
  101. package/docs/features-update-and-refine.md +67 -63
  102. package/docs/features-update-and-refine.zh-TW.md +72 -67
  103. package/docs/features-update-and-refine.zh.md +71 -67
  104. package/docs/features.ja.md +29 -19
  105. package/docs/features.md +25 -15
  106. package/docs/features.zh-TW.md +28 -18
  107. package/docs/features.zh.md +31 -21
  108. package/docs/getting-started.ja.md +43 -46
  109. package/docs/getting-started.md +36 -39
  110. package/docs/getting-started.zh-TW.md +41 -44
  111. package/docs/getting-started.zh.md +39 -42
  112. package/docs/overview.ja.md +63 -11
  113. package/docs/overview.md +62 -10
  114. package/docs/overview.zh-TW.md +67 -15
  115. package/docs/overview.zh.md +62 -10
  116. package/docs-mcp/analyze-docs-relevance.yaml +6 -6
  117. package/docs-mcp/docs-search.yaml +1 -1
  118. package/media.md +9 -9
  119. package/package.json +2 -2
  120. package/prompts/common/document-structure/conflict-resolution-guidance.md +3 -3
  121. package/prompts/common/document-structure/document-structure-rules.md +2 -2
  122. package/prompts/detail/custom/custom-components.md +304 -188
  123. package/prompts/detail/document-rules.md +5 -5
  124. package/prompts/detail/generate-document.md +21 -8
  125. package/prompts/detail/update-document.md +8 -12
  126. package/prompts/evaluate/document-structure.md +6 -6
  127. package/prompts/structure/check-document-structure.md +10 -10
  128. package/prompts/structure/document-rules.md +2 -2
  129. package/prompts/structure/generate-structure-system.md +3 -3
  130. package/prompts/structure/structure-example.md +1 -1
  131. package/prompts/structure/structure-getting-started.md +1 -1
  132. package/prompts/structure/update-document-structure.md +18 -14
  133. package/prompts/utils/feedback-refiner.md +3 -3
  134. package/tests/agents/clear/choose-contents.test.mjs +1 -1
  135. package/tests/agents/clear/clear-document-structure.test.mjs +36 -30
  136. package/tests/agents/evaluate/generate-report.test.mjs +1 -1
  137. package/tests/agents/generate/check-need-generate-structure.test.mjs +1 -1
  138. package/tests/agents/generate/document-structure-tools/add-document.test.mjs +2 -2
  139. package/tests/agents/generate/document-structure-tools/delete-document.test.mjs +4 -4
  140. package/tests/agents/generate/document-structure-tools/move-document.test.mjs +12 -12
  141. package/tests/agents/generate/document-structure-tools/update-document.test.mjs +3 -3
  142. package/tests/agents/generate/user-review-document-structure.test.mjs +36 -13
  143. package/tests/agents/update/check-document.test.mjs +1 -1
  144. package/tests/agents/update/document-tools/update-document-content.test.mjs +115 -112
  145. package/tests/agents/update/fs-tools/glob.test.mjs +438 -0
  146. package/tests/agents/update/fs-tools/grep.test.mjs +279 -0
  147. package/tests/agents/update/fs-tools/read-file.test.mjs +553 -0
  148. package/tests/agents/update/user-review-document.test.mjs +48 -27
  149. package/tests/agents/utils/format-document-structure.test.mjs +5 -5
  150. package/tests/agents/utils/load-sources.test.mjs +4 -4
  151. package/tests/agents/utils/save-docs.test.mjs +1 -1
  152. package/tests/utils/conflict-detector.test.mjs +1 -1
  153. package/tests/utils/docs-finder-utils.test.mjs +8 -8
  154. package/types/document-schema.mjs +5 -6
  155. package/types/document-structure-schema.mjs +25 -13
  156. package/utils/conflict-detector.mjs +1 -1
  157. package/utils/constants/index.mjs +4 -4
  158. package/utils/docs-finder-utils.mjs +11 -11
  159. package/utils/markdown-checker.mjs +1 -1
@@ -158,7 +158,7 @@ describe("move-document", () => {
158
158
  expect(result.documentStructure).toEqual(baseDocumentStructure);
159
159
  expect(result.originalDocument).toBeUndefined();
160
160
  expect(result.updatedDocument).toBeUndefined();
161
- expect(consoleSpy).toHaveBeenCalledWith("Error: Cannot move document - path: Required");
161
+ expect(consoleSpy).toHaveBeenCalledWith("⚠️ Cannot move document: path: Required");
162
162
  });
163
163
 
164
164
  test("should return error when path is empty string", async () => {
@@ -169,7 +169,7 @@ describe("move-document", () => {
169
169
  });
170
170
 
171
171
  expect(result.documentStructure).toEqual(baseDocumentStructure);
172
- expect(consoleSpy).toHaveBeenCalledWith("Error: Cannot move document - path: Path is required");
172
+ expect(consoleSpy).toHaveBeenCalledWith("⚠️ Cannot move document: path: Path is required");
173
173
  });
174
174
 
175
175
  test("should return error when document does not exist", async () => {
@@ -181,7 +181,7 @@ describe("move-document", () => {
181
181
 
182
182
  expect(result.documentStructure).toEqual(baseDocumentStructure);
183
183
  expect(consoleSpy).toHaveBeenCalledWith(
184
- "Error: Cannot move document - Document '/nonexistent-document' does not exist. Please select an existing document to move.",
184
+ "⚠️ Cannot move document: Document '/nonexistent-document' does not exist. Please select an existing document to move.",
185
185
  );
186
186
  });
187
187
 
@@ -194,7 +194,7 @@ describe("move-document", () => {
194
194
 
195
195
  expect(result.documentStructure).toEqual(baseDocumentStructure);
196
196
  expect(consoleSpy).toHaveBeenCalledWith(
197
- "Error: Cannot move document - Target parent document '/nonexistent-parent' does not exist. Please select an existing parent document.",
197
+ "⚠️ Cannot move document: Target parent document '/nonexistent-parent' does not exist. Please select an existing parent document.",
198
198
  );
199
199
  });
200
200
 
@@ -208,7 +208,7 @@ describe("move-document", () => {
208
208
 
209
209
  expect(result.documentStructure).toEqual(baseDocumentStructure);
210
210
  expect(consoleSpy).toHaveBeenCalledWith(
211
- "Error: Cannot move document - Moving '/api' under '/api/auth' would create an invalid hierarchy. Please select a parent that is not nested under the document being moved.",
211
+ "⚠️ Cannot move document: Moving '/api' under '/api/auth' would create an invalid hierarchy. Please select a parent that is not nested under the document being moved.",
212
212
  );
213
213
  });
214
214
 
@@ -221,7 +221,7 @@ describe("move-document", () => {
221
221
 
222
222
  expect(result.documentStructure).toEqual(baseDocumentStructure);
223
223
  expect(consoleSpy).toHaveBeenCalledWith(
224
- "Error: Cannot move document - Moving '/api' under '/api/auth/oauth' would create an invalid hierarchy. Please select a parent that is not nested under the document being moved.",
224
+ "⚠️ Cannot move document: Moving '/api' under '/api/auth/oauth' would create an invalid hierarchy. Please select a parent that is not nested under the document being moved.",
225
225
  );
226
226
  });
227
227
 
@@ -278,7 +278,7 @@ describe("move-document", () => {
278
278
 
279
279
  expect(result.documentStructure).toEqual(complexStructure);
280
280
  expect(consoleSpy).toHaveBeenCalledWith(
281
- "Error: Cannot move document - Moving '/api' under '/api/auth/oauth/scopes' would create an invalid hierarchy. Please select a parent that is not nested under the document being moved.",
281
+ "⚠️ Cannot move document: Moving '/api' under '/api/auth/oauth/scopes' would create an invalid hierarchy. Please select a parent that is not nested under the document being moved.",
282
282
  );
283
283
  });
284
284
 
@@ -326,7 +326,7 @@ describe("move-document", () => {
326
326
  expect(updatedDoc.parentId).not.toBe(originalDoc.parentId);
327
327
  });
328
328
 
329
- test("should handle empty document structure", async () => {
329
+ test("should handle empty documentation structure", async () => {
330
330
  const result = await moveDocument({
331
331
  documentStructure: [],
332
332
  path: "/any-path",
@@ -335,11 +335,11 @@ describe("move-document", () => {
335
335
 
336
336
  expect(result.documentStructure).toEqual([]);
337
337
  expect(consoleSpy).toHaveBeenCalledWith(
338
- "Error: Cannot move document - Document '/any-path' does not exist. Please select an existing document to move.",
338
+ "⚠️ Cannot move document: Document '/any-path' does not exist. Please select an existing document to move.",
339
339
  );
340
340
  });
341
341
 
342
- test("should handle single document structure", async () => {
342
+ test("should handle single documentation structure", async () => {
343
343
  const singleDocStructure = [
344
344
  {
345
345
  title: "Only Document",
@@ -358,12 +358,12 @@ describe("move-document", () => {
358
358
 
359
359
  expect(result.documentStructure).toEqual(singleDocStructure);
360
360
  expect(consoleSpy).toHaveBeenCalledWith(
361
- "Error: Cannot move document - Target parent document '/nonexistent' does not exist. Please select an existing parent document.",
361
+ "⚠️ Cannot move document: Target parent document '/nonexistent' does not exist. Please select an existing parent document.",
362
362
  );
363
363
  });
364
364
 
365
365
  // DATA INTEGRITY TESTS
366
- test("should not modify original document structure", async () => {
366
+ test("should not modify original documentation structure", async () => {
367
367
  const originalStructure = [...baseDocumentStructure];
368
368
 
369
369
  await moveDocument({
@@ -319,7 +319,7 @@ describe("update-document", () => {
319
319
  expect(consoleSpy).not.toHaveBeenCalled();
320
320
  });
321
321
 
322
- test("should handle empty document structure", async () => {
322
+ test("should handle empty documentation structure", async () => {
323
323
  const result = await updateDocument({
324
324
  documentStructure: [],
325
325
  path: "/any-path",
@@ -332,7 +332,7 @@ describe("update-document", () => {
332
332
  );
333
333
  });
334
334
 
335
- test("should handle single document structure", async () => {
335
+ test("should handle single documentation structure", async () => {
336
336
  const singleDocStructure = [
337
337
  {
338
338
  title: "Only Document",
@@ -377,7 +377,7 @@ describe("update-document", () => {
377
377
  });
378
378
 
379
379
  // DATA INTEGRITY TESTS
380
- test("should not modify original document structure", async () => {
380
+ test("should not modify original documentation structure", async () => {
381
381
  const originalStructure = [...baseDocumentStructure];
382
382
 
383
383
  await updateDocument({
@@ -49,6 +49,9 @@ describe("user-review-document-structure", () => {
49
49
  invoke: mock(async () => ({
50
50
  documentStructure: documentStructure,
51
51
  })),
52
+ userContext: {
53
+ currentStructure: [],
54
+ },
52
55
  },
53
56
  };
54
57
 
@@ -71,13 +74,13 @@ describe("user-review-document-structure", () => {
71
74
  consoleSpy?.mockRestore();
72
75
  });
73
76
 
74
- test("should return original structure when no document structure provided", async () => {
77
+ test("should return original structure when no documentation structure provided", async () => {
75
78
  const result = await userReviewDocumentStructure({}, mockOptions);
76
79
 
77
80
  expect(result).toBeDefined();
78
81
  expect(result.documentStructure).toBeUndefined();
79
82
  expect(mockOptions.prompts.select).not.toHaveBeenCalled();
80
- expect(consoleSpy).toHaveBeenCalledWith("No document structure was generated to review.");
83
+ expect(consoleSpy).toHaveBeenCalledWith("No documentation structure was generated to review.");
81
84
  });
82
85
 
83
86
  test("should return original structure when empty array provided", async () => {
@@ -86,7 +89,7 @@ describe("user-review-document-structure", () => {
86
89
  expect(result).toBeDefined();
87
90
  expect(result.documentStructure).toEqual([]);
88
91
  expect(mockOptions.prompts.select).not.toHaveBeenCalled();
89
- expect(consoleSpy).toHaveBeenCalledWith("No document structure was generated to review.");
92
+ expect(consoleSpy).toHaveBeenCalledWith("No documentation structure was generated to review.");
90
93
  });
91
94
 
92
95
  test("should return original structure when user chooses not to review", async () => {
@@ -110,7 +113,9 @@ describe("user-review-document-structure", () => {
110
113
  expect(result.documentStructure).toEqual(documentStructure);
111
114
  expect(mockOptions.prompts.select).toHaveBeenCalled();
112
115
  expect(mockOptions.prompts.input).toHaveBeenCalled();
113
- expect(consoleSpy).toHaveBeenCalledWith(expect.stringContaining("Current Document Structure"));
116
+ expect(consoleSpy).toHaveBeenCalledWith(
117
+ expect.stringContaining("Current Documentation Structure"),
118
+ );
114
119
  });
115
120
 
116
121
  test("should process user feedback and call refineDocumentStructure agent", async () => {
@@ -130,9 +135,13 @@ describe("user-review-document-structure", () => {
130
135
  .mockImplementationOnce(async () => feedback)
131
136
  .mockImplementationOnce(async () => ""); // Exit loop on second call
132
137
 
133
- mockOptions.context.invoke.mockImplementation(async () => ({
134
- documentStructure: refinedStructure,
135
- }));
138
+ mockOptions.context.invoke.mockImplementation(async () => {
139
+ // Simulate the agent updating the shared context
140
+ mockOptions.context.userContext.currentStructure = refinedStructure;
141
+ return {
142
+ documentStructure: refinedStructure,
143
+ };
144
+ });
136
145
 
137
146
  const result = await userReviewDocumentStructure({ documentStructure }, mockOptions);
138
147
 
@@ -188,7 +197,7 @@ describe("user-review-document-structure", () => {
188
197
 
189
198
  expect(result.documentStructure).toEqual(documentStructure);
190
199
  expect(consoleSpy).toHaveBeenCalledWith(
191
- "Unable to process your feedback - the document structure update feature is unavailable.",
200
+ "Unable to process your feedback - the documentation structure update feature is unavailable.",
192
201
  );
193
202
  });
194
203
 
@@ -240,11 +249,25 @@ describe("user-review-document-structure", () => {
240
249
  .mockImplementationOnce(async () => secondFeedback)
241
250
  .mockImplementationOnce(async () => ""); // Exit loop
242
251
 
243
- mockOptions.context.invoke
244
- .mockImplementationOnce(async () => ({ documentStructure: firstRefinedStructure })) // refineDocumentStructure 1st call
245
- .mockImplementationOnce(async () => ({})) // checkFeedbackRefiner 1st call
246
- .mockImplementationOnce(async () => ({ documentStructure: finalRefinedStructure })) // refineDocumentStructure 2nd call
247
- .mockImplementationOnce(async () => ({})); // checkFeedbackRefiner 2nd call
252
+ let invokeCount = 0;
253
+ mockOptions.context.invoke.mockImplementation(async () => {
254
+ invokeCount++;
255
+ if (invokeCount === 1) {
256
+ // refineDocumentStructure 1st call
257
+ mockOptions.context.userContext.currentStructure = firstRefinedStructure;
258
+ return { documentStructure: firstRefinedStructure };
259
+ } else if (invokeCount === 2) {
260
+ // checkFeedbackRefiner 1st call
261
+ return {};
262
+ } else if (invokeCount === 3) {
263
+ // refineDocumentStructure 2nd call
264
+ mockOptions.context.userContext.currentStructure = finalRefinedStructure;
265
+ return { documentStructure: finalRefinedStructure };
266
+ } else {
267
+ // checkFeedbackRefiner 2nd call
268
+ return {};
269
+ }
270
+ });
248
271
 
249
272
  const result = await userReviewDocumentStructure({ documentStructure }, mockOptions);
250
273
 
@@ -177,7 +177,7 @@ describe("check-document", () => {
177
177
  expect(mockOptions.context.invoke).not.toHaveBeenCalled();
178
178
  });
179
179
 
180
- test("should handle missing original node in document structure", async () => {
180
+ test("should handle missing original node in documentation structure", async () => {
181
181
  accessSpy.mockResolvedValue();
182
182
  checkDetailResultSpy.mockResolvedValue({ isApproved: true });
183
183