@percher/core 0.2.6 → 0.3.0

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 (206) hide show
  1. package/dist/ai-files-manifest.d.ts +28 -0
  2. package/dist/ai-files-manifest.d.ts.map +1 -0
  3. package/dist/ai-files-manifest.js +96 -0
  4. package/dist/ai-files-manifest.js.map +1 -0
  5. package/dist/commands/account.d.ts +51 -0
  6. package/dist/commands/account.d.ts.map +1 -0
  7. package/dist/commands/account.js +88 -0
  8. package/dist/commands/account.js.map +1 -0
  9. package/dist/commands/ai-files.d.ts +73 -0
  10. package/dist/commands/ai-files.d.ts.map +1 -0
  11. package/dist/commands/ai-files.js +179 -0
  12. package/dist/commands/ai-files.js.map +1 -0
  13. package/dist/commands/billing.d.ts +1 -1
  14. package/dist/commands/billing.d.ts.map +1 -1
  15. package/dist/commands/billing.js +1 -1
  16. package/dist/commands/billing.js.map +1 -1
  17. package/dist/commands/continue.d.ts +48 -0
  18. package/dist/commands/continue.d.ts.map +1 -0
  19. package/dist/commands/continue.js +121 -0
  20. package/dist/commands/continue.js.map +1 -0
  21. package/dist/commands/create.d.ts +1 -1
  22. package/dist/commands/create.d.ts.map +1 -1
  23. package/dist/commands/create.js +1 -1
  24. package/dist/commands/create.js.map +1 -1
  25. package/dist/commands/dashboard.d.ts +15 -0
  26. package/dist/commands/dashboard.d.ts.map +1 -0
  27. package/dist/commands/dashboard.js +33 -0
  28. package/dist/commands/dashboard.js.map +1 -0
  29. package/dist/commands/data-export.d.ts +21 -0
  30. package/dist/commands/data-export.d.ts.map +1 -0
  31. package/dist/commands/data-export.js +36 -0
  32. package/dist/commands/data-export.js.map +1 -0
  33. package/dist/commands/data.d.ts +1 -1
  34. package/dist/commands/data.d.ts.map +1 -1
  35. package/dist/commands/data.js +1 -1
  36. package/dist/commands/data.js.map +1 -1
  37. package/dist/commands/delete.d.ts +1 -1
  38. package/dist/commands/delete.d.ts.map +1 -1
  39. package/dist/commands/delete.js +1 -1
  40. package/dist/commands/delete.js.map +1 -1
  41. package/dist/commands/deploys.d.ts +2 -2
  42. package/dist/commands/deploys.d.ts.map +1 -1
  43. package/dist/commands/deploys.js +21 -5
  44. package/dist/commands/deploys.js.map +1 -1
  45. package/dist/commands/dev.d.ts +1 -9
  46. package/dist/commands/dev.d.ts.map +1 -1
  47. package/dist/commands/dev.js +77 -23
  48. package/dist/commands/dev.js.map +1 -1
  49. package/dist/commands/diagnose.d.ts +1 -1
  50. package/dist/commands/diagnose.d.ts.map +1 -1
  51. package/dist/commands/diagnose.js +1 -1
  52. package/dist/commands/diagnose.js.map +1 -1
  53. package/dist/commands/doctor.d.ts +63 -1
  54. package/dist/commands/doctor.d.ts.map +1 -1
  55. package/dist/commands/doctor.js +792 -10
  56. package/dist/commands/doctor.js.map +1 -1
  57. package/dist/commands/domains.d.ts +1 -1
  58. package/dist/commands/domains.d.ts.map +1 -1
  59. package/dist/commands/domains.js +1 -1
  60. package/dist/commands/domains.js.map +1 -1
  61. package/dist/commands/env-scan.d.ts +2 -0
  62. package/dist/commands/env-scan.d.ts.map +1 -0
  63. package/dist/commands/env-scan.js +92 -0
  64. package/dist/commands/env-scan.js.map +1 -0
  65. package/dist/commands/env.d.ts +1 -1
  66. package/dist/commands/env.d.ts.map +1 -1
  67. package/dist/commands/env.js +1 -1
  68. package/dist/commands/env.js.map +1 -1
  69. package/dist/commands/export.d.ts +1 -1
  70. package/dist/commands/export.js +1 -1
  71. package/dist/commands/generate.d.ts +1 -1
  72. package/dist/commands/generate.d.ts.map +1 -1
  73. package/dist/commands/generate.js +14 -9
  74. package/dist/commands/generate.js.map +1 -1
  75. package/dist/commands/github.d.ts +60 -0
  76. package/dist/commands/github.d.ts.map +1 -0
  77. package/dist/commands/github.js +112 -0
  78. package/dist/commands/github.js.map +1 -0
  79. package/dist/commands/import-project.d.ts +1 -1
  80. package/dist/commands/import-project.d.ts.map +1 -1
  81. package/dist/commands/import-project.js +1 -1
  82. package/dist/commands/import-project.js.map +1 -1
  83. package/dist/commands/init.d.ts +1 -1
  84. package/dist/commands/init.d.ts.map +1 -1
  85. package/dist/commands/init.js +1 -1
  86. package/dist/commands/init.js.map +1 -1
  87. package/dist/commands/insights.d.ts +1 -1
  88. package/dist/commands/insights.d.ts.map +1 -1
  89. package/dist/commands/insights.js +1 -1
  90. package/dist/commands/insights.js.map +1 -1
  91. package/dist/commands/login.d.ts +1 -1
  92. package/dist/commands/login.d.ts.map +1 -1
  93. package/dist/commands/login.js +1 -1
  94. package/dist/commands/login.js.map +1 -1
  95. package/dist/commands/logs.d.ts +1 -1
  96. package/dist/commands/logs.d.ts.map +1 -1
  97. package/dist/commands/logs.js +1 -1
  98. package/dist/commands/logs.js.map +1 -1
  99. package/dist/commands/mcp.d.ts +1 -1
  100. package/dist/commands/mcp.d.ts.map +1 -1
  101. package/dist/commands/mcp.js +1 -1
  102. package/dist/commands/mcp.js.map +1 -1
  103. package/dist/commands/open.d.ts +1 -1
  104. package/dist/commands/open.d.ts.map +1 -1
  105. package/dist/commands/open.js +1 -1
  106. package/dist/commands/open.js.map +1 -1
  107. package/dist/commands/publish-failure.d.ts +31 -0
  108. package/dist/commands/publish-failure.d.ts.map +1 -0
  109. package/dist/commands/publish-failure.js +142 -0
  110. package/dist/commands/publish-failure.js.map +1 -0
  111. package/dist/commands/publish-node.d.ts +13 -0
  112. package/dist/commands/publish-node.d.ts.map +1 -0
  113. package/dist/commands/publish-node.js +38 -0
  114. package/dist/commands/publish-node.js.map +1 -0
  115. package/dist/commands/publish.d.ts +87 -3
  116. package/dist/commands/publish.d.ts.map +1 -1
  117. package/dist/commands/publish.js +589 -156
  118. package/dist/commands/publish.js.map +1 -1
  119. package/dist/commands/push.d.ts +45 -8
  120. package/dist/commands/push.d.ts.map +1 -1
  121. package/dist/commands/push.js +215 -22
  122. package/dist/commands/push.js.map +1 -1
  123. package/dist/commands/redeploy.d.ts +28 -0
  124. package/dist/commands/redeploy.d.ts.map +1 -0
  125. package/dist/commands/redeploy.js +417 -0
  126. package/dist/commands/redeploy.js.map +1 -0
  127. package/dist/commands/rename.d.ts +1 -1
  128. package/dist/commands/rename.d.ts.map +1 -1
  129. package/dist/commands/rename.js +1 -1
  130. package/dist/commands/rename.js.map +1 -1
  131. package/dist/commands/reproduce.d.ts +64 -0
  132. package/dist/commands/reproduce.d.ts.map +1 -0
  133. package/dist/commands/reproduce.js +211 -0
  134. package/dist/commands/reproduce.js.map +1 -0
  135. package/dist/commands/reset-superuser.d.ts +1 -1
  136. package/dist/commands/reset-superuser.d.ts.map +1 -1
  137. package/dist/commands/reset-superuser.js +1 -1
  138. package/dist/commands/reset-superuser.js.map +1 -1
  139. package/dist/commands/restore.d.ts +79 -0
  140. package/dist/commands/restore.d.ts.map +1 -0
  141. package/dist/commands/restore.js +164 -0
  142. package/dist/commands/restore.js.map +1 -0
  143. package/dist/commands/resume.d.ts +1 -1
  144. package/dist/commands/resume.d.ts.map +1 -1
  145. package/dist/commands/resume.js +1 -1
  146. package/dist/commands/resume.js.map +1 -1
  147. package/dist/commands/rollback.d.ts +20 -8
  148. package/dist/commands/rollback.d.ts.map +1 -1
  149. package/dist/commands/rollback.js +11 -6
  150. package/dist/commands/rollback.js.map +1 -1
  151. package/dist/commands/unsuspend.d.ts +35 -0
  152. package/dist/commands/unsuspend.d.ts.map +1 -0
  153. package/dist/commands/unsuspend.js +27 -0
  154. package/dist/commands/unsuspend.js.map +1 -0
  155. package/dist/commands/versions.d.ts +1 -1
  156. package/dist/commands/versions.d.ts.map +1 -1
  157. package/dist/commands/versions.js +1 -1
  158. package/dist/commands/versions.js.map +1 -1
  159. package/dist/commands/wait-deploy.d.ts +92 -0
  160. package/dist/commands/wait-deploy.d.ts.map +1 -0
  161. package/dist/commands/wait-deploy.js +225 -0
  162. package/dist/commands/wait-deploy.js.map +1 -0
  163. package/dist/env-scan-source.d.ts +39 -0
  164. package/dist/env-scan-source.d.ts.map +1 -0
  165. package/dist/env-scan-source.js +332 -0
  166. package/dist/env-scan-source.js.map +1 -0
  167. package/dist/error-classifier.d.ts.map +1 -1
  168. package/dist/error-classifier.js +67 -4
  169. package/dist/error-classifier.js.map +1 -1
  170. package/dist/errors.d.ts +8 -1
  171. package/dist/errors.d.ts.map +1 -1
  172. package/dist/errors.js +2 -0
  173. package/dist/errors.js.map +1 -1
  174. package/dist/index.d.ts +14 -1
  175. package/dist/index.d.ts.map +1 -1
  176. package/dist/index.js +13 -0
  177. package/dist/index.js.map +1 -1
  178. package/dist/plans.d.ts +11 -0
  179. package/dist/plans.d.ts.map +1 -1
  180. package/dist/plans.js +10 -0
  181. package/dist/plans.js.map +1 -1
  182. package/dist/poll-deployment.d.ts +47 -0
  183. package/dist/poll-deployment.d.ts.map +1 -0
  184. package/dist/poll-deployment.js +57 -0
  185. package/dist/poll-deployment.js.map +1 -0
  186. package/dist/recovery.d.ts +356 -0
  187. package/dist/recovery.d.ts.map +1 -0
  188. package/dist/recovery.js +299 -0
  189. package/dist/recovery.js.map +1 -0
  190. package/dist/stream-utils.d.ts +21 -0
  191. package/dist/stream-utils.d.ts.map +1 -0
  192. package/dist/stream-utils.js +41 -0
  193. package/dist/stream-utils.js.map +1 -0
  194. package/dist/templates/ai-files/claude-md.d.ts +7 -0
  195. package/dist/templates/ai-files/claude-md.d.ts.map +1 -0
  196. package/dist/templates/ai-files/claude-md.js +78 -0
  197. package/dist/templates/ai-files/claude-md.js.map +1 -0
  198. package/dist/templates/ai-files/cursor-percher-mdc.d.ts +7 -0
  199. package/dist/templates/ai-files/cursor-percher-mdc.d.ts.map +1 -0
  200. package/dist/templates/ai-files/cursor-percher-mdc.js +111 -0
  201. package/dist/templates/ai-files/cursor-percher-mdc.js.map +1 -0
  202. package/dist/templates/ai-files/index.d.ts +8 -0
  203. package/dist/templates/ai-files/index.d.ts.map +1 -0
  204. package/dist/templates/ai-files/index.js +4 -0
  205. package/dist/templates/ai-files/index.js.map +1 -0
  206. package/package.json +5 -5
