@percher/core 0.4.10 → 0.4.12

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 (155) hide show
  1. package/dist/ai-files-manifest.d.ts +1 -1
  2. package/dist/appstore-artifacts.d.ts +44 -0
  3. package/dist/appstore-artifacts.d.ts.map +1 -0
  4. package/dist/appstore-artifacts.js +142 -0
  5. package/dist/appstore-artifacts.js.map +1 -0
  6. package/dist/commands/account.d.ts +1 -1
  7. package/dist/commands/account.js +2 -2
  8. package/dist/commands/admin-reconcile-routes.d.ts +1 -1
  9. package/dist/commands/ai-files.d.ts +2 -2
  10. package/dist/commands/ai-files.js +2 -2
  11. package/dist/commands/alerts.d.ts +1 -1
  12. package/dist/commands/app-resources.d.ts +1 -1
  13. package/dist/commands/app-resources.js +2 -2
  14. package/dist/commands/app-topology.d.ts +1 -1
  15. package/dist/commands/app-topology.js +2 -2
  16. package/dist/commands/appstore-kit.d.ts +36 -0
  17. package/dist/commands/appstore-kit.d.ts.map +1 -0
  18. package/dist/commands/appstore-kit.js +93 -0
  19. package/dist/commands/appstore-kit.js.map +1 -0
  20. package/dist/commands/billing.d.ts +1 -1
  21. package/dist/commands/billing.js +1 -1
  22. package/dist/commands/cache.d.ts +1 -1
  23. package/dist/commands/cache.js +2 -2
  24. package/dist/commands/capabilities.d.ts +1 -1
  25. package/dist/commands/claim.d.ts +1 -1
  26. package/dist/commands/claim.js +1 -1
  27. package/dist/commands/create.d.ts +2 -2
  28. package/dist/commands/create.js +2 -2
  29. package/dist/commands/dashboard.d.ts +1 -1
  30. package/dist/commands/dashboard.js +2 -2
  31. package/dist/commands/data-export.d.ts +1 -1
  32. package/dist/commands/data-export.js +3 -3
  33. package/dist/commands/data.d.ts +1 -1
  34. package/dist/commands/data.js +2 -2
  35. package/dist/commands/delete.d.ts +1 -1
  36. package/dist/commands/delete.js +2 -2
  37. package/dist/commands/deploys.d.ts +1 -1
  38. package/dist/commands/deploys.js +2 -2
  39. package/dist/commands/dev.d.ts +1 -1
  40. package/dist/commands/dev.js +3 -3
  41. package/dist/commands/diagnose.d.ts +1 -1
  42. package/dist/commands/diagnose.js +2 -2
  43. package/dist/commands/diff.d.ts +1 -1
  44. package/dist/commands/diff.js +2 -2
  45. package/dist/commands/doctor.d.ts +3 -3
  46. package/dist/commands/doctor.js +4 -4
  47. package/dist/commands/domains.d.ts +1 -1
  48. package/dist/commands/domains.js +2 -2
  49. package/dist/commands/env.d.ts +1 -1
  50. package/dist/commands/env.js +2 -2
  51. package/dist/commands/export.d.ts +1 -1
  52. package/dist/commands/export.js +2 -2
  53. package/dist/commands/forgejo.d.ts +1 -1
  54. package/dist/commands/forgejo.js +2 -2
  55. package/dist/commands/generate.d.ts +1 -1
  56. package/dist/commands/generate.js +1 -1
  57. package/dist/commands/github.d.ts +1 -1
  58. package/dist/commands/github.js +2 -2
  59. package/dist/commands/import-project.d.ts +1 -1
  60. package/dist/commands/import-project.js +2 -2
  61. package/dist/commands/init.d.ts +2 -2
  62. package/dist/commands/init.js +3 -3
  63. package/dist/commands/insights.d.ts +1 -1
  64. package/dist/commands/insights.js +2 -2
  65. package/dist/commands/inspect-link.d.ts +1 -1
  66. package/dist/commands/inspect-link.js +2 -2
  67. package/dist/commands/login.d.ts +1 -1
  68. package/dist/commands/login.js +1 -1
  69. package/dist/commands/logs.d.ts +1 -1
  70. package/dist/commands/logs.js +2 -2
  71. package/dist/commands/mcp.d.ts +1 -1
  72. package/dist/commands/migrate-supabase-map.d.ts +1 -1
  73. package/dist/commands/migrate-supabase-recipes.d.ts +28 -0
  74. package/dist/commands/migrate-supabase-recipes.d.ts.map +1 -0
  75. package/dist/commands/migrate-supabase-recipes.js +92 -0
  76. package/dist/commands/migrate-supabase-recipes.js.map +1 -0
  77. package/dist/commands/migrate-supabase-rewrite.d.ts +8 -3
  78. package/dist/commands/migrate-supabase-rewrite.d.ts.map +1 -1
  79. package/dist/commands/migrate-supabase-rewrite.js +155 -11
  80. package/dist/commands/migrate-supabase-rewrite.js.map +1 -1
  81. package/dist/commands/migrate-supabase-scaffold.d.ts +25 -0
  82. package/dist/commands/migrate-supabase-scaffold.d.ts.map +1 -0
  83. package/dist/commands/migrate-supabase-scaffold.js +234 -0
  84. package/dist/commands/migrate-supabase-scaffold.js.map +1 -0
  85. package/dist/commands/migrate-supabase-schema.d.ts +4 -4
  86. package/dist/commands/migrate-supabase-schema.js +4 -4
  87. package/dist/commands/migrate-supabase-scripts.d.ts +1 -1
  88. package/dist/commands/migrate-supabase-sdk.d.ts +34 -0
  89. package/dist/commands/migrate-supabase-sdk.d.ts.map +1 -1
  90. package/dist/commands/migrate-supabase-sdk.js +169 -0
  91. package/dist/commands/migrate-supabase-sdk.js.map +1 -1
  92. package/dist/commands/migrate-supabase-status.d.ts +92 -0
  93. package/dist/commands/migrate-supabase-status.d.ts.map +1 -0
  94. package/dist/commands/migrate-supabase-status.js +470 -0
  95. package/dist/commands/migrate-supabase-status.js.map +1 -0
  96. package/dist/commands/migrate-supabase-walker.d.ts +15 -1
  97. package/dist/commands/migrate-supabase-walker.d.ts.map +1 -1
  98. package/dist/commands/migrate-supabase-walker.js +49 -5
  99. package/dist/commands/migrate-supabase-walker.js.map +1 -1
  100. package/dist/commands/migrate-supabase.d.ts +2 -2
  101. package/dist/commands/migrate-supabase.js +1 -1
  102. package/dist/commands/open.d.ts +1 -1
  103. package/dist/commands/open.js +2 -2
  104. package/dist/commands/preview-branch.d.ts +1 -1
  105. package/dist/commands/preview-branch.js +2 -2
  106. package/dist/commands/publish-api-error.d.ts +1 -1
  107. package/dist/commands/publish-api-error.js +1 -1
  108. package/dist/commands/publish-failure.d.ts +3 -3
  109. package/dist/commands/publish-failure.js +3 -3
  110. package/dist/commands/publish.d.ts +3 -3
  111. package/dist/commands/publish.js +13 -13
  112. package/dist/commands/push.d.ts +2 -2
  113. package/dist/commands/push.js +8 -8
  114. package/dist/commands/redeploy.d.ts +2 -2
  115. package/dist/commands/redeploy.js +4 -4
  116. package/dist/commands/rename.d.ts +1 -1
  117. package/dist/commands/rename.js +2 -2
  118. package/dist/commands/reproduce.d.ts +1 -1
  119. package/dist/commands/reproduce.js +1 -1
  120. package/dist/commands/reset-superuser.d.ts +1 -1
  121. package/dist/commands/reset-superuser.js +2 -2
  122. package/dist/commands/restore.d.ts +1 -1
  123. package/dist/commands/restore.js +2 -2
  124. package/dist/commands/resume.d.ts +1 -1
  125. package/dist/commands/resume.js +2 -2
  126. package/dist/commands/rollback.d.ts +1 -1
  127. package/dist/commands/rollback.js +2 -2
  128. package/dist/commands/sharing.d.ts +1 -1
  129. package/dist/commands/sharing.js +2 -2
  130. package/dist/commands/status.d.ts +1 -1
  131. package/dist/commands/transfers.d.ts +1 -1
  132. package/dist/commands/transfers.js +2 -2
  133. package/dist/commands/unsuspend.d.ts +1 -1
  134. package/dist/commands/versions.d.ts +1 -1
  135. package/dist/commands/versions.js +2 -2
  136. package/dist/commands/wait-deploy.d.ts +3 -3
  137. package/dist/commands/wait-deploy.js +3 -3
  138. package/dist/commands/whoami.d.ts +1 -1
  139. package/dist/detect.js +1 -1
  140. package/dist/errors.d.ts +1 -1
  141. package/dist/errors.d.ts.map +1 -1
  142. package/dist/errors.js.map +1 -1
  143. package/dist/index.d.ts +78 -75
  144. package/dist/index.d.ts.map +1 -1
  145. package/dist/index.js +77 -74
  146. package/dist/index.js.map +1 -1
  147. package/dist/plans.d.ts +0 -1
  148. package/dist/plans.d.ts.map +1 -1
  149. package/dist/plans.js +0 -6
  150. package/dist/plans.js.map +1 -1
  151. package/dist/poll-deployment.d.ts +1 -1
  152. package/dist/recovery.d.ts +1 -1
  153. package/dist/structured-error-codes.d.ts +1 -1
  154. package/dist/templates/ai-files/index.js +2 -2
  155. package/package.json +11 -3
@@ -3,9 +3,9 @@ import { join } from "node:path";
3
3
  import { TIMEOUTS } from "@percher/shared/timeouts";
4
4
  import { parseFile } from "@percher/toml";
5
5
  import { z } from "zod";
6
- import { PercherCoreError } from "../errors";
7
- import { createTarball } from "../tarball";
8
- import { createWatcher } from "../watcher";
6
+ import { PercherCoreError } from "../errors.js";
7
+ import { createTarball } from "../tarball.js";
8
+ import { createWatcher } from "../watcher.js";
9
9
  export const devInputSchema = z.object({
10
10
  app: z.string().optional(),
11
11
  });
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import type { Context } from "../context";
2
+ import type { Context } from "../context.js";
3
3
  export declare const diagnoseInputSchema: z.ZodObject<{
4
4
  app: z.ZodOptional<z.ZodString>;
5
5
  logLines: z.ZodOptional<z.ZodNumber>;
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
- import { readPercherTomlAppName } from "../app-name";
3
- import { PercherCoreError } from "../errors";
2
+ import { readPercherTomlAppName } from "../app-name.js";
3
+ import { PercherCoreError } from "../errors.js";
4
4
  export const diagnoseInputSchema = z.object({
5
5
  app: z.string().optional(),
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  import type { DeployChanges } from "@percher/client";
2
2
  import { z } from "zod";
3
- import type { Context } from "../context";
3
+ import type { Context } from "../context.js";
4
4
  export declare const diffInputSchema: z.ZodObject<{
5
5
  app: z.ZodOptional<z.ZodString>;
6
6
  base: z.ZodOptional<z.ZodString>;
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
- import { readPercherTomlAppName } from "../app-name";
3
- import { PercherCoreError } from "../errors";
2
+ import { readPercherTomlAppName } from "../app-name.js";
3
+ import { PercherCoreError } from "../errors.js";
4
4
  export const diffInputSchema = z.object({
5
5
  app: z.string().optional(),
6
6
  base: z.string().optional(),
@@ -1,8 +1,8 @@
1
1
  import type { BuildProblem, CrashReport, SuspectDeploy } from "@percher/client";
2
2
  import { z } from "zod";
3
- import type { Context } from "../context";
4
- import { type ClassifiedError } from "../error-classifier";
5
- import { type PublishRecovery, type ReasonCode } from "../recovery";
3
+ import type { Context } from "../context.js";
4
+ import { type ClassifiedError } from "../error-classifier.js";
5
+ import { type PublishRecovery, type ReasonCode } from "../recovery.js";
6
6
  export declare const doctorInputSchema: z.ZodObject<{
7
7
  app: z.ZodOptional<z.ZodString>;
8
8
  json: z.ZodOptional<z.ZodBoolean>;
@@ -2,10 +2,10 @@ import { existsSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
  import { PercherTomlError, parseFile } from "@percher/toml";
4
4
  import { z } from "zod";
5
- import { readPercherTomlAppName } from "../app-name";
6
- import { classifyError } from "../error-classifier";
7
- import { buildProblemToRecoveryProblem, recoveryAsk, recoveryEnv, recoveryFixConfig, recoveryFixProblems, recoveryInspectBuildLog, recoveryLogin, recoveryNone, recoveryWait, } from "../recovery";
8
- import { resolveReplaced } from "./wait-deploy";
5
+ import { readPercherTomlAppName } from "../app-name.js";
6
+ import { classifyError } from "../error-classifier.js";
7
+ import { buildProblemToRecoveryProblem, recoveryAsk, recoveryEnv, recoveryFixConfig, recoveryFixProblems, recoveryInspectBuildLog, recoveryLogin, recoveryNone, recoveryWait, } from "../recovery.js";
8
+ import { resolveReplaced } from "./wait-deploy.js";
9
9
  export const doctorInputSchema = z.object({
10
10
  app: z.string().optional(),
11
11
  json: z.boolean().optional(),
@@ -1,6 +1,6 @@
1
1
  import type { CustomDomainAddResult, CustomDomainEntry, CustomDomainVerifyResult } from "@percher/client";
2
2
  import { z } from "zod";
3
- import type { Context } from "../context";
3
+ import type { Context } from "../context.js";
4
4
  export declare const domainAddInputSchema: z.ZodObject<{
5
5
  app: z.ZodOptional<z.ZodString>;
6
6
  domain: z.ZodString;
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
- import { readPercherTomlAppName } from "../app-name";
3
- import { PercherCoreError } from "../errors";
2
+ import { readPercherTomlAppName } from "../app-name.js";
3
+ import { PercherCoreError } from "../errors.js";
4
4
  export const domainAddInputSchema = z.object({
5
5
  app: z.string().optional(),
6
6
  domain: z.string().min(1, "Domain is required"),
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import type { Context } from "../context";
2
+ import type { Context } from "../context.js";
3
3
  export declare const envSetInputSchema: z.ZodObject<{
4
4
  app: z.ZodOptional<z.ZodString>;
5
5
  values: z.ZodRecord<z.ZodString, z.ZodString>;
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
- import { readPercherTomlAppName } from "../app-name";
3
- import { PercherCoreError } from "../errors";
2
+ import { readPercherTomlAppName } from "../app-name.js";
3
+ import { PercherCoreError } from "../errors.js";
4
4
  export const envSetInputSchema = z.object({
5
5
  app: z.string().optional(),
6
6
  values: z.record(z.string(), z.string()),
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import type { Context } from "../context";
2
+ import type { Context } from "../context.js";
3
3
  export declare const exportInputSchema: z.ZodObject<{
4
4
  app: z.ZodOptional<z.ZodString>;
5
5
  out: z.ZodOptional<z.ZodString>;
@@ -3,8 +3,8 @@ import { createWriteStream } from "node:fs";
3
3
  import { rename, unlink } from "node:fs/promises";
4
4
  import { isAbsolute, resolve as resolvePath } from "node:path";
5
5
  import { z } from "zod";
6
- import { readPercherTomlAppName } from "../app-name";
7
- import { PercherCoreError } from "../errors";
6
+ import { readPercherTomlAppName } from "../app-name.js";
7
+ import { PercherCoreError } from "../errors.js";
8
8
  export const exportInputSchema = z.object({
9
9
  app: z.string().optional(),
10
10
  /** Where to write the bundle. Defaults to `./{appName}-{date}.tar.gz` in cwd.
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import type { Context } from "../context";
2
+ import type { Context } from "../context.js";
3
3
  export declare const forgejoConnectInputSchema: z.ZodObject<{
4
4
  app: z.ZodOptional<z.ZodString>;
5
5
  repoUrl: z.ZodString;
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
- import { readPercherTomlAppName } from "../app-name";
3
- import { PercherCoreError } from "../errors";
2
+ import { readPercherTomlAppName } from "../app-name.js";
3
+ import { PercherCoreError } from "../errors.js";
4
4
  /**
5
5
  * FUTURE9 Fas 6 — Forgejo (self-hosted Gitea fork) connect + webhook
6
6
  * setup. Mirrors the GitHub commands one-for-one; the only
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import type { Context } from "../context";
2
+ import type { Context } from "../context.js";
3
3
  export declare const generateInputSchema: z.ZodObject<{
4
4
  cwd: z.ZodOptional<z.ZodString>;
5
5
  }, z.core.$strip>;
@@ -2,7 +2,7 @@ import { existsSync, mkdirSync, writeFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
  import { getEnvValues, parseFile } from "@percher/toml";
4
4
  import { z } from "zod";
5
- import { PercherCoreError } from "../errors";
5
+ import { PercherCoreError } from "../errors.js";
6
6
  export const generateInputSchema = z.object({
7
7
  cwd: z.string().optional(),
8
8
  });
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import type { Context } from "../context";
2
+ import type { Context } from "../context.js";
3
3
  export declare const githubConnectInputSchema: z.ZodObject<{
4
4
  app: z.ZodOptional<z.ZodString>;
5
5
  repoUrl: z.ZodString;
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
- import { readPercherTomlAppName } from "../app-name";
3
- import { PercherCoreError } from "../errors";
2
+ import { readPercherTomlAppName } from "../app-name.js";
3
+ import { PercherCoreError } from "../errors.js";
4
4
  // Keep in sync with the API-side GITHUB_URL_RE in packages/api/src/routes/github.ts
5
5
  const GITHUB_URL_RE = /^https:\/\/github\.com\/[\w.-]+\/[\w.-]+(\.git)?$/;
6
6
  export const githubConnectInputSchema = z.object({
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import type { Context } from "../context";
2
+ import type { Context } from "../context.js";
3
3
  export declare const importInputSchema: z.ZodObject<{
4
4
  from: z.ZodOptional<z.ZodEnum<{
5
5
  vercel: "vercel";
@@ -1,8 +1,8 @@
1
1
  import { existsSync, readFileSync, writeFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
  import { z } from "zod";
4
- import { PercherCoreError } from "../errors";
5
- import { renderStaticFrameworkCaddyfile, renderStaticFrameworkDockerfile, STATIC_DOCKER_PORT, } from "../static-docker";
4
+ import { PercherCoreError } from "../errors.js";
5
+ import { renderStaticFrameworkCaddyfile, renderStaticFrameworkDockerfile, STATIC_DOCKER_PORT, } from "../static-docker.js";
6
6
  export const importInputSchema = z.object({
7
7
  from: z
8
8
  .enum(["vercel", "netlify"])
@@ -1,7 +1,7 @@
1
1
  import { type PercherConfig } from "@percher/toml";
2
2
  import { z } from "zod";
3
- import type { Context } from "../context";
4
- import { type DetectedFramework } from "../detect";
3
+ import type { Context } from "../context.js";
4
+ import { type DetectedFramework } from "../detect.js";
5
5
  /**
6
6
  * FUTURE11 Fas 5 — detect names that almost certainly came from an
7
7
  * auto-generated temp directory (timestamps, date stamps, very long
@@ -2,9 +2,9 @@ import { existsSync, writeFileSync } from "node:fs";
2
2
  import { basename, join } from "node:path";
3
3
  import { generateName, serialize } from "@percher/toml";
4
4
  import { z } from "zod";
5
- import { detectFramework, refineBunRuntime } from "../detect";
6
- import { PercherCoreError } from "../errors";
7
- import { renderStaticFrameworkCaddyfile, renderStaticFrameworkDockerfile } from "../static-docker";
5
+ import { detectFramework, refineBunRuntime } from "../detect.js";
6
+ import { PercherCoreError } from "../errors.js";
7
+ import { renderStaticFrameworkCaddyfile, renderStaticFrameworkDockerfile } from "../static-docker.js";
8
8
  /**
9
9
  * FUTURE11 Fas 5 — detect names that almost certainly came from an
10
10
  * auto-generated temp directory (timestamps, date stamps, very long
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import type { Context } from "../context";
2
+ import type { Context } from "../context.js";
3
3
  export declare const insightsInputSchema: z.ZodObject<{
4
4
  app: z.ZodOptional<z.ZodString>;
5
5
  }, z.core.$strip>;
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
- import { readPercherTomlAppName } from "../app-name";
3
- import { PercherCoreError } from "../errors";
2
+ import { readPercherTomlAppName } from "../app-name.js";
3
+ import { PercherCoreError } from "../errors.js";
4
4
  export const insightsInputSchema = z.object({
5
5
  app: z.string().optional(),
6
6
  });
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import type { Context } from "../context";
2
+ import type { Context } from "../context.js";
3
3
  export declare const inspectLinkInputSchema: z.ZodObject<{
4
4
  app: z.ZodOptional<z.ZodString>;
5
5
  revoke: z.ZodOptional<z.ZodBoolean>;
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
- import { readPercherTomlAppName } from "../app-name";
3
- import { PercherCoreError } from "../errors";
2
+ import { readPercherTomlAppName } from "../app-name.js";
3
+ import { PercherCoreError } from "../errors.js";
4
4
  export const inspectLinkInputSchema = z.object({
5
5
  app: z.string().optional().describe("App name (defaults to percher.toml)"),
6
6
  revoke: z.boolean().optional().describe("Revoke the app's inspect link instead of creating one"),
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import type { Context } from "../context";
2
+ import type { Context } from "../context.js";
3
3
  export declare const loginInputSchema: z.ZodObject<{
4
4
  token: z.ZodOptional<z.ZodString>;
5
5
  apiUrl: z.ZodOptional<z.ZodString>;
@@ -1,6 +1,6 @@
1
1
  import { PercherClient, saveConfig } from "@percher/client";
2
2
  import { z } from "zod";
3
- import { PercherCoreError } from "../errors";
3
+ import { PercherCoreError } from "../errors.js";
4
4
  export const loginInputSchema = z.object({
5
5
  token: z.string().optional(),
6
6
  apiUrl: z.string().url().optional(),
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import type { Context } from "../context";
2
+ import type { Context } from "../context.js";
3
3
  /**
4
4
  * FUTURE9 Fas 1 — server-side log filtering exposed to CLI + MCP.
5
5
  * Closes the gap between `percher_doctor` (crash diagnosis) and blind
@@ -1,7 +1,7 @@
1
1
  import { MAX_LOG_SEARCH_LENGTH } from "@percher/shared";
2
2
  import { z } from "zod";
3
- import { readPercherTomlAppName } from "../app-name";
4
- import { PercherCoreError } from "../errors";
3
+ import { readPercherTomlAppName } from "../app-name.js";
4
+ import { PercherCoreError } from "../errors.js";
5
5
  /**
6
6
  * FUTURE9 Fas 1 — server-side log filtering exposed to CLI + MCP.
7
7
  * Closes the gap between `percher_doctor` (crash diagnosis) and blind
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import type { Context } from "../context";
2
+ import type { Context } from "../context.js";
3
3
  export declare const mcpInputSchema: z.ZodObject<{}, z.core.$strip>;
4
4
  export type McpInput = z.infer<typeof mcpInputSchema>;
5
5
  export interface McpConfigResult {
@@ -1,4 +1,4 @@
1
- import type { InspectSupabaseResult } from "./migrate-supabase";
1
+ import type { InspectSupabaseResult } from "./migrate-supabase.js";
2
2
  /**
3
3
  * FUTURE9 Phase B — Supabase → PocketBase schema mapping.
4
4
  *
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Phase D — auth recipes.
3
+ *
4
+ * Centralised PocketBase-equivalent guidance for the Supabase auth patterns
5
+ * the rewriter deliberately does NOT auto-translate. The north star: a
6
+ * compiling-but-wrong getSession/OTP/password-reset is the worst outcome, so
7
+ * these stay flagged (the Supabase call is left in place) and the user gets a
8
+ * concrete recipe instead of a fake rewrite.
9
+ *
10
+ * Keyed by the flag pattern the SDK rewriter emits (`auth.<method>`). Used two
11
+ * ways: the rewriter folds the recipe into the flag's inline note, and the
12
+ * report renders a deduplicated "Recipes" section from the patterns present.
13
+ */
14
+ export interface AuthRecipe {
15
+ /** Short title for the Recipes section heading. */
16
+ title: string;
17
+ /** Concrete PocketBase-equivalent guidance — one tight paragraph. */
18
+ recipe: string;
19
+ }
20
+ export declare const AUTH_RECIPES: Record<string, AuthRecipe>;
21
+ /** Recipe for a flag pattern, or null when there isn't one. */
22
+ export declare function recipeFor(pattern: string): AuthRecipe | null;
23
+ /**
24
+ * Render the "Recipes" section for REWRITE_NOTES.md from the set of flag
25
+ * patterns present. Returns markdown lines (empty when no auth recipe applies).
26
+ */
27
+ export declare function renderRecipesSection(patterns: Iterable<string>): string[];
28
+ //# sourceMappingURL=migrate-supabase-recipes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrate-supabase-recipes.d.ts","sourceRoot":"","sources":["../../src/commands/migrate-supabase-recipes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,WAAW,UAAU;IACzB,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CA8CnD,CAAC;AAEF,+DAA+D;AAC/D,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAE5D;AAWD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,MAAM,EAAE,CA0BzE"}
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Phase D — auth recipes.
3
+ *
4
+ * Centralised PocketBase-equivalent guidance for the Supabase auth patterns
5
+ * the rewriter deliberately does NOT auto-translate. The north star: a
6
+ * compiling-but-wrong getSession/OTP/password-reset is the worst outcome, so
7
+ * these stay flagged (the Supabase call is left in place) and the user gets a
8
+ * concrete recipe instead of a fake rewrite.
9
+ *
10
+ * Keyed by the flag pattern the SDK rewriter emits (`auth.<method>`). Used two
11
+ * ways: the rewriter folds the recipe into the flag's inline note, and the
12
+ * report renders a deduplicated "Recipes" section from the patterns present.
13
+ */
14
+ export const AUTH_RECIPES = {
15
+ "auth.getSession": {
16
+ title: "getSession → pb.authStore",
17
+ recipe: "PocketBase keeps the session in `pb.authStore` (local, synchronous — no await). Replace `const { data: { session } } = await supabase.auth.getSession()` with `pb.authStore.isValid` (logged in?), `pb.authStore.record` (the user record), and `pb.authStore.token` (the JWT).",
18
+ },
19
+ "auth.getClaims": {
20
+ title: "getClaims → pb.authStore.record",
21
+ recipe: "PocketBase has no separate claims endpoint. The authenticated user's fields live on `pb.authStore.record`; use `pb.authStore.isValid` for the logged-in check. Read them directly — no await, no token decode.",
22
+ },
23
+ "auth.getUser": {
24
+ title: "getUser → pb.authStore.record",
25
+ recipe: "`pb.authStore.record` is the current user record (or null), read synchronously. Supabase's `getUser()` returns `Promise<{ data: { user } }>`, so drop the await and the `.data.user` unwrap.",
26
+ },
27
+ "auth.signInWithOtp": {
28
+ title: "signInWithOtp → requestOTP + authWithOTP",
29
+ recipe: "PocketBase email-OTP is two steps: `const req = await pb.collection('users').requestOTP(email)` sends the code, then on a second screen `await pb.collection('users').authWithOTP(req.otpId, code)` verifies it. Supabase's single magic-link `signInWithOtp` maps to the first step — you'll add a code-entry screen for the second.",
30
+ },
31
+ "auth.verifyOtp": {
32
+ title: "verifyOtp → authWithOTP",
33
+ recipe: "Pairs with requestOTP: `await pb.collection('users').authWithOTP(otpId, code)` (otpId comes from the requestOTP response, not from the email link). Supabase's `token_hash` / `type` model doesn't carry over — keep the otpId from step one in component state.",
34
+ },
35
+ "auth.resetPasswordForEmail": {
36
+ title: "resetPasswordForEmail → requestPasswordReset",
37
+ recipe: "`await pb.collection('users').requestPasswordReset(email)` sends the reset email. The confirm step lives on your reset page: `await pb.collection('users').confirmPasswordReset(token, newPassword, newPasswordConfirm)` (token comes from the email link).",
38
+ },
39
+ "auth.updateUser": {
40
+ title: "updateUser → collection('users').update",
41
+ recipe: "PocketBase updates by record id: `await pb.collection('users').update(pb.authStore.record.id, { ... })`. There's no implicit current-user update — pass the id explicitly. Email/password changes use the dedicated `requestEmailChange` / `confirmEmailChange` flows.",
42
+ },
43
+ "auth.refreshSession": {
44
+ title: "refreshSession → authRefresh",
45
+ recipe: "`await pb.collection('users').authRefresh()` re-validates the stored token and refreshes `pb.authStore`. There's no refresh-token rotation to manage — PocketBase reissues the JWT in place.",
46
+ },
47
+ "auth.onAuthStateChange": {
48
+ title: "onAuthStateChange → pb.authStore.onChange",
49
+ recipe: "`const unsubscribe = pb.authStore.onChange((token, record) => { ... })`. The callback receives `(token, record)`, NOT Supabase's `(event, session)` — there's no event-type string, so branch on `pb.authStore.isValid` inside the callback. It returns an unsubscribe function; call it on teardown.",
50
+ },
51
+ };
52
+ /** Recipe for a flag pattern, or null when there isn't one. */
53
+ export function recipeFor(pattern) {
54
+ return AUTH_RECIPES[pattern] ?? null;
55
+ }
56
+ /** General auth guidance worth surfacing whenever any auth call was flagged. */
57
+ const GENERAL_AUTH_RECIPES = [
58
+ {
59
+ title: "Route guards → pb.authStore.isValid",
60
+ recipe: "Gate protected routes on `pb.authStore.isValid` instead of inspecting a session object, e.g. `if (!pb.authStore.isValid) redirect('/login')`. `pb.authStore` is restored from storage on load, so the check works on the first render.",
61
+ },
62
+ ];
63
+ /**
64
+ * Render the "Recipes" section for REWRITE_NOTES.md from the set of flag
65
+ * patterns present. Returns markdown lines (empty when no auth recipe applies).
66
+ */
67
+ export function renderRecipesSection(patterns) {
68
+ const seen = new Set();
69
+ const recipes = [];
70
+ for (const pattern of patterns) {
71
+ const recipe = recipeFor(pattern);
72
+ if (recipe && !seen.has(recipe.title)) {
73
+ seen.add(recipe.title);
74
+ recipes.push(recipe);
75
+ }
76
+ }
77
+ if (recipes.length === 0)
78
+ return [];
79
+ const lines = [];
80
+ lines.push("## Recipes — Supabase auth → PocketBase");
81
+ lines.push("");
82
+ lines.push("Concrete PocketBase equivalents for the auth calls above. These are NOT auto-applied — the Supabase call is left in place so the app keeps working until you migrate it deliberately. See https://pocketbase.io/docs/authentication/.");
83
+ lines.push("");
84
+ for (const recipe of [...recipes, ...GENERAL_AUTH_RECIPES]) {
85
+ lines.push(`### ${recipe.title}`);
86
+ lines.push("");
87
+ lines.push(recipe.recipe);
88
+ lines.push("");
89
+ }
90
+ return lines;
91
+ }
92
+ //# sourceMappingURL=migrate-supabase-recipes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrate-supabase-recipes.js","sourceRoot":"","sources":["../../src/commands/migrate-supabase-recipes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AASH,MAAM,CAAC,MAAM,YAAY,GAA+B;IACtD,iBAAiB,EAAE;QACjB,KAAK,EAAE,2BAA2B;QAClC,MAAM,EACJ,iRAAiR;KACpR;IACD,gB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CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACvB,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;IACD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAEpC,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAC;IACtD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CACR,uOAAuO,CACxO,CAAC;IACF,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,MAAM,MAAM,IAAI,CAAC,GAAG,OAAO,EAAE,GAAG,oBAAoB,CAAC,EAAE,CAAC;QAC3D,KAAK,CAAC,IAAI,CAAC,OAAO,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;QAClC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC1B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
- import type { Context } from "../context";
3
- import { type AskUserRecovery, type NoneRecovery } from "../recovery";
4
- import { type SkippedFile } from "./migrate-supabase-walker";
2
+ import type { Context } from "../context.js";
3
+ import { type AskUserRecovery, type NoneRecovery } from "../recovery.js";
4
+ import { type SkippedFile } from "./migrate-supabase-walker.js";
5
5
  /**
6
6
  * FUTURE9 Phase D chunk 3.3 — user-facing client-rewrite wiring.
7
7
  *
@@ -38,6 +38,7 @@ export declare const rewriteSupabaseClientInputSchema: z.ZodObject<{
38
38
  apply: z.ZodOptional<z.ZodBoolean>;
39
39
  pbIdentifier: z.ZodOptional<z.ZodString>;
40
40
  supabaseIdentifiers: z.ZodOptional<z.ZodArray<z.ZodString>>;
41
+ scaffoldClient: z.ZodOptional<z.ZodBoolean>;
41
42
  }, z.core.$strip>;
42
43
  export type RewriteSupabaseClientInput = z.infer<typeof rewriteSupabaseClientInputSchema>;
43
44
  /**
@@ -81,6 +82,10 @@ export interface RewriteSupabaseClientResult {
81
82
  packageJsonChanged: boolean;
82
83
  /** How many .env* files had Supabase keys commented out + stubbed. */
83
84
  envFilesChanged: number;
85
+ /** The PocketBase client module that was scaffolded (relative to ctx.cwd), or null
86
+ * when scaffolding was off, skipped (a pb client already exists), or there were
87
+ * no rewrites. */
88
+ clientModule: string | null;
84
89
  /** Files the walker couldn't process (parse error, binary, read error). */
85
90
  skipped: SkippedFile[];
86
91
  recovery: NoneRecovery | AskUserRecovery;
@@ -1 +1 @@
1
- {"version":3,"file":"migrate-supabase-rewrite.d.ts","sourceRoot":"","sources":["../../src/commands/migrate-supabase-rewrite.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,YAAY,EAA6B,MAAM,aAAa,CAAC;AACjG,OAAO,EACL,KAAK,WAAW,EAIjB,MAAM,2BAA2B,CAAC;AAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,eAAO,MAAM,gCAAgC;;;;;;iBA2B3C,CAAC;AACH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAE1F;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,4EAA4E;IAC5E,IAAI,EAAE,MAAM,CAAC;IACb,sFAAsF;IACtF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mEAAmE;IACnE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8FAA8F;IAC9F,IAAI,EAAE,eAAe,GAAG,aAAa,CAAC;IACtC,6EAA6E;IAC7E,OAAO,EAAE,MAAM,CAAC;IAChB,sDAAsD;IACtD,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,IAAI,GAAG,QAAQ,CAAC;IACxB,oEAAoE;IACpE,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC;IAC1B,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,yGAAyG;IACzG,SAAS,EAAE,MAAM,CAAC;IAClB,6GAA6G;IAC7G,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,0GAA0G;IAC1G,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,oDAAoD;IACpD,YAAY,EAAE,MAAM,CAAC;IACrB,kKAAkK;IAClK,KAAK,EAAE,iBAAiB,EAAE,CAAC;IAC3B,kHAAkH;IAClH,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,qEAAqE;IACrE,kBAAkB,EAAE,OAAO,CAAC;IAC5B,sEAAsE;IACtE,eAAe,EAAE,MAAM,CAAC;IACxB,2EAA2E;IAC3E,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,QAAQ,EAAE,YAAY,GAAG,eAAe,CAAC;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE;QACN,IAAI,EAAE,gBAAgB,CAAC;QACvB,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAED,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,0BAA0B,GAChC,OAAO,CAAC,2BAA2B,CAAC,CAwItC"}
1
+ {"version":3,"file":"migrate-supabase-rewrite.d.ts","sourceRoot":"","sources":["../../src/commands/migrate-supabase-rewrite.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACx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