@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.
- package/.aigne/doc-smith/config.yaml +3 -1
- package/.aigne/doc-smith/output/structure-plan.json +2 -2
- package/.aigne/doc-smith/preferences.yml +28 -20
- package/.aigne/doc-smith/upload-cache.yaml +702 -0
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +22 -2
- package/README.md +2 -2
- 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 +38 -13
- package/agents/generate/document-structure-tools/delete-document.mjs +37 -14
- package/agents/generate/document-structure-tools/move-document.mjs +46 -19
- package/agents/generate/document-structure-tools/update-document.mjs +39 -12
- package/agents/generate/generate-structure.yaml +1 -1
- package/agents/generate/update-document-structure.yaml +3 -9
- package/agents/generate/user-review-document-structure.mjs +15 -14
- package/agents/translate/translate-document.yaml +1 -9
- package/agents/update/batch-generate-document.yaml +1 -1
- package/agents/update/check-document.mjs +2 -2
- package/agents/update/check-update-is-single.mjs +2 -1
- package/agents/update/document-tools/update-document-content.mjs +24 -14
- package/agents/update/fs-tools/glob.mjs +184 -0
- package/agents/update/fs-tools/grep.mjs +317 -0
- package/agents/update/fs-tools/read-file.mjs +307 -0
- package/agents/update/generate-document.yaml +4 -7
- package/agents/update/update-document-detail.yaml +6 -10
- package/agents/update/user-review-document.mjs +13 -13
- 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/assets/screenshots/doc-complete-setup.png +0 -0
- package/assets/screenshots/doc-generate-docs.png +0 -0
- package/assets/screenshots/doc-generate.png +0 -0
- package/assets/screenshots/doc-generated-successfully.png +0 -0
- package/assets/screenshots/doc-publish.png +0 -0
- package/assets/screenshots/doc-regenerate.png +0 -0
- package/assets/screenshots/doc-translate-langs.png +0 -0
- package/assets/screenshots/doc-translate.png +0 -0
- package/assets/screenshots/doc-update.png +0 -0
- package/docs/_sidebar.md +1 -1
- package/docs/advanced-how-it-works.ja.md +31 -31
- package/docs/advanced-how-it-works.md +10 -10
- package/docs/advanced-how-it-works.zh-TW.md +24 -24
- package/docs/advanced-how-it-works.zh.md +20 -20
- package/docs/advanced-quality-assurance.ja.md +57 -61
- package/docs/advanced-quality-assurance.md +57 -61
- package/docs/advanced-quality-assurance.zh-TW.md +57 -61
- package/docs/advanced-quality-assurance.zh.md +57 -61
- package/docs/advanced.ja.md +8 -4
- package/docs/advanced.md +7 -3
- package/docs/advanced.zh-TW.md +9 -5
- package/docs/advanced.zh.md +9 -5
- package/docs/changelog.ja.md +206 -29
- package/docs/changelog.md +177 -0
- package/docs/changelog.zh-TW.md +229 -52
- package/docs/changelog.zh.md +204 -27
- package/docs/cli-reference.ja.md +181 -80
- package/docs/cli-reference.md +168 -67
- package/docs/cli-reference.zh-TW.md +177 -76
- package/docs/cli-reference.zh.md +172 -71
- package/docs/configuration-interactive-setup.ja.md +45 -42
- package/docs/configuration-interactive-setup.md +9 -6
- package/docs/configuration-interactive-setup.zh-TW.md +26 -23
- package/docs/configuration-interactive-setup.zh.md +25 -22
- package/docs/configuration-language-support.ja.md +33 -63
- package/docs/configuration-language-support.md +32 -62
- package/docs/configuration-language-support.zh-TW.md +35 -65
- package/docs/configuration-language-support.zh.md +32 -62
- package/docs/configuration-llm-setup.ja.md +25 -23
- package/docs/configuration-llm-setup.md +20 -18
- package/docs/configuration-llm-setup.zh-TW.md +21 -19
- package/docs/configuration-llm-setup.zh.md +20 -18
- package/docs/configuration-preferences.ja.md +67 -52
- package/docs/configuration-preferences.md +55 -40
- package/docs/configuration-preferences.zh-TW.md +69 -54
- package/docs/configuration-preferences.zh.md +68 -53
- package/docs/configuration.ja.md +98 -58
- package/docs/configuration.md +42 -2
- package/docs/configuration.zh-TW.md +86 -46
- package/docs/configuration.zh.md +76 -36
- package/docs/features-generate-documentation.ja.md +49 -55
- package/docs/features-generate-documentation.md +49 -55
- package/docs/features-generate-documentation.zh-TW.md +54 -60
- package/docs/features-generate-documentation.zh.md +48 -54
- package/docs/features-publish-your-docs.ja.md +68 -45
- package/docs/features-publish-your-docs.md +65 -42
- package/docs/features-publish-your-docs.zh-TW.md +74 -51
- package/docs/features-publish-your-docs.zh.md +67 -44
- package/docs/features-translate-documentation.ja.md +46 -35
- package/docs/features-translate-documentation.md +39 -28
- package/docs/features-translate-documentation.zh-TW.md +45 -34
- package/docs/features-translate-documentation.zh.md +39 -28
- package/docs/features-update-and-refine.ja.md +75 -71
- package/docs/features-update-and-refine.md +67 -63
- package/docs/features-update-and-refine.zh-TW.md +72 -67
- package/docs/features-update-and-refine.zh.md +71 -67
- package/docs/features.ja.md +29 -19
- package/docs/features.md +25 -15
- package/docs/features.zh-TW.md +28 -18
- package/docs/features.zh.md +31 -21
- package/docs/getting-started.ja.md +43 -46
- package/docs/getting-started.md +36 -39
- package/docs/getting-started.zh-TW.md +41 -44
- package/docs/getting-started.zh.md +39 -42
- package/docs/overview.ja.md +63 -11
- package/docs/overview.md +62 -10
- package/docs/overview.zh-TW.md +67 -15
- package/docs/overview.zh.md +62 -10
- package/docs-mcp/analyze-docs-relevance.yaml +6 -6
- package/docs-mcp/docs-search.yaml +1 -1
- package/media.md +9 -9
- 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/custom/custom-components.md +304 -188
- package/prompts/detail/document-rules.md +5 -5
- package/prompts/detail/generate-document.md +21 -8
- package/prompts/detail/update-document.md +8 -12
- 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 +18 -14
- package/prompts/utils/feedback-refiner.md +3 -3
- 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 +12 -12
- package/tests/agents/generate/document-structure-tools/update-document.test.mjs +3 -3
- package/tests/agents/generate/user-review-document-structure.test.mjs +36 -13
- package/tests/agents/update/check-document.test.mjs +1 -1
- package/tests/agents/update/document-tools/update-document-content.test.mjs +115 -112
- package/tests/agents/update/fs-tools/glob.test.mjs +438 -0
- package/tests/agents/update/fs-tools/grep.test.mjs +279 -0
- package/tests/agents/update/fs-tools/read-file.test.mjs +553 -0
- package/tests/agents/update/user-review-document.test.mjs +48 -27
- 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-schema.mjs +5 -6
- package/types/document-structure-schema.mjs +25 -13
- 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
|
@@ -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
|
});
|
|
@@ -3,22 +3,20 @@ import { zodToJsonSchema } from "zod-to-json-schema";
|
|
|
3
3
|
|
|
4
4
|
// Update document content schemas
|
|
5
5
|
export const updateDocumentContentInputSchema = z.object({
|
|
6
|
-
originalContent: z.string().min(1, "Original content is required"),
|
|
7
6
|
diffPatch: z.string().min(1, "Diff patch is required"),
|
|
8
7
|
});
|
|
9
8
|
|
|
10
9
|
export const updateDocumentContentOutputSchema = z.object({
|
|
11
10
|
success: z.boolean(),
|
|
12
11
|
updatedContent: z.string().optional(),
|
|
13
|
-
error: z.string().optional(),
|
|
14
|
-
message: z.string(),
|
|
12
|
+
error: z.object({ message: z.string() }).optional(),
|
|
13
|
+
message: z.string().optional(),
|
|
15
14
|
});
|
|
16
15
|
|
|
17
16
|
// JSON Schema conversions for update document content
|
|
18
17
|
export const getUpdateDocumentContentInputJsonSchema = () => {
|
|
19
18
|
const schema = zodToJsonSchema(updateDocumentContentInputSchema);
|
|
20
19
|
if (schema.properties) {
|
|
21
|
-
schema.properties.originalContent.description = "Original markdown content to be updated";
|
|
22
20
|
schema.properties.diffPatch.description = "Diff patch string to apply to the original content";
|
|
23
21
|
}
|
|
24
22
|
return schema;
|
|
@@ -30,8 +28,9 @@ export const getUpdateDocumentContentOutputJsonSchema = () => {
|
|
|
30
28
|
schema.properties.success.description = "Whether the update was successful";
|
|
31
29
|
schema.properties.updatedContent.description =
|
|
32
30
|
"Updated markdown content (only present if success is true)";
|
|
33
|
-
schema.properties.error.description =
|
|
34
|
-
|
|
31
|
+
schema.properties.error.description =
|
|
32
|
+
"Error object containing error message (only present if success is false)";
|
|
33
|
+
schema.properties.message.description = "Success message (only present if success is true)";
|
|
35
34
|
}
|
|
36
35
|
return schema;
|
|
37
36
|
};
|
|
@@ -10,12 +10,11 @@ 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
|
|
17
17
|
export const addDocumentInputSchema = z.object({
|
|
18
|
-
documentStructure: documentStructureSchema,
|
|
19
18
|
title: z.string().min(1, "Title is required"),
|
|
20
19
|
description: z.string().min(1, "Description is required"),
|
|
21
20
|
path: z.string().startsWith("/", 'Path must start with "/"'),
|
|
@@ -25,37 +24,40 @@ export const addDocumentInputSchema = z.object({
|
|
|
25
24
|
|
|
26
25
|
export const addDocumentOutputSchema = z.object({
|
|
27
26
|
documentStructure: documentStructureSchema,
|
|
27
|
+
message: z.string().optional(),
|
|
28
28
|
addedDocument: documentItemSchema.optional(),
|
|
29
|
+
error: z.object({ message: z.string() }).optional(),
|
|
29
30
|
});
|
|
30
31
|
|
|
31
32
|
// Delete document schemas
|
|
32
33
|
export const deleteDocumentInputSchema = z.object({
|
|
33
|
-
documentStructure: documentStructureSchema,
|
|
34
34
|
path: z.string().min(1, "Path is required"),
|
|
35
35
|
});
|
|
36
36
|
|
|
37
37
|
export const deleteDocumentOutputSchema = z.object({
|
|
38
38
|
documentStructure: documentStructureSchema,
|
|
39
|
+
message: z.string().optional(),
|
|
39
40
|
deletedDocument: documentItemSchema.optional(),
|
|
41
|
+
error: z.object({ message: z.string() }).optional(),
|
|
40
42
|
});
|
|
41
43
|
|
|
42
44
|
// Move document schemas
|
|
43
45
|
export const moveDocumentInputSchema = z.object({
|
|
44
|
-
documentStructure: documentStructureSchema,
|
|
45
46
|
path: z.string().min(1, "Path is required"),
|
|
46
47
|
newParentId: z.string().nullable().optional(),
|
|
47
48
|
});
|
|
48
49
|
|
|
49
50
|
export const moveDocumentOutputSchema = z.object({
|
|
50
51
|
documentStructure: documentStructureSchema,
|
|
52
|
+
message: z.string().optional(),
|
|
51
53
|
originalDocument: documentItemSchema.optional(),
|
|
52
54
|
updatedDocument: documentItemSchema.optional(),
|
|
55
|
+
error: z.object({ message: z.string() }).optional(),
|
|
53
56
|
});
|
|
54
57
|
|
|
55
58
|
// Update document schemas
|
|
56
59
|
export const updateDocumentInputSchema = z
|
|
57
60
|
.object({
|
|
58
|
-
documentStructure: documentStructureSchema,
|
|
59
61
|
path: z.string().min(1, "Path is required"),
|
|
60
62
|
title: z.string().min(1).optional(),
|
|
61
63
|
description: z.string().min(1).optional(),
|
|
@@ -71,8 +73,10 @@ export const updateDocumentInputSchema = z
|
|
|
71
73
|
|
|
72
74
|
export const updateDocumentOutputSchema = z.object({
|
|
73
75
|
documentStructure: documentStructureSchema,
|
|
76
|
+
message: z.string().optional(),
|
|
74
77
|
originalDocument: documentItemSchema.optional(),
|
|
75
78
|
updatedDocument: documentItemSchema.optional(),
|
|
79
|
+
error: z.object({ message: z.string() }).optional(),
|
|
76
80
|
});
|
|
77
81
|
|
|
78
82
|
// JSON Schema conversion functions using zodToJsonSchema
|
|
@@ -80,7 +84,6 @@ export const getAddDocumentInputJsonSchema = () => {
|
|
|
80
84
|
const schema = zodToJsonSchema(addDocumentInputSchema);
|
|
81
85
|
// Add custom descriptions
|
|
82
86
|
if (schema.properties) {
|
|
83
|
-
schema.properties.documentStructure.description = "Current document structure array";
|
|
84
87
|
schema.properties.title.description = "Title of the new document";
|
|
85
88
|
schema.properties.description.description = "Description of the new document";
|
|
86
89
|
schema.properties.path.description = "URL path for the new document (must start with '/')";
|
|
@@ -96,8 +99,11 @@ export const getAddDocumentOutputJsonSchema = () => {
|
|
|
96
99
|
const schema = zodToJsonSchema(addDocumentOutputSchema);
|
|
97
100
|
if (schema.properties) {
|
|
98
101
|
schema.properties.documentStructure.description =
|
|
99
|
-
"Updated
|
|
102
|
+
"Updated documentation structure array with the new document added";
|
|
103
|
+
schema.properties.message.description = "Success message describing the operation result";
|
|
100
104
|
schema.properties.addedDocument.description = "The newly added document object";
|
|
105
|
+
schema.properties.error.description =
|
|
106
|
+
"Error object containing error message if operation failed";
|
|
101
107
|
}
|
|
102
108
|
return schema;
|
|
103
109
|
};
|
|
@@ -105,7 +111,6 @@ export const getAddDocumentOutputJsonSchema = () => {
|
|
|
105
111
|
export const getDeleteDocumentInputJsonSchema = () => {
|
|
106
112
|
const schema = zodToJsonSchema(deleteDocumentInputSchema);
|
|
107
113
|
if (schema.properties) {
|
|
108
|
-
schema.properties.documentStructure.description = "Current document structure array";
|
|
109
114
|
schema.properties.path.description = "URL path of the document to delete";
|
|
110
115
|
}
|
|
111
116
|
return schema;
|
|
@@ -115,8 +120,11 @@ export const getDeleteDocumentOutputJsonSchema = () => {
|
|
|
115
120
|
const schema = zodToJsonSchema(deleteDocumentOutputSchema);
|
|
116
121
|
if (schema.properties) {
|
|
117
122
|
schema.properties.documentStructure.description =
|
|
118
|
-
"Updated
|
|
123
|
+
"Updated documentation structure array with the document removed";
|
|
124
|
+
schema.properties.message.description = "Success message describing the operation result";
|
|
119
125
|
schema.properties.deletedDocument.description = "The deleted document object";
|
|
126
|
+
schema.properties.error.description =
|
|
127
|
+
"Error object containing error message if operation failed";
|
|
120
128
|
}
|
|
121
129
|
return schema;
|
|
122
130
|
};
|
|
@@ -124,7 +132,6 @@ export const getDeleteDocumentOutputJsonSchema = () => {
|
|
|
124
132
|
export const getMoveDocumentInputJsonSchema = () => {
|
|
125
133
|
const schema = zodToJsonSchema(moveDocumentInputSchema);
|
|
126
134
|
if (schema.properties) {
|
|
127
|
-
schema.properties.documentStructure.description = "Current document structure array";
|
|
128
135
|
schema.properties.path.description = "URL path of the document to move";
|
|
129
136
|
schema.properties.newParentId.description =
|
|
130
137
|
"Path of the new parent document (leave empty for top-level)";
|
|
@@ -136,9 +143,12 @@ export const getMoveDocumentOutputJsonSchema = () => {
|
|
|
136
143
|
const schema = zodToJsonSchema(moveDocumentOutputSchema);
|
|
137
144
|
if (schema.properties) {
|
|
138
145
|
schema.properties.documentStructure.description =
|
|
139
|
-
"Updated
|
|
146
|
+
"Updated documentation structure array with the document moved";
|
|
147
|
+
schema.properties.message.description = "Success message describing the operation result";
|
|
140
148
|
schema.properties.originalDocument.description = "The original document object before moving";
|
|
141
149
|
schema.properties.updatedDocument.description = "The updated document object after moving";
|
|
150
|
+
schema.properties.error.description =
|
|
151
|
+
"Error object containing error message if operation failed";
|
|
142
152
|
}
|
|
143
153
|
return schema;
|
|
144
154
|
};
|
|
@@ -146,7 +156,6 @@ export const getMoveDocumentOutputJsonSchema = () => {
|
|
|
146
156
|
export const getUpdateDocumentInputJsonSchema = () => {
|
|
147
157
|
const schema = zodToJsonSchema(updateDocumentInputSchema);
|
|
148
158
|
if (schema.properties) {
|
|
149
|
-
schema.properties.documentStructure.description = "Current document structure array";
|
|
150
159
|
schema.properties.path.description = "URL path of the document to update";
|
|
151
160
|
schema.properties.title.description = "New title for the document (optional)";
|
|
152
161
|
schema.properties.description.description = "New description for the document (optional)";
|
|
@@ -166,10 +175,13 @@ export const getUpdateDocumentOutputJsonSchema = () => {
|
|
|
166
175
|
const schema = zodToJsonSchema(updateDocumentOutputSchema);
|
|
167
176
|
if (schema.properties) {
|
|
168
177
|
schema.properties.documentStructure.description =
|
|
169
|
-
"Updated
|
|
178
|
+
"Updated documentation structure array with the document modified";
|
|
179
|
+
schema.properties.message.description = "Success message describing the operation result";
|
|
170
180
|
schema.properties.originalDocument.description = "The original document object before update";
|
|
171
181
|
schema.properties.updatedDocument.description =
|
|
172
182
|
"The updated document object after modification";
|
|
183
|
+
schema.properties.error.description =
|
|
184
|
+
"Error object containing error message if operation failed";
|
|
173
185
|
}
|
|
174
186
|
return schema;
|
|
175
187
|
};
|
|
@@ -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
|
*/
|
|
@@ -350,7 +350,7 @@ export const SUPPORTED_FILE_EXTENSIONS = [".txt", ".md", ".json", ".yaml", ".yml
|
|
|
350
350
|
export const CONFLICT_RULES = {
|
|
351
351
|
// Internal conflicts within the same question (multi-select conflicts)
|
|
352
352
|
internalConflicts: {
|
|
353
|
-
// Note: Most conflicts can be resolved through intelligent
|
|
353
|
+
// Note: Most conflicts can be resolved through intelligent documentation structure
|
|
354
354
|
// Only keeping conflicts that represent fundamental incompatibilities
|
|
355
355
|
},
|
|
356
356
|
|
|
@@ -424,7 +424,7 @@ export const CONFLICT_RULES = {
|
|
|
424
424
|
|
|
425
425
|
// Conflict resolution rules - defines how to handle conflicts when users select conflicting options
|
|
426
426
|
export const CONFLICT_RESOLUTION_RULES = {
|
|
427
|
-
// Document purpose conflicts that can be resolved through
|
|
427
|
+
// Document purpose conflicts that can be resolved through documentation structure
|
|
428
428
|
documentPurpose: [
|
|
429
429
|
{
|
|
430
430
|
conflictItems: ["getStarted", "findAnswers"],
|
|
@@ -451,7 +451,7 @@ export const CONFLICT_RESOLUTION_RULES = {
|
|
|
451
451
|
},
|
|
452
452
|
],
|
|
453
453
|
|
|
454
|
-
// Target audience conflicts that can be resolved through
|
|
454
|
+
// Target audience conflicts that can be resolved through documentation structure
|
|
455
455
|
targetAudienceTypes: [
|
|
456
456
|
{
|
|
457
457
|
conflictItems: ["endUsers", "developers"],
|
|
@@ -475,7 +475,7 @@ export const CONFLICT_RESOLUTION_RULES = {
|
|
|
475
475
|
// Resolution strategy descriptions
|
|
476
476
|
export const RESOLUTION_STRATEGIES = {
|
|
477
477
|
layered_structure: (items) =>
|
|
478
|
-
`Detected "${items.join('" and "')}" purpose conflict. Resolution strategy: Create layered
|
|
478
|
+
`Detected "${items.join('" and "')}" purpose conflict. Resolution strategy: Create layered documentation structure
|
|
479
479
|
- Quick start section: Uses "get started" style - optimizes for speed, key steps, working examples, skips complex edge cases
|
|
480
480
|
- API reference section: Uses "find answers" style - comprehensive coverage, searchability, rich examples, skips narrative flow
|
|
481
481
|
- Ensure sections complement rather than conflict with each other`,
|
|
@@ -24,8 +24,8 @@ function generateFileName(flatName, locale) {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
|
-
* Find a single item by path in
|
|
28
|
-
* @param {Array} documentExecutionStructure - Array of
|
|
27
|
+
* Find a single item by path in documentation structure result and read its content
|
|
28
|
+
* @param {Array} documentExecutionStructure - Array of documentation structure items
|
|
29
29
|
* @param {string} docPath - Document path to find (supports .md filenames)
|
|
30
30
|
* @param {string} boardId - Board ID for fallback matching
|
|
31
31
|
* @param {string} docsDir - Docs directory path for reading content
|
|
@@ -116,7 +116,7 @@ export async function readFileContent(docsDir, fileName) {
|
|
|
116
116
|
* Get main language markdown files from docs directory
|
|
117
117
|
* @param {string} docsDir - Docs directory path
|
|
118
118
|
* @param {string} locale - Main language locale (e.g., 'en', 'zh', 'fr')
|
|
119
|
-
* @param {Array} documentExecutionStructure - Array of
|
|
119
|
+
* @param {Array} documentExecutionStructure - Array of documentation structure items to determine file order
|
|
120
120
|
* @returns {Promise<string[]>} Array of main language .md files ordered by documentExecutionStructure
|
|
121
121
|
*/
|
|
122
122
|
export async function getMainLanguageFiles(docsDir, locale, documentExecutionStructure = null) {
|
|
@@ -153,7 +153,7 @@ export async function getMainLanguageFiles(docsDir, locale, documentExecutionStr
|
|
|
153
153
|
|
|
154
154
|
// If documentExecutionStructure is provided, sort files according to the order in documentExecutionStructure
|
|
155
155
|
if (documentExecutionStructure && Array.isArray(documentExecutionStructure)) {
|
|
156
|
-
// Create a map from flat file name to
|
|
156
|
+
// Create a map from flat file name to documentation structure order
|
|
157
157
|
const orderMap = new Map();
|
|
158
158
|
documentExecutionStructure.forEach((item, index) => {
|
|
159
159
|
const itemFlattenedPath = item.path.replace(/^\//, "").replace(/\//g, "-");
|
|
@@ -166,16 +166,16 @@ export async function getMainLanguageFiles(docsDir, locale, documentExecutionStr
|
|
|
166
166
|
const orderA = orderMap.get(a);
|
|
167
167
|
const orderB = orderMap.get(b);
|
|
168
168
|
|
|
169
|
-
// If both files are in the
|
|
169
|
+
// If both files are in the documentation structure, sort by order
|
|
170
170
|
if (orderA !== undefined && orderB !== undefined) {
|
|
171
171
|
return orderA - orderB;
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
// If only one file is in the
|
|
174
|
+
// If only one file is in the documentation structure, it comes first
|
|
175
175
|
if (orderA !== undefined) return -1;
|
|
176
176
|
if (orderB !== undefined) return 1;
|
|
177
177
|
|
|
178
|
-
// If neither file is in the
|
|
178
|
+
// If neither file is in the documentation structure, maintain alphabetical order
|
|
179
179
|
return a.localeCompare(b);
|
|
180
180
|
});
|
|
181
181
|
}
|
|
@@ -200,8 +200,8 @@ export function fileNameToFlatPath(fileName) {
|
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
/**
|
|
203
|
-
* Find
|
|
204
|
-
* @param {Array} documentExecutionStructure - Array of
|
|
203
|
+
* Find documentation structure item by flattened file name
|
|
204
|
+
* @param {Array} documentExecutionStructure - Array of documentation structure items
|
|
205
205
|
* @param {string} flatName - Flattened file name
|
|
206
206
|
* @returns {Object|null} Found item or null
|
|
207
207
|
*/
|
|
@@ -215,7 +215,7 @@ export function findItemByFlatName(documentExecutionStructure, flatName) {
|
|
|
215
215
|
/**
|
|
216
216
|
* Process selected files and convert to found items with content
|
|
217
217
|
* @param {string[]} selectedFiles - Array of selected file names
|
|
218
|
-
* @param {Array} documentExecutionStructure - Array of
|
|
218
|
+
* @param {Array} documentExecutionStructure - Array of documentation structure items
|
|
219
219
|
* @param {string} docsDir - Docs directory path
|
|
220
220
|
* @returns {Promise<Object[]>} Array of found items with content
|
|
221
221
|
*/
|
|
@@ -244,7 +244,7 @@ export async function processSelectedFiles(selectedFiles, documentExecutionStruc
|
|
|
244
244
|
|
|
245
245
|
foundItems.push(result);
|
|
246
246
|
} else {
|
|
247
|
-
console.warn(`⚠️ No
|
|
247
|
+
console.warn(`⚠️ No documentation structure item found for file: ${selectedFile}`);
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
250
|
|
|
@@ -87,7 +87,7 @@ function checkDeadLinks(markdown, source, allowedLinks, errorMessages) {
|
|
|
87
87
|
// Check if this link is in the allowed links set
|
|
88
88
|
if (!allowedLinks.has(path)) {
|
|
89
89
|
errorMessages.push(
|
|
90
|
-
`Found a dead link in ${source}: [${match[1]}](${trimLink}), ensure the link exists in the
|
|
90
|
+
`Found a dead link in ${source}: [${match[1]}](${trimLink}), ensure the link exists in the documentation structure path`,
|
|
91
91
|
);
|
|
92
92
|
}
|
|
93
93
|
}
|