@superblocksteam/vite-plugin-file-sync 2.0.115 → 2.0.116-next.1

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 (80) hide show
  1. package/dist/ai-service/agent/prompts/build-base-system-prompt.d.ts.map +1 -1
  2. package/dist/ai-service/agent/prompts/build-base-system-prompt.js +11 -3
  3. package/dist/ai-service/agent/prompts/build-base-system-prompt.js.map +1 -1
  4. package/dist/ai-service/agent/tools2/tools/download-attachments.js +1 -1
  5. package/dist/ai-service/agent/tools2/tools/exit-plan-mode.d.ts.map +1 -1
  6. package/dist/ai-service/agent/tools2/tools/exit-plan-mode.js +7 -3
  7. package/dist/ai-service/agent/tools2/tools/exit-plan-mode.js.map +1 -1
  8. package/dist/ai-service/chat/chat-session-store.d.ts +4 -0
  9. package/dist/ai-service/chat/chat-session-store.d.ts.map +1 -1
  10. package/dist/ai-service/chat/chat-session-store.js +30 -11
  11. package/dist/ai-service/chat/chat-session-store.js.map +1 -1
  12. package/dist/ai-service/features.d.ts +4 -0
  13. package/dist/ai-service/features.d.ts.map +1 -1
  14. package/dist/ai-service/features.js +4 -0
  15. package/dist/ai-service/features.js.map +1 -1
  16. package/dist/ai-service/skills/system/_registry.generated.d.ts.map +1 -1
  17. package/dist/ai-service/skills/system/_registry.generated.js +8 -0
  18. package/dist/ai-service/skills/system/_registry.generated.js.map +1 -1
  19. package/dist/ai-service/skills/system/third-party-migration/lovable.generated.d.ts +2 -0
  20. package/dist/ai-service/skills/system/third-party-migration/lovable.generated.d.ts.map +1 -0
  21. package/dist/ai-service/skills/system/third-party-migration/lovable.generated.js +79 -0
  22. package/dist/ai-service/skills/system/third-party-migration/lovable.generated.js.map +1 -0
  23. package/dist/ai-service/skills/system/third-party-migration/replit.generated.d.ts +2 -0
  24. package/dist/ai-service/skills/system/third-party-migration/replit.generated.d.ts.map +1 -0
  25. package/dist/ai-service/skills/system/third-party-migration/replit.generated.js +65 -0
  26. package/dist/ai-service/skills/system/third-party-migration/replit.generated.js.map +1 -0
  27. package/dist/ai-service/skills/system/third-party-migration/skill.generated.d.ts +2 -0
  28. package/dist/ai-service/skills/system/third-party-migration/skill.generated.d.ts.map +1 -0
  29. package/dist/ai-service/skills/system/third-party-migration/skill.generated.js +115 -0
  30. package/dist/ai-service/skills/system/third-party-migration/skill.generated.js.map +1 -0
  31. package/dist/ai-service/skills/system/third-party-migration/v0.generated.d.ts +2 -0
  32. package/dist/ai-service/skills/system/third-party-migration/v0.generated.d.ts.map +1 -0
  33. package/dist/ai-service/skills/system/third-party-migration/v0.generated.js +118 -0
  34. package/dist/ai-service/skills/system/third-party-migration/v0.generated.js.map +1 -0
  35. package/dist/ai-service/state-machine/clark-fsm.js +1 -1
  36. package/dist/ai-service/state-machine/clark-fsm.js.map +1 -1
  37. package/dist/ai-service/state-machine/handlers/llm-generating.d.ts.map +1 -1
  38. package/dist/ai-service/state-machine/handlers/llm-generating.js +34 -2
  39. package/dist/ai-service/state-machine/handlers/llm-generating.js.map +1 -1
  40. package/dist/ai-service/util/archive-extractors.d.ts +13 -0
  41. package/dist/ai-service/util/archive-extractors.d.ts.map +1 -1
  42. package/dist/ai-service/util/archive-extractors.js +27 -0
  43. package/dist/ai-service/util/archive-extractors.js.map +1 -1
  44. package/dist/file-sync-vite-plugin.d.ts.map +1 -1
  45. package/dist/file-sync-vite-plugin.js +41 -13
  46. package/dist/file-sync-vite-plugin.js.map +1 -1
  47. package/dist/git-service/live-branch.d.ts +1 -0
  48. package/dist/git-service/live-branch.d.ts.map +1 -1
  49. package/dist/git-service/live-branch.js +2 -16
  50. package/dist/git-service/live-branch.js.map +1 -1
  51. package/dist/lock-service/index.d.ts.map +1 -1
  52. package/dist/lock-service/index.js +5 -8
  53. package/dist/lock-service/index.js.map +1 -1
  54. package/dist/migration/migration-classifier.d.ts +4 -0
  55. package/dist/migration/migration-classifier.d.ts.map +1 -0
  56. package/dist/migration/migration-classifier.js +77 -0
  57. package/dist/migration/migration-classifier.js.map +1 -0
  58. package/dist/migration/migration-routes.d.ts.map +1 -1
  59. package/dist/migration/migration-routes.js +159 -2
  60. package/dist/migration/migration-routes.js.map +1 -1
  61. package/dist/migration/unsupported-integrations.d.ts +10 -0
  62. package/dist/migration/unsupported-integrations.d.ts.map +1 -0
  63. package/dist/migration/unsupported-integrations.js +197 -0
  64. package/dist/migration/unsupported-integrations.js.map +1 -0
  65. package/dist/server-rpc/index.d.ts +2 -0
  66. package/dist/server-rpc/index.d.ts.map +1 -1
  67. package/dist/server-rpc/index.js +6 -0
  68. package/dist/server-rpc/index.js.map +1 -1
  69. package/dist/socket-manager.d.ts.map +1 -1
  70. package/dist/socket-manager.js +27 -24
  71. package/dist/socket-manager.js.map +1 -1
  72. package/dist/sync-service/download.d.ts +1 -0
  73. package/dist/sync-service/download.d.ts.map +1 -1
  74. package/dist/sync-service/download.js +1 -1
  75. package/dist/sync-service/download.js.map +1 -1
  76. package/dist/sync-service/index.d.ts +22 -6
  77. package/dist/sync-service/index.d.ts.map +1 -1
  78. package/dist/sync-service/index.js +96 -47
  79. package/dist/sync-service/index.js.map +1 -1
  80. package/package.json +7 -7