@@ -0,0 +1,28 @@
1
+ import type { AiFileTemplate } from "./templates/ai-files";
2
+ export interface ManifestEntry {
3
+ templateId: string;
4
+ templateVersion: string;
5
+ installedHash: string;
6
+ }
7
+ export interface AiFilesManifest {
8
+ version: 1;
9
+ files: Record<string, ManifestEntry>;
10
+ }
11
+ export declare function hashContent(content: string): string;
12
+ export declare function manifestPath(projectRoot: string): string;
13
+ export declare function loadManifest(projectRoot: string): AiFilesManifest;
14
+ export declare function saveManifest(projectRoot: string, manifest: AiFilesManifest): void;
15
+ /**
16
+ * Returns true if any existing path component between projectRoot and filePath
17
+ * is a symlink. Prevents --force writes from escaping the project root via a
18
+ * symlink pointing outside it.
19
+ */
20
+ export declare function hasSymlinkInPath(projectRoot: string, filePath: string): boolean;
21
+ export type FileStatus = "missing" | "managed" | "modified" | "foreign";
22
+ export interface FileClassification {
23
+ status: FileStatus;
24
+ installedVersion: string | undefined;
25
+ latestVersion: string;
26
+ }
27
+ export declare function classifyFile(projectRoot: string, template: AiFileTemplate, manifest: AiFilesManifest): FileClassification;
28
+ //# sourceMappingURL=ai-files-manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-files-manifest.d.ts","sourceRoot":"","sources":["../src/ai-files-manifest.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,CAAC,CAAC;IACX,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;CACtC;AAKD,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAGnD;AAED,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,eAAe,CAYjE;AAED,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,GAAG,IAAI,CAIjF;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAY/E;AAED,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;AAExE,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,UAAU,CAAC;IACnB,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,YAAY,CAC1B,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,cAAc,EACxB,QAAQ,EAAE,eAAe,GACxB,kBAAkB,CA4CpB"}
@@ -0,0 +1,96 @@
1
+ import { createHash } from "node:crypto";
2
+ import { existsSync, lstatSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
3
+ import { dirname, join, resolve } from "node:path";
4
+ const MANIFEST_REL = ".percher/ai-files-state.json";
5
+ const EMPTY_MANIFEST = { version: 1, files: {} };
6
+ export function hashContent(content) {
7
+ const normalised = content.replace(/\r\n/g, "\n");
8
+ return createHash("sha256").update(normalised, "utf8").digest("hex");
9
+ }
10
+ export function manifestPath(projectRoot) {
11
+ return join(projectRoot, MANIFEST_REL);
12
+ }
13
+ export function loadManifest(projectRoot) {
14
+ const p = manifestPath(projectRoot);
15
+ if (!existsSync(p))
16
+ return { ...EMPTY_MANIFEST, files: {} };
17
+ try {
18
+ const parsed = JSON.parse(readFileSync(p, "utf8"));
19
+ if (parsed?.version !== 1 || typeof parsed.files !== "object") {
20
+ return { ...EMPTY_MANIFEST, files: {} };
21
+ }
22
+ return parsed;
23
+ }
24
+ catch {
25
+ return { ...EMPTY_MANIFEST, files: {} };
26
+ }
27
+ }
28
+ export function saveManifest(projectRoot, manifest) {
29
+ const p = manifestPath(projectRoot);
30
+ mkdirSync(dirname(p), { recursive: true });
31
+ writeFileSync(p, `${JSON.stringify(manifest, null, 2)}\n`, "utf8");
32
+ }
33
+ /**
34
+ * Returns true if any existing path component between projectRoot and filePath
35
+ * is a symlink. Prevents --force writes from escaping the project root via a
36
+ * symlink pointing outside it.
37
+ */
38
+ export function hasSymlinkInPath(projectRoot, filePath) {
39
+ const root = resolve(projectRoot);
40
+ let current = resolve(filePath);
41
+ while (current !== root && current !== dirname(current)) {
42
+ try {
43
+ if (lstatSync(current).isSymbolicLink())
44
+ return true;
45
+ }
46
+ catch {
47
+ // Path component does not exist yet — safe.
48
+ }
49
+ current = dirname(current);
50
+ }
51
+ return false;
52
+ }
53
+ export function classifyFile(projectRoot, template, manifest) {
54
+ const filePath = join(projectRoot, template.path);
55
+ const onDisk = existsSync(filePath);
56
+ const entry = manifest.files[template.path];
57
+ // Treat any symlink in the path as unmanageable — writing through it
58
+ // could escape the project root. Classify as foreign so the caller
59
+ // skips the file (or requires explicit confirmation) rather than
60
+ // overwriting a target outside cwd.
61
+ if (onDisk && hasSymlinkInPath(projectRoot, filePath)) {
62
+ return {
63
+ status: "foreign",
64
+ installedVersion: undefined,
65
+ latestVersion: template.version,
66
+ };
67
+ }
68
+ if (!onDisk) {
69
+ return {
70
+ status: "missing",
71
+ installedVersion: entry?.templateVersion,
72
+ latestVersion: template.version,
73
+ };
74
+ }
75
+ if (!entry) {
76
+ return {
77
+ status: "foreign",
78
+ installedVersion: undefined,
79
+ latestVersion: template.version,
80
+ };
81
+ }
82
+ const diskHash = hashContent(readFileSync(filePath, "utf8"));
83
+ if (diskHash === entry.installedHash) {
84
+ return {
85
+ status: "managed",
86
+ installedVersion: entry.templateVersion,
87
+ latestVersion: template.version,
88
+ };
89
+ }
90
+ return {
91
+ status: "modified",
92
+ installedVersion: entry.templateVersion,
93
+ latestVersion: template.version,
94
+ };
95
+ }
96
+ //# sourceMappingURL=ai-files-manifest.js.map
@@ -0,0 +1 @@
1
+ {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AQ,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAE5C,qEAAqE;IACrE,mEAAmE;IACnE,iEAAiE;IACjE,oCAAoC;IACpC,IAAI,MAAM,IAAI,gBAAgB,CAAC,WAAW,EAAE,QAAQ,CAAC,EAAE,CAAC;QACtD,OAAO;YACL,MAAM,EAAE,SAAS;YACjB,gBAAgB,EAAE,SAAS;YAC3B,aAAa,EAAE,QAAQ,CAAC,OAAO;SAChC,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO;YACL,MAAM,EAAE,SAAS;YACjB,gBAAgB,EAAE,KAAK,EAAE,eAAe;YACxC,aAAa,EAAE,QAAQ,CAAC,OAAO;SAChC,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO;YACL,MAAM,EAAE,SAAS;YACjB,gBAAgB,EAAE,SAAS;YAC3B,aAAa,EAAE,QAAQ,CAAC,OAAO;SAChC,CAAC;IACJ,CAAC;IACD,MAAM,QAAQ,GAAG,WAAW,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;IAC7D,IAAI,QAAQ,KAAK,KAAK,CAAC,aAAa,EAAE,CAAC;QACrC,OAAO;YACL,MAAM,EAAE,SAAS;YACjB,gBAAgB,EAAE,KAAK,CAAC,eAAe;YACvC,aAAa,EAAE,QAAQ,CAAC,OAAO;SAChC,CAAC;IACJ,CAAC;IACD,OAAO;QACL,MAAM,EAAE,UAAU;QAClB,gBAAgB,EAAE,KAAK,CAAC,eAAe;QACvC,aAAa,EAAE,QAAQ,CAAC,OAAO;KAChC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,51 @@
1
+ import { z } from "zod/v3";
2
+ import type { Context } from "../context";
3
+ /**
4
+ * IMPLEMENTING-followup item 7 — GDPR account commands. The server
5
+ * already exposes GET /account/export (Art. 20) and DELETE /account
6
+ * (Art. 17); these are the user-facing wrappers that surface them
7
+ * through CLI + MCP.
8
+ */
9
+ export declare const accountExportInputSchema: z.ZodObject<{
10
+ out: z.ZodOptional<z.ZodString>;
11
+ includeAppData: z.ZodOptional<z.ZodBoolean>;
12
+ }, "strip", z.ZodTypeAny, {
13
+ out?: string | undefined;
14
+ includeAppData?: boolean | undefined;
15
+ }, {
16
+ out?: string | undefined;
17
+ includeAppData?: boolean | undefined;
18
+ }>;
19
+ export type AccountExportInput = z.infer<typeof accountExportInputSchema>;
20
+ export interface AccountExportResult {
21
+ path: string;
22
+ bytes: number;
23
+ exportedAt: string;
24
+ /** Set when --include-app-data was used. */
25
+ appTarballs?: Array<{
26
+ app: string;
27
+ path: string;
28
+ bytes: number;
29
+ }>;
30
+ /**
31
+ * Apps whose data could not be downloaded (rate-limited, container
32
+ * stopped, etc.). Present only when --include-app-data is set. A
33
+ * non-empty array means the export is partial — automation should
34
+ * treat this as a soft failure and surface the details to the user.
35
+ */
36
+ appTarballsFailed?: Array<{
37
+ app: string;
38
+ error: string;
39
+ }>;
40
+ }
41
+ export declare function accountExport(ctx: Context, input: AccountExportInput): Promise<AccountExportResult>;
42
+ export declare const accountDeleteInputSchema: z.ZodObject<{
43
+ confirm: z.ZodString;
44
+ }, "strip", z.ZodTypeAny, {
45
+ confirm: string;
46
+ }, {
47
+ confirm: string;
48
+ }>;
49
+ export type AccountDeleteInput = z.infer<typeof accountDeleteInputSchema>;
50
+ export declare function accountDelete(ctx: Context, input: AccountDeleteInput): Promise<void>;
51
+ //# sourceMappingURL=account.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../src/commands/account.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAC3B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAI1C;;;;;GAKG;AAEH,eAAO,MAAM,wBAAwB;;;;;;;;;EAanC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,WAAW,CAAC,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAClE;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC3D;AAED,wBAAsB,aAAa,CACjC,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,kBAAkB,GACxB,OAAO,CAAC,mBAAmB,CAAC,CAqD9B;AAED,eAAO,MAAM,wBAAwB;;;;;;EAMnC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,wBAAsB,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgB1F"}
@@ -0,0 +1,88 @@
1
+ import { mkdir, writeFile } from "node:fs/promises";
2
+ import { join, resolve } from "node:path";
3
+ import { z } from "zod/v3";
4
+ import { PercherCoreError } from "../errors";
5
+ import { writeResponseToFile } from "../stream-utils";
6
+ /**
7
+ * IMPLEMENTING-followup item 7 — GDPR account commands. The server
8
+ * already exposes GET /account/export (Art. 20) and DELETE /account
9
+ * (Art. 17); these are the user-facing wrappers that surface them
10
+ * through CLI + MCP.
11
+ */
12
+ export const accountExportInputSchema = z.object({
13
+ out: z
14
+ .string()
15
+ .optional()
16
+ .describe("Output file path for the metadata JSON. Defaults to ./percher-export-<timestamp>.json. Ignored when --include-app-data is set (a directory is created instead)."),
17
+ includeAppData: z
18
+ .boolean()
19
+ .optional()
20
+ .describe("Also download per-app PocketBase data tarballs alongside the metadata JSON. Creates a percher-export-<timestamp>/ directory containing metadata.json and apps/<app>-pb.tar.gz for every PocketBase app. Rate-limited: 1 tarball per app per 24h."),
21
+ });
22
+ export async function accountExport(ctx, input) {
23
+ ctx.status("Exporting account data…");
24
+ const data = await ctx.client.account.exportData();
25
+ const json = JSON.stringify(data, null, 2);
26
+ if (input.includeAppData) {
27
+ // Create a versioned directory: percher-export-<timestamp>/
28
+ const stamp = new Date().toISOString().replace(/[:.]/g, "-").slice(0, 19);
29
+ const dir = resolve(ctx.cwd, `percher-export-${stamp}`);
30
+ await mkdir(join(dir, "apps"), { recursive: true });
31
+ const metaPath = join(dir, "metadata.json");
32
+ await writeFile(metaPath, json, "utf8");
33
+ const urls = data.dataExportUrls ?? [];
34
+ const appTarballs = [];
35
+ const appTarballsFailed = [];
36
+ for (const entry of urls) {
37
+ ctx.status?.(` Downloading ${entry.appName} data…`);
38
+ try {
39
+ const res = await ctx.client.apps.streamDataExport(entry.appName);
40
+ const tarPath = join(dir, "apps", `${entry.appName}-pb.tar.gz`);
41
+ const bytesWritten = await writeResponseToFile(res, tarPath);
42
+ appTarballs.push({ app: entry.appName, path: tarPath, bytes: bytesWritten });
43
+ }
44
+ catch (err) {
45
+ // Collect failures rather than aborting — one rate-limited app
46
+ // should not prevent the rest from downloading.
47
+ const msg = err instanceof Error ? err.message : String(err);
48
+ ctx.status?.(` ⚠ ${entry.appName}: ${msg} (skipped)`);
49
+ appTarballsFailed.push({ app: entry.appName, error: msg });
50
+ }
51
+ }
52
+ return {
53
+ path: dir,
54
+ bytes: Buffer.byteLength(json, "utf8"),
55
+ exportedAt: data.exportedAt,
56
+ appTarballs,
57
+ ...(appTarballsFailed.length > 0 && { appTarballsFailed }),
58
+ };
59
+ }
60
+ const fileName = input.out ?? `percher-export-${new Date().toISOString().replace(/[:.]/g, "-")}.json`;
61
+ const path = resolve(ctx.cwd, fileName);
62
+ await writeFile(path, json, "utf8");
63
+ return {
64
+ path,
65
+ bytes: Buffer.byteLength(json, "utf8"),
66
+ exportedAt: data.exportedAt,
67
+ };
68
+ }
69
+ export const accountDeleteInputSchema = z.object({
70
+ confirm: z
71
+ .string()
72
+ .describe("Must equal the signed-in user's email address. The server rejects anything else with CONFIRMATION_REQUIRED. This is a permanent, cascading delete: apps, deploys, env vars, custom domains, API tokens, and shared access are all wiped."),
73
+ });
74
+ export async function accountDelete(ctx, input) {
75
+ // The server validates `confirm === user.email` server-side, but
76
+ // surface a clearer client-side error before round-tripping if
77
+ // the value is obviously not an email — saves a user a confusing
78
+ // 400 when they typed "yes" expecting a y/N prompt.
79
+ if (!input.confirm.includes("@")) {
80
+ throw new PercherCoreError("Account deletion requires --confirm <your-email>. Pass the email address you sign in with to confirm.", {
81
+ code: "account.delete.confirmation-required",
82
+ hint: "Example: percher account delete --confirm you@example.com",
83
+ });
84
+ }
85
+ ctx.status("Deleting account…");
86
+ await ctx.client.account.deleteAccount(input.confirm);
87
+ }
88
+ //# sourceMappingURL=account.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account.js","sourceRoot":"","sources":["../../src/commands/account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,GAAG,EAAE,CAAC;SACH,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,iKAAiK,CAClK;IACH,cAAc,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C,OAAO,CAAC;IACvF,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IACxC,MAAM,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IAEpC,OAAO;QACL,IAAI;QACJ,KAAK,EAAE,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC;QACtC,UAAU,EAAE,IAAI,CAAC,UAAU;KAC5B,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,OAAO,EAAE,CAAC;SACP,MAAM,EAAE;SACR,QAAQ,CACP,0OAA0O,CAC3O;CACJ,CAAC,CAAC;AAGH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,GAAY,EAAE,KAAyB;IACzE,iEAAiE;IACjE,+DAA+D;IAC/D,iEAAiE;IACjE,oDAAoD;IACpD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACjC,MAAM,IAAI,gBAAgB,CACxB,uGAAuG,EACvG;YACE,IAAI,EAAE,sCAAsC;YAC5C,IAAI,EAAE,2DAA2D;SAClE,CACF,CAAC;IACJ,CAAC;IACD,GAAG,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;IAChC,MAAM,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AACxD,CAAC"}
@@ -0,0 +1,73 @@
1
+ import { z } from "zod/v3";
2
+ import { type FileStatus } from "../ai-files-manifest";
3
+ import type { Context } from "../context";
4
+ export declare const aiFilesInstallInputSchema: z.ZodObject<{
5
+ force: z.ZodOptional<z.ZodBoolean>;
6
+ }, "strip", z.ZodTypeAny, {
7
+ force?: boolean | undefined;
8
+ }, {
9
+ force?: boolean | undefined;
10
+ }>;
11
+ export declare const aiFilesUpdateInputSchema: z.ZodObject<{
12
+ force: z.ZodOptional<z.ZodBoolean>;
13
+ }, "strip", z.ZodTypeAny, {
14
+ force?: boolean | undefined;
15
+ }, {
16
+ force?: boolean | undefined;
17
+ }>;
18
+ export declare const aiFilesRemoveInputSchema: z.ZodObject<{
19
+ force: z.ZodOptional<z.ZodBoolean>;
20
+ }, "strip", z.ZodTypeAny, {
21
+ force?: boolean | undefined;
22
+ }, {
23
+ force?: boolean | undefined;
24
+ }>;
25
+ export declare const aiFilesStatusInputSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
26
+ export type InstallSkipReason = "already-installed" | "modified" | "foreign";
27
+ export type UpdateSkipReason = "modified" | "up-to-date" | "foreign" | "missing-from-manifest";
28
+ export interface InstallResult {
29
+ installed: Array<{
30
+ path: string;
31
+ templateVersion: string;
32
+ }>;
33
+ skipped: Array<{
34
+ path: string;
35
+ reason: InstallSkipReason;
36
+ detail?: string;
37
+ }>;
38
+ }
39
+ export interface UpdateResult {
40
+ updated: Array<{
41
+ path: string;
42
+ reason: "version-bump" | "reinstalled";
43
+ from?: string;
44
+ to: string;
45
+ }>;
46
+ skipped: Array<{
47
+ path: string;
48
+ reason: UpdateSkipReason;
49
+ }>;
50
+ }
51
+ export interface RemoveResult {
52
+ removed: Array<{
53
+ path: string;
54
+ }>;
55
+ skipped: Array<{
56
+ path: string;
57
+ reason: "modified" | "foreign" | "missing";
58
+ }>;
59
+ }
60
+ export interface StatusResult {
61
+ files: Array<{
62
+ path: string;
63
+ templateId: string;
64
+ status: FileStatus;
65
+ installedVersion: string | undefined;
66
+ latestVersion: string;
67
+ }>;
68
+ }
69
+ export declare function aiFilesInstall(ctx: Context, input: z.infer<typeof aiFilesInstallInputSchema>): Promise<InstallResult>;
70
+ export declare function aiFilesUpdate(ctx: Context, input: z.infer<typeof aiFilesUpdateInputSchema>): Promise<UpdateResult>;
71
+ export declare function aiFilesStatus(ctx: Context, _input: z.infer<typeof aiFilesStatusInputSchema>): Promise<StatusResult>;
72
+ export declare function aiFilesRemove(ctx: Context, input: z.infer<typeof aiFilesRemoveInputSchema>): Promise<RemoveResult>;
73
+ //# sourceMappingURL=ai-files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-files.d.ts","sourceRoot":"","sources":["../../src/commands/ai-files.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B,OAAO,EAEL,KAAK,UAAU,EAKhB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAG1C,eAAO,MAAM,yBAAyB;;;;;;EAEpC,CAAC;AACH,eAAO,MAAM,wBAAwB;;;;;;EAEnC,CAAC;AACH,eAAO,MAAM,wBAAwB;;;;;;EAEnC,CAAC;AACH,eAAO,MAAM,wBAAwB,gDAAe,CAAC;AAErD,MAAM,MAAM,iBAAiB,GAAG,mBAAmB,GAAG,UAAU,GAAG,SAAS,CAAC;AAC7E,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,YAAY,GAAG,SAAS,GAAG,uBAAuB,CAAC;AAE/F,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,eAAe,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC5D,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,iBAAiB,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC9E;AACD,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,KAAK,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,cAAc,GAAG,aAAa,CAAC;QACvC,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,EAAE,EAAE,MAAM,CAAC;KACZ,CAAC,CAAC;IACH,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,M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3
+ import { z } from "zod/v3";
4
+ import { hasSymlinkInPath } from "../ai-files-manifest";
5
+ import { classifyFile, hashContent, loadManifest, saveManifest, } from "../ai-files-manifest";
6
+ import { AI_FILE_TEMPLATES } from "../templates/ai-files";
7
+ export const aiFilesInstallInputSchema = z.object({
8
+ force: z.boolean().optional(),
9
+ });
10
+ export const aiFilesUpdateInputSchema = z.object({
11
+ force: z.boolean().optional(),
12
+ });
13
+ export const aiFilesRemoveInputSchema = z.object({
14
+ force: z.boolean().optional(),
15
+ });
16
+ export const aiFilesStatusInputSchema = z.object({});
17
+ function writeTemplate(projectRoot, t) {
18
+ const target = join(projectRoot, t.path);
19
+ if (hasSymlinkInPath(projectRoot, target)) {
20
+ throw new Error(`Refusing to write ${t.path}: a symlink in the path could redirect the write outside the project root.`);
21
+ }
22
+ mkdirSync(dirname(target), { recursive: true });
23
+ writeFileSync(target, t.content, "utf8");
24
+ }
25
+ function ensureGitignored(projectRoot) {
26
+ const gitignorePath = join(projectRoot, ".gitignore");
27
+ const marker = ".percher/";
28
+ let current = "";
29
+ try {
30
+ current = readFileSync(gitignorePath, "utf8");
31
+ }
32
+ catch {
33
+ /* missing file — we'll create it */
34
+ }
35
+ const lines = current.split(/\r?\n/);
36
+ if (lines.some((l) => l.trim() === marker))
37
+ return;
38
+ const next = current.length === 0 ? `${marker}\n` : `${current.replace(/\n*$/, "")}\n${marker}\n`;
39
+ writeFileSync(gitignorePath, next, "utf8");
40
+ }
41
+ function applyManifestEntry(manifest, t) {
42
+ manifest.files[t.path] = {
43
+ templateId: t.id,
44
+ templateVersion: t.version,
45
+ installedHash: hashContent(t.content),
46
+ };
47
+ }
48
+ export async function aiFilesInstall(ctx, input) {
49
+ const root = ctx.cwd;
50
+ const manifest = loadManifest(root);
51
+ const installed = [];
52
+ const skipped = [];
53
+ for (const t of AI_FILE_TEMPLATES) {
54
+ const c = classifyFile(root, t, manifest);
55
+ if (c.status === "managed") {
56
+ skipped.push({ path: t.path, reason: "already-installed" });
57
+ continue;
58
+ }
59
+ if (c.status === "modified" && !input.force) {
60
+ skipped.push({ path: t.path, reason: "modified" });
61
+ continue;
62
+ }
63
+ if (c.status === "foreign") {
64
+ // Symlinks at the install path get classified as foreign, but
65
+ // unlike content-mismatch foreign (which --force can overwrite),
66
+ // a symlink could redirect the write outside the project root.
67
+ // Skip even with --force so the safety guard can't be bypassed
68
+ // by a normal flag — the only way to install over a symlink is
69
+ // for the user to remove the symlink first.
70
+ const target = join(root, t.path);
71
+ if (!input.force || hasSymlinkInPath(root, target)) {
72
+ skipped.push({ path: t.path, reason: "foreign" });
73
+ continue;
74
+ }
75
+ }
76
+ writeTemplate(root, t);
77
+ applyManifestEntry(manifest, t);
78
+ installed.push({ path: t.path, templateVersion: t.version });
79
+ }
80
+ if (installed.length > 0) {
81
+ ensureGitignored(root);
82
+ }
83
+ saveManifest(root, manifest);
84
+ return { installed, skipped };
85
+ }
86
+ export async function aiFilesUpdate(ctx, input) {
87
+ const root = ctx.cwd;
88
+ const manifest = loadManifest(root);
89
+ const updated = [];
90
+ const skipped = [];
91
+ for (const t of AI_FILE_TEMPLATES) {
92
+ const c = classifyFile(root, t, manifest);
93
+ const entry = manifest.files[t.path];
94
+ if (c.status === "foreign") {
95
+ skipped.push({ path: t.path, reason: "foreign" });
96
+ continue;
97
+ }
98
+ if (c.status === "modified" && !input.force) {
99
+ skipped.push({ path: t.path, reason: "modified" });
100
+ continue;
101
+ }
102
+ if (c.status === "missing" && !entry) {
103
+ skipped.push({ path: t.path, reason: "missing-from-manifest" });
104
+ continue;
105
+ }
106
+ if (c.status === "missing") {
107
+ writeTemplate(root, t);
108
+ applyManifestEntry(manifest, t);
109
+ updated.push({
110
+ path: t.path,
111
+ reason: "reinstalled",
112
+ from: entry?.templateVersion,
113
+ to: t.version,
114
+ });
115
+ continue;
116
+ }
117
+ // managed or (modified + force)
118
+ if (entry?.templateVersion === t.version && c.status === "managed") {
119
+ skipped.push({ path: t.path, reason: "up-to-date" });
120
+ continue;
121
+ }
122
+ writeTemplate(root, t);
123
+ applyManifestEntry(manifest, t);
124
+ updated.push({
125
+ path: t.path,
126
+ reason: "version-bump",
127
+ from: entry?.templateVersion,
128
+ to: t.version,
129
+ });
130
+ }
131
+ saveManifest(root, manifest);
132
+ return { updated, skipped };
133
+ }
134
+ export async function aiFilesStatus(ctx, _input) {
135
+ const root = ctx.cwd;
136
+ const manifest = loadManifest(root);
137
+ const files = AI_FILE_TEMPLATES.map((t) => {
138
+ const c = classifyFile(root, t, manifest);
139
+ return {
140
+ path: t.path,
141
+ templateId: t.id,
142
+ status: c.status,
143
+ installedVersion: c.installedVersion,
144
+ latestVersion: c.latestVersion,
145
+ };
146
+ });
147
+ return { files };
148
+ }
149
+ export async function aiFilesRemove(ctx, input) {
150
+ const root = ctx.cwd;
151
+ const manifest = loadManifest(root);
152
+ const removed = [];
153
+ const skipped = [];
154
+ for (const t of AI_FILE_TEMPLATES) {
155
+ const c = classifyFile(root, t, manifest);
156
+ const target = join(root, t.path);
157
+ if (c.status === "foreign") {
158
+ skipped.push({ path: t.path, reason: "foreign" });
159
+ continue;
160
+ }
161
+ if (c.status === "missing") {
162
+ if (manifest.files[t.path]) {
163
+ delete manifest.files[t.path];
164
+ }
165
+ skipped.push({ path: t.path, reason: "missing" });
166
+ continue;
167
+ }
168
+ if (c.status === "modified" && !input.force) {
169
+ skipped.push({ path: t.path, reason: "modified" });
170
+ continue;
171
+ }
172
+ rmSync(target, { force: true });
173
+ delete manifest.files[t.path];
174
+ removed.push({ path: t.path });
175
+ }
176
+ saveManifest(root, manifest);
177
+ return { removed, skipped };
178
+ }
179
+ //# sourceMappingURL=ai-files.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-files.js","sourceRoot":"","sources":["../../src/commands/ai-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACrF,OAAO,EAAE,OAAO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AC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YAChC,CAAC;YACD,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;YAClD,SAAS;QACX,CAAC;QACD,IAAI,CAAC,CAAC,MAAM,KAAK,UAAU,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YAC5C,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;YACnD,SAAS;QACX,CAAC;QACD,MAAM,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QAChC,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAC9B,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACjC,CAAC;IACD,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC7B,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AAC9B,CAAC"}
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import type { Context } from "../context";
3
3
  export declare const billingUpgradeInputSchema: z.ZodObject<{
4
4
  plan: z.ZodEnum<["starter", "maker", "pro"]>;
@@ -1 +1 @@
1
- {"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../../src/commands/billing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAG1C,eAAO,MAAM,yBAAyB;;;;;;EAEpC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,eA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BAAsB,cAAc,CAClC,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,mBAAmB,GACzB,OAAO,CAAC,oBAAoB,CAAC,CAc/B;AAED;;;;;;;GAOG;AACH,wBAAsB,aAAa,CACjC,GAAG,EAAE,OAAO,EACZ,MAAM,GAAE,kBAAuB,GAC9B,OAAO,CAAC,mBAAmB,CAAC,CAqB9B"}
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z } from "zod/v3";
2
2
  import { PercherCoreError } from "../errors";
3
3
  export const billingUpgradeInputSchema = z.object({
4
4
  plan: z.enum(["starter", "maker", "pro"]),
@@ -1 +1 @@
1
- {"version":3,"file":"billing.js","sourceRoot":"","sources":["../../src/commands/billing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;CAC1C,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAarD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,GAAY,EACZ,KAA0B;IAE1B,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACzD,OAAO;YACL,GAAG,EAAE,GAAG,CAAC,GAAG;YACZ,OAAO,EAAE,+BAA+B,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,GAAG,EAAE;SACjE,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,gBAAgB,CAAC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AC;AACH,CAAC"}
@@ -0,0 +1,48 @@
1
+ import type { Deployment } from "@percher/client";
2
+ import { z } from "zod/v3";
3
+ import type { Context } from "../context";
4
+ import type { PublishRecovery, RecoveryAction, SuggestedTool } from "../recovery";
5
+ export declare const continueInputSchema: z.ZodObject<{
6
+ app: z.ZodString;
7
+ deployId: z.ZodOptional<z.ZodString>;
8
+ }, "strip", z.ZodTypeAny, {
9
+ app: string;
10
+ deployId?: string | undefined;
11
+ }, {
12
+ app: string;
13
+ deployId?: string | undefined;
14
+ }>;
15
+ export type ContinueInput = z.infer<typeof continueInputSchema>;
16
+ export interface ContinueResult {
17
+ /** Snapshot of the deploy state we found. */
18
+ state: "live" | "in_progress" | "failed" | "replaced" | "no_deploys";
19
+ app: {
20
+ id: string;
21
+ name: string;
22
+ url: string;
23
+ };
24
+ deployment?: Deployment;
25
+ url?: string;
26
+ /** Single primary recommended action. Mirrors `recovery.nextAction`. */
27
+ nextAction: RecoveryAction;
28
+ /** Short reason — one sentence the agent can echo to the user. */
29
+ reason: string;
30
+ suggestedTool?: SuggestedTool;
31
+ args?: Record<string, unknown>;
32
+ /**
33
+ * Full recovery shape (with optional `alternativeActions` from the
34
+ * inspect path). The convenience fields above are the primary surface;
35
+ * `recovery` is here for callers that already know how to read it.
36
+ */
37
+ recovery: PublishRecovery;
38
+ summary: string;
39
+ }
40
+ /**
41
+ * FUTURE11 Phase 3 — read-only "what do I do next?" tool. Looks up the
42
+ * latest (or specified) deploy and returns a single primary action with
43
+ * pre-filled args. Never starts a new deploy. Never deletes data. The
44
+ * point is to collapse the multi-tool decision tree (publish vs push vs
45
+ * logs vs doctor vs deploys_inspect) into one question for the agent.
46
+ */
47
+ export declare function percherContinue(ctx: Context, input: ContinueInput): Promise<ContinueResult>;
48
+ //# sourceMappingURL=continue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"continue.d.ts","sourceRoot":"","sources":["../../src/commands/continue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAC3B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGlF,eAAO,MAAM,mBAAmB;;;;;;;;;EAQ9B,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,MAAM,WAAW,cAAc;IAC7B,6CAA6C;IAC7C,KAAK,EAAE,MAAM,GAAG,aAAa,GAAG,QAAQ,GAAG,UAAU,GAAG,YAAY,CAAC;IACrE,GAAG,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/C,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,wEAAwE;IACxE,UAAU,EAAE,cAAc,CAAC;IAC3B,kEAAkE;IAClE,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,EAAE,eAAe,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,CA8GjG"}