@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.
- package/dist/ai-files-manifest.d.ts +1 -1
- package/dist/appstore-artifacts.d.ts +44 -0
- package/dist/appstore-artifacts.d.ts.map +1 -0
- package/dist/appstore-artifacts.js +142 -0
- package/dist/appstore-artifacts.js.map +1 -0
- package/dist/commands/account.d.ts +1 -1
- package/dist/commands/account.js +2 -2
- package/dist/commands/admin-reconcile-routes.d.ts +1 -1
- package/dist/commands/ai-files.d.ts +2 -2
- package/dist/commands/ai-files.js +2 -2
- package/dist/commands/alerts.d.ts +1 -1
- package/dist/commands/app-resources.d.ts +1 -1
- package/dist/commands/app-resources.js +2 -2
- package/dist/commands/app-topology.d.ts +1 -1
- package/dist/commands/app-topology.js +2 -2
- package/dist/commands/appstore-kit.d.ts +36 -0
- package/dist/commands/appstore-kit.d.ts.map +1 -0
- package/dist/commands/appstore-kit.js +93 -0
- package/dist/commands/appstore-kit.js.map +1 -0
- package/dist/commands/billing.d.ts +1 -1
- package/dist/commands/billing.js +1 -1
- package/dist/commands/cache.d.ts +1 -1
- package/dist/commands/cache.js +2 -2
- package/dist/commands/capabilities.d.ts +1 -1
- package/dist/commands/claim.d.ts +1 -1
- package/dist/commands/claim.js +1 -1
- package/dist/commands/create.d.ts +2 -2
- package/dist/commands/create.js +2 -2
- package/dist/commands/dashboard.d.ts +1 -1
- package/dist/commands/dashboard.js +2 -2
- package/dist/commands/data-export.d.ts +1 -1
- package/dist/commands/data-export.js +3 -3
- package/dist/commands/data.d.ts +1 -1
- package/dist/commands/data.js +2 -2
- package/dist/commands/delete.d.ts +1 -1
- package/dist/commands/delete.js +2 -2
- package/dist/commands/deploys.d.ts +1 -1
- package/dist/commands/deploys.js +2 -2
- package/dist/commands/dev.d.ts +1 -1
- package/dist/commands/dev.js +3 -3
- package/dist/commands/diagnose.d.ts +1 -1
- package/dist/commands/diagnose.js +2 -2
- package/dist/commands/diff.d.ts +1 -1
- package/dist/commands/diff.js +2 -2
- package/dist/commands/doctor.d.ts +3 -3
- package/dist/commands/doctor.js +4 -4
- package/dist/commands/domains.d.ts +1 -1
- package/dist/commands/domains.js +2 -2
- package/dist/commands/env.d.ts +1 -1
- package/dist/commands/env.js +2 -2
- package/dist/commands/export.d.ts +1 -1
- package/dist/commands/export.js +2 -2
- package/dist/commands/forgejo.d.ts +1 -1
- package/dist/commands/forgejo.js +2 -2
- package/dist/commands/generate.d.ts +1 -1
- package/dist/commands/generate.js +1 -1
- package/dist/commands/github.d.ts +1 -1
- package/dist/commands/github.js +2 -2
- package/dist/commands/import-project.d.ts +1 -1
- package/dist/commands/import-project.js +2 -2
- package/dist/commands/init.d.ts +2 -2
- package/dist/commands/init.js +3 -3
- package/dist/commands/insights.d.ts +1 -1
- package/dist/commands/insights.js +2 -2
- package/dist/commands/inspect-link.d.ts +1 -1
- package/dist/commands/inspect-link.js +2 -2
- package/dist/commands/login.d.ts +1 -1
- package/dist/commands/login.js +1 -1
- package/dist/commands/logs.d.ts +1 -1
- package/dist/commands/logs.js +2 -2
- package/dist/commands/mcp.d.ts +1 -1
- package/dist/commands/migrate-supabase-map.d.ts +1 -1
- package/dist/commands/migrate-supabase-recipes.d.ts +28 -0
- package/dist/commands/migrate-supabase-recipes.d.ts.map +1 -0
- package/dist/commands/migrate-supabase-recipes.js +92 -0
- package/dist/commands/migrate-supabase-recipes.js.map +1 -0
- package/dist/commands/migrate-supabase-rewrite.d.ts +8 -3
- package/dist/commands/migrate-supabase-rewrite.d.ts.map +1 -1
- package/dist/commands/migrate-supabase-rewrite.js +155 -11
- package/dist/commands/migrate-supabase-rewrite.js.map +1 -1
- package/dist/commands/migrate-supabase-scaffold.d.ts +25 -0
- package/dist/commands/migrate-supabase-scaffold.d.ts.map +1 -0
- package/dist/commands/migrate-supabase-scaffold.js +234 -0
- package/dist/commands/migrate-supabase-scaffold.js.map +1 -0
- package/dist/commands/migrate-supabase-schema.d.ts +4 -4
- package/dist/commands/migrate-supabase-schema.js +4 -4
- package/dist/commands/migrate-supabase-scripts.d.ts +1 -1
- package/dist/commands/migrate-supabase-sdk.d.ts +34 -0
- package/dist/commands/migrate-supabase-sdk.d.ts.map +1 -1
- package/dist/commands/migrate-supabase-sdk.js +169 -0
- package/dist/commands/migrate-supabase-sdk.js.map +1 -1
- package/dist/commands/migrate-supabase-status.d.ts +92 -0
- package/dist/commands/migrate-supabase-status.d.ts.map +1 -0
- package/dist/commands/migrate-supabase-status.js +470 -0
- package/dist/commands/migrate-supabase-status.js.map +1 -0
- package/dist/commands/migrate-supabase-walker.d.ts +15 -1
- package/dist/commands/migrate-supabase-walker.d.ts.map +1 -1
- package/dist/commands/migrate-supabase-walker.js +49 -5
- package/dist/commands/migrate-supabase-walker.js.map +1 -1
- package/dist/commands/migrate-supabase.d.ts +2 -2
- package/dist/commands/migrate-supabase.js +1 -1
- package/dist/commands/open.d.ts +1 -1
- package/dist/commands/open.js +2 -2
- package/dist/commands/preview-branch.d.ts +1 -1
- package/dist/commands/preview-branch.js +2 -2
- package/dist/commands/publish-api-error.d.ts +1 -1
- package/dist/commands/publish-api-error.js +1 -1
- package/dist/commands/publish-failure.d.ts +3 -3
- package/dist/commands/publish-failure.js +3 -3
- package/dist/commands/publish.d.ts +3 -3
- package/dist/commands/publish.js +13 -13
- package/dist/commands/push.d.ts +2 -2
- package/dist/commands/push.js +8 -8
- package/dist/commands/redeploy.d.ts +2 -2
- package/dist/commands/redeploy.js +4 -4
- package/dist/commands/rename.d.ts +1 -1
- package/dist/commands/rename.js +2 -2
- package/dist/commands/reproduce.d.ts +1 -1
- package/dist/commands/reproduce.js +1 -1
- package/dist/commands/reset-superuser.d.ts +1 -1
- package/dist/commands/reset-superuser.js +2 -2
- package/dist/commands/restore.d.ts +1 -1
- package/dist/commands/restore.js +2 -2
- package/dist/commands/resume.d.ts +1 -1
- package/dist/commands/resume.js +2 -2
- package/dist/commands/rollback.d.ts +1 -1
- package/dist/commands/rollback.js +2 -2
- package/dist/commands/sharing.d.ts +1 -1
- package/dist/commands/sharing.js +2 -2
- package/dist/commands/status.d.ts +1 -1
- package/dist/commands/transfers.d.ts +1 -1
- package/dist/commands/transfers.js +2 -2
- package/dist/commands/unsuspend.d.ts +1 -1
- package/dist/commands/versions.d.ts +1 -1
- package/dist/commands/versions.js +2 -2
- package/dist/commands/wait-deploy.d.ts +3 -3
- package/dist/commands/wait-deploy.js +3 -3
- package/dist/commands/whoami.d.ts +1 -1
- package/dist/detect.js +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +78 -75
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +77 -74
- package/dist/index.js.map +1 -1
- package/dist/plans.d.ts +0 -1
- package/dist/plans.d.ts.map +1 -1
- package/dist/plans.js +0 -6
- package/dist/plans.js.map +1 -1
- package/dist/poll-deployment.d.ts +1 -1
- package/dist/recovery.d.ts +1 -1
- package/dist/structured-error-codes.d.ts +1 -1
- package/dist/templates/ai-files/index.js +2 -2
- package/package.json +11 -3
package/dist/commands/dev.js
CHANGED
|
@@ -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,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
|
/**
|
package/dist/commands/diff.d.ts
CHANGED
|
@@ -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>;
|
package/dist/commands/diff.js
CHANGED
|
@@ -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>;
|
package/dist/commands/doctor.js
CHANGED
|
@@ -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;
|
package/dist/commands/domains.js
CHANGED
|
@@ -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"),
|
package/dist/commands/env.d.ts
CHANGED
package/dist/commands/env.js
CHANGED
|
@@ -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()),
|
package/dist/commands/export.js
CHANGED
|
@@ -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.
|
package/dist/commands/forgejo.js
CHANGED
|
@@ -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
|
|
@@ -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
|
});
|
package/dist/commands/github.js
CHANGED
|
@@ -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,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"])
|
package/dist/commands/init.d.ts
CHANGED
|
@@ -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
|
package/dist/commands/init.js
CHANGED
|
@@ -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,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,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"),
|
package/dist/commands/login.d.ts
CHANGED
package/dist/commands/login.js
CHANGED
|
@@ -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(),
|
package/dist/commands/logs.d.ts
CHANGED
package/dist/commands/logs.js
CHANGED
|
@@ -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
|
package/dist/commands/mcp.d.ts
CHANGED
|
@@ -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 {
|
|
@@ -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,gBAAgB,EAAE;QAChB,KAAK,EAAE,iCAAiC;QACxC,MAAM,EACJ,gNAAgN;KACnN;IACD,cAAc,EAAE;QACd,KAAK,EAAE,+BAA+B;QACtC,MAAM,EACJ,8LAA8L;KACjM;IACD,oBAAoB,EAAE;QACpB,KAAK,EAAE,0CAA0C;QACjD,MAAM,EACJ,uUAAuU;KAC1U;IACD,gBAAgB,EAAE;QAChB,KAAK,EAAE,yBAAyB;QAChC,MAAM,EACJ,kQAAkQ;KACrQ;IACD,4BAA4B,EAAE;QAC5B,KAAK,EAAE,8CAA8C;QACrD,MAAM,EACJ,6PAA6P;KAChQ;IACD,iBAAiB,EAAE;QACjB,KAAK,EAAE,yCAAyC;QAChD,MAAM,EACJ,wQAAwQ;KAC3Q;IACD,qBAAqB,EAAE;QACrB,KAAK,EAAE,8BAA8B;QACrC,MAAM,EACJ,8LAA8L;KACjM;IACD,wBAAwB,EAAE;QACxB,KAAK,EAAE,2CAA2C;QAClD,MAAM,EACJ,uSAAuS;KAC1S;CACF,CAAC;AAEF,+DAA+D;AAC/D,MAAM,UAAU,SAAS,CAAC,OAAe;IACvC,OAAO,YAAY,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC;AACvC,CAAC;AAED,gFAAgF;AAChF,MAAM,oBAAoB,GAAiB;IACzC;QACE,KAAK,EAAE,qCAAqC;QAC5C,MAAM,EACJ,wOAAwO;KAC3O;CACF,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAA0B;IAC7D,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,MAAM,OAAO,GAAiB,EAAE,CAAC;IACjC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;QAClC,IAAI,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;YACtC,IAAI,CAAC,GAAG,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;
|
|
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;AAIjG,OAAO,EACL,KAAK,WAAW,EAIjB,MAAM,2BAA2B,CAAC;AAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,eAAO,MAAM,gCAAgC;;;;;;;iBAiC3C,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;;uBAEmB;IACnB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,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,CAgNtC"}
|