@@ -0,0 +1,79 @@
1
+ // Auto-generated from src/ai-service/skills/system/third-party-migration/lovable.md
2
+ // Do not edit directly - edit the .md file instead
3
+ export const content = `# Lovable-specific mapping
4
+
5
+ This is a per-platform reference loaded from \`SKILL.md\`. The framework — target layout, universal mapping, non-negotiables, workflow, code-emission rules — lives there. This file documents only what's specific to a Lovable source.
6
+
7
+ > Lovable is not a fixed stack. Unlike Replit, there is no canonical template to assume. A Lovable app may talk to Lovable Cloud / Supabase directly from the client, may have edge functions, may call arbitrary third-party APIs, may have no backend at all, or may mix all of the above. **Discover before you map.** Do not assume Supabase, do not assume an Express server, and do not invent integrations the source does not use.
8
+
9
+ ## Where the source lives
10
+
11
+ Hallmarks: \`src/integrations/supabase/client.ts\`, \`src/integrations/supabase/types.ts\`, \`supabase/config.toml\`, \`supabase/functions/<name>/index.ts\`, \`supabase/migrations/\`, a \`lovable-tagger\` entry in \`vite.config.ts\`, or a Lovable-flavored README.
12
+
13
+ If the user gave a path, use it. Otherwise look for the hallmarks above in the working tree. If ambiguous, ask.
14
+
15
+ ## Typical shape (hints, not rules)
16
+
17
+ Use these as starting points; re-verify against the actual source tree on every migration.
18
+
19
+ - **Frontend**: React 18 + Vite + TypeScript + Tailwind + shadcn/ui. Routing via \`react-router-dom\` (v6 or v7) or sometimes \`wouter\`. Data fetching via \`@tanstack/react-query\`. Forms via \`react-hook-form\` + \`zod\`.
20
+ - **Backend (when present)** — pick whichever the source actually uses:
21
+ - **Lovable Cloud / Supabase** is the default. Surfaces in the source as \`src/integrations/supabase/client.ts\`, \`src/integrations/supabase/types.ts\`, a top-level \`supabase/\` dir with \`migrations/\` and/or \`functions/<name>/index.ts\` (Deno edge functions), and direct \`supabase.from("table").select(...)\` calls from React components.
22
+ - **Edge functions** (Deno-style): \`supabase/functions/<name>/index.ts\`. Each is its own HTTP endpoint, may use \`Deno.serve\`, often reads \`Deno.env.get(...)\`.
23
+ - **Third-party APIs** called from the client (Stripe, OpenAI, Resend, etc.) — frequently with secrets that should never have been on the client.
24
+ - **No backend at all** — pure static app, possibly with localStorage state. The framework's "Don't fabricate a backend" rule applies; the migrated app stays frontend-only.
25
+ - **Auth**: \`supabase.auth\` from the client (\`signInWithPassword\`, \`onAuthStateChange\`, \`getSession\`). Sometimes wrapped in an \`AuthContext\`.
26
+ - **Storage**: \`supabase.storage.from(bucket).upload(...)\` or third-party upload services.
27
+ - **Realtime**: \`supabase.channel(...).on("postgres_changes", ...)\` subscriptions. **Superblocks has no realtime equivalent in this template — flag and degrade to polling or one-shot fetches; do not silently drop.**
28
+
29
+ ## Discovery checklist
30
+
31
+ This is the most important step for a Lovable migration — get it wrong and the rest is rework. In addition to the framework's discovery requirements, build a list of:
32
+
33
+ - Every distinct backend interaction: Supabase table queries (grouped by table + operation), Supabase RPC calls, edge functions, third-party API calls (each endpoint), storage operations, realtime subscriptions, auth calls.
34
+ - Every env var and where it's used (client vs. server, whether it's a secret).
35
+ - Every Supabase migration file and the schema it implies.
36
+ - Every RLS policy you can find — these become explicit \`WHERE\` clauses post-migration.
37
+ - Every leaked secret found on the client side (\`VITE_*\`, hardcoded keys) — these go into the security note at the end.
38
+
39
+ If the discovery summary doesn't tell you what every API will look like, you haven't discovered enough.
40
+
41
+ ## Core mapping
42
+
43
+ - **Each client-side Supabase call → one Superblocks API**, then call it via \`useApi\`/\`useApiData\`. Direct database access from the client is not how Superblocks apps work — every read and write flows through \`server/apis/<ApiName>/api.ts\`.
44
+ - \`supabase.from("table").select(...)\` → \`api()\` with a Postgres integration and \`ctx.integrations.db.query(...)\`. Translate the PostgREST filter chain (\`.eq\`, \`.in\`, \`.order\`, \`.range\`, \`.limit\`) into parameterized SQL — never string-interpolate user input.
45
+ - \`supabase.from("table").insert/update/upsert/delete(...)\` → \`.execute(...)\` with parameterized SQL.
46
+ - \`supabase.rpc("<fn>", { ... })\` → \`SELECT * FROM <fn>(...)\` via \`.query\` if it returns rows, else \`.execute\`.
47
+ - **RLS / row-level-security policies** in Lovable do not transfer automatically. The Superblocks API runs as the integration's service user, not the end user. You must enforce per-user filtering in SQL using \`ctx.user.userId\` (or another claim) explicitly. Audit every ported query — if the original relied on \`auth.uid()\` in an RLS policy, the ported SQL needs an equivalent \`WHERE user_id = $N\` clause. Missing filters are a security bug. Write a one-line comment above the clause noting which RLS policy it replaces, since the _why_ is non-obvious to a future reader.
48
+ - **Schema**: Postgres tables exist on the integration the user binds. Do not run Lovable's \`supabase/migrations/*.sql\` against the target DB. Read them to understand schema and surface a summary; if the integration's DB is empty or schema-mismatched, stop and ask the user how they want to proceed (apply migrations manually, point to an existing DB, or defer).
49
+ - **Each \`supabase/functions/<name>/index.ts\` edge function → one Superblocks API** at \`server/apis/<NameInPascalCase>/api.ts\`. Translate \`Deno.serve\`'s request handler the same way as any other handler: body/query/params → unified \`input\` schema, response → \`return { ... }\` from \`run\`. \`Deno.env.get(...)\` → \`ctx.env\`. Edge-function-specific helpers (CORS headers, JWT verification middleware) → drop; the platform handles them.
50
+ - **Each third-party API call → integration**. \`fetch("https://api.stripe.com/...")\` becomes a declared integration plus \`apiRequest(...)\`. Secrets from \`import.meta.env.VITE_*\`, hardcoded keys, or \`Deno.env.get\` move into the integration definition. A \`VITE_OPENAI_API_KEY\` on the client side is also a security finding worth surfacing in the migration summary.
51
+ - **\`supabase.auth\` → \`ctx.user\`**. Drop \`AuthContext\` providers, sign-in pages, password-reset flows, and magic-link handlers — they have no role in a Superblocks app.
52
+ - **\`supabase.storage\` → integrations**. If the source uses Supabase storage, ask the user which target storage integration to use (S3, GCS, etc.) — there is no Lovable-flavored "storage" integration. Surface the buckets used in the discovery summary.
53
+ - **\`supabase.channel(...)\` realtime subscriptions** → not supported in this template. Flag as a \`failed\` checklist item with \`failureReason: "realtime subscription on <table> has no Superblocks equivalent"\`, and ask the user before silently rewriting to polling.
54
+
55
+ ## Ask-before-guessing — Lovable specifics
56
+
57
+ - "The source uses Supabase for both database and auth — bind to an existing Postgres integration, or do you want to point at a different DB? Auth is platform-managed in Superblocks regardless."
58
+ - "I see direct calls to \`<third-party API>\` from the client with secrets in \`VITE_*\` env vars. I'll move these server-side via an integration — confirm which integration to bind, or whether to create a new one."
59
+ - "The source has Postgres migrations under \`supabase/migrations/\`. I will not run them against your integration's database. How do you want the schema to land?"
60
+ - "I see realtime subscriptions on \`<table>\`. Superblocks has no realtime in this template — degrade to polling, drop the feature, or stop and let you decide?"
61
+ - "RLS policy \`<policy>\` filtered by \`auth.uid()\`. I'll replace it with \`WHERE user_id = $N\` keyed off \`ctx.user.userId\`. Is that the right user-claim mapping?"
62
+
63
+ ## Page port — what changes vs. what doesn't
64
+
65
+ For each Lovable page, only these change:
66
+
67
+ - **Data hooks**: direct Supabase calls + \`@tanstack/react-query\` → \`useApi\` / \`useApiData\`.
68
+ - **Auth touchpoints**: \`supabase.auth\` / custom \`AuthContext\` → platform-managed (drop the provider; consume \`ctx.user\` server-side).
69
+ - **Router primitives**: if the source uses \`wouter\` or v6 patterns, adapt to \`react-router\` v7.
70
+
71
+ Everything else — JSX structure, Tailwind classes, shadcn variants, custom CSS, theme tokens, fonts, layout containers — transfers unchanged. If the diff goes beyond data + auth + routing, you are over-editing.
72
+
73
+ ## Done — Lovable specifics
74
+
75
+ In the final report, additionally surface:
76
+
77
+ - Any unsupported features that became \`failed\` items (realtime subscriptions, Supabase storage without a target integration, etc.).
78
+ `;
79
+ //# sourceMappingURL=lovable.generated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lovable.generated.js","sourceRoot":"","sources":["../../../../../src/ai-service/skills/system/third-party-migration/lovable.generated.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,mDAAmD;AAEnD,MAAM,CAAC,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2EtB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const content = "# Replit-specific mapping\n\nThis is a per-platform reference loaded from `SKILL.md`. The framework \u2014 target layout, universal mapping, non-negotiables, workflow, code-emission rules \u2014 lives there. This file documents only what's specific to a Replit source.\n\n## Where the source lives\n\nHallmarks: `replit.md`, `.replit`, `artifacts/`, an Express server entry (e.g. `server/index.ts`), an Orval-generated client package (typically `client/src/api/` or similar with `useXxx` hooks).\n\nIf the user gave a path, use it. Otherwise look for the hallmarks above in the working tree. If ambiguous, ask.\n\n## Typical shape\n\nA Replit fullstack app usually looks like:\n\n- **Server**: Express + TypeScript. Routes split across multiple files, mounted with `app.use(\"/api/...\", router)`. Middleware for auth (sometimes Passport, sometimes hand-rolled JWT), CORS, error handling. Errors propagated via `next(err)` or `res.status(...).json(...)`. Env vars via `process.env.*`.\n- **Database**: `pg`, `knex`, `prisma`, or Drizzle, with credentials in env (`DATABASE_URL` / DSN).\n- **Client**: React + Vite + Tailwind + shadcn/ui. Routing via `wouter` or `react-router`. Data fetching via Orval-generated `useXxx` hooks backed by `@tanstack/react-query`. Forms via `react-hook-form` + `zod`. Local `QueryClientProvider` and base-URL/auth-token getters.\n\nThis is the common case. Verify against the actual tree before mapping.\n\n## Discovery checklist\n\nIn addition to the framework's discovery requirements, for a Replit source enumerate:\n\n- Every Express route handler (group by router file, then by mounted path).\n- Every middleware (auth, CORS, error, logging) \u2014 most drop entirely.\n- Every DB client and the queries it issues. Note env vars holding the DSN.\n- Every external HTTP call (`axios` / `fetch`) and the API it targets.\n- Every `process.env.*` read, separated into \"credentials/secrets\" (move to integrations) and \"config\" (`ctx.env`).\n- Every Orval-generated hook usage on the client.\n\n## Core mapping\n\n- **Each Express route handler \u2192 one Superblocks API** at `server/apis/<ApiName>/api.ts`, registered in `server/apis/index.ts`. Within `api()`:\n - `req.body` / `req.query` / `req.params` \u2192 unified `input` Zod schema.\n - `res.json(data)` \u2192 `return { ... }` from `run`.\n - Auth middleware that hung user info on `req.user` \u2192 `ctx.user`.\n - DB clients \u2192 `ctx.integrations.db.query/execute(...)`.\n - External HTTP \u2192 declared integration + `apiRequest(...)`.\n - Error middleware / `next(err)` / `res.status(...).json(...)` \u2192 throw the documented `SdkError` subtypes.\n - `app.listen`, CORS, static-file middleware, route grouping \u2192 drop entirely. Route groups become separate `api()` files.\n- **Each React page \u2192 one Superblocks page** wired into `client/router.tsx`. Replace Orval `useXxx` hooks with `useApiData` (reads) or `useApi` (mutations) keyed by `<ApiName>`. Drop the generated client package, the local `QueryClientProvider`, any base-URL or auth-token getters.\n\n## Ask-before-guessing \u2014 Replit specifics\n\n- \"The source uses `<DB client>` against `<DSN env var>`. I'll bind to a Postgres integration \u2014 which one, or do you want to create a new one?\"\n- \"I see external HTTP calls to `<host>` with credentials in `<env var>`. Bind to an integration of type `<kind>`?\"\n- \"Multiple route files mount under `<prefix>`. I'll emit one API per handler \u2014 does that match how you want to address them, or should some be consolidated?\"\n\n## Page port \u2014 what changes vs. what doesn't\n\nFor each Replit page, only these change:\n\n- **Data hooks**: Orval `useXxx` \u2192 `useApi` / `useApiData`.\n- **Router primitives**: `wouter` \u2192 `react-router` v7 (or adapt v6 \u2192 v7 patterns if the source already used `react-router`).\n\nEverything else \u2014 JSX structure, Tailwind classes, shadcn variants, custom CSS, theme tokens, fonts, layout containers \u2014 transfers unchanged. If the diff goes beyond data + routing, you are over-editing.\n\n## Done \u2014 Replit specifics\n\nNothing extra to surface beyond the framework's \"Done\" report.\n";
2
+ //# sourceMappingURL=replit.generated.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replit.generated.d.ts","sourceRoot":"","sources":["../../../../../src/ai-service/skills/system/third-party-migration/replit.generated.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,gmIA6DnB,CAAC"}
@@ -0,0 +1,65 @@
1
+ // Auto-generated from src/ai-service/skills/system/third-party-migration/replit.md
2
+ // Do not edit directly - edit the .md file instead
3
+ export const content = `# Replit-specific mapping
4
+
5
+ This is a per-platform reference loaded from \`SKILL.md\`. The framework — target layout, universal mapping, non-negotiables, workflow, code-emission rules — lives there. This file documents only what's specific to a Replit source.
6
+
7
+ ## Where the source lives
8
+
9
+ Hallmarks: \`replit.md\`, \`.replit\`, \`artifacts/\`, an Express server entry (e.g. \`server/index.ts\`), an Orval-generated client package (typically \`client/src/api/\` or similar with \`useXxx\` hooks).
10
+
11
+ If the user gave a path, use it. Otherwise look for the hallmarks above in the working tree. If ambiguous, ask.
12
+
13
+ ## Typical shape
14
+
15
+ A Replit fullstack app usually looks like:
16
+
17
+ - **Server**: Express + TypeScript. Routes split across multiple files, mounted with \`app.use("/api/...", router)\`. Middleware for auth (sometimes Passport, sometimes hand-rolled JWT), CORS, error handling. Errors propagated via \`next(err)\` or \`res.status(...).json(...)\`. Env vars via \`process.env.*\`.
18
+ - **Database**: \`pg\`, \`knex\`, \`prisma\`, or Drizzle, with credentials in env (\`DATABASE_URL\` / DSN).
19
+ - **Client**: React + Vite + Tailwind + shadcn/ui. Routing via \`wouter\` or \`react-router\`. Data fetching via Orval-generated \`useXxx\` hooks backed by \`@tanstack/react-query\`. Forms via \`react-hook-form\` + \`zod\`. Local \`QueryClientProvider\` and base-URL/auth-token getters.
20
+
21
+ This is the common case. Verify against the actual tree before mapping.
22
+
23
+ ## Discovery checklist
24
+
25
+ In addition to the framework's discovery requirements, for a Replit source enumerate:
26
+
27
+ - Every Express route handler (group by router file, then by mounted path).
28
+ - Every middleware (auth, CORS, error, logging) — most drop entirely.
29
+ - Every DB client and the queries it issues. Note env vars holding the DSN.
30
+ - Every external HTTP call (\`axios\` / \`fetch\`) and the API it targets.
31
+ - Every \`process.env.*\` read, separated into "credentials/secrets" (move to integrations) and "config" (\`ctx.env\`).
32
+ - Every Orval-generated hook usage on the client.
33
+
34
+ ## Core mapping
35
+
36
+ - **Each Express route handler → one Superblocks API** at \`server/apis/<ApiName>/api.ts\`, registered in \`server/apis/index.ts\`. Within \`api()\`:
37
+ - \`req.body\` / \`req.query\` / \`req.params\` → unified \`input\` Zod schema.
38
+ - \`res.json(data)\` → \`return { ... }\` from \`run\`.
39
+ - Auth middleware that hung user info on \`req.user\` → \`ctx.user\`.
40
+ - DB clients → \`ctx.integrations.db.query/execute(...)\`.
41
+ - External HTTP → declared integration + \`apiRequest(...)\`.
42
+ - Error middleware / \`next(err)\` / \`res.status(...).json(...)\` → throw the documented \`SdkError\` subtypes.
43
+ - \`app.listen\`, CORS, static-file middleware, route grouping → drop entirely. Route groups become separate \`api()\` files.
44
+ - **Each React page → one Superblocks page** wired into \`client/router.tsx\`. Replace Orval \`useXxx\` hooks with \`useApiData\` (reads) or \`useApi\` (mutations) keyed by \`<ApiName>\`. Drop the generated client package, the local \`QueryClientProvider\`, any base-URL or auth-token getters.
45
+
46
+ ## Ask-before-guessing — Replit specifics
47
+
48
+ - "The source uses \`<DB client>\` against \`<DSN env var>\`. I'll bind to a Postgres integration — which one, or do you want to create a new one?"
49
+ - "I see external HTTP calls to \`<host>\` with credentials in \`<env var>\`. Bind to an integration of type \`<kind>\`?"
50
+ - "Multiple route files mount under \`<prefix>\`. I'll emit one API per handler — does that match how you want to address them, or should some be consolidated?"
51
+
52
+ ## Page port — what changes vs. what doesn't
53
+
54
+ For each Replit page, only these change:
55
+
56
+ - **Data hooks**: Orval \`useXxx\` → \`useApi\` / \`useApiData\`.
57
+ - **Router primitives**: \`wouter\` → \`react-router\` v7 (or adapt v6 → v7 patterns if the source already used \`react-router\`).
58
+
59
+ Everything else — JSX structure, Tailwind classes, shadcn variants, custom CSS, theme tokens, fonts, layout containers — transfers unchanged. If the diff goes beyond data + routing, you are over-editing.
60
+
61
+ ## Done — Replit specifics
62
+
63
+ Nothing extra to surface beyond the framework's "Done" report.
64
+ `;
65
+ //# sourceMappingURL=replit.generated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replit.generated.js","sourceRoot":"","sources":["../../../../../src/ai-service/skills/system/third-party-migration/replit.generated.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,mDAAmD;AAEnD,MAAM,CAAC,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6DtB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const content = "---\nname: third-party-migration\ndescription: |\n Migrate a third-party app (Replit, Lovable, v0, or similar) into a Superblocks 3.0 full-stack app.\n Load when the user asks to migrate, import, or port an external app \u2014 or when the source tree contains hallmarks of a supported platform (`replit.md` / `.replit`, `src/integrations/supabase/`, `supabase/functions/`, `lovable-tagger`, an `app/` directory with `next.config.*` and `\"use client\"` / `\"use server\"` directives, etc.) and the user wants it turned into a Superblocks app.\nreadOnly: true\nmetadata:\n author: superblocks\n version: \"1.0\"\n---\n\n# Third-Party App \u2192 Superblocks 3.0 Migration\n\nPort a user-provided external app into the Superblocks fullstack app you are running inside (template: `app-fullstack`). The source tree is **read-only material**. All edits land in the target app under `server/` and `client/`.\n\nThis file is the migration framework. **Per-platform mapping rules live in sibling files** \u2014 load the right one before you start mapping.\n\n## Identify the source platform\n\nMatch the source tree against these signals, then read the matching reference file in this folder. Read it once, up-front \u2014 it tells you what shapes to look for and how each maps to Superblocks.\n\n- **Replit** \u2014 `replit.md`, `.replit`, `artifacts/`, an Express server with an Orval-generated client. \u2192 load `replit.md`.\n- **Lovable** \u2014 `src/integrations/supabase/client.ts`, `supabase/config.toml`, `supabase/functions/`, `supabase/migrations/`, `lovable-tagger` in `vite.config.ts`. \u2192 load `lovable.md`.\n- **v0** \u2014 `app/<segment>/page.tsx` (Next.js App Router) plus `next.config.{js,mjs,ts}` and `next` in `package.json`, files with `\"use client\"` / `\"use server\"` directives, `next/link` / `next/navigation` imports, `components/ui/` with shadcn primitives. \u2192 load `v0.md`.\n- **Ambiguous or neither** \u2014 stop and ask the user which platform the source came from. Do not guess. It is possible that it is No Platform. In this case, follow the general guidelines in this document and ask user questions for any ambiguity.\n\nThe framework below applies to every platform; the platform file fills in the source-specific mapping.\n\n## Target layout\n\nThe app you are running inside looks like this. Do not invent new top-level directories.\n\n```\nclient/\n App.tsx \u2014 root with <AppProvider> + <Outlet />\n router.tsx \u2014 react-router v7, lazy imports\n index.css \u2014 Tailwind v4 + theme tokens\n hooks/\n useApi.ts \u2014 typed wrapper around useTypedApi<ApiRegistry>\n useApiData.ts \u2014 typed wrapper around useTypedApiData<ApiRegistry>\n lib/executeApi.ts \u2014 non-React typed executeApi\n pages/<Name>/index.tsx\n components/ui/ \u2014 shadcn primitives (do not modify)\nserver/\n apis/\n index.ts \u2014 registry: `const apis = { ApiName: ... } as const;`\n <ApiName>/api.ts\n```\n\n## Universal mapping (applies to every source)\n\nThese hold regardless of source platform. Per-platform specifics layer on top.\n\n- APIs are addressed by `name` via the registry \u2014 there is no URL path. Within `api()`:\n - All inputs (whatever shape the source had \u2014 body, query, params, function args) \u2192 one unified `input` Zod schema; destructure inside `run(ctx, { ... })`.\n - The handler's response \u2192 `return { ... }` from `run`. The `output` schema validates it automatically; do not `safeParse` by hand.\n - Auth \u2192 `ctx.user` (`userId`, `email`, `name`, `groups`, `customClaims`). Auth is platform-managed; drop the source's auth flows entirely.\n - Errors \u2192 throw the `SdkError` subtypes the sdk-api README documents (`InputValidationError`, `OutputValidationError`, `IntegrationError`, `ExecutionError`). Never invent error classes or return HTTP status codes.\n - DB clients (`pg`, `knex`, `prisma`, Drizzle, `supabase.from(...)`) \u2192 declare in `integrations: { db: postgres(DB_INTEGRATION_ID) }` and call `ctx.integrations.db.query(sql, ZodSchema, params, { label: \"...\" })` / `.execute(...)`. Parameterized SQL only. Hold integration UUIDs in module-level `const`s, not literals scattered through `run`.\n - External HTTP (`axios`, `fetch`, third-party SDKs) \u2192 declared integration + `ctx.integrations.<name>.apiRequest({ method, path, body }, { response: ZodSchema })`.\n - `process.env.*` / `import.meta.env.*` / `Deno.env.get(...)` \u2192 `ctx.env`. Logging \u2192 `ctx.log.info/warn/error/debug(msg, data?)`.\n - Server bootstrapping (`app.listen`, CORS, route grouping, middleware setup, `Deno.serve`) \u2192 drop entirely. The platform handles it.\n- **Each frontend page \u2192 one Superblocks page** at `client/pages/<Name>/index.tsx`, wired into `client/router.tsx`.\n- **Each backend data source (DB, REST client, S3, ...) \u2192 one Superblocks integration** referenced by UUID. Credentials live on the integration, never in code.\n\n## Authoritative references (read just-in-time, not up front)\n\n- `node_modules/@superblocksteam/sdk-api/README.md` and `src/index.ts` \u2014 the server `api()` contract and the full list of factory names. **Never invent factory names.** If a required file is missing, mark the affected checklist item `failed` with the missing path as the reason.\n- Per-integration READMEs under `node_modules/@superblocksteam/sdk-api/src/integrations/<kind>/` \u2014 read once, when you first emit an API that uses that integration.\n- `skills/system/superblocks-frontend/SKILL.md` \u2014 the client contract (`useApi` / `useApiData` / `executeApi` from `@superblocksteam/library`).\n\n> \u26A0\uFE0F **Never** load `skills/system/superblocks-api/SKILL.md`. It describes a different, block-based API pattern that is incompatible with the fullstack template's `sdk-api`. Mixing them produces code that does not compile.\n\n## Non-negotiables\n\n1. **Track everything in the checklist.** The **first tool call after exiting plan mode** or **during build mode, before building** is `build_manageChecklist` to seed. Before every per-item edit, `update <itemId> in_progress`; after, `update <itemId> completed` (or `failed` with a concrete `failureReason`). If you are about to write code and the checklist is empty, stale, or missing the item you are working on, **stop and fix the checklist first** \u2014 the orchestration depends on it. Free-text status reports are not a substitute.\n2. **Discover before you edit.** Inventory routes, pages, data sources, env vars, _and visual surface_ (theme tokens, `index.css`, custom CSS, font setup, layout shells) across the entire source tree before writing any code. The platform file tells you what shapes to look for.\n3. **Ask before guessing.** Multiple integrations of the same kind, missing integrations, unsupported data sources, or any platform-specific ambiguity \u2192 stop and `askMultiChoice`. Never pick for the user. The platform file lists ambiguities specific to that source.\n4. **Preserve visual identity.** The migrated app must look and feel like the source. Carry over Tailwind config, shadcn theme tokens, `index.css` / `globals.css`, custom CSS modules, fonts, spacing, color palette, and layout shells (header/sidebar/grid). shadcn/ui components stay as-is. Do **not** redesign, restyle, or \"clean up\" while porting \u2014 visual regressions are bugs, not improvements. If the user wants a redesign, that is a separate task after migration.\n5. **Never copy secrets.** DSN strings, API keys, anon/service-role keys, JWT secrets, env-var lookups for credentials \u2014 none move into the target tree. Integration UUIDs replace them. Surface every leaked secret you find (especially client-side `VITE_*` / `NEXT_PUBLIC_*` keys) in the discovery summary so the user can rotate them.\n6. **No `// TODO`s.** Anything you can't finish deterministically becomes a `failed` checklist item with a concrete `failureReason`.\n7. **Don't scaffold.** If `server/apis/index.ts` or `client/router.tsx` doesn't already exist, you're in the wrong app \u2014 stop and surface this.\n8. **Don't fabricate a backend.** If the source is genuinely frontend-only, the migrated app should also be frontend-only. Don't invent APIs to \"complete\" the architecture.\n\n## Workflow\n\n1. **Locate the source.** If the user gave a path, use it. Otherwise look in the working tree for the platform signals listed above. If ambiguous, ask.\n2. **Load the platform guide.** Read `replit.md`, `lovable.md`, or `v0.md` based on what you found. Do not start mapping before you've read it \u2014 it documents the source's shape and how each piece translates.\n3. **Inventory.** Following the platform guide's discovery checklist, enumerate every route/handler, page, data source, env var, secret, and visual asset in the source tree. Surface a one-paragraph summary plus an itemized list of integrations and unsupported features before writing anything. If the source has bespoke styling, seed a `setup_theme` checklist item to port it.\n4. **Resolve integrations.** For each data source kind: call `searchIntegrations` (filter by `type`). One match \u2192 bind it. Multiple \u2192 ask the user which. Zero \u2192 ask whether to create one; if yes, use `listAvailableIntegrationTypes` (if needed) and `openIntegrationSetup`, then ask the user explicitly whether they saved or cancelled before re-searching. Resolution is **blocking** \u2014 the checklist cannot be seeded until every kind maps to a UUID, is explicitly deferred, or has been confirmed unsupported.\n5. **Seed the checklist** via `build_manageChecklist`. One `api_<ApiName>` per backend interaction, one `frontend_<PageName>` per page, plus `setup_router`, `setup_registry`, `setup_cleanup`, and any `setup_theme` / `setup_storage` / `unsupported_<feature>` items the platform guide tells you to add. Print the count as a sanity check; if it looks wrong, re-check discovery.\n6. **Execute.** Every item follows the same ritual \u2014 no exceptions:\n - **Before touching files:** `build_manageChecklist update <itemId> in_progress`.\n - **Emit / edit the files** for that item.\n - **After the edit lands:** `build_manageChecklist update <itemId> completed` (or `failed` with a concrete `failureReason`).\n - You are not done with an item until its checklist entry has moved to a terminal state. Do not batch updates at the end; update as you go.\n - **For parallelizable work:** call `spawnCodingSubagents` with batches of tasks. Each batch's `instructions` names exact `itemId`s, includes the integration-UUID map and source path, any platform-specific context the sub-agent needs (e.g. RLS-replacement clauses for Lovable), and tells the sub-agent to follow the same `in_progress` \u2192 `completed`/`failed` ritual for every item it owns.\n - `spawnCodingSubagents` **must be the only tool call in that turn.** It blocks until every sub-agent finishes; there is no \"while waiting\" from your perspective. Other tool calls in the same turn race on the shared checklist and corrupt state. After it returns, read the checklist and handle `failed` items sequentially. If the tool itself errors, surface it and fall back to sequential \u2014 or fail the affected items with `sub-agent orchestration failed: <error>`.\n\n## When emitting code\n\n- **Server.** Default-export one `api({ name, integrations, input, output, run })` from `@superblocksteam/sdk-api`. The `name` and the registry key in `server/apis/index.ts` must equal `<ApiName>` verbatim \u2014 the client calls `useApi(\"<ApiName>\")` by that exact string. Preserve the external response shape exactly so the migrated frontend keeps working. Use parameterized SQL only (`$N`); zero string interpolations. Throw the error classes the sdk-api README documents instead of returning HTTP status codes.\n- **Client.** Replace the source's data hooks with `useApiData` (reads) or `useApi` (mutations) keyed by `<ApiName>`. **Import the typed wrappers from the template, not the library directly:** `import { useApi } from \"@/hooks/useApi.js\"`, `import { useApiData } from \"@/hooks/useApiData.js\"`, `import { executeApi } from \"@/lib/executeApi.js\"`. They give compile-time inference from `ApiRegistry`. Drop the source's generated client packages, `QueryClientProvider`, base-URL or auth-token getters, and any auth-context plumbing \u2014 Superblocks handles all of that. shadcn/form + react-hook-form + zod stays. Follow the loading-state guidance in `superblocks-frontend/SKILL.md`.\n- **ESM imports.** Every relative import in emitted code uses an explicit `.js` extension (`./api.js`, `../hooks/useApi.js`) \u2014 even though the source is `.ts`. The template is ESM; bare specifiers fail at runtime.\n- **Theme port.** When carrying over the source's theme, copy the existing color values **as-is** into `client/index.css`'s `:root` block. HSL values written `hsl(222 47% 11%)` (CSS Color Level 4 space-separated form) work directly with the `@theme inline` mapping in Tailwind v4. **Do not convert to OKLCH** unless the source already uses OKLCH \u2014 converting introduces drift and is a common visual-regression source.\n- **Visual fidelity.** JSX structure, Tailwind classes, shadcn variants, custom CSS, theme tokens, fonts, and layout containers must transfer over **unchanged** from the source page. The only things that change in a page port are the data hooks, the auth touchpoints, and the router primitives. Do not \"improve\" markup, swap class names, or substitute components. If the diff between source and target page goes beyond data + auth + routing, you are over-editing \u2014 back out the cosmetic changes.\n- **Sub-agents must not** call `searchIntegrations`, `openIntegrationSetup`, or any integration-resolution tool. If they hit a kind missing from the map, fail the item with `unresolved integration kind: <kind>` and let the main agent handle it on return.\n\n## Done\n\nStop only when every checklist item is `completed` or `failed`. Report the counts plus any platform-specific findings the per-platform guide asks you to surface (e.g. leaked secrets, replaced RLS policies, unsupported realtime features). Do not claim success \u2014 defer verification to the user running the app.\n";
2
+ //# sourceMappingURL=skill.generated.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill.generated.d.ts","sourceRoot":"","sources":["../../../../../src/ai-service/skills/system/third-party-migration/skill.generated.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,s9bA+GnB,CAAC"}
@@ -0,0 +1,115 @@
1
+ // Auto-generated from src/ai-service/skills/system/third-party-migration/SKILL.md
2
+ // Do not edit directly - edit the .md file instead
3
+ export const content = `---
4
+ name: third-party-migration
5
+ description: |
6
+ Migrate a third-party app (Replit, Lovable, v0, or similar) into a Superblocks 3.0 full-stack app.
7
+ Load when the user asks to migrate, import, or port an external app — or when the source tree contains hallmarks of a supported platform (\`replit.md\` / \`.replit\`, \`src/integrations/supabase/\`, \`supabase/functions/\`, \`lovable-tagger\`, an \`app/\` directory with \`next.config.*\` and \`"use client"\` / \`"use server"\` directives, etc.) and the user wants it turned into a Superblocks app.
8
+ readOnly: true
9
+ metadata:
10
+ author: superblocks
11
+ version: "1.0"
12
+ ---
13
+
14
+ # Third-Party App → Superblocks 3.0 Migration
15
+
16
+ Port a user-provided external app into the Superblocks fullstack app you are running inside (template: \`app-fullstack\`). The source tree is **read-only material**. All edits land in the target app under \`server/\` and \`client/\`.
17
+
18
+ This file is the migration framework. **Per-platform mapping rules live in sibling files** — load the right one before you start mapping.
19
+
20
+ ## Identify the source platform
21
+
22
+ Match the source tree against these signals, then read the matching reference file in this folder. Read it once, up-front — it tells you what shapes to look for and how each maps to Superblocks.
23
+
24
+ - **Replit** — \`replit.md\`, \`.replit\`, \`artifacts/\`, an Express server with an Orval-generated client. → load \`replit.md\`.
25
+ - **Lovable** — \`src/integrations/supabase/client.ts\`, \`supabase/config.toml\`, \`supabase/functions/\`, \`supabase/migrations/\`, \`lovable-tagger\` in \`vite.config.ts\`. → load \`lovable.md\`.
26
+ - **v0** — \`app/<segment>/page.tsx\` (Next.js App Router) plus \`next.config.{js,mjs,ts}\` and \`next\` in \`package.json\`, files with \`"use client"\` / \`"use server"\` directives, \`next/link\` / \`next/navigation\` imports, \`components/ui/\` with shadcn primitives. → load \`v0.md\`.
27
+ - **Ambiguous or neither** — stop and ask the user which platform the source came from. Do not guess. It is possible that it is No Platform. In this case, follow the general guidelines in this document and ask user questions for any ambiguity.
28
+
29
+ The framework below applies to every platform; the platform file fills in the source-specific mapping.
30
+
31
+ ## Target layout
32
+
33
+ The app you are running inside looks like this. Do not invent new top-level directories.
34
+
35
+ \`\`\`
36
+ client/
37
+ App.tsx — root with <AppProvider> + <Outlet />
38
+ router.tsx — react-router v7, lazy imports
39
+ index.css — Tailwind v4 + theme tokens
40
+ hooks/
41
+ useApi.ts — typed wrapper around useTypedApi<ApiRegistry>
42
+ useApiData.ts — typed wrapper around useTypedApiData<ApiRegistry>
43
+ lib/executeApi.ts — non-React typed executeApi
44
+ pages/<Name>/index.tsx
45
+ components/ui/ — shadcn primitives (do not modify)
46
+ server/
47
+ apis/
48
+ index.ts — registry: \`const apis = { ApiName: ... } as const;\`
49
+ <ApiName>/api.ts
50
+ \`\`\`
51
+
52
+ ## Universal mapping (applies to every source)
53
+
54
+ These hold regardless of source platform. Per-platform specifics layer on top.
55
+
56
+ - APIs are addressed by \`name\` via the registry — there is no URL path. Within \`api()\`:
57
+ - All inputs (whatever shape the source had — body, query, params, function args) → one unified \`input\` Zod schema; destructure inside \`run(ctx, { ... })\`.
58
+ - The handler's response → \`return { ... }\` from \`run\`. The \`output\` schema validates it automatically; do not \`safeParse\` by hand.
59
+ - Auth → \`ctx.user\` (\`userId\`, \`email\`, \`name\`, \`groups\`, \`customClaims\`). Auth is platform-managed; drop the source's auth flows entirely.
60
+ - Errors → throw the \`SdkError\` subtypes the sdk-api README documents (\`InputValidationError\`, \`OutputValidationError\`, \`IntegrationError\`, \`ExecutionError\`). Never invent error classes or return HTTP status codes.
61
+ - DB clients (\`pg\`, \`knex\`, \`prisma\`, Drizzle, \`supabase.from(...)\`) → declare in \`integrations: { db: postgres(DB_INTEGRATION_ID) }\` and call \`ctx.integrations.db.query(sql, ZodSchema, params, { label: "..." })\` / \`.execute(...)\`. Parameterized SQL only. Hold integration UUIDs in module-level \`const\`s, not literals scattered through \`run\`.
62
+ - External HTTP (\`axios\`, \`fetch\`, third-party SDKs) → declared integration + \`ctx.integrations.<name>.apiRequest({ method, path, body }, { response: ZodSchema })\`.
63
+ - \`process.env.*\` / \`import.meta.env.*\` / \`Deno.env.get(...)\` → \`ctx.env\`. Logging → \`ctx.log.info/warn/error/debug(msg, data?)\`.
64
+ - Server bootstrapping (\`app.listen\`, CORS, route grouping, middleware setup, \`Deno.serve\`) → drop entirely. The platform handles it.
65
+ - **Each frontend page → one Superblocks page** at \`client/pages/<Name>/index.tsx\`, wired into \`client/router.tsx\`.
66
+ - **Each backend data source (DB, REST client, S3, ...) → one Superblocks integration** referenced by UUID. Credentials live on the integration, never in code.
67
+
68
+ ## Authoritative references (read just-in-time, not up front)
69
+
70
+ - \`node_modules/@superblocksteam/sdk-api/README.md\` and \`src/index.ts\` — the server \`api()\` contract and the full list of factory names. **Never invent factory names.** If a required file is missing, mark the affected checklist item \`failed\` with the missing path as the reason.
71
+ - Per-integration READMEs under \`node_modules/@superblocksteam/sdk-api/src/integrations/<kind>/\` — read once, when you first emit an API that uses that integration.
72
+ - \`skills/system/superblocks-frontend/SKILL.md\` — the client contract (\`useApi\` / \`useApiData\` / \`executeApi\` from \`@superblocksteam/library\`).
73
+
74
+ > ⚠️ **Never** load \`skills/system/superblocks-api/SKILL.md\`. It describes a different, block-based API pattern that is incompatible with the fullstack template's \`sdk-api\`. Mixing them produces code that does not compile.
75
+
76
+ ## Non-negotiables
77
+
78
+ 1. **Track everything in the checklist.** The **first tool call after exiting plan mode** or **during build mode, before building** is \`build_manageChecklist\` to seed. Before every per-item edit, \`update <itemId> in_progress\`; after, \`update <itemId> completed\` (or \`failed\` with a concrete \`failureReason\`). If you are about to write code and the checklist is empty, stale, or missing the item you are working on, **stop and fix the checklist first** — the orchestration depends on it. Free-text status reports are not a substitute.
79
+ 2. **Discover before you edit.** Inventory routes, pages, data sources, env vars, _and visual surface_ (theme tokens, \`index.css\`, custom CSS, font setup, layout shells) across the entire source tree before writing any code. The platform file tells you what shapes to look for.
80
+ 3. **Ask before guessing.** Multiple integrations of the same kind, missing integrations, unsupported data sources, or any platform-specific ambiguity → stop and \`askMultiChoice\`. Never pick for the user. The platform file lists ambiguities specific to that source.
81
+ 4. **Preserve visual identity.** The migrated app must look and feel like the source. Carry over Tailwind config, shadcn theme tokens, \`index.css\` / \`globals.css\`, custom CSS modules, fonts, spacing, color palette, and layout shells (header/sidebar/grid). shadcn/ui components stay as-is. Do **not** redesign, restyle, or "clean up" while porting — visual regressions are bugs, not improvements. If the user wants a redesign, that is a separate task after migration.
82
+ 5. **Never copy secrets.** DSN strings, API keys, anon/service-role keys, JWT secrets, env-var lookups for credentials — none move into the target tree. Integration UUIDs replace them. Surface every leaked secret you find (especially client-side \`VITE_*\` / \`NEXT_PUBLIC_*\` keys) in the discovery summary so the user can rotate them.
83
+ 6. **No \`// TODO\`s.** Anything you can't finish deterministically becomes a \`failed\` checklist item with a concrete \`failureReason\`.
84
+ 7. **Don't scaffold.** If \`server/apis/index.ts\` or \`client/router.tsx\` doesn't already exist, you're in the wrong app — stop and surface this.
85
+ 8. **Don't fabricate a backend.** If the source is genuinely frontend-only, the migrated app should also be frontend-only. Don't invent APIs to "complete" the architecture.
86
+
87
+ ## Workflow
88
+
89
+ 1. **Locate the source.** If the user gave a path, use it. Otherwise look in the working tree for the platform signals listed above. If ambiguous, ask.
90
+ 2. **Load the platform guide.** Read \`replit.md\`, \`lovable.md\`, or \`v0.md\` based on what you found. Do not start mapping before you've read it — it documents the source's shape and how each piece translates.
91
+ 3. **Inventory.** Following the platform guide's discovery checklist, enumerate every route/handler, page, data source, env var, secret, and visual asset in the source tree. Surface a one-paragraph summary plus an itemized list of integrations and unsupported features before writing anything. If the source has bespoke styling, seed a \`setup_theme\` checklist item to port it.
92
+ 4. **Resolve integrations.** For each data source kind: call \`searchIntegrations\` (filter by \`type\`). One match → bind it. Multiple → ask the user which. Zero → ask whether to create one; if yes, use \`listAvailableIntegrationTypes\` (if needed) and \`openIntegrationSetup\`, then ask the user explicitly whether they saved or cancelled before re-searching. Resolution is **blocking** — the checklist cannot be seeded until every kind maps to a UUID, is explicitly deferred, or has been confirmed unsupported.
93
+ 5. **Seed the checklist** via \`build_manageChecklist\`. One \`api_<ApiName>\` per backend interaction, one \`frontend_<PageName>\` per page, plus \`setup_router\`, \`setup_registry\`, \`setup_cleanup\`, and any \`setup_theme\` / \`setup_storage\` / \`unsupported_<feature>\` items the platform guide tells you to add. Print the count as a sanity check; if it looks wrong, re-check discovery.
94
+ 6. **Execute.** Every item follows the same ritual — no exceptions:
95
+ - **Before touching files:** \`build_manageChecklist update <itemId> in_progress\`.
96
+ - **Emit / edit the files** for that item.
97
+ - **After the edit lands:** \`build_manageChecklist update <itemId> completed\` (or \`failed\` with a concrete \`failureReason\`).
98
+ - You are not done with an item until its checklist entry has moved to a terminal state. Do not batch updates at the end; update as you go.
99
+ - **For parallelizable work:** call \`spawnCodingSubagents\` with batches of tasks. Each batch's \`instructions\` names exact \`itemId\`s, includes the integration-UUID map and source path, any platform-specific context the sub-agent needs (e.g. RLS-replacement clauses for Lovable), and tells the sub-agent to follow the same \`in_progress\` → \`completed\`/\`failed\` ritual for every item it owns.
100
+ - \`spawnCodingSubagents\` **must be the only tool call in that turn.** It blocks until every sub-agent finishes; there is no "while waiting" from your perspective. Other tool calls in the same turn race on the shared checklist and corrupt state. After it returns, read the checklist and handle \`failed\` items sequentially. If the tool itself errors, surface it and fall back to sequential — or fail the affected items with \`sub-agent orchestration failed: <error>\`.
101
+
102
+ ## When emitting code
103
+
104
+ - **Server.** Default-export one \`api({ name, integrations, input, output, run })\` from \`@superblocksteam/sdk-api\`. The \`name\` and the registry key in \`server/apis/index.ts\` must equal \`<ApiName>\` verbatim — the client calls \`useApi("<ApiName>")\` by that exact string. Preserve the external response shape exactly so the migrated frontend keeps working. Use parameterized SQL only (\`$N\`); zero string interpolations. Throw the error classes the sdk-api README documents instead of returning HTTP status codes.
105
+ - **Client.** Replace the source's data hooks with \`useApiData\` (reads) or \`useApi\` (mutations) keyed by \`<ApiName>\`. **Import the typed wrappers from the template, not the library directly:** \`import { useApi } from "@/hooks/useApi.js"\`, \`import { useApiData } from "@/hooks/useApiData.js"\`, \`import { executeApi } from "@/lib/executeApi.js"\`. They give compile-time inference from \`ApiRegistry\`. Drop the source's generated client packages, \`QueryClientProvider\`, base-URL or auth-token getters, and any auth-context plumbing — Superblocks handles all of that. shadcn/form + react-hook-form + zod stays. Follow the loading-state guidance in \`superblocks-frontend/SKILL.md\`.
106
+ - **ESM imports.** Every relative import in emitted code uses an explicit \`.js\` extension (\`./api.js\`, \`../hooks/useApi.js\`) — even though the source is \`.ts\`. The template is ESM; bare specifiers fail at runtime.
107
+ - **Theme port.** When carrying over the source's theme, copy the existing color values **as-is** into \`client/index.css\`'s \`:root\` block. HSL values written \`hsl(222 47% 11%)\` (CSS Color Level 4 space-separated form) work directly with the \`@theme inline\` mapping in Tailwind v4. **Do not convert to OKLCH** unless the source already uses OKLCH — converting introduces drift and is a common visual-regression source.
108
+ - **Visual fidelity.** JSX structure, Tailwind classes, shadcn variants, custom CSS, theme tokens, fonts, and layout containers must transfer over **unchanged** from the source page. The only things that change in a page port are the data hooks, the auth touchpoints, and the router primitives. Do not "improve" markup, swap class names, or substitute components. If the diff between source and target page goes beyond data + auth + routing, you are over-editing — back out the cosmetic changes.
109
+ - **Sub-agents must not** call \`searchIntegrations\`, \`openIntegrationSetup\`, or any integration-resolution tool. If they hit a kind missing from the map, fail the item with \`unresolved integration kind: <kind>\` and let the main agent handle it on return.
110
+
111
+ ## Done
112
+
113
+ Stop only when every checklist item is \`completed\` or \`failed\`. Report the counts plus any platform-specific findings the per-platform guide asks you to surface (e.g. leaked secrets, replaced RLS policies, unsupported realtime features). Do not claim success — defer verification to the user running the app.
114
+ `;
115
+ //# sourceMappingURL=skill.generated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill.generated.js","sourceRoot":"","sources":["../../../../../src/ai-service/skills/system/third-party-migration/skill.generated.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,mDAAmD;AAEnD,MAAM,CAAC,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+GtB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const content = "# v0-specific mapping\n\nThis is a per-platform reference loaded from `SKILL.md`. The framework (target layout, universal mapping, non-negotiables, workflow, code-emission rules) lives there. This file documents only what is specific to a v0 source.\n\n> v0 (Vercel) emits a Next.js App Router project the vast majority of the time. The Superblocks 3.0 fullstack template is **Vite + react-router**, not Next.js, so every page port involves translating Next.js primitives (server components, file-system routing, `next/*` imports) into the Vite/react-router shape. Treat that translation as the core of the migration; the data-mapping side is usually thin because v0 sources rarely have real backends.\n\n## Where the source lives\n\nDefinitive marker: `app/layout.tsx` exports a `metadata` object with `generator: 'v0.app'`. If you find that, it is a v0 export.\n\nStrong supporting signals:\n\n- `app/` directory at the repo root containing `page.tsx` / `layout.tsx`, plus `next.config.{js,mjs,ts}` and `next` listed as a dependency in `package.json`.\n- `components.json` at the repo root (shadcn CLI config) with `\"style\": \"new-york\"` and `\"iconLibrary\": \"lucide\"`.\n- `components/ui/` with shadcn primitives and a heavy roster of `@radix-ui/react-*` packages.\n- `next.config.mjs` with `images: { unoptimized: true }` and often `typescript: { ignoreBuildErrors: true }` (v0 escape hatches; surface both as warnings since they hide real issues).\n- Frequent imports from `next/link`, `next/navigation`, `next/image`, `next/font`, and a `<Analytics />` from `@vercel/analytics/next` in the layout.\n- Standard placeholder assets in `public/`: `placeholder.svg`, `placeholder.jpg`, `placeholder-logo.{svg,png}`, `placeholder-user.jpg`. Source code often references these.\n- A `styles/globals.css` AND an `app/globals.css` may both exist. The active one is whichever the layout imports (typically `app/globals.css`); the other is dead code from the shadcn scaffold. Surface this in discovery so the user knows.\n\nIf the user gave a path, use it. Otherwise look for the markers above in the working tree. If ambiguous (for example the source is plain Next.js with no `generator: 'v0.app'` and no `components.json`), ask before assuming v0 conventions, since unrelated Next.js apps can have their own non-trivial server logic that the v0 mapping below underestimates.\n\n## Typical shape (hints, not rules)\n\nUse these as starting points; re-verify against the actual source tree on every migration.\n\n- **Frontend**: Next.js 14/15 App Router + React 18/19 + Tailwind (often v4 with `@import 'tailwindcss'` and OKLCH theme tokens in `app/globals.css`) + shadcn/ui (under `components/ui/`) + `lucide-react`. Pages live at `app/<segment>/page.tsx`; layouts at `app/<segment>/layout.tsx`. Route groups use `(group-name)/` directories. Dynamic segments use `[param]` directories. Forms via `react-hook-form` + `zod` are common but not universal.\n- **Theming**: `next-themes` with a `<ThemeProvider>` in `app/layout.tsx` is the default v0 dark-mode wiring. Translate to a custom provider or drop and pin a theme; `next-themes` itself does not work outside Next.\n- **Fonts**: `next/font/google` loading Geist + Geist_Mono is the default v0 font stack (with CSS variables `--font-geist-sans` / `--font-geist-mono`). Re-load via `@import` from Google Fonts in `client/index.css` and re-bind the variables in Tailwind v4 tokens.\n- **Analytics**: `<Analytics />` from `@vercel/analytics/next` in the root layout is boilerplate. Drop entirely \u2014 there is no Superblocks equivalent and the component is Vercel-platform-bound.\n- **Backend (when present)** \u2014 pick whichever the source actually uses:\n - **Server Actions**: functions or files with `\"use server\"`, often in `app/actions.ts` or co-located with the page. Called from client components via form actions or direct invocation.\n - **API Routes**: `app/api/<name>/route.ts` exporting `GET`, `POST`, etc. handlers.\n - **Server Component data fetching**: `async function Page()` with inline `fetch(...)` or DB calls. The result is rendered server-side and shipped as HTML on first load.\n - **Third-party APIs called from the client** (Stripe, OpenAI, AI SDK) with secrets that should never have been in `NEXT_PUBLIC_*`.\n - **No backend at all**: pure UI app with mocked data or `localStorage`. The framework's \"Don't fabricate a backend\" rule applies; the migrated app stays frontend-only.\n- **Auth**: occasionally a `middleware.ts` with NextAuth / Clerk / hand-rolled session checks. Frequently absent in v0-only outputs.\n- **Storage**: occasionally `@vercel/blob` or third-party uploads. Often absent.\n- **Streaming / AI**: AI SDK (`ai`, `@ai-sdk/openai`) with streamed responses sometimes shows up in v0 outputs. **Superblocks has no streaming-response equivalent in this template** \u2014 flag and degrade to one-shot calls; do not silently drop.\n\n## Discovery checklist\n\nIn addition to the framework's discovery requirements, for a v0 source enumerate:\n\n- Every page (`app/**/page.tsx`) and its dynamic-segment params.\n- Every layout (`app/**/layout.tsx`) and what it provides (theme provider, header, sidebar, fonts).\n- Every Server Action (`\"use server\"` functions or files), grouped by what they touch.\n- Every API Route (`app/api/**/route.ts`), grouped by HTTP method.\n- Every Server Component that fetches data inline (look for `async function` page/layout exports calling `fetch`, ORMs, or DB clients).\n- Every `next/*` import in use (`next/link`, `next/navigation`, `next/image`, `next/font`, `next/headers`, `next/cookies`, `next/cache`).\n- Every external HTTP call and the API it targets (in client components, Server Actions, and Server Components).\n- Every env var read (`process.env.*`, `import.meta.env.*`), separated into \"credentials/secrets\" (move to integrations) and \"config\" (`ctx.env`).\n- Every middleware (`middleware.ts`) \u2014 usually drops, but capture what it was doing so the equivalent can be implemented at the API layer if needed.\n- Theme port surface: `tailwind.config.{js,ts}`, `app/globals.css`, font setup via `next/font`, custom CSS modules.\n\nIf the discovery summary doesn't tell you what every API will look like and how every page changes shape, you haven't discovered enough.\n\n## Core mapping\n\n- **Each page (`app/.../page.tsx`) \u2192 one Superblocks page** at `client/pages/<Name>/index.tsx`, wired into `client/router.tsx`. Route groups (`(name)/`) collapse into nested routes; dynamic segments (`[id]/`) become `:id` params under react-router v7.\n- **Each Server Component that fetches data inline \u2192 one Superblocks API + a client component**. The page becomes a normal client component that calls `useApiData(\"<ApiName>\")`. The inline `fetch` / DB call moves into `server/apis/<ApiName>/api.ts`. There is no server-rendered first paint in this template; the page renders with a loading state and hydrates from the API.\n- **Each Server Action (`\"use server\"` function) \u2192 one Superblocks API** at `server/apis/<ActionName>/api.ts`, called from the client via `useApi(\"<ActionName>\")` (mutations) or `executeApi`. Form-action wiring (`<form action={...}>`) becomes a normal `onSubmit` handler that calls the API. `revalidatePath` / `revalidateTag` calls drop; refetch via the returned hook's invalidation pattern instead.\n- **Each API Route (`app/api/<name>/route.ts`) \u2192 one Superblocks API** at `server/apis/<NameInPascalCase>/api.ts`. Route handlers exporting `GET`, `POST`, etc. that share a path collapse into one `api()` keyed by method on the input schema, or split into separate APIs per method. Pick one shape and stay consistent. `Request` / `Response` / `NextResponse` primitives drop entirely; the platform handles HTTP.\n- **Each external HTTP call \u2192 integration**. `fetch(\"https://api.openai.com/...\")` becomes a declared integration plus `apiRequest(...)`. Secrets from `process.env`, `NEXT_PUBLIC_*`, hardcoded keys, or AI SDK provider configs move into the integration definition. A `NEXT_PUBLIC_OPENAI_API_KEY` on the client side is also a security finding worth surfacing in the migration summary.\n- **DB clients** (Drizzle, Prisma, `@vercel/postgres`, `@neondatabase/serverless`, `pg`) \u2192 declare in `integrations: { db: postgres(DB_INTEGRATION_ID) }` and call `ctx.integrations.db.query/execute(...)` with parameterized SQL. Read schema from any included migration files; do not run them against the target integration without asking.\n- **`next/link`** \u2192 `import { Link } from \"react-router\"` (v7). The `href` prop becomes `to`.\n- **`next/navigation`** \u2192 react-router v7 hooks: `useRouter()` becomes `useNavigate()`, `usePathname()` becomes `useLocation().pathname`, `useSearchParams()` stays `useSearchParams()` from `react-router` (similar API but not identical, verify call sites).\n- **`next/image`** \u2192 standard `<img>` with the same `src`/`alt`. Drop the `width`/`height`/`priority` props or convert to inline styles. If the source relied on Next's image optimization (remote loaders, blur placeholders), flag as a `failed` item with `failureReason: \"next/image optimization on <usage> has no Superblocks equivalent in this template\"`.\n- **`next/font/google`** \u2192 **never just delete the import**. The font has to be re-loaded somewhere or it disappears from the migrated app and everything renders in the browser fallback. Three required steps; all three are mandatory:\n - **(a) Load the font.** Pick one shape and stay consistent within the migration:\n 1. **CDN `@import` (default; zero new deps).** At the top of `client/index.css`: `@import url('https://fonts.googleapis.com/css2?family=<Family>:wght@<weights>&display=swap');`. Bring over both the sans and mono family the source used.\n 2. **Self-hosted via npm.** For Geist specifically: `pnpm add geist`, then `import 'geist/font/sans'; import 'geist/font/mono';` from `client/main.tsx` (it injects `@font-face` and exposes `--font-geist-sans` / `--font-geist-mono`). For other Google fonts: `pnpm add @fontsource-variable/<family>` and `import '@fontsource-variable/<family>';`.\n - **(b) Bind it in `@theme`.** The starter `client/index.css` ships with no `--font-sans` token, so even after loading the font you must add `@theme { --font-sans: '<Family>', ui-sans-serif, system-ui, sans-serif; --font-mono: '<MonoFamily>', ui-monospace, monospace; }` (or a `var(--font-geist-sans)` reference for the self-hosted Geist case). Without this, Tailwind's `font-sans` keeps using the browser default.\n - **(c) Drop the source's `next/font` import and the `className={font.variable}` wiring** on `<html>` / `<body>` \u2014 the Tailwind token from (b) carries the variable forward instead.\n\n The most common port failure is silently dropping (a): the agent removes the `next/font` import as part of \"drop Next-isms\" and never adds a replacement, so the migrated app renders in system fonts. (b) without (a) is just as bad. **Verify by inspecting a heading in DevTools and confirming `font-family` resolves to the source's family, not `ui-sans-serif`/system fallback.** If a font is intentionally not carried over, surface it as a `failed` item with a reason; do not drop silently.\n\n- **`next/font/local`** \u2192 copy the font files to `client/public/fonts/`, write matching `@font-face` blocks in `client/index.css`, and bind the family name in `@theme`. Preserve the original `font-display`, weight, and style.\n- **`app/layout.tsx`** \u2192 fold into `client/App.tsx` (the root shell with `<AppProvider>` + `<Outlet />`) or into specific page wrappers, depending on what each layout provided. Theme providers, font loaders, and metadata setters from layouts collapse into the App shell or `client/index.css`. The `<html>`/`<body>` shell drops; the platform owns it.\n- **`app/loading.tsx`** \u2192 component-level loading state in the page, driven by `useApiData`'s loading boolean. There is no implicit Suspense boundary in this template.\n- **`app/error.tsx`** \u2192 react-router v7 `errorElement` on the route, or a try/catch around the API hook with a fallback render.\n- **`metadata` exports / `generateMetadata`** \u2192 drop, or set `document.title` via `useEffect` if the page title matters. Open Graph / Twitter card metadata has no equivalent here.\n- **`middleware.ts`** \u2192 drop. If it was enforcing auth, the equivalent enforcement happens server-side in each `api()` via `ctx.user`. If it was rewriting URLs, surface to the user \u2014 Superblocks has no URL-rewriting layer.\n- **`\"use client\"` / `\"use server\"` directives** \u2192 drop. Every component in the Superblocks template is a client component; every server-side function lives in `server/apis/`. There is no RSC boundary to mark.\n- **`next-themes`** \u2192 translate to a small custom provider that toggles a `class=\"dark\"` on `document.documentElement` and persists to `localStorage`, or drop entirely and pin the theme. The `next-themes` package depends on Next-specific hydration behavior and should not be carried over as-is. Preserve the source's CSS variable scheme (`:root` / `.dark` blocks in `globals.css`) \u2014 only the JS toggle changes.\n- **`@vercel/analytics`** \u2192 drop. The `<Analytics />` component and `track()` helper are bound to the Vercel platform and have no equivalent here. Note in the migration summary if the source relied on it.\n\n## Ask-before-guessing \u2014 v0 specifics\n\n- \"The source uses Server Actions / API Routes calling `<DB client>` against `<DSN env var>`. I'll bind to a Postgres integration; which one, or do you want to create a new one?\"\n- \"I see external HTTP calls to `<host>` with credentials in `<env var>`. Bind to an integration of type `<kind>`?\"\n- \"I see `<feature>` (streaming AI responses, edge runtime, ISR, etc.) which has no equivalent in this template. Drop, degrade, or stop and let you decide?\"\n- \"I see Server Components fetching data inline. The migrated app cannot server-render; the page will hydrate from the API with a loading state. Is that acceptable, or do you want a particular skeleton/loading shape?\"\n- \"The source has a `middleware.ts` doing `<auth/redirect/rewrite>`. I'll drop it and enforce equivalent rules in each API via `ctx.user`. Is that the right user-claim mapping?\"\n\n## Page port \u2014 what changes vs. what doesn't\n\nFor each v0 page, only these change:\n\n- **Data hooks**: Server Component inline fetch / Server Action calls / API Route fetches \u2192 `useApi` / `useApiData`.\n- **Auth touchpoints**: NextAuth / Clerk / `middleware.ts` checks \u2192 platform-managed (drop the provider; consume `ctx.user` server-side).\n- **Router primitives**: `next/link`, `next/navigation`, file-system routing \u2192 react-router v7 (`Link`, `useNavigate`, `useLocation`, explicit route definitions in `client/router.tsx`).\n- **Asset primitives**: `next/image` \u2192 `<img>`, `next/font` \u2192 CSS-loaded fonts.\n- **Directives**: `\"use client\"` / `\"use server\"` removed.\n\nEverything else (JSX structure, Tailwind classes, shadcn variants, custom CSS, theme tokens, layout containers) transfers unchanged. If the diff goes beyond data + auth + routing + asset/font primitives + directive removal, you are over-editing.\n\n## Done \u2014 v0 specifics\n\nIn the final report, additionally surface:\n\n- Any unsupported features that became `failed` items (streaming AI responses, server-side rendering, ISR, `next/image` optimization, edge runtime, route rewrites, etc.).\n- Any `NEXT_PUBLIC_*` secrets found on the client side (these should be rotated even after migration).\n- The list of `next/*` imports that were translated, so the user can spot-check them in the migrated tree.\n";
2
+ //# sourceMappingURL=v0.generated.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v0.generated.d.ts","sourceRoot":"","sources":["../../../../../src/ai-service/skills/system/third-party-migration/v0.generated.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,47eAkHnB,CAAC"}
@@ -0,0 +1,118 @@
1
+ // Auto-generated from src/ai-service/skills/system/third-party-migration/v0.md
2
+ // Do not edit directly - edit the .md file instead
3
+ export const content = `# v0-specific mapping
4
+
5
+ This is a per-platform reference loaded from \`SKILL.md\`. The framework (target layout, universal mapping, non-negotiables, workflow, code-emission rules) lives there. This file documents only what is specific to a v0 source.
6
+
7
+ > v0 (Vercel) emits a Next.js App Router project the vast majority of the time. The Superblocks 3.0 fullstack template is **Vite + react-router**, not Next.js, so every page port involves translating Next.js primitives (server components, file-system routing, \`next/*\` imports) into the Vite/react-router shape. Treat that translation as the core of the migration; the data-mapping side is usually thin because v0 sources rarely have real backends.
8
+
9
+ ## Where the source lives
10
+
11
+ Definitive marker: \`app/layout.tsx\` exports a \`metadata\` object with \`generator: 'v0.app'\`. If you find that, it is a v0 export.
12
+
13
+ Strong supporting signals:
14
+
15
+ - \`app/\` directory at the repo root containing \`page.tsx\` / \`layout.tsx\`, plus \`next.config.{js,mjs,ts}\` and \`next\` listed as a dependency in \`package.json\`.
16
+ - \`components.json\` at the repo root (shadcn CLI config) with \`"style": "new-york"\` and \`"iconLibrary": "lucide"\`.
17
+ - \`components/ui/\` with shadcn primitives and a heavy roster of \`@radix-ui/react-*\` packages.
18
+ - \`next.config.mjs\` with \`images: { unoptimized: true }\` and often \`typescript: { ignoreBuildErrors: true }\` (v0 escape hatches; surface both as warnings since they hide real issues).
19
+ - Frequent imports from \`next/link\`, \`next/navigation\`, \`next/image\`, \`next/font\`, and a \`<Analytics />\` from \`@vercel/analytics/next\` in the layout.
20
+ - Standard placeholder assets in \`public/\`: \`placeholder.svg\`, \`placeholder.jpg\`, \`placeholder-logo.{svg,png}\`, \`placeholder-user.jpg\`. Source code often references these.
21
+ - A \`styles/globals.css\` AND an \`app/globals.css\` may both exist. The active one is whichever the layout imports (typically \`app/globals.css\`); the other is dead code from the shadcn scaffold. Surface this in discovery so the user knows.
22
+
23
+ If the user gave a path, use it. Otherwise look for the markers above in the working tree. If ambiguous (for example the source is plain Next.js with no \`generator: 'v0.app'\` and no \`components.json\`), ask before assuming v0 conventions, since unrelated Next.js apps can have their own non-trivial server logic that the v0 mapping below underestimates.
24
+
25
+ ## Typical shape (hints, not rules)
26
+
27
+ Use these as starting points; re-verify against the actual source tree on every migration.
28
+
29
+ - **Frontend**: Next.js 14/15 App Router + React 18/19 + Tailwind (often v4 with \`@import 'tailwindcss'\` and OKLCH theme tokens in \`app/globals.css\`) + shadcn/ui (under \`components/ui/\`) + \`lucide-react\`. Pages live at \`app/<segment>/page.tsx\`; layouts at \`app/<segment>/layout.tsx\`. Route groups use \`(group-name)/\` directories. Dynamic segments use \`[param]\` directories. Forms via \`react-hook-form\` + \`zod\` are common but not universal.
30
+ - **Theming**: \`next-themes\` with a \`<ThemeProvider>\` in \`app/layout.tsx\` is the default v0 dark-mode wiring. Translate to a custom provider or drop and pin a theme; \`next-themes\` itself does not work outside Next.
31
+ - **Fonts**: \`next/font/google\` loading Geist + Geist_Mono is the default v0 font stack (with CSS variables \`--font-geist-sans\` / \`--font-geist-mono\`). Re-load via \`@import\` from Google Fonts in \`client/index.css\` and re-bind the variables in Tailwind v4 tokens.
32
+ - **Analytics**: \`<Analytics />\` from \`@vercel/analytics/next\` in the root layout is boilerplate. Drop entirely — there is no Superblocks equivalent and the component is Vercel-platform-bound.
33
+ - **Backend (when present)** — pick whichever the source actually uses:
34
+ - **Server Actions**: functions or files with \`"use server"\`, often in \`app/actions.ts\` or co-located with the page. Called from client components via form actions or direct invocation.
35
+ - **API Routes**: \`app/api/<name>/route.ts\` exporting \`GET\`, \`POST\`, etc. handlers.
36
+ - **Server Component data fetching**: \`async function Page()\` with inline \`fetch(...)\` or DB calls. The result is rendered server-side and shipped as HTML on first load.
37
+ - **Third-party APIs called from the client** (Stripe, OpenAI, AI SDK) with secrets that should never have been in \`NEXT_PUBLIC_*\`.
38
+ - **No backend at all**: pure UI app with mocked data or \`localStorage\`. The framework's "Don't fabricate a backend" rule applies; the migrated app stays frontend-only.
39
+ - **Auth**: occasionally a \`middleware.ts\` with NextAuth / Clerk / hand-rolled session checks. Frequently absent in v0-only outputs.
40
+ - **Storage**: occasionally \`@vercel/blob\` or third-party uploads. Often absent.
41
+ - **Streaming / AI**: AI SDK (\`ai\`, \`@ai-sdk/openai\`) with streamed responses sometimes shows up in v0 outputs. **Superblocks has no streaming-response equivalent in this template** — flag and degrade to one-shot calls; do not silently drop.
42
+
43
+ ## Discovery checklist
44
+
45
+ In addition to the framework's discovery requirements, for a v0 source enumerate:
46
+
47
+ - Every page (\`app/**/page.tsx\`) and its dynamic-segment params.
48
+ - Every layout (\`app/**/layout.tsx\`) and what it provides (theme provider, header, sidebar, fonts).
49
+ - Every Server Action (\`"use server"\` functions or files), grouped by what they touch.
50
+ - Every API Route (\`app/api/**/route.ts\`), grouped by HTTP method.
51
+ - Every Server Component that fetches data inline (look for \`async function\` page/layout exports calling \`fetch\`, ORMs, or DB clients).
52
+ - Every \`next/*\` import in use (\`next/link\`, \`next/navigation\`, \`next/image\`, \`next/font\`, \`next/headers\`, \`next/cookies\`, \`next/cache\`).
53
+ - Every external HTTP call and the API it targets (in client components, Server Actions, and Server Components).
54
+ - Every env var read (\`process.env.*\`, \`import.meta.env.*\`), separated into "credentials/secrets" (move to integrations) and "config" (\`ctx.env\`).
55
+ - Every middleware (\`middleware.ts\`) — usually drops, but capture what it was doing so the equivalent can be implemented at the API layer if needed.
56
+ - Theme port surface: \`tailwind.config.{js,ts}\`, \`app/globals.css\`, font setup via \`next/font\`, custom CSS modules.
57
+
58
+ If the discovery summary doesn't tell you what every API will look like and how every page changes shape, you haven't discovered enough.
59
+
60
+ ## Core mapping
61
+
62
+ - **Each page (\`app/.../page.tsx\`) → one Superblocks page** at \`client/pages/<Name>/index.tsx\`, wired into \`client/router.tsx\`. Route groups (\`(name)/\`) collapse into nested routes; dynamic segments (\`[id]/\`) become \`:id\` params under react-router v7.
63
+ - **Each Server Component that fetches data inline → one Superblocks API + a client component**. The page becomes a normal client component that calls \`useApiData("<ApiName>")\`. The inline \`fetch\` / DB call moves into \`server/apis/<ApiName>/api.ts\`. There is no server-rendered first paint in this template; the page renders with a loading state and hydrates from the API.
64
+ - **Each Server Action (\`"use server"\` function) → one Superblocks API** at \`server/apis/<ActionName>/api.ts\`, called from the client via \`useApi("<ActionName>")\` (mutations) or \`executeApi\`. Form-action wiring (\`<form action={...}>\`) becomes a normal \`onSubmit\` handler that calls the API. \`revalidatePath\` / \`revalidateTag\` calls drop; refetch via the returned hook's invalidation pattern instead.
65
+ - **Each API Route (\`app/api/<name>/route.ts\`) → one Superblocks API** at \`server/apis/<NameInPascalCase>/api.ts\`. Route handlers exporting \`GET\`, \`POST\`, etc. that share a path collapse into one \`api()\` keyed by method on the input schema, or split into separate APIs per method. Pick one shape and stay consistent. \`Request\` / \`Response\` / \`NextResponse\` primitives drop entirely; the platform handles HTTP.
66
+ - **Each external HTTP call → integration**. \`fetch("https://api.openai.com/...")\` becomes a declared integration plus \`apiRequest(...)\`. Secrets from \`process.env\`, \`NEXT_PUBLIC_*\`, hardcoded keys, or AI SDK provider configs move into the integration definition. A \`NEXT_PUBLIC_OPENAI_API_KEY\` on the client side is also a security finding worth surfacing in the migration summary.
67
+ - **DB clients** (Drizzle, Prisma, \`@vercel/postgres\`, \`@neondatabase/serverless\`, \`pg\`) → declare in \`integrations: { db: postgres(DB_INTEGRATION_ID) }\` and call \`ctx.integrations.db.query/execute(...)\` with parameterized SQL. Read schema from any included migration files; do not run them against the target integration without asking.
68
+ - **\`next/link\`** → \`import { Link } from "react-router"\` (v7). The \`href\` prop becomes \`to\`.
69
+ - **\`next/navigation\`** → react-router v7 hooks: \`useRouter()\` becomes \`useNavigate()\`, \`usePathname()\` becomes \`useLocation().pathname\`, \`useSearchParams()\` stays \`useSearchParams()\` from \`react-router\` (similar API but not identical, verify call sites).
70
+ - **\`next/image\`** → standard \`<img>\` with the same \`src\`/\`alt\`. Drop the \`width\`/\`height\`/\`priority\` props or convert to inline styles. If the source relied on Next's image optimization (remote loaders, blur placeholders), flag as a \`failed\` item with \`failureReason: "next/image optimization on <usage> has no Superblocks equivalent in this template"\`.
71
+ - **\`next/font/google\`** → **never just delete the import**. The font has to be re-loaded somewhere or it disappears from the migrated app and everything renders in the browser fallback. Three required steps; all three are mandatory:
72
+ - **(a) Load the font.** Pick one shape and stay consistent within the migration:
73
+ 1. **CDN \`@import\` (default; zero new deps).** At the top of \`client/index.css\`: \`@import url('https://fonts.googleapis.com/css2?family=<Family>:wght@<weights>&display=swap');\`. Bring over both the sans and mono family the source used.
74
+ 2. **Self-hosted via npm.** For Geist specifically: \`pnpm add geist\`, then \`import 'geist/font/sans'; import 'geist/font/mono';\` from \`client/main.tsx\` (it injects \`@font-face\` and exposes \`--font-geist-sans\` / \`--font-geist-mono\`). For other Google fonts: \`pnpm add @fontsource-variable/<family>\` and \`import '@fontsource-variable/<family>';\`.
75
+ - **(b) Bind it in \`@theme\`.** The starter \`client/index.css\` ships with no \`--font-sans\` token, so even after loading the font you must add \`@theme { --font-sans: '<Family>', ui-sans-serif, system-ui, sans-serif; --font-mono: '<MonoFamily>', ui-monospace, monospace; }\` (or a \`var(--font-geist-sans)\` reference for the self-hosted Geist case). Without this, Tailwind's \`font-sans\` keeps using the browser default.
76
+ - **(c) Drop the source's \`next/font\` import and the \`className={font.variable}\` wiring** on \`<html>\` / \`<body>\` — the Tailwind token from (b) carries the variable forward instead.
77
+
78
+ The most common port failure is silently dropping (a): the agent removes the \`next/font\` import as part of "drop Next-isms" and never adds a replacement, so the migrated app renders in system fonts. (b) without (a) is just as bad. **Verify by inspecting a heading in DevTools and confirming \`font-family\` resolves to the source's family, not \`ui-sans-serif\`/system fallback.** If a font is intentionally not carried over, surface it as a \`failed\` item with a reason; do not drop silently.
79
+
80
+ - **\`next/font/local\`** → copy the font files to \`client/public/fonts/\`, write matching \`@font-face\` blocks in \`client/index.css\`, and bind the family name in \`@theme\`. Preserve the original \`font-display\`, weight, and style.
81
+ - **\`app/layout.tsx\`** → fold into \`client/App.tsx\` (the root shell with \`<AppProvider>\` + \`<Outlet />\`) or into specific page wrappers, depending on what each layout provided. Theme providers, font loaders, and metadata setters from layouts collapse into the App shell or \`client/index.css\`. The \`<html>\`/\`<body>\` shell drops; the platform owns it.
82
+ - **\`app/loading.tsx\`** → component-level loading state in the page, driven by \`useApiData\`'s loading boolean. There is no implicit Suspense boundary in this template.
83
+ - **\`app/error.tsx\`** → react-router v7 \`errorElement\` on the route, or a try/catch around the API hook with a fallback render.
84
+ - **\`metadata\` exports / \`generateMetadata\`** → drop, or set \`document.title\` via \`useEffect\` if the page title matters. Open Graph / Twitter card metadata has no equivalent here.
85
+ - **\`middleware.ts\`** → drop. If it was enforcing auth, the equivalent enforcement happens server-side in each \`api()\` via \`ctx.user\`. If it was rewriting URLs, surface to the user — Superblocks has no URL-rewriting layer.
86
+ - **\`"use client"\` / \`"use server"\` directives** → drop. Every component in the Superblocks template is a client component; every server-side function lives in \`server/apis/\`. There is no RSC boundary to mark.
87
+ - **\`next-themes\`** → translate to a small custom provider that toggles a \`class="dark"\` on \`document.documentElement\` and persists to \`localStorage\`, or drop entirely and pin the theme. The \`next-themes\` package depends on Next-specific hydration behavior and should not be carried over as-is. Preserve the source's CSS variable scheme (\`:root\` / \`.dark\` blocks in \`globals.css\`) — only the JS toggle changes.
88
+ - **\`@vercel/analytics\`** → drop. The \`<Analytics />\` component and \`track()\` helper are bound to the Vercel platform and have no equivalent here. Note in the migration summary if the source relied on it.
89
+
90
+ ## Ask-before-guessing — v0 specifics
91
+
92
+ - "The source uses Server Actions / API Routes calling \`<DB client>\` against \`<DSN env var>\`. I'll bind to a Postgres integration; which one, or do you want to create a new one?"
93
+ - "I see external HTTP calls to \`<host>\` with credentials in \`<env var>\`. Bind to an integration of type \`<kind>\`?"
94
+ - "I see \`<feature>\` (streaming AI responses, edge runtime, ISR, etc.) which has no equivalent in this template. Drop, degrade, or stop and let you decide?"
95
+ - "I see Server Components fetching data inline. The migrated app cannot server-render; the page will hydrate from the API with a loading state. Is that acceptable, or do you want a particular skeleton/loading shape?"
96
+ - "The source has a \`middleware.ts\` doing \`<auth/redirect/rewrite>\`. I'll drop it and enforce equivalent rules in each API via \`ctx.user\`. Is that the right user-claim mapping?"
97
+
98
+ ## Page port — what changes vs. what doesn't
99
+
100
+ For each v0 page, only these change:
101
+
102
+ - **Data hooks**: Server Component inline fetch / Server Action calls / API Route fetches → \`useApi\` / \`useApiData\`.
103
+ - **Auth touchpoints**: NextAuth / Clerk / \`middleware.ts\` checks → platform-managed (drop the provider; consume \`ctx.user\` server-side).
104
+ - **Router primitives**: \`next/link\`, \`next/navigation\`, file-system routing → react-router v7 (\`Link\`, \`useNavigate\`, \`useLocation\`, explicit route definitions in \`client/router.tsx\`).
105
+ - **Asset primitives**: \`next/image\` → \`<img>\`, \`next/font\` → CSS-loaded fonts.
106
+ - **Directives**: \`"use client"\` / \`"use server"\` removed.
107
+
108
+ Everything else (JSX structure, Tailwind classes, shadcn variants, custom CSS, theme tokens, layout containers) transfers unchanged. If the diff goes beyond data + auth + routing + asset/font primitives + directive removal, you are over-editing.
109
+
110
+ ## Done — v0 specifics
111
+
112
+ In the final report, additionally surface:
113
+
114
+ - Any unsupported features that became \`failed\` items (streaming AI responses, server-side rendering, ISR, \`next/image\` optimization, edge runtime, route rewrites, etc.).
115
+ - Any \`NEXT_PUBLIC_*\` secrets found on the client side (these should be rotated even after migration).
116
+ - The list of \`next/*\` imports that were translated, so the user can spot-check them in the migrated tree.
117
+ `;
118
+ //# sourceMappingURL=v0.generated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v0.generated.js","sourceRoot":"","sources":["../../../../../src/ai-service/skills/system/third-party-migration/v0.generated.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,mDAAmD;AAEnD,MAAM,CAAC,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkHtB,CAAC"}
@@ -113,7 +113,7 @@ export class Clark extends TracedFSM {
113
113
  };
114
114
  }
115
115
  resetContext() {
116
- this.logger.info(`[ai-service] resetContext`);
116
+ this.logger.info(`[ai-service] resetContext state=${this.state}`);
117
117
  this.updateContext((ctx) => {
118
118
  return {
119
119
  // The peer reference is a permanent StablePeer proxy and must be
@@ -1 +1 @@
1
- {"version":3,"file":"clark-fsm.js","sourceRoot":"","sources":["../../../src/ai-service/state-machine/clark-fsm.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AA+BlC,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAe/D,OAAO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