pylot-cli 0.1.2 → 0.1.3

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 (2) hide show
  1. package/dist/index.mjs +34 -17
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -14921,7 +14921,7 @@ function registerObservability(program3) {
14921
14921
  const { opts, cfg } = await ctx(cmd);
14922
14922
  emit(opts, await request(cfg, "/logs/router", { query: { lines: flags.lines } }));
14923
14923
  });
14924
- logs.command("admin").description("gateway Lambda CloudWatch logs by source (GET /admin/logs/:source)").argument("<source>", "api | ingress | processor | executor | notifier | scheduler | chat").option("--minutes <n>", "lookback minutes (max 180)", (v) => parseInt(v, 10)).option("--grep <pattern>", "filter pattern").option("--limit <n>", "max entries (max 1000)", (v) => parseInt(v, 10)).action(async (source, flags, cmd) => {
14924
+ logs.command("admin").description("gateway Lambda CloudWatch logs by source (GET /admin/logs/:source)").argument("<source>", "api | ingress | processor | executor | notifier | scheduler | chat | proxy | slack-events | slack-processor").option("--minutes <n>", "lookback minutes (max 180)", (v) => parseInt(v, 10)).option("--grep <pattern>", "filter pattern").option("--limit <n>", "max entries (max 1000)", (v) => parseInt(v, 10)).action(async (source, flags, cmd) => {
14925
14925
  const { opts, cfg } = await ctx(cmd);
14926
14926
  emit(
14927
14927
  opts,
@@ -15358,7 +15358,7 @@ function printNewPhases(opts, body, seen) {
15358
15358
  note(opts, `phase ${p.phase}${p.status ? ` ${p.status}` : ""}`);
15359
15359
  }
15360
15360
  }
15361
- async function waitForBuild(opts, cfg, buildId, { timeoutMs, promoteKey }) {
15361
+ async function waitForBuild(opts, cfg, buildId, { timeoutMs }) {
15362
15362
  const seenPhases = /* @__PURE__ */ new Set();
15363
15363
  const resp = await pollUntil(
15364
15364
  () => request(cfg, `/admin/build-worker/${encodeURIComponent(buildId)}`),
@@ -15372,13 +15372,21 @@ async function waitForBuild(opts, cfg, buildId, { timeoutMs, promoteKey }) {
15372
15372
  printNewPhases(opts, resp.json, seenPhases);
15373
15373
  const body = resp.json;
15374
15374
  const status = String(body?.status ?? "");
15375
- let ok = status === "SUCCEEDED";
15376
- if (ok && promoteKey) {
15377
- const promote = body?.[promoteKey];
15378
- ok = promote != null && (promote.failed ?? []).length === 0;
15379
- if (!ok) note(opts, `${buildId} SUCCEEDED but ${promoteKey} reported failures \u2014 NOT promoted`);
15375
+ note(opts, `${buildId} ${status}${status === "SUCCEEDED" ? "" : " (failed)"}`);
15376
+ if (status !== "SUCCEEDED") {
15377
+ emit(opts, resp);
15378
+ process.exit(1);
15380
15379
  }
15381
- note(opts, `${buildId} ${status}${ok ? "" : " (failed)"}`);
15380
+ return resp;
15381
+ }
15382
+ async function promoteBuild(opts, cfg, buildId, { promoteKey, smoke = false }) {
15383
+ const resp = await request(cfg, `/admin/build-worker/${encodeURIComponent(buildId)}/promote`, {
15384
+ method: "POST",
15385
+ body: promoteKey === "worker_promote" ? { smoke } : {}
15386
+ });
15387
+ const promote = resp.json?.[promoteKey];
15388
+ const ok = resp.status >= 200 && resp.status < 300 && promote != null && (promote.failed ?? []).length === 0;
15389
+ if (!ok) note(opts, `${buildId} ${promoteKey} failed`);
15382
15390
  emit(opts, resp);
15383
15391
  process.exit(ok ? 0 : 1);
15384
15392
  }
@@ -15417,6 +15425,13 @@ function registerDeploy(program3) {
15417
15425
  const { opts, cfg } = await ctx(cmd);
15418
15426
  emit(opts, await request(cfg, `/admin/build-worker/${encodeURIComponent(buildId)}`));
15419
15427
  });
15428
+ deploy.command("promote").description("promote a successful operator/worker image build (POST /admin/build-worker/:build_id/promote)").argument("<build_id>").option("--smoke", "for worker builds, run the live Fargate smoke gate before pinning").action(async (buildId, flags, cmd) => {
15429
+ const { opts, cfg } = await ctx(cmd);
15430
+ emit(opts, await request(cfg, `/admin/build-worker/${encodeURIComponent(buildId)}/promote`, {
15431
+ method: "POST",
15432
+ body: flags.smoke ? { smoke: true } : {}
15433
+ }));
15434
+ });
15420
15435
  deploy.command("logs").description("CodeBuild log tail via CloudWatch (GET /admin/deploy/logs/:build_id)").argument("<build_id>").option("--stage <stage>", "staging | production (default staging)").action(async (buildId, flags, cmd) => {
15421
15436
  const { opts, cfg } = await ctx(cmd);
15422
15437
  emit(
@@ -15427,8 +15442,8 @@ function registerDeploy(program3) {
15427
15442
  );
15428
15443
  });
15429
15444
  deploy.command("build-operator").description(
15430
- 'rebuild the operator image (POST /admin/build-operator). With --wait: SUCCEEDED alone is not "promoted" \u2014 completion requires operator_promote with no failures'
15431
- ).option("--source-version <ref>", "git ref to build (default: gateway's stage branch)").option("--wait", "poll until promoted (exit 0 only on SUCCEEDED + clean operator_promote)").option("--timeout <seconds>", "max seconds to wait (default 1500)", (v) => parseInt(v, 10), 1500).action(async (flags, cmd) => {
15445
+ "rebuild the operator image (POST /admin/build-operator). With --wait: poll to SUCCEEDED, then explicitly promote"
15446
+ ).option("--source-version <ref>", "git ref to build (default: gateway's stage branch)").option("--wait", "poll until SUCCEEDED, then promote (exit 0 only on clean operator_promote)").option("--timeout <seconds>", "max seconds to wait (default 1500)", (v) => parseInt(v, 10), 1500).action(async (flags, cmd) => {
15432
15447
  flags = withParentBuildOpts(flags, cmd);
15433
15448
  const { opts, cfg } = await ctx(cmd);
15434
15449
  const body = {};
@@ -15444,7 +15459,8 @@ function registerDeploy(program3) {
15444
15459
  process.exit(1);
15445
15460
  }
15446
15461
  note(opts, `operator build started: ${buildId}`);
15447
- await waitForBuild(opts, cfg, buildId, { timeoutMs: flags.timeout * 1e3, promoteKey: "operator_promote" });
15462
+ await waitForBuild(opts, cfg, buildId, { timeoutMs: flags.timeout * 1e3 });
15463
+ await promoteBuild(opts, cfg, buildId, { promoteKey: "operator_promote" });
15448
15464
  });
15449
15465
  deploy.command("publish-cli").description(
15450
15466
  "publish modules/cli to npm as pylot-cli (POST /admin/publish-cli). Idempotent: no-ops when the tree's version is already on npm. Staging builders always dry-run"
@@ -15468,8 +15484,8 @@ function registerDeploy(program3) {
15468
15484
  await waitForBuild(opts, cfg, buildId, { timeoutMs: flags.timeout * 1e3 });
15469
15485
  });
15470
15486
  deploy.command("build-worker").description(
15471
- "build a repo's worker image (POST /admin/build-worker, body {repo}); --batch --file posts {repos: [...]} to /admin/build-worker/batch. With --wait: completion requires worker_promote with no failures"
15472
- ).argument("[org/repo]", "repo to build (omit with --batch)").option("--source-version <ref>", "git ref to build the worker overlay from").option("--batch", "batch mode (POST /admin/build-worker/batch)").option("--file <path>", "JSON body from file ('-' for stdin; required with --batch)").option("--wait", "poll until promoted (exit 0 only on SUCCEEDED + clean worker_promote)").option("--timeout <seconds>", "max seconds to wait (default 1500)", (v) => parseInt(v, 10), 1500).action(async (repo, flags, cmd) => {
15487
+ "build a repo's worker image (POST /admin/build-worker, body {repo}); --batch --file posts {repos: [...]} to /admin/build-worker/batch. With --wait: poll to SUCCEEDED, then explicitly promote"
15488
+ ).argument("[org/repo]", "repo to build (omit with --batch)").option("--source-version <ref>", "git ref to build the worker overlay from").option("--batch", "batch mode (POST /admin/build-worker/batch)").option("--file <path>", "JSON body from file ('-' for stdin; required with --batch)").option("--wait", "poll until SUCCEEDED, then promote (exit 0 only on clean worker_promote)").option("--smoke", "with --wait, run the live Fargate smoke gate before pinning").option("--timeout <seconds>", "max seconds to wait (default 1500)", (v) => parseInt(v, 10), 1500).action(async (repo, flags, cmd) => {
15473
15489
  flags = withParentBuildOpts(flags, cmd);
15474
15490
  const { opts, cfg } = await ctx(cmd);
15475
15491
  if (flags.batch) {
@@ -15492,7 +15508,8 @@ function registerDeploy(program3) {
15492
15508
  process.exit(1);
15493
15509
  }
15494
15510
  note(opts, `worker build started: ${buildId}`);
15495
- await waitForBuild(opts, cfg, buildId, { timeoutMs: flags.timeout * 1e3, promoteKey: "worker_promote" });
15511
+ await waitForBuild(opts, cfg, buildId, { timeoutMs: flags.timeout * 1e3 });
15512
+ await promoteBuild(opts, cfg, buildId, { promoteKey: "worker_promote", smoke: flags.smoke === true });
15496
15513
  });
15497
15514
  deploy.command("ensure-taskdefs").description("backfill per-role operator task definitions (POST /admin/operators/ensure-taskdefs)").action(async (_flags, cmd) => {
15498
15515
  const { opts, cfg } = await ctx(cmd);
@@ -15583,9 +15600,9 @@ function registerSkills(program3) {
15583
15600
  const { opts, cfg } = await ctx(cmd);
15584
15601
  emit(opts, await request(cfg, "/admin/skills/lock"));
15585
15602
  });
15586
- skills.command("staleness").description("SHA-mismatch report vs origin HEAD (GET /admin/skills/staleness)").action(async (_flags, cmd) => {
15603
+ skills.command("staleness").description("SHA-mismatch report vs origin HEAD (GET /admin/skills/staleness?org=<org>)").requiredOption("--org <org>", "GitHub org to check (staleness is per-org, #1919)").action(async (flags, cmd) => {
15587
15604
  const { opts, cfg } = await ctx(cmd);
15588
- emit(opts, await request(cfg, "/admin/skills/staleness"));
15605
+ emit(opts, await request(cfg, "/admin/skills/staleness", { query: { org: flags.org } }));
15589
15606
  });
15590
15607
  skills.command("sync").description(
15591
15608
  "trigger the CodeBuild skills-sync job for one org (POST /admin/skills/sync, body {org}) or every installed org (--all \u2192 POST /admin/skills/sync-all)"
@@ -15794,7 +15811,7 @@ function registerAssets(program3) {
15794
15811
  }
15795
15812
 
15796
15813
  // src/index.mts
15797
- var VERSION = true ? "0.1.2" : "0.0.0-dev";
15814
+ var VERSION = true ? "0.1.3" : "0.0.0-dev";
15798
15815
  installEpipeGuard();
15799
15816
  var program2 = new Command();
15800
15817
  program2.name("pylot").description(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pylot-cli",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
5
  "description": "pylot — first-class CLI for the Pylot gateway API. Replaces curl workflows for operators and humans.",
6
6
  "bin": {