@usepowerplant/cli 0.4.34 → 0.4.36

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]="e68dfa4d-9f44-5ddd-9585-453c496a0665")}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]="9097a1df-1029-52ad-9229-11dca3abcd84")}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;
@@ -37102,6 +37102,39 @@ ${captureLines}` : capture2.stack;
37102
37102
  }
37103
37103
  });
37104
37104
 
37105
+ // src/mcpPrompt.ts
37106
+ import { emitKeypressEvents } from "node:readline";
37107
+ function promptMcpSetup(question, input2 = process.stdin, output2 = process.stdout, interrupt = () => process.kill(process.pid, "SIGINT")) {
37108
+ const wasRaw = input2.isRaw === true;
37109
+ return new Promise((resolve2) => {
37110
+ const cleanup = () => {
37111
+ input2.removeListener("keypress", onKey);
37112
+ input2.removeListener("end", onEnd);
37113
+ input2.pause();
37114
+ input2.setRawMode?.(wasRaw);
37115
+ output2.write("\n");
37116
+ };
37117
+ const finish = (confirmed) => {
37118
+ cleanup();
37119
+ resolve2(confirmed);
37120
+ };
37121
+ const onEnd = () => finish(false);
37122
+ const onKey = (_character, key) => {
37123
+ if (key.ctrl && key.name === "c") {
37124
+ cleanup();
37125
+ interrupt();
37126
+ } else if (key.name === "escape") finish(false);
37127
+ else if (key.name === "return" || key.name === "enter" || key.ctrl && key.name === "d") finish(true);
37128
+ };
37129
+ emitKeypressEvents(input2);
37130
+ input2.on("keypress", onKey);
37131
+ input2.once("end", onEnd);
37132
+ input2.setRawMode?.(true);
37133
+ output2.write(question);
37134
+ input2.resume();
37135
+ });
37136
+ }
37137
+
37105
37138
  // src/hookPreferences.ts
37106
37139
  import { mkdirSync as mkdirSync26, readFileSync as readFileSync24, renameSync as renameSync13, writeFileSync as writeFileSync15 } from "node:fs";
37107
37140
  import path51 from "node:path";
@@ -57384,13 +57417,15 @@ function redactJsonSecretValues(text) {
57384
57417
  return out + text.slice(copied);
57385
57418
  }
57386
57419
  function redactSecretNamedValues(text) {
57387
- return redactJsonSecretValues(text).replace(
57420
+ const out = redactJsonSecretValues(text).replace(
57388
57421
  QUOTED_SECRET_VALUE,
57389
57422
  (match, name, separator, quote, value) => isSecretName(name) && isSecretValue(value) ? `${name}${separator}${quote}${REDACTED}${quote}` : match
57390
57423
  ).replace(
57391
57424
  CONFIG_LINE_SECRET_VALUE,
57392
57425
  (match, prefix, name, separator, value) => isSecretName(name) && isSecretValue(value) && /[\d/+=!@#$%^&*~?]/.test(value) ? `${prefix}${name}${separator}${REDACTED}` : match
57393
- ).replace(
57426
+ );
57427
+ if (!out.includes("**") && !out.includes("__")) return out;
57428
+ return out.replace(
57394
57429
  BOLD_FIELD_SECRET_VALUE,
57395
57430
  (match, start, _bold, label2, colon, gap, value) => isSecretName(label2) && isSecretValue(value) ? `${start}${label2}${colon}${gap}${REDACTED}` : match
57396
57431
  );
@@ -57702,7 +57737,8 @@ function isRecord(value) {
57702
57737
  var PROVIDER_WORDS = {
57703
57738
  anthropic: {
57704
57739
  speed: { standard: "standard", fast: "fast" },
57705
- service_tier: { standard: "standard" },
57740
+ // Anthropic's service tier is its priority queue, not Fast mode; usage.speed records Fast.
57741
+ service_tier: { standard: null },
57706
57742
  inference_geo: { global: "global", us: "us" }
57707
57743
  },
57708
57744
  openai: {
@@ -85308,7 +85344,7 @@ function _init2(options = {}, getDefaultIntegrationsImpl) {
85308
85344
  import tls2 from "node:tls";
85309
85345
  var import_undici = __toESM(require_undici(), 1);
85310
85346
  var CLI_VERSION_HEADER = "x-powerplant-cli-version";
85311
- var cliVersion = true ? "0.4.34" : "0.0.0-checkout";
85347
+ var cliVersion = true ? "0.4.36" : "0.0.0-checkout";
85312
85348
  function cliVersionHeaders() {
85313
85349
  return { [CLI_VERSION_HEADER]: cliVersion, "user-agent": `powerplant-cli/${cliVersion}` };
85314
85350
  }
@@ -93997,7 +94033,9 @@ var storedCredentialsSchema = external_exports.object({
93997
94033
  * installation whose account failed to resolve, nothing usable to
93998
94034
  * stand in) — unknown, never "claims nothing". A pass reading only
93999
94035
  * the cache must not stamp a deep sweep done over it. */
94000
- unresolved: external_exports.literal(true).optional()
94036
+ unresolved: external_exports.literal(true).optional(),
94037
+ /** The workspace's "parent-folder-sync" flag. Absent = on. */
94038
+ parentFolderSync: external_exports.boolean().optional()
94001
94039
  })
94002
94040
  ).optional(),
94003
94041
  /** Folders this member explicitly chose. Under scope mode they are the
@@ -94238,10 +94276,13 @@ function parentFolderOf(cwd, policy) {
94238
94276
  const synced = childNames.flatMap((name) => {
94239
94277
  const dir = paths.join(root, name);
94240
94278
  const repoFullName = policy.repoOf(dir);
94241
- return repoFullName !== null && policyClaimsRepo(policy, repoFullName) ? [{ dir, repoFullName }] : [];
94279
+ return repoFullName !== null && policyClaimsRepo(policy, repoFullName) && parentFolderSyncAllows(policy, repoFullName) ? [{ dir, repoFullName }] : [];
94242
94280
  });
94243
94281
  return synced.length > 0 ? { root, synced, childNames, platform: platform2, homeDir: home } : null;
94244
94282
  }
94283
+ function parentFolderSyncAllows(policy, repoFullName) {
94284
+ return (policy.workspaceClaims ?? []).filter((workspace) => workspaceClaimsRepo(repoFullName, workspace)).every((workspace) => workspace.parentFolderSync !== false);
94285
+ }
94245
94286
  var WRITE_TOOLS = /* @__PURE__ */ new Set(["Edit", "MultiEdit", "Write", "NotebookEdit"]);
94246
94287
  var SEARCH_TOOLS = /* @__PURE__ */ new Set(["Glob", "Grep"]);
94247
94288
  var SEARCH_COMMANDS = /* @__PURE__ */ new Set(["rg", "find", "fd", "ag", "ack", "tree"]);
@@ -95067,7 +95108,8 @@ async function fetchCapturePolicy(apiUrl, machineToken, request2 = {}) {
95067
95108
  isTestWorkspace: external_exports.boolean().optional().catch(void 0),
95068
95109
  owners: external_exports.array(external_exports.string()),
95069
95110
  repos: external_exports.array(external_exports.string()).nullable(),
95070
- integration: external_exports.enum(["none", "linked"])
95111
+ integration: external_exports.enum(["none", "linked"]),
95112
+ parentFolderSync: external_exports.boolean().optional().catch(void 0)
95071
95113
  })
95072
95114
  ).optional()
95073
95115
  })
@@ -95470,7 +95512,8 @@ async function runEnrollment(config2, options) {
95470
95512
  repos: workspace.repos,
95471
95513
  // Cached unknownness survives enrollment: an unresolved workspace's
95472
95514
  // claims are unknown, and the first sweep must not stamp over them.
95473
- ...workspace.integration === "linked" && workspace.owners.length === 0 && workspace.repos === null && { unresolved: true }
95515
+ ...workspace.integration === "linked" && workspace.owners.length === 0 && workspace.repos === null && { unresolved: true },
95516
+ ...workspace.parentFolderSync !== void 0 && { parentFolderSync: workspace.parentFolderSync }
95474
95517
  }));
95475
95518
  const credentials = {
95476
95519
  machineId: result.machine.id,
@@ -97618,17 +97661,20 @@ async function resolveCapturePolicy(config2, credentials, log3, deps = defaultPo
97618
97661
  const unresolved = workspace.integration === "linked" && workspace.owners.length === 0 && workspace.repos === null;
97619
97662
  const cached3 = workspacePolicies?.find((entry) => entry.orgId === workspace.orgId) ?? (credentials.orgId !== void 0 && workspace.orgId === credentials.orgId ? { orgId: workspace.orgId, name: workspace.name, owners, repos } : void 0);
97620
97663
  const usableCache = cached3 !== void 0 && workspaceClaimsAnyRepo(cached3);
97621
- const effective = unresolved && usableCache ? cached3 : unresolved ? {
97664
+ const flag = workspace.parentFolderSync === void 0 ? {} : { parentFolderSync: workspace.parentFolderSync };
97665
+ const effective = unresolved && usableCache ? { ...cached3, ...flag } : unresolved ? {
97622
97666
  orgId: workspace.orgId,
97623
97667
  name: workspace.name,
97624
97668
  owners: workspace.owners,
97625
97669
  repos: workspace.repos,
97626
- unresolved: true
97670
+ unresolved: true,
97671
+ ...flag
97627
97672
  } : {
97628
97673
  orgId: workspace.orgId,
97629
97674
  name: workspace.name,
97630
97675
  owners: workspace.owners,
97631
- repos: workspace.repos
97676
+ repos: workspace.repos,
97677
+ ...flag
97632
97678
  };
97633
97679
  if (effective.unresolved) claimsUnresolved = true;
97634
97680
  return effective;
@@ -100622,7 +100668,10 @@ function syncHeader(i) {
100622
100668
  var AGENT_TITLE_MAX = 48;
100623
100669
  function recentAgentItems(i) {
100624
100670
  if (i.memberSessions === null) return null;
100625
- const recent = i.memberSessions.filter((session) => i.now - Date.parse(session.lastActivityAt) < RECENT_SESSION_WINDOW_MS).filter((session) => session.archived !== true && session.subagent !== true && session.standaloneReview !== true).sort((a, b2) => Date.parse(b2.lastActivityAt) - Date.parse(a.lastActivityAt)).map((session) => agentRow(session, i)).filter((row) => row.agent?.status !== "ended").sort((a, b2) => Number(b2.agent?.status === "working") - Number(a.agent?.status === "working"));
100671
+ const recent = i.memberSessions.filter((session) => i.now - Date.parse(session.lastActivityAt) < RECENT_SESSION_WINDOW_MS).filter((session) => session.archived !== true && session.subagent !== true && session.standaloneReview !== true).sort((a, b2) => Date.parse(b2.lastActivityAt) - Date.parse(a.lastActivityAt)).map((session) => ({
100672
+ row: agentRow(session, i),
100673
+ localMachine: i.credentials !== null && session.machineId === i.credentials.machineId
100674
+ })).filter(({ row }) => row.agent?.status !== "ended").sort((a, b2) => Number(b2.row.agent?.status === "working") - Number(a.row.agent?.status === "working"));
100626
100675
  const rows = recent.length === 0 ? [{ type: "status", mark: "muted", title: i.memberSessionsIncomplete ? "No sessions found in the partial list" : "No eligible sessions in the latest results" }] : groupedAgentRows(recent.slice(0, RECENT_SESSION_VISIBLE_LIMIT), i.platform);
100627
100676
  if (i.memberSessionsIncomplete) rows.push({
100628
100677
  type: "status",
@@ -100638,10 +100687,13 @@ function recentAgentItems(i) {
100638
100687
  });
100639
100688
  return rows;
100640
100689
  }
100641
- function groupedAgentRows(rows, platform2) {
100642
- const openable2 = rows.filter((row) => row.agent?.harness !== void 0);
100643
- const unavailable = rows.filter((row) => row.agent?.harness === void 0);
100644
- return [...openable2, ...unavailable.length > 0 ? [{ type: "section", title: `Not on this ${platform2 === "darwin" ? "Mac" : "PC"}` }, ...unavailable] : []];
100690
+ function groupedAgentRows(sessions, platform2) {
100691
+ const available = [];
100692
+ const elsewhere = [];
100693
+ for (const { row, localMachine } of sessions) {
100694
+ (localMachine || row.agent?.harness !== void 0 ? available : elsewhere).push(row);
100695
+ }
100696
+ return [...available, ...elsewhere.length > 0 ? [{ type: "section", title: `Not on this ${platform2 === "darwin" ? "Mac" : "PC"}` }, ...elsewhere] : []];
100645
100697
  }
100646
100698
  function agentRow(session, i) {
100647
100699
  const name = session.title ?? session.repoDir ?? "Untitled session";
@@ -100979,12 +101031,24 @@ function requestedAfter(file2, writtenAtMs) {
100979
101031
  }
100980
101032
  }
100981
101033
 
101034
+ // src/mcpSetupOutcome.ts
101035
+ function aggregateConnectionTargets(results) {
101036
+ const has = (state2) => results.some((result) => result.state === state2);
101037
+ const state = has("failed") ? "failed" : results.every((result) => result.state === "skipped") ? "skipped" : has("pending") || has("skipped") ? "pending" : has("configured") ? "configured" : "connected";
101038
+ return { state, unchanged: results.every((result) => result.unchanged) };
101039
+ }
101040
+ async function confirmConnection(name, deps, missing, action = `sign in to ${name} in your browser`) {
101041
+ if (!deps.pressEnter || await deps.pressEnter(action)) return null;
101042
+ deps.log(missing ? `! ${name}: MCP setup skipped` : `! ${name}: MCP installed; sign-in needed`);
101043
+ return { state: missing ? "skipped" : "pending", unchanged: false };
101044
+ }
101045
+
100982
101046
  // src/connect.ts
100983
101047
  import { spawnSync as spawnSync6 } from "node:child_process";
100984
101048
  import { mkdirSync as mkdirSync29, readFileSync as readFileSync28, statSync as statSync12, writeFileSync as writeFileSync18 } from "node:fs";
100985
101049
  import os28 from "node:os";
100986
101050
  import path59 from "node:path";
100987
- import { emitKeypressEvents } from "node:readline";
101051
+ import { emitKeypressEvents as emitKeypressEvents2 } from "node:readline";
100988
101052
 
100989
101053
  // src/agentVersions.ts
100990
101054
  var AGENT_VERSION_FLOORS = {
@@ -101018,6 +101082,152 @@ function belowVersionFloor(client, versionText) {
101018
101082
  return { version: version2.join("."), floor };
101019
101083
  }
101020
101084
 
101085
+ // src/terminal.ts
101086
+ var ANSI = {
101087
+ clearLine: "\r\x1B[2K",
101088
+ amber: "\x1B[33m",
101089
+ cyan: "\x1B[36m",
101090
+ green: "\x1B[32m",
101091
+ red: "\x1B[31m",
101092
+ yellow: "\x1B[33m",
101093
+ dim: "\x1B[2m",
101094
+ bold: "\x1B[1m",
101095
+ underline: "\x1B[4m",
101096
+ resetColor: "\x1B[39m",
101097
+ /** Ends bold as well as dim: the terminal has one intensity attribute. */
101098
+ resetDim: "\x1B[22m",
101099
+ resetUnderline: "\x1B[24m"
101100
+ };
101101
+ var SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
101102
+ var COLUMNS = {
101103
+ command: { line: 0, detail: 2 },
101104
+ stage: { line: 5, detail: 7 }
101105
+ };
101106
+ function terminalUsesEffects(interactive, env) {
101107
+ return interactive && !("NO_COLOR" in env);
101108
+ }
101109
+ function colorPrefix(line) {
101110
+ const status = /^(\s*)([✓!✗→])/.exec(line);
101111
+ if (status) {
101112
+ const color = status[2] === "\u2713" ? ANSI.green : status[2] === "\u2717" ? ANSI.red : ANSI.yellow;
101113
+ return `${status[1]}${color}${status[2]}${ANSI.resetColor}${line.slice(status[0].length)}`;
101114
+ }
101115
+ if (line.startsWith("\u26A1 Powerplant")) {
101116
+ return `${ANSI.amber}\u26A1 Powerplant${ANSI.resetColor}${line.slice("\u26A1 Powerplant".length)}`;
101117
+ }
101118
+ return line.replace(/^(\d\/\d)/, `${ANSI.amber}$1${ANSI.resetColor}`);
101119
+ }
101120
+ function styleUrls(line) {
101121
+ return line.replace(
101122
+ /https:\/\/[^\s)]+/g,
101123
+ (url2) => `${ANSI.cyan}${ANSI.underline}${url2}${ANSI.resetUnderline}${ANSI.resetColor}`
101124
+ );
101125
+ }
101126
+ function styleCommands(line) {
101127
+ return line.replace(/`([^`]+)`/g, (_, command) => `${ANSI.bold}${command}${ANSI.resetDim}`);
101128
+ }
101129
+ function ignoreClosedOutput(streams) {
101130
+ for (const stream of streams) {
101131
+ stream.on("error", (error63) => {
101132
+ if (error63.code !== "EPIPE") throw error63;
101133
+ });
101134
+ }
101135
+ }
101136
+ function dim(line) {
101137
+ return `${ANSI.dim}${line}${ANSI.resetDim}`;
101138
+ }
101139
+ function withDimTerminal(write, work) {
101140
+ write(ANSI.dim);
101141
+ try {
101142
+ return work();
101143
+ } finally {
101144
+ write(ANSI.resetDim);
101145
+ }
101146
+ }
101147
+ function skippable(line, place) {
101148
+ if (/^\s*[✓!✗→]/.test(line)) return false;
101149
+ if (/`[^`]+`|https:\/\//.test(line)) return false;
101150
+ return place.level === "stage" ? !place.detail : place.detail;
101151
+ }
101152
+ function printExpectedError(error63, stderr, env) {
101153
+ const effects = terminalUsesEffects(stderr.isTTY === true, env);
101154
+ const output2 = createTerminalOutput({ interactive: effects, color: effects, write: (chunk) => stderr.write(chunk) }).command;
101155
+ output2.log(error63.message);
101156
+ for (const detail of error63.details) output2.detail(detail);
101157
+ }
101158
+ function styleLine(line, place) {
101159
+ if (skippable(line, place)) return dim(line);
101160
+ return styleCommands(styleUrls(colorPrefix(line)));
101161
+ }
101162
+ function createTerminalOutput(options) {
101163
+ const interactive = options.interactive;
101164
+ const color = interactive && options.color;
101165
+ let activityLabel = null;
101166
+ let activityIndent = "";
101167
+ let frameIndex = 0;
101168
+ const renderActivity = () => {
101169
+ if (activityLabel === null) return;
101170
+ const frame = SPINNER_FRAMES[frameIndex % SPINNER_FRAMES.length];
101171
+ frameIndex += 1;
101172
+ const glyph = color ? `${ANSI.amber}${frame}${ANSI.resetColor}` : frame;
101173
+ options.write(`${ANSI.clearLine}${activityIndent}${glyph} ${activityLabel}`);
101174
+ };
101175
+ const clearActivity = () => {
101176
+ if (activityLabel !== null) options.write(ANSI.clearLine);
101177
+ };
101178
+ const log3 = (line, place) => {
101179
+ const rerender = activityLabel !== null;
101180
+ if (rerender) clearActivity();
101181
+ options.write(`${color ? styleLine(line, place) : line}
101182
+ `);
101183
+ if (rerender) renderActivity();
101184
+ };
101185
+ const startActivity = (place, label2) => {
101186
+ const indent = " ".repeat(COLUMNS[place.level].line);
101187
+ if (!interactive) {
101188
+ log3(`${indent}\u2026 ${label2}`, place);
101189
+ return () => {
101190
+ };
101191
+ }
101192
+ activityLabel = label2;
101193
+ activityIndent = indent;
101194
+ frameIndex = 0;
101195
+ renderActivity();
101196
+ const timer = setInterval(renderActivity, 80);
101197
+ timer.unref();
101198
+ return () => {
101199
+ clearInterval(timer);
101200
+ clearActivity();
101201
+ activityLabel = null;
101202
+ };
101203
+ };
101204
+ const activity = async (place, label2, work) => {
101205
+ const stop = startActivity(place, label2);
101206
+ try {
101207
+ return await work();
101208
+ } finally {
101209
+ stop();
101210
+ }
101211
+ };
101212
+ const writer = (level) => {
101213
+ const columns = COLUMNS[level];
101214
+ const indent = " ".repeat(columns.line);
101215
+ const detailIndent = " ".repeat(columns.detail);
101216
+ const line = { level, detail: false };
101217
+ const detail = { level, detail: true };
101218
+ return {
101219
+ indent,
101220
+ // A blank line separates stages; it carries no indentation.
101221
+ log: (text) => log3(text === "" ? "" : `${indent}${text}`, line),
101222
+ detail: (text) => log3(`${detailIndent}${text}`, detail),
101223
+ activity: (label2, work) => activity(line, label2, work),
101224
+ startActivity: (label2) => startActivity(line, label2),
101225
+ pressEnterPrompt: (action) => color ? `${indent}${ANSI.bold}Press Enter${ANSI.resetDim} to ${styleUrls(action)}\u2026 ` : `${indent}Press Enter to ${action}\u2026 `
101226
+ };
101227
+ };
101228
+ return { command: writer("command"), stage: writer("stage") };
101229
+ }
101230
+
101021
101231
  // src/connect.ts
101022
101232
  var AGENT_DISPLAY_NAMES = {
101023
101233
  claude: "Claude Code",
@@ -101080,7 +101290,7 @@ async function runConnectStage(clients, deps) {
101080
101290
  found: already.found + outcome.found + skipped,
101081
101291
  connected: already.connected + outcome.connected,
101082
101292
  unchanged: already.unchanged + outcome.unchanged,
101083
- skipped
101293
+ skipped: skipped + outcome.skipped
101084
101294
  };
101085
101295
  }
101086
101296
  function unsigned(candidate, verifySignature) {
@@ -101129,6 +101339,7 @@ async function runConnect(clients, deps) {
101129
101339
  for (const targetCandidates of groupByConnectionTarget(candidates).values()) {
101130
101340
  results.push(await connectTarget(agent, targetCandidates, clients, deps));
101131
101341
  }
101342
+ if (results.every((result2) => result2.state === "skipped")) deps.onSkipped?.(agent);
101132
101343
  const result = aggregateConnectionTargets(results);
101133
101344
  outcome[result.state] += 1;
101134
101345
  if (result.unchanged) outcome.unchanged += 1;
@@ -101154,10 +101365,6 @@ function groupByConnectionTarget(clients) {
101154
101365
  }
101155
101366
  return targets;
101156
101367
  }
101157
- function aggregateConnectionTargets(results) {
101158
- const state = results.some((result) => result.state === "failed") ? "failed" : results.some((result) => result.state === "pending") ? "pending" : results.some((result) => result.state === "configured") ? "configured" : "connected";
101159
- return { state, unchanged: results.every((result) => result.unchanged) };
101160
- }
101161
101368
  async function connectTarget(agent, candidates, all, deps) {
101162
101369
  let last = failed("no installation to try");
101163
101370
  for (const [index, candidate] of candidates.entries()) {
@@ -101212,13 +101419,13 @@ function pickerAllowed(options) {
101212
101419
  async function pickAgents(clients, deps) {
101213
101420
  const products = [...new Set(clients.map((client) => client.client))];
101214
101421
  if (products.length === 0) return clients;
101215
- deps.log("This selects MCP access only. Session uploads follow your machine\u2019s capture settings.");
101216
101422
  const selected = await deps.promptCheckboxes(
101217
- "Add MCP to all",
101423
+ "What agents should be able to use Powerplant MCP?",
101218
101424
  products.map((product) => ({
101219
101425
  value: product,
101220
101426
  label: AGENT_DISPLAY_NAMES[product]
101221
- }))
101427
+ })),
101428
+ "This does not affect upload settings."
101222
101429
  );
101223
101430
  if (selected === null) return clients;
101224
101431
  const kept = new Set(selected);
@@ -101238,14 +101445,13 @@ function realCheckboxPrompt(question, choices, seams = {}) {
101238
101445
  let settled = false;
101239
101446
  const wasRaw = input2.isRaw === true;
101240
101447
  const render = () => [
101241
- `${indent}? ${question}`,
101242
101448
  ...choices.map(
101243
101449
  (choice, index) => `${indent}${index === active ? "\u276F" : " "} [${selected.has(choice.value) ? "x" : " "}] ${choice.label}`
101244
101450
  ),
101245
- `${indent} \u2191/\u2193 move \xB7 space toggle \xB7 enter confirm`
101451
+ `${indent} \u2191/\u2193: move \xB7 space: toggle \xB7 enter: confirm`
101246
101452
  ].join("\n");
101247
101453
  const redraw = () => {
101248
- output2.write(`\r\x1B[${choices.length + 1}A\x1B[J${render()}`);
101454
+ output2.write(`\r\x1B[${choices.length}A\x1B[J${render()}`);
101249
101455
  };
101250
101456
  return new Promise((resolve2) => {
101251
101457
  const cleanup = () => {
@@ -101297,10 +101503,17 @@ function realCheckboxPrompt(question, choices, seams = {}) {
101297
101503
  finish([]);
101298
101504
  return;
101299
101505
  }
101300
- emitKeypressEvents(input2);
101506
+ emitKeypressEvents2(input2);
101301
101507
  input2.on("keypress", onKeypress);
101302
101508
  input2.once("end", onEnd);
101303
101509
  if (input2.setRawMode) input2.setRawMode(true);
101510
+ output2.write(`${indent}${question}
101511
+ `);
101512
+ if (seams.description) {
101513
+ const description = terminalUsesEffects(output2.isTTY === true, process.env) ? dim(seams.description) : seams.description;
101514
+ output2.write(`${indent}${description}
101515
+ `);
101516
+ }
101304
101517
  output2.write(render());
101305
101518
  input2.resume();
101306
101519
  });
@@ -101321,6 +101534,12 @@ async function connectClaude(client, name, deps) {
101321
101534
  return failed(`probing for the Powerplant MCP failed, ${probe.detail}`);
101322
101535
  }
101323
101536
  const { missing, registeredUrl } = probe;
101537
+ if (!missing && (registeredUrl === void 0 || registeredUrl === deps.mcpUrl) && probe.signIn === "signed-in") {
101538
+ deps.log(`\u2713 ${name}: MCP already connected`);
101539
+ return { state: "connected", unchanged: true };
101540
+ }
101541
+ const skipped = await confirmConnection(name, deps, missing);
101542
+ if (skipped) return skipped;
101324
101543
  if (missing || registeredUrl !== void 0 && registeredUrl !== deps.mcpUrl) {
101325
101544
  if (!missing) {
101326
101545
  deps.log(`${name} was registered against ${registeredUrl}, re-registering for ${deps.mcpUrl}.`);
@@ -101330,9 +101549,6 @@ async function connectClaude(client, name, deps) {
101330
101549
  if (add.status !== 0) {
101331
101550
  return failed(`registering the Powerplant MCP failed, ${describeFailure(add)}`);
101332
101551
  }
101333
- } else if (probe.signIn === "signed-in") {
101334
- deps.log(`\u2713 ${name}: MCP already connected`);
101335
- return { state: "connected", unchanged: true };
101336
101552
  } else if (probe.signIn === "sign-in-needed" && deps.officialClients?.["claude-code"]) {
101337
101553
  deps.run(bin, ["mcp", "remove", "--scope", "user", deps.serverName], env);
101338
101554
  const add = deps.run(bin, claudeAddArgs(deps), env);
@@ -101525,6 +101741,10 @@ async function connectCodex(install, name, unscoped) {
101525
101741
  const { missing, registeredUrl } = probe;
101526
101742
  const wrongUrl = registeredUrl !== void 0 && registeredUrl !== deps.mcpUrl;
101527
101743
  const alreadyConnected = !missing && !wrongUrl && probe.signIn === "signed-in";
101744
+ if (!alreadyConnected) {
101745
+ const skipped = await confirmConnection(name, deps, missing);
101746
+ if (skipped) return skipped;
101747
+ }
101528
101748
  if (missing || wrongUrl) {
101529
101749
  if (wrongUrl) deps.log(`${name} was registered against ${registeredUrl}, re-registering for ${deps.mcpUrl}.`);
101530
101750
  if (codexAddLogsIn(bin, deps)) {
@@ -101578,8 +101798,9 @@ function ensureCodexOfficialClient(name, deps) {
101578
101798
  }
101579
101799
  async function connectCursor(mcpJsonPath, name, deps) {
101580
101800
  const official = deps.officialClients?.cursor;
101801
+ const existing = deps.readTextFile(mcpJsonPath);
101581
101802
  const patch = patchCursorMcpJson(
101582
- deps.readTextFile(mcpJsonPath),
101803
+ existing,
101583
101804
  deps.serverName,
101584
101805
  deps.mcpUrl,
101585
101806
  official?.clientId ?? null
@@ -101589,8 +101810,9 @@ async function connectCursor(mcpJsonPath, name, deps) {
101589
101810
  `${mcpJsonPath.replace(os28.homedir(), "~")} is ${patch.error}, fix it by hand, then re-run ${deps.connectCommand}.`
101590
101811
  );
101591
101812
  }
101813
+ const skipped = await confirmConnection(name, deps, !unpatchCursorMcpJson(existing, deps.serverName).changed, "open Cursor");
101814
+ if (skipped) return skipped;
101592
101815
  if (patch.changed) deps.writeTextFile(mcpJsonPath, patch.content);
101593
- await deps.pressEnter?.("open Cursor");
101594
101816
  if (deps.openUrl(cursorInstallDeeplink(deps.serverName, patch.entry))) {
101595
101817
  deps.log(`\u2192 ${name}: approve inside Cursor when it asks`);
101596
101818
  return { state: "configured", unchanged: !patch.changed };
@@ -101601,8 +101823,7 @@ async function connectCursor(mcpJsonPath, name, deps) {
101601
101823
  return { state: "pending", unchanged: false };
101602
101824
  }
101603
101825
  async function login(bin, name, args, deps, env) {
101604
- if (deps.pressEnter) await deps.pressEnter(`sign in to ${name} in your browser`);
101605
- else deps.log(`\u2192 ${name}: approve in your browser\u2026`);
101826
+ if (!deps.pressEnter) deps.log(`\u2192 ${name}: approve in your browser\u2026`);
101606
101827
  const status = deps.runInteractive(bin, args, env);
101607
101828
  if (status === 0) {
101608
101829
  deps.log(`\u2713 ${name}: MCP connected`);
@@ -103105,7 +103326,7 @@ function runResumeSession(source, sessionId, deps = {}) {
103105
103326
  }
103106
103327
 
103107
103328
  // src/version.ts
103108
- var CLI_VERSION = true ? "0.4.34" : "0.0.0-checkout";
103329
+ var CLI_VERSION = true ? "0.4.36" : "0.0.0-checkout";
103109
103330
  var CLI_RELEASE_BUILD = true ? true : false;
103110
103331
  var CLI_DEVELOPMENT_COPY = false;
103111
103332
  function updateRefusal(tarball, developmentCopy = CLI_DEVELOPMENT_COPY) {
@@ -103378,152 +103599,6 @@ function fetchVersionFacts(appEnv, credentials, packageName, fetchImpl = fetch,
103378
103599
  return Promise.all([latest2, policy.then((found) => found?.oldestSupportedVersion ?? null)]);
103379
103600
  }
103380
103601
 
103381
- // src/terminal.ts
103382
- var ANSI = {
103383
- clearLine: "\r\x1B[2K",
103384
- amber: "\x1B[33m",
103385
- cyan: "\x1B[36m",
103386
- green: "\x1B[32m",
103387
- red: "\x1B[31m",
103388
- yellow: "\x1B[33m",
103389
- dim: "\x1B[2m",
103390
- bold: "\x1B[1m",
103391
- underline: "\x1B[4m",
103392
- resetColor: "\x1B[39m",
103393
- /** Ends bold as well as dim: the terminal has one intensity attribute. */
103394
- resetDim: "\x1B[22m",
103395
- resetUnderline: "\x1B[24m"
103396
- };
103397
- var SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
103398
- var COLUMNS = {
103399
- command: { line: 0, detail: 2 },
103400
- stage: { line: 5, detail: 7 }
103401
- };
103402
- function terminalUsesEffects(interactive, env) {
103403
- return interactive && !("NO_COLOR" in env);
103404
- }
103405
- function colorPrefix(line) {
103406
- const status = /^(\s*)([✓!✗→])/.exec(line);
103407
- if (status) {
103408
- const color = status[2] === "\u2713" ? ANSI.green : status[2] === "\u2717" ? ANSI.red : ANSI.yellow;
103409
- return `${status[1]}${color}${status[2]}${ANSI.resetColor}${line.slice(status[0].length)}`;
103410
- }
103411
- if (line.startsWith("\u26A1 Powerplant")) {
103412
- return `${ANSI.amber}\u26A1 Powerplant${ANSI.resetColor}${line.slice("\u26A1 Powerplant".length)}`;
103413
- }
103414
- return line.replace(/^(\d\/\d)/, `${ANSI.amber}$1${ANSI.resetColor}`);
103415
- }
103416
- function styleUrls(line) {
103417
- return line.replace(
103418
- /https:\/\/[^\s)]+/g,
103419
- (url2) => `${ANSI.cyan}${ANSI.underline}${url2}${ANSI.resetUnderline}${ANSI.resetColor}`
103420
- );
103421
- }
103422
- function styleCommands(line) {
103423
- return line.replace(/`([^`]+)`/g, (_, command) => `${ANSI.bold}${command}${ANSI.resetDim}`);
103424
- }
103425
- function ignoreClosedOutput(streams) {
103426
- for (const stream of streams) {
103427
- stream.on("error", (error63) => {
103428
- if (error63.code !== "EPIPE") throw error63;
103429
- });
103430
- }
103431
- }
103432
- function dim(line) {
103433
- return `${ANSI.dim}${line}${ANSI.resetDim}`;
103434
- }
103435
- function withDimTerminal(write, work) {
103436
- write(ANSI.dim);
103437
- try {
103438
- return work();
103439
- } finally {
103440
- write(ANSI.resetDim);
103441
- }
103442
- }
103443
- function skippable(line, place) {
103444
- if (/^\s*[✓!✗→]/.test(line)) return false;
103445
- if (/`[^`]+`|https:\/\//.test(line)) return false;
103446
- return place.level === "stage" ? !place.detail : place.detail;
103447
- }
103448
- function printExpectedError(error63, stderr, env) {
103449
- const effects = terminalUsesEffects(stderr.isTTY === true, env);
103450
- const output2 = createTerminalOutput({ interactive: effects, color: effects, write: (chunk) => stderr.write(chunk) }).command;
103451
- output2.log(error63.message);
103452
- for (const detail of error63.details) output2.detail(detail);
103453
- }
103454
- function styleLine(line, place) {
103455
- if (skippable(line, place)) return dim(line);
103456
- return styleCommands(styleUrls(colorPrefix(line)));
103457
- }
103458
- function createTerminalOutput(options) {
103459
- const interactive = options.interactive;
103460
- const color = interactive && options.color;
103461
- let activityLabel = null;
103462
- let activityIndent = "";
103463
- let frameIndex = 0;
103464
- const renderActivity = () => {
103465
- if (activityLabel === null) return;
103466
- const frame = SPINNER_FRAMES[frameIndex % SPINNER_FRAMES.length];
103467
- frameIndex += 1;
103468
- const glyph = color ? `${ANSI.amber}${frame}${ANSI.resetColor}` : frame;
103469
- options.write(`${ANSI.clearLine}${activityIndent}${glyph} ${activityLabel}`);
103470
- };
103471
- const clearActivity = () => {
103472
- if (activityLabel !== null) options.write(ANSI.clearLine);
103473
- };
103474
- const log3 = (line, place) => {
103475
- const rerender = activityLabel !== null;
103476
- if (rerender) clearActivity();
103477
- options.write(`${color ? styleLine(line, place) : line}
103478
- `);
103479
- if (rerender) renderActivity();
103480
- };
103481
- const startActivity = (place, label2) => {
103482
- const indent = " ".repeat(COLUMNS[place.level].line);
103483
- if (!interactive) {
103484
- log3(`${indent}\u2026 ${label2}`, place);
103485
- return () => {
103486
- };
103487
- }
103488
- activityLabel = label2;
103489
- activityIndent = indent;
103490
- frameIndex = 0;
103491
- renderActivity();
103492
- const timer = setInterval(renderActivity, 80);
103493
- timer.unref();
103494
- return () => {
103495
- clearInterval(timer);
103496
- clearActivity();
103497
- activityLabel = null;
103498
- };
103499
- };
103500
- const activity = async (place, label2, work) => {
103501
- const stop = startActivity(place, label2);
103502
- try {
103503
- return await work();
103504
- } finally {
103505
- stop();
103506
- }
103507
- };
103508
- const writer = (level) => {
103509
- const columns = COLUMNS[level];
103510
- const indent = " ".repeat(columns.line);
103511
- const detailIndent = " ".repeat(columns.detail);
103512
- const line = { level, detail: false };
103513
- const detail = { level, detail: true };
103514
- return {
103515
- indent,
103516
- // A blank line separates stages; it carries no indentation.
103517
- log: (text) => log3(text === "" ? "" : `${indent}${text}`, line),
103518
- detail: (text) => log3(`${detailIndent}${text}`, detail),
103519
- activity: (label2, work) => activity(line, label2, work),
103520
- startActivity: (label2) => startActivity(line, label2),
103521
- pressEnterPrompt: (action) => color ? `${indent}${ANSI.bold}Press Enter${ANSI.resetDim} to ${styleUrls(action)}\u2026 ` : `${indent}Press Enter to ${action}\u2026 `
103522
- };
103523
- };
103524
- return { command: writer("command"), stage: writer("stage") };
103525
- }
103526
-
103527
103602
  // src/installProgress.ts
103528
103603
  function installProgress(writer, update) {
103529
103604
  const show = () => update ? () => {
@@ -104383,7 +104458,7 @@ ${USAGE}`);
104383
104458
  // already chose, and --yes or non-TTY runs must never wait on a prompt.
104384
104459
  pick: pickerOn && clientFilter === void 0 ? (offered) => pickAgents(offered, {
104385
104460
  log: log3,
104386
- promptCheckboxes: (question, choices) => realCheckboxPrompt(question, choices, { indent: output2.indent }),
104461
+ promptCheckboxes: (question, choices, description) => realCheckboxPrompt(question, choices, { indent: output2.indent, description }),
104387
104462
  onChoice: (selected) => recordMcpChoices(
104388
104463
  config2.appEnv,
104389
104464
  offered.map((client) => client.client),
@@ -104408,7 +104483,8 @@ ${USAGE}`);
104408
104483
  url2,
104409
104484
  (reason) => log3(`! Cursor: could not open Cursor (${reason}), enable the ${mcpServerNameFor(config2.appEnv)} server in Cursor's MCP settings and sign in`)
104410
104485
  ),
104411
- pressEnter: pickerOn ? (action) => pressEnter(output2, action) : null,
104486
+ pressEnter: pickerOn ? (action) => promptMcpSetup(output2.pressEnterPrompt(action)) : null,
104487
+ onSkipped: (client) => recordMcpChoices(config2.appEnv, [client], []),
104412
104488
  codexConfigPath: codexConfigPath({}),
104413
104489
  verifySignature: verifyBundleSignatureSync
104414
104490
  }),
@@ -105158,4 +105234,4 @@ undici/lib/web/websocket/frame.js:
105158
105234
  (*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> *)
105159
105235
  */
105160
105236
 
105161
- //# debugId=e68dfa4d-9f44-5ddd-9585-453c496a0665
105237
+ //# debugId=9097a1df-1029-52ad-9229-11dca3abcd84
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usepowerplant/cli",
3
- "version": "0.4.34",
3
+ "version": "0.4.36",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },