@codeyam/codeyam-cli 0.1.28 → 0.1.30

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 (109) hide show
  1. package/analyzer-template/.build-info.json +6 -6
  2. package/analyzer-template/log.txt +3 -3
  3. package/analyzer-template/package.json +2 -2
  4. package/analyzer-template/packages/aws/package.json +5 -5
  5. package/analyzer-template/packages/database/package.json +1 -1
  6. package/codeyam-cli/src/commands/__tests__/init.gitignore.test.js +38 -3
  7. package/codeyam-cli/src/commands/__tests__/init.gitignore.test.js.map +1 -1
  8. package/codeyam-cli/src/commands/editor.js +307 -5
  9. package/codeyam-cli/src/commands/editor.js.map +1 -1
  10. package/codeyam-cli/src/commands/init.js +19 -0
  11. package/codeyam-cli/src/commands/init.js.map +1 -1
  12. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js +136 -0
  13. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js.map +1 -1
  14. package/codeyam-cli/src/utils/__tests__/editorProxySession.test.js +98 -1
  15. package/codeyam-cli/src/utils/__tests__/editorProxySession.test.js.map +1 -1
  16. package/codeyam-cli/src/utils/__tests__/editorRoadmap.test.js +398 -0
  17. package/codeyam-cli/src/utils/__tests__/editorRoadmap.test.js.map +1 -0
  18. package/codeyam-cli/src/utils/designSystemShowcase.js +810 -0
  19. package/codeyam-cli/src/utils/designSystemShowcase.js.map +1 -0
  20. package/codeyam-cli/src/utils/editorAudit.js +6 -1
  21. package/codeyam-cli/src/utils/editorAudit.js.map +1 -1
  22. package/codeyam-cli/src/utils/editorRoadmap.js +301 -0
  23. package/codeyam-cli/src/utils/editorRoadmap.js.map +1 -0
  24. package/codeyam-cli/src/utils/editorScenarios.js +10 -0
  25. package/codeyam-cli/src/utils/editorScenarios.js.map +1 -1
  26. package/codeyam-cli/src/utils/install-skills.js +27 -6
  27. package/codeyam-cli/src/utils/install-skills.js.map +1 -1
  28. package/codeyam-cli/src/webserver/__tests__/api.interactive-switch-scenario.test.js +1 -0
  29. package/codeyam-cli/src/webserver/__tests__/api.interactive-switch-scenario.test.js.map +1 -1
  30. package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js +115 -0
  31. package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js.map +1 -1
  32. package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
  33. package/codeyam-cli/src/webserver/build/client/assets/{CopyButton-CLe80MMu.js → CopyButton-DTBZZfSk.js} +1 -1
  34. package/codeyam-cli/src/webserver/build/client/assets/{EntityItem-Crt_KN_U.js → EntityItem-BxclONWq.js} +1 -1
  35. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-CD7lGABo.js → EntityTypeIcon-BsnEOJZ_.js} +1 -1
  36. package/codeyam-cli/src/webserver/build/client/assets/{InlineSpinner-CgTNOhnu.js → InlineSpinner-ByaELMbv.js} +1 -1
  37. package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-DtYTSPL2.js → InteractivePreview-6WjVfhxX.js} +2 -2
  38. package/codeyam-cli/src/webserver/build/client/assets/{LibraryFunctionPreview-D3s1MFkb.js → LibraryFunctionPreview-ChX-Hp7W.js} +1 -1
  39. package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-CM5zg40N.js → LogViewer-C-9zQdXg.js} +1 -1
  40. package/codeyam-cli/src/webserver/build/client/assets/{MiniClaudeChat-CQENLSrF.js → MiniClaudeChat-BusrvT2F.js} +1 -1
  41. package/codeyam-cli/src/webserver/build/client/assets/{ReportIssueModal-C2PLkej3.js → ReportIssueModal-DQsceHVv.js} +1 -1
  42. package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-DanvyBPb.js → SafeScreenshot-DThcm_9M.js} +1 -1
  43. package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-CefgqbCr.js → ScenarioViewer-Cl4oOA3A.js} +1 -1
  44. package/codeyam-cli/src/webserver/build/client/assets/{Spinner-Bc8BG-Lw.js → Spinner-CIil5-gb.js} +1 -1
  45. package/codeyam-cli/src/webserver/build/client/assets/{ViewportInspectBar-BA_Ry-rs.js → ViewportInspectBar-BqkA9zyZ.js} +1 -1
  46. package/codeyam-cli/src/webserver/build/client/assets/{_index-C1YkzTAV.js → _index-DnOgyseQ.js} +1 -1
  47. package/codeyam-cli/src/webserver/build/client/assets/{activity.(_tab)-yH46LLUz.js → activity.(_tab)-DqM9hbNE.js} +1 -1
  48. package/codeyam-cli/src/webserver/build/client/assets/{addon-web-links-CHx25PAe.js → addon-web-links-C58dYPwR.js} +1 -1
  49. package/codeyam-cli/src/webserver/build/client/assets/{agent-transcripts-Bg3e7q4S.js → agent-transcripts-B8NCeOrm.js} +1 -1
  50. package/codeyam-cli/src/webserver/build/client/assets/api.editor-roadmap-l0sNRNKZ.js +1 -0
  51. package/codeyam-cli/src/webserver/build/client/assets/{book-open-CL-lMgHh.js → book-open-BFSIqZgO.js} +1 -1
  52. package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-GmAjGS9-.js → chevron-down-B9fDzFVh.js} +1 -1
  53. package/codeyam-cli/src/webserver/build/client/assets/chunk-UVKPFVEO-Bmq2apuh.js +43 -0
  54. package/codeyam-cli/src/webserver/build/client/assets/{circle-check-DFcQkN5j.js → circle-check-DLPObLUx.js} +1 -1
  55. package/codeyam-cli/src/webserver/build/client/assets/{copy-C6iF61Xs.js → copy-DXEmO0TD.js} +1 -1
  56. package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-4ImjHTVC.js → createLucideIcon-BwyFiRot.js} +1 -1
  57. package/codeyam-cli/src/webserver/build/client/assets/{dev.empty-CRepiabR.js → dev.empty-iRhRIFlp.js} +1 -1
  58. package/codeyam-cli/src/webserver/build/client/assets/editor._tab-BZPBzV73.js +1 -0
  59. package/codeyam-cli/src/webserver/build/client/assets/editor.entity.(_sha)-CsYVRiNH.js +147 -0
  60. package/codeyam-cli/src/webserver/build/client/assets/{editorPreview-CluPkvXJ.js → editorPreview-C6fEYHrh.js} +6 -6
  61. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-DYJRGiDI.js → entity._sha._-Ce1s4OQ1.js} +1 -1
  62. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha.scenarios._scenarioId.dev-wdiwx5-Z.js → entity._sha.scenarios._scenarioId.dev-C8AyYgYT.js} +1 -1
  63. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha.scenarios._scenarioId.fullscreen-BrkN-40Y.js → entity._sha.scenarios._scenarioId.fullscreen-DziaVQX1.js} +1 -1
  64. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.create-scenario-DxfhekTZ.js → entity._sha_.create-scenario-BTcpgIpC.js} +1 -1
  65. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-CRXJWmpB.js → entity._sha_.edit._scenarioId-D_O_ajfZ.js} +1 -1
  66. package/codeyam-cli/src/webserver/build/client/assets/{entry.client-SuW9syRS.js → entry.client-j1Vi0bco.js} +6 -6
  67. package/codeyam-cli/src/webserver/build/client/assets/{files-D-xGrg29.js → files-kuny2Q_s.js} +1 -1
  68. package/codeyam-cli/src/webserver/build/client/assets/{git-Bq_fbXP5.js → git-DgCZPMie.js} +1 -1
  69. package/codeyam-cli/src/webserver/build/client/assets/globals-Gp2o-NMc.css +1 -0
  70. package/codeyam-cli/src/webserver/build/client/assets/{index-Bp1l4hSv.js → index-BliGSSpl.js} +1 -1
  71. package/codeyam-cli/src/webserver/build/client/assets/{index-DE3jI_dv.js → index-SqjQKTdH.js} +1 -1
  72. package/codeyam-cli/src/webserver/build/client/assets/{index-CWV9XZiG.js → index-vyrZD2g4.js} +1 -1
  73. package/codeyam-cli/src/webserver/build/client/assets/{labs-B_IX45ih.js → labs-c3yLxSEp.js} +1 -1
  74. package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-De-7qQ2u.js → loader-circle-D-q28GLF.js} +1 -1
  75. package/codeyam-cli/src/webserver/build/client/assets/manifest-ef0f624d.js +1 -0
  76. package/codeyam-cli/src/webserver/build/client/assets/{memory-Cx2xEx7s.js → memory-CEWIUC4t.js} +1 -1
  77. package/codeyam-cli/src/webserver/build/client/assets/{pause-CFxEKL1u.js → pause-BP6fitdh.js} +1 -1
  78. package/codeyam-cli/src/webserver/build/client/assets/{root-dKFRTYcy.js → root-Didv9PLi.js} +5 -5
  79. package/codeyam-cli/src/webserver/build/client/assets/{search-BdBb5aqc.js → search-BooqacKS.js} +1 -1
  80. package/codeyam-cli/src/webserver/build/client/assets/{settings-DdE-Untf.js → settings-BM0nbryO.js} +1 -1
  81. package/codeyam-cli/src/webserver/build/client/assets/{simulations-DSCdE99u.js → simulations-ovy6FjRY.js} +1 -1
  82. package/codeyam-cli/src/webserver/build/client/assets/{terminal-CrplD4b1.js → terminal-DHemCJIs.js} +1 -1
  83. package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-DqJ0j69l.js → triangle-alert-D87ekDl8.js} +1 -1
  84. package/codeyam-cli/src/webserver/build/client/assets/{useCustomSizes-DhXHbEjP.js → useCustomSizes-Dk0Tciqg.js} +1 -1
  85. package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-D9QZKaLJ.js → useLastLogLine-C8QvIe05.js} +1 -1
  86. package/codeyam-cli/src/webserver/build/client/assets/{useReportContext-Cy5Qg_UR.js → useReportContext-jkCytuYz.js} +1 -1
  87. package/codeyam-cli/src/webserver/build/client/assets/{useToast-5HR2j9ZE.js → useToast-BgqkixU9.js} +1 -1
  88. package/codeyam-cli/src/webserver/build/server/assets/{analysisRunner-OLsM110H.js → analysisRunner-BKMsxwqe.js} +1 -1
  89. package/codeyam-cli/src/webserver/build/server/assets/{index-WHdB6WTN.js → index-CvuvIPEn.js} +1 -1
  90. package/codeyam-cli/src/webserver/build/server/assets/init-B3gVLAAJ.js +14 -0
  91. package/codeyam-cli/src/webserver/build/server/assets/{server-build-DZbLY6O_.js → server-build-B4LxStYP.js} +183 -132
  92. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  93. package/codeyam-cli/src/webserver/build-info.json +5 -5
  94. package/codeyam-cli/src/webserver/editorProxy.js +77 -4
  95. package/codeyam-cli/src/webserver/editorProxy.js.map +1 -1
  96. package/codeyam-cli/src/webserver/server.js +67 -0
  97. package/codeyam-cli/src/webserver/server.js.map +1 -1
  98. package/codeyam-cli/src/webserver/terminalServer.js +21 -0
  99. package/codeyam-cli/src/webserver/terminalServer.js.map +1 -1
  100. package/codeyam-cli/templates/codeyam-editor-gemini.md +59 -0
  101. package/codeyam-cli/templates/editor-step-hook.py +4 -4
  102. package/codeyam-cli/templates/seed-adapters/supabase.ts +42 -53
  103. package/package.json +1 -1
  104. package/codeyam-cli/src/webserver/build/client/assets/chunk-JZWAC4HX-BAdwhyCx.js +0 -43
  105. package/codeyam-cli/src/webserver/build/client/assets/editor._tab-Gbk_i5Js.js +0 -1
  106. package/codeyam-cli/src/webserver/build/client/assets/editor.entity.(_sha)-CRxPi2BB.js +0 -96
  107. package/codeyam-cli/src/webserver/build/client/assets/globals-BsGHu8WX.css +0 -1
  108. package/codeyam-cli/src/webserver/build/client/assets/manifest-9032538f.js +0 -1
  109. package/codeyam-cli/src/webserver/build/server/assets/init-DbSiZoE6.js +0 -10
