pantheon-cli 0.1.0 → 0.1.1

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/pantheon.mjs +121 -71
  2. package/package.json +1 -1
package/dist/pantheon.mjs CHANGED
@@ -5436,7 +5436,7 @@ var require_contains = __commonJS({
5436
5436
  const count = gen.let("count", 0);
5437
5437
  validateItems(schValid, () => gen.if(schValid, () => checkLimits(count)));
5438
5438
  }
5439
- function validateItems(_valid, block) {
5439
+ function validateItems(_valid, block2) {
5440
5440
  gen.forRange("i", 0, len, (i) => {
5441
5441
  cxt.subschema({
5442
5442
  keyword: "contains",
@@ -5444,7 +5444,7 @@ var require_contains = __commonJS({
5444
5444
  dataPropType: util_1.Type.Num,
5445
5445
  compositeRule: true
5446
5446
  }, _valid);
5447
- block();
5447
+ block2();
5448
5448
  });
5449
5449
  }
5450
5450
  function checkLimits(count) {
@@ -12806,10 +12806,10 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
12806
12806
  const shape = def.shape;
12807
12807
  const propValues = {};
12808
12808
  for (const key in shape) {
12809
- const field = shape[key]._zod;
12810
- if (field.values) {
12809
+ const field2 = shape[key]._zod;
12810
+ if (field2.values) {
12811
12811
  propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
12812
- for (const v of field.values)
12812
+ for (const v of field2.values)
12813
12813
  propValues[key].add(v);
12814
12814
  }
12815
12815
  }
@@ -20623,11 +20623,11 @@ var McpServer = class {
20623
20623
  return EMPTY_COMPLETION_RESULT;
20624
20624
  }
20625
20625
  const promptShape = getObjectShape(prompt.argsSchema);
20626
- const field = promptShape?.[request.params.argument.name];
20627
- if (!isCompletable(field)) {
20626
+ const field2 = promptShape?.[request.params.argument.name];
20627
+ if (!isCompletable(field2)) {
20628
20628
  return EMPTY_COMPLETION_RESULT;
20629
20629
  }
20630
- const completer = getCompleter(field);
20630
+ const completer = getCompleter(field2);
20631
20631
  if (!completer) {
20632
20632
  return EMPTY_COMPLETION_RESULT;
20633
20633
  }
@@ -20900,8 +20900,8 @@ var McpServer = class {
20900
20900
  };
20901
20901
  this._registeredPrompts[name] = registeredPrompt;
20902
20902
  if (argsSchema) {
20903
- const hasCompletable = Object.values(argsSchema).some((field) => {
20904
- const inner = field instanceof ZodOptional ? field._def?.innerType : field;
20903
+ const hasCompletable = Object.values(argsSchema).some((field2) => {
20904
+ const inner = field2 instanceof ZodOptional ? field2._def?.innerType : field2;
20905
20905
  return isCompletable(inner);
20906
20906
  });
20907
20907
  if (hasCompletable) {
@@ -21110,9 +21110,9 @@ function promptArgumentsFromSchema(schema) {
21110
21110
  const shape = getObjectShape(schema);
21111
21111
  if (!shape)
21112
21112
  return [];
21113
- return Object.entries(shape).map(([name, field]) => {
21114
- const description = getSchemaDescription(field);
21115
- const isOptional = isSchemaOptional(field);
21113
+ return Object.entries(shape).map(([name, field2]) => {
21114
+ const description = getSchemaDescription(field2);
21115
+ const isOptional = isSchemaOptional(field2);
21116
21116
  return {
21117
21117
  name,
21118
21118
  description,
@@ -21656,12 +21656,12 @@ function parseTurns(transcript) {
21656
21656
  toolCalls: turn.toolCalls
21657
21657
  }));
21658
21658
  }
21659
- return transcript.split(/\n{2,}/).map((block, index) => {
21660
- const match = block.match(/^(user|assistant|system)\s*:\s*([\s\S]+)/i);
21659
+ return transcript.split(/\n{2,}/).map((block2, index) => {
21660
+ const match = block2.match(/^(user|assistant|system)\s*:\s*([\s\S]+)/i);
21661
21661
  return {
21662
21662
  id: index + 1,
21663
21663
  role: match?.[1]?.toLowerCase() || "user",
21664
- text: (match?.[2] || block).trim(),
21664
+ text: (match?.[2] || block2).trim(),
21665
21665
  ts: nowIso()
21666
21666
  };
21667
21667
  }).filter((turn) => turn.text);
@@ -22796,7 +22796,7 @@ function upsertCodex(home) {
22796
22796
  mkdirSync4(dirname2(path), { recursive: true });
22797
22797
  const server = mcpServer(home);
22798
22798
  const args = server.args.map(tomlString).join(", ");
22799
- const block = [
22799
+ const block2 = [
22800
22800
  "[mcp_servers.pantheon]",
22801
22801
  `command = ${tomlString(String(server.command))}`,
22802
22802
  `args = [${args}]`,
@@ -22807,14 +22807,14 @@ function upsertCodex(home) {
22807
22807
  ""
22808
22808
  ].join("\n");
22809
22809
  if (!existsSync5(path)) {
22810
- writeFileSync4(path, block);
22810
+ writeFileSync4(path, block2);
22811
22811
  return;
22812
22812
  }
22813
22813
  const existing = readFileSync4(path, "utf8");
22814
22814
  if (existing.includes("[mcp_servers.pantheon]")) {
22815
22815
  const next = existing.replace(
22816
22816
  /\[mcp_servers\.pantheon\][\s\S]*?(?=\n\[(?!mcp_servers\.pantheon)|\s*$)/,
22817
- block.trim()
22817
+ block2.trim()
22818
22818
  );
22819
22819
  writeFileSync4(path, next.endsWith("\n") ? next : `${next}
22820
22820
  `);
@@ -22822,7 +22822,7 @@ function upsertCodex(home) {
22822
22822
  }
22823
22823
  writeFileSync4(path, `${existing.trimEnd()}
22824
22824
 
22825
- ${block}`);
22825
+ ${block2}`);
22826
22826
  }
22827
22827
  var spaceGate = 'A space is the short name the human chose for a conscience (preorders, auth-refactor). The argument is: $ARGUMENTS\n\nIf that value is missing, empty, still says $ARGUMENTS, contains spaces, or is not a single short name, do not call any tool. Ask: "What should this conscience be named?" and wait. Never invent a name.';
22828
22828
  var slashCommands = [
@@ -22915,43 +22915,55 @@ function installAgentAssets() {
22915
22915
  writeSlashCommands();
22916
22916
  writeCodexSkill();
22917
22917
  }
22918
+ function tilde(path) {
22919
+ const home = homedir5();
22920
+ return path.startsWith(home) ? `~${path.slice(home.length)}` : path;
22921
+ }
22918
22922
  function installMcpClients(home) {
22919
22923
  const written = [];
22920
22924
  const skipped = [];
22921
22925
  const server = mcpServer(home);
22922
- mergeMcpJson(join5(homedir5(), ".cursor", "mcp.json"), home, server);
22923
- written.push("Cursor");
22924
- mergeMcpJson(join5(homedir5(), ".claude.json"), home, mcpServer(home, true));
22925
- written.push("Claude Code");
22926
+ const cursor = join5(homedir5(), ".cursor", "mcp.json");
22927
+ mergeMcpJson(cursor, home, server);
22928
+ written.push({ name: "Cursor", detail: tilde(cursor) });
22929
+ const claudeCode = join5(homedir5(), ".claude.json");
22930
+ mergeMcpJson(claudeCode, home, mcpServer(home, true));
22931
+ written.push({ name: "Claude Code", detail: tilde(claudeCode) });
22926
22932
  const desktop = claudeDesktopPath();
22927
22933
  if (existsSync5(dirname2(desktop)) || process.platform === "darwin" || process.platform === "win32") {
22928
22934
  mergeMcpJson(desktop, home, server);
22929
- written.push("Claude Desktop");
22935
+ written.push({ name: "Claude Desktop", detail: tilde(desktop) });
22930
22936
  } else {
22931
- skipped.push("Claude Desktop (app not found)");
22937
+ skipped.push({ name: "Claude Desktop", detail: "app not found" });
22932
22938
  }
22933
22939
  const chatgpt = chatgptDesktopPath();
22934
22940
  if (chatgpt && existsSync5(dirname2(chatgpt))) {
22935
22941
  mergeMcpJson(chatgpt, home, server);
22936
- written.push("ChatGPT.app (shared MCP file)");
22942
+ written.push({ name: "ChatGPT.app", detail: tilde(chatgpt) });
22937
22943
  }
22944
+ const codex = join5(homedir5(), ".codex", "config.toml");
22938
22945
  try {
22939
22946
  upsertCodex(home);
22940
- written.push(process.platform === "darwin" ? "ChatGPT.app / Codex" : "Codex");
22947
+ written.push({ name: "Codex", detail: tilde(codex) });
22941
22948
  } catch {
22942
- skipped.push(process.platform === "darwin" ? "ChatGPT.app / Codex" : "Codex");
22949
+ skipped.push({ name: "Codex", detail: `could not write ${tilde(codex)}` });
22943
22950
  }
22944
- skipped.push("ChatGPT Classic (no local MCP \u2014 use ChatGPT.app Chat or Codex)");
22945
- skipped.push("Replit Desktop (add the HTTPS MCP URL from Settings \u2192 Replit Desktop)");
22946
22951
  const windsurf = join5(homedir5(), ".codeium", "windsurf", "mcp_config.json");
22947
22952
  if (existsSync5(dirname2(windsurf))) {
22948
22953
  mergeMcpJson(windsurf, home, server);
22949
- written.push("Windsurf");
22954
+ written.push({ name: "Windsurf", detail: tilde(windsurf) });
22955
+ } else {
22956
+ skipped.push({ name: "Windsurf", detail: "app not found" });
22950
22957
  }
22951
22958
  writeSlashCommands();
22952
22959
  writeCodexSkill();
22953
- written.push("/pantheon-* commands");
22954
- written.push("ChatGPT / Codex skill");
22960
+ written.push({ name: "/pantheon-* commands", detail: "~/.cursor, ~/.claude" });
22961
+ written.push({ name: "Agent skill", detail: "~/.agents, ~/.codex" });
22962
+ skipped.push({ name: "ChatGPT Classic", detail: "no local MCP \u2014 use ChatGPT.app or Codex" });
22963
+ skipped.push({
22964
+ name: "Replit Desktop",
22965
+ detail: "add the HTTPS URL from Settings \u2192 Connect an agent"
22966
+ });
22955
22967
  return { written, skipped };
22956
22968
  }
22957
22969
  function removeServerFromJson(path, key = "mcpServers") {
@@ -23026,6 +23038,28 @@ function installMcpFromConfig() {
23026
23038
  return installMcpClients(stored.config.home);
23027
23039
  }
23028
23040
 
23041
+ // src/report.ts
23042
+ var LABEL = 12;
23043
+ var NAME = 22;
23044
+ function field(label, value) {
23045
+ return ` ${label.padEnd(LABEL)}${value}`;
23046
+ }
23047
+ function block(title, entries) {
23048
+ if (!entries.length) return "";
23049
+ const lines = [` ${title}`];
23050
+ for (const entry of entries) {
23051
+ lines.push(
23052
+ entry.detail ? ` ${entry.name.padEnd(NAME)}${entry.detail}` : ` ${entry.name}`
23053
+ );
23054
+ }
23055
+ return lines.join("\n");
23056
+ }
23057
+ function report(...sections) {
23058
+ return `
23059
+ ${sections.filter(Boolean).join("\n\n")}
23060
+ `;
23061
+ }
23062
+
23029
23063
  // src/connect.ts
23030
23064
  var PRODUCTION_API_URL = "https://pantheon-ui-web.vercel.app";
23031
23065
  function candidateHosts(explicit) {
@@ -23073,36 +23107,44 @@ async function connect(opts) {
23073
23107
  );
23074
23108
  mkdirSync5(home, { recursive: true });
23075
23109
  const helper = credentialHelperCommand();
23076
- if (!existsSync6(join6(home, ".git"))) {
23077
- process.stdout.write(" Cloning\u2026\n");
23078
- execFileSync2("git", ["-c", `credential.helper=${helper}`, "clone", body.cloneUrl, home], {
23079
- stdio: "inherit"
23080
- });
23110
+ const quiet = { stdio: ["ignore", "pipe", "pipe"] };
23111
+ const fresh = !existsSync6(join6(home, ".git"));
23112
+ if (fresh) {
23113
+ process.stdout.write(" Cloning the vault\u2026\n");
23114
+ execFileSync2("git", ["-c", `credential.helper=${helper}`, "clone", body.cloneUrl, home], quiet);
23081
23115
  } else {
23082
- execFileSync2("git", ["-c", `credential.helper=${helper}`, "-C", home, "pull", "--ff-only"], {
23083
- stdio: "inherit"
23084
- });
23116
+ execFileSync2(
23117
+ "git",
23118
+ ["-c", `credential.helper=${helper}`, "-C", home, "pull", "--ff-only"],
23119
+ quiet
23120
+ );
23085
23121
  }
23086
- execFileSync2("git", ["-C", home, "config", "credential.helper", helper]);
23087
- execFileSync2("git", ["-C", home, "config", "user.name", "Pantheon"]);
23088
- execFileSync2("git", ["-C", home, "config", "user.email", "pantheon@users.noreply.github.com"]);
23089
- let mcpNote = "MCP config failed";
23122
+ execFileSync2("git", ["-C", home, "config", "credential.helper", helper], quiet);
23123
+ execFileSync2("git", ["-C", home, "config", "user.name", "Pantheon"], quiet);
23124
+ execFileSync2("git", ["-C", home, "config", "user.email", "pantheon@users.noreply.github.com"], quiet);
23125
+ let written = [];
23126
+ let skipped = [];
23127
+ let failure = "";
23090
23128
  try {
23091
23129
  const result = installMcpClients(home);
23092
- mcpNote = result.written.join(", ");
23093
- if (result.skipped.length) mcpNote += ` \xB7 skipped ${result.skipped.join(", ")}`;
23130
+ written = result.written;
23131
+ skipped = result.skipped;
23094
23132
  } catch (error2) {
23095
- mcpNote = error2 instanceof Error ? error2.message : String(error2);
23096
- }
23097
- console.log(`
23098
- Connected ${body.account}
23099
- Install ${body.installationId}
23100
- Repo ${body.repo} (private)
23101
- Home ${home}
23102
- MCP ${mcpNote}
23103
-
23104
- Reload MCP in each app, then type /pantheon-handoff <space>
23105
- `);
23133
+ failure = error2 instanceof Error ? error2.message : String(error2);
23134
+ }
23135
+ console.log(
23136
+ report(
23137
+ [
23138
+ field("Connected", body.account),
23139
+ field("Install", String(body.installationId)),
23140
+ field("Repo", `${body.repo} (private)`),
23141
+ field("Vault", `${home}${fresh ? " (cloned)" : " (updated)"}`)
23142
+ ].join("\n"),
23143
+ failure ? field("MCP", `failed \u2014 ${failure}`) : block("Configured", written),
23144
+ block("Skipped", skipped),
23145
+ " Reload MCP in each app, then type /pantheon-handoff <space>"
23146
+ )
23147
+ );
23106
23148
  }
23107
23149
  function credentialHelperCommand() {
23108
23150
  return "!pantheon git-credential";
@@ -23265,18 +23307,22 @@ import { existsSync as existsSync7 } from "node:fs";
23265
23307
  function printStatus() {
23266
23308
  const stored = loadMachineConfig();
23267
23309
  if (!stored) {
23268
- console.log(" Not connected. Open the web app and paste the install command.");
23310
+ console.log("\n Not connected. Open the web app and paste the install command.\n");
23269
23311
  return;
23270
23312
  }
23271
23313
  const { config: config2 } = stored;
23272
- console.log(`
23273
- GitHub ${config2.account}
23274
- Install ${config2.installationId}
23275
- Repo ${config2.repo} (private)
23276
- Home ${config2.home}${existsSync7(config2.home) ? "" : " (missing)"}
23277
- API ${config2.apiUrl}
23278
- Machine ${config2.machineId}
23279
- `);
23314
+ console.log(
23315
+ report(
23316
+ [
23317
+ field("GitHub", config2.account),
23318
+ field("Install", String(config2.installationId)),
23319
+ field("Repo", `${config2.repo} (private)`),
23320
+ field("Vault", `${config2.home}${existsSync7(config2.home) ? "" : " (missing)"}`),
23321
+ field("API", config2.apiUrl),
23322
+ field("Machine", config2.machineId)
23323
+ ].join("\n")
23324
+ )
23325
+ );
23280
23326
  }
23281
23327
 
23282
23328
  // src/sync.ts
@@ -23361,9 +23407,13 @@ async function main() {
23361
23407
  }
23362
23408
  if (cmd === "mcp-install") {
23363
23409
  const result = installMcpFromConfig();
23364
- console.log(` MCP ${result.written.join(", ")}`);
23365
- if (result.skipped.length) console.log(` Skipped ${result.skipped.join(", ")}`);
23366
- console.log("\n Reload MCP in each app, then type /pantheon-handoff <space>\n");
23410
+ console.log(
23411
+ report(
23412
+ block("Configured", result.written),
23413
+ block("Skipped", result.skipped),
23414
+ " Reload MCP in each app, then type /pantheon-handoff <space>"
23415
+ )
23416
+ );
23367
23417
  return;
23368
23418
  }
23369
23419
  if (cmd === "mcp-uninstall") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pantheon-cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Carry agent conscience between AI coding agents. Hand off a conversation in one agent, resume it in another.",
5
5
  "license": "MIT",
6
6
  "type": "module",