lacuna-cli 0.1.6 → 0.1.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.
Files changed (86) hide show
  1. package/README.md +45 -11
  2. package/dist/agent/context.d.ts +2 -0
  3. package/dist/agent/context.d.ts.map +1 -1
  4. package/dist/agent/context.js +314 -1
  5. package/dist/agent/context.js.map +1 -1
  6. package/dist/agent/fix-loop.d.ts.map +1 -1
  7. package/dist/agent/fix-loop.js +36 -8
  8. package/dist/agent/fix-loop.js.map +1 -1
  9. package/dist/agent/generator.d.ts +5 -1
  10. package/dist/agent/generator.d.ts.map +1 -1
  11. package/dist/agent/generator.js +51 -12
  12. package/dist/agent/generator.js.map +1 -1
  13. package/dist/agent/loop.d.ts.map +1 -1
  14. package/dist/agent/loop.js +83 -38
  15. package/dist/agent/loop.js.map +1 -1
  16. package/dist/agent/{prompts.d.ts → prompts/index.d.ts} +4 -2
  17. package/dist/agent/prompts/index.d.ts.map +1 -0
  18. package/dist/agent/{prompts.js → prompts/index.js} +162 -341
  19. package/dist/agent/prompts/index.js.map +1 -0
  20. package/dist/agent/prompts/nextjs.d.ts +12 -0
  21. package/dist/agent/prompts/nextjs.d.ts.map +1 -0
  22. package/dist/agent/prompts/nextjs.js +138 -0
  23. package/dist/agent/prompts/nextjs.js.map +1 -0
  24. package/dist/agent/prompts/react-native.d.ts +4 -0
  25. package/dist/agent/prompts/react-native.d.ts.map +1 -0
  26. package/dist/agent/prompts/react-native.js +82 -0
  27. package/dist/agent/prompts/react-native.js.map +1 -0
  28. package/dist/agent/prompts/react.d.ts +2 -0
  29. package/dist/agent/prompts/react.d.ts.map +1 -0
  30. package/dist/agent/prompts/react.js +48 -0
  31. package/dist/agent/prompts/react.js.map +1 -0
  32. package/dist/agent/prompts/runners/js-common.d.ts +2 -0
  33. package/dist/agent/prompts/runners/js-common.d.ts.map +1 -0
  34. package/dist/agent/prompts/runners/js-common.js +13 -0
  35. package/dist/agent/prompts/runners/js-common.js.map +1 -0
  36. package/dist/agent/prompts/runners/typescript.d.ts +2 -0
  37. package/dist/agent/prompts/runners/typescript.d.ts.map +1 -0
  38. package/dist/agent/prompts/runners/typescript.js +12 -0
  39. package/dist/agent/prompts/runners/typescript.js.map +1 -0
  40. package/dist/agent/prompts/runners/vitest.d.ts +2 -0
  41. package/dist/agent/prompts/runners/vitest.d.ts.map +1 -0
  42. package/dist/agent/prompts/runners/vitest.js +23 -0
  43. package/dist/agent/prompts/runners/vitest.js.map +1 -0
  44. package/dist/agent/prompts/vue.d.ts +3 -0
  45. package/dist/agent/prompts/vue.d.ts.map +1 -0
  46. package/dist/agent/prompts/vue.js +29 -0
  47. package/dist/agent/prompts/vue.js.map +1 -0
  48. package/dist/commands/analyze.d.ts.map +1 -1
  49. package/dist/commands/analyze.js +43 -32
  50. package/dist/commands/analyze.js.map +1 -1
  51. package/dist/commands/fix.js +1 -1
  52. package/dist/commands/fix.js.map +1 -1
  53. package/dist/commands/init.d.ts.map +1 -1
  54. package/dist/commands/init.js +104 -14
  55. package/dist/commands/init.js.map +1 -1
  56. package/dist/lib/coverage/gaps.d.ts.map +1 -1
  57. package/dist/lib/coverage/gaps.js +33 -3
  58. package/dist/lib/coverage/gaps.js.map +1 -1
  59. package/dist/lib/coverage/index.d.ts +1 -1
  60. package/dist/lib/coverage/index.d.ts.map +1 -1
  61. package/dist/lib/coverage/index.js +1 -1
  62. package/dist/lib/coverage/index.js.map +1 -1
  63. package/dist/lib/detector.d.ts.map +1 -1
  64. package/dist/lib/detector.js +26 -12
  65. package/dist/lib/detector.js.map +1 -1
  66. package/dist/lib/providers/anthropic.d.ts.map +1 -1
  67. package/dist/lib/providers/anthropic.js +30 -1
  68. package/dist/lib/providers/anthropic.js.map +1 -1
  69. package/dist/lib/providers/openai-compatible.d.ts.map +1 -1
  70. package/dist/lib/providers/openai-compatible.js +35 -2
  71. package/dist/lib/providers/openai-compatible.js.map +1 -1
  72. package/dist/lib/providers/types.d.ts +4 -0
  73. package/dist/lib/providers/types.d.ts.map +1 -1
  74. package/dist/lib/providers/types.js +10 -0
  75. package/dist/lib/providers/types.js.map +1 -1
  76. package/dist/lib/validate.d.ts.map +1 -1
  77. package/dist/lib/validate.js +52 -20
  78. package/dist/lib/validate.js.map +1 -1
  79. package/dist/lib/worker-display.d.ts +7 -0
  80. package/dist/lib/worker-display.d.ts.map +1 -1
  81. package/dist/lib/worker-display.js +35 -2
  82. package/dist/lib/worker-display.js.map +1 -1
  83. package/oclif.manifest.json +309 -0
  84. package/package.json +1 -1
  85. package/dist/agent/prompts.d.ts.map +0 -1
  86. package/dist/agent/prompts.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/agent/prompts/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,cAAc,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAC9I,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACjG,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AACzF,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAErD,iFAAiF;AAEjF,SAAS,sBAAsB,CAAC,SAAiB;IAC/C,MAAM,MAAM,GAAa,EAAE,CAAA;IAC3B,KAAK,MAAM,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC,sCAAsC,CAAC,EAAE,CAAC;QAC3E,MAAM,CAAC,IAAI,CAAC,CAAC,C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AC,aAAa,CAAC,CAAA;IACvD,IAAI,YAAY;QAAE,KAAK,CAAC,IAAI,CAAC,SAAS,YAAY,EAAE,CAAC,CAAA;IAErD,MAAM,cAAc,GAAG,sBAAsB,CAAC,aAAa,CAAC,CAAA;IAC5D,IAAI,cAAc;QAAE,KAAK,CAAC,IAAI,CAAC,SAAS,cAAc,EAAE,CAAC,CAAA;IAEzD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACd,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA;IAC5B,KAAK,CAAC,IAAI,CAAC,2FAA2F,CAAC,CAAA;IACvG,KAAK,CAAC,IAAI,CAAC,4EAA4E,CAAC,CAAA;IACxF,KAAK,CAAC,IAAI,CAAC,kRAAkR,CAAC,CAAA;IAC9R,KAAK,CAAC,IAAI,CAAC,2NAA2N,CAAC,CAAA;IACvO,KAAK,CAAC,IAAI,CAAC,mFAAmF,CAAC,CAAA;IAC/F,KAAK,CAAC,IAAI,CAAC,uEAAuE,CAAC,CAAA;IACnF,KAAK,CAAC,IAAI,CAAC,8QAA8Q,CAAC,CAAA;IAC1R,KAAK,CAAC,IAAI,CAAC,2NAA2N,CAAC,CAAA;IACvO,KAAK,CAAC,IAAI,CAAC,geAAge,CAAC,CAAA;IAC5e,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACd,KAAK,CAAC,IAAI,CAAC,2FAA2F,CAAC,CAAA;IAEvG,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACzB,CAAC"}
