@aigne/doc-smith 0.8.11-beta.5 → 0.8.11-beta.6
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/.aigne/doc-smith/config.yaml +1 -1
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +9 -2
- package/README.md +1 -1
- package/agents/clear/choose-contents.mjs +2 -2
- package/agents/clear/clear-document-structure.mjs +8 -8
- package/agents/clear/index.yaml +1 -1
- package/agents/evaluate/document-structure.yaml +1 -1
- package/agents/generate/check-document-structure.yaml +3 -3
- package/agents/generate/check-need-generate-structure.mjs +8 -8
- package/agents/generate/document-structure-tools/add-document.mjs +3 -3
- package/agents/generate/document-structure-tools/delete-document.mjs +2 -2
- package/agents/generate/document-structure-tools/move-document.mjs +3 -2
- package/agents/generate/document-structure-tools/update-document.mjs +2 -2
- package/agents/generate/generate-structure.yaml +1 -1
- package/agents/generate/update-document-structure.yaml +3 -3
- package/agents/generate/user-review-document-structure.mjs +10 -10
- package/agents/update/batch-generate-document.yaml +1 -1
- package/agents/update/check-document.mjs +2 -2
- package/agents/utils/check-feedback-refiner.mjs +1 -1
- package/agents/utils/choose-docs.mjs +1 -1
- package/agents/utils/load-document-all-content.mjs +3 -3
- package/agents/utils/load-sources.mjs +1 -1
- package/agents/utils/save-docs.mjs +7 -28
- package/aigne.yaml +2 -2
- package/docs/_sidebar.md +1 -1
- package/docs/advanced-how-it-works.md +3 -3
- package/docs/advanced-quality-assurance.md +1 -1
- package/docs/cli-reference.ja.md +151 -80
- package/docs/cli-reference.md +126 -55
- package/docs/cli-reference.zh-TW.md +133 -62
- package/docs/cli-reference.zh.md +143 -72
- package/docs/configuration-interactive-setup.md +1 -1
- package/docs/configuration-language-support.md +1 -1
- package/docs/configuration-preferences.md +1 -1
- package/docs/configuration.ja.md +104 -48
- package/docs/configuration.md +58 -2
- package/docs/configuration.zh-TW.md +99 -42
- package/docs/configuration.zh.md +78 -21
- package/docs/features-generate-documentation.ja.md +63 -44
- package/docs/features-generate-documentation.md +54 -35
- package/docs/features-generate-documentation.zh-TW.md +67 -48
- package/docs/features-generate-documentation.zh.md +61 -41
- package/docs/features-publish-your-docs.ja.md +69 -46
- package/docs/features-publish-your-docs.md +65 -42
- package/docs/features-publish-your-docs.zh-TW.md +73 -50
- package/docs/features-publish-your-docs.zh.md +67 -44
- package/docs/features-translate-documentation.ja.md +35 -33
- package/docs/features-translate-documentation.md +24 -22
- package/docs/features-translate-documentation.zh-TW.md +32 -30
- package/docs/features-translate-documentation.zh.md +29 -27
- package/docs/features-update-and-refine.ja.md +120 -66
- package/docs/features-update-and-refine.md +110 -56
- package/docs/features-update-and-refine.zh-TW.md +116 -62
- package/docs/features-update-and-refine.zh.md +118 -64
- package/docs/getting-started.ja.md +22 -22
- package/docs/getting-started.md +1 -1
- package/docs/getting-started.zh-TW.md +16 -16
- package/docs/getting-started.zh.md +28 -28
- package/docs/overview.md +3 -3
- package/docs-mcp/analyze-docs-relevance.yaml +6 -6
- package/docs-mcp/docs-search.yaml +1 -1
- package/package.json +2 -2
- package/prompts/common/document-structure/conflict-resolution-guidance.md +3 -3
- package/prompts/common/document-structure/document-structure-rules.md +2 -2
- package/prompts/detail/document-rules.md +1 -1
- package/prompts/detail/generate-document.md +1 -1
- package/prompts/evaluate/document-structure.md +6 -6
- package/prompts/structure/check-document-structure.md +10 -10
- package/prompts/structure/document-rules.md +2 -2
- package/prompts/structure/generate-structure-system.md +3 -3
- package/prompts/structure/structure-example.md +1 -1
- package/prompts/structure/structure-getting-started.md +1 -1
- package/prompts/structure/update-document-structure.md +9 -9
- package/prompts/utils/feedback-refiner.md +1 -1
- package/tests/agents/clear/choose-contents.test.mjs +1 -1
- package/tests/agents/clear/clear-document-structure.test.mjs +36 -30
- package/tests/agents/evaluate/generate-report.test.mjs +1 -1
- package/tests/agents/generate/check-need-generate-structure.test.mjs +1 -1
- package/tests/agents/generate/document-structure-tools/add-document.test.mjs +2 -2
- package/tests/agents/generate/document-structure-tools/delete-document.test.mjs +4 -4
- package/tests/agents/generate/document-structure-tools/move-document.test.mjs +3 -3
- package/tests/agents/generate/document-structure-tools/update-document.test.mjs +3 -3
- package/tests/agents/generate/user-review-document-structure.test.mjs +7 -5
- package/tests/agents/update/check-document.test.mjs +1 -1
- package/tests/agents/utils/format-document-structure.test.mjs +5 -5
- package/tests/agents/utils/load-sources.test.mjs +4 -4
- package/tests/agents/utils/save-docs.test.mjs +1 -1
- package/tests/utils/conflict-detector.test.mjs +1 -1
- package/tests/utils/docs-finder-utils.test.mjs +8 -8
- package/types/document-structure-schema.mjs +9 -9
- package/utils/conflict-detector.mjs +1 -1
- package/utils/constants/index.mjs +4 -4
- package/utils/docs-finder-utils.mjs +11 -11
- package/utils/markdown-checker.mjs +1 -1
|
@@ -34,8 +34,8 @@ describe("clear-document-structure", () => {
|
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
-
test("should clear structure
|
|
38
|
-
// Create a test structure
|
|
37
|
+
test("should clear documentation structure only when no docsDir provided", async () => {
|
|
38
|
+
// Create a test documentation structure file
|
|
39
39
|
const structurePlan = {
|
|
40
40
|
documents: [
|
|
41
41
|
{ path: "/intro", title: "Introduction" },
|
|
@@ -46,18 +46,18 @@ describe("clear-document-structure", () => {
|
|
|
46
46
|
|
|
47
47
|
const result = await clearDocumentStructure({ workDir: testDir });
|
|
48
48
|
|
|
49
|
-
expect(result.message).toContain("
|
|
49
|
+
expect(result.message).toContain("Documentation Structure cleared successfully!");
|
|
50
50
|
expect(result.hasError).toBe(false);
|
|
51
51
|
expect(result.clearedCount).toBe(1);
|
|
52
52
|
|
|
53
|
-
// Verify structure
|
|
53
|
+
// Verify documentation structure file is actually deleted
|
|
54
54
|
const { pathExists } = await import("../../../utils/file-utils.mjs");
|
|
55
55
|
const exists = await pathExists(structurePlanPath);
|
|
56
56
|
expect(exists).toBe(false);
|
|
57
57
|
});
|
|
58
58
|
|
|
59
|
-
test("should clear both structure
|
|
60
|
-
// Create structure
|
|
59
|
+
test("should clear both documentation structure and docs directory when docsDir provided", async () => {
|
|
60
|
+
// Create documentation structure
|
|
61
61
|
await writeFile(structurePlanPath, JSON.stringify({ test: "data" }));
|
|
62
62
|
|
|
63
63
|
// Create docs directory with files
|
|
@@ -67,7 +67,7 @@ describe("clear-document-structure", () => {
|
|
|
67
67
|
|
|
68
68
|
const result = await clearDocumentStructure({ workDir: testDir, docsDir });
|
|
69
69
|
|
|
70
|
-
expect(result.message).toContain("
|
|
70
|
+
expect(result.message).toContain("Documentation Structure cleared successfully!");
|
|
71
71
|
expect(result.clearedCount).toBe(2);
|
|
72
72
|
|
|
73
73
|
// Verify both are deleted
|
|
@@ -78,17 +78,17 @@ describe("clear-document-structure", () => {
|
|
|
78
78
|
expect(docsExists).toBe(false);
|
|
79
79
|
});
|
|
80
80
|
|
|
81
|
-
test("should handle non-existent structure
|
|
82
|
-
// Don't create the structure
|
|
81
|
+
test("should handle non-existent documentation structure file", async () => {
|
|
82
|
+
// Don't create the documentation structure file
|
|
83
83
|
const result = await clearDocumentStructure({ workDir: testDir });
|
|
84
84
|
|
|
85
|
-
expect(result.message).toContain("
|
|
85
|
+
expect(result.message).toContain("Documentation Structure already empty.");
|
|
86
86
|
expect(result.clearedCount).toBe(0);
|
|
87
87
|
expect(result.hasError).toBe(false);
|
|
88
88
|
});
|
|
89
89
|
|
|
90
90
|
test("should handle non-existent docs directory", async () => {
|
|
91
|
-
// Create structure
|
|
91
|
+
// Create documentation structure but not docs directory
|
|
92
92
|
await writeFile(structurePlanPath, JSON.stringify({ test: "data" }));
|
|
93
93
|
|
|
94
94
|
const nonExistentDocsDir = join(testDir, "non-existent-docs");
|
|
@@ -98,10 +98,10 @@ describe("clear-document-structure", () => {
|
|
|
98
98
|
docsDir: nonExistentDocsDir,
|
|
99
99
|
});
|
|
100
100
|
|
|
101
|
-
expect(result.message).toContain("
|
|
102
|
-
expect(result.clearedCount).toBe(1); // Only structure
|
|
101
|
+
expect(result.message).toContain("Documentation Structure cleared successfully!");
|
|
102
|
+
expect(result.clearedCount).toBe(1); // Only documentation structure cleared
|
|
103
103
|
|
|
104
|
-
// Verify structure
|
|
104
|
+
// Verify documentation structure is deleted
|
|
105
105
|
const { pathExists } = await import("../../../utils/file-utils.mjs");
|
|
106
106
|
const exists = await pathExists(structurePlanPath);
|
|
107
107
|
expect(exists).toBe(false);
|
|
@@ -114,12 +114,12 @@ describe("clear-document-structure", () => {
|
|
|
114
114
|
// Change to test directory
|
|
115
115
|
process.chdir(testDir);
|
|
116
116
|
|
|
117
|
-
// Create structure
|
|
117
|
+
// Create documentation structure in current directory's structure
|
|
118
118
|
await writeFile(structurePlanPath, JSON.stringify({ test: "data" }));
|
|
119
119
|
|
|
120
120
|
const result = await clearDocumentStructure({});
|
|
121
121
|
|
|
122
|
-
expect(result.message).toContain("
|
|
122
|
+
expect(result.message).toContain("Documentation Structure cleared successfully!");
|
|
123
123
|
expect(result.clearedCount).toBe(1);
|
|
124
124
|
} finally {
|
|
125
125
|
// Restore original working directory
|
|
@@ -159,15 +159,15 @@ describe("clear-document-structure", () => {
|
|
|
159
159
|
|
|
160
160
|
test("should have correct task metadata", () => {
|
|
161
161
|
expect(clearDocumentStructure.taskTitle).toBe(
|
|
162
|
-
"Clear
|
|
162
|
+
"Clear documentation structure and all generated documents",
|
|
163
163
|
);
|
|
164
164
|
expect(clearDocumentStructure.description).toBe(
|
|
165
|
-
"Clear the
|
|
165
|
+
"Clear the documentation structure (structure-plan.json) and optionally the documents directory",
|
|
166
166
|
);
|
|
167
167
|
});
|
|
168
168
|
|
|
169
|
-
test("should handle complex
|
|
170
|
-
// Create complex structure
|
|
169
|
+
test("should handle complex documentation structures", async () => {
|
|
170
|
+
// Create complex documentation structure
|
|
171
171
|
const complexStructure = {
|
|
172
172
|
documents: [
|
|
173
173
|
{
|
|
@@ -289,7 +289,7 @@ describe("clear-document-structure", () => {
|
|
|
289
289
|
const structureResult = result.results.find((r) => r.type === "structure");
|
|
290
290
|
expect(structureResult).toBeDefined();
|
|
291
291
|
expect(structureResult.cleared).toBe(true);
|
|
292
|
-
expect(structureResult.message).toContain("structure
|
|
292
|
+
expect(structureResult.message).toContain("documentation structure");
|
|
293
293
|
|
|
294
294
|
// Check documents result
|
|
295
295
|
const docsResult = result.results.find((r) => r.type === "documents");
|
|
@@ -298,12 +298,12 @@ describe("clear-document-structure", () => {
|
|
|
298
298
|
expect(docsResult.message).toContain("documents directory");
|
|
299
299
|
});
|
|
300
300
|
|
|
301
|
-
test("should handle structure
|
|
302
|
-
// Create a spy on rm to simulate an error for structure
|
|
301
|
+
test("should handle documentation structure file removal errors", async () => {
|
|
302
|
+
// Create a spy on rm to simulate an error for documentation structure
|
|
303
303
|
const rmSpy = spyOn(fsPromises, "rm");
|
|
304
304
|
rmSpy.mockImplementation((path, _options) => {
|
|
305
305
|
if (path.includes("structure-plan.json")) {
|
|
306
|
-
throw new Error("Permission denied for structure
|
|
306
|
+
throw new Error("Permission denied for documentation structure");
|
|
307
307
|
}
|
|
308
308
|
return Promise.resolve();
|
|
309
309
|
});
|
|
@@ -312,19 +312,21 @@ describe("clear-document-structure", () => {
|
|
|
312
312
|
const result = await clearDocumentStructure({ workDir: testDir });
|
|
313
313
|
|
|
314
314
|
expect(result.hasError).toBe(true);
|
|
315
|
-
expect(result.message).toContain(
|
|
315
|
+
expect(result.message).toContain(
|
|
316
|
+
"Documentation Structure cleanup finished with some issues.",
|
|
317
|
+
);
|
|
316
318
|
|
|
317
319
|
const structureResult = result.results.find((r) => r.type === "structure");
|
|
318
320
|
expect(structureResult.error).toBe(true);
|
|
319
|
-
expect(structureResult.message).toContain("Failed to clear
|
|
320
|
-
expect(structureResult.message).toContain("Permission denied for structure
|
|
321
|
+
expect(structureResult.message).toContain("Failed to clear documentation structure");
|
|
322
|
+
expect(structureResult.message).toContain("Permission denied for documentation structure");
|
|
321
323
|
} finally {
|
|
322
324
|
rmSpy.mockRestore();
|
|
323
325
|
}
|
|
324
326
|
});
|
|
325
327
|
|
|
326
328
|
test("should handle documents directory removal errors", async () => {
|
|
327
|
-
// Create structure
|
|
329
|
+
// Create documentation structure file
|
|
328
330
|
await writeFile(structurePlanPath, JSON.stringify({ test: "data" }));
|
|
329
331
|
|
|
330
332
|
// Create a spy on rm to simulate an error for docs directory
|
|
@@ -340,7 +342,9 @@ describe("clear-document-structure", () => {
|
|
|
340
342
|
const result = await clearDocumentStructure({ workDir: testDir, docsDir });
|
|
341
343
|
|
|
342
344
|
expect(result.hasError).toBe(true);
|
|
343
|
-
expect(result.message).toContain(
|
|
345
|
+
expect(result.message).toContain(
|
|
346
|
+
"Documentation Structure cleanup finished with some issues.",
|
|
347
|
+
);
|
|
344
348
|
|
|
345
349
|
const docsResult = result.results.find((r) => r.type === "documents");
|
|
346
350
|
expect(docsResult.error).toBe(true);
|
|
@@ -362,7 +366,9 @@ describe("clear-document-structure", () => {
|
|
|
362
366
|
const result = await clearDocumentStructure({ workDir: testDir, docsDir });
|
|
363
367
|
|
|
364
368
|
expect(result.hasError).toBe(true);
|
|
365
|
-
expect(result.message).toContain(
|
|
369
|
+
expect(result.message).toContain(
|
|
370
|
+
"Documentation Structure cleanup finished with some issues.",
|
|
371
|
+
);
|
|
366
372
|
expect(result.results).toHaveLength(2);
|
|
367
373
|
|
|
368
374
|
// Both operations should have errors
|
|
@@ -189,7 +189,7 @@ describe("generateEvaluationReport", () => {
|
|
|
189
189
|
expect(firstDoc.codeEvaluation).toBe(null);
|
|
190
190
|
});
|
|
191
191
|
|
|
192
|
-
test("should handle empty
|
|
192
|
+
test("should handle empty documentation structure", async () => {
|
|
193
193
|
const testData = {
|
|
194
194
|
structureEvaluation: {
|
|
195
195
|
purposeCoverage: {
|
|
@@ -87,7 +87,7 @@ describe("check-need-generate-structure", () => {
|
|
|
87
87
|
saveValueToConfigSpy?.mockRestore();
|
|
88
88
|
});
|
|
89
89
|
|
|
90
|
-
test("should return original
|
|
90
|
+
test("should return original documentation structure when no regeneration needed", async () => {
|
|
91
91
|
// Test when no feedback and no sidebar file exists (default mock behavior)
|
|
92
92
|
const result = await checkNeedGenerateStructure(
|
|
93
93
|
{ originalDocumentStructure, docsDir: "./docs" },
|
|
@@ -335,7 +335,7 @@ describe("add-document", () => {
|
|
|
335
335
|
});
|
|
336
336
|
|
|
337
337
|
// EDGE CASES
|
|
338
|
-
test("should handle empty
|
|
338
|
+
test("should handle empty documentation structure", async () => {
|
|
339
339
|
const result = await addDocument({
|
|
340
340
|
documentStructure: [],
|
|
341
341
|
title: "First Document",
|
|
@@ -418,7 +418,7 @@ describe("add-document", () => {
|
|
|
418
418
|
});
|
|
419
419
|
|
|
420
420
|
// DATA INTEGRITY TESTS
|
|
421
|
-
test("should not modify original
|
|
421
|
+
test("should not modify original documentation structure", async () => {
|
|
422
422
|
const originalStructure = [...baseDocumentStructure];
|
|
423
423
|
|
|
424
424
|
await addDocument({
|
|
@@ -197,7 +197,7 @@ describe("delete-document", () => {
|
|
|
197
197
|
});
|
|
198
198
|
|
|
199
199
|
// EDGE CASES
|
|
200
|
-
test("should handle empty
|
|
200
|
+
test("should handle empty documentation structure", async () => {
|
|
201
201
|
const result = await deleteDocument({
|
|
202
202
|
documentStructure: [],
|
|
203
203
|
path: "/any-path",
|
|
@@ -210,7 +210,7 @@ describe("delete-document", () => {
|
|
|
210
210
|
);
|
|
211
211
|
});
|
|
212
212
|
|
|
213
|
-
test("should handle
|
|
213
|
+
test("should handle documentation structure with single document", async () => {
|
|
214
214
|
const singleDocStructure = [
|
|
215
215
|
{
|
|
216
216
|
title: "Only Document",
|
|
@@ -313,7 +313,7 @@ describe("delete-document", () => {
|
|
|
313
313
|
});
|
|
314
314
|
|
|
315
315
|
// DATA INTEGRITY TESTS
|
|
316
|
-
test("should not modify original
|
|
316
|
+
test("should not modify original documentation structure", async () => {
|
|
317
317
|
const originalStructure = [...baseDocumentStructure];
|
|
318
318
|
|
|
319
319
|
await deleteDocument({
|
|
@@ -390,7 +390,7 @@ describe("delete-document", () => {
|
|
|
390
390
|
expect(result.deletedDocument).toHaveProperty("sourceIds");
|
|
391
391
|
});
|
|
392
392
|
|
|
393
|
-
test("should return updated
|
|
393
|
+
test("should return updated documentation structure without deleted document", async () => {
|
|
394
394
|
const originalLength = baseDocumentStructure.length;
|
|
395
395
|
const result = await deleteDocument({
|
|
396
396
|
documentStructure: baseDocumentStructure,
|
|
@@ -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
|
|
329
|
+
test("should handle empty documentation structure", async () => {
|
|
330
330
|
const result = await moveDocument({
|
|
331
331
|
documentStructure: [],
|
|
332
332
|
path: "/any-path",
|
|
@@ -339,7 +339,7 @@ describe("move-document", () => {
|
|
|
339
339
|
);
|
|
340
340
|
});
|
|
341
341
|
|
|
342
|
-
test("should handle single
|
|
342
|
+
test("should handle single documentation structure", async () => {
|
|
343
343
|
const singleDocStructure = [
|
|
344
344
|
{
|
|
345
345
|
title: "Only Document",
|
|
@@ -363,7 +363,7 @@ describe("move-document", () => {
|
|
|
363
363
|
});
|
|
364
364
|
|
|
365
365
|
// DATA INTEGRITY TESTS
|
|
366
|
-
test("should not modify original
|
|
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
|
|
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
|
|
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
|
|
380
|
+
test("should not modify original documentation structure", async () => {
|
|
381
381
|
const originalStructure = [...baseDocumentStructure];
|
|
382
382
|
|
|
383
383
|
await updateDocument({
|
|
@@ -71,13 +71,13 @@ describe("user-review-document-structure", () => {
|
|
|
71
71
|
consoleSpy?.mockRestore();
|
|
72
72
|
});
|
|
73
73
|
|
|
74
|
-
test("should return original structure when no
|
|
74
|
+
test("should return original structure when no documentation structure provided", async () => {
|
|
75
75
|
const result = await userReviewDocumentStructure({}, mockOptions);
|
|
76
76
|
|
|
77
77
|
expect(result).toBeDefined();
|
|
78
78
|
expect(result.documentStructure).toBeUndefined();
|
|
79
79
|
expect(mockOptions.prompts.select).not.toHaveBeenCalled();
|
|
80
|
-
expect(consoleSpy).toHaveBeenCalledWith("No
|
|
80
|
+
expect(consoleSpy).toHaveBeenCalledWith("No documentation structure was generated to review.");
|
|
81
81
|
});
|
|
82
82
|
|
|
83
83
|
test("should return original structure when empty array provided", async () => {
|
|
@@ -86,7 +86,7 @@ describe("user-review-document-structure", () => {
|
|
|
86
86
|
expect(result).toBeDefined();
|
|
87
87
|
expect(result.documentStructure).toEqual([]);
|
|
88
88
|
expect(mockOptions.prompts.select).not.toHaveBeenCalled();
|
|
89
|
-
expect(consoleSpy).toHaveBeenCalledWith("No
|
|
89
|
+
expect(consoleSpy).toHaveBeenCalledWith("No documentation structure was generated to review.");
|
|
90
90
|
});
|
|
91
91
|
|
|
92
92
|
test("should return original structure when user chooses not to review", async () => {
|
|
@@ -110,7 +110,9 @@ describe("user-review-document-structure", () => {
|
|
|
110
110
|
expect(result.documentStructure).toEqual(documentStructure);
|
|
111
111
|
expect(mockOptions.prompts.select).toHaveBeenCalled();
|
|
112
112
|
expect(mockOptions.prompts.input).toHaveBeenCalled();
|
|
113
|
-
expect(consoleSpy).toHaveBeenCalledWith(
|
|
113
|
+
expect(consoleSpy).toHaveBeenCalledWith(
|
|
114
|
+
expect.stringContaining("Current Documentation Structure"),
|
|
115
|
+
);
|
|
114
116
|
});
|
|
115
117
|
|
|
116
118
|
test("should process user feedback and call refineDocumentStructure agent", async () => {
|
|
@@ -188,7 +190,7 @@ describe("user-review-document-structure", () => {
|
|
|
188
190
|
|
|
189
191
|
expect(result.documentStructure).toEqual(documentStructure);
|
|
190
192
|
expect(consoleSpy).toHaveBeenCalledWith(
|
|
191
|
-
"Unable to process your feedback - the
|
|
193
|
+
"Unable to process your feedback - the documentation structure update feature is unavailable.",
|
|
192
194
|
);
|
|
193
195
|
});
|
|
194
196
|
|
|
@@ -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
|
|
180
|
+
test("should handle missing original node in documentation structure", async () => {
|
|
181
181
|
accessSpy.mockResolvedValue();
|
|
182
182
|
checkDetailResultSpy.mockResolvedValue({ isApproved: true });
|
|
183
183
|
|
|
@@ -104,7 +104,7 @@ describe("format-document-structure", () => {
|
|
|
104
104
|
});
|
|
105
105
|
|
|
106
106
|
// BASIC FUNCTIONALITY TESTS
|
|
107
|
-
test("should format empty
|
|
107
|
+
test("should format empty documentation structure", async () => {
|
|
108
108
|
const result = await formatDocumentStructure({
|
|
109
109
|
documentStructure: [],
|
|
110
110
|
});
|
|
@@ -121,7 +121,7 @@ describe("format-document-structure", () => {
|
|
|
121
121
|
});
|
|
122
122
|
});
|
|
123
123
|
|
|
124
|
-
test("should format single item
|
|
124
|
+
test("should format single item documentation structure", async () => {
|
|
125
125
|
const documentStructure = [
|
|
126
126
|
{
|
|
127
127
|
title: "Getting Started",
|
|
@@ -152,7 +152,7 @@ describe("format-document-structure", () => {
|
|
|
152
152
|
expect(result.documentStructureYaml).toBe(expectedYaml);
|
|
153
153
|
});
|
|
154
154
|
|
|
155
|
-
test("should format multiple items
|
|
155
|
+
test("should format multiple items documentation structure", async () => {
|
|
156
156
|
const documentStructure = [
|
|
157
157
|
{
|
|
158
158
|
title: "API Reference",
|
|
@@ -321,7 +321,7 @@ describe("format-document-structure", () => {
|
|
|
321
321
|
expect(result.documentStructure).toEqual(documentStructure);
|
|
322
322
|
});
|
|
323
323
|
|
|
324
|
-
test("should return both yaml string and original
|
|
324
|
+
test("should return both yaml string and original documentation structure", async () => {
|
|
325
325
|
const documentStructure = [
|
|
326
326
|
{
|
|
327
327
|
title: "Return Test",
|
|
@@ -339,7 +339,7 @@ describe("format-document-structure", () => {
|
|
|
339
339
|
expect(result.documentStructure).toBe(documentStructure); // Should be the same reference
|
|
340
340
|
});
|
|
341
341
|
|
|
342
|
-
test("should preserve original
|
|
342
|
+
test("should preserve original documentation structure unchanged", async () => {
|
|
343
343
|
const originalDocumentStructure = [
|
|
344
344
|
{
|
|
345
345
|
title: "Original",
|
|
@@ -1030,8 +1030,8 @@ describe("load-sources", () => {
|
|
|
1030
1030
|
});
|
|
1031
1031
|
});
|
|
1032
1032
|
|
|
1033
|
-
describe("Document path and
|
|
1034
|
-
test("should load existing
|
|
1033
|
+
describe("Document path and documentation structure handling", () => {
|
|
1034
|
+
test("should load existing documentation structure", async () => {
|
|
1035
1035
|
const documentStructure = {
|
|
1036
1036
|
sections: ["Introduction", "API", "Examples"],
|
|
1037
1037
|
lastUpdated: new Date().toISOString(),
|
|
@@ -1050,7 +1050,7 @@ describe("load-sources", () => {
|
|
|
1050
1050
|
expect(result.originalDocumentStructure).toEqual(documentStructure);
|
|
1051
1051
|
});
|
|
1052
1052
|
|
|
1053
|
-
test("should handle malformed
|
|
1053
|
+
test("should handle malformed documentation structure JSON", async () => {
|
|
1054
1054
|
await writeFile(path.join(tempDir, "structure-plan.json"), "{ invalid json content");
|
|
1055
1055
|
|
|
1056
1056
|
const result = await loadSources({
|
|
@@ -1064,7 +1064,7 @@ describe("load-sources", () => {
|
|
|
1064
1064
|
expect(result.originalDocumentStructure).toBeUndefined();
|
|
1065
1065
|
});
|
|
1066
1066
|
|
|
1067
|
-
test("should handle non-ENOENT errors when reading
|
|
1067
|
+
test("should handle non-ENOENT errors when reading documentation structure JSON", async () => {
|
|
1068
1068
|
// Import fs promises module to spy on
|
|
1069
1069
|
const fsPromises = await import("node:fs/promises");
|
|
1070
1070
|
|
|
@@ -52,7 +52,7 @@ describe("save-docs", () => {
|
|
|
52
52
|
expect(initialFiles).toContain("getting-started.md");
|
|
53
53
|
expect(initialFiles).toContain("old-file.md");
|
|
54
54
|
|
|
55
|
-
// Test
|
|
55
|
+
// Test documentation structure
|
|
56
56
|
const documentStructure = [
|
|
57
57
|
{
|
|
58
58
|
path: "/overview",
|
|
@@ -309,7 +309,7 @@ describe("conflict-detector", () => {
|
|
|
309
309
|
|
|
310
310
|
// Should include conflict resolution rules in final rules
|
|
311
311
|
expect(result.rules).toContain("=== Conflict Resolution Guidelines ===");
|
|
312
|
-
expect(result.rules).toContain("Create layered
|
|
312
|
+
expect(result.rules).toContain("Create layered documentation structure");
|
|
313
313
|
expect(result.rules).toContain("Create separate user paths");
|
|
314
314
|
|
|
315
315
|
// Should also include regular configuration content with enhanced format
|
|
@@ -125,7 +125,7 @@ describe("docs-finder-utils", () => {
|
|
|
125
125
|
expect(result).toBeUndefined();
|
|
126
126
|
});
|
|
127
127
|
|
|
128
|
-
test("should handle empty
|
|
128
|
+
test("should handle empty documentation structure", () => {
|
|
129
129
|
const result = findItemByFlatName([], "any-name");
|
|
130
130
|
expect(result).toBeUndefined();
|
|
131
131
|
});
|
|
@@ -243,7 +243,7 @@ describe("docs-finder-utils", () => {
|
|
|
243
243
|
expect(result).toEqual(["guide.zh.md", "overview.zh.md"]);
|
|
244
244
|
});
|
|
245
245
|
|
|
246
|
-
test("should sort files by
|
|
246
|
+
test("should sort files by documentation structure order", async () => {
|
|
247
247
|
readdirSpy.mockResolvedValue(["guide.md", "overview.md", "advanced.md"]);
|
|
248
248
|
|
|
249
249
|
const documentStructure = [{ path: "/overview" }, { path: "/guide" }, { path: "/advanced" }];
|
|
@@ -253,7 +253,7 @@ describe("docs-finder-utils", () => {
|
|
|
253
253
|
expect(result).toEqual(["overview.md", "guide.md", "advanced.md"]);
|
|
254
254
|
});
|
|
255
255
|
|
|
256
|
-
test("should handle files not in
|
|
256
|
+
test("should handle files not in documentation structure", async () => {
|
|
257
257
|
readdirSpy.mockResolvedValue(["guide.md", "extra.md", "overview.md"]);
|
|
258
258
|
|
|
259
259
|
const documentStructure = [{ path: "/overview" }, { path: "/guide" }];
|
|
@@ -480,7 +480,7 @@ describe("docs-finder-utils", () => {
|
|
|
480
480
|
]);
|
|
481
481
|
});
|
|
482
482
|
|
|
483
|
-
test("should warn for files not in
|
|
483
|
+
test("should warn for files not in documentation structure", async () => {
|
|
484
484
|
readFileSpy.mockResolvedValue("content");
|
|
485
485
|
|
|
486
486
|
const selectedFiles = ["unknown.md"];
|
|
@@ -488,7 +488,7 @@ describe("docs-finder-utils", () => {
|
|
|
488
488
|
|
|
489
489
|
expect(result).toEqual([]);
|
|
490
490
|
expect(consoleWarnSpy).toHaveBeenCalledWith(
|
|
491
|
-
"⚠️ No
|
|
491
|
+
"⚠️ No documentation structure item found for file: unknown.md",
|
|
492
492
|
);
|
|
493
493
|
});
|
|
494
494
|
|
|
@@ -508,7 +508,7 @@ describe("docs-finder-utils", () => {
|
|
|
508
508
|
},
|
|
509
509
|
]);
|
|
510
510
|
expect(consoleWarnSpy).toHaveBeenCalledWith(
|
|
511
|
-
"⚠️ No
|
|
511
|
+
"⚠️ No documentation structure item found for file: unknown.md",
|
|
512
512
|
);
|
|
513
513
|
});
|
|
514
514
|
|
|
@@ -623,14 +623,14 @@ describe("docs-finder-utils", () => {
|
|
|
623
623
|
await expect(getMainLanguageFiles("/denied", "en")).rejects.toThrow("Permission denied");
|
|
624
624
|
});
|
|
625
625
|
|
|
626
|
-
test("processSelectedFiles should handle empty
|
|
626
|
+
test("processSelectedFiles should handle empty documentation structure", async () => {
|
|
627
627
|
readFileSpy.mockResolvedValue("content");
|
|
628
628
|
|
|
629
629
|
const result = await processSelectedFiles(["test.md"], [], "/docs");
|
|
630
630
|
|
|
631
631
|
expect(result).toEqual([]);
|
|
632
632
|
expect(consoleWarnSpy).toHaveBeenCalledWith(
|
|
633
|
-
"⚠️ No
|
|
633
|
+
"⚠️ No documentation structure item found for file: test.md",
|
|
634
634
|
);
|
|
635
635
|
});
|
|
636
636
|
});
|
|
@@ -10,7 +10,7 @@ export const documentItemSchema = z.object({
|
|
|
10
10
|
sourceIds: z.array(z.string()).min(1, "At least one source ID is required"),
|
|
11
11
|
});
|
|
12
12
|
|
|
13
|
-
//
|
|
13
|
+
// Documentation structure schema - represents the entire documentation structure array
|
|
14
14
|
export const documentStructureSchema = z.array(documentItemSchema);
|
|
15
15
|
|
|
16
16
|
// Add document schemas
|
|
@@ -80,7 +80,7 @@ export const getAddDocumentInputJsonSchema = () => {
|
|
|
80
80
|
const schema = zodToJsonSchema(addDocumentInputSchema);
|
|
81
81
|
// Add custom descriptions
|
|
82
82
|
if (schema.properties) {
|
|
83
|
-
schema.properties.documentStructure.description = "Current
|
|
83
|
+
schema.properties.documentStructure.description = "Current documentation structure array";
|
|
84
84
|
schema.properties.title.description = "Title of the new document";
|
|
85
85
|
schema.properties.description.description = "Description of the new document";
|
|
86
86
|
schema.properties.path.description = "URL path for the new document (must start with '/')";
|
|
@@ -96,7 +96,7 @@ export const getAddDocumentOutputJsonSchema = () => {
|
|
|
96
96
|
const schema = zodToJsonSchema(addDocumentOutputSchema);
|
|
97
97
|
if (schema.properties) {
|
|
98
98
|
schema.properties.documentStructure.description =
|
|
99
|
-
"Updated
|
|
99
|
+
"Updated documentation structure array with the new document added";
|
|
100
100
|
schema.properties.addedDocument.description = "The newly added document object";
|
|
101
101
|
}
|
|
102
102
|
return schema;
|
|
@@ -105,7 +105,7 @@ export const getAddDocumentOutputJsonSchema = () => {
|
|
|
105
105
|
export const getDeleteDocumentInputJsonSchema = () => {
|
|
106
106
|
const schema = zodToJsonSchema(deleteDocumentInputSchema);
|
|
107
107
|
if (schema.properties) {
|
|
108
|
-
schema.properties.documentStructure.description = "Current
|
|
108
|
+
schema.properties.documentStructure.description = "Current documentation structure array";
|
|
109
109
|
schema.properties.path.description = "URL path of the document to delete";
|
|
110
110
|
}
|
|
111
111
|
return schema;
|
|
@@ -115,7 +115,7 @@ export const getDeleteDocumentOutputJsonSchema = () => {
|
|
|
115
115
|
const schema = zodToJsonSchema(deleteDocumentOutputSchema);
|
|
116
116
|
if (schema.properties) {
|
|
117
117
|
schema.properties.documentStructure.description =
|
|
118
|
-
"Updated
|
|
118
|
+
"Updated documentation structure array with the document removed";
|
|
119
119
|
schema.properties.deletedDocument.description = "The deleted document object";
|
|
120
120
|
}
|
|
121
121
|
return schema;
|
|
@@ -124,7 +124,7 @@ export const getDeleteDocumentOutputJsonSchema = () => {
|
|
|
124
124
|
export const getMoveDocumentInputJsonSchema = () => {
|
|
125
125
|
const schema = zodToJsonSchema(moveDocumentInputSchema);
|
|
126
126
|
if (schema.properties) {
|
|
127
|
-
schema.properties.documentStructure.description = "Current
|
|
127
|
+
schema.properties.documentStructure.description = "Current documentation structure array";
|
|
128
128
|
schema.properties.path.description = "URL path of the document to move";
|
|
129
129
|
schema.properties.newParentId.description =
|
|
130
130
|
"Path of the new parent document (leave empty for top-level)";
|
|
@@ -136,7 +136,7 @@ export const getMoveDocumentOutputJsonSchema = () => {
|
|
|
136
136
|
const schema = zodToJsonSchema(moveDocumentOutputSchema);
|
|
137
137
|
if (schema.properties) {
|
|
138
138
|
schema.properties.documentStructure.description =
|
|
139
|
-
"Updated
|
|
139
|
+
"Updated documentation structure array with the document moved";
|
|
140
140
|
schema.properties.originalDocument.description = "The original document object before moving";
|
|
141
141
|
schema.properties.updatedDocument.description = "The updated document object after moving";
|
|
142
142
|
}
|
|
@@ -146,7 +146,7 @@ export const getMoveDocumentOutputJsonSchema = () => {
|
|
|
146
146
|
export const getUpdateDocumentInputJsonSchema = () => {
|
|
147
147
|
const schema = zodToJsonSchema(updateDocumentInputSchema);
|
|
148
148
|
if (schema.properties) {
|
|
149
|
-
schema.properties.documentStructure.description = "Current
|
|
149
|
+
schema.properties.documentStructure.description = "Current documentation structure array";
|
|
150
150
|
schema.properties.path.description = "URL path of the document to update";
|
|
151
151
|
schema.properties.title.description = "New title for the document (optional)";
|
|
152
152
|
schema.properties.description.description = "New description for the document (optional)";
|
|
@@ -166,7 +166,7 @@ export const getUpdateDocumentOutputJsonSchema = () => {
|
|
|
166
166
|
const schema = zodToJsonSchema(updateDocumentOutputSchema);
|
|
167
167
|
if (schema.properties) {
|
|
168
168
|
schema.properties.documentStructure.description =
|
|
169
|
-
"Updated
|
|
169
|
+
"Updated documentation structure array with the document modified";
|
|
170
170
|
schema.properties.originalDocument.description = "The original document object before update";
|
|
171
171
|
schema.properties.updatedDocument.description =
|
|
172
172
|
"The updated document object after modification";
|
|
@@ -76,7 +76,7 @@ export function getFilteredOptions(targetQuestion, currentSelections, allOptions
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
/**
|
|
79
|
-
* Detect conflicts in user configuration selections that can be resolved through
|
|
79
|
+
* Detect conflicts in user configuration selections that can be resolved through documentation structure
|
|
80
80
|
* @param {Object} config - User configuration
|
|
81
81
|
* @returns {Array} Array of detected conflicts with resolution strategies
|
|
82
82
|
*/
|