@yolo-labs/yolo-cli 0.40.0 → 0.41.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.
- package/dist/deploy-ship.js +80 -0
- package/package.json +1 -1
package/dist/deploy-ship.js
CHANGED
|
@@ -296,6 +296,11 @@ export async function runDeployShip(options) {
|
|
|
296
296
|
const bootCheck = parseBootCheck(finalized.value.bootCheck);
|
|
297
297
|
if (bootCheck)
|
|
298
298
|
progress(`deploy: warn — deployed Worker failed to boot (HTTP ${bootCheck.status})`);
|
|
299
|
+
const pageCheck = parsePageCheck(finalized.value.pageCheck);
|
|
300
|
+
if (pageCheckHasProblems(pageCheck)) {
|
|
301
|
+
for (const line of pageCheckLines(pageCheck))
|
|
302
|
+
progress(line);
|
|
303
|
+
}
|
|
299
304
|
return {
|
|
300
305
|
ok: true,
|
|
301
306
|
dryRun: false,
|
|
@@ -304,6 +309,7 @@ export async function runDeployShip(options) {
|
|
|
304
309
|
releaseId: finalized.value.releaseId,
|
|
305
310
|
url: finalized.value.url,
|
|
306
311
|
...(bootCheck ? { bootCheck } : {}),
|
|
312
|
+
...(pageCheck ? { pageCheck } : {}),
|
|
307
313
|
};
|
|
308
314
|
}
|
|
309
315
|
/**
|
|
@@ -328,6 +334,11 @@ async function resumeStagedShip(ctx, resume, io) {
|
|
|
328
334
|
const bootCheck = parseBootCheck(finalized.value.bootCheck);
|
|
329
335
|
if (bootCheck)
|
|
330
336
|
progress(`deploy: warn — deployed Worker failed to boot (HTTP ${bootCheck.status})`);
|
|
337
|
+
const pageCheck = parsePageCheck(finalized.value.pageCheck);
|
|
338
|
+
if (pageCheckHasProblems(pageCheck)) {
|
|
339
|
+
for (const line of pageCheckLines(pageCheck))
|
|
340
|
+
progress(line);
|
|
341
|
+
}
|
|
331
342
|
return {
|
|
332
343
|
ok: true,
|
|
333
344
|
dryRun: false,
|
|
@@ -343,6 +354,10 @@ async function resumeStagedShip(ctx, resume, io) {
|
|
|
343
354
|
releaseId: finalized.value.releaseId,
|
|
344
355
|
url: finalized.value.url,
|
|
345
356
|
...(bootCheck ? { bootCheck } : {}),
|
|
357
|
+
// Must be on the RESULT, not only the progress line: under --json the
|
|
358
|
+
// warning goes to stderr and the structured verdict + samples would
|
|
359
|
+
// otherwise be lost entirely for a resumed (approval-parked) ship.
|
|
360
|
+
...(pageCheck ? { pageCheck } : {}),
|
|
346
361
|
};
|
|
347
362
|
}
|
|
348
363
|
// Still parked: the grant hasn't landed yet (approval-pending), or the
|
|
@@ -425,6 +440,71 @@ function parseBootCheck(raw) {
|
|
|
425
440
|
return undefined;
|
|
426
441
|
return { status: r.status, detail: r.detail };
|
|
427
442
|
}
|
|
443
|
+
/**
|
|
444
|
+
* True when the page check found something worth a warning line. Mirrors
|
|
445
|
+
* `pageCheckHasProblems` in common-api — a 5xx document is a failure in its own
|
|
446
|
+
* right, not just a source of console noise.
|
|
447
|
+
*
|
|
448
|
+
* Takes `undefined` deliberately: absence means NOT CHECKED, so it returns
|
|
449
|
+
* false and the CLI stays silent rather than printing a reassuring line.
|
|
450
|
+
*/
|
|
451
|
+
function pageCheckHasProblems(p) {
|
|
452
|
+
if (!p)
|
|
453
|
+
return false;
|
|
454
|
+
return p.consoleErrors > 0 || p.failedRequests > 0 || (!!p.httpStatus && p.httpStatus >= 500);
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* The warn line PLUS the captured samples.
|
|
458
|
+
*
|
|
459
|
+
* Counts alone are not actionable: "23 console errors" does not tell anyone the
|
|
460
|
+
* allow-list is missing `x-cart-token`, and finalize cannot be safely re-run
|
|
461
|
+
* just to get `--json`, so whatever the human path omits here is lost for good.
|
|
462
|
+
* The samples are already bounded and truncated server-side.
|
|
463
|
+
*/
|
|
464
|
+
function pageCheckLines(p) {
|
|
465
|
+
const lines = [`deploy: warn — ${describeCliPageCheck(p)}`];
|
|
466
|
+
for (const sample of p.samples ?? [])
|
|
467
|
+
lines.push(`deploy: ${sample}`);
|
|
468
|
+
return lines;
|
|
469
|
+
}
|
|
470
|
+
/** One-line human summary for the warn output. */
|
|
471
|
+
function describeCliPageCheck(p) {
|
|
472
|
+
const parts = [];
|
|
473
|
+
if (p.httpStatus && p.httpStatus >= 500)
|
|
474
|
+
parts.push(`the page returned HTTP ${p.httpStatus}`);
|
|
475
|
+
if (p.consoleErrors > 0)
|
|
476
|
+
parts.push(`${p.consoleErrors} console error(s)`);
|
|
477
|
+
if (p.failedRequests > 0)
|
|
478
|
+
parts.push(`${p.failedRequests} failed request(s)`);
|
|
479
|
+
// Name the URL actually checked. A clean-or-dirty verdict about the PREVIEW
|
|
480
|
+
// origin must not be read as one about production — origin-exact CORS is
|
|
481
|
+
// exactly the failure class this check exists for.
|
|
482
|
+
const where = p.url ? ` on ${p.url}` : '';
|
|
483
|
+
return `page check${where}: ${parts.join(', ')}`;
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* Narrow the backend's optional `pageCheck` envelope; ignore anything malformed.
|
|
487
|
+
*
|
|
488
|
+
* A malformed payload narrows to `undefined`, which the caller renders as "not
|
|
489
|
+
* checked" — the safe direction. Inventing zeros instead would manufacture a
|
|
490
|
+
* clean bill of health out of a parse failure.
|
|
491
|
+
*/
|
|
492
|
+
function parsePageCheck(raw) {
|
|
493
|
+
if (!raw || typeof raw !== 'object')
|
|
494
|
+
return undefined;
|
|
495
|
+
const r = raw;
|
|
496
|
+
if (typeof r.consoleErrors !== 'number' || typeof r.failedRequests !== 'number')
|
|
497
|
+
return undefined;
|
|
498
|
+
const samples = Array.isArray(r.samples) ? r.samples.filter((s) => typeof s === 'string') : [];
|
|
499
|
+
return {
|
|
500
|
+
consoleErrors: r.consoleErrors,
|
|
501
|
+
failedRequests: r.failedRequests,
|
|
502
|
+
samples,
|
|
503
|
+
url: typeof r.url === 'string' ? r.url : '',
|
|
504
|
+
...(typeof r.httpStatus === 'number' ? { httpStatus: r.httpStatus } : {}),
|
|
505
|
+
...(r.origin === 'preview' || r.origin === 'prod' ? { origin: r.origin } : {}),
|
|
506
|
+
};
|
|
507
|
+
}
|
|
428
508
|
// ─── Exit codes (spec §5 — EXACT) ─────────────────────────────────────────
|
|
429
509
|
/**
|
|
430
510
|
* | Exit | Meaning |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yolo-labs/yolo-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.41.0",
|
|
4
4
|
"description": "YOLO Studio substrate CLI \u2014 owns yolo plan/workspace/artifact substrate-tooling commands. Distinct from yolo-code (the agent CLI) and yolo-router (the LLM gateway client).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|