meto-cli 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/cli/audit/blueprint.d.ts +53 -0
  2. package/dist/cli/audit/blueprint.d.ts.map +1 -0
  3. package/dist/cli/audit/blueprint.js +386 -0
  4. package/dist/cli/audit/blueprint.js.map +1 -0
  5. package/dist/cli/audit/detect-stack.d.ts +31 -0
  6. package/dist/cli/audit/detect-stack.d.ts.map +1 -0
  7. package/dist/cli/audit/detect-stack.js +154 -0
  8. package/dist/cli/audit/detect-stack.js.map +1 -0
  9. package/dist/cli/audit/fixer.d.ts +75 -0
  10. package/dist/cli/audit/fixer.d.ts.map +1 -0
  11. package/dist/cli/audit/fixer.js +802 -0
  12. package/dist/cli/audit/fixer.js.map +1 -0
  13. package/dist/cli/audit/index.d.ts +24 -0
  14. package/dist/cli/audit/index.d.ts.map +1 -0
  15. package/dist/cli/audit/index.js +212 -0
  16. package/dist/cli/audit/index.js.map +1 -0
  17. package/dist/cli/audit/reporter.d.ts +42 -0
  18. package/dist/cli/audit/reporter.d.ts.map +1 -0
  19. package/dist/cli/audit/reporter.js +101 -0
  20. package/dist/cli/audit/reporter.js.map +1 -0
  21. package/dist/cli/audit/scanner.d.ts +48 -0
  22. package/dist/cli/audit/scanner.d.ts.map +1 -0
  23. package/dist/cli/audit/scanner.js +202 -0
  24. package/dist/cli/audit/scanner.js.map +1 -0
  25. package/dist/cli/index.js +6 -0
  26. package/dist/cli/index.js.map +1 -1
  27. package/dist/cli/renderer.d.ts.map +1 -1
  28. package/dist/cli/renderer.js +3 -1
  29. package/dist/cli/renderer.js.map +1 -1
  30. package/dist/cli/stacks.d.ts +11 -0
  31. package/dist/cli/stacks.d.ts.map +1 -1
  32. package/dist/cli/stacks.js +82 -0
  33. package/dist/cli/stacks.js.map +1 -1
  34. package/package.json +1 -1
  35. package/templates/.claude/agents/developer-agent.md +4 -1
  36. package/templates/.claude/agents/tester-agent.md +4 -1
  37. package/templates/CLAUDE.md +3 -0
  38. package/templates/ai/workflows/code-guidelines.md +46 -0
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Declarative blueprint that defines what each audit layer expects.
3
+ * The scanner reads this data structure to determine which checks to run.
4
+ * Adding new checks is data-driven: add an entry here, the scanner picks it up.
5
+ */
6
+ /** The kind of filesystem check the scanner should perform. */
7
+ export type CheckType = "file-exists" | "dir-exists" | "file-contains" | "custom";
8
+ /**
9
+ * A single expectation within a layer.
10
+ * Describes one thing the scanner should verify.
11
+ */
12
+ export interface BlueprintExpectation {
13
+ /** Unique identifier (e.g. "L0-git", "L1-claude-md") */
14
+ id: string;
15
+ /** Human-readable description shown in reports */
16
+ description: string;
17
+ /** What kind of check the scanner should perform */
18
+ checkType: CheckType;
19
+ /**
20
+ * Relative path (from project root) the check targets.
21
+ * For "custom" checks this may be a hint or pattern rather than a literal path.
22
+ */
23
+ path: string;
24
+ /** Which layer this expectation belongs to (0, 1, 2, 3) */
25
+ layer: number;
26
+ /** Whether the fixer can automatically resolve a failure */
27
+ fixable: boolean;
28
+ /**
29
+ * For "file-contains" checks: the pattern (substring or heading) expected
30
+ * inside the file. Ignored for other check types.
31
+ */
32
+ containsPattern?: string;
33
+ }
34
+ /**
35
+ * A layer groups related expectations under a name and numeric id.
36
+ * Layers are ordered: higher layers gate on lower layers passing.
37
+ */
38
+ export interface BlueprintLayer {
39
+ /** Numeric layer identifier (0, 1, 2, 3) */
40
+ id: number;
41
+ /** Human-readable layer name */
42
+ name: string;
43
+ /** Ordered list of expectations for this layer */
44
+ expectations: BlueprintExpectation[];
45
+ }
46
+ /**
47
+ * The complete audit blueprint. Layers are ordered; the scanner should
48
+ * evaluate them sequentially and gate higher layers on lower ones passing.
49
+ *
50
+ * Exported as a constant -- no runtime construction.
51
+ */
52
+ export declare const AUDIT_BLUEPRINT: readonly BlueprintLayer[];
53
+ //# sourceMappingURL=blueprint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blueprint.d.ts","sourceRoot":"","sources":["../../../src/cli/audit/blueprint.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,+DAA+D;AAC/D,MAAM,MAAM,SAAS,GACjB,aAAa,GACb,YAAY,GACZ,eAAe,GACf,QAAQ,CAAC;AAEb;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,wDAAwD;IACxD,EAAE,EAAE,MAAM,CAAC;IACX,kDAAkD;IAClD,WAAW,EAAE,MAAM,CAAC;IACpB,oDAAoD;IACpD,SAAS,EAAE,SAAS,CAAC;IACrB;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,2DAA2D;IAC3D,KAAK,EAAE,MAAM,CAAC;IACd,4DAA4D;IAC5D,OAAO,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,4CAA4C;IAC5C,EAAE,EAAE,MAAM,CAAC;IACX,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,kDAAkD;IAClD,YAAY,EAAE,oBAAoB,EAAE,CAAC;CACtC;AA2WD;;;;;GAKG;AACH,eAAO,MAAM,eAAe,EAAE,SAAS,cAAc,EAqB3C,CAAC"}
@@ -0,0 +1,386 @@
1
+ /**
2
+ * Declarative blueprint that defines what each audit layer expects.
3
+ * The scanner reads this data structure to determine which checks to run.
4
+ * Adding new checks is data-driven: add an entry here, the scanner picks it up.
5
+ */
6
+ // ---------------------------------------------------------------------------
7
+ // Layer 0 -- Project Prerequisites
8
+ // ---------------------------------------------------------------------------
9
+ const LAYER_0_EXPECTATIONS = [
10
+ {
11
+ id: "L0-git",
12
+ description: "Git initialized",
13
+ checkType: "dir-exists",
14
+ path: ".git",
15
+ layer: 0,
16
+ fixable: false,
17
+ },
18
+ {
19
+ id: "L0-readme",
20
+ description: "README exists",
21
+ checkType: "custom",
22
+ path: "README*",
23
+ layer: 0,
24
+ fixable: false,
25
+ },
26
+ {
27
+ id: "L0-source-dir",
28
+ description: "Source code directory exists",
29
+ checkType: "custom",
30
+ path: "src|lib|app|pkg|cmd|internal",
31
+ layer: 0,
32
+ fixable: false,
33
+ },
34
+ ];
35
+ // ---------------------------------------------------------------------------
36
+ // Layer 1 -- Methodology
37
+ // ---------------------------------------------------------------------------
38
+ const LAYER_1_EXPECTATIONS = [
39
+ {
40
+ id: "L1-claude-md",
41
+ description: "CLAUDE.md project instructions",
42
+ checkType: "file-exists",
43
+ path: "CLAUDE.md",
44
+ layer: 1,
45
+ fixable: true,
46
+ },
47
+ {
48
+ id: "L1-ai-dir",
49
+ description: "ai/ directory",
50
+ checkType: "dir-exists",
51
+ path: "ai",
52
+ layer: 1,
53
+ fixable: true,
54
+ },
55
+ {
56
+ id: "L1-context-dir",
57
+ description: "ai/context/ directory",
58
+ checkType: "dir-exists",
59
+ path: "ai/context",
60
+ layer: 1,
61
+ fixable: true,
62
+ },
63
+ {
64
+ id: "L1-product-vision",
65
+ description: "Product vision document",
66
+ checkType: "file-exists",
67
+ path: "ai/context/product-vision.md",
68
+ layer: 1,
69
+ fixable: true,
70
+ },
71
+ {
72
+ id: "L1-tech-stack",
73
+ description: "Tech stack document",
74
+ checkType: "file-exists",
75
+ path: "ai/context/tech-stack.md",
76
+ layer: 1,
77
+ fixable: true,
78
+ },
79
+ {
80
+ id: "L1-decisions",
81
+ description: "Decisions log",
82
+ checkType: "file-exists",
83
+ path: "ai/context/decisions.md",
84
+ layer: 1,
85
+ fixable: true,
86
+ },
87
+ {
88
+ id: "L1-tasks-dir",
89
+ description: "ai/tasks/ directory",
90
+ checkType: "dir-exists",
91
+ path: "ai/tasks",
92
+ layer: 1,
93
+ fixable: true,
94
+ },
95
+ {
96
+ id: "L1-tasks-backlog",
97
+ description: "Task board: backlog",
98
+ checkType: "file-exists",
99
+ path: "ai/tasks/tasks-backlog.md",
100
+ layer: 1,
101
+ fixable: true,
102
+ },
103
+ {
104
+ id: "L1-tasks-todo",
105
+ description: "Task board: todo",
106
+ checkType: "file-exists",
107
+ path: "ai/tasks/tasks-todo.md",
108
+ layer: 1,
109
+ fixable: true,
110
+ },
111
+ {
112
+ id: "L1-tasks-in-progress",
113
+ description: "Task board: in-progress",
114
+ checkType: "file-exists",
115
+ path: "ai/tasks/tasks-in-progress.md",
116
+ layer: 1,
117
+ fixable: true,
118
+ },
119
+ {
120
+ id: "L1-tasks-in-testing",
121
+ description: "Task board: in-testing",
122
+ checkType: "file-exists",
123
+ path: "ai/tasks/tasks-in-testing.md",
124
+ layer: 1,
125
+ fixable: true,
126
+ },
127
+ {
128
+ id: "L1-tasks-done",
129
+ description: "Task board: done",
130
+ checkType: "file-exists",
131
+ path: "ai/tasks/tasks-done.md",
132
+ layer: 1,
133
+ fixable: true,
134
+ },
135
+ {
136
+ id: "L1-workflows-dir",
137
+ description: "ai/workflows/ directory",
138
+ checkType: "dir-exists",
139
+ path: "ai/workflows",
140
+ layer: 1,
141
+ fixable: true,
142
+ },
143
+ {
144
+ id: "L1-definition-of-done",
145
+ description: "Definition of done workflow",
146
+ checkType: "file-exists",
147
+ path: "ai/workflows/definition-of-done.md",
148
+ layer: 1,
149
+ fixable: true,
150
+ },
151
+ {
152
+ id: "L1-commit-conventions",
153
+ description: "Commit conventions workflow",
154
+ checkType: "file-exists",
155
+ path: "ai/workflows/commit-conventions.md",
156
+ layer: 1,
157
+ fixable: true,
158
+ },
159
+ ];
160
+ // ---------------------------------------------------------------------------
161
+ // Layer 2 -- Agents
162
+ // ---------------------------------------------------------------------------
163
+ const LAYER_2_EXPECTATIONS = [
164
+ {
165
+ id: "L2-claude-dir",
166
+ description: ".claude/ directory",
167
+ checkType: "dir-exists",
168
+ path: ".claude",
169
+ layer: 2,
170
+ fixable: true,
171
+ },
172
+ {
173
+ id: "L2-settings-json",
174
+ description: "Agent settings (.claude/settings.json)",
175
+ checkType: "file-exists",
176
+ path: ".claude/settings.json",
177
+ layer: 2,
178
+ fixable: true,
179
+ },
180
+ {
181
+ id: "L2-agents-dir",
182
+ description: ".claude/agents/ directory",
183
+ checkType: "dir-exists",
184
+ path: ".claude/agents",
185
+ layer: 2,
186
+ fixable: true,
187
+ },
188
+ {
189
+ id: "L2-pm-agent",
190
+ description: "PM agent definition",
191
+ checkType: "file-exists",
192
+ path: ".claude/agents/pm-agent.md",
193
+ layer: 2,
194
+ fixable: true,
195
+ },
196
+ {
197
+ id: "L2-developer-agent",
198
+ description: "Developer agent definition",
199
+ checkType: "file-exists",
200
+ path: ".claude/agents/developer-agent.md",
201
+ layer: 2,
202
+ fixable: true,
203
+ },
204
+ {
205
+ id: "L2-tester-agent",
206
+ description: "Tester agent definition",
207
+ checkType: "file-exists",
208
+ path: ".claude/agents/tester-agent.md",
209
+ layer: 2,
210
+ fixable: true,
211
+ },
212
+ {
213
+ id: "L2-agent-memory-dir",
214
+ description: ".claude/agent-memory/ directory",
215
+ checkType: "dir-exists",
216
+ path: ".claude/agent-memory",
217
+ layer: 2,
218
+ fixable: true,
219
+ },
220
+ {
221
+ id: "L2-pm-memory",
222
+ description: "PM agent memory directory",
223
+ checkType: "dir-exists",
224
+ path: ".claude/agent-memory/meto-pm",
225
+ layer: 2,
226
+ fixable: true,
227
+ },
228
+ {
229
+ id: "L2-developer-memory",
230
+ description: "Developer agent memory directory",
231
+ checkType: "dir-exists",
232
+ path: ".claude/agent-memory/meto-developer",
233
+ layer: 2,
234
+ fixable: true,
235
+ },
236
+ {
237
+ id: "L2-tester-memory",
238
+ description: "Tester agent memory directory",
239
+ checkType: "dir-exists",
240
+ path: ".claude/agent-memory/meto-tester",
241
+ layer: 2,
242
+ fixable: true,
243
+ },
244
+ ];
245
+ // ---------------------------------------------------------------------------
246
+ // Layer 3 -- Governance
247
+ // ---------------------------------------------------------------------------
248
+ const LAYER_3_EXPECTATIONS = [
249
+ {
250
+ id: "L3-dod-exists",
251
+ description: "Definition of done workflow exists",
252
+ checkType: "file-exists",
253
+ path: "ai/workflows/definition-of-done.md",
254
+ layer: 3,
255
+ fixable: true,
256
+ },
257
+ {
258
+ id: "L3-code-guidelines-exists",
259
+ description: "Code guidelines workflow exists",
260
+ checkType: "file-exists",
261
+ path: "ai/workflows/code-guidelines.md",
262
+ layer: 3,
263
+ fixable: true,
264
+ },
265
+ {
266
+ id: "L3-developer-agent-refs-guidelines",
267
+ description: "Developer agent references code guidelines",
268
+ checkType: "file-contains",
269
+ path: ".claude/agents/developer-agent.md",
270
+ layer: 3,
271
+ fixable: true,
272
+ containsPattern: "code-guidelines",
273
+ },
274
+ {
275
+ id: "L3-tester-agent-refs-guidelines",
276
+ description: "Tester agent references code guidelines",
277
+ checkType: "file-contains",
278
+ path: ".claude/agents/tester-agent.md",
279
+ layer: 3,
280
+ fixable: true,
281
+ containsPattern: "code-guidelines",
282
+ },
283
+ {
284
+ id: "L3-commit-conventions-defined",
285
+ description: "Commit conventions defined",
286
+ checkType: "file-contains",
287
+ path: "CLAUDE.md",
288
+ layer: 3,
289
+ fixable: true,
290
+ containsPattern: "Commit",
291
+ },
292
+ {
293
+ id: "L3-session-checkpoint",
294
+ description: "Session checkpoint workflow present",
295
+ checkType: "file-exists",
296
+ path: "ai/workflows/session-checkpoint.md",
297
+ layer: 3,
298
+ fixable: true,
299
+ },
300
+ {
301
+ id: "L3-pm-agent-refs-dod",
302
+ description: "PM agent references definition of done",
303
+ checkType: "file-contains",
304
+ path: ".claude/agents/pm-agent.md",
305
+ layer: 3,
306
+ fixable: true,
307
+ containsPattern: "definition-of-done",
308
+ },
309
+ {
310
+ id: "L3-developer-agent-refs-commit",
311
+ description: "Developer agent references commit conventions",
312
+ checkType: "file-contains",
313
+ path: ".claude/agents/developer-agent.md",
314
+ layer: 3,
315
+ fixable: true,
316
+ containsPattern: "commit",
317
+ },
318
+ {
319
+ id: "L3-tester-agent-refs-dod",
320
+ description: "Tester agent references definition of done",
321
+ checkType: "file-contains",
322
+ path: ".claude/agents/tester-agent.md",
323
+ layer: 3,
324
+ fixable: true,
325
+ containsPattern: "definition-of-done",
326
+ },
327
+ {
328
+ id: "L3-pm-agent-refs-memory",
329
+ description: "PM agent references memory file",
330
+ checkType: "file-contains",
331
+ path: ".claude/agents/pm-agent.md",
332
+ layer: 3,
333
+ fixable: true,
334
+ containsPattern: "agent-memory",
335
+ },
336
+ {
337
+ id: "L3-developer-agent-refs-memory",
338
+ description: "Developer agent references memory file",
339
+ checkType: "file-contains",
340
+ path: ".claude/agents/developer-agent.md",
341
+ layer: 3,
342
+ fixable: true,
343
+ containsPattern: "agent-memory",
344
+ },
345
+ {
346
+ id: "L3-tester-agent-refs-memory",
347
+ description: "Tester agent references memory file",
348
+ checkType: "file-contains",
349
+ path: ".claude/agents/tester-agent.md",
350
+ layer: 3,
351
+ fixable: true,
352
+ containsPattern: "agent-memory",
353
+ },
354
+ ];
355
+ // ---------------------------------------------------------------------------
356
+ // Blueprint (all layers)
357
+ // ---------------------------------------------------------------------------
358
+ /**
359
+ * The complete audit blueprint. Layers are ordered; the scanner should
360
+ * evaluate them sequentially and gate higher layers on lower ones passing.
361
+ *
362
+ * Exported as a constant -- no runtime construction.
363
+ */
364
+ export const AUDIT_BLUEPRINT = [
365
+ {
366
+ id: 0,
367
+ name: "Project Prerequisites",
368
+ expectations: LAYER_0_EXPECTATIONS,
369
+ },
370
+ {
371
+ id: 1,
372
+ name: "Methodology",
373
+ expectations: LAYER_1_EXPECTATIONS,
374
+ },
375
+ {
376
+ id: 2,
377
+ name: "Agents",
378
+ expectations: LAYER_2_EXPECTATIONS,
379
+ },
380
+ {
381
+ id: 3,
382
+ name: "Governance",
383
+ expectations: LAYER_3_EXPECTATIONS,
384
+ },
385
+ ];
386
+ //# sourceMappingURL=blueprint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blueprint.js","sourceRoot":"","sources":["../../../src/cli/audit/blueprint.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAqDH,8EAA8E;AAC9E,mCAAmC;AACnC,8EAA8E;AAE9E,MAAM,oB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SAAS,EAAE,eAAe;QAC1B,IAAI,EAAE,gCAAgC;QACtC,KAAK,EAAE,CAAC;QACR,OAAO,EAAE,IAAI;QACb,eAAe,EAAE,oBAAoB;KACtC;IACD;QACE,EAAE,EAAE,yBAAyB;QAC7B,WAAW,EAAE,iCAAiC;QAC9C,SAAS,EAAE,eAAe;QAC1B,IAAI,EAAE,4BAA4B;QAClC,KAAK,EAAE,CAAC;QACR,OAAO,EAAE,IAAI;QACb,eAAe,EAAE,cAAc;KAChC;IACD;QACE,EAAE,EAAE,gCAAgC;QACpC,WAAW,EAAE,wCAAwC;QACrD,SAAS,EAAE,eAAe;QAC1B,IAAI,EAAE,mCAAmC;QACzC,KAAK,EAAE,CAAC;QACR,OAAO,EAAE,IAAI;QACb,eAAe,EAAE,cAAc;KAChC;IACD;QACE,EAAE,EAAE,6BAA6B;QACjC,WAAW,EAAE,qCAAqC;QAClD,SAAS,EAAE,eAAe;QAC1B,IAAI,EAAE,gCAAgC;QACtC,KAAK,EAAE,CAAC;QACR,OAAO,EAAE,IAAI;QACb,eAAe,EAAE,cAAc;KAChC;CACF,CAAC;AAEF,8EAA8E;AAC9E,yBAAyB;AACzB,8EAA8E;AAE9E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAA8B;IACxD;QACE,EAAE,EAAE,CAAC;QACL,IAAI,EAAE,uBAAuB;QAC7B,YAAY,EAAE,oBAAoB;KACnC;IACD;QACE,EAAE,EAAE,CAAC;QACL,IAAI,EAAE,aAAa;QACnB,YAAY,EAAE,oBAAoB;KACnC;IACD;QACE,EAAE,EAAE,CAAC;QACL,IAAI,EAAE,QAAQ;QACd,YAAY,EAAE,oBAAoB;KACnC;IACD;QACE,EAAE,EAAE,CAAC;QACL,IAAI,EAAE,YAAY;QAClB,YAAY,EAAE,oBAAoB;KACnC;CACO,CAAC"}
@@ -0,0 +1,31 @@
1
+ import type { TechStack } from "../types.js";
2
+ /**
3
+ * Result of tech stack auto-detection.
4
+ */
5
+ export interface DetectedStack {
6
+ /** The detected stack identifier matching TechStack presets, or "custom" */
7
+ stack: TechStack;
8
+ /** The manifest file that was used for detection */
9
+ detectedVia: string;
10
+ /** Human-readable label for the detected stack */
11
+ label: string;
12
+ }
13
+ /**
14
+ * Auto-detects the tech stack of a project by examining manifest files
15
+ * in the project root directory.
16
+ *
17
+ * Detection order:
18
+ * 1. package.json — inspects dependencies for Next.js, React Native,
19
+ * Vite+React, or falls back to Node.js CLI
20
+ * 2. go.mod — Go
21
+ * 3. pyproject.toml or requirements.txt — Python (FastAPI preset)
22
+ * 4. pubspec.yaml — Flutter
23
+ * 5. Cargo.toml — Rust (returns "custom" since no Rust preset exists)
24
+ *
25
+ * Root-level manifests only. Does not recurse into subdirectories.
26
+ *
27
+ * @param projectDir - Absolute path to the project root directory
28
+ * @returns The detected stack result, or a "custom" fallback if no manifest is found
29
+ */
30
+ export declare function detectStack(projectDir: string): Promise<DetectedStack>;
31
+ //# sourceMappingURL=detect-stack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detect-stack.d.ts","sourceRoot":"","sources":["../../../src/cli/audit/detect-stack.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,4EAA4E;IAC5E,KAAK,EAAE,SAAS,CAAC;IACjB,oDAAoD;IACpD,WAAW,EAAE,MAAM,CAAC;IACpB,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;CACf;AAiGD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAyD5E"}
@@ -0,0 +1,154 @@
1
+ import { readFile, stat } from "node:fs/promises";
2
+ import { join } from "node:path";
3
+ /**
4
+ * Checks whether a file exists at the given path.
5
+ */
6
+ async function fileExists(filePath) {
7
+ try {
8
+ const stats = await stat(filePath);
9
+ return stats.isFile();
10
+ }
11
+ catch {
12
+ return false;
13
+ }
14
+ }
15
+ /**
16
+ * Reads and parses a package.json file. Returns null if the file
17
+ * does not exist or cannot be parsed.
18
+ */
19
+ async function readPackageJson(projectDir) {
20
+ const pkgPath = join(projectDir, "package.json");
21
+ try {
22
+ const content = await readFile(pkgPath, "utf-8");
23
+ return JSON.parse(content);
24
+ }
25
+ catch {
26
+ return null;
27
+ }
28
+ }
29
+ /**
30
+ * Checks whether a dependency exists in package.json dependencies
31
+ * or devDependencies.
32
+ */
33
+ function hasDependency(pkg, depName) {
34
+ const deps = pkg["dependencies"];
35
+ const devDeps = pkg["devDependencies"];
36
+ if (deps !== null && deps !== undefined && typeof deps === "object") {
37
+ if (depName in deps) {
38
+ return true;
39
+ }
40
+ }
41
+ if (devDeps !== null && devDeps !== undefined && typeof devDeps === "object") {
42
+ if (depName in devDeps) {
43
+ return true;
44
+ }
45
+ }
46
+ return false;
47
+ }
48
+ /**
49
+ * Determines the most specific Node.js stack from package.json contents.
50
+ * Checks for framework-specific dependencies to distinguish between
51
+ * Next.js, React Native, Vite+React, and generic Node.js CLI.
52
+ */
53
+ function detectNodeStack(pkg) {
54
+ // Next.js detection (maps to nextjs-supabase preset)
55
+ if (hasDependency(pkg, "next")) {
56
+ return {
57
+ stack: "nextjs-supabase",
58
+ detectedVia: "package.json",
59
+ label: "Next.js",
60
+ };
61
+ }
62
+ // React Native detection
63
+ if (hasDependency(pkg, "react-native")) {
64
+ return {
65
+ stack: "react-native",
66
+ detectedVia: "package.json",
67
+ label: "React Native",
68
+ };
69
+ }
70
+ // Vite + React detection (check vite first, then confirm React)
71
+ if (hasDependency(pkg, "vite") && hasDependency(pkg, "react")) {
72
+ return {
73
+ stack: "vite-react",
74
+ detectedVia: "package.json",
75
+ label: "Vite + React",
76
+ };
77
+ }
78
+ // Generic Node.js CLI fallback for package.json projects
79
+ return {
80
+ stack: "nodejs-cli",
81
+ detectedVia: "package.json",
82
+ label: "Node.js",
83
+ };
84
+ }
85
+ /**
86
+ * Auto-detects the tech stack of a project by examining manifest files
87
+ * in the project root directory.
88
+ *
89
+ * Detection order:
90
+ * 1. package.json — inspects dependencies for Next.js, React Native,
91
+ * Vite+React, or falls back to Node.js CLI
92
+ * 2. go.mod — Go
93
+ * 3. pyproject.toml or requirements.txt — Python (FastAPI preset)
94
+ * 4. pubspec.yaml — Flutter
95
+ * 5. Cargo.toml — Rust (returns "custom" since no Rust preset exists)
96
+ *
97
+ * Root-level manifests only. Does not recurse into subdirectories.
98
+ *
99
+ * @param projectDir - Absolute path to the project root directory
100
+ * @returns The detected stack result, or a "custom" fallback if no manifest is found
101
+ */
102
+ export async function detectStack(projectDir) {
103
+ // 1. Check package.json first (most common, and allows sub-detection)
104
+ const pkg = await readPackageJson(projectDir);
105
+ if (pkg !== null) {
106
+ return detectNodeStack(pkg);
107
+ }
108
+ // 2. Check go.mod
109
+ if (await fileExists(join(projectDir, "go.mod"))) {
110
+ return {
111
+ stack: "go",
112
+ detectedVia: "go.mod",
113
+ label: "Go",
114
+ };
115
+ }
116
+ // 3. Check Python manifests
117
+ if (await fileExists(join(projectDir, "pyproject.toml"))) {
118
+ return {
119
+ stack: "python-fastapi",
120
+ detectedVia: "pyproject.toml",
121
+ label: "Python",
122
+ };
123
+ }
124
+ if (await fileExists(join(projectDir, "requirements.txt"))) {
125
+ return {
126
+ stack: "python-fastapi",
127
+ detectedVia: "requirements.txt",
128
+ label: "Python",
129
+ };
130
+ }
131
+ // 4. Check Flutter
132
+ if (await fileExists(join(projectDir, "pubspec.yaml"))) {
133
+ return {
134
+ stack: "flutter",
135
+ detectedVia: "pubspec.yaml",
136
+ label: "Flutter",
137
+ };
138
+ }
139
+ // 5. Check Rust (no preset — returns "custom")
140
+ if (await fileExists(join(projectDir, "Cargo.toml"))) {
141
+ return {
142
+ stack: "custom",
143
+ detectedVia: "Cargo.toml",
144
+ label: "Rust",
145
+ };
146
+ }
147
+ // No manifest detected
148
+ return {
149
+ stack: "custom",
150
+ detectedVia: "none",
151
+ label: "Unknown",
152
+ };
153
+ }
154
+ //# sourceMappingURL=detect-stack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detect-stack.js","sourceRoot":"","sources":["../../../src/cli/audit/detect-stack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAejC;;GAEG;AACH,KAAK,UAAU,UAAU,CAAC,QAAgB;IACxC,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,CAAC;QACnC,OAAO,KAAK,CAAC,MAAM,EAAE,CAAC;IACxB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,KAAK,UAAU,eAAe,CAC5B,UAAkB;IAElB,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;IACjD,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACjD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAA4B,CAAC;IACxD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,SAAS,aAAa,CACpB,GAA4B,EAC5B,OAAe;IAEf,MAAM,IAAI,GAAG,GAAG,CAAC,cAAc,CAAC,CAAC;IACjC,MAAM,OAAO,GAAG,GAAG,CAAC,iBAAiB,CAAC,CAAC;IAEvC,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,SAAS,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QACpE,IAAI,OAAO,IAAK,IAAgC,EAAE,CAAC;YACjD,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED,IAAI,OAAO,KAAK,IAA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