@@ -0,0 +1,12 @@
1
+ export interface NextJsAnalysis {
2
+ hasNavigation: boolean;
3
+ hasHeaders: boolean;
4
+ hasCache: boolean;
5
+ clientModules: string[];
6
+ serverModules: string[];
7
+ sessionProviders: string[];
8
+ }
9
+ export declare function analyzeNextJs(sourceCode: string): NextJsAnalysis;
10
+ export declare function buildNextJsGuidance(a: NextJsAnalysis, mockApi: string): string | null;
11
+ export declare function detectNextJsImportError(errorOutput: string, mockApi?: string): string | null;
12
+ //# sourceMappingURL=nextjs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nextjs.d.ts","sourceRoot":"","sources":["../../../src/agent/prompts/nextjs.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,aAAa,EAAE,OAAO,CAAA;IACtB,UAAU,EAAE,OAAO,CAAA;IACnB,QAAQ,EAAE,OAAO,CAAA;IACjB,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,gBAAgB,EAAE,MAAM,EAAE,CAAA;CAC3B;AAED,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,cAAc,CAyChE;AAED,wBAAgB,mBAAmB,CACjC,CAAC,EAAE,cAAc,EACjB,OAAO,EAAE,MAAM,GACd,MAAM,GAAG,IAAI,CAkHf;AAED,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,MAAM,EACnB,OAAO,SAAO,GACb,MAAM,GAAG,IAAI,CAyEf"}
@@ -0,0 +1,138 @@
1
+ export function analyzeNextJs(sourceCode) {
2
+ const hasNavigation = /from\s+['"]next\/navigation['"]/.test(sourceCode);
3
+ const hasHeaders = /from\s+['"]next\/headers['"]/.test(sourceCode);
4
+ const hasCache = /from\s+['"]next\/cache['"]/.test(sourceCode);
5
+ // IMPORTANT: real Next.js boundary signals (useful, not decorative)
6
+ const hasClientDirective = /["']use client["']/.test(sourceCode);
7
+ const hasServerDirective = /["']use server["']/.test(sourceCode);
8
+ const clientModules = [];
9
+ const clientMatches = sourceCode.matchAll(/from\s+['"]([^'"]+\.client)['"]/g);
10
+ for (const m of clientMatches)
11
+ clientModules.push(m[1]);
12
+ const serverModules = [];
13
+ const serverMatches = sourceCode.matchAll(/from\s+['"]([^'"]+\.server)['"]/g);
14
+ for (const m of serverMatches)
15
+ serverModules.push(m[1]);
16
+ const sessionProviders = [];
17
+ const sessionMatches = sourceCode.matchAll(/from\s+['"]([^'"]*(?:next-auth|session|auth|useSession|provider)[^'"]*)['"]/gi);
18
+ for (const m of sessionMatches)
19
+ sessionProviders.push(m[1]);
20
+ /**
21
+ * CRITICAL FIX:
22
+ * Directives are not "modules", but they *must influence classification*
23
+ */
24
+ const enhancedHasNavigation = hasNavigation || hasClientDirective;
25
+ const enhancedHasHeaders = hasHeaders || hasServerDirective;
26
+ return {
27
+ hasNavigation: enhancedHasNavigation,
28
+ hasHeaders: enhancedHasHeaders,
29
+ hasCache,
30
+ clientModules,
31
+ serverModules,
32
+ sessionProviders,
33
+ };
34
+ }
35
+ export function buildNextJsGuidance(a, mockApi) {
36
+ const isNextJsProject = a.hasNavigation ||
37
+ a.hasHeaders ||
38
+ a.hasCache ||
39
+ a.clientModules.length > 0 ||
40
+ a.serverModules.length > 0 ||
41
+ a.sessionProviders.length > 0;
42
+ if (!isNextJsProject)
43
+ return null;
44
+ const lines = [
45
+ "NEXT.JS TEST ENVIRONMENT GUIDANCE (autogenerated):",
46
+ "",
47
+ "CRITICAL RULE: Next.js server/client boundaries must be mocked BEFORE rendering.",
48
+ "",
49
+ "SERVER COMPONENT NOTE:",
50
+ "Do NOT attempt custom async-to-sync wrapping. Instead:",
51
+ "- If component is async, resolve data layer only and test output JSX, not function execution.",
52
+ "",
53
+ "SERVER ACTIONS:",
54
+ `Mock all 'use server' actions at module level using ${mockApi}.mock(...) returning resolved promises.`,
55
+ ];
56
+ // navigation
57
+ if (a.hasNavigation) {
58
+ lines.push("", "NEXT/NAVIGATION MOCK (required):", `${mockApi}.mock('next/navigation', () => ({`, ` useRouter: ${mockApi}.fn(() => ({ push: ${mockApi}.fn(), replace: ${mockApi}.fn(), back: ${mockApi}.fn() })),`, ` usePathname: ${mockApi}.fn(() => '/'),`, ` useSearchParams: ${mockApi}.fn(() => ({ get: ${mockApi}.fn(() => null), has: ${mockApi}.fn(() => false) })),`, ` useParams: ${mockApi}.fn(() => ({})),`, `}))`);
59
+ }
60
+ if (a.hasHeaders) {
61
+ lines.push("", "NEXT/HEADERS MOCK (server-only safe stub):", `${mockApi}.mock('next/headers', () => ({`, ` cookies: ${mockApi}.fn(() => ({ get: ${mockApi}.fn(() => undefined) })),`, ` headers: ${mockApi}.fn(() => ({ get: ${mockApi}.fn(() => null) })),`, `}))`);
62
+ }
63
+ if (a.hasCache) {
64
+ lines.push("", "NEXT/CACHE MOCK (no-op):", `${mockApi}.mock('next/cache', () => ({`, ` revalidatePath: ${mockApi}.fn(),`, ` revalidateTag: ${mockApi}.fn(),`, ` unstable_cache: ${mockApi}.fn((fn: any) => fn),`, `}))`);
65
+ }
66
+ // client modules
67
+ if (a.clientModules.length > 0) {
68
+ lines.push("", "CLIENT MODULE MOCKS (boundary isolation required):");
69
+ for (const p of a.clientModules) {
70
+ lines.push(`${mockApi}.mock('${p}', () => ({ /* export stubs */ }))`);
71
+ }
72
+ }
73
+ // server modules
74
+ if (a.serverModules.length > 0) {
75
+ lines.push("", "SERVER MODULE MOCKS:");
76
+ for (const p of a.serverModules) {
77
+ lines.push(`${mockApi}.mock('${p}', () => ({ /* export stubs */ }))`);
78
+ }
79
+ }
80
+ // session/auth (less aggressive now)
81
+ if (a.sessionProviders.length > 0) {
82
+ const target = a.sessionProviders[0];
83
+ lines.push("", "AUTH / SESSION MOCK:", `${mockApi}.mock('${target}', () => ({`, ` useSession: ${mockApi}.fn(() => ({`, ` data: { user: { id: 'test-user', email: 'test@example.com' } },`, ` status: 'authenticated'`, ` })),`, ` getSession: ${mockApi}.fn(() => Promise.resolve({ user: { id: 'test-user' } }))`, `}))`);
84
+ }
85
+ lines.push("", "FINAL RULE:", "If imports still fail, the mock path does NOT match the runtime import string exactly (character-for-character).");
86
+ return lines.join("\n");
87
+ }
88
+ export function detectNextJsImportError(errorOutput, mockApi = 'vi') {
89
+ const failedImport = errorOutput.match(/Failed to resolve import "([^"]+)"/);
90
+ // PRIORITY 1: async server rendering crash
91
+ if (/Objects are not valid as a React child/i.test(errorOutput) ||
92
+ /async.*component/i.test(errorOutput) ||
93
+ /renderAsync/i.test(errorOutput)) {
94
+ return [
95
+ "NEXT.JS RENDER FAILURE (ASYNC COMPONENT DETECTED)",
96
+ "You are trying to render a Server Component or async function as a React node.",
97
+ "",
98
+ "Fix:",
99
+ "- Do NOT wrap components in custom async factories",
100
+ "- Ensure test only renders resolved JSX output",
101
+ "- Prefer testing data + rendered output separately"
102
+ ].join("\n");
103
+ }
104
+ // PRIORITY 2: server action failure
105
+ if (/Server Action/i.test(errorOutput) ||
106
+ /use server/i.test(errorOutput)) {
107
+ return [
108
+ "SERVER ACTION FAILURE",
109
+ `All server actions must be mocked using ${mockApi}.mock() and return resolved promises.`,
110
+ ].join("\n");
111
+ }
112
+ if (!failedImport)
113
+ return null;
114
+ const importPath = failedImport[1];
115
+ const isNextInternal = importPath.startsWith('next/');
116
+ const isServerOnly = importPath === 'server-only';
117
+ const isClientBoundary = importPath.endsWith('.client');
118
+ const isServerBoundary = importPath.endsWith('.server');
119
+ const isProvider = /session|auth|provider/i.test(importPath);
120
+ const isAlias = importPath.startsWith('@/');
121
+ if (!isNextInternal && !isServerOnly && !isClientBoundary && !isServerBoundary && !isProvider && !isAlias) {
122
+ return null;
123
+ }
124
+ const lines = [
125
+ `IMPORT FAILURE: "${importPath}"`
126
+ ];
127
+ if (isServerOnly) {
128
+ lines.push("server-only cannot be resolved in test runtime.", "Fix must be in test config (module alias to empty stub).");
129
+ }
130
+ if (isAlias) {
131
+ lines.push("TS path alias '@/' is not resolved in test environment.", "Use relative mock paths instead of alias.");
132
+ }
133
+ if (isClientBoundary || isServerBoundary) {
134
+ lines.push("Next.js boundary module detected.", `Mock explicitly using ${mockApi}.mock(importPath, factory).`);
135
+ }
136
+ return lines.join("\n");
137
+ }
138
+ //# sourceMappingURL=nextjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nextjs.js","sourceRoot":"","sources":["../../../src/agent/prompts/nextjs.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,aAAa,CAAC,UAAkB;IAC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IAAI,CAAC,gBAAgB,IAAI,CAAC,UAAU,IAAI,CAAC,OAAO,EAAE,CAAC;QAC1G,OAAO,IAAI,CAAA;IACb,CAAC;IAED,MAAM,KAAK,GAAa;QACtB,oBAAoB,UAAU,GAAG;KAClC,CAAA;IAED,IAAI,YAAY,EAAE,CAAC;QACjB,KAAK,CAAC,IAAI,CACR,iDAAiD,EACjD,0DAA0D,CAC3D,CAAA;IACH,CAAC;IAED,IAAI,OAAO,EAAE,CAAC;QACZ,KAAK,CAAC,IAAI,CACR,yDAAyD,EACzD,2CAA2C,CAC5C,CAAA;IACH,CAAC;IAED,IAAI,gBAAgB,IAAI,gBAAgB,EAAE,CAAC;QACzC,KAAK,CAAC,IAAI,CACR,mCAAmC,EACnC,yBAAyB,OAAO,6BAA6B,CAC9D,CAAA;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACzB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare function detectReactNative(packageDeps: string | null): boolean;
2
+ export declare function buildReactNativeGuidance(): string;
3
+ export declare function detectRntlErrors(errorOutput: string): string | null;
4
+ //# sourceMappingURL=react-native.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-native.d.ts","sourceRoot":"","sources":["../../../src/agent/prompts/react-native.ts"],"names":[],"mappings":"AAAA,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAIrE;AAED,wBAAgB,wBAAwB,IAAI,MAAM,CAoEjD;AAED,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA0EnE"}
@@ -0,0 +1,82 @@
1
+ export function detectReactNative(packageDeps) {
2
+ if (!packageDeps)
3
+ return false;
4
+ // Safe matching prevents false-positives on web codebases containing loose words
5
+ return /\b(react-native|expo-router|@react-navigation\/native)\b/.test(packageDeps) || /"expo"\s*:/.test(packageDeps);
6
+ }
7
+ export function buildReactNativeGuidance() {
8
+ return [
9
+ 'REACT NATIVE PROJECT — use @testing-library/react-native, not @testing-library/react.',
10
+ '- NEVER write `expect(true).toBe(true)` as a render smoke-test — it proves nothing and will be rejected. When a component previously crashed and now renders successfully, assert on at least one element that must be visible: `expect(screen.getByText(\'Some Title\')).toBeTruthy()` or `expect(screen.getByTestId(\'...\')). toBeDefined()`. Read the JSX and pick the first piece of text or testID that is unconditionally rendered.',
11
+ '- READ THE COMPONENT FIRST — before writing any test, read the component file and identify: (1) which hooks are called and exactly which keys are destructured from each; (2) which service methods are called and with what arguments; (3) the exact text strings rendered (titles, button labels, placeholders, empty states, error messages); (4) all conditional rendering branches (loading states, feature flags, KYC status, permission checks); (5) multi-step modal/navigation flows. Every test must be traceable to a specific line of JSX — if you cannot point to where a text string or UI element is rendered in the component, do not write that assertion.',
12
+ '- MOCK SHAPE MUST MATCH HOOK DESTRUCTURE EXACTLY: grep the component for `const { ... } = useHookName()` and copy every destructured key into the mock return value. Missing keys are silently `undefined` and cause crashes or broken UI (e.g. a missing numeric threshold makes validation always false, a missing string inserts "undefined" into rendered text). Wrong keys (extra properties the component never reads) are harmless but missing ones are always bugs. Every mock must include a sensible default for every key the component destructures.',
13
+ '- SERVICE METHOD NAMES: grep the component for `ServiceName.method(` and copy the exact method name verbatim — a single-letter difference (`getDrawResult` vs `getDrawResults`, `swapBerries` vs `redeemBerries`) silently attaches the mock to a nonexistent property, leaving the real method un-mocked. Never infer method names from intent; always read the call site.',
14
+ '- MOCK DATA COMPLETENESS: mock object factory helpers must include every field the component accesses — especially arrays. If the component does `item.my_tickets.length`, `.map(...)`, or `.some(...)`, a mock missing `my_tickets` throws `TypeError: Cannot read properties of undefined`. Scan the component for every property access on each mock object and include them all with safe defaults (`[]`, `0`, `false`, `\'\'`).',
15
+ "- Import render, screen, fireEvent, waitFor from '@testing-library/react-native'",
16
+ '- No document, window, or localStorage globals — they do not exist in React Native',
17
+ "- Mock react-native modules with jest.mock('react-native', ...)",
18
+ '- Use fireEvent.press() not fireEvent.click() for Pressable/TouchableOpacity',
19
+ "- Async state: use waitFor() from '@testing-library/react-native', not from '@testing-library/react'",
20
+ '- ALL mock functions must use jest.fn() — do NOT mix vi.fn() and jest.fn() in the same project',
21
+ "- Mock component props: use ViewProps from react-native (NOT Record<string, unknown>) when spreading props into a <View> mock. Record<string, unknown> conflicts with View's ref: React.Ref<View> and causes ts(2352). Pattern:\n import { View, type ViewProps } from 'react-native'\n const MockFoo = (props: ViewProps) => <View testID=\"foo\" {...props} />",
22
+ '- "render function has not been called": TWO causes — (1) forgot to await render() — RNTL v14 render() is async, should be awaited in async tests; or (2) component threw during render (missing mock, undefined import). Check both before diagnosing screen queries.',
23
+ '- RNTL v14 — render() IS ASYNC: test should be async and render should typically be awaited: `await render(<Screen />)`. Without awaiting async updates, act() may not flush and screen queries can fail with "render function has not been called".',
24
+ '- useEffect MICROTASK FLUSH: `await render()` flushes all pending microtasks via act(), so any state set by a useEffect that calls mockResolvedValue (e.g. fetching data on mount) is already committed before the first assertion runs. You do NOT need an extra waitFor after render for mount-time data fetches — the state is already there. Use waitFor only when testing flows that trigger further async state changes after user interaction.',
25
+ '- RNTL v14 — fireEvent SHOULD BE AWAITED: prefer `await fireEvent.press(...)` and `await fireEvent.changeText(...)` so updates flush before assertions. Missing await can cause state updates not to commit.',
26
+ '- LOADING STATE — controlled Promise pattern: do NOT await the press when testing loading UI. Instead: (1) const pressPromise = fireEvent.press(btn); (2) await waitFor(() => expect(screen.getByTestId("activity-indicator")).toBeTruthy()); (3) resolve mock; (4) await pressPromise. Skipping step 4 leaves open act() scope that corrupts subsequent tests.',
27
+ // ICON/COMPONENT MOCKS
28
+ '- ICON/COMPONENT MOCKS (Stateless): For simple stubs where you do NOT assert call counts, use plain functions `() => null`. Never use jest.fn(() => null) because clearAllMocks() strips implementations, causing "Nothing was returned from render".',
29
+ `- COMPOUND COMPONENT MOCKS (e.g. expo-router Tabs): Mock them using a static factory:\n jest.mock('expo-router', () => {\n const MockComponent = ({ children }) => children;\n MockComponent.Screen = () => null;\n return {\n Tabs: MockComponent,\n Link: () => null,\n useRouter: () => ({\n push: jest.fn(),\n replace: jest.fn(),\n back: jest.fn(),\n }),\n };\n });`,
30
+ // CRUCIAL NATIVE INFRASTRUCTURE MOCKS
31
+ "- NATIVE ANIMATION DRIVER MOCK: jest.mock('react-native/Libraries/Animated/nativeWithAnimated', () => ({}));",
32
+ "- REANIMATED MOCK: jest.mock('react-native-reanimated', () => require('react-native-reanimated/mock'));",
33
+ "- ASYNC STORAGE MOCK: jest.mock('@react-native-async-storage/async-storage', () => require('@react-native-async-storage/async-storage/jest/async-storage-mock'));",
34
+ "- SAFE AREA CONTEXT MOCK: jest.mock('react-native-safe-area-context', () => ({ SafeAreaProvider: ({ children }) => children, SafeAreaView: ({ children }) => children, useSafeAreaInsets: () => ({ top: 0, right: 0, bottom: 0, left: 0 }) }));",
35
+ "- VECTOR ICONS MOCK: jest.mock('@expo/vector-icons', () => ({ MaterialIcons: () => null, Ionicons: () => null }));",
36
+ // STATE & NAVIGATION
37
+ "- REACT NAVIGATION MOCK: jest.mock('@react-navigation/native', () => ({ ...jest.requireActual('@react-navigation/native'), useNavigation: () => ({ navigate: jest.fn(), goBack: jest.fn(), setOptions: jest.fn() }), useRoute: () => ({ params: {} }) }));",
38
+ "- useFocusEffect MOCK: mock as a no-op to keep the view at its initial useState value and prevent navigation side-effects during test setup: `jest.mock('@react-navigation/native', () => ({ useFocusEffect: jest.fn() }))`. If you need to test a specific view driven by route params, call the callback in the mock AND mock `useLocalSearchParams` to return the target params: `useFocusEffect: jest.fn((cb) => cb())`.",
39
+ "- ZUSTAND STORE RESET: use act() when mutating store state in tests:\n act(() => { useMyStore.setState({ user: mockUser }); });",
40
+ "- REDUX REQUIREMENT: must wrap tested components in Provider with mock store",
41
+ '- UI TEXT — copy verbatim from the component: text strings in assertions must match the component exactly — punctuation ("No transactions yet." with period), case ("100 berries" not "Berries"), and Unicode characters (`…` U+2026 HORIZONTAL ELLIPSIS is not the same as `...` three dots). A one-character mismatch causes getByText to throw even though the element is present. When in doubt, read the JSX.',
42
+ "- DYNAMIC TEXT TEMPLATES: when the component renders a string built from state (e.g. `No ${activeStatus} draws right now` or `Buy ${quantity} Ticket${quantity > 1 ? 's' : ''}`), trace your mock's return value to compute the exact rendered string. With `activeStatus: 'open'` the text is `'No open draws right now'`. With `quantity: 1` the button says `'Buy 1 Ticket'`. Always derive the expected string from mock state — never guess the label.",
43
+ '- TOAST VS SCREEN TEXT — check the catch/success block before asserting screen text: if the component calls `showToast(message, ...)` in a catch block, nothing is rendered on screen — assert `expect(showToast).toHaveBeenCalledWith(\'Exact message\', ...)` instead. For error flows use `mockRejectedValue(new Error(\'...\'))`, not `mockResolvedValue({ success: false })`. For success flows that only call `showToast` and clear state (no success screen rendered), also assert on `showToast`. Never write `screen.getByText(\'...\')` for text that goes to a toast service.',
44
+ "- BUTTON QUERIES: getAllByRole('button') does NOT reliably match TouchableOpacity. Prefer getAllByText('Label') or testID.",
45
+ '- ICON-ONLY BUTTONS: if a TouchableOpacity contains only an icon component (mocked as `() => null`) with no text, testID, or accessibilityLabel, it cannot be queried in RNTL v14. Do not invent a text label that is not in the JSX. Options: (1) skip that test with a comment explaining why; (2) add a `testID` to the component. Never use `UNSAFE_getAllByType` — removed in RNTL v14.',
46
+ "- DISABLED TouchableOpacity: fireEvent.press is blocked automatically when disabled={true}",
47
+ "- TEST CASCADE: one failing test can corrupt all later tests due to open act() scope or render crash. Always fix FIRST failure first.",
48
+ ].join('\n');
49
+ }
50
+ export function detectRntlErrors(errorOutput) {
51
+ const lines = [];
52
+ if (/Element type is invalid/i.test(errorOutput) || /expected a string.*but got.*undefined/i.test(errorOutput)) {
53
+ lines.push('CRITICAL: Component import resolved to undefined.', 'Check:', '1. Named vs default import mismatch', '2. Missing exports in barrel files', '3. Mock factories not returning required keys', 'Fix: verify import paths before test assertions.');
54
+ }
55
+ if (/Failed to create a worklet/i.test(errorOutput) || /useSharedValue/i.test(errorOutput) || /Reanimated/i.test(errorOutput)) {
56
+ lines.push('Reanimated not configured for Jest.', "Fix: jest.mock('react-native-reanimated', () => require('react-native-reanimated/mock'));");
57
+ }
58
+ if (/AsyncStorage/i.test(errorOutput)) {
59
+ lines.push('AsyncStorage mock missing.', "Fix: jest.mock('@react-native-async-storage/async-storage', () => require('@react-native-async-storage/async-storage/jest/async-storage-mock'));");
60
+ }
61
+ if (/react-native-gesture-handler/i.test(errorOutput) || /PanGestureHandler/i.test(errorOutput)) {
62
+ lines.push('Gesture Handler missing setup.', "Fix: import 'react-native-gesture-handler' at test setup entry.");
63
+ }
64
+ if (/NativeEventEmitter/i.test(errorOutput)) {
65
+ lines.push('NativeEventEmitter requires a mocked native module.', 'Fix: mock the underlying native module dependency.');
66
+ }
67
+ if (/useRouter/i.test(errorOutput) || /router\.(push|replace|back)/i.test(errorOutput)) {
68
+ lines.push('Expo Router not mocked.', "Fix: jest.mock('expo-router', () => ({ useRouter: () => ({ push: jest.fn(), replace: jest.fn(), back: jest.fn() }) }));");
69
+ }
70
+ if ((/Cannot read properties of undefined/i.test(errorOutput) && /navigate/i.test(errorOutput)) ||
71
+ (/invariant violation/i.test(errorOutput) && /navigation/i.test(errorOutput))) {
72
+ lines.push('React Navigation missing mock.', "Fix: jest.mock('@react-navigation/native', () => ({ useNavigation: () => ({ navigate: jest.fn(), goBack: jest.fn() }) }));");
73
+ }
74
+ if (/render function has not been called/i.test(errorOutput)) {
75
+ lines.push('Render did not complete.', 'Check: (1) render not awaited (2) component threw during render due to missing mock.');
76
+ }
77
+ if (/Nothing was returned from render/i.test(errorOutput)) {
78
+ lines.push('A component mock returned undefined.', 'Fix: replace jest.fn(() => null) with () => null for stateless mocks.');
79
+ }
80
+ return lines.length ? lines.join('\n') : null;
81
+ }
82
+ //# sourceMappingURL=react-native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-native.js","sourceRoot":"","sources":["../../../src/agent/prompts/react-native.ts"],"names":[],"mappings":"AAAA,MAAM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AC1B,sFAAsF,CACvF,CAAA;IACH,CAAC;IAED,IAAI,mCAAmC,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;QAC1D,KAAK,CAAC,IAAI,CACR,sCAAsC,EACtC,uEAAuE,CACxE,CAAA;IACH,CAAC;IAED,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;AAC/C,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function buildReactCauses(isJSRunner: boolean, mockApi: string): string;
2
+ //# sourceMappingURL=react.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../../src/agent/prompts/react.ts"],"names":[],"mappings":"AACA,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CA6C7E"}
@@ -0,0 +1,48 @@
1
+ // React web component testing guidance (non-RN, non-Next.js)
2
+ export function buildReactCauses(isJSRunner, mockApi) {
3
+ if (!isJSRunner)
4
+ return '';
5
+ return `
6
+ - "renders without crashing" tests: NEVER write \`expect(true).toBe(true)\` as a render smoke-test. It proves nothing and will be rejected. Instead, assert on at least one element that must be visible: \`expect(screen.getByText('Some Heading')).toBeTruthy()\` or \`expect(screen.getByTestId('...')).toBeDefined()\`. Read the component's JSX to find a reliable element — a title, a label, a button text.
7
+
8
+ - React 18 act() async rule: ALWAYS await act() when it wraps async code. Unawaited act() calls cause state to leak across tests, producing "Cannot read properties of null" failures in unrelated tests.
9
+
10
+ - Act batching boundary: multiple state updates triggered in the same tick must be wrapped in a single act() block to avoid partial render assertions.
11
+
12
+ - React 18 Strict Mode double-invocation: effects and event handlers may run twice in test environment. Assertions must tolerate idempotent execution or explicitly assert call counts when needed.
13
+
14
+ - Loading state architecture: before asserting a button is disabled during loading, verify whether the element is replaced or unmounted. If unmounted, getByText("Submit") will throw — assert spinner or fallback UI instead.
15
+
16
+ - Unhandled promise rejections: after triggering async actions with mockRejectedValueOnce, always resolve state using waitFor or findBy queries within bounded time to ensure rejection is handled inside test scope.
17
+
18
+ - waitFor safety rule: always provide a timeout (e.g. { timeout: 2000 }). Never allow unbounded waitFor loops in agent-generated tests.
19
+
20
+ - findBy over waitFor: prefer findByRole/findByText/findByLabelText over waitFor(() => getByRole(...)). findBy has built-in timeout, is semantically clearer, and avoids unnecessary waitFor nesting. Use waitFor only when asserting on non-element state (e.g. mock call counts, store updates).
21
+
22
+ - Query hierarchy rule:
23
+ 1. getByRole (preferred)
24
+ 2. getByLabelText
25
+ 3. getByPlaceholderText
26
+ 4. getByText
27
+ 5. getByTestId (last resort)
28
+
29
+ - getByText / getByTestId ambiguity: generic strings and reused components may appear multiple times. Use getAllByText()[0], getByRole, or within(container) scoping.
30
+
31
+ - Functional state updater assertions: when setState uses updater functions (e.g. setPage(p => p + 1)), do not assert raw mock args. Instead extract updater and execute it.
32
+
33
+ - Mock lifecycle rule: prefer mockResolvedValueOnce / mockImplementationOnce for per-test isolation. Always reset mocks in afterEach to prevent leakage.
34
+
35
+ - Test isolation rule: assume global state leakage unless explicitly cleaned.
36
+ - afterEach(() => cleanup())
37
+ - afterEach(() => ${mockApi}.clearAllMocks())
38
+ - afterEach(() => ${mockApi}.useRealTimers() if timers are used)
39
+ - never use shared mutable module-level variables between tests without resetting them in beforeEach/afterEach — tests must not depend on mutations from a previous test.
40
+
41
+ - Timer determinism: when using fake timers (${mockApi}.useFakeTimers()), always advance explicitly with ${mockApi}.advanceTimersByTime(ms) — never rely on real delays or setTimeout chains. Always restore with ${mockApi}.useRealTimers() in afterEach; fake timers that leak between tests cause unrelated tests to hang or fire callbacks at wrong times.
42
+
43
+ - Infinite retry guard: never generate recursive waitFor → trigger → waitFor chains. If a condition does not resolve within a single waitFor block, fail explicitly.
44
+
45
+ - React 18 act() flush rule: wrap async mock resolutions in await act(async () => {}) before test exit to flush pending updates.
46
+ `;
47
+ }
48
+ //# sourceMappingURL=react.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.js","sourceRoot":"","sources":["../../../src/agent/prompts/react.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,MAAM,UAAU,gBAAgB,CAAC,UAAmB,EAAE,OAAe;IACnE,IAAI,CAAC,UAAU;QAAE,OAAO,EAAE,CAAA;IAE1B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAgCiB,OAAO;0BACP,OAAO;;;mDAGkB,OAAO,qDAAqD,OAAO,kGAAkG,OAAO;;;;;CAK9N,CAAA;AACD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function buildJsCauses(mockApi: string): string;
2
+ //# sourceMappingURL=js-common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"js-common.d.ts","sourceRoot":"","sources":["../../../../src/agent/prompts/runners/js-common.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAWrD"}
@@ -0,0 +1,13 @@
1
+ export function buildJsCauses(mockApi) {
2
+ return `
3
+ - NEVER write require() anywhere in test files — @typescript-eslint/no-require-imports flags it everywhere, including inside test() and beforeEach() callbacks. Use ES import statements instead. To access real module values inside ${mockApi}.mock() factories, use ${mockApi}.requireActual() — it is a method on the ${mockApi} global (always in scope) and is never flagged.
4
+ - FILE STRUCTURE — strict ordering to avoid import/first ESLint errors: (1) ALL import statements at the very top; (2) ALL ${mockApi}.mock() calls below all imports; (3) test code (describe/it/beforeEach). NEVER add an import statement after any ${mockApi}.mock() call — this triggers import/first even if earlier imports exist. Plan all imports before writing any mock call.
5
+ - ${mockApi}.mock() FACTORY SCOPE — the test framework hoists ALL ${mockApi}.mock() calls before any import statement. Two consequences: (a) imported bindings (React, View, any named import) are NOT in scope — referencing them throws ReferenceError; (b) module-scope variables — EVEN mock-prefixed ones like \`const MockTabs = ${mockApi}.fn()\` — are NOT hoisted. They pass the compiler's error check, but because the factory fires during the import phase (before module-scope declarations run), they are still undefined when the factory executes. WRONG: \`const MockTabs = ${mockApi}.fn(); ${mockApi}.mock('expo-router', () => ({ Tabs: MockTabs }))\` — MockTabs is undefined at factory time. RIGHT approach — self-contained factories: define every mock function as a local variable INSIDE the factory body using ${mockApi}.fn() (a global, always in scope). Access the same instances from tests via ${mockApi}.mocked() on the static import — after hoisting, the static import resolves to the factory's mock: \`import { Tabs } from 'expo-router'; ${mockApi}.mock('expo-router', () => { const Tabs = ${mockApi}.fn(() => null); Tabs.Screen = ${mockApi}.fn(() => null); return { Tabs }; }); const mockTabs = ${mockApi}.mocked(Tabs); beforeEach(() => { mockTabs.mockImplementation(...); });\` For namespaced mocks (e.g. Tabs.Screen): assign sub-properties inside the factory, not from outside. For accessing real module internals: use ${mockApi}.requireActual() — \`${mockApi}\` is always in scope inside a factory.
6
+ - Component mocks: NEVER use React.createElement() or JSX inside a ${mockApi}.mock() factory — React is an imported binding and is not in scope when the factory runs (throws ReferenceError or "Invalid variable access" — not React Native specific, ANY imported binding fails the same way). Mock components as \`${mockApi}.fn(() => null)\` instead. If the test genuinely needs a testID or rendered text from the mock, use ${mockApi}.requireActual() to pull in React inside the factory: \`${mockApi}.fn(({ value }) => { const React = ${mockApi}.requireActual('react'); const { View } = ${mockApi}.requireActual('react-native'); return React.createElement(View, { testID: 'my-component' }); })\`.
7
+ - clearAllMocks() wipes ALL ${mockApi}.fn() implementations, including those created inside ${mockApi}.mock() factories. After the first test's afterEach, any ${mockApi}.fn() in a factory has no implementation and returns undefined — causing "Nothing was returned from render". Fix: re-apply implementations in beforeEach using ${mockApi}.mocked() — declare \`const mockFn = ${mockApi}.mocked(importedFn)\` at module scope (after the ${mockApi}.mock() call), then call mockFn.mockImplementation(...) in beforeEach. Note: clearAllMocks() does NOT delete object properties (e.g. Tabs.Screen still exists after clear — only its implementation is gone).
8
+ - ${mockApi}.mock() paths are relative to the TEST FILE, not the source file. Count directories from the test file's location, not the source file's.
9
+ - Missing mock is the silent killer: if expect(mockFn).toHaveBeenCalled() fails but the code path is clearly reached, the mock declaration is missing or uses the wrong path. The real implementation ran instead.
10
+ - Response envelope mismatch (silent empty state): if a hook guards \`if (res.success)\` or destructures \`{ success, data }\`, mocking with a raw array means .success is undefined and state is never populated — silently. Trace each call site individually — different clients in the same hook often have different shapes (one returns \`{ data: [] }\`, another \`{ success, data: { items: [] } }\` with nested access). Never assume a uniform envelope across the whole hook.
11
+ - Barrel file mock miss: mocking a barrel/index file (${mockApi}.mock('../components')) will NOT intercept imports of the direct file ('../components/Foo'). Mock the specific module the source actually imports.`;
12
+ }
13
+ //# sourceMappingURL=js-common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"js-common.js","sourceRoot":"","sources":["../../../../src/agent/prompts/runners/js-common.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,aAAa,CAAC,OAAe;IAC3C,OAAO;wOAC+N,OAAO,0BAA0B,OAAO,4CAA4C,OAAO;6HACtM,OAAO,oHAAoH,OAAO;IAC3P,OAAO,yDAAyD,OAAO,8PAA8P,OAAO,gPAAgP,OAAO,UAAU,OAAO,uNAAuN,OAAO,+EAA+E,OAAO,4IAA4I,OAAO,6CAA6C,OAAO,kCAAkC,OAAO,0DAA0D,OAAO,2NAA2N,OAAO,wBAAwB,OAAO;qEACz3C,OAAO,4OAA4O,OAAO,uGAAuG,OAAO,2DAA2D,OAAO,sCAAsC,OAAO,6CAA6C,OAAO;8BACljB,OAAO,yDAAyD,OAAO,4DAA4D,OAAO,kKAAkK,OAAO,wCAAwC,OAAO,oDAAoD,OAAO;IACvb,OAAO;;;wDAG6C,OAAO,oJAAoJ,CAAA;AACnN,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function buildTsRule(mockApi: string): string;
2
+ //# sourceMappingURL=typescript.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../../../src/agent/prompts/runners/typescript.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAUnD"}
@@ -0,0 +1,12 @@
1
+ export function buildTsRule(mockApi) {
2
+ return `
3
+ 9. TypeScript type safety: all test code must compile without type errors. The TypeScript compiler is the authority — its error messages are exact instructions, not hints.
4
+ - Use EXACT property/member names from the TYPE DEFINITIONS section and source code. Do not apply naming conventions: if a hook returns { loading, users }, do NOT write isLoading or isUsers.
5
+ - Import enums, constants, interfaces, and types from the project's existing files. Do NOT redeclare them inline or invent lookalike values.
6
+ - Never use "as any", "@ts-ignore", or "@ts-expect-error" to suppress type errors.
7
+ - For ${mockApi}.fn(), either let TypeScript infer the type from context or type it explicitly: ${mockApi}.fn<Parameters<typeof fn>, ReturnType<typeof fn>>().
8
+ - Use ReturnType<>, Parameters<>, and other utility types to derive mock types from real function signatures.
9
+ - When accessing optional properties, handle null/undefined correctly.
10
+ - Array types: always use T[] syntax, never Array<T> — @typescript-eslint/array-type will flag the generic form. For inline object arrays use \`{ field: type }[]\` not \`Array<{ field: type }>\`.`;
11
+ }
12
+ //# sourceMappingURL=typescript.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typescript.js","sourceRoot":"","sources":["../../../../src/agent/prompts/runners/typescript.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,WAAW,CAAC,OAAe;IACzC,OAAO;;;;;WAKE,OAAO,mFAAmF,OAAO;;;uMAG2F,CAAA;AACvM,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function buildVitestCauses(): string;
2
+ //# sourceMappingURL=vitest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vitest.d.ts","sourceRoot":"","sources":["../../../../src/agent/prompts/runners/vitest.ts"],"names":[],"mappings":"AAAA,wBAAgB,iBAAiB,IAAI,MAAM,CAqB1C"}
@@ -0,0 +1,23 @@
1
+ export function buildVitestCauses() {
2
+ return `
3
+ - Never use require() in Vitest: Vitest runs files as ESM — dynamic require() fails at transform time. Always use static ES import + vi.mocked().
4
+ - vi.mock() ORDERING: write all import statements first, then vi.mock() calls after them. Vitest hoists vi.mock() at runtime, but ESLint's import/first rule errors if vi.mock() appears before any import in the source. WRONG: \`vi.mock(...); import React from 'react'\` — RIGHT: \`import React from 'react'; ... vi.mock(...)\`
5
+ - Shared mock file factory syntax: \`vi.mock('../service', async () => await import('../../test/mocks'))\` — synchronous factory cannot import external files in Vitest.
6
+ - vi.hoisted() for shared mock references: when a mock object is created inside vi.mock() AND configured in beforeEach, use vi.hoisted() so both closures reference the same object instance. CONSTRUCTABLE MOCK PATTERN: if the source calls \`new Module()\` (especially at module scope in the imported file, e.g. \`const resend = new Resend(key)\`), the vi.mock() factory must return something constructable. Arrow functions are NOT constructable — \`new (() => {})()\` throws "not a constructor". Use vi.hoisted() to define the mock outside the factory, then use a regular function expression (not an arrow function) in mockImplementation: \`const MockResend = vi.hoisted(() => vi.fn().mockImplementation(function() { return { emails: { send: mockSend } }; }))\` — regular function expressions ARE constructable with \`new\`. Then reference MockResend inside the vi.mock() factory.
7
+ - Complete hook self-replacement for *.client-importing hooks: when a hook imports *.client services that chain into browser/server-only modules, mock the entire hook — \`vi.mock('../useMyHook', () => ({ useMyHook: vi.fn() }))\` — rather than each sub-dependency.
8
+ - server-only resolution in Next.js: \`Failed to resolve import "server-only"\` is a config issue, not a test issue. Add an alias in vitest.config.ts: \`'server-only': path.resolve(__dirname, './test/empty-module.ts')\` and create that file with \`export default {}\`.
9
+ - Top-level await (TS1378): NEVER use \`await\` at the top level of a test file. Every \`await\` must be inside an async callback: \`it("...", async () => { ... })\`.
10
+ - NEVER call vi.spyOn(global, ...) or vi.spyOn(globalThis, ...) at module level (outside beforeEach/beforeAll). Each Vitest file has its own vi registry. A module-level spy is installed on the shared worker globalThis but setup-file afterEach cleanup (vi.restoreAllMocks) uses a different vi instance and cannot remove it — the spy persists after the file ends and poisons the next file that runs in the same worker. Always create global spies inside beforeEach so they are fresh per test and properly cleaned up:
11
+ WRONG: const mockFetch = vi.spyOn(global, 'fetch'); // module level — breaks other files
12
+ RIGHT: let mockFetch: ReturnType<typeof vi.spyOn>;
13
+ beforeEach(() => { mockFetch = vi.spyOn(global, 'fetch'); });
14
+ - Never write two vi.mock() calls for the same module path in the same file. The second call silently overrides the first — exports from the first mock are lost. If a module exports many things (e.g. lucide-react icons), list them all in a single vi.mock() factory:
15
+ WRONG: vi.mock('lucide-react', () => ({ Search: () => null })) ...later... vi.mock('lucide-react', () => ({ Plus: () => null }))
16
+ RIGHT: vi.mock('lucide-react', () => ({ Search: () => null, Plus: () => null }))
17
+ - vi.resetAllMocks() vs vi.clearAllMocks() — use the right one or tests break under shuffle:
18
+ clearAllMocks() only wipes call history (mock.calls, mock.results). It does NOT reset mockReturnValue / mockResolvedValue / mockImplementation.
19
+ resetAllMocks() wipes call history AND resets all implementations back to undefined.
20
+ RULE: if ANY test in the file calls mockFn.mockImplementation(...) directly (e.g. a loading-state test that uses \`() => new Promise(() => {})\` to freeze async), the beforeEach MUST use vi.resetAllMocks() — otherwise that implementation bleeds into the next test when run in shuffle order, and mockResolvedValue set in beforeEach is silently overridden by the stale mockImplementation.
21
+ PATTERN: loading-state test sets mockImplementation → test passes → shuffle puts it before the success-state test → success test's beforeEach calls clearAllMocks (history wiped, implementation NOT wiped) → mockResolvedValue set in beforeEach loses to the stale never-resolving implementation → success test gets 0 instead of expected data.`;
22
+ }
23
+ //# sourceMappingURL=vitest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vitest.js","sourceRoot":"","sources":["../../../../src/agent/prompts/runners/vitest.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,iBAAiB;IAC/B,OAAO;;;;;;;;;;;;;;;;;;;sVAmB6U,CAAA;AACtV,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare function detectVue(packageDeps: string | null): boolean;
2
+ export declare function buildVueGuidance(): string;
3
+ //# sourceMappingURL=vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vue.d.ts","sourceRoot":"","sources":["../../../src/agent/prompts/vue.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAG7D;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAgCzC"}
@@ -0,0 +1,29 @@
1
+ export function detectVue(packageDeps) {
2
+ if (!packageDeps)
3
+ return false;
4
+ return /\bvue\b/.test(packageDeps);
5
+ }
6
+ export function buildVueGuidance() {
7
+ return [
8
+ 'VUE PROJECT — use @testing-library/vue for component tests.',
9
+ "Import render, screen, fireEvent, waitFor from '@testing-library/vue'",
10
+ "Import userEvent from '@testing-library/user-event'",
11
+ 'Prefer screen queries over container.querySelector().',
12
+ 'Prefer getByRole() when possible.',
13
+ 'Vue DOM updates are asynchronous.',
14
+ 'After state-changing interactions, use waitFor() before asserting updated UI.',
15
+ 'Never perform user interactions inside waitFor().',
16
+ 'Never call fireEvent() inside waitFor().',
17
+ 'Never call userEvent actions inside waitFor().',
18
+ 'waitFor() callbacks must contain assertions only.',
19
+ 'Use findBy* queries when waiting for asynchronous UI.',
20
+ 'Use nextTick() only when Vue reactivity flushing must be awaited.',
21
+ 'Mock network requests and browser APIs.',
22
+ 'Do not perform real HTTP requests.',
23
+ 'Mock vue-router when testing isolated components.',
24
+ 'Mock Pinia stores when testing isolated components.',
25
+ 'Prefer jest.advanceTimersByTime() over runAllTimers() when fake timers are used.',
26
+ 'Avoid unnecessary cleanup() calls.',
27
+ ].join('\n');
28
+ }
29
+ //# sourceMappingURL=vue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vue.js","sourceRoot":"","sources":["../../../src/agent/prompts/vue.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,SAAS,CAAC,WAA0B;IAClD,IAAI,CAAC,WAAW;QAAE,OAAO,KAAK,CAAA;IAC9B,OAAO,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;AACpC,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,OAAO;QACL,6DAA6D;QAE7D,uEAAuE;QACvE,qDAAqD;QAErD,uDAAuD;QACvD,mCAAmC;QAEnC,mCAAmC;QACnC,+EAA+E;QAE/E,mDAAmD;QACnD,0CAA0C;QAC1C,gDAAgD;QAChD,mDAAmD;QAEnD,uDAAuD;QAEvD,mEAAmE;QAEnE,yCAAyC;QACzC,oCAAoC;QAEpC,mDAAmD;QACnD,qDAAqD;QAErD,kFAAkF;QAElF,oCAAoC;KACrC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACd,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"analyze.d.ts","sourceRoot":"","sources":["../../src/commands/analyze.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAS,MAAM,aAAa,CAAA;AAW5C,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,OAAO;IAC1C,MAAM,CAAC,WAAW,SAA+D;IAEjF,MAAM,CAAC,QAAQ,WAKd;IAED,MAAM,CAAC,KAAK;;;;;MAoBX;IAEK,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAyH3B"}
1
+ {"version":3,"file":"analyze.d.ts","sourceRoot":"","sources":["../../src/commands/analyze.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAS,MAAM,aAAa,CAAA;AAc5C,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,OAAO;IAC1C,MAAM,CAAC,WAAW,SAA+D;IAEjF,MAAM,CAAC,QAAQ,WAKd;IAED,MAAM,CAAC,KAAK;;;;;MAoBX;IAEK,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAoI3B"}