@usepowerplant/cli 0.4.34 → 0.4.35
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 +252 -182
- package/dist/menubar/Powerplant.app.zip +0 -0
- package/package.json +1 -1
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]="
|
|
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]="79afb1aa-8532-5f74-8d71-d00555a824ee")}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
|
-
|
|
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
|
-
)
|
|
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
|
-
|
|
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.
|
|
85347
|
+
var cliVersion = true ? "0.4.35" : "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
|
|
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;
|
|
@@ -100979,12 +101025,24 @@ function requestedAfter(file2, writtenAtMs) {
|
|
|
100979
101025
|
}
|
|
100980
101026
|
}
|
|
100981
101027
|
|
|
101028
|
+
// src/mcpSetupOutcome.ts
|
|
101029
|
+
function aggregateConnectionTargets(results) {
|
|
101030
|
+
const has = (state2) => results.some((result) => result.state === state2);
|
|
101031
|
+
const state = has("failed") ? "failed" : results.every((result) => result.state === "skipped") ? "skipped" : has("pending") || has("skipped") ? "pending" : has("configured") ? "configured" : "connected";
|
|
101032
|
+
return { state, unchanged: results.every((result) => result.unchanged) };
|
|
101033
|
+
}
|
|
101034
|
+
async function confirmConnection(name, deps, missing, action = `sign in to ${name} in your browser`) {
|
|
101035
|
+
if (!deps.pressEnter || await deps.pressEnter(action)) return null;
|
|
101036
|
+
deps.log(missing ? `! ${name}: MCP setup skipped` : `! ${name}: MCP installed; sign-in needed`);
|
|
101037
|
+
return { state: missing ? "skipped" : "pending", unchanged: false };
|
|
101038
|
+
}
|
|
101039
|
+
|
|
100982
101040
|
// src/connect.ts
|
|
100983
101041
|
import { spawnSync as spawnSync6 } from "node:child_process";
|
|
100984
101042
|
import { mkdirSync as mkdirSync29, readFileSync as readFileSync28, statSync as statSync12, writeFileSync as writeFileSync18 } from "node:fs";
|
|
100985
101043
|
import os28 from "node:os";
|
|
100986
101044
|
import path59 from "node:path";
|
|
100987
|
-
import { emitKeypressEvents } from "node:readline";
|
|
101045
|
+
import { emitKeypressEvents as emitKeypressEvents2 } from "node:readline";
|
|
100988
101046
|
|
|
100989
101047
|
// src/agentVersions.ts
|
|
100990
101048
|
var AGENT_VERSION_FLOORS = {
|
|
@@ -101018,6 +101076,152 @@ function belowVersionFloor(client, versionText) {
|
|
|
101018
101076
|
return { version: version2.join("."), floor };
|
|
101019
101077
|
}
|
|
101020
101078
|
|
|
101079
|
+
// src/terminal.ts
|
|
101080
|
+
var ANSI = {
|
|
101081
|
+
clearLine: "\r\x1B[2K",
|
|
101082
|
+
amber: "\x1B[33m",
|
|
101083
|
+
cyan: "\x1B[36m",
|
|
101084
|
+
green: "\x1B[32m",
|
|
101085
|
+
red: "\x1B[31m",
|
|
101086
|
+
yellow: "\x1B[33m",
|
|
101087
|
+
dim: "\x1B[2m",
|
|
101088
|
+
bold: "\x1B[1m",
|
|
101089
|
+
underline: "\x1B[4m",
|
|
101090
|
+
resetColor: "\x1B[39m",
|
|
101091
|
+
/** Ends bold as well as dim: the terminal has one intensity attribute. */
|
|
101092
|
+
resetDim: "\x1B[22m",
|
|
101093
|
+
resetUnderline: "\x1B[24m"
|
|
101094
|
+
};
|
|
101095
|
+
var SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
101096
|
+
var COLUMNS = {
|
|
101097
|
+
command: { line: 0, detail: 2 },
|
|
101098
|
+
stage: { line: 5, detail: 7 }
|
|
101099
|
+
};
|
|
101100
|
+
function terminalUsesEffects(interactive, env) {
|
|
101101
|
+
return interactive && !("NO_COLOR" in env);
|
|
101102
|
+
}
|
|
101103
|
+
function colorPrefix(line) {
|
|
101104
|
+
const status = /^(\s*)([✓!✗→])/.exec(line);
|
|
101105
|
+
if (status) {
|
|
101106
|
+
const color = status[2] === "\u2713" ? ANSI.green : status[2] === "\u2717" ? ANSI.red : ANSI.yellow;
|
|
101107
|
+
return `${status[1]}${color}${status[2]}${ANSI.resetColor}${line.slice(status[0].length)}`;
|
|
101108
|
+
}
|
|
101109
|
+
if (line.startsWith("\u26A1 Powerplant")) {
|
|
101110
|
+
return `${ANSI.amber}\u26A1 Powerplant${ANSI.resetColor}${line.slice("\u26A1 Powerplant".length)}`;
|
|
101111
|
+
}
|
|
101112
|
+
return line.replace(/^(\d\/\d)/, `${ANSI.amber}$1${ANSI.resetColor}`);
|
|
101113
|
+
}
|
|
101114
|
+
function styleUrls(line) {
|
|
101115
|
+
return line.replace(
|
|
101116
|
+
/https:\/\/[^\s)]+/g,
|
|
101117
|
+
(url2) => `${ANSI.cyan}${ANSI.underline}${url2}${ANSI.resetUnderline}${ANSI.resetColor}`
|
|
101118
|
+
);
|
|
101119
|
+
}
|
|
101120
|
+
function styleCommands(line) {
|
|
101121
|
+
return line.replace(/`([^`]+)`/g, (_, command) => `${ANSI.bold}${command}${ANSI.resetDim}`);
|
|
101122
|
+
}
|
|
101123
|
+
function ignoreClosedOutput(streams) {
|
|
101124
|
+
for (const stream of streams) {
|
|
101125
|
+
stream.on("error", (error63) => {
|
|
101126
|
+
if (error63.code !== "EPIPE") throw error63;
|
|
101127
|
+
});
|
|
101128
|
+
}
|
|
101129
|
+
}
|
|
101130
|
+
function dim(line) {
|
|
101131
|
+
return `${ANSI.dim}${line}${ANSI.resetDim}`;
|
|
101132
|
+
}
|
|
101133
|
+
function withDimTerminal(write, work) {
|
|
101134
|
+
write(ANSI.dim);
|
|
101135
|
+
try {
|
|
101136
|
+
return work();
|
|
101137
|
+
} finally {
|
|
101138
|
+
write(ANSI.resetDim);
|
|
101139
|
+
}
|
|
101140
|
+
}
|
|
101141
|
+
function skippable(line, place) {
|
|
101142
|
+
if (/^\s*[✓!✗→]/.test(line)) return false;
|
|
101143
|
+
if (/`[^`]+`|https:\/\//.test(line)) return false;
|
|
101144
|
+
return place.level === "stage" ? !place.detail : place.detail;
|
|
101145
|
+
}
|
|
101146
|
+
function printExpectedError(error63, stderr, env) {
|
|
101147
|
+
const effects = terminalUsesEffects(stderr.isTTY === true, env);
|
|
101148
|
+
const output2 = createTerminalOutput({ interactive: effects, color: effects, write: (chunk) => stderr.write(chunk) }).command;
|
|
101149
|
+
output2.log(error63.message);
|
|
101150
|
+
for (const detail of error63.details) output2.detail(detail);
|
|
101151
|
+
}
|
|
101152
|
+
function styleLine(line, place) {
|
|
101153
|
+
if (skippable(line, place)) return dim(line);
|
|
101154
|
+
return styleCommands(styleUrls(colorPrefix(line)));
|
|
101155
|
+
}
|
|
101156
|
+
function createTerminalOutput(options) {
|
|
101157
|
+
const interactive = options.interactive;
|
|
101158
|
+
const color = interactive && options.color;
|
|
101159
|
+
let activityLabel = null;
|
|
101160
|
+
let activityIndent = "";
|
|
101161
|
+
let frameIndex = 0;
|
|
101162
|
+
const renderActivity = () => {
|
|
101163
|
+
if (activityLabel === null) return;
|
|
101164
|
+
const frame = SPINNER_FRAMES[frameIndex % SPINNER_FRAMES.length];
|
|
101165
|
+
frameIndex += 1;
|
|
101166
|
+
const glyph = color ? `${ANSI.amber}${frame}${ANSI.resetColor}` : frame;
|
|
101167
|
+
options.write(`${ANSI.clearLine}${activityIndent}${glyph} ${activityLabel}`);
|
|
101168
|
+
};
|
|
101169
|
+
const clearActivity = () => {
|
|
101170
|
+
if (activityLabel !== null) options.write(ANSI.clearLine);
|
|
101171
|
+
};
|
|
101172
|
+
const log3 = (line, place) => {
|
|
101173
|
+
const rerender = activityLabel !== null;
|
|
101174
|
+
if (rerender) clearActivity();
|
|
101175
|
+
options.write(`${color ? styleLine(line, place) : line}
|
|
101176
|
+
`);
|
|
101177
|
+
if (rerender) renderActivity();
|
|
101178
|
+
};
|
|
101179
|
+
const startActivity = (place, label2) => {
|
|
101180
|
+
const indent = " ".repeat(COLUMNS[place.level].line);
|
|
101181
|
+
if (!interactive) {
|
|
101182
|
+
log3(`${indent}\u2026 ${label2}`, place);
|
|
101183
|
+
return () => {
|
|
101184
|
+
};
|
|
101185
|
+
}
|
|
101186
|
+
activityLabel = label2;
|
|
101187
|
+
activityIndent = indent;
|
|
101188
|
+
frameIndex = 0;
|
|
101189
|
+
renderActivity();
|
|
101190
|
+
const timer = setInterval(renderActivity, 80);
|
|
101191
|
+
timer.unref();
|
|
101192
|
+
return () => {
|
|
101193
|
+
clearInterval(timer);
|
|
101194
|
+
clearActivity();
|
|
101195
|
+
activityLabel = null;
|
|
101196
|
+
};
|
|
101197
|
+
};
|
|
101198
|
+
const activity = async (place, label2, work) => {
|
|
101199
|
+
const stop = startActivity(place, label2);
|
|
101200
|
+
try {
|
|
101201
|
+
return await work();
|
|
101202
|
+
} finally {
|
|
101203
|
+
stop();
|
|
101204
|
+
}
|
|
101205
|
+
};
|
|
101206
|
+
const writer = (level) => {
|
|
101207
|
+
const columns = COLUMNS[level];
|
|
101208
|
+
const indent = " ".repeat(columns.line);
|
|
101209
|
+
const detailIndent = " ".repeat(columns.detail);
|
|
101210
|
+
const line = { level, detail: false };
|
|
101211
|
+
const detail = { level, detail: true };
|
|
101212
|
+
return {
|
|
101213
|
+
indent,
|
|
101214
|
+
// A blank line separates stages; it carries no indentation.
|
|
101215
|
+
log: (text) => log3(text === "" ? "" : `${indent}${text}`, line),
|
|
101216
|
+
detail: (text) => log3(`${detailIndent}${text}`, detail),
|
|
101217
|
+
activity: (label2, work) => activity(line, label2, work),
|
|
101218
|
+
startActivity: (label2) => startActivity(line, label2),
|
|
101219
|
+
pressEnterPrompt: (action) => color ? `${indent}${ANSI.bold}Press Enter${ANSI.resetDim} to ${styleUrls(action)}\u2026 ` : `${indent}Press Enter to ${action}\u2026 `
|
|
101220
|
+
};
|
|
101221
|
+
};
|
|
101222
|
+
return { command: writer("command"), stage: writer("stage") };
|
|
101223
|
+
}
|
|
101224
|
+
|
|
101021
101225
|
// src/connect.ts
|
|
101022
101226
|
var AGENT_DISPLAY_NAMES = {
|
|
101023
101227
|
claude: "Claude Code",
|
|
@@ -101080,7 +101284,7 @@ async function runConnectStage(clients, deps) {
|
|
|
101080
101284
|
found: already.found + outcome.found + skipped,
|
|
101081
101285
|
connected: already.connected + outcome.connected,
|
|
101082
101286
|
unchanged: already.unchanged + outcome.unchanged,
|
|
101083
|
-
skipped
|
|
101287
|
+
skipped: skipped + outcome.skipped
|
|
101084
101288
|
};
|
|
101085
101289
|
}
|
|
101086
101290
|
function unsigned(candidate, verifySignature) {
|
|
@@ -101129,6 +101333,7 @@ async function runConnect(clients, deps) {
|
|
|
101129
101333
|
for (const targetCandidates of groupByConnectionTarget(candidates).values()) {
|
|
101130
101334
|
results.push(await connectTarget(agent, targetCandidates, clients, deps));
|
|
101131
101335
|
}
|
|
101336
|
+
if (results.every((result2) => result2.state === "skipped")) deps.onSkipped?.(agent);
|
|
101132
101337
|
const result = aggregateConnectionTargets(results);
|
|
101133
101338
|
outcome[result.state] += 1;
|
|
101134
101339
|
if (result.unchanged) outcome.unchanged += 1;
|
|
@@ -101154,10 +101359,6 @@ function groupByConnectionTarget(clients) {
|
|
|
101154
101359
|
}
|
|
101155
101360
|
return targets;
|
|
101156
101361
|
}
|
|
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
101362
|
async function connectTarget(agent, candidates, all, deps) {
|
|
101162
101363
|
let last = failed("no installation to try");
|
|
101163
101364
|
for (const [index, candidate] of candidates.entries()) {
|
|
@@ -101212,13 +101413,13 @@ function pickerAllowed(options) {
|
|
|
101212
101413
|
async function pickAgents(clients, deps) {
|
|
101213
101414
|
const products = [...new Set(clients.map((client) => client.client))];
|
|
101214
101415
|
if (products.length === 0) return clients;
|
|
101215
|
-
deps.log("This selects MCP access only. Session uploads follow your machine\u2019s capture settings.");
|
|
101216
101416
|
const selected = await deps.promptCheckboxes(
|
|
101217
|
-
"
|
|
101417
|
+
"What agents should be able to use Powerplant MCP?",
|
|
101218
101418
|
products.map((product) => ({
|
|
101219
101419
|
value: product,
|
|
101220
101420
|
label: AGENT_DISPLAY_NAMES[product]
|
|
101221
|
-
}))
|
|
101421
|
+
})),
|
|
101422
|
+
"This does not affect upload settings."
|
|
101222
101423
|
);
|
|
101223
101424
|
if (selected === null) return clients;
|
|
101224
101425
|
const kept = new Set(selected);
|
|
@@ -101238,14 +101439,13 @@ function realCheckboxPrompt(question, choices, seams = {}) {
|
|
|
101238
101439
|
let settled = false;
|
|
101239
101440
|
const wasRaw = input2.isRaw === true;
|
|
101240
101441
|
const render = () => [
|
|
101241
|
-
`${indent}? ${question}`,
|
|
101242
101442
|
...choices.map(
|
|
101243
101443
|
(choice, index) => `${indent}${index === active ? "\u276F" : " "} [${selected.has(choice.value) ? "x" : " "}] ${choice.label}`
|
|
101244
101444
|
),
|
|
101245
|
-
`${indent} \u2191/\u2193 move
|
|
101445
|
+
`${indent} \u2191/\u2193: move \xB7 space: toggle \xB7 enter: confirm`
|
|
101246
101446
|
].join("\n");
|
|
101247
101447
|
const redraw = () => {
|
|
101248
|
-
output2.write(`\r\x1B[${choices.length
|
|
101448
|
+
output2.write(`\r\x1B[${choices.length}A\x1B[J${render()}`);
|
|
101249
101449
|
};
|
|
101250
101450
|
return new Promise((resolve2) => {
|
|
101251
101451
|
const cleanup = () => {
|
|
@@ -101297,10 +101497,17 @@ function realCheckboxPrompt(question, choices, seams = {}) {
|
|
|
101297
101497
|
finish([]);
|
|
101298
101498
|
return;
|
|
101299
101499
|
}
|
|
101300
|
-
|
|
101500
|
+
emitKeypressEvents2(input2);
|
|
101301
101501
|
input2.on("keypress", onKeypress);
|
|
101302
101502
|
input2.once("end", onEnd);
|
|
101303
101503
|
if (input2.setRawMode) input2.setRawMode(true);
|
|
101504
|
+
output2.write(`${indent}${question}
|
|
101505
|
+
`);
|
|
101506
|
+
if (seams.description) {
|
|
101507
|
+
const description = terminalUsesEffects(output2.isTTY === true, process.env) ? dim(seams.description) : seams.description;
|
|
101508
|
+
output2.write(`${indent}${description}
|
|
101509
|
+
`);
|
|
101510
|
+
}
|
|
101304
101511
|
output2.write(render());
|
|
101305
101512
|
input2.resume();
|
|
101306
101513
|
});
|
|
@@ -101321,6 +101528,12 @@ async function connectClaude(client, name, deps) {
|
|
|
101321
101528
|
return failed(`probing for the Powerplant MCP failed, ${probe.detail}`);
|
|
101322
101529
|
}
|
|
101323
101530
|
const { missing, registeredUrl } = probe;
|
|
101531
|
+
if (!missing && (registeredUrl === void 0 || registeredUrl === deps.mcpUrl) && probe.signIn === "signed-in") {
|
|
101532
|
+
deps.log(`\u2713 ${name}: MCP already connected`);
|
|
101533
|
+
return { state: "connected", unchanged: true };
|
|
101534
|
+
}
|
|
101535
|
+
const skipped = await confirmConnection(name, deps, missing);
|
|
101536
|
+
if (skipped) return skipped;
|
|
101324
101537
|
if (missing || registeredUrl !== void 0 && registeredUrl !== deps.mcpUrl) {
|
|
101325
101538
|
if (!missing) {
|
|
101326
101539
|
deps.log(`${name} was registered against ${registeredUrl}, re-registering for ${deps.mcpUrl}.`);
|
|
@@ -101330,9 +101543,6 @@ async function connectClaude(client, name, deps) {
|
|
|
101330
101543
|
if (add.status !== 0) {
|
|
101331
101544
|
return failed(`registering the Powerplant MCP failed, ${describeFailure(add)}`);
|
|
101332
101545
|
}
|
|
101333
|
-
} else if (probe.signIn === "signed-in") {
|
|
101334
|
-
deps.log(`\u2713 ${name}: MCP already connected`);
|
|
101335
|
-
return { state: "connected", unchanged: true };
|
|
101336
101546
|
} else if (probe.signIn === "sign-in-needed" && deps.officialClients?.["claude-code"]) {
|
|
101337
101547
|
deps.run(bin, ["mcp", "remove", "--scope", "user", deps.serverName], env);
|
|
101338
101548
|
const add = deps.run(bin, claudeAddArgs(deps), env);
|
|
@@ -101525,6 +101735,10 @@ async function connectCodex(install, name, unscoped) {
|
|
|
101525
101735
|
const { missing, registeredUrl } = probe;
|
|
101526
101736
|
const wrongUrl = registeredUrl !== void 0 && registeredUrl !== deps.mcpUrl;
|
|
101527
101737
|
const alreadyConnected = !missing && !wrongUrl && probe.signIn === "signed-in";
|
|
101738
|
+
if (!alreadyConnected) {
|
|
101739
|
+
const skipped = await confirmConnection(name, deps, missing);
|
|
101740
|
+
if (skipped) return skipped;
|
|
101741
|
+
}
|
|
101528
101742
|
if (missing || wrongUrl) {
|
|
101529
101743
|
if (wrongUrl) deps.log(`${name} was registered against ${registeredUrl}, re-registering for ${deps.mcpUrl}.`);
|
|
101530
101744
|
if (codexAddLogsIn(bin, deps)) {
|
|
@@ -101578,8 +101792,9 @@ function ensureCodexOfficialClient(name, deps) {
|
|
|
101578
101792
|
}
|
|
101579
101793
|
async function connectCursor(mcpJsonPath, name, deps) {
|
|
101580
101794
|
const official = deps.officialClients?.cursor;
|
|
101795
|
+
const existing = deps.readTextFile(mcpJsonPath);
|
|
101581
101796
|
const patch = patchCursorMcpJson(
|
|
101582
|
-
|
|
101797
|
+
existing,
|
|
101583
101798
|
deps.serverName,
|
|
101584
101799
|
deps.mcpUrl,
|
|
101585
101800
|
official?.clientId ?? null
|
|
@@ -101589,8 +101804,9 @@ async function connectCursor(mcpJsonPath, name, deps) {
|
|
|
101589
101804
|
`${mcpJsonPath.replace(os28.homedir(), "~")} is ${patch.error}, fix it by hand, then re-run ${deps.connectCommand}.`
|
|
101590
101805
|
);
|
|
101591
101806
|
}
|
|
101807
|
+
const skipped = await confirmConnection(name, deps, !unpatchCursorMcpJson(existing, deps.serverName).changed, "open Cursor");
|
|
101808
|
+
if (skipped) return skipped;
|
|
101592
101809
|
if (patch.changed) deps.writeTextFile(mcpJsonPath, patch.content);
|
|
101593
|
-
await deps.pressEnter?.("open Cursor");
|
|
101594
101810
|
if (deps.openUrl(cursorInstallDeeplink(deps.serverName, patch.entry))) {
|
|
101595
101811
|
deps.log(`\u2192 ${name}: approve inside Cursor when it asks`);
|
|
101596
101812
|
return { state: "configured", unchanged: !patch.changed };
|
|
@@ -101601,8 +101817,7 @@ async function connectCursor(mcpJsonPath, name, deps) {
|
|
|
101601
101817
|
return { state: "pending", unchanged: false };
|
|
101602
101818
|
}
|
|
101603
101819
|
async function login(bin, name, args, deps, env) {
|
|
101604
|
-
if (deps.pressEnter)
|
|
101605
|
-
else deps.log(`\u2192 ${name}: approve in your browser\u2026`);
|
|
101820
|
+
if (!deps.pressEnter) deps.log(`\u2192 ${name}: approve in your browser\u2026`);
|
|
101606
101821
|
const status = deps.runInteractive(bin, args, env);
|
|
101607
101822
|
if (status === 0) {
|
|
101608
101823
|
deps.log(`\u2713 ${name}: MCP connected`);
|
|
@@ -103105,7 +103320,7 @@ function runResumeSession(source, sessionId, deps = {}) {
|
|
|
103105
103320
|
}
|
|
103106
103321
|
|
|
103107
103322
|
// src/version.ts
|
|
103108
|
-
var CLI_VERSION = true ? "0.4.
|
|
103323
|
+
var CLI_VERSION = true ? "0.4.35" : "0.0.0-checkout";
|
|
103109
103324
|
var CLI_RELEASE_BUILD = true ? true : false;
|
|
103110
103325
|
var CLI_DEVELOPMENT_COPY = false;
|
|
103111
103326
|
function updateRefusal(tarball, developmentCopy = CLI_DEVELOPMENT_COPY) {
|
|
@@ -103378,152 +103593,6 @@ function fetchVersionFacts(appEnv, credentials, packageName, fetchImpl = fetch,
|
|
|
103378
103593
|
return Promise.all([latest2, policy.then((found) => found?.oldestSupportedVersion ?? null)]);
|
|
103379
103594
|
}
|
|
103380
103595
|
|
|
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
103596
|
// src/installProgress.ts
|
|
103528
103597
|
function installProgress(writer, update) {
|
|
103529
103598
|
const show = () => update ? () => {
|
|
@@ -104383,7 +104452,7 @@ ${USAGE}`);
|
|
|
104383
104452
|
// already chose, and --yes or non-TTY runs must never wait on a prompt.
|
|
104384
104453
|
pick: pickerOn && clientFilter === void 0 ? (offered) => pickAgents(offered, {
|
|
104385
104454
|
log: log3,
|
|
104386
|
-
promptCheckboxes: (question, choices) => realCheckboxPrompt(question, choices, { indent: output2.indent }),
|
|
104455
|
+
promptCheckboxes: (question, choices, description) => realCheckboxPrompt(question, choices, { indent: output2.indent, description }),
|
|
104387
104456
|
onChoice: (selected) => recordMcpChoices(
|
|
104388
104457
|
config2.appEnv,
|
|
104389
104458
|
offered.map((client) => client.client),
|
|
@@ -104408,7 +104477,8 @@ ${USAGE}`);
|
|
|
104408
104477
|
url2,
|
|
104409
104478
|
(reason) => log3(`! Cursor: could not open Cursor (${reason}), enable the ${mcpServerNameFor(config2.appEnv)} server in Cursor's MCP settings and sign in`)
|
|
104410
104479
|
),
|
|
104411
|
-
pressEnter: pickerOn ? (action) =>
|
|
104480
|
+
pressEnter: pickerOn ? (action) => promptMcpSetup(output2.pressEnterPrompt(action)) : null,
|
|
104481
|
+
onSkipped: (client) => recordMcpChoices(config2.appEnv, [client], []),
|
|
104412
104482
|
codexConfigPath: codexConfigPath({}),
|
|
104413
104483
|
verifySignature: verifyBundleSignatureSync
|
|
104414
104484
|
}),
|
|
@@ -105158,4 +105228,4 @@ undici/lib/web/websocket/frame.js:
|
|
|
105158
105228
|
(*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> *)
|
|
105159
105229
|
*/
|
|
105160
105230
|
|
|
105161
|
-
//# debugId=
|
|
105231
|
+
//# debugId=79afb1aa-8532-5f74-8d71-d00555a824ee
|
|
Binary file
|