@calo-design/cli 0.13.0 → 0.13.1
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/bin/backend.js +25 -8
- package/package.json +1 -1
package/bin/backend.js
CHANGED
|
@@ -299,14 +299,31 @@ async function cmdCheck(args) {
|
|
|
299
299
|
const bj = readBackendJson(root);
|
|
300
300
|
if (!bj || !bj.workerUrl) throw new Error("no backend.json here — run `calo-design backend init` first");
|
|
301
301
|
let res, body;
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
302
|
+
// Right after a deploy, two kinds of lag are normal and NOT failures: network-level
|
|
303
|
+
// (route/DNS propagation) and 401/5xx while the fresh APP_KEY secret version reaches
|
|
304
|
+
// running isolates. Retry through both with the reason on screen; a state that
|
|
305
|
+
// persists past the retries is a real failure.
|
|
306
|
+
const TRIES = 6;
|
|
307
|
+
for (let i = 1; ; i++) {
|
|
308
|
+
try {
|
|
309
|
+
res = await fetch(`${bj.workerUrl}/__health`, {
|
|
310
|
+
headers: { authorization: `Bearer ${bj.appKey}` },
|
|
311
|
+
signal: AbortSignal.timeout(15000),
|
|
312
|
+
});
|
|
313
|
+
body = await res.json().catch(() => ({}));
|
|
314
|
+
if (res.ok || i >= TRIES) break;
|
|
315
|
+
log(c.dim(` not healthy yet (HTTP ${res.status}) — retrying ${i}/${TRIES - 1} in 5s (fresh deploys propagate for a few seconds)`));
|
|
316
|
+
await new Promise((r) => setTimeout(r, 5000));
|
|
317
|
+
} catch (e) {
|
|
318
|
+
if (i >= TRIES) {
|
|
319
|
+
throw new Error(
|
|
320
|
+
`worker unreachable at ${bj.workerUrl} (${e.message}) — deployed yet? try \`calo-design backend deploy\`, ` +
|
|
321
|
+
"then re-run `calo-design backend check`"
|
|
322
|
+
);
|
|
323
|
+
}
|
|
324
|
+
log(c.dim(` worker not reachable yet (${e.message}) — retrying ${i}/${TRIES - 1} in 5s`));
|
|
325
|
+
await new Promise((r) => setTimeout(r, 5000));
|
|
326
|
+
}
|
|
310
327
|
}
|
|
311
328
|
if (has(args, "json")) return emitJson(JSON.stringify({ status: res.status, ...body }));
|
|
312
329
|
const checks = body.checks || {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@calo-design/cli",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"description": "One-line setup for Calo design tooling: logs in with your Calo email and installs the calo-design skill + design-system packages. No GitHub account needed.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"calo-design": "bin/cli.js"
|