@percher/core 0.2.6 → 0.4.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 (226) 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 +3 -3
  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 +79 -24
  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 +75 -3
  54. package/dist/commands/doctor.d.ts.map +1 -1
  55. package/dist/commands/doctor.js +822 -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 +150 -0
  110. package/dist/commands/publish-failure.js.map +1 -0
  111. package/dist/commands/publish-node.d.ts +16 -0
  112. package/dist/commands/publish-node.d.ts.map +1 -0
  113. package/dist/commands/publish-node.js +42 -0
  114. package/dist/commands/publish-node.js.map +1 -0
  115. package/dist/commands/publish.d.ts +105 -3
  116. package/dist/commands/publish.d.ts.map +1 -1
  117. package/dist/commands/publish.js +746 -158
  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 +233 -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 +421 -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 +21 -8
  148. package/dist/commands/rollback.d.ts.map +1 -1
  149. package/dist/commands/rollback.js +12 -6
  150. package/dist/commands/rollback.js.map +1 -1
  151. package/dist/commands/status.d.ts +33 -0
  152. package/dist/commands/status.d.ts.map +1 -0
  153. package/dist/commands/status.js +48 -0
  154. package/dist/commands/status.js.map +1 -0
  155. package/dist/commands/unsuspend.d.ts +35 -0
  156. package/dist/commands/unsuspend.d.ts.map +1 -0
  157. package/dist/commands/unsuspend.js +27 -0
  158. package/dist/commands/unsuspend.js.map +1 -0
  159. package/dist/commands/versions.d.ts +1 -1
  160. package/dist/commands/versions.d.ts.map +1 -1
  161. package/dist/commands/versions.js +1 -1
  162. package/dist/commands/versions.js.map +1 -1
  163. package/dist/commands/wait-deploy.d.ts +92 -0
  164. package/dist/commands/wait-deploy.d.ts.map +1 -0
  165. package/dist/commands/wait-deploy.js +226 -0
  166. package/dist/commands/wait-deploy.js.map +1 -0
  167. package/dist/env-scan-source.d.ts +39 -0
  168. package/dist/env-scan-source.d.ts.map +1 -0
  169. package/dist/env-scan-source.js +332 -0
  170. package/dist/env-scan-source.js.map +1 -0
  171. package/dist/error-classifier.d.ts.map +1 -1
  172. package/dist/error-classifier.js +67 -4
  173. package/dist/error-classifier.js.map +1 -1
  174. package/dist/errors.d.ts +8 -1
  175. package/dist/errors.d.ts.map +1 -1
  176. package/dist/errors.js +2 -0
  177. package/dist/errors.js.map +1 -1
  178. package/dist/event-renderer.d.ts +17 -0
  179. package/dist/event-renderer.d.ts.map +1 -0
  180. package/dist/event-renderer.js +130 -0
  181. package/dist/event-renderer.js.map +1 -0
  182. package/dist/index.d.ts +16 -1
  183. package/dist/index.d.ts.map +1 -1
  184. package/dist/index.js +15 -0
  185. package/dist/index.js.map +1 -1
  186. package/dist/plans.d.ts +20 -0
  187. package/dist/plans.d.ts.map +1 -1
  188. package/dist/plans.js +15 -0
  189. package/dist/plans.js.map +1 -1
  190. package/dist/poll-deployment.d.ts +59 -0
  191. package/dist/poll-deployment.d.ts.map +1 -0
  192. package/dist/poll-deployment.js +93 -0
  193. package/dist/poll-deployment.js.map +1 -0
  194. package/dist/publish-retry.d.ts +29 -0
  195. package/dist/publish-retry.d.ts.map +1 -0
  196. package/dist/publish-retry.js +224 -0
  197. package/dist/publish-retry.js.map +1 -0
  198. package/dist/recovery.d.ts +356 -0
  199. package/dist/recovery.d.ts.map +1 -0
  200. package/dist/recovery.js +300 -0
  201. package/dist/recovery.js.map +1 -0
  202. package/dist/stream-utils.d.ts +21 -0
  203. package/dist/stream-utils.d.ts.map +1 -0
  204. package/dist/stream-utils.js +41 -0
  205. package/dist/stream-utils.js.map +1 -0
  206. package/dist/structured-error-codes.d.ts +30 -0
  207. package/dist/structured-error-codes.d.ts.map +1 -0
  208. package/dist/structured-error-codes.js +86 -0
  209. package/dist/structured-error-codes.js.map +1 -0
  210. package/dist/tarball.d.ts +11 -0
  211. package/dist/tarball.d.ts.map +1 -1
  212. package/dist/tarball.js +30 -9
  213. package/dist/tarball.js.map +1 -1
  214. package/dist/templates/ai-files/claude-md.d.ts +7 -0
  215. package/dist/templates/ai-files/claude-md.d.ts.map +1 -0
  216. package/dist/templates/ai-files/claude-md.js +78 -0
  217. package/dist/templates/ai-files/claude-md.js.map +1 -0
  218. package/dist/templates/ai-files/cursor-percher-mdc.d.ts +7 -0
  219. package/dist/templates/ai-files/cursor-percher-mdc.d.ts.map +1 -0
  220. package/dist/templates/ai-files/cursor-percher-mdc.js +111 -0
  221. package/dist/templates/ai-files/cursor-percher-mdc.js.map +1 -0
  222. package/dist/templates/ai-files/index.d.ts +8 -0
  223. package/dist/templates/ai-files/index.d.ts.map +1 -0
  224. package/dist/templates/ai-files/index.js +4 -0
  225. package/dist/templates/ai-files/index.js.map +1 -0
  226. package/package.json +6 -5
@@ -0,0 +1,300 @@
1
+ import { TIMEOUTS } from "@percher/shared/timeouts";
2
+ // ── Builders ─────────────────────────────────────────────────────────
3
+ //
4
+ // All recovery construction goes through these. Each builder enforces
5
+ // the required fields for its branch, so a typo or missing field is
6
+ // caught at compile time rather than producing an inline literal that
7
+ // silently violates the contract (e.g. ask_user without prompt).
8
+ /** Success / no-op recovery. `url` is the current live URL when known. */
9
+ export function recoveryNone(opts = {}) {
10
+ return {
11
+ retryable: false,
12
+ nextAction: "none",
13
+ reasonCode: opts.reasonCode ?? "none",
14
+ ...(opts.url !== undefined ? { url: opts.url } : {}),
15
+ };
16
+ }
17
+ /** Authentication required — agent should call `percher_login`. */
18
+ export function recoveryLogin(opts = {}) {
19
+ return {
20
+ retryable: false,
21
+ nextAction: "open_login",
22
+ suggestedTool: "percher_login",
23
+ args: {},
24
+ reasonCode: opts.reasonCode ?? "auth_required",
25
+ };
26
+ }
27
+ /** Wait on an in-flight deploy — agent should call `percher_wait_for_deploy`. */
28
+ export function recoveryWait(opts) {
29
+ return {
30
+ retryable: false,
31
+ nextAction: "wait_deploy",
32
+ suggestedTool: "percher_wait_for_deploy",
33
+ args: {
34
+ app: opts.app,
35
+ deployId: opts.deployId,
36
+ timeoutSeconds: opts.timeoutSeconds ?? TIMEOUTS.mcpWaitDeployDefault / 1000,
37
+ },
38
+ reasonCode: opts.reasonCode,
39
+ };
40
+ }
41
+ /** Route to `percher_doctor` for an ambiguous failure that needs diagnosis. */
42
+ export function recoveryDoctor(opts) {
43
+ const args = {};
44
+ if (opts.app !== undefined)
45
+ args.app = opts.app;
46
+ if (opts.deployId !== undefined)
47
+ args.deployId = opts.deployId;
48
+ if (opts.mode !== undefined)
49
+ args.mode = opts.mode;
50
+ return {
51
+ retryable: false,
52
+ nextAction: "run_doctor",
53
+ suggestedTool: "percher_doctor",
54
+ args,
55
+ reasonCode: opts.reasonCode,
56
+ ...(opts.alternativeActions !== undefined
57
+ ? { alternativeActions: opts.alternativeActions }
58
+ : {}),
59
+ };
60
+ }
61
+ /** Build/runtime needs env keys — agent should call `percher_env_set`. */
62
+ export function recoveryEnv(opts) {
63
+ const args = {};
64
+ if (opts.app !== undefined)
65
+ args.app = opts.app;
66
+ if (opts.keys.length > 0)
67
+ args.keys = opts.keys;
68
+ return {
69
+ retryable: false,
70
+ nextAction: "set_env_vars",
71
+ suggestedTool: "percher_env_set",
72
+ args,
73
+ reasonCode: opts.reasonCode ?? "missing_env",
74
+ };
75
+ }
76
+ /**
77
+ * `percher.toml` is invalid or missing — agent should fix the file
78
+ * directly. `problems` carries the structured issue list (file,
79
+ * line/column, message) so the agent can apply edits without parsing
80
+ * a free-text error.
81
+ */
82
+ export function recoveryFixConfig(opts) {
83
+ return {
84
+ retryable: false,
85
+ nextAction: "fix_config",
86
+ problems: opts.problems,
87
+ reasonCode: opts.reasonCode ?? "config_invalid",
88
+ };
89
+ }
90
+ /**
91
+ * Build failed and the API extracted at least one structured problem
92
+ * with file/line data — agent should patch the offending file(s).
93
+ */
94
+ export function recoveryFixProblems(opts) {
95
+ return {
96
+ retryable: false,
97
+ nextAction: "fix_problems",
98
+ problems: opts.problems,
99
+ reasonCode: opts.reasonCode ?? "build_failed",
100
+ ...(opts.alternativeActions !== undefined
101
+ ? { alternativeActions: opts.alternativeActions }
102
+ : {}),
103
+ };
104
+ }
105
+ /** Transient infra failure — agent can re-issue the same call. */
106
+ export function recoveryRetry(opts) {
107
+ return {
108
+ retryable: true,
109
+ nextAction: "retry",
110
+ suggestedTool: opts.suggestedTool,
111
+ args: opts.args,
112
+ reasonCode: opts.reasonCode,
113
+ };
114
+ }
115
+ /**
116
+ * Human-input required. `prompt` MUST be a concrete question — agents
117
+ * surface it verbatim, so empty/placeholder strings violate the
118
+ * contract.
119
+ */
120
+ export function recoveryAsk(opts) {
121
+ if (!opts.prompt || opts.prompt.trim().length === 0) {
122
+ throw new Error("recoveryAsk requires a non-empty prompt");
123
+ }
124
+ return {
125
+ retryable: opts.retryable ?? false,
126
+ nextAction: "ask_user",
127
+ prompt: opts.prompt,
128
+ ...(opts.options !== undefined ? { options: opts.options } : {}),
129
+ reasonCode: opts.reasonCode,
130
+ };
131
+ }
132
+ /**
133
+ * Legacy `inspect_build_log` recovery — kept for the build-failure
134
+ * paths that haven't migrated to `run_doctor` yet. FUTURE12 Phase 4
135
+ * will replace these emit sites with `recoveryDoctor`.
136
+ */
137
+ export function recoveryInspectBuildLog(opts) {
138
+ const args = opts.deployId
139
+ ? { id: opts.deployId, app: opts.app }
140
+ : { latestFailed: true, app: opts.app };
141
+ return {
142
+ retryable: false,
143
+ nextAction: "inspect_build_log",
144
+ suggestedTool: "percher_deploys_inspect",
145
+ args,
146
+ reasonCode: opts.reasonCode ?? "build_failed",
147
+ ...(opts.alternativeActions !== undefined
148
+ ? { alternativeActions: opts.alternativeActions }
149
+ : {}),
150
+ };
151
+ }
152
+ // ── Legacy const exports ─────────────────────────────────────────────
153
+ //
154
+ // Kept as concrete values so existing call-sites compile until they
155
+ // migrate to the builders directly. Each is just the corresponding
156
+ // builder evaluated with default reasonCode.
157
+ /** Recovery on the success path. */
158
+ export const RECOVERY_NONE = recoveryNone();
159
+ /** Recovery for the unauthenticated path. */
160
+ export const RECOVERY_NEEDS_LOGIN = recoveryLogin();
161
+ /**
162
+ * Convert a `BuildProblem` into the lossless `RecoveryProblem` shape.
163
+ * Drops fields that aren't part of the recovery contract (severity,
164
+ * code) — those still ride on `error.problems` for the CLI's pretty
165
+ * printer. `hint` is folded into the message because it carries the
166
+ * actionable next step (especially for problems without a line, like
167
+ * malformed package.json) and the recovery contract has no separate
168
+ * hint slot.
169
+ *
170
+ * Exported so doctor (Phase 2c fix_problems path) can reuse the
171
+ * same hint-preserving mapping rather than re-implementing it.
172
+ */
173
+ export function buildProblemToRecoveryProblem(p) {
174
+ // p.file is optional on BuildProblem but the caller filters to
175
+ // file-bearing problems before reaching here.
176
+ const file = p.file ?? "";
177
+ const message = p.hint && p.hint.length > 0 ? `${p.message}\nHint: ${p.hint}` : p.message;
178
+ return {
179
+ file,
180
+ ...(typeof p.line === "number" ? { line: p.line } : {}),
181
+ ...(typeof p.column === "number" ? { column: p.column } : {}),
182
+ message,
183
+ };
184
+ }
185
+ /**
186
+ * Map an `ErrorClass` to a recovery action. Conservative by default —
187
+ * unknown classes resolve to `ask_user` so an agent never blindly retries
188
+ * something we haven't classified.
189
+ */
190
+ export function recoveryFromErrorClass(errorClass, failure = {}) {
191
+ switch (errorClass) {
192
+ case "missing_env":
193
+ return recoveryEnv({
194
+ keys: failure.missingEnvVars ?? [],
195
+ reasonCode: "missing_env",
196
+ });
197
+ case "infra_unavailable":
198
+ return recoveryRetry({
199
+ suggestedTool: "percher_publish",
200
+ args: failure.publishInput ?? {},
201
+ reasonCode: "infra_unavailable",
202
+ });
203
+ case "config_invalid":
204
+ return recoveryFixConfig({
205
+ problems: [
206
+ {
207
+ file: "percher.toml",
208
+ message: "percher.toml failed validation — fix the file and re-run.",
209
+ },
210
+ ],
211
+ reasonCode: "config_invalid",
212
+ });
213
+ case "build_failed":
214
+ case "missing_dependency":
215
+ case "health_check_timeout":
216
+ case "port_mismatch":
217
+ case "permission_denied":
218
+ case "runtime_crash":
219
+ case "oom_killed": {
220
+ // FUTURE1 Phase 2.3: when the API parser extracted at least one
221
+ // problem WITH a file location, give the agent a structured
222
+ // `fix_problems` recovery instead of routing through doctor.
223
+ // Problems without a file (missing-module by bare name,
224
+ // missing-build-env) are still actionable by hint but the agent
225
+ // has nothing to open — let doctor classify those so it can pull
226
+ // the build log and decide between set_env_vars / ask_user / etc.
227
+ const fileProblems = (failure.problems ?? []).filter((p) => p.file);
228
+ const reproduceAlt = failure.deployId
229
+ ? {
230
+ action: "reproduce_locally",
231
+ suggestedTool: "percher_reproduce",
232
+ args: { deployId: failure.deployId, app: failure.appName },
233
+ when: "after the primary path didn't surface a clear fix and the user has nixpacks installed locally",
234
+ }
235
+ : undefined;
236
+ if (fileProblems.length > 0) {
237
+ return recoveryFixProblems({
238
+ problems: fileProblems.map(buildProblemToRecoveryProblem),
239
+ reasonCode: "build_failed",
240
+ ...(reproduceAlt
241
+ ? {
242
+ alternativeActions: [
243
+ {
244
+ ...reproduceAlt,
245
+ when: "after fixing the file-located problems didn't make the build pass and the user has nixpacks installed locally",
246
+ },
247
+ ],
248
+ }
249
+ : {}),
250
+ });
251
+ }
252
+ // FUTURE12 Phase 4: route ambiguous build failures through
253
+ // `percher_doctor` instead of straight to `inspect_build_log`.
254
+ // Doctor's deploy-mode dispatch (Phase 2c) fetches the build
255
+ // log, runs `classifyError`, and returns a more specific
256
+ // recovery (`set_env_vars` when missing env keys are extracted,
257
+ // `fix_problems` when structured BuildProblems with file
258
+ // locations are extracted, falling back to `inspect_build_log`
259
+ // only when classification yields nothing). Publish/wait don't
260
+ // always have the build log when they hit this path, so handing
261
+ // off to doctor closes the loop with one consistent contract for
262
+ // agents.
263
+ //
264
+ // `inspect_build_log` is preserved as an `alternativeAction` so
265
+ // agents that want the raw log can still opt in after doctor's
266
+ // primary recovery doesn't help. Reproduce-locally chains after
267
+ // that for users with nixpacks installed.
268
+ const inspectAlt = {
269
+ action: "inspect_build_log",
270
+ suggestedTool: "percher_deploys_inspect",
271
+ args: failure.deployId
272
+ ? { id: failure.deployId, app: failure.appName }
273
+ : { latestFailed: true, app: failure.appName },
274
+ when: "after percher_doctor's recovery didn't yield a fix and you want to read the raw build log directly",
275
+ };
276
+ const alternativeActions = [inspectAlt];
277
+ if (reproduceAlt) {
278
+ alternativeActions.push({
279
+ ...reproduceAlt,
280
+ when: "after percher_doctor + percher_deploys_inspect didn't surface a clear fix and the user has nixpacks installed locally",
281
+ });
282
+ }
283
+ return recoveryDoctor({
284
+ app: failure.appName,
285
+ deployId: failure.deployId,
286
+ mode: "deploy",
287
+ reasonCode: "build_failed",
288
+ alternativeActions,
289
+ });
290
+ }
291
+ default:
292
+ // Exhaustiveness fallback. New `ErrorClass` values land here until a
293
+ // mapping is added — better than misclassifying as `retry`.
294
+ return recoveryAsk({
295
+ prompt: "Unexpected failure — Percher couldn't classify this error. Try `percher doctor` for diagnostics, or surface the error to the user.",
296
+ reasonCode: "unknown",
297
+ });
298
+ }
299
+ }
300
+ //# sourceMappingURL=recovery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recovery.js","sourceRoot":"","sources":["../src/recovery.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAyQpD,wEAAwE;AACxE,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,sEAAsE;AACtE,iEAAiE;AAEjE,0EAA0E;AAC1E,MAAM,UAAU,YAAY,CAAC,OAAkD,EAAE;IAC/E,OAAO;QACL,SAAS,EAAE,KAAK;QAChB,UAAU,EAAE,MAAM;QAClB,UAAU,EAAE,IAAI,CAAC,UAAU,IAAI,MAAM;QACrC,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACrD,CAAC;AACJ,CAAC;AAED,mEAAmE;AACnE,MA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AS;aACtB,CAAC,CAAC;IACP,CAAC;AACH,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Cross-runtime streaming file write.
3
+ *
4
+ * Both the CLI and MCP server advertise Node.js compatibility
5
+ * (`npx percher`, `npx -y @percher/mcp`). The core package must not
6
+ * call Bun globals directly.
7
+ *
8
+ * In Bun: Bun.write(path, Response) streams to disk natively and
9
+ * returns the byte count — zero intermediate allocation.
10
+ *
11
+ * In Node.js 18+: we use Readable.fromWeb() + pipeline() to pipe the
12
+ * Web ReadableStream from the fetch Response to a fs.createWriteStream.
13
+ * The byte count is read back from fs.stat after the pipeline finishes.
14
+ */
15
+ /**
16
+ * Node.js fallback — exported for direct testing so we don't need to
17
+ * mask the read-only Bun global in tests.
18
+ */
19
+ export declare function writeResponseToFileNode(res: Response, filePath: string): Promise<number>;
20
+ export declare function writeResponseToFile(res: Response, filePath: string): Promise<number>;
21
+ //# sourceMappingURL=stream-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stream-utils.d.ts","sourceRoot":"","sources":["../src/stream-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;GAGG;AACH,wBAAsB,uBAAuB,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAmB9F;AAED,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAQ1F"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Cross-runtime streaming file write.
3
+ *
4
+ * Both the CLI and MCP server advertise Node.js compatibility
5
+ * (`npx percher`, `npx -y @percher/mcp`). The core package must not
6
+ * call Bun globals directly.
7
+ *
8
+ * In Bun: Bun.write(path, Response) streams to disk natively and
9
+ * returns the byte count — zero intermediate allocation.
10
+ *
11
+ * In Node.js 18+: we use Readable.fromWeb() + pipeline() to pipe the
12
+ * Web ReadableStream from the fetch Response to a fs.createWriteStream.
13
+ * The byte count is read back from fs.stat after the pipeline finishes.
14
+ */
15
+ /**
16
+ * Node.js fallback — exported for direct testing so we don't need to
17
+ * mask the read-only Bun global in tests.
18
+ */
19
+ export async function writeResponseToFileNode(res, filePath) {
20
+ if (!res.body)
21
+ throw new Error("Server returned empty response body");
22
+ const { createWriteStream } = await import("node:fs");
23
+ const { stat } = await import("node:fs/promises");
24
+ const { Readable } = await import("node:stream");
25
+ const { pipeline } = await import("node:stream/promises");
26
+ const fileStream = createWriteStream(filePath);
27
+ // fromWeb converts a WHATWG ReadableStream to a Node.js Readable.
28
+ // The cast is needed because TypeScript's Node typedefs require
29
+ // stream.web.ReadableStream but fetch returns the global ReadableStream.
30
+ const nodeReadable = Readable.fromWeb(res.body);
31
+ await pipeline(nodeReadable, fileStream);
32
+ const { size } = await stat(filePath);
33
+ return size;
34
+ }
35
+ export async function writeResponseToFile(res, filePath) {
36
+ if (typeof Bun !== "undefined") {
37
+ return Bun.write(filePath, res);
38
+ }
39
+ return writeResponseToFileNode(res, filePath);
40
+ }
41
+ //# sourceMappingURL=stream-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stream-utils.js","sourceRoot":"","sources":["../src/stream-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,GAAa,EAAE,QAAgB;IAC3E,IAAI,CAAC,GAAG,CAAC,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IAEtE,MAAM,EAAE,iBAAiB,EAAE,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,CAAC;IACtD,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAC;IAClD,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC;IACjD,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,sBAAsB,CAAC,CAAC;IAE1D,MAAM,UAAU,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAC/C,kEAAkE;IAClE,gEAAgE;IAChE,yEAAyE;IACzE,MAAM,YAAY,GAAG,QAAQ,CAAC,OAAO,CACnC,GAAG,CAAC,IAAyD,CAC9D,CAAC;IACF,MAAM,QAAQ,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;IAEzC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,CAAC;IACtC,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,GAAa,EAAE,QAAgB;IACvE,IAAI,OAAO,GAAG,KAAK,WAAW,EAAE,CAAC;QAC/B,OAAQ,GAAyE,CAAC,KAAK,CACrF,QAAQ,EACR,GAAG,CACJ,CAAC;IACJ,CAAC;IACD,OAAO,uBAAuB,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;AAChD,CAAC"}
@@ -0,0 +1,30 @@
1
+ import type { ClassifiedError } from "./error-classifier";
2
+ /**
3
+ * Phase 4 of the publish-resilience plan — CLI-side mapping from
4
+ * the canonical `DeployErrorCode` strings (defined server-side in
5
+ * `@percher/api/src/worker/error-codes.ts`) to the
6
+ * `ClassifiedError` shape the CLI's publish-failure renderer
7
+ * already consumes.
8
+ *
9
+ * Why this lives in @percher/core instead of @percher/client: the
10
+ * client surfaces the raw `errorCode` string on `Deployment` and
11
+ * stays unopinionated; the core package owns the rendering of
12
+ * publish failures and is the right place to decide "given this
13
+ * canonical code, what title/explanation/suggestion does the user
14
+ * see". The CLI's `publish-failure.ts` calls into this module
15
+ * BEFORE the regex-based `classifyError` so the structured code
16
+ * always wins when present.
17
+ *
18
+ * Set parity: the strings here MUST match the ones in the API's
19
+ * `DEPLOY_ERROR_CODES` const. Adding a new code requires updating
20
+ * both files. Forward-compat: an unknown code returns null, the
21
+ * CLI falls back to the regex classifier, no breakage.
22
+ */
23
+ export type DeployErrorCode = "WORKER_UNAVAILABLE" | "WORKER_UNAVAILABLE_PERSISTENT" | "BUILD_TIMEOUT" | "BUILD_FAILED" | "WORKER_ERROR" | "DEPLOY_STALLED";
24
+ /**
25
+ * Map a canonical Phase 4 error code to a {@link ClassifiedError}.
26
+ * Returns null for NULL / unknown codes so the caller can fall back
27
+ * to the regex-based `classifyError`.
28
+ */
29
+ export declare function classifyByErrorCode(code: string | null | undefined, rawMessage: string): ClassifiedError | null;
30
+ //# sourceMappingURL=structured-error-codes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structured-error-codes.d.ts","sourceRoot":"","sources":["../src/structured-error-codes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAc,MAAM,oBAAoB,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,MAAM,MAAM,eAAe,GACvB,oBAAoB,GACpB,+BAA+B,GAC/B,eAAe,GACf,cAAc,GACd,cAAc,GACd,gBAAgB,CAAC;AAoFrB;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC/B,UAAU,EAAE,MAAM,GACjB,eAAe,GAAG,IAAI,CAcxB"}
@@ -0,0 +1,86 @@
1
+ const MAPPINGS = {
2
+ WORKER_UNAVAILABLE: {
3
+ errorClass: "infra_unavailable",
4
+ phase: "infra",
5
+ cause: "worker_fetch_failed",
6
+ title: "Build worker is unreachable",
7
+ explanation: (raw) => raw
8
+ ? `The Percher build worker did not respond in time: ${trimMessage(raw)}. This is a platform-side issue, not your code.`
9
+ : "The Percher build worker did not respond in time. This is a platform-side issue, not your code.",
10
+ suggestion: "Wait 30 seconds and run `percher publish` again. If retry #2 also fails, pause 5 minutes before the next attempt — back-to-back retries during a partial outage just waste your time. After 3 spaced-out retries, check status.percher.app or contact support. Your build never started.",
11
+ },
12
+ WORKER_UNAVAILABLE_PERSISTENT: {
13
+ errorClass: "infra_unavailable",
14
+ phase: "infra",
15
+ cause: "worker_circuit_breaker_open",
16
+ title: "Build worker is in a crash loop",
17
+ explanation: () => "The Percher build worker has failed repeatedly in the last minute and the platform's circuit breaker has flipped open. Retrying immediately would just queue more failures.",
18
+ suggestion: "Wait 2-3 minutes for the platform to recover, then retry. If it persists past 5 minutes check status.percher.app or contact support — this is a platform incident, not your code.",
19
+ },
20
+ BUILD_TIMEOUT: {
21
+ errorClass: "build_failed",
22
+ phase: "build",
23
+ cause: "build_timeout",
24
+ title: "Build timed out",
25
+ explanation: () => "The build ran longer than the 10-minute platform limit and was aborted.",
26
+ suggestion: "Common causes: a slow `postinstall` hook, very large dependency tree, or a Dockerfile that pulls a huge base image. Try `bun install` locally and check what's slow. If it's legitimately a heavy build, contact support to discuss raising the limit for your account.",
27
+ },
28
+ BUILD_FAILED: {
29
+ errorClass: "build_failed",
30
+ phase: "build",
31
+ cause: "build_nonzero_exit",
32
+ title: "Build failed",
33
+ explanation: (raw) => raw
34
+ ? `The build process returned a non-zero exit code: ${trimMessage(raw)}. Read the build log below for the exact error.`
35
+ : "The build process returned a non-zero exit code. Read the build log below for the exact error.",
36
+ suggestion: "Run your build locally to reproduce: `bun install && bun run build`. The error in the build log usually points to a missing dependency, a TypeScript/syntax error, or a misconfigured framework setting.",
37
+ },
38
+ WORKER_ERROR: {
39
+ errorClass: "infra_unavailable",
40
+ phase: "infra",
41
+ cause: "worker_internal_error",
42
+ title: "Platform error inside the build worker",
43
+ explanation: (raw) => raw
44
+ ? `The build worker hit an internal error: ${trimMessage(raw)}. This is a Percher bug, not your code.`
45
+ : "The build worker hit an internal error. This is a Percher bug, not your code.",
46
+ suggestion: "Retry once — transient platform errors usually clear within a minute. If it repeats, please report it: include the deploy ID and we'll investigate. Your account is not at fault.",
47
+ },
48
+ DEPLOY_STALLED: {
49
+ errorClass: "infra_unavailable",
50
+ phase: "infra",
51
+ cause: "deploy_stalled",
52
+ title: "Deploy stalled",
53
+ explanation: () => "The platform abandoned this deploy — likely because the API or build worker restarted mid-build. Your code is fine; the build never finished.",
54
+ suggestion: "Run `percher publish` again. The new deploy will start fresh. If you see this repeatedly across multiple publishes, check status.percher.app — it implies a recurring platform issue.",
55
+ },
56
+ };
57
+ /**
58
+ * Map a canonical Phase 4 error code to a {@link ClassifiedError}.
59
+ * Returns null for NULL / unknown codes so the caller can fall back
60
+ * to the regex-based `classifyError`.
61
+ */
62
+ export function classifyByErrorCode(code, rawMessage) {
63
+ if (!code)
64
+ return null;
65
+ const mapping = MAPPINGS[code];
66
+ if (!mapping)
67
+ return null;
68
+ return {
69
+ title: mapping.title,
70
+ explanation: mapping.explanation(rawMessage),
71
+ suggestion: mapping.suggestion,
72
+ errorClass: mapping.errorClass,
73
+ phase: mapping.phase,
74
+ cause: mapping.cause,
75
+ relevantFiles: [],
76
+ missingEnvVars: [],
77
+ };
78
+ }
79
+ function trimMessage(raw) {
80
+ // Keep the first line + truncate. The CLI already shows the
81
+ // full build-log tail below; this is just enough context to
82
+ // explain WHY the platform-side classifier picked this code.
83
+ const firstLine = raw.split("\n")[0] ?? "";
84
+ return firstLine.length > 200 ? `${firstLine.slice(0, 200)}…` : firstLine;
85
+ }
86
+ //# sourceMappingURL=structured-error-codes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structured-error-codes.js","sourceRoot":"","sources":["../src/structured-error-codes.ts"],"names":[],"mappings":"AA8CA,MAAM,QAAQ,GAAyC;IACrD,kBAAkB,EAAE;QAClB,UAAU,EAAE,mBAAmB;QAC/B,KAAK,EAAE,OAAO;QACd,KAAK,EAAE,qBAAqB;QAC5B,KAAK,EAAE,6BAA6B;QACpC,WAAW,EAAE,CAAC,GAAG,EAAE,EAAE,CACnB,GAAG;YACD,CAAC,CAAC,qDAAqD,WAAW,CAAC,GAAG,CAAC,iDAAiD;YACxH,CAAC,CAAC,iGAAiG;QACvG,UAAU,EACR,0RAA0R;KAC7R;IACD,6BAA6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B,UAAkB;IAElB,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IACvB,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAuB,CAAC,CAAC;IAClD,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAC1B,OAAO;QACL,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,WAAW,EAAE,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC;QAC5C,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,aAAa,EAAE,EAAE;QACjB,cAAc,EAAE,EAAE;KACnB,CAAC;AACJ,CAAC;AAED,SAAS,WAAW,CAAC,GAAW;IAC9B,4DAA4D;IAC5D,4DAA4D;IAC5D,6DAA6D;IAC7D,MAAM,SAAS,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC3C,OAAO,SAAS,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;AAC5E,CAAC"}
package/dist/tarball.d.ts CHANGED
@@ -12,6 +12,17 @@ export interface TarballResult {
12
12
  path: string;
13
13
  size: number;
14
14
  }>;
15
+ /**
16
+ * Phase 7.8 follow-up — deterministic content-hash of the bundle.
17
+ * Used by the CLI's cache-probe call so identical sources hash to
18
+ * the same value across runs. Distinct from the gzipped-bytes hash
19
+ * the API computes on upload (which carries embedded mtimes from
20
+ * tar/gzip headers and therefore *cannot* be deterministic). The
21
+ * CLI sends this value as the `X-Tarball-Hash` header on the
22
+ * upload; the API stores it on `deployments.tarball_hash` so a
23
+ * subsequent probe matches.
24
+ */
25
+ contentHash: string;
15
26
  }
16
27
  export declare function createTarball(options: TarballOptions): Promise<TarballResult>;
17
28
  //# sourceMappingURL=tarball.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tarball.d.ts","sourceRoot":"","sources":["../src/tarball.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAInD,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,aAAa,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACjD;AAiCD,wBAAsB,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CA2CnF"}
1
+ {"version":3,"file":"tarball.d.ts","sourceRoot":"","sources":["../src/tarball.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAInD,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,aAAa,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAChD;;;;;;;;;OASG;IACH,WAAW,EAAE,MAAM,CAAC;CACrB;AAiCD,wBAAsB,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CAgEnF"}
package/dist/tarball.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { createHash } from "node:crypto";
1
2
  import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
2
3
  import { join, relative, sep } from "node:path";
3
4
  import { Readable } from "node:stream";
@@ -45,18 +46,34 @@ export async function createTarball(options) {
45
46
  }
46
47
  if (options.extraIgnore)
47
48
  ig.add(options.extraIgnore);
48
- const files = [];
49
+ // Sorted entries — required for the deterministic content-hash
50
+ // below. Without this, readdirSync's platform-dependent order
51
+ // produces a different hash on every run even for unchanged
52
+ // sources, and cache-probe never matches. Codex P2, 2026-05-08.
53
+ const fileBuffers = [];
49
54
  for (const rel of walk(options.cwd, options.cwd, ig)) {
50
- const stats = statSync(join(options.cwd, rel));
51
- files.push({ path: rel, size: stats.size });
55
+ const data = readFileSync(join(options.cwd, rel));
56
+ fileBuffers.push({ path: rel, size: data.length, data });
52
57
  }
53
- const totalBytes = files.reduce((sum, f) => sum + f.size, 0);
58
+ fileBuffers.sort((a, b) => (a.path < b.path ? -1 : a.path > b.path ? 1 : 0));
59
+ const totalBytes = fileBuffers.reduce((sum, f) => sum + f.size, 0);
60
+ // Deterministic content-hash: SHA-256 over a canonical encoding of
61
+ // every file's path + bytes, in sorted order. The encoding uses
62
+ // length-prefixed sections so a path containing a delimiter can't
63
+ // collide with a longer/shorter path of the same prefix.
64
+ const contentHasher = createHash("sha256");
65
+ for (const f of fileBuffers) {
66
+ contentHasher.update(`PATH:${f.path.length}:${f.path}\n`);
67
+ contentHasher.update(`SIZE:${f.size}\n`);
68
+ contentHasher.update(f.data);
69
+ contentHasher.update("\n");
70
+ }
71
+ const contentHash = contentHasher.digest("hex");
54
72
  const pack = tarPack();
55
73
  (async () => {
56
- for (const file of files) {
57
- const data = readFileSync(join(options.cwd, file.path));
74
+ for (const file of fileBuffers) {
58
75
  await new Promise((resolve, reject) => {
59
- pack.entry({ name: file.path, size: data.length }, data, (err) => err ? reject(err) : resolve());
76
+ pack.entry({ name: file.path, size: file.data.length }, file.data, (err) => err ? reject(err) : resolve());
60
77
  });
61
78
  }
62
79
  pack.finalize();
@@ -64,12 +81,16 @@ export async function createTarball(options) {
64
81
  const gzip = createGzip();
65
82
  const nodeStream = pack.pipe(gzip);
66
83
  const webStream = Readable.toWeb(nodeStream);
67
- const topFiles = [...files].sort((a, b) => b.size - a.size).slice(0, 5);
84
+ const topFiles = [...fileBuffers]
85
+ .sort((a, b) => b.size - a.size)
86
+ .slice(0, 5)
87
+ .map((f) => ({ path: f.path, size: f.size }));
68
88
  return {
69
89
  stream: webStream,
70
90
  bytes: totalBytes,
71
- fileCount: files.length,
91
+ fileCount: fileBuffers.length,
72
92
  topFiles,
93
+ contentHash,
73
94
  };
74
95
  }
75
96
  //# sourceMappingURL=tarball.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tarball.js","sourceRoot":"","sources":["../src/tarball.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,YAAY,CAAC;AAe7C,MAAM,cAAc,GAAG;IACrB,cAAc;IACd,MAAM;IACN,MAAM;IACN,OAAO;IACP,aAAa;IACb,OAAO;IACP,UAAU;IACV,MAAM;IACN,QAAQ;IACR,MAAM;IACN,OAAO;IACP,WAAW;CACZ,CAAC;AAEF,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAW,EAAE,OAAe,EAAE,EAA6B;IACxE,MAAM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 -0,0 +1,7 @@
1
+ export declare const CLAUDE_MD: {
2
+ id: "claude-md";
3
+ path: string;
4
+ version: string;
5
+ content: string;
6
+ };
7
+ //# sourceMappingURL=claude-md.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-md.d.ts","sourceRoot":"","sources":["../../../src/templates/ai-files/claude-md.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS;;;;;CA4ErB,CAAC"}