@usepowerplant/cli 0.4.29 → 0.4.30

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/main.js CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="6e438e0b-76c4-52f1-83bd-651f3e3005c6")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="88557388-75d1-50bb-85dd-fada0be036eb")}catch(e){}}();
3
3
  import { createRequire as __cliCreateRequire } from 'node:module';
4
4
  const require = __cliCreateRequire(import.meta.url);
5
5
  var __create = Object.create;
@@ -85111,7 +85111,7 @@ function _init2(options = {}, getDefaultIntegrationsImpl) {
85111
85111
  import tls2 from "node:tls";
85112
85112
  var import_undici = __toESM(require_undici(), 1);
85113
85113
  var CLI_VERSION_HEADER = "x-powerplant-cli-version";
85114
- var cliVersion = true ? "0.4.29" : "0.0.0-checkout";
85114
+ var cliVersion = true ? "0.4.30" : "0.0.0-checkout";
85115
85115
  function cliVersionHeaders() {
85116
85116
  return { [CLI_VERSION_HEADER]: cliVersion, "user-agent": `powerplant-cli/${cliVersion}` };
85117
85117
  }
@@ -87392,6 +87392,9 @@ async function collectCodexSessions(options = {}) {
87392
87392
  mtimeMs,
87393
87393
  codexClient: summary.codexClient,
87394
87394
  ...summary.noninteractive && { codexNoninteractive: true },
87395
+ // Only a dedicated review is seen to skip hooks (three runs checked
87396
+ // 2026-09-18). A terminal `codex exec` run is still judged.
87397
+ ...isAutomationRun(summary) && { hookRecordOptional: true },
87395
87398
  transcriptPath: parent.transcriptPath,
87396
87399
  transcriptPrefix: parent.prefix,
87397
87400
  subagents: children2.capture,
@@ -89259,13 +89262,19 @@ function createHookHealthTracker(deps) {
89259
89262
  };
89260
89263
  const admit = (session, nowMs) => {
89261
89264
  const harness = NATIVE_HOOK_NAME_BY_HARNESS[session.item.harness];
89262
- if (session.item.automation === true || session.item.startedAt === void 0) return;
89265
+ if (session.item.startedAt === void 0) return;
89263
89266
  if (!(Date.parse(session.item.startedAt) > installedAtMs)) return;
89264
89267
  const sessionId = hookSessionId(harness, session.item.harnessSessionId);
89265
89268
  if (sessionId === null) return;
89266
89269
  const key = `${harness}:${sessionId}`;
89267
89270
  if (judged.has(key) || candidates.has(key)) return;
89268
- candidates.set(key, { harness, sessionId, startedAt: session.item.startedAt, firstSeenMs: nowMs });
89271
+ candidates.set(key, {
89272
+ harness,
89273
+ sessionId,
89274
+ startedAt: session.item.startedAt,
89275
+ firstSeenMs: nowMs,
89276
+ recordOptional: session.hookRecordOptional === true
89277
+ });
89269
89278
  };
89270
89279
  const judge = (candidate, fired, nowMs) => {
89271
89280
  const { harness } = candidate;
@@ -89279,6 +89288,7 @@ function createHookHealthTracker(deps) {
89279
89288
  );
89280
89289
  return true;
89281
89290
  }
89291
+ if (candidate.recordOptional) return false;
89282
89292
  const silence = describeHookSilence(harness, inspect(harness), home);
89283
89293
  if (current.silence?.problem === silence.problem) return false;
89284
89294
  health[harness] = {
@@ -94031,7 +94041,7 @@ function parseClaudeCodeTranscript(text) {
94031
94041
  turnCount: usageByMessage.size,
94032
94042
  cwd,
94033
94043
  gitBranch,
94034
- entrypoint,
94044
+ launch: claudeLaunchOf(entrypoint),
94035
94045
  endsWithAbortedTurn
94036
94046
  };
94037
94047
  }
@@ -94064,9 +94074,10 @@ function firstText(message3) {
94064
94074
  }
94065
94075
  return "";
94066
94076
  }
94067
- var AGENT_SDK_ENTRYPOINTS = /* @__PURE__ */ new Set(["sdk-py", "sdk-ts"]);
94068
- function isAutomationEntrypoint(entrypoint) {
94069
- return entrypoint !== void 0 && AGENT_SDK_ENTRYPOINTS.has(entrypoint);
94077
+ function claudeLaunchOf(entrypoint) {
94078
+ if (entrypoint === "sdk-cli") return "print";
94079
+ if (entrypoint === "sdk-py" || entrypoint === "sdk-ts") return "agent-sdk";
94080
+ return "interactive";
94070
94081
  }
94071
94082
  function sessionKey(identity) {
94072
94083
  return JSON.stringify([identity.harness, identity.harnessSessionId]);
@@ -94172,6 +94183,7 @@ async function collectClaudeCodeSessions(options = {}) {
94172
94183
  const endedAt = endObservedAt ?? laterTimestamp(summary.endedAt, usage.endedAt);
94173
94184
  items.push({
94174
94185
  mtimeMs,
94186
+ ...summary.launch !== "interactive" && { hookRecordOptional: true },
94175
94187
  endsWithAbortedTurn: summary.endsWithAbortedTurn,
94176
94188
  transcriptPath,
94177
94189
  transcriptPrefix: transcript.prefix,
@@ -94206,7 +94218,7 @@ async function collectClaudeCodeSessions(options = {}) {
94206
94218
  fastCacheWriteTokens: usage.fast.cacheCreation
94207
94219
  },
94208
94220
  ...summary.title && { title: redactText(summary.title).slice(0, 500) },
94209
- ...isAutomationEntrypoint(summary.entrypoint) && { automation: true },
94221
+ ...summary.launch === "agent-sdk" && { automation: true },
94210
94222
  // The PR-join coordinates: the checkout's directory name (bare
94211
94223
  // repo, not the local path) and the branch the work started on.
94212
94224
  ...cwd && { repoDir: path40.basename(cwd) },
@@ -101881,6 +101893,10 @@ async function confirmResume(deps, output2) {
101881
101893
  var MACOS_BLOCKED_FOLDER_REMEDY = "To allow it, open System Settings > Privacy & Security > Files and Folders, enable the folder for node, then run `powerplant init`.";
101882
101894
 
101883
101895
  // src/init.ts
101896
+ var INIT_PREFLIGHT_LABELS = {
101897
+ move: "Finishing background sync setup\u2026",
101898
+ restart: "Restarting background sync\u2026"
101899
+ };
101884
101900
  function syncNote(credentials) {
101885
101901
  const org = credentials.orgName ?? "your organization";
101886
101902
  const boundary = storedCaptureBoundary(credentials);
@@ -101921,6 +101937,7 @@ async function runInit(deps) {
101921
101937
  const existing = deps.loadCredentials();
101922
101938
  command.log("\u26A1 Powerplant");
101923
101939
  command.detail(`${existing ? "Checking" : "Setting up"} this machine \xB7 ${deps.environmentName}`);
101940
+ const preflightDidWork = await deps.prepareCredentialUpgrade?.(command) ?? false;
101924
101941
  command.log("");
101925
101942
  command.log("1/3 Enroll this machine");
101926
101943
  let enrolled = false;
@@ -102045,7 +102062,7 @@ async function runInit(deps) {
102045
102062
  command.log("");
102046
102063
  const connectDidWork = outcome !== null && outcome.connected + outcome.configured > outcome.unchanged;
102047
102064
  const connectSettled = outcome !== null && outcome.found > 0 && outcome.pending === 0 && outcome.failed === 0 && outcome.skipped === 0 && outcome.unchanged === outcome.found && !connectDidWork;
102048
- if (!enrolled && !installed && !menubarDidWork && !repoDiscoveryDidWork && !protectedFoldersNeedAttention && pauseOffer === "not-paused" && connectSettled) {
102065
+ if (!preflightDidWork && !enrolled && !installed && !menubarDidWork && !repoDiscoveryDidWork && !protectedFoldersNeedAttention && pauseOffer === "not-paused" && connectSettled) {
102049
102066
  command.log("\u2713 Everything is already set up");
102050
102067
  return "already-set-up";
102051
102068
  }
@@ -102227,7 +102244,7 @@ function runResumeSession(source, sessionId, deps = {}) {
102227
102244
  }
102228
102245
 
102229
102246
  // src/version.ts
102230
- var CLI_VERSION = true ? "0.4.29" : "0.0.0-checkout";
102247
+ var CLI_VERSION = true ? "0.4.30" : "0.0.0-checkout";
102231
102248
  var CLI_RELEASE_BUILD = true ? true : false;
102232
102249
  var CLI_DEVELOPMENT_COPY = false;
102233
102250
  function updateRefusal(tarball, developmentCopy = CLI_DEVELOPMENT_COPY) {
@@ -102682,8 +102699,11 @@ async function prepareCredentialUpgrade(deps) {
102682
102699
  if (!deps.launcherCurrent()) {
102683
102700
  lock.assertHeld();
102684
102701
  deps.install();
102685
- if (deps.movesSync) deadline = deps.now() + 3e4;
102702
+ } else if (deps.movesSync && !deps.startingNextWorker()) {
102703
+ lock.assertHeld();
102704
+ deps.restart();
102686
102705
  }
102706
+ if (deps.movesSync) deadline = deps.now() + 3e4;
102687
102707
  for (; ; ) {
102688
102708
  lock.assertHeld();
102689
102709
  if (!deps.needsMigration()) return "ready";
@@ -103346,9 +103366,16 @@ ${USAGE}`);
103346
103366
  write: (chunk) => process.stdout.write(chunk)
103347
103367
  });
103348
103368
  const writesFolders = command === "folders" && ["add", "remove"].includes(positionals[1] ?? "") && positionals[2] !== void 0;
103349
- if ((["menu", "init", "enroll", "sync"].includes(command) || writesFolders) && !values["dry-run"]) {
103350
- const movesSync = command === "init" && service?.installRetiresReplaced === true;
103351
- let moveFinished;
103369
+ const needsCredentialPreflight = (["menu", "init", "enroll", "sync"].includes(command) || writesFolders) && !values["dry-run"];
103370
+ const movesSync = command === "init" && service?.installRetiresReplaced === true;
103371
+ const restartService2 = () => {
103372
+ if (requireBackgroundService(service).restart() === "not-installed") {
103373
+ throw new ExpectedCliError("Background sync is not installed. Rerun `powerplant init`.");
103374
+ }
103375
+ };
103376
+ const credentialPreflight = async (output2) => {
103377
+ let changed = false;
103378
+ let stopProgress;
103352
103379
  const outcome = await prepareCredentialUpgrade({
103353
103380
  needsMigration: () => credentialsNeedMigration(config2.appEnv),
103354
103381
  serviceExists: () => serviceState2(service) !== "not-installed",
@@ -103365,15 +103392,22 @@ ${USAGE}`);
103365
103392
  // (credentialMigration.ts), and only init moves sync to it.
103366
103393
  launcherCurrent: () => service?.installRetiresReplaced === true && !movesSync || service?.upToDate(watchCommand(config2, copy)) === true,
103367
103394
  install: () => {
103368
- if (movesSync) moveFinished = terminal.command.startActivity("Finishing background sync setup\u2026");
103395
+ if (movesSync) stopProgress = output2.startActivity(INIT_PREFLIGHT_LABELS.move);
103369
103396
  requireBackgroundService(service).install(watchCommand(config2, copy));
103397
+ changed = true;
103370
103398
  },
103399
+ restart: () => {
103400
+ stopProgress = output2.startActivity(INIT_PREFLIGHT_LABELS.restart);
103401
+ restartService2();
103402
+ changed = true;
103403
+ },
103404
+ startingNextWorker: () => describeDaemonState(readCollectorStatus(config2.appEnv)).state === "restarting",
103371
103405
  tryLock: () => tryCredentialUpgradeLock(path63.join(collectorStateDir(), `credential-upgrade-${config2.appEnv}.lock`)),
103372
103406
  now: Date.now,
103373
103407
  sleep: () => new Promise((resolve2) => setTimeout(resolve2, 250)),
103374
103408
  savesCredentials: command !== "menu",
103375
103409
  movesSync
103376
- }).finally(() => moveFinished?.()).catch((error63) => {
103410
+ }).finally(() => stopProgress?.()).catch((error63) => {
103377
103411
  if (error63 instanceof ExpectedCliError && credentialUpgradeBlock !== void 0) {
103378
103412
  reportDaily(
103379
103413
  new Error(`Credential upgrade blocked: ${credentialUpgradeBlock}`, { cause: error63 }),
@@ -103387,7 +103421,10 @@ ${USAGE}`);
103387
103421
  if (outcome === "busy" && command !== "menu") {
103388
103422
  throw new ExpectedCliError("Powerplant is updating background sync. Try this command again after the update finishes.");
103389
103423
  }
103390
- }
103424
+ return changed;
103425
+ };
103426
+ const preflightUnderInitHeader = needsCredentialPreflight && movesSync;
103427
+ if (needsCredentialPreflight && !preflightUnderInitHeader) await credentialPreflight(terminal.command);
103391
103428
  const withEnv = (cmd) => config2.appEnv === "production" ? cmd : `${cmd} --env ${config2.appEnv}`;
103392
103429
  const connectCommand = withEnv("powerplant connect");
103393
103430
  const disconnectCommand = withEnv("powerplant disconnect");
@@ -103544,11 +103581,7 @@ ${USAGE}`);
103544
103581
  const daemon = describeDaemonState(readCollectorStatus(config2.appEnv));
103545
103582
  return daemon.state === "running" ? daemon.status : null;
103546
103583
  },
103547
- restart: () => {
103548
- if (requireBackgroundService(service).restart() === "not-installed") {
103549
- throw new ExpectedCliError("Background sync is not installed. Rerun `powerplant init`.");
103550
- }
103551
- },
103584
+ restart: restartService2,
103552
103585
  now: Date.now,
103553
103586
  sleep: () => new Promise((resolve2) => setTimeout(resolve2, 250))
103554
103587
  }),
@@ -103563,7 +103596,8 @@ ${USAGE}`);
103563
103596
  connectCommand,
103564
103597
  environmentName: config2.appEnv,
103565
103598
  webUrl: config2.webUrl,
103566
- setupRefusal
103599
+ setupRefusal,
103600
+ prepareCredentialUpgrade: preflightUnderInitHeader ? credentialPreflight : null
103567
103601
  });
103568
103602
  process.exitCode = initExitCode(summary);
103569
103603
  return;
@@ -104254,4 +104288,4 @@ undici/lib/web/websocket/frame.js:
104254
104288
  (*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> *)
104255
104289
  */
104256
104290
 
104257
- //# debugId=6e438e0b-76c4-52f1-83bd-651f3e3005c6
104291
+ //# debugId=88557388-75d1-50bb-85dd-fada0be036eb
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usepowerplant/cli",
3
- "version": "0.4.29",
3
+ "version": "0.4.30",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },