Skip to content

Commit a1d5483

Browse files
authored
Merge branch 'main' into codex/render-ai-markdown
2 parents 5fcdb31 + 5b84b7a commit a1d5483

3 files changed

Lines changed: 63 additions & 1 deletion

File tree

docs/for-me-personal/TEST.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,3 +616,38 @@ npm exec --yes --cache "$env:TEMP\devmap-help" --package $tarball -- devmap --he
616616
```
617617

618618
Jangan menjalankan dua instalasi `npx` secara paralel dengan cache yang sama.
619+
620+
### End-to-End Project Sementara
621+
622+
Pasang tarball pada project sementara yang memiliki:
623+
624+
- `package.json` dengan dependency Express;
625+
- `src/server.ts` dengan satu route;
626+
- `AGENTS.md` yang sudah memiliki isi.
627+
628+
Jalankan binary dari `node_modules/.bin`:
629+
630+
```powershell
631+
devmap --version
632+
devmap --help
633+
devmap init
634+
devmap analyze
635+
devmap ask "where is the server entry point?"
636+
devmap doctor
637+
```
638+
639+
Tanpa `GROQ_API_KEY`, hasil yang diharapkan:
640+
641+
- `init` exit `1` dengan pesan actionable dan tidak membuat config parsial;
642+
- `analyze`, `ask`, dan `doctor` exit `0`;
643+
- `ask` menampilkan static context;
644+
- snapshot mendeteksi Express, npm, dan route project;
645+
- lockfile package manager tidak masuk `fileIndex` atau statistik line;
646+
- `AGENTS.md` yang sudah ada tidak berubah.
647+
648+
Dengan `GROQ_API_KEY` valid, ulangi flow untuk memverifikasi:
649+
650+
- `init` membuat config, `.gitignore`, dan `DEVMAP.md`;
651+
- `analyze` menghasilkan AI architecture interpretation;
652+
- `ask` menghasilkan jawaban AI dan token usage;
653+
- `doctor` memvalidasi key dan model.

packages/cli/src/analyzers/filterEngine.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,30 @@ const IGNORED_EXTENSIONS = new Set([
2525
".zip"
2626
]);
2727

28+
const IGNORED_FILES = new Set([
29+
"package-lock.json",
30+
"npm-shrinkwrap.json",
31+
"pnpm-lock.yaml",
32+
"yarn.lock",
33+
"bun.lock",
34+
"bun.lockb"
35+
]);
36+
2837
export function shouldIgnorePath(path: string, isDirectory: boolean): boolean {
2938
const segments = path.split("/");
3039
if (segments.some((segment) => IGNORED_DIRECTORIES.has(segment))) {
3140
return true;
3241
}
3342

43+
if (!isDirectory && IGNORED_FILES.has(segments.at(-1) ?? "")) {
44+
return true;
45+
}
46+
3447
if (path.startsWith(".env") || path.includes("/.env")) {
3548
return true;
3649
}
3750

38-
if (path.includes("public/assets/") || path.endsWith(".min.ts") || path.endsWith("-lock.yaml")) {
51+
if (path.includes("public/assets/") || path.endsWith(".min.ts")) {
3952
return true;
4053
}
4154

packages/cli/test/analyzers.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { fileURLToPath } from "node:url";
66
import test from "node:test";
77
import { buildDependencyGraph, countReferences } from "../src/analyzers/dependencyGraph.js";
88
import { scanFiles } from "../src/analyzers/fileScanner.js";
9+
import { shouldIgnorePath } from "../src/analyzers/filterEngine.js";
910
import { detectFramework } from "../src/analyzers/frameworkDetector.js";
1011
import { createProjectMap } from "../src/analyzers/projectMap.js";
1112
import { detectExternalServices } from "../src/analyzers/serviceDetector.js";
@@ -32,6 +33,19 @@ test("scanner ignores generated and secret paths", async () => {
3233
assert.ok(!paths.some((path) => path.startsWith(".env")));
3334
});
3435

36+
test("scanner ignores package manager lockfiles", () => {
37+
for (const lockfile of [
38+
"package-lock.json",
39+
"npm-shrinkwrap.json",
40+
"pnpm-lock.yaml",
41+
"yarn.lock",
42+
"bun.lock",
43+
"bun.lockb"
44+
]) {
45+
assert.equal(shouldIgnorePath(lockfile, false), true, lockfile);
46+
}
47+
});
48+
3549
test("framework detector recognizes Next.js and Express fixtures", async () => {
3650
const nextFiles = await scanFiles(nextFixture);
3751
const expressFiles = await scanFiles(expressFixture);

0 commit comments

Comments
 (0)