@percher/core 0.4.0 → 0.4.2
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/commands/account.d.ts +24 -14
- package/dist/commands/account.d.ts.map +1 -1
- package/dist/commands/account.js +17 -4
- package/dist/commands/account.js.map +1 -1
- package/dist/commands/admin-reconcile-routes.d.ts +18 -0
- package/dist/commands/admin-reconcile-routes.d.ts.map +1 -0
- package/dist/commands/admin-reconcile-routes.js +22 -0
- package/dist/commands/admin-reconcile-routes.js.map +1 -0
- package/dist/commands/ai-files.d.ts +5 -17
- package/dist/commands/ai-files.d.ts.map +1 -1
- package/dist/commands/ai-files.js +3 -4
- package/dist/commands/ai-files.js.map +1 -1
- package/dist/commands/alerts.d.ts +70 -0
- package/dist/commands/alerts.d.ts.map +1 -0
- package/dist/commands/alerts.js +82 -0
- package/dist/commands/alerts.js.map +1 -0
- package/dist/commands/app-resources.d.ts +30 -0
- package/dist/commands/app-resources.d.ts.map +1 -0
- package/dist/commands/app-resources.js +34 -0
- package/dist/commands/app-resources.js.map +1 -0
- package/dist/commands/app-topology.d.ts +18 -0
- package/dist/commands/app-topology.d.ts.map +1 -0
- package/dist/commands/app-topology.js +25 -0
- package/dist/commands/app-topology.js.map +1 -0
- package/dist/commands/billing.d.ts +8 -8
- package/dist/commands/billing.d.ts.map +1 -1
- package/dist/commands/billing.js +1 -1
- package/dist/commands/billing.js.map +1 -1
- package/dist/commands/continue.d.ts +1 -1
- package/dist/commands/create.d.ts +2 -12
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +1 -1
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/dashboard.d.ts +2 -8
- package/dist/commands/dashboard.d.ts.map +1 -1
- package/dist/commands/dashboard.js +1 -1
- package/dist/commands/dashboard.js.map +1 -1
- package/dist/commands/data-export.d.ts +2 -8
- package/dist/commands/data-export.d.ts.map +1 -1
- package/dist/commands/data-export.js +1 -1
- package/dist/commands/data-export.js.map +1 -1
- package/dist/commands/data.d.ts +2 -8
- package/dist/commands/data.d.ts.map +1 -1
- package/dist/commands/data.js +1 -1
- package/dist/commands/data.js.map +1 -1
- package/dist/commands/delete.d.ts +2 -8
- package/dist/commands/delete.d.ts.map +1 -1
- package/dist/commands/delete.js +1 -1
- package/dist/commands/delete.js.map +1 -1
- package/dist/commands/deploys.d.ts +4 -28
- package/dist/commands/deploys.d.ts.map +1 -1
- package/dist/commands/deploys.js +1 -1
- package/dist/commands/deploys.js.map +1 -1
- package/dist/commands/dev.d.ts +2 -6
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +1 -1
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/diagnose.d.ts +2 -22
- package/dist/commands/diagnose.d.ts.map +1 -1
- package/dist/commands/diagnose.js +1 -1
- package/dist/commands/diagnose.js.map +1 -1
- package/dist/commands/doctor.d.ts +10 -35
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +12 -4
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/domains.d.ts +5 -27
- package/dist/commands/domains.d.ts.map +1 -1
- package/dist/commands/domains.js +1 -1
- package/dist/commands/domains.js.map +1 -1
- package/dist/commands/env-scan.js +1 -1
- package/dist/commands/env-scan.js.map +1 -1
- package/dist/commands/env.d.ts +4 -20
- package/dist/commands/env.d.ts.map +1 -1
- package/dist/commands/env.js +1 -1
- package/dist/commands/env.js.map +1 -1
- package/dist/commands/export.d.ts +6 -15
- package/dist/commands/export.d.ts.map +1 -1
- package/dist/commands/export.js +1 -1
- package/dist/commands/forgejo.d.ts +45 -0
- package/dist/commands/forgejo.d.ts.map +1 -0
- package/dist/commands/forgejo.js +125 -0
- package/dist/commands/forgejo.js.map +1 -0
- package/dist/commands/generate.d.ts +2 -6
- package/dist/commands/generate.d.ts.map +1 -1
- package/dist/commands/generate.js +1 -1
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/github.d.ts +4 -15
- package/dist/commands/github.d.ts.map +1 -1
- package/dist/commands/github.js +17 -1
- package/dist/commands/github.js.map +1 -1
- package/dist/commands/import-project.d.ts +13 -9
- package/dist/commands/import-project.d.ts.map +1 -1
- package/dist/commands/import-project.js +73 -22
- package/dist/commands/import-project.js.map +1 -1
- package/dist/commands/init.d.ts +26 -11
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +103 -2
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/insights.d.ts +2 -6
- package/dist/commands/insights.d.ts.map +1 -1
- package/dist/commands/insights.js +1 -1
- package/dist/commands/insights.js.map +1 -1
- package/dist/commands/login.d.ts +2 -8
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +22 -1
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/logs.d.ts +25 -10
- package/dist/commands/logs.d.ts.map +1 -1
- package/dist/commands/logs.js +65 -5
- package/dist/commands/logs.js.map +1 -1
- package/dist/commands/mcp.d.ts +2 -2
- package/dist/commands/mcp.d.ts.map +1 -1
- package/dist/commands/mcp.js +1 -1
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/migrate-supabase-map.d.ts +171 -0
- package/dist/commands/migrate-supabase-map.d.ts.map +1 -0
- package/dist/commands/migrate-supabase-map.js +452 -0
- package/dist/commands/migrate-supabase-map.js.map +1 -0
- package/dist/commands/migrate-supabase-schema.d.ts +67 -0
- package/dist/commands/migrate-supabase-schema.d.ts.map +1 -0
- package/dist/commands/migrate-supabase-schema.js +321 -0
- package/dist/commands/migrate-supabase-schema.js.map +1 -0
- package/dist/commands/migrate-supabase-scripts.d.ts +64 -0
- package/dist/commands/migrate-supabase-scripts.d.ts.map +1 -0
- package/dist/commands/migrate-supabase-scripts.js +564 -0
- package/dist/commands/migrate-supabase-scripts.js.map +1 -0
- package/dist/commands/migrate-supabase-sdk.d.ts +133 -0
- package/dist/commands/migrate-supabase-sdk.d.ts.map +1 -0
- package/dist/commands/migrate-supabase-sdk.js +1119 -0
- package/dist/commands/migrate-supabase-sdk.js.map +1 -0
- package/dist/commands/migrate-supabase-walker.d.ts +93 -0
- package/dist/commands/migrate-supabase-walker.d.ts.map +1 -0
- package/dist/commands/migrate-supabase-walker.js +413 -0
- package/dist/commands/migrate-supabase-walker.js.map +1 -0
- package/dist/commands/migrate-supabase.d.ts +81 -0
- package/dist/commands/migrate-supabase.d.ts.map +1 -0
- package/dist/commands/migrate-supabase.js +579 -0
- package/dist/commands/migrate-supabase.js.map +1 -0
- package/dist/commands/open.d.ts +2 -6
- package/dist/commands/open.d.ts.map +1 -1
- package/dist/commands/open.js +1 -1
- package/dist/commands/open.js.map +1 -1
- package/dist/commands/publish-api-error.d.ts +46 -0
- package/dist/commands/publish-api-error.d.ts.map +1 -0
- package/dist/commands/publish-api-error.js +358 -0
- package/dist/commands/publish-api-error.js.map +1 -0
- package/dist/commands/publish-failure.d.ts.map +1 -1
- package/dist/commands/publish-failure.js +11 -2
- package/dist/commands/publish-failure.js.map +1 -1
- package/dist/commands/publish.d.ts +40 -17
- package/dist/commands/publish.d.ts.map +1 -1
- package/dist/commands/publish.js +115 -8
- package/dist/commands/publish.js.map +1 -1
- package/dist/commands/push.d.ts +2 -12
- package/dist/commands/push.d.ts.map +1 -1
- package/dist/commands/push.js +2 -2
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/redeploy.d.ts +2 -8
- package/dist/commands/redeploy.d.ts.map +1 -1
- package/dist/commands/redeploy.js +2 -2
- package/dist/commands/redeploy.js.map +1 -1
- package/dist/commands/rename.d.ts +2 -8
- package/dist/commands/rename.d.ts.map +1 -1
- package/dist/commands/rename.js +1 -1
- package/dist/commands/rename.js.map +1 -1
- package/dist/commands/reproduce.d.ts +2 -8
- package/dist/commands/reproduce.d.ts.map +1 -1
- package/dist/commands/reproduce.js +1 -1
- package/dist/commands/reproduce.js.map +1 -1
- package/dist/commands/reset-superuser.d.ts +2 -16
- package/dist/commands/reset-superuser.d.ts.map +1 -1
- package/dist/commands/reset-superuser.js +1 -1
- package/dist/commands/reset-superuser.js.map +1 -1
- package/dist/commands/restore.d.ts +7 -22
- package/dist/commands/restore.d.ts.map +1 -1
- package/dist/commands/restore.js +1 -1
- package/dist/commands/restore.js.map +1 -1
- package/dist/commands/resume.d.ts +2 -6
- package/dist/commands/resume.d.ts.map +1 -1
- package/dist/commands/resume.js +1 -1
- package/dist/commands/resume.js.map +1 -1
- package/dist/commands/rollback.d.ts +2 -8
- package/dist/commands/rollback.d.ts.map +1 -1
- package/dist/commands/rollback.js +1 -1
- package/dist/commands/rollback.js.map +1 -1
- package/dist/commands/sharing.d.ts +48 -0
- package/dist/commands/sharing.d.ts.map +1 -0
- package/dist/commands/sharing.js +85 -0
- package/dist/commands/sharing.js.map +1 -0
- package/dist/commands/status.d.ts +2 -6
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +1 -1
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/transfers.d.ts +34 -0
- package/dist/commands/transfers.d.ts.map +1 -0
- package/dist/commands/transfers.js +62 -0
- package/dist/commands/transfers.js.map +1 -0
- package/dist/commands/unsuspend.d.ts +2 -6
- package/dist/commands/unsuspend.d.ts.map +1 -1
- package/dist/commands/unsuspend.js +1 -1
- package/dist/commands/unsuspend.js.map +1 -1
- package/dist/commands/versions.d.ts +2 -6
- package/dist/commands/versions.d.ts.map +1 -1
- package/dist/commands/versions.js +1 -1
- package/dist/commands/versions.js.map +1 -1
- package/dist/commands/wait-deploy.d.ts +2 -12
- package/dist/commands/wait-deploy.d.ts.map +1 -1
- package/dist/commands/wait-deploy.js +1 -1
- package/dist/commands/wait-deploy.js.map +1 -1
- package/dist/context.d.ts +15 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/detect.d.ts +11 -0
- package/dist/detect.d.ts.map +1 -1
- package/dist/detect.js +31 -8
- package/dist/detect.js.map +1 -1
- package/dist/env-scan-source.d.ts +8 -1
- package/dist/env-scan-source.d.ts.map +1 -1
- package/dist/env-scan-source.js +100 -24
- package/dist/env-scan-source.js.map +1 -1
- package/dist/error-classifier.d.ts +18 -1
- package/dist/error-classifier.d.ts.map +1 -1
- package/dist/error-classifier.js +171 -9
- package/dist/error-classifier.js.map +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 +64 -49
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +57 -42
- package/dist/index.js.map +1 -1
- package/dist/plans.d.ts +86 -8
- package/dist/plans.d.ts.map +1 -1
- package/dist/plans.js +113 -24
- package/dist/plans.js.map +1 -1
- package/dist/recovery.d.ts +73 -3
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +36 -0
- package/dist/recovery.js.map +1 -1
- package/dist/static-docker.d.ts +77 -0
- package/dist/static-docker.d.ts.map +1 -0
- package/dist/static-docker.js +105 -0
- package/dist/static-docker.js.map +1 -0
- package/dist/tarball.js +1 -1
- package/dist/tarball.js.map +1 -1
- package/dist/templates/ai-files/cursor-percher-mdc.d.ts.map +1 -1
- package/dist/templates/ai-files/cursor-percher-mdc.js +12 -9
- package/dist/templates/ai-files/cursor-percher-mdc.js.map +1 -1
- package/dist/templates.js +11 -11
- package/dist/templates.js.map +1 -1
- package/dist/watcher.js +1 -1
- package/dist/watcher.js.map +1 -1
- package/package.json +6 -2
package/dist/commands/login.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PercherClient, saveConfig } from "@percher/client";
|
|
2
|
-
import { z } from "zod
|
|
2
|
+
import { z } from "zod";
|
|
3
3
|
import { PercherCoreError } from "../errors";
|
|
4
4
|
export const loginInputSchema = z.object({
|
|
5
5
|
token: z.string().optional(),
|
|
@@ -16,9 +16,30 @@ async function validateAndPersist(ctx, apiUrl, token) {
|
|
|
16
16
|
const client = new PercherClient({
|
|
17
17
|
apiUrl: apiUrl ?? ctx.client.apiUrl,
|
|
18
18
|
token,
|
|
19
|
+
// FUTURE6 — carry the MCP session id forward across the
|
|
20
|
+
// re-mint. Without this, post-login MCP requests would drop the
|
|
21
|
+
// X-Percher-Session header (PercherClient reads options only in
|
|
22
|
+
// its constructor) and the server's per-session limit would no
|
|
23
|
+
// longer see the agent's loop.
|
|
24
|
+
sessionId: ctx.client.sessionId,
|
|
19
25
|
});
|
|
20
26
|
const me = await client.auth.whoami();
|
|
21
27
|
await writeStatus(ctx, `Signed in as ${me.email}`);
|
|
28
|
+
// FUTURE16 Fas 1.4: re-bind ctx.client so subsequent tool calls in
|
|
29
|
+
// the same MCP session see the new token. PercherClient reads
|
|
30
|
+
// loadConfig() only once in its constructor — without rebinding,
|
|
31
|
+
// the singleton context behöll pre-login-clienten (token: null)
|
|
32
|
+
// även efter saveConfig skrev token till disk. Pre-fix triggades
|
|
33
|
+
// det här bara när en agent försökte publish:a i samma MCP-session
|
|
34
|
+
// som login:en (en ny MCP-session återskapade singleton från disk
|
|
35
|
+
// och fungerade); recovery-kontraktet säger att open_login →
|
|
36
|
+
// percher_login → omkall publish ska fungera utan restart.
|
|
37
|
+
if (ctx.setClient) {
|
|
38
|
+
ctx.setClient(client);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
ctx.client = client;
|
|
42
|
+
}
|
|
22
43
|
return token;
|
|
23
44
|
}
|
|
24
45
|
export async function login(ctx, input = {}) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../src/commands/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../src/commands/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;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AAE,MAAM,CAAC,KAAK,CAAC,CAAC;QAC7D,CAAC;QACD,IAAI,IAAI,CAAC,QAAQ,GAAG,CAAC,EAAE,CAAC;YACtB,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC;QAC5E,CAAC;IACH,CAAC;IAED,MAAM,IAAI,gBAAgB,CAAC,0CAA0C,EAAE;QACrE,IAAI,EAAE,eAAe;KACtB,CAAC,CAAC;AACL,CAAC"}
|
package/dist/commands/logs.d.ts
CHANGED
|
@@ -1,18 +1,33 @@
|
|
|
1
|
-
import { z } from "zod
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
import type { Context } from "../context";
|
|
3
|
+
/**
|
|
4
|
+
* FUTURE9 Fas 1 — server-side log filtering exposed to CLI + MCP.
|
|
5
|
+
* Closes the gap between `percher_doctor` (crash diagnosis) and blind
|
|
6
|
+
* log streaming: an agent that sees "app is slow but not crashed" can
|
|
7
|
+
* now ask for `{ level: "error", tail: 50 }` and get the relevant
|
|
8
|
+
* rows directly instead of streaming everything and filtering locally.
|
|
9
|
+
*/
|
|
3
10
|
export declare const logsInputSchema: z.ZodObject<{
|
|
4
11
|
app: z.ZodOptional<z.ZodString>;
|
|
5
12
|
tail: z.ZodOptional<z.ZodNumber>;
|
|
6
13
|
follow: z.ZodOptional<z.ZodBoolean>;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
level: z.ZodOptional<z.ZodEnum<{
|
|
15
|
+
error: "error";
|
|
16
|
+
debug: "debug";
|
|
17
|
+
info: "info";
|
|
18
|
+
warn: "warn";
|
|
19
|
+
fatal: "fatal";
|
|
20
|
+
}>>;
|
|
21
|
+
source: z.ZodOptional<z.ZodEnum<{
|
|
22
|
+
build: "build";
|
|
23
|
+
runtime: "runtime";
|
|
24
|
+
crash: "crash";
|
|
25
|
+
system: "system";
|
|
26
|
+
}>>;
|
|
27
|
+
search: z.ZodOptional<z.ZodString>;
|
|
28
|
+
deployId: z.ZodOptional<z.ZodString>;
|
|
29
|
+
since: z.ZodOptional<z.ZodString>;
|
|
30
|
+
}, z.core.$strip>;
|
|
16
31
|
export type LogsInput = z.infer<typeof logsInputSchema>;
|
|
17
32
|
export declare function logs(ctx: Context, input?: LogsInput): Promise<void>;
|
|
18
33
|
//# sourceMappingURL=logs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logs.d.ts","sourceRoot":"","sources":["../../src/commands/logs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"logs.d.ts","sourceRoot":"","sources":["../../src/commands/logs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAG1C;;;;;;GAMG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;iBA8B1B,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAgBxD,wBAAsB,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,GAAE,SAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAkD7E"}
|
package/dist/commands/logs.js
CHANGED
|
@@ -1,11 +1,50 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MAX_LOG_SEARCH_LENGTH } from "@percher/shared";
|
|
2
|
+
import { z } from "zod";
|
|
2
3
|
import { readPercherTomlAppName } from "../app-name";
|
|
3
4
|
import { PercherCoreError } from "../errors";
|
|
5
|
+
/**
|
|
6
|
+
* FUTURE9 Fas 1 — server-side log filtering exposed to CLI + MCP.
|
|
7
|
+
* Closes the gap between `percher_doctor` (crash diagnosis) and blind
|
|
8
|
+
* log streaming: an agent that sees "app is slow but not crashed" can
|
|
9
|
+
* now ask for `{ level: "error", tail: 50 }` and get the relevant
|
|
10
|
+
* rows directly instead of streaming everything and filtering locally.
|
|
11
|
+
*/
|
|
4
12
|
export const logsInputSchema = z.object({
|
|
5
13
|
app: z.string().optional(),
|
|
6
14
|
tail: z.number().int().positive().optional(),
|
|
7
15
|
follow: z.boolean().optional(),
|
|
16
|
+
/** Keep only entries with this level. */
|
|
17
|
+
level: z.enum(["debug", "info", "warn", "error", "fatal"]).optional(),
|
|
18
|
+
/** Keep only entries with this source. `crash` is the agent affordance for "post-mortem only". */
|
|
19
|
+
source: z.enum(["build", "runtime", "crash", "system"]).optional(),
|
|
20
|
+
/**
|
|
21
|
+
* Case-insensitive substring match on the message. Capped at
|
|
22
|
+
* MAX_LOG_SEARCH_LENGTH (shared with the server). Longer values are
|
|
23
|
+
* rejected at the schema layer — the server enforces the same cap
|
|
24
|
+
* as a defense-in-depth check via SEARCH_TOO_LONG (400).
|
|
25
|
+
*/
|
|
26
|
+
search: z.string().max(MAX_LOG_SEARCH_LENGTH).optional(),
|
|
27
|
+
/**
|
|
28
|
+
* Filter to a specific deploy id — useful right after a publish
|
|
29
|
+
* ("show me only what this new deploy emitted"). Agents typically
|
|
30
|
+
* get this from the publish/wait-for-deploy response.
|
|
31
|
+
*/
|
|
32
|
+
deployId: z.string().optional(),
|
|
33
|
+
/**
|
|
34
|
+
* ISO-8601 timestamp lower bound. Entries with timestamp >= since
|
|
35
|
+
* pass. `.datetime({ offset: true })` accepts both `…Z` and
|
|
36
|
+
* offset-style (`…+02:00`) variants — matches the parser's
|
|
37
|
+
* Date.parse-based comparison so a typo like since="yesterday"
|
|
38
|
+
* surfaces as a clear schema validation error at the MCP/CLI layer
|
|
39
|
+
* rather than silently disabling the filter at runtime.
|
|
40
|
+
*/
|
|
41
|
+
since: z.string().datetime({ offset: true }).optional(),
|
|
8
42
|
});
|
|
43
|
+
function isStructured(entry) {
|
|
44
|
+
return (typeof entry === "object" &&
|
|
45
|
+
entry !== null &&
|
|
46
|
+
typeof entry.message === "string");
|
|
47
|
+
}
|
|
9
48
|
export async function logs(ctx, input = {}) {
|
|
10
49
|
const name = input.app ?? readPercherTomlAppName(ctx.cwd);
|
|
11
50
|
if (!name) {
|
|
@@ -17,16 +56,37 @@ export async function logs(ctx, input = {}) {
|
|
|
17
56
|
const app = await ctx.client.apps.get(name);
|
|
18
57
|
const writer = ctx.stdout.getWriter();
|
|
19
58
|
const encoder = new TextEncoder();
|
|
59
|
+
// Any filter being set flips the route into structured-response mode
|
|
60
|
+
// (returns LogLine[] instead of string[]). The caller below handles
|
|
61
|
+
// both shapes — see isStructured.
|
|
62
|
+
const filters = {
|
|
63
|
+
level: input.level,
|
|
64
|
+
source: input.source,
|
|
65
|
+
search: input.search,
|
|
66
|
+
deployId: input.deployId,
|
|
67
|
+
since: input.since,
|
|
68
|
+
};
|
|
69
|
+
const hasFilter = Object.values(filters).some((v) => v !== undefined);
|
|
20
70
|
try {
|
|
21
71
|
if (input.tail !== undefined) {
|
|
22
|
-
const lines = await ctx.client.logs.tail(app.id, {
|
|
72
|
+
const lines = await ctx.client.logs.tail(app.id, {
|
|
73
|
+
lines: input.tail,
|
|
74
|
+
...filters,
|
|
75
|
+
});
|
|
23
76
|
for (const line of lines) {
|
|
24
|
-
|
|
77
|
+
if (isStructured(line)) {
|
|
78
|
+
const levelTag = line.level.toUpperCase().padEnd(5);
|
|
79
|
+
await writer.write(encoder.encode(`[${line.timestamp}] ${levelTag} ${line.message}\n`));
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
await writer.write(encoder.encode(`${line}\n`));
|
|
83
|
+
}
|
|
25
84
|
}
|
|
26
85
|
return;
|
|
27
86
|
}
|
|
28
|
-
// Follow mode (default)
|
|
29
|
-
|
|
87
|
+
// Follow mode (default). Filters apply server-side so we don't
|
|
88
|
+
// burn bandwidth on lines the agent didn't ask for.
|
|
89
|
+
for await (const line of ctx.client.logs.stream(app.id, hasFilter ? filters : undefined)) {
|
|
30
90
|
const levelTag = line.level.toUpperCase().padEnd(5);
|
|
31
91
|
await writer.write(encoder.encode(`[${line.timestamp}] ${levelTag} ${line.message}\n`));
|
|
32
92
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logs.js","sourceRoot":"","sources":["../../src/commands/logs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"logs.js","sourceRoot":"","sources":["../../src/commands/logs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAC5C,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC9B,yCAAyC;IACzC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,QAAQ,EAAE;IACrE,kGAAkG;IAClG,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE;IAClE;;;;;OAKG;IACH,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,qBAAqB,CAA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,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,SAAS,KAAK,QAAQ,IAAI,IAAI,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC;QAC1F,CAAC;IACH,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,WAAW,EAAE,CAAC;IACvB,CAAC;AACH,CAAC"}
|
package/dist/commands/mcp.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { z } from "zod
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
import type { Context } from "../context";
|
|
3
|
-
export declare const mcpInputSchema: z.ZodObject<{},
|
|
3
|
+
export declare const mcpInputSchema: z.ZodObject<{}, z.core.$strip>;
|
|
4
4
|
export type McpInput = z.infer<typeof mcpInputSchema>;
|
|
5
5
|
export interface McpConfigResult {
|
|
6
6
|
/** Canonical mcpServers entry that any MCP-aware client can paste in. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,eAAO,MAAM,cAAc,gCAAe,CAAC;AAC3C,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD,MAAM,WAAW,eAAe;IAC9B,yEAAyE;IACzE,MAAM,EAAE;QAAE,UAAU,EAAE;YAAE,OAAO,EAAE;gBAAE,OAAO,EAAE,MAAM,CAAC;gBAAC,IAAI,EAAE,MAAM,EAAE,CAAA;aAAE,CAAA;SAAE,CAAA;KAAE,CAAC;IACzE,2EAA2E;IAC3E,gBAAgB,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC1E;AAED;;;;;GAKG;AACH,wBAAgB,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,GAAE,QAAa,GAAG,eAAe,CAyBzE"}
|
package/dist/commands/mcp.js
CHANGED
package/dist/commands/mcp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAU3C;;;;;GAKG;AACH,MAAM,UAAU,GAAG,CAAC,IAAa,EAAE,SAAmB,EAAE;IACtD,OAAO;QACL,MAAM,EAAE;YACN,UAAU,EAAE;gBACV,OAAO,EAAE;oBACP,OAAO,EAAE,KAAK;oBACd,IAAI,EAAE,CAAC,IAAI,EAAE,cAAc,CAAC;iBAC7B;aACF;SACF;QACD,gBAAgB,EAAE;YAChB;gBACE,MAAM,EAAE,aAAa;gBACrB,IAAI,EAAE,+DAA+D;aACtE;YACD;gBACE,MAAM,EAAE,mBAAmB;gBAC3B,IAAI,EAAE,wDAAwD;aAC/D;YACD;gBACE,MAAM,EAAE,4BAA4B;gBACpC,IAAI,EAAE,kCAAkC;aACzC;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import type { InspectSupabaseResult } from "./migrate-supabase";
|
|
2
|
+
/**
|
|
3
|
+
* FUTURE9 Phase B — Supabase → PocketBase schema mapping.
|
|
4
|
+
*
|
|
5
|
+
* Pure function: takes the Phase A introspection result, returns a
|
|
6
|
+
* PocketBase-shaped collection schema plus migration notes. No file
|
|
7
|
+
* writes — the CLI/MCP layer (Phase B chunk 2) decides where the
|
|
8
|
+
* preview lands.
|
|
9
|
+
*
|
|
10
|
+
* Mapping rules come from the type-mapping table in
|
|
11
|
+
* docs/plans/FUTURE9_fas-8-lovable-migration-plan.md. Edge cases that
|
|
12
|
+
* can't be auto-translated (composite PKs, arrays of non-scalars,
|
|
13
|
+
* enum values, complex RLS) are flagged in `migrationNotes` rather
|
|
14
|
+
* than guessed at.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* PocketBase field types we emit. Aligns with PB's built-in field
|
|
18
|
+
* schema (text, number, bool, date, json, file, relation, select, url,
|
|
19
|
+
* email). The subset here covers what Postgres → PB mapping needs;
|
|
20
|
+
* unmapped Postgres types fall back to `json` with a warning.
|
|
21
|
+
*/
|
|
22
|
+
export type PocketBaseFieldType = "text" | "number" | "bool" | "date" | "json" | "file" | "relation" | "select";
|
|
23
|
+
export interface PocketBaseRelationOptions {
|
|
24
|
+
collectionName: string;
|
|
25
|
+
cascadeDelete: boolean;
|
|
26
|
+
maxSelect: 1;
|
|
27
|
+
}
|
|
28
|
+
export interface PocketBaseSelectOptions {
|
|
29
|
+
values: string[];
|
|
30
|
+
maxSelect: 1;
|
|
31
|
+
}
|
|
32
|
+
export interface PocketBaseField {
|
|
33
|
+
name: string;
|
|
34
|
+
type: PocketBaseFieldType;
|
|
35
|
+
required: boolean;
|
|
36
|
+
/** Marked unique when the source column is a primary key or a single-column unique constraint. */
|
|
37
|
+
unique: boolean;
|
|
38
|
+
/** Type-specific options. PocketBase's collection-create API expects this shape. */
|
|
39
|
+
options: Record<string, never> | PocketBaseRelationOptions | PocketBaseSelectOptions | {
|
|
40
|
+
min: number | null;
|
|
41
|
+
max: number | null;
|
|
42
|
+
pattern: string;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Provenance — which Postgres column this field came from, plus
|
|
46
|
+
* any per-field flag so the agent can surface "this needs a look"
|
|
47
|
+
* without re-parsing migrationNotes.
|
|
48
|
+
*/
|
|
49
|
+
source: {
|
|
50
|
+
postgresType: string;
|
|
51
|
+
sourceColumn: string;
|
|
52
|
+
flag?: string;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export interface PocketBaseCollection {
|
|
56
|
+
name: string;
|
|
57
|
+
type: "base";
|
|
58
|
+
/** Source-of-truth Postgres schema.table — useful for the agent to map back. */
|
|
59
|
+
sourceTable: string;
|
|
60
|
+
/** PB built-in id/created/updated are implicit. `schema` carries only user-defined fields. */
|
|
61
|
+
schema: PocketBaseField[];
|
|
62
|
+
/**
|
|
63
|
+
* Source columns the mapper dropped (because PB built-ins cover
|
|
64
|
+
* them — uuid PK → `id`; `created_at`/`updated_at` → PB's own
|
|
65
|
+
* timestamp fields). Phase C's data-import-script generator uses
|
|
66
|
+
* this to build a precise row-transform that strips exactly the
|
|
67
|
+
* dropped columns from the incoming Supabase row, no more and no
|
|
68
|
+
* less. Empty when nothing was dropped.
|
|
69
|
+
*/
|
|
70
|
+
droppedSourceColumns: string[];
|
|
71
|
+
/**
|
|
72
|
+
* The source-side column name of a single uuid primary key when
|
|
73
|
+
* one was dropped from the PB schema (PB's built-in `id` covers
|
|
74
|
+
* that role). `null` for tables with composite PKs, non-uuid PKs,
|
|
75
|
+
* or no PK at all.
|
|
76
|
+
*
|
|
77
|
+
* Phase C's data-import-script generator uses this to read the
|
|
78
|
+
* source row's PK value, derive a deterministic PB-compatible
|
|
79
|
+
* 15-char record id from it, and remember the mapping so FK
|
|
80
|
+
* columns in dependent tables can be rewritten to the new id.
|
|
81
|
+
* Without this remap, FK columns would still hold raw Supabase
|
|
82
|
+
* UUIDs after import — pointing at nothing in PB. Codex P1
|
|
83
|
+
* finding 2026-05-17.
|
|
84
|
+
*/
|
|
85
|
+
sourcePrimaryKey: string | null;
|
|
86
|
+
/**
|
|
87
|
+
* PocketBase API rules. Phase B sets them to `null` (most-restrictive)
|
|
88
|
+
* even when the source had open RLS — the user MUST review them.
|
|
89
|
+
* The original policy bodies live in `migrationNotes.rlsPolicies` so
|
|
90
|
+
* the user can manually paste a rule once they've decided.
|
|
91
|
+
*/
|
|
92
|
+
listRule: null;
|
|
93
|
+
viewRule: null;
|
|
94
|
+
createRule: null;
|
|
95
|
+
updateRule: null;
|
|
96
|
+
deleteRule: null;
|
|
97
|
+
indexes: string[];
|
|
98
|
+
}
|
|
99
|
+
export interface MigrationRlsPolicyNote {
|
|
100
|
+
/** Schema-qualified table the policy belongs to. */
|
|
101
|
+
table: string;
|
|
102
|
+
policyName: string;
|
|
103
|
+
command: string;
|
|
104
|
+
originalUsing: string | null;
|
|
105
|
+
originalWithCheck: string | null;
|
|
106
|
+
/**
|
|
107
|
+
* Best-effort PocketBase-API-rule rewrite. Set when the original
|
|
108
|
+
* matches a very narrow set of patterns (`auth.uid() = <col>`).
|
|
109
|
+
* `null` when the source is too complex to translate safely; the
|
|
110
|
+
* user gets the originals + a "MANUAL" hint instead.
|
|
111
|
+
*/
|
|
112
|
+
suggestedRule: string | null;
|
|
113
|
+
/** True when no safe automatic rewrite was possible. */
|
|
114
|
+
manual: boolean;
|
|
115
|
+
}
|
|
116
|
+
export interface MigrationUnsupported {
|
|
117
|
+
kind: "composite_primary_key" | "no_primary_key" | "self_referential_fk" | "array_column" | "user_defined_type" | "auth_users_reference" | "unmapped_type" | "storage_bucket_files" | "auth_user_passwords";
|
|
118
|
+
/** "schema.table" or "schema.table.column" depending on `kind`. */
|
|
119
|
+
source: string;
|
|
120
|
+
reason: string;
|
|
121
|
+
suggestion: string;
|
|
122
|
+
}
|
|
123
|
+
export interface MigrationPreview {
|
|
124
|
+
/** Echo of the source projectRef from introspection. */
|
|
125
|
+
sourceProjectRef: string;
|
|
126
|
+
/** ISO-8601 generation time, set by the caller. Deterministic null in tests. */
|
|
127
|
+
generatedAt: string;
|
|
128
|
+
collections: PocketBaseCollection[];
|
|
129
|
+
migrationNotes: {
|
|
130
|
+
rlsPolicies: MigrationRlsPolicyNote[];
|
|
131
|
+
unsupported: MigrationUnsupported[];
|
|
132
|
+
authMigration: {
|
|
133
|
+
userCount: number;
|
|
134
|
+
note: string;
|
|
135
|
+
} | null;
|
|
136
|
+
storageMigration: {
|
|
137
|
+
buckets: string[];
|
|
138
|
+
note: string;
|
|
139
|
+
} | null;
|
|
140
|
+
};
|
|
141
|
+
/** Aggregate warnings (count of unsupported items + table-level red flags). Plain strings for CLI rendering. */
|
|
142
|
+
warnings: string[];
|
|
143
|
+
/** Counts so a UI or agent doesn't have to walk the arrays. */
|
|
144
|
+
summary: {
|
|
145
|
+
collectionCount: number;
|
|
146
|
+
fieldCount: number;
|
|
147
|
+
relationFieldCount: number;
|
|
148
|
+
unsupportedCount: number;
|
|
149
|
+
rlsPolicyCount: number;
|
|
150
|
+
manualRlsPolicyCount: number;
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
export interface MapOptions {
|
|
154
|
+
/**
|
|
155
|
+
* Override the timestamp baked into `generatedAt`. Tests pin a
|
|
156
|
+
* deterministic value; production callers leave undefined and let
|
|
157
|
+
* the mapper read the wall clock.
|
|
158
|
+
*/
|
|
159
|
+
now?: () => Date;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Map a Supabase introspection result to a PocketBase migration preview.
|
|
163
|
+
* Pure (no I/O). Safe to call repeatedly.
|
|
164
|
+
*
|
|
165
|
+
* The function never throws on a malformed input — every "I don't
|
|
166
|
+
* know how to map this" case becomes a `MigrationUnsupported` entry
|
|
167
|
+
* so the user gets the full picture in one pass rather than the
|
|
168
|
+
* mapper bailing out on the first weird column.
|
|
169
|
+
*/
|
|
170
|
+
export declare function mapSupabaseToPocketBase(introspection: Pick<InspectSupabaseResult, "projectRef" | "tables" | "storageBuckets" | "authUsersCount">, options?: MapOptions): MigrationPreview;
|
|
171
|
+
//# sourceMappingURL=migrate-supabase-map.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate-supabase-map.d.ts","sourceRoot":"","sources":["../../src/commands/migrate-supabase-map.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EAItB,MAAM,oBAAoB,CAAC;AAE5B;;;;;;;;;;;;;GAaG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAC3B,MAAM,GACN,QAAQ,GACR,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,UAAU,GACV,QAAQ,CAAC;AAEb,MAAM,WAAW,yBAAyB;IACxC,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;IACvB,SAAS,EAAE,CAAC,CAAC;CACd;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,EAAE,CAAC,CAAC;CACd;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,mBAAmB,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,kGAAkG;IAClG,MAAM,EAAE,OAAO,CAAC;IAChB,oFAAoF;IACpF,OAAO,EACH,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GACrB,yBAAyB,GACzB,uBAAuB,GACvB;QAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAChE;;;;OAIG;IACH,MAAM,EAAE;QACN,YAAY,EAAE,MAAM,CAAC;QACrB,YAAY,EAAE,MAAM,CAAC;QACrB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,gFAAgF;IAChF,WAAW,EAAE,MAAM,CAAC;IACpB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