@@ -0,0 +1,59 @@
1
+ # CodeYam Editor Project (Gemini)
2
+
3
+ This project is being built with CodeYam's Code + Data Editor. The core principle is **code and data are developed together** — every component should have scenario data that drives what it renders.
4
+
5
+ ## Architecture: Components + Scenarios
6
+
7
+ ### Component Structure
8
+
9
+ Build with a clear component hierarchy so individual components can be previewed in isolation:
10
+
11
+ ```
12
+ app/
13
+ components/
14
+ Dashboard.tsx ← page-level component
15
+ TaskList.tsx ← displays a list, gets data from API or props
16
+ TaskCard.tsx ← single item, pure props
17
+ EmptyState.tsx ← shown when no data
18
+ ```
19
+
20
+ ### Scenarios
21
+
22
+ A **scenario** is a named set of data that drives how the app renders. Scenarios exist at two levels:
23
+
24
+ - **App-level scenarios**: Full application state.
25
+ - **Component-level scenarios**: Props for a single component in isolation.
26
+
27
+ **Always register scenarios with CodeYam** using the CLI:
28
+
29
+ ```bash
30
+ codeyam editor register @.codeyam/tmp/scenario.json
31
+ ```
32
+
33
+ **To list existing scenarios:** `codeyam editor scenarios`
34
+
35
+ ## Workflow
36
+
37
+ 1. Build a component
38
+ 2. Create scenarios with rich, realistic data.
39
+ 3. Register the scenarios with CodeYam.
40
+ 4. Preview each scenario to verify the component handles all states.
41
+ 5. Repeat for the next component.
42
+
43
+ ## Key Conventions
44
+
45
+ - Component files go in `app/components/` (or `src/components/`)
46
+ - One component per file, default export.
47
+ - Components accept props that can be provided by scenarios.
48
+
49
+ ## AI Handoff
50
+
51
+ Since you are working in an AI-assisted workflow, you must maintain a handoff summary for other AI agents (or yourself in a later session).
52
+
53
+ **At the end of every step, update the handoff summary:**
54
+
55
+ ```bash
56
+ codeyam editor handoff '{"summary": "Built the X component and registered 3 scenarios. Ready to start on Y."}'
57
+ ```
58
+
59
+ This summary will be displayed when starting a new session or switching between AI providers (Claude <-> Gemini).
@@ -40,8 +40,8 @@ STEP_RESTRICTIONS = {
40
40
  3: "Do NOT create scenarios or run codeyam analyze. Build fast — working prototype with real data.",
41
41
  4: "Verify the prototype works. Do NOT add features — only fix broken functionality.",
42
42
  5: "Present a selection menu (AskUserQuestion) for confirmation. Do NOT refactor or create scenarios until approved.",
43
- 6: "Do NOT write any code. Read every file, identify all extractable pieces, write a numbered plan. Planning only.",
44
- 7: "Execute the extraction plan from step 6. Components first (no tests), then library functions via TDD. Page files must contain ZERO direct JSX.",
43
+ 6: "Do NOT write any code. Read every file, identify all extractable pieces, write a numbered plan. Planning only. Every opportunity to extract code into a function, helper, or sub-component MUST be taken. Then plan to extract from the extracted code until each piece does one clearly defined thing.",
44
+ 7: "Execute the extraction plan from step 6. Components first (no tests), then library functions via TDD. Page files must contain ZERO direct JSX. After extraction: re-read every file — extract further until each piece does one thing. Verify every test file covers all conditional branches.",
45
45
  8: "Do NOT write application code or scenarios. Update the glossary only.",
46
46
  9: "Create isolation routes for visual components, run tests for library functions. Register component scenarios via codeyam editor register.",
47
47
  10: "Do NOT modify application code. Create and register app-level scenarios only.",
@@ -52,7 +52,7 @@ STEP_RESTRICTIONS = {
52
52
  15: "Show the results panel, present summary, then selection menu (AskUserQuestion): Save or make changes.",
53
53
  16: "Hide the results panel and commit all changes. Do NOT push — that happens in step 18.",
54
54
  17: "Update the journal entry with the commit SHA and amend the commit to include the journal update.",
55
- 18: "Check for a git remote and offer to push. WAIT for the user's answer before starting the next feature.",
55
+ 18: "Check for a git remote and offer to push. After push (or skip), call the feature-complete API and STOP.",
56
56
  }
57
57
 
58
58
  MIGRATION_STEP_LABELS = {
@@ -212,7 +212,7 @@ def main():
212
212
  next_cmd = f"codeyam editor migrate {step + 1}" if step < 10 else "codeyam editor migrate next"
213
213
  else:
214
214
  restriction = STEP_RESTRICTIONS.get(step, "")
215
- next_cmd = f"codeyam editor {step + 1}" if step < 18 else "codeyam editor 1"
215
+ next_cmd = f"codeyam editor {step + 1}" if step < 18 else "(feature complete — UI handles transition)"
216
216
 
217
217
  # UserPromptSubmit: concise workflow reminder injected before Claude processes the user's message
218
218
  if event_type == "user_prompt":
@@ -10,16 +10,19 @@
10
10
  * "tableName": [{ "column": "value", ... }, ...],
11
11
  * "_auth": { // optional
12
12
  * "email": "alice@example.com",
13
- * "password": "test123"
13
+ * "password": "test123" // optional — default used if omitted
14
14
  * }
15
15
  * }
16
16
  *
17
17
  * When _auth is present, the adapter:
18
18
  * 1. Creates the user if they don't exist (auto-confirms email)
19
- * 2. Signs in with signInWithPassword to get a valid session
20
- * 3. Writes session cookies to .codeyam/tmp/seed-session.json
19
+ * 2. Builds a synthetic JWT with far-future expiry (no real sign-in needed)
20
+ * 3. Writes session cookies + auth mocks to .codeyam/tmp/seed-session.json
21
21
  * so the CodeYam proxy can inject them into the browser
22
22
  *
23
+ * The password field is optional — if omitted, a default dev password is used.
24
+ * No real JWTs are stored; the preload module intercepts all auth API calls.
25
+ *
23
26
  * Requirements:
24
27
  * - A Supabase project URL (https://<ref>.supabase.co) in any env var
25
28
  * - A secret key (sb_secret_... or legacy eyJ... service_role JWT) in any env var
@@ -66,7 +69,6 @@ const supabaseUrl = findAllEnvByPattern(
66
69
 
67
70
  // New-format keys are unambiguous by prefix
68
71
  const newSecretKey = findAllEnvByPattern(/^sb_secret_/)[0];
69
- const newAnonKey = findAllEnvByPattern(/^sb_publishable_/)[0];
70
72
 
71
73
  // Legacy JWT keys — disambiguate by decoding the role claim
72
74
  const legacyJwts = findAllEnvByPattern(
@@ -75,10 +77,8 @@ const legacyJwts = findAllEnvByPattern(
75
77
  const legacyServiceRole = legacyJwts.find(
76
78
  (jwt) => getJwtRole(jwt) === 'service_role',
77
79
  );
78
- const legacyAnon = legacyJwts.find((jwt) => getJwtRole(jwt) === 'anon');
79
80
 
80
81
  const secretKey = newSecretKey || legacyServiceRole;
81
- const anonKey = newAnonKey || legacyAnon;
82
82
 
83
83
  if (!supabaseUrl || !secretKey) {
84
84
  console.error(
@@ -210,17 +210,25 @@ function buildUserResponse(user: { id: string; email?: string }) {
210
210
  };
211
211
  }
212
212
 
213
+ const DEFAULT_AUTH_PASSWORD = 'codeyam-dev-password-123!';
214
+
213
215
  /**
214
- * Handle auth: create user, sign in, write session cookies.
216
+ * Handle auth: create user, build synthetic session, write session cookies.
215
217
  * Returns the user ID so callers can replace __AUTH_USER_ID__ placeholders in seed data.
218
+ *
219
+ * No real sign-in is performed — the session cookie uses a synthetic JWT with
220
+ * far-future expiry, and externalApis mocks intercept all Supabase auth API calls.
221
+ * This avoids storing real tokens (security risk + expiration) in scenario files.
216
222
  */
217
223
  async function handleAuth(auth: {
218
224
  email: string;
219
- password: string;
225
+ password?: string;
220
226
  }): Promise<string> {
221
- const { email, password } = auth;
227
+ const email = auth.email;
228
+ const password = auth.password || DEFAULT_AUTH_PASSWORD;
222
229
 
223
- // Create user if they don't exist (auto-confirm email so sign-in works)
230
+ // Create user if they don't exist (auto-confirm email)
231
+ // We still need the auth.users row for PostgREST FK relationships.
224
232
  const { data: createData, error: createError } =
225
233
  await supabase.auth.admin.createUser({
226
234
  email,
@@ -228,52 +236,36 @@ async function handleAuth(auth: {
228
236
  email_confirm: true,
229
237
  });
230
238
 
239
+ let userId: string;
240
+
231
241
  if (createError) {
232
242
  if (createError.message.includes('already been registered')) {
233
- // User exists — update their password so sign-in works even if the
234
- // scenario specifies a different password than a previous run.
243
+ // User exists — look up their ID
235
244
  const { data: listData } = await supabase.auth.admin.listUsers();
236
245
  const existingUser = listData?.users?.find((u) => u.email === email);
237
246
  if (existingUser) {
238
- await supabase.auth.admin.updateUserById(existingUser.id, {
239
- password,
240
- });
241
- console.log(` Updated password for existing user ${email}`);
247
+ userId = existingUser.id;
248
+ console.log(` Found existing user ${email} (user: ${userId})`);
249
+ } else {
250
+ console.error(
251
+ ` User ${email} reported as registered but not found in listUsers`,
252
+ );
253
+ process.exit(1);
242
254
  }
243
255
  } else {
244
256
  console.error(` Failed to create auth user: ${createError.message}`);
245
257
  process.exit(1);
246
258
  }
259
+ } else {
260
+ userId = createData!.user.id;
261
+ console.log(` Created user ${email} (user: ${userId})`);
247
262
  }
248
263
 
249
- // Sign in to get a valid session
250
- // Use a separate client with the publishable/anon key for sign-in (if available)
251
- const signInClient =
252
- anonKey && anonKey !== secretKey
253
- ? createClient(supabaseUrl!, anonKey, {
254
- auth: { autoRefreshToken: false, persistSession: false },
255
- })
256
- : supabase;
257
-
258
- const { data: signInData, error: signInError } =
259
- await signInClient.auth.signInWithPassword({ email, password });
260
-
261
- if (signInError || !signInData.session) {
262
- console.error(
263
- ` Failed to sign in as ${email}: ${signInError?.message || 'no session returned'}`,
264
- );
265
- process.exit(1);
266
- }
267
-
268
- const userId = signInData.user.id;
269
- console.log(` Signed in as ${email} (user: ${userId})`);
270
-
271
- // Use the REAL JWT from Supabase sign-in for the session cookie so auth
272
- // works immediately against the real Supabase API. The externalApis below
273
- // provide a fallback for when the CLI supports preload-based auth
274
- // interception (no real Supabase calls needed at render time).
275
- const fakeJwt = buildFakeJwt(userId, email);
276
- const userResponse = buildUserResponse(signInData.user);
264
+ // Build synthetic JWT and mock responses — no real sign-in needed.
265
+ // The preload module intercepts server-side getUser() calls so Next.js
266
+ // middleware returns the mock user without hitting real Supabase.
267
+ const fakeJwt = buildFakeJwt(userId!, email);
268
+ const userResponse = buildUserResponse({ id: userId!, email });
277
269
 
278
270
  const projectRef = getProjectRef();
279
271
  const sessionOutput = {
@@ -281,19 +273,16 @@ async function handleAuth(auth: {
281
273
  {
282
274
  name: `sb-${projectRef}-auth-token`,
283
275
  value: JSON.stringify({
284
- access_token: signInData.session.access_token,
285
- refresh_token: signInData.session.refresh_token,
276
+ access_token: fakeJwt,
277
+ refresh_token: 'codeyam-mock-refresh-token',
286
278
  token_type: 'bearer',
287
- expires_in: signInData.session.expires_in,
288
- expires_at: signInData.session.expires_at,
279
+ expires_in: 315360000,
280
+ expires_at: 9999999999,
289
281
  }),
290
282
  path: '/',
291
283
  sameSite: 'Lax' as const,
292
284
  },
293
285
  ],
294
- // External API mocks — when the CLI supports propagating these, the
295
- // preload module will intercept server-side getUser() calls so Next.js
296
- // middleware returns the mock user without hitting real Supabase.
297
286
  externalApis: {
298
287
  [`${supabaseUrl}/auth/v1/user`]: {
299
288
  body: userResponse,
@@ -319,7 +308,7 @@ async function handleAuth(auth: {
319
308
  fs.writeFileSync(outputPath, JSON.stringify(sessionOutput, null, 2));
320
309
  console.log(` Session cookies + auth mocks written to ${outputPath}`);
321
310
 
322
- return userId;
311
+ return userId!;
323
312
  }
324
313
 
325
314
  /**
@@ -358,7 +347,7 @@ async function main() {
358
347
  // in seed data (e.g. for user_id foreign key columns with Supabase RLS)
359
348
  if (auth) {
360
349
  const userId = await handleAuth(
361
- auth as { email: string; password: string },
350
+ auth as { email: string; password?: string },
362
351
  );
363
352
  seed = replaceAuthPlaceholders(seed, userId);
364
353
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codeyam/codeyam-cli",
3
- "version": "0.1.28",
3
+ "version": "0.1.30",
4
4
  "description": "Local development CLI for CodeYam analysis",
5
5
  "type": "module",
6
6
  "bin": {