@aigne/doc-smith 0.8.12-beta.2 → 0.8.12-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.aigne/doc-smith/config.yaml +9 -6
- package/.aigne/doc-smith/output/structure-plan.json +123 -109
- package/.aigne/doc-smith/upload-cache.yaml +48 -0
- package/.github/workflows/publish-docs.yml +4 -7
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +20 -0
- package/agents/clear/choose-contents.mjs +22 -5
- package/agents/clear/clear-auth-tokens.mjs +2 -4
- package/agents/clear/clear-deployment-config.mjs +49 -0
- package/agents/clear/clear-document-config.mjs +2 -5
- package/agents/clear/clear-document-structure.mjs +2 -6
- package/agents/clear/clear-generated-docs.mjs +0 -1
- package/agents/generate/check-need-generate-structure.mjs +15 -60
- package/agents/generate/document-structure-tools/generate-sub-structure.mjs +131 -0
- package/agents/generate/generate-structure-without-tools.yaml +65 -0
- package/agents/generate/generate-structure.yaml +7 -1
- package/agents/generate/index.yaml +0 -3
- package/agents/generate/update-document-structure.yaml +3 -0
- package/agents/generate/user-review-document-structure.mjs +7 -5
- package/agents/init/index.mjs +15 -15
- package/agents/publish/publish-docs.mjs +132 -113
- package/agents/translate/index.yaml +1 -1
- package/agents/update/batch-generate-document.yaml +1 -1
- package/agents/update/batch-update-document.yaml +1 -1
- package/agents/update/check-document.mjs +3 -19
- package/agents/update/user-review-document.mjs +4 -3
- package/agents/utils/load-sources.mjs +54 -151
- package/agents/utils/transform-detail-datasources.mjs +14 -18
- package/aigne.yaml +2 -0
- package/biome.json +1 -1
- package/docs/_sidebar.md +13 -15
- package/docs/configuration-initial-setup.ja.md +179 -0
- package/docs/configuration-initial-setup.md +179 -0
- package/docs/configuration-initial-setup.zh-TW.md +179 -0
- package/docs/configuration-initial-setup.zh.md +179 -0
- package/docs/configuration-managing-preferences.ja.md +100 -0
- package/docs/configuration-managing-preferences.md +100 -0
- package/docs/configuration-managing-preferences.zh-TW.md +100 -0
- package/docs/configuration-managing-preferences.zh.md +100 -0
- package/docs/configuration.ja.md +68 -184
- package/docs/configuration.md +62 -178
- package/docs/configuration.zh-TW.md +70 -186
- package/docs/configuration.zh.md +67 -183
- package/docs/getting-started.ja.md +46 -78
- package/docs/getting-started.md +46 -78
- package/docs/getting-started.zh-TW.md +47 -79
- package/docs/getting-started.zh.md +47 -79
- package/docs/guides-cleaning-up.ja.md +50 -0
- package/docs/guides-cleaning-up.md +50 -0
- package/docs/guides-cleaning-up.zh-TW.md +50 -0
- package/docs/guides-cleaning-up.zh.md +50 -0
- package/docs/guides-evaluating-documents.ja.md +66 -0
- package/docs/guides-evaluating-documents.md +66 -0
- package/docs/guides-evaluating-documents.zh-TW.md +66 -0
- package/docs/guides-evaluating-documents.zh.md +66 -0
- package/docs/guides-generating-documentation.ja.md +149 -0
- package/docs/guides-generating-documentation.md +149 -0
- package/docs/guides-generating-documentation.zh-TW.md +149 -0
- package/docs/guides-generating-documentation.zh.md +149 -0
- package/docs/guides-interactive-chat.ja.md +85 -0
- package/docs/guides-interactive-chat.md +85 -0
- package/docs/guides-interactive-chat.zh-TW.md +85 -0
- package/docs/guides-interactive-chat.zh.md +85 -0
- package/docs/guides-managing-history.ja.md +51 -0
- package/docs/guides-managing-history.md +51 -0
- package/docs/guides-managing-history.zh-TW.md +51 -0
- package/docs/guides-managing-history.zh.md +51 -0
- package/docs/guides-publishing-your-docs.ja.md +78 -0
- package/docs/guides-publishing-your-docs.md +78 -0
- package/docs/guides-publishing-your-docs.zh-TW.md +78 -0
- package/docs/guides-publishing-your-docs.zh.md +78 -0
- package/docs/guides-translating-documentation.ja.md +95 -0
- package/docs/guides-translating-documentation.md +95 -0
- package/docs/guides-translating-documentation.zh-TW.md +95 -0
- package/docs/guides-translating-documentation.zh.md +95 -0
- package/docs/guides-updating-documentation.ja.md +77 -0
- package/docs/guides-updating-documentation.md +77 -0
- package/docs/guides-updating-documentation.zh-TW.md +77 -0
- package/docs/guides-updating-documentation.zh.md +77 -0
- package/docs/guides.ja.md +32 -0
- package/docs/guides.md +32 -0
- package/docs/guides.zh-TW.md +32 -0
- package/docs/guides.zh.md +32 -0
- package/docs/overview.ja.md +39 -60
- package/docs/overview.md +39 -60
- package/docs/overview.zh-TW.md +39 -60
- package/docs/overview.zh.md +39 -60
- package/docs/release-notes.ja.md +255 -0
- package/docs/release-notes.md +255 -0
- package/docs/release-notes.zh-TW.md +255 -0
- package/docs/release-notes.zh.md +255 -0
- package/package.json +4 -2
- package/prompts/common/document/content-rules-core.md +1 -0
- package/prompts/common/document-structure/document-structure-rules.md +8 -9
- package/prompts/common/document-structure/output-constraints.md +1 -1
- package/prompts/structure/document-rules.md +8 -2
- package/prompts/structure/generate/system-prompt.md +27 -2
- package/prompts/structure/generate/user-prompt.md +18 -0
- package/prompts/structure/update/system-prompt.md +12 -0
- package/prompts/structure/update/user-prompt.md +3 -0
- package/tests/agents/clear/choose-contents.test.mjs +8 -4
- package/tests/agents/generate/check-need-generate-structure.test.mjs +53 -63
- package/tests/agents/generate/document-structure-tools/generate-sub-structure.test.mjs +277 -0
- package/tests/agents/init/init.test.mjs +18 -18
- package/tests/agents/publish/publish-docs.test.mjs +79 -0
- package/tests/agents/update/check-document.test.mjs +7 -67
- package/tests/agents/utils/load-sources.test.mjs +90 -90
- package/tests/agents/utils/transform-detail-datasources.test.mjs +153 -196
- package/tests/utils/file-utils.test.mjs +309 -1
- package/utils/auth-utils.mjs +12 -5
- package/utils/constants/index.mjs +5 -2
- package/utils/deploy.mjs +2 -2
- package/utils/file-utils.mjs +315 -0
- package/utils/utils.mjs +89 -50
- package/docs/advanced-how-it-works.ja.md +0 -101
- package/docs/advanced-how-it-works.md +0 -101
- package/docs/advanced-how-it-works.zh-TW.md +0 -101
- package/docs/advanced-how-it-works.zh.md +0 -101
- package/docs/advanced-quality-assurance.ja.md +0 -92
- package/docs/advanced-quality-assurance.md +0 -92
- package/docs/advanced-quality-assurance.zh-TW.md +0 -92
- package/docs/advanced-quality-assurance.zh.md +0 -92
- package/docs/advanced.ja.md +0 -20
- package/docs/advanced.md +0 -20
- package/docs/advanced.zh-TW.md +0 -20
- package/docs/advanced.zh.md +0 -20
- package/docs/changelog.ja.md +0 -486
- package/docs/changelog.md +0 -486
- package/docs/changelog.zh-TW.md +0 -486
- package/docs/changelog.zh.md +0 -486
- package/docs/cli-reference.ja.md +0 -311
- package/docs/cli-reference.md +0 -311
- package/docs/cli-reference.zh-TW.md +0 -311
- package/docs/cli-reference.zh.md +0 -311
- package/docs/configuration-interactive-setup.ja.md +0 -138
- package/docs/configuration-interactive-setup.md +0 -138
- package/docs/configuration-interactive-setup.zh-TW.md +0 -138
- package/docs/configuration-interactive-setup.zh.md +0 -138
- package/docs/configuration-language-support.ja.md +0 -64
- package/docs/configuration-language-support.md +0 -64
- package/docs/configuration-language-support.zh-TW.md +0 -64
- package/docs/configuration-language-support.zh.md +0 -64
- package/docs/configuration-llm-setup.ja.md +0 -56
- package/docs/configuration-llm-setup.md +0 -56
- package/docs/configuration-llm-setup.zh-TW.md +0 -56
- package/docs/configuration-llm-setup.zh.md +0 -56
- package/docs/configuration-preferences.ja.md +0 -144
- package/docs/configuration-preferences.md +0 -144
- package/docs/configuration-preferences.zh-TW.md +0 -144
- package/docs/configuration-preferences.zh.md +0 -144
- package/docs/features-generate-documentation.ja.md +0 -95
- package/docs/features-generate-documentation.md +0 -95
- package/docs/features-generate-documentation.zh-TW.md +0 -95
- package/docs/features-generate-documentation.zh.md +0 -95
- package/docs/features-publish-your-docs.ja.md +0 -130
- package/docs/features-publish-your-docs.md +0 -130
- package/docs/features-publish-your-docs.zh-TW.md +0 -130
- package/docs/features-publish-your-docs.zh.md +0 -130
- package/docs/features-translate-documentation.ja.md +0 -90
- package/docs/features-translate-documentation.md +0 -90
- package/docs/features-translate-documentation.zh-TW.md +0 -90
- package/docs/features-translate-documentation.zh.md +0 -90
- package/docs/features-update-and-refine.ja.md +0 -142
- package/docs/features-update-and-refine.md +0 -142
- package/docs/features-update-and-refine.zh-TW.md +0 -143
- package/docs/features-update-and-refine.zh.md +0 -142
- package/docs/features.ja.md +0 -62
- package/docs/features.md +0 -62
- package/docs/features.zh-TW.md +0 -62
- package/docs/features.zh.md +0 -62
|
@@ -3,7 +3,6 @@ import * as fsPromises from "node:fs/promises";
|
|
|
3
3
|
import * as aigneCore from "@aigne/core";
|
|
4
4
|
import checkDocument from "../../../agents/update/check-document.mjs";
|
|
5
5
|
import * as checkDetailResultModule from "../../../agents/utils/check-detail-result.mjs";
|
|
6
|
-
import * as utils from "../../../utils/utils.mjs";
|
|
7
6
|
|
|
8
7
|
describe("check-document", () => {
|
|
9
8
|
let mockOptions;
|
|
@@ -12,7 +11,6 @@ describe("check-document", () => {
|
|
|
12
11
|
let teamAgentFromSpy;
|
|
13
12
|
|
|
14
13
|
// Spies for internal utils and fs operations
|
|
15
|
-
let hasSourceFilesChangedSpy;
|
|
16
14
|
let checkDetailResultSpy;
|
|
17
15
|
let consoleSpy;
|
|
18
16
|
let accessSpy;
|
|
@@ -32,7 +30,6 @@ describe("check-document", () => {
|
|
|
32
30
|
};
|
|
33
31
|
|
|
34
32
|
// Set up spies for internal utils
|
|
35
|
-
hasSourceFilesChangedSpy = spyOn(utils, "hasSourceFilesChanged").mockReturnValue(false);
|
|
36
33
|
checkDetailResultSpy = spyOn(checkDetailResultModule, "default").mockResolvedValue({
|
|
37
34
|
isApproved: true,
|
|
38
35
|
detailFeedback: "",
|
|
@@ -50,7 +47,6 @@ describe("check-document", () => {
|
|
|
50
47
|
afterEach(() => {
|
|
51
48
|
// Restore all spies
|
|
52
49
|
teamAgentFromSpy?.mockRestore();
|
|
53
|
-
hasSourceFilesChangedSpy?.mockRestore();
|
|
54
50
|
checkDetailResultSpy?.mockRestore();
|
|
55
51
|
consoleSpy?.mockRestore();
|
|
56
52
|
accessSpy?.mockRestore();
|
|
@@ -197,68 +193,8 @@ describe("check-document", () => {
|
|
|
197
193
|
expect(mockOptions.context.invoke).not.toHaveBeenCalled();
|
|
198
194
|
});
|
|
199
195
|
|
|
200
|
-
// SOURCE FILES CHANGE TESTS
|
|
201
|
-
|
|
202
|
-
accessSpy.mockResolvedValue();
|
|
203
|
-
checkDetailResultSpy.mockResolvedValue({ isApproved: true });
|
|
204
|
-
hasSourceFilesChangedSpy.mockReturnValue(true);
|
|
205
|
-
|
|
206
|
-
await checkDocument(
|
|
207
|
-
{
|
|
208
|
-
path: "/getting-started",
|
|
209
|
-
docsDir: "./docs",
|
|
210
|
-
sourceIds: ["file1.js"],
|
|
211
|
-
originalDocumentStructure: [{ path: "/getting-started", sourceIds: ["file1.js"] }],
|
|
212
|
-
documentStructure: [{ path: "/getting-started" }],
|
|
213
|
-
modifiedFiles: ["file1.js"],
|
|
214
|
-
},
|
|
215
|
-
mockOptions,
|
|
216
|
-
);
|
|
217
|
-
|
|
218
|
-
expect(hasSourceFilesChangedSpy).toHaveBeenCalledWith(["file1.js"], ["file1.js"]);
|
|
219
|
-
expect(consoleSpy).toHaveBeenCalledWith(
|
|
220
|
-
"Source files changed for /getting-started, will regenerate",
|
|
221
|
-
);
|
|
222
|
-
expect(mockOptions.context.invoke).toHaveBeenCalled();
|
|
223
|
-
});
|
|
224
|
-
|
|
225
|
-
test("should not check source files when no sourceIds provided", async () => {
|
|
226
|
-
accessSpy.mockResolvedValue();
|
|
227
|
-
checkDetailResultSpy.mockResolvedValue({ isApproved: true });
|
|
228
|
-
|
|
229
|
-
const result = await checkDocument(
|
|
230
|
-
{
|
|
231
|
-
path: "/getting-started",
|
|
232
|
-
docsDir: "./docs",
|
|
233
|
-
sourceIds: [],
|
|
234
|
-
documentStructure: [{ path: "/getting-started" }],
|
|
235
|
-
modifiedFiles: ["file1.js"],
|
|
236
|
-
},
|
|
237
|
-
mockOptions,
|
|
238
|
-
);
|
|
239
|
-
|
|
240
|
-
expect(hasSourceFilesChangedSpy).not.toHaveBeenCalled();
|
|
241
|
-
expect(result.detailGenerated).toBe(true);
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
test("should not check source files when no modifiedFiles provided", async () => {
|
|
245
|
-
accessSpy.mockResolvedValue();
|
|
246
|
-
checkDetailResultSpy.mockResolvedValue({ isApproved: true });
|
|
247
|
-
|
|
248
|
-
const result = await checkDocument(
|
|
249
|
-
{
|
|
250
|
-
path: "/getting-started",
|
|
251
|
-
docsDir: "./docs",
|
|
252
|
-
sourceIds: ["file1.js"],
|
|
253
|
-
documentStructure: [{ path: "/getting-started" }],
|
|
254
|
-
modifiedFiles: null,
|
|
255
|
-
},
|
|
256
|
-
mockOptions,
|
|
257
|
-
);
|
|
258
|
-
|
|
259
|
-
expect(hasSourceFilesChangedSpy).not.toHaveBeenCalled();
|
|
260
|
-
expect(result.detailGenerated).toBe(true);
|
|
261
|
-
});
|
|
196
|
+
// SOURCE FILES CHANGE TESTS - These tests are now obsolete as modifiedFiles checking has been removed
|
|
197
|
+
// The check-document function now only checks for sourceIds changes and content validation
|
|
262
198
|
|
|
263
199
|
// CONTENT VALIDATION TESTS
|
|
264
200
|
test("should regenerate when content validation fails", async () => {
|
|
@@ -420,12 +356,16 @@ describe("check-document", () => {
|
|
|
420
356
|
{
|
|
421
357
|
path: "/api/users/create",
|
|
422
358
|
docsDir: "./docs",
|
|
359
|
+
locale: "en",
|
|
423
360
|
},
|
|
424
361
|
mockOptions,
|
|
425
362
|
);
|
|
426
363
|
|
|
427
364
|
// "/api/users/create" -> flatName "api-users-create" -> fileFullName "api-users-create.md"
|
|
428
|
-
|
|
365
|
+
// The access function is called with a full path that includes docsDir
|
|
366
|
+
expect(accessSpy).toHaveBeenCalled();
|
|
367
|
+
const callArg = accessSpy.mock.calls[0][0];
|
|
368
|
+
expect(callArg).toMatch(/api-users-create\.md$/);
|
|
429
369
|
});
|
|
430
370
|
|
|
431
371
|
// RESULT STRUCTURE TESTS
|
|
@@ -156,11 +156,11 @@ describe("load-sources", () => {
|
|
|
156
156
|
docsDir: path.join(testDir, "docs"),
|
|
157
157
|
});
|
|
158
158
|
|
|
159
|
-
expect(result.
|
|
160
|
-
expect(result.
|
|
159
|
+
expect(result.files).toBeDefined();
|
|
160
|
+
expect(result.files.length).toBeGreaterThan(0);
|
|
161
161
|
|
|
162
162
|
// Should include package.json, README.md, src files
|
|
163
|
-
const filePaths = result.
|
|
163
|
+
const filePaths = result.files;
|
|
164
164
|
expect(filePaths.some((element) => element.includes("package.json"))).toBe(true);
|
|
165
165
|
expect(filePaths.some((element) => element.includes("README.md"))).toBe(true);
|
|
166
166
|
expect(filePaths.some((element) => element.includes("src/index.js"))).toBe(true);
|
|
@@ -182,10 +182,10 @@ describe("load-sources", () => {
|
|
|
182
182
|
docsDir: path.join(testDir, "docs"),
|
|
183
183
|
});
|
|
184
184
|
|
|
185
|
-
expect(result.
|
|
186
|
-
expect(result.
|
|
185
|
+
expect(result.files).toBeDefined();
|
|
186
|
+
expect(result.files.length).toBeGreaterThan(0);
|
|
187
187
|
|
|
188
|
-
const filePaths = result.
|
|
188
|
+
const filePaths = result.files;
|
|
189
189
|
expect(filePaths.some((element) => element.includes("package.json"))).toBe(true);
|
|
190
190
|
expect(filePaths.some((element) => element.includes("src/index.js"))).toBe(true);
|
|
191
191
|
expect(filePaths.some((element) => element.includes("src/utils.js"))).toBe(true);
|
|
@@ -204,9 +204,9 @@ describe("load-sources", () => {
|
|
|
204
204
|
docsDir: path.join(testDir, "docs"),
|
|
205
205
|
});
|
|
206
206
|
|
|
207
|
-
expect(result.
|
|
207
|
+
expect(result.files).toBeDefined();
|
|
208
208
|
|
|
209
|
-
const filePaths = result.
|
|
209
|
+
const filePaths = result.files;
|
|
210
210
|
|
|
211
211
|
// Should exclude files listed in .gitignore
|
|
212
212
|
expect(filePaths.some((element) => element.includes("node_modules"))).toBe(false);
|
|
@@ -224,9 +224,9 @@ describe("load-sources", () => {
|
|
|
224
224
|
docsDir: path.join(testDir, "docs"),
|
|
225
225
|
});
|
|
226
226
|
|
|
227
|
-
expect(result.
|
|
227
|
+
expect(result.files).toBeDefined();
|
|
228
228
|
|
|
229
|
-
const filePaths = result.
|
|
229
|
+
const filePaths = result.files;
|
|
230
230
|
expect(filePaths.some((element) => element.includes("src/index.js"))).toBe(true);
|
|
231
231
|
expect(filePaths.some((element) => element.includes("src/utils.js"))).toBe(true);
|
|
232
232
|
|
|
@@ -243,10 +243,10 @@ describe("load-sources", () => {
|
|
|
243
243
|
docsDir: path.join(testDir, "docs"),
|
|
244
244
|
});
|
|
245
245
|
|
|
246
|
-
expect(result.
|
|
247
|
-
expect(result.
|
|
246
|
+
expect(result.files).toBeDefined();
|
|
247
|
+
expect(result.files.length).toBeGreaterThan(0);
|
|
248
248
|
|
|
249
|
-
const filePaths = result.
|
|
249
|
+
const filePaths = result.files;
|
|
250
250
|
expect(filePaths.some((element) => element.includes("src/index.js"))).toBe(true);
|
|
251
251
|
expect(filePaths.some((element) => element.includes("src/utils.js"))).toBe(true);
|
|
252
252
|
});
|
|
@@ -259,8 +259,8 @@ describe("load-sources", () => {
|
|
|
259
259
|
docsDir: path.join(testDir, "docs"),
|
|
260
260
|
});
|
|
261
261
|
|
|
262
|
-
expect(result.
|
|
263
|
-
expect(result.
|
|
262
|
+
expect(result.files).toBeDefined();
|
|
263
|
+
expect(result.files.length).toBe(0);
|
|
264
264
|
});
|
|
265
265
|
|
|
266
266
|
test("should merge user patterns with default patterns", async () => {
|
|
@@ -273,9 +273,9 @@ describe("load-sources", () => {
|
|
|
273
273
|
docsDir: path.join(testDir, "docs"),
|
|
274
274
|
});
|
|
275
275
|
|
|
276
|
-
expect(result.
|
|
276
|
+
expect(result.files).toBeDefined();
|
|
277
277
|
|
|
278
|
-
const filePaths = result.
|
|
278
|
+
const filePaths = result.files;
|
|
279
279
|
|
|
280
280
|
// Should include default patterns (package.json, README.md, etc.)
|
|
281
281
|
expect(filePaths.some((element) => element.includes("package.json"))).toBe(true);
|
|
@@ -295,10 +295,10 @@ describe("load-sources", () => {
|
|
|
295
295
|
docsDir: path.join(testDir, "docs"),
|
|
296
296
|
});
|
|
297
297
|
|
|
298
|
-
expect(result.
|
|
299
|
-
expect(result.
|
|
298
|
+
expect(result.files).toBeDefined();
|
|
299
|
+
expect(result.files.length).toBeGreaterThan(0);
|
|
300
300
|
|
|
301
|
-
const filePaths = result.
|
|
301
|
+
const filePaths = result.files;
|
|
302
302
|
|
|
303
303
|
// Should include files from all levels
|
|
304
304
|
expect(filePaths.some((element) => element.includes("src/index.js"))).toBe(true);
|
|
@@ -333,9 +333,9 @@ describe("load-sources", () => {
|
|
|
333
333
|
docsDir: path.join(testDir, "docs"),
|
|
334
334
|
});
|
|
335
335
|
|
|
336
|
-
expect(result.
|
|
336
|
+
expect(result.files).toBeDefined();
|
|
337
337
|
|
|
338
|
-
const filePaths = result.
|
|
338
|
+
const filePaths = result.files;
|
|
339
339
|
|
|
340
340
|
// Should include files from specified subdirectories
|
|
341
341
|
expect(filePaths.some((element) => element.includes("src/components/Button.js"))).toBe(true);
|
|
@@ -363,9 +363,9 @@ describe("load-sources", () => {
|
|
|
363
363
|
docsDir: path.join(testDir, "docs"),
|
|
364
364
|
});
|
|
365
365
|
|
|
366
|
-
expect(result.
|
|
366
|
+
expect(result.files).toBeDefined();
|
|
367
367
|
|
|
368
|
-
const filePaths = result.
|
|
368
|
+
const filePaths = result.files;
|
|
369
369
|
|
|
370
370
|
// Should include JS files from all levels
|
|
371
371
|
expect(filePaths.some((element) => element.includes("src/components/Button.js"))).toBe(true);
|
|
@@ -390,9 +390,9 @@ describe("load-sources", () => {
|
|
|
390
390
|
docsDir: path.join(testDir, "docs"),
|
|
391
391
|
});
|
|
392
392
|
|
|
393
|
-
expect(result.
|
|
393
|
+
expect(result.files).toBeDefined();
|
|
394
394
|
|
|
395
|
-
const filePaths = result.
|
|
395
|
+
const filePaths = result.files;
|
|
396
396
|
|
|
397
397
|
// For now, let's verify that regular files are still included
|
|
398
398
|
expect(filePaths.some((element) => element.includes("src/index.js"))).toBe(true);
|
|
@@ -413,10 +413,10 @@ describe("load-sources", () => {
|
|
|
413
413
|
docsDir: path.join(testDir, "docs"),
|
|
414
414
|
});
|
|
415
415
|
|
|
416
|
-
expect(result.
|
|
417
|
-
expect(result.
|
|
416
|
+
expect(result.files).toBeDefined();
|
|
417
|
+
expect(result.files.length).toBeGreaterThan(0);
|
|
418
418
|
|
|
419
|
-
const filePaths = result.
|
|
419
|
+
const filePaths = result.files;
|
|
420
420
|
|
|
421
421
|
// Should include JS files from src directory and subdirectories
|
|
422
422
|
expect(filePaths.some((element) => element.includes("src/index.js"))).toBe(true);
|
|
@@ -439,10 +439,10 @@ describe("load-sources", () => {
|
|
|
439
439
|
docsDir: path.join(testDir, "docs"),
|
|
440
440
|
});
|
|
441
441
|
|
|
442
|
-
expect(result.
|
|
443
|
-
expect(result.
|
|
442
|
+
expect(result.files).toBeDefined();
|
|
443
|
+
expect(result.files.length).toBeGreaterThan(0);
|
|
444
444
|
|
|
445
|
-
const filePaths = result.
|
|
445
|
+
const filePaths = result.files;
|
|
446
446
|
|
|
447
447
|
// Should include JS files from src directory
|
|
448
448
|
expect(filePaths.some((element) => element.includes("src/index.js"))).toBe(true);
|
|
@@ -466,9 +466,9 @@ describe("load-sources", () => {
|
|
|
466
466
|
docsDir: path.join(testDir, "docs"),
|
|
467
467
|
});
|
|
468
468
|
|
|
469
|
-
expect(result.
|
|
469
|
+
expect(result.files).toBeDefined();
|
|
470
470
|
|
|
471
|
-
const filePaths = result.
|
|
471
|
+
const filePaths = result.files;
|
|
472
472
|
|
|
473
473
|
// Should include JS files
|
|
474
474
|
expect(filePaths.some((element) => element.includes("src/index.js"))).toBe(true);
|
|
@@ -492,8 +492,8 @@ describe("load-sources", () => {
|
|
|
492
492
|
docsDir: path.join(testDir, "docs"),
|
|
493
493
|
});
|
|
494
494
|
|
|
495
|
-
expect(result.
|
|
496
|
-
expect(result.
|
|
495
|
+
expect(result.files).toBeDefined();
|
|
496
|
+
expect(result.files.length).toBe(0);
|
|
497
497
|
});
|
|
498
498
|
|
|
499
499
|
test("should handle mixed regular paths and glob patterns", async () => {
|
|
@@ -505,10 +505,10 @@ describe("load-sources", () => {
|
|
|
505
505
|
docsDir: path.join(testDir, "docs"),
|
|
506
506
|
});
|
|
507
507
|
|
|
508
|
-
expect(result.
|
|
509
|
-
expect(result.
|
|
508
|
+
expect(result.files).toBeDefined();
|
|
509
|
+
expect(result.files.length).toBeGreaterThan(0);
|
|
510
510
|
|
|
511
|
-
const filePaths = result.
|
|
511
|
+
const filePaths = result.files;
|
|
512
512
|
|
|
513
513
|
// Should include markdown files from directory scan
|
|
514
514
|
expect(filePaths.some((element) => element.includes("README.md"))).toBe(true);
|
|
@@ -526,9 +526,9 @@ describe("load-sources", () => {
|
|
|
526
526
|
docsDir: path.join(testDir, "docs"),
|
|
527
527
|
});
|
|
528
528
|
|
|
529
|
-
expect(result.
|
|
529
|
+
expect(result.files).toBeDefined();
|
|
530
530
|
|
|
531
|
-
const filePaths = result.
|
|
531
|
+
const filePaths = result.files;
|
|
532
532
|
|
|
533
533
|
// Should match Button.js with character class
|
|
534
534
|
expect(filePaths.some((element) => element.includes("src/components/Button.js"))).toBe(true);
|
|
@@ -552,10 +552,10 @@ describe("load-sources", () => {
|
|
|
552
552
|
|
|
553
553
|
const result = await loadSources(yamlConfigInput);
|
|
554
554
|
|
|
555
|
-
expect(result.
|
|
556
|
-
expect(result.
|
|
555
|
+
expect(result.files).toBeDefined();
|
|
556
|
+
expect(result.files.length).toBeGreaterThan(0);
|
|
557
557
|
|
|
558
|
-
const filePaths = result.
|
|
558
|
+
const filePaths = result.files;
|
|
559
559
|
expect(filePaths.some((element) => element.includes("src/index.js"))).toBe(true);
|
|
560
560
|
});
|
|
561
561
|
|
|
@@ -568,8 +568,8 @@ describe("load-sources", () => {
|
|
|
568
568
|
docsDir: path.join(testDir, "docs"),
|
|
569
569
|
});
|
|
570
570
|
|
|
571
|
-
expect(result.
|
|
572
|
-
expect(result.
|
|
571
|
+
expect(result.files).toBeDefined();
|
|
572
|
+
expect(result.files.length).toBe(0);
|
|
573
573
|
expect(result.files.length).toBe(0);
|
|
574
574
|
|
|
575
575
|
// Empty arrays are handled gracefully - this is correct behavior
|
|
@@ -588,7 +588,7 @@ describe("load-sources", () => {
|
|
|
588
588
|
});
|
|
589
589
|
|
|
590
590
|
// Should successfully process valid paths and ignore invalid ones
|
|
591
|
-
expect(result.
|
|
591
|
+
expect(result.files).toBeDefined();
|
|
592
592
|
// This test will FAIL because the function crashes instead of filtering
|
|
593
593
|
});
|
|
594
594
|
|
|
@@ -601,9 +601,9 @@ describe("load-sources", () => {
|
|
|
601
601
|
docsDir: path.join(testDir, "docs"),
|
|
602
602
|
});
|
|
603
603
|
|
|
604
|
-
expect(result.
|
|
605
|
-
expect(Array.isArray(result.
|
|
606
|
-
expect(result.
|
|
604
|
+
expect(result.files).toBeDefined();
|
|
605
|
+
expect(Array.isArray(result.files)).toBe(true);
|
|
606
|
+
expect(result.files.length).toBe(0);
|
|
607
607
|
|
|
608
608
|
// undefined is handled gracefully by skipping sourcesPath processing
|
|
609
609
|
});
|
|
@@ -627,9 +627,9 @@ describe("load-sources", () => {
|
|
|
627
627
|
outputDir: tempDir,
|
|
628
628
|
docsDir: path.join(testDir, "docs"),
|
|
629
629
|
});
|
|
630
|
-
expect(result.
|
|
631
|
-
expect(Array.isArray(result.
|
|
632
|
-
expect(result.
|
|
630
|
+
expect(result.files).toBeDefined();
|
|
631
|
+
expect(Array.isArray(result.files)).toBe(true);
|
|
632
|
+
expect(result.files.length).toBe(0);
|
|
633
633
|
}
|
|
634
634
|
}
|
|
635
635
|
|
|
@@ -651,7 +651,7 @@ describe("load-sources", () => {
|
|
|
651
651
|
docsDir: path.join(testDir, "docs"),
|
|
652
652
|
});
|
|
653
653
|
|
|
654
|
-
expect(result.
|
|
654
|
+
expect(result.files).toBeDefined();
|
|
655
655
|
// Some of these tests will FAIL, exposing input validation issues
|
|
656
656
|
}
|
|
657
657
|
});
|
|
@@ -673,8 +673,8 @@ describe("load-sources", () => {
|
|
|
673
673
|
docsDir: path.join(testDir, "docs"),
|
|
674
674
|
});
|
|
675
675
|
|
|
676
|
-
expect(result.
|
|
677
|
-
const filePaths = result.
|
|
676
|
+
expect(result.files).toBeDefined();
|
|
677
|
+
const filePaths = result.files;
|
|
678
678
|
expect(filePaths.some((element) => element.includes("index.js"))).toBe(true);
|
|
679
679
|
} catch {
|
|
680
680
|
// Skip test on systems that don't support symlinks
|
|
@@ -699,8 +699,8 @@ describe("load-sources", () => {
|
|
|
699
699
|
docsDir: path.join(testDir, "docs"),
|
|
700
700
|
});
|
|
701
701
|
|
|
702
|
-
expect(result.
|
|
703
|
-
const filePaths = result.
|
|
702
|
+
expect(result.files).toBeDefined();
|
|
703
|
+
const filePaths = result.files;
|
|
704
704
|
expect(filePaths.some((element) => element.includes("a/b/c/d/e/f/g/h/deep.js"))).toBe(true);
|
|
705
705
|
});
|
|
706
706
|
|
|
@@ -724,8 +724,8 @@ describe("load-sources", () => {
|
|
|
724
724
|
docsDir: path.join(testDir, "docs"),
|
|
725
725
|
});
|
|
726
726
|
|
|
727
|
-
expect(result.
|
|
728
|
-
const filePaths = result.
|
|
727
|
+
expect(result.files).toBeDefined();
|
|
728
|
+
const filePaths = result.files;
|
|
729
729
|
|
|
730
730
|
expect(filePaths.some((element) => element.includes("file with spaces.js"))).toBe(true);
|
|
731
731
|
expect(filePaths.some((element) => element.includes("file-with-dashes.js"))).toBe(true);
|
|
@@ -745,8 +745,8 @@ describe("load-sources", () => {
|
|
|
745
745
|
docsDir: path.join(testDir, "docs"),
|
|
746
746
|
});
|
|
747
747
|
|
|
748
|
-
expect(result.
|
|
749
|
-
expect(result.
|
|
748
|
+
expect(result.files).toBeDefined();
|
|
749
|
+
expect(result.files.length).toBe(0);
|
|
750
750
|
});
|
|
751
751
|
});
|
|
752
752
|
|
|
@@ -761,8 +761,8 @@ describe("load-sources", () => {
|
|
|
761
761
|
docsDir: path.join(testDir, "docs"),
|
|
762
762
|
});
|
|
763
763
|
|
|
764
|
-
expect(result.
|
|
765
|
-
const filePaths = result.
|
|
764
|
+
expect(result.files).toBeDefined();
|
|
765
|
+
const filePaths = result.files;
|
|
766
766
|
|
|
767
767
|
// Should still exclude test files by default gitignore/patterns
|
|
768
768
|
expect(filePaths.some((element) => element.includes("src/index.js"))).toBe(true);
|
|
@@ -779,8 +779,8 @@ describe("load-sources", () => {
|
|
|
779
779
|
docsDir: path.join(testDir, "docs"),
|
|
780
780
|
});
|
|
781
781
|
|
|
782
|
-
expect(result.
|
|
783
|
-
const filePaths = result.
|
|
782
|
+
expect(result.files).toBeDefined();
|
|
783
|
+
const filePaths = result.files;
|
|
784
784
|
|
|
785
785
|
// Exclude should win over include
|
|
786
786
|
expect(filePaths.some((element) => element.includes("src/index.js"))).toBe(false);
|
|
@@ -801,8 +801,8 @@ describe("load-sources", () => {
|
|
|
801
801
|
docsDir: path.join(testDir, "docs"),
|
|
802
802
|
});
|
|
803
803
|
|
|
804
|
-
expect(result.
|
|
805
|
-
const filePaths = result.
|
|
804
|
+
expect(result.files).toBeDefined();
|
|
805
|
+
const filePaths = result.files;
|
|
806
806
|
|
|
807
807
|
expect(filePaths.some((element) => element.includes("CamelCase.js"))).toBe(true);
|
|
808
808
|
expect(filePaths.some((element) => element.includes("lowercase.js"))).toBe(true);
|
|
@@ -821,9 +821,9 @@ describe("load-sources", () => {
|
|
|
821
821
|
docsDir: path.join(testDir, "docs"),
|
|
822
822
|
});
|
|
823
823
|
|
|
824
|
-
expect(result.
|
|
824
|
+
expect(result.files).toBeDefined();
|
|
825
825
|
// Just verify it doesn't crash and returns some results
|
|
826
|
-
expect(Array.isArray(result.
|
|
826
|
+
expect(Array.isArray(result.files)).toBe(true);
|
|
827
827
|
});
|
|
828
828
|
});
|
|
829
829
|
|
|
@@ -843,7 +843,7 @@ describe("load-sources", () => {
|
|
|
843
843
|
});
|
|
844
844
|
const endTime = Date.now();
|
|
845
845
|
|
|
846
|
-
expect(result.
|
|
846
|
+
expect(result.files).toBeDefined();
|
|
847
847
|
expect(endTime - startTime).toBeLessThan(5000); // Should complete within 5 seconds
|
|
848
848
|
});
|
|
849
849
|
|
|
@@ -861,8 +861,8 @@ describe("load-sources", () => {
|
|
|
861
861
|
docsDir: path.join(testDir, "docs"),
|
|
862
862
|
});
|
|
863
863
|
|
|
864
|
-
expect(result.
|
|
865
|
-
const filePaths = result.
|
|
864
|
+
expect(result.files).toBeDefined();
|
|
865
|
+
const filePaths = result.files;
|
|
866
866
|
expect(filePaths.some((element) => element.includes(longDirName))).toBe(true);
|
|
867
867
|
});
|
|
868
868
|
});
|
|
@@ -881,7 +881,7 @@ describe("load-sources", () => {
|
|
|
881
881
|
docsDir: path.join(testDir, "docs"),
|
|
882
882
|
});
|
|
883
883
|
|
|
884
|
-
expect(result.
|
|
884
|
+
expect(result.files).toBeDefined();
|
|
885
885
|
// Should handle gracefully without crashing
|
|
886
886
|
} catch {
|
|
887
887
|
// Skip on systems where permission tests don't work
|
|
@@ -897,9 +897,9 @@ describe("load-sources", () => {
|
|
|
897
897
|
docsDir: path.join(testDir, "docs"),
|
|
898
898
|
});
|
|
899
899
|
|
|
900
|
-
expect(result.
|
|
900
|
+
expect(result.files).toBeDefined();
|
|
901
901
|
// Should not crash, even with malformed patterns
|
|
902
|
-
expect(Array.isArray(result.
|
|
902
|
+
expect(Array.isArray(result.files)).toBe(true);
|
|
903
903
|
});
|
|
904
904
|
|
|
905
905
|
test("should handle circular symbolic links", async () => {
|
|
@@ -920,7 +920,7 @@ describe("load-sources", () => {
|
|
|
920
920
|
docsDir: path.join(testDir, "docs"),
|
|
921
921
|
});
|
|
922
922
|
|
|
923
|
-
expect(result.
|
|
923
|
+
expect(result.files).toBeDefined();
|
|
924
924
|
// Should handle circular links without infinite loop
|
|
925
925
|
|
|
926
926
|
// Clean up circular links immediately to prevent interference with other tests
|
|
@@ -958,8 +958,8 @@ describe("load-sources", () => {
|
|
|
958
958
|
docsDir: path.join(testDir, "docs"),
|
|
959
959
|
});
|
|
960
960
|
|
|
961
|
-
expect(result.
|
|
962
|
-
expect(Array.isArray(result.
|
|
961
|
+
expect(result.files).toBeDefined();
|
|
962
|
+
expect(Array.isArray(result.files)).toBe(true);
|
|
963
963
|
// Should not crash with any typical config
|
|
964
964
|
}
|
|
965
965
|
});
|
|
@@ -978,9 +978,9 @@ describe("load-sources", () => {
|
|
|
978
978
|
docsDir: path.join(testDir, "docs"),
|
|
979
979
|
});
|
|
980
980
|
|
|
981
|
-
expect(result.
|
|
982
|
-
expect(result.
|
|
983
|
-
expect(result.
|
|
981
|
+
expect(result.files).toBeDefined();
|
|
982
|
+
expect(result.files.length).toBe(1);
|
|
983
|
+
expect(result.files[0]).toContain("single-file.js");
|
|
984
984
|
});
|
|
985
985
|
|
|
986
986
|
test("should process media files correctly", async () => {
|
|
@@ -1024,8 +1024,8 @@ describe("load-sources", () => {
|
|
|
1024
1024
|
docsDir: path.join(testDir, "docs"),
|
|
1025
1025
|
});
|
|
1026
1026
|
|
|
1027
|
-
expect(result.
|
|
1028
|
-
expect(Array.isArray(result.
|
|
1027
|
+
expect(result.files).toBeDefined();
|
|
1028
|
+
expect(Array.isArray(result.files)).toBe(true);
|
|
1029
1029
|
// Should handle gracefully without crashing
|
|
1030
1030
|
});
|
|
1031
1031
|
});
|
|
@@ -1246,8 +1246,8 @@ describe("load-sources", () => {
|
|
|
1246
1246
|
});
|
|
1247
1247
|
});
|
|
1248
1248
|
|
|
1249
|
-
describe("
|
|
1250
|
-
test("should count
|
|
1249
|
+
describe("Token and line counting", () => {
|
|
1250
|
+
test("should count tokens and lines in source content", async () => {
|
|
1251
1251
|
// Create files with known content for counting
|
|
1252
1252
|
await writeFile(
|
|
1253
1253
|
path.join(testDir, "count-test.js"),
|
|
@@ -1262,9 +1262,9 @@ describe("load-sources", () => {
|
|
|
1262
1262
|
docsDir: path.join(testDir, "docs"),
|
|
1263
1263
|
});
|
|
1264
1264
|
|
|
1265
|
-
expect(result.
|
|
1265
|
+
expect(result.totalTokens).toBeGreaterThan(0);
|
|
1266
1266
|
expect(result.totalLines).toBeGreaterThan(0);
|
|
1267
|
-
expect(typeof result.
|
|
1267
|
+
expect(typeof result.totalTokens).toBe("number");
|
|
1268
1268
|
expect(typeof result.totalLines).toBe("number");
|
|
1269
1269
|
});
|
|
1270
1270
|
});
|
|
@@ -1394,11 +1394,11 @@ describe("load-sources", () => {
|
|
|
1394
1394
|
docsDir: path.join(testDir, "docs"),
|
|
1395
1395
|
});
|
|
1396
1396
|
|
|
1397
|
-
expect(result.
|
|
1397
|
+
expect(result.files.length).toBeGreaterThan(0);
|
|
1398
1398
|
expect(result.assetsContent).toContain("mixed-image.png");
|
|
1399
1399
|
|
|
1400
1400
|
// Verify both source files and media files are processed
|
|
1401
|
-
const sourceFiles = result.
|
|
1401
|
+
const sourceFiles = result.files;
|
|
1402
1402
|
expect(sourceFiles.some((f) => f.includes("mixed-test.js"))).toBe(true);
|
|
1403
1403
|
expect(sourceFiles.some((f) => f.includes("mixed-doc.md"))).toBe(true);
|
|
1404
1404
|
});
|