pantheon-cli 0.2.14 → 0.2.17
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/pantheon.mjs +250 -61
- package/package.json +1 -1
package/dist/pantheon.mjs
CHANGED
|
@@ -21272,6 +21272,7 @@ import {
|
|
|
21272
21272
|
writeFileSync as writeFileSync2,
|
|
21273
21273
|
appendFileSync
|
|
21274
21274
|
} from "node:fs";
|
|
21275
|
+
import { execFileSync } from "node:child_process";
|
|
21275
21276
|
import { homedir as homedir2 } from "node:os";
|
|
21276
21277
|
import { basename as basename2, isAbsolute, join as join3, relative, resolve } from "node:path";
|
|
21277
21278
|
|
|
@@ -22231,6 +22232,23 @@ function readArtifactFile(path, base) {
|
|
|
22231
22232
|
bytes: stat.size
|
|
22232
22233
|
};
|
|
22233
22234
|
}
|
|
22235
|
+
function trackedFiles(base) {
|
|
22236
|
+
try {
|
|
22237
|
+
const out = execFileSync("git", ["-C", base, "ls-files", "-z"], {
|
|
22238
|
+
encoding: "utf8",
|
|
22239
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
22240
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
22241
|
+
});
|
|
22242
|
+
return new Set(
|
|
22243
|
+
out.split("\0").filter(Boolean).map((relative2) => slash(join3(base, relative2)))
|
|
22244
|
+
);
|
|
22245
|
+
} catch {
|
|
22246
|
+
return null;
|
|
22247
|
+
}
|
|
22248
|
+
}
|
|
22249
|
+
function budgetReason(tracked, limit) {
|
|
22250
|
+
return tracked ? `already tracked by git, so the ${limit} went to files that are not` : `over the ${limit}`;
|
|
22251
|
+
}
|
|
22234
22252
|
function collectWrittenArtifacts(turns, cwd = process.cwd(), opts = {}) {
|
|
22235
22253
|
const base = slash(resolve(cwd));
|
|
22236
22254
|
const since = opts.since ?? null;
|
|
@@ -22260,11 +22278,13 @@ function collectWrittenArtifacts(turns, cwd = process.cwd(), opts = {}) {
|
|
|
22260
22278
|
}
|
|
22261
22279
|
const found = [];
|
|
22262
22280
|
const skipped = [];
|
|
22281
|
+
let skippedTotal = 0;
|
|
22263
22282
|
let total = 0;
|
|
22264
22283
|
const note = (path, reason) => {
|
|
22284
|
+
skippedTotal += 1;
|
|
22265
22285
|
if (skipped.length < MAX_SKIP_REPORT) skipped.push({ name: flatName(path, base), reason });
|
|
22266
22286
|
};
|
|
22267
|
-
const store = (path, gate) => {
|
|
22287
|
+
const store = (path, gate, tracked2) => {
|
|
22268
22288
|
if (!existsSync3(path)) return;
|
|
22269
22289
|
const stat = statSync2(path);
|
|
22270
22290
|
if (!stat.isFile() || stat.size === 0) return;
|
|
@@ -22276,8 +22296,15 @@ function collectWrittenArtifacts(turns, cwd = process.cwd(), opts = {}) {
|
|
|
22276
22296
|
);
|
|
22277
22297
|
return;
|
|
22278
22298
|
}
|
|
22279
|
-
if (found.length >= MAX_WRITTEN_COUNT
|
|
22280
|
-
note(path,
|
|
22299
|
+
if (found.length >= MAX_WRITTEN_COUNT) {
|
|
22300
|
+
note(path, budgetReason(tracked2, `${MAX_WRITTEN_COUNT}-file limit for one handoff`));
|
|
22301
|
+
return;
|
|
22302
|
+
}
|
|
22303
|
+
if (total + stat.size > MAX_WRITTEN_TOTAL) {
|
|
22304
|
+
note(
|
|
22305
|
+
path,
|
|
22306
|
+
budgetReason(tracked2, `${MAX_WRITTEN_TOTAL / 1024 / 1024}MB total limit for one handoff`)
|
|
22307
|
+
);
|
|
22281
22308
|
return;
|
|
22282
22309
|
}
|
|
22283
22310
|
const file = readArtifactFile(path, base);
|
|
@@ -22285,20 +22312,19 @@ function collectWrittenArtifacts(turns, cwd = process.cwd(), opts = {}) {
|
|
|
22285
22312
|
total += file.bytes;
|
|
22286
22313
|
found.push({ name: file.name, content: file.content, encoding: file.encoding });
|
|
22287
22314
|
};
|
|
22288
|
-
|
|
22289
|
-
|
|
22290
|
-
|
|
22291
|
-
|
|
22292
|
-
|
|
22293
|
-
|
|
22294
|
-
for (const
|
|
22295
|
-
if (written.has(path)) continue;
|
|
22315
|
+
const tracked = trackedFiles(base);
|
|
22316
|
+
const queue = [
|
|
22317
|
+
...[...written].map((path) => ({ path, gate: false })),
|
|
22318
|
+
...[...touched].filter((path) => !written.has(path)).map((path) => ({ path, gate: true }))
|
|
22319
|
+
].map((item) => ({ ...item, tracked: tracked?.has(item.path) ?? false }));
|
|
22320
|
+
queue.sort((a, b) => Number(a.tracked) - Number(b.tracked));
|
|
22321
|
+
for (const item of queue) {
|
|
22296
22322
|
try {
|
|
22297
|
-
store(path,
|
|
22323
|
+
store(item.path, item.gate, item.tracked);
|
|
22298
22324
|
} catch {
|
|
22299
22325
|
}
|
|
22300
22326
|
}
|
|
22301
|
-
return { artifacts: found, skipped };
|
|
22327
|
+
return { artifacts: found, skipped, skippedTotal };
|
|
22302
22328
|
}
|
|
22303
22329
|
function collectAttachedArtifacts(turns, cwd = process.cwd()) {
|
|
22304
22330
|
const base = slash(resolve(cwd));
|
|
@@ -22641,6 +22667,9 @@ function writeHandoff(home, input) {
|
|
|
22641
22667
|
// Files this session made that the archive would not take. Silence here is
|
|
22642
22668
|
// how a handoff comes to promise more than it holds.
|
|
22643
22669
|
skipped: sweep?.skipped ?? [],
|
|
22670
|
+
// The list above is capped. Reporting its length as the total understates
|
|
22671
|
+
// the loss by however many it left out.
|
|
22672
|
+
skippedTotal: sweep?.skippedTotal ?? 0,
|
|
22644
22673
|
// Usually empty. Only a failure that recurred across separate conversations
|
|
22645
22674
|
// and is not already documented gets this far.
|
|
22646
22675
|
skillCandidates: spaceSkillCandidates(root, cwd),
|
|
@@ -23088,7 +23117,7 @@ function saveMachineConfig(config2, credentials) {
|
|
|
23088
23117
|
}
|
|
23089
23118
|
|
|
23090
23119
|
// ../core/src/vault.ts
|
|
23091
|
-
import { execFileSync } from "node:child_process";
|
|
23120
|
+
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
23092
23121
|
import { existsSync as existsSync5, mkdirSync as mkdirSync4, unlinkSync, writeFileSync as writeFileSync4 } from "node:fs";
|
|
23093
23122
|
import { homedir as homedir4, tmpdir } from "node:os";
|
|
23094
23123
|
import { dirname, join as join5 } from "node:path";
|
|
@@ -23108,7 +23137,7 @@ function gitEnv(extra = {}) {
|
|
|
23108
23137
|
};
|
|
23109
23138
|
}
|
|
23110
23139
|
function git(home, args, env) {
|
|
23111
|
-
return
|
|
23140
|
+
return execFileSync2("git", ["-C", home, ...args], {
|
|
23112
23141
|
encoding: "utf8",
|
|
23113
23142
|
stdio: ["ignore", "pipe", "pipe"],
|
|
23114
23143
|
env: gitEnv(env)
|
|
@@ -23214,7 +23243,7 @@ function ensureVaultClone(home, cloneUrl, token) {
|
|
|
23214
23243
|
try {
|
|
23215
23244
|
mkdirSync4(dirname(home), { recursive: true });
|
|
23216
23245
|
withGitAuth(token, (env) => {
|
|
23217
|
-
|
|
23246
|
+
execFileSync2("git", ["clone", "--depth", "50", cloneUrl, home], {
|
|
23218
23247
|
encoding: "utf8",
|
|
23219
23248
|
stdio: ["ignore", "pipe", "pipe"],
|
|
23220
23249
|
env: gitEnv({
|
|
@@ -23460,8 +23489,10 @@ ${GUIDE}` }]
|
|
|
23460
23489
|
// second conversation was open, this is where that shows.
|
|
23461
23490
|
written.lastMessage ? `Last human message in the captured chat: "${written.lastMessage}" \u2014 if that is not this conversation, re-run with sessionKey from pantheon_local_sessions.` : null,
|
|
23462
23491
|
// A file the session made and the archive would not take is
|
|
23463
|
-
// the one thing the human cannot see for themselves.
|
|
23464
|
-
|
|
23492
|
+
// the one thing the human cannot see for themselves. Say how
|
|
23493
|
+
// many there were as well as which ones, because the list is
|
|
23494
|
+
// capped and reporting its length as the total is a lie.
|
|
23495
|
+
written.skipped?.length ? `Not stored: ${written.skippedTotal} file${written.skippedTotal === 1 ? "" : "s"}${written.skippedTotal > written.skipped.length ? `, of which these ${written.skipped.length}` : ""} \u2014 ${written.skipped.map((file) => `${file.name} (${file.reason})`).join(", ")}. Report the total, not just the named ones, so the human knows what the space does not hold.` : null,
|
|
23465
23496
|
// Rare by design. Offer it, do not act on it: a skill nobody
|
|
23466
23497
|
// asked for is context every future agent pays for.
|
|
23467
23498
|
written.skillCandidates?.length ? `This space has hit the same problem in more than one conversation: ${written.skillCandidates.map((item) => `"${item.title}" (${item.sessions.length} sessions, key ${item.key})`).join("; ")}. Ask the human whether to write a skill for it. Only if they say yes, call pantheon_save_skill using the cited evidence \u2014 read the turns first with pantheon_get_turns rather than writing from memory. If they say no, call pantheon_dismiss_skill with that key so it stops being offered.` : null
|
|
@@ -23674,13 +23705,13 @@ async function startMcpServer(home = defaultHome()) {
|
|
|
23674
23705
|
import { hostname as hostname3 } from "node:os";
|
|
23675
23706
|
|
|
23676
23707
|
// src/connect.ts
|
|
23677
|
-
import { execFileSync as
|
|
23678
|
-
import { existsSync as existsSync7, mkdirSync as mkdirSync6, renameSync } from "node:fs";
|
|
23708
|
+
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
23709
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync6, renameSync as renameSync2 } from "node:fs";
|
|
23679
23710
|
import { hostname as hostname2 } from "node:os";
|
|
23680
23711
|
import { join as join7 } from "node:path";
|
|
23681
23712
|
|
|
23682
23713
|
// src/mcp-install.ts
|
|
23683
|
-
import { existsSync as existsSync6, mkdirSync as mkdirSync5, readFileSync as readFileSync5, unlinkSync as unlinkSync2, writeFileSync as writeFileSync5 } from "node:fs";
|
|
23714
|
+
import { existsSync as existsSync6, mkdirSync as mkdirSync5, readFileSync as readFileSync5, renameSync, unlinkSync as unlinkSync2, writeFileSync as writeFileSync5 } from "node:fs";
|
|
23684
23715
|
import { homedir as homedir5 } from "node:os";
|
|
23685
23716
|
import { dirname as dirname2, join as join6 } from "node:path";
|
|
23686
23717
|
import { fileURLToPath } from "node:url";
|
|
@@ -23709,17 +23740,109 @@ function mcpServer(home, withType = false) {
|
|
|
23709
23740
|
if (withType) server.type = "stdio";
|
|
23710
23741
|
return server;
|
|
23711
23742
|
}
|
|
23743
|
+
function stripComments(text2) {
|
|
23744
|
+
let out = "";
|
|
23745
|
+
let inString = false;
|
|
23746
|
+
let escaped = false;
|
|
23747
|
+
for (let i = 0; i < text2.length; i += 1) {
|
|
23748
|
+
const ch = text2[i];
|
|
23749
|
+
if (inString) {
|
|
23750
|
+
out += ch;
|
|
23751
|
+
if (escaped) escaped = false;
|
|
23752
|
+
else if (ch === "\\") escaped = true;
|
|
23753
|
+
else if (ch === '"') inString = false;
|
|
23754
|
+
continue;
|
|
23755
|
+
}
|
|
23756
|
+
if (ch === '"') {
|
|
23757
|
+
inString = true;
|
|
23758
|
+
out += ch;
|
|
23759
|
+
continue;
|
|
23760
|
+
}
|
|
23761
|
+
if (ch === "/" && text2[i + 1] === "/") {
|
|
23762
|
+
while (i < text2.length && text2[i] !== "\n") i += 1;
|
|
23763
|
+
out += "\n";
|
|
23764
|
+
continue;
|
|
23765
|
+
}
|
|
23766
|
+
if (ch === "/" && text2[i + 1] === "*") {
|
|
23767
|
+
i += 2;
|
|
23768
|
+
while (i < text2.length && !(text2[i] === "*" && text2[i + 1] === "/")) i += 1;
|
|
23769
|
+
i += 1;
|
|
23770
|
+
continue;
|
|
23771
|
+
}
|
|
23772
|
+
out += ch;
|
|
23773
|
+
}
|
|
23774
|
+
return out;
|
|
23775
|
+
}
|
|
23776
|
+
function stripTrailingCommas(text2) {
|
|
23777
|
+
const out = [];
|
|
23778
|
+
let inString = false;
|
|
23779
|
+
let escaped = false;
|
|
23780
|
+
let comma = -1;
|
|
23781
|
+
for (const ch of text2) {
|
|
23782
|
+
if (inString) {
|
|
23783
|
+
out.push(ch);
|
|
23784
|
+
if (escaped) escaped = false;
|
|
23785
|
+
else if (ch === "\\") escaped = true;
|
|
23786
|
+
else if (ch === '"') inString = false;
|
|
23787
|
+
continue;
|
|
23788
|
+
}
|
|
23789
|
+
if (ch === '"') {
|
|
23790
|
+
inString = true;
|
|
23791
|
+
comma = -1;
|
|
23792
|
+
out.push(ch);
|
|
23793
|
+
continue;
|
|
23794
|
+
}
|
|
23795
|
+
if (/\s/.test(ch)) {
|
|
23796
|
+
out.push(ch);
|
|
23797
|
+
continue;
|
|
23798
|
+
}
|
|
23799
|
+
if (ch === ",") {
|
|
23800
|
+
comma = out.length;
|
|
23801
|
+
out.push(ch);
|
|
23802
|
+
continue;
|
|
23803
|
+
}
|
|
23804
|
+
if ((ch === "}" || ch === "]") && comma >= 0) out[comma] = "";
|
|
23805
|
+
comma = -1;
|
|
23806
|
+
out.push(ch);
|
|
23807
|
+
}
|
|
23808
|
+
return out.join("");
|
|
23809
|
+
}
|
|
23810
|
+
function isPlainObject3(value) {
|
|
23811
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
23812
|
+
}
|
|
23712
23813
|
function readJson(path) {
|
|
23713
23814
|
if (!existsSync6(path)) return {};
|
|
23815
|
+
const text2 = readFileSync5(path, "utf8").replace(/^\uFEFF/, "");
|
|
23816
|
+
if (!text2.trim()) return {};
|
|
23817
|
+
let value;
|
|
23714
23818
|
try {
|
|
23715
|
-
|
|
23716
|
-
} catch {
|
|
23717
|
-
|
|
23819
|
+
value = JSON.parse(text2);
|
|
23820
|
+
} catch (strict) {
|
|
23821
|
+
try {
|
|
23822
|
+
value = JSON.parse(stripTrailingCommas(stripComments(text2)));
|
|
23823
|
+
} catch {
|
|
23824
|
+
const why = strict instanceof Error ? strict.message : String(strict);
|
|
23825
|
+
throw new Error(`${path} is not valid JSON \u2014 ${why}`);
|
|
23826
|
+
}
|
|
23827
|
+
}
|
|
23828
|
+
if (!isPlainObject3(value)) {
|
|
23829
|
+
throw new Error(`${path} is not valid JSON \u2014 the top level must be an object`);
|
|
23718
23830
|
}
|
|
23831
|
+
return value;
|
|
23719
23832
|
}
|
|
23720
|
-
function
|
|
23833
|
+
function writeAtomic(path, text2) {
|
|
23721
23834
|
mkdirSync5(dirname2(path), { recursive: true });
|
|
23722
|
-
|
|
23835
|
+
const temp = `${path}.pantheon-${process.pid}.tmp`;
|
|
23836
|
+
try {
|
|
23837
|
+
writeFileSync5(temp, text2);
|
|
23838
|
+
renameSync(temp, path);
|
|
23839
|
+
} catch (error2) {
|
|
23840
|
+
if (existsSync6(temp)) unlinkSync2(temp);
|
|
23841
|
+
throw error2;
|
|
23842
|
+
}
|
|
23843
|
+
}
|
|
23844
|
+
function writeJson(path, data) {
|
|
23845
|
+
writeAtomic(path, `${JSON.stringify(data, null, 2)}
|
|
23723
23846
|
`);
|
|
23724
23847
|
}
|
|
23725
23848
|
function mergeMcpJson(path, home, server, key = "mcpServers") {
|
|
@@ -23760,7 +23883,7 @@ function upsertCodex(home) {
|
|
|
23760
23883
|
""
|
|
23761
23884
|
].join("\n");
|
|
23762
23885
|
if (!existsSync6(path)) {
|
|
23763
|
-
|
|
23886
|
+
writeAtomic(path, block2);
|
|
23764
23887
|
return;
|
|
23765
23888
|
}
|
|
23766
23889
|
const existing = readFileSync5(path, "utf8");
|
|
@@ -23769,15 +23892,15 @@ function upsertCodex(home) {
|
|
|
23769
23892
|
/\[mcp_servers\.pantheon\][\s\S]*?(?=\n\[(?!mcp_servers\.pantheon)|\s*$)/,
|
|
23770
23893
|
block2.trim()
|
|
23771
23894
|
);
|
|
23772
|
-
|
|
23895
|
+
writeAtomic(path, next.endsWith("\n") ? next : `${next}
|
|
23773
23896
|
`);
|
|
23774
23897
|
return;
|
|
23775
23898
|
}
|
|
23776
|
-
|
|
23899
|
+
writeAtomic(path, `${existing.trimEnd()}
|
|
23777
23900
|
|
|
23778
23901
|
${block2}`);
|
|
23779
23902
|
}
|
|
23780
|
-
var spaceGate = 'A space is the short name the human chose for a conscience (preorders, auth-refactor). The argument is: $ARGUMENTS\n\nIf that
|
|
23903
|
+
var spaceGate = 'A space is the short name the human chose for a conscience (preorders, auth-refactor). The argument is: $ARGUMENTS\n\nIf that arrived blank, or as an unexpanded placeholder rather than a name, ask: "What should this conscience be named?" and wait. Never invent a name. Otherwise use it exactly as typed \u2014 any single short slug counts, including one that is not in the vault yet.';
|
|
23781
23904
|
var slashCommands = [
|
|
23782
23905
|
{
|
|
23783
23906
|
name: "pantheon-handoff",
|
|
@@ -23791,7 +23914,7 @@ Only after you have a real space name, call pantheon_handoff even if that name i
|
|
|
23791
23914
|
description: "Load a Pantheon conscience into this chat",
|
|
23792
23915
|
body: `A space is the short name the human chose for a conscience. The argument is: $ARGUMENTS
|
|
23793
23916
|
|
|
23794
|
-
Call pantheon_resume immediately
|
|
23917
|
+
Call pantheon_resume immediately, with that name exactly as typed. If it arrived blank or as an unexpanded placeholder, call pantheon_resume without a space \u2014 it lists live consciences. Show that list and ask which one they meant. Do not invent a name. Once they pick a slug, call pantheon_resume with that slug. It pulls the vault first. If the packet lists artifacts, fetch the ones you need with pantheon_get_artifact. Do not use any other resume tool. Do not run pantheon sync.`
|
|
23795
23918
|
},
|
|
23796
23919
|
{
|
|
23797
23920
|
name: "pantheon-park",
|
|
@@ -23913,39 +24036,94 @@ function tilde(path) {
|
|
|
23913
24036
|
const home = homedir5();
|
|
23914
24037
|
return path.startsWith(home) ? `~${path.slice(home.length)}` : path;
|
|
23915
24038
|
}
|
|
24039
|
+
function detectApps() {
|
|
24040
|
+
const home = homedir5();
|
|
24041
|
+
const mac = process.platform === "darwin";
|
|
24042
|
+
const win = process.platform === "win32";
|
|
24043
|
+
const local = process.env.LOCALAPPDATA || join6(home, "AppData", "Local");
|
|
24044
|
+
const roaming = process.env.APPDATA || join6(home, "AppData", "Roaming");
|
|
24045
|
+
const evidence = {
|
|
24046
|
+
Cursor: [
|
|
24047
|
+
join6(home, ".cursor", "extensions"),
|
|
24048
|
+
join6(home, ".cursor", "argv.json"),
|
|
24049
|
+
join6(home, ".cursor", "cli"),
|
|
24050
|
+
...mac ? ["/Applications/Cursor.app", join6(home, "Applications", "Cursor.app")] : [],
|
|
24051
|
+
...win ? [join6(local, "Programs", "cursor")] : []
|
|
24052
|
+
],
|
|
24053
|
+
"Claude Code": [
|
|
24054
|
+
join6(home, ".claude", "projects"),
|
|
24055
|
+
join6(home, ".claude", "settings.json"),
|
|
24056
|
+
join6(home, ".claude", "history.jsonl"),
|
|
24057
|
+
join6(home, ".claude", "statsig")
|
|
24058
|
+
],
|
|
24059
|
+
"Claude Desktop": [
|
|
24060
|
+
...mac ? ["/Applications/Claude.app", join6(home, "Applications", "Claude.app")] : [],
|
|
24061
|
+
...win ? [join6(local, "AnthropicClaude"), join6(roaming, "Claude", "window-state.json")] : [],
|
|
24062
|
+
...!mac && !win ? [join6(home, ".config", "Claude", "window-state.json")] : []
|
|
24063
|
+
],
|
|
24064
|
+
"ChatGPT.app": mac ? ["/Applications/ChatGPT.app", join6(home, "Applications", "ChatGPT.app")] : [],
|
|
24065
|
+
Codex: [
|
|
24066
|
+
join6(home, ".codex", "sessions"),
|
|
24067
|
+
join6(home, ".codex", "auth.json"),
|
|
24068
|
+
join6(home, ".codex", "history.jsonl"),
|
|
24069
|
+
join6(home, ".codex", "log")
|
|
24070
|
+
],
|
|
24071
|
+
Windsurf: [
|
|
24072
|
+
join6(home, ".codeium", "windsurf"),
|
|
24073
|
+
...mac ? ["/Applications/Windsurf.app", join6(home, "Applications", "Windsurf.app")] : []
|
|
24074
|
+
]
|
|
24075
|
+
};
|
|
24076
|
+
const found = /* @__PURE__ */ new Set();
|
|
24077
|
+
for (const [name, paths] of Object.entries(evidence)) {
|
|
24078
|
+
if (paths.some((path) => existsSync6(path))) found.add(name);
|
|
24079
|
+
}
|
|
24080
|
+
return found;
|
|
24081
|
+
}
|
|
24082
|
+
var AHEAD = "Written ahead \u2014 app not detected, ready if you install it";
|
|
24083
|
+
function nextSteps(found, apiUrl) {
|
|
24084
|
+
if (found.length) return " Reload MCP in each app, then type /pantheon-handoff <space>";
|
|
24085
|
+
return [
|
|
24086
|
+
" No desktop agent detected. The configs above are in place if you install one.",
|
|
24087
|
+
"",
|
|
24088
|
+
" Using Claude.ai or ChatGPT in a browser instead? Connect it from",
|
|
24089
|
+
` ${apiUrl}/app/settings/connect`
|
|
24090
|
+
].join("\n");
|
|
24091
|
+
}
|
|
23916
24092
|
function installMcpClients(home) {
|
|
23917
24093
|
const written = [];
|
|
24094
|
+
const ahead = [];
|
|
23918
24095
|
const skipped = [];
|
|
23919
24096
|
const server = mcpServer(home);
|
|
23920
|
-
const
|
|
23921
|
-
|
|
23922
|
-
|
|
23923
|
-
|
|
23924
|
-
|
|
23925
|
-
|
|
24097
|
+
const found = detectApps();
|
|
24098
|
+
const install = (name, path, entry) => {
|
|
24099
|
+
try {
|
|
24100
|
+
mergeMcpJson(path, home, entry);
|
|
24101
|
+
(found.has(name) ? written : ahead).push({ name, detail: tilde(path) });
|
|
24102
|
+
} catch (error2) {
|
|
24103
|
+
const why = error2 instanceof Error ? error2.message : String(error2);
|
|
24104
|
+
skipped.push({ name, detail: why.replace(homedir5(), "~") });
|
|
24105
|
+
}
|
|
24106
|
+
};
|
|
24107
|
+
install("Cursor", join6(homedir5(), ".cursor", "mcp.json"), server);
|
|
24108
|
+
install("Claude Code", join6(homedir5(), ".claude.json"), mcpServer(home, true));
|
|
23926
24109
|
const desktop = claudeDesktopPath();
|
|
23927
24110
|
if (existsSync6(dirname2(desktop)) || process.platform === "darwin" || process.platform === "win32") {
|
|
23928
|
-
|
|
23929
|
-
written.push({ name: "Claude Desktop", detail: tilde(desktop) });
|
|
24111
|
+
install("Claude Desktop", desktop, server);
|
|
23930
24112
|
} else {
|
|
23931
24113
|
skipped.push({ name: "Claude Desktop", detail: "app not found" });
|
|
23932
24114
|
}
|
|
23933
24115
|
const chatgpt = chatgptDesktopPath();
|
|
23934
|
-
if (chatgpt && existsSync6(dirname2(chatgpt)))
|
|
23935
|
-
mergeMcpJson(chatgpt, home, server);
|
|
23936
|
-
written.push({ name: "ChatGPT.app", detail: tilde(chatgpt) });
|
|
23937
|
-
}
|
|
24116
|
+
if (chatgpt && existsSync6(dirname2(chatgpt))) install("ChatGPT.app", chatgpt, server);
|
|
23938
24117
|
const codex = join6(homedir5(), ".codex", "config.toml");
|
|
23939
24118
|
try {
|
|
23940
24119
|
upsertCodex(home);
|
|
23941
|
-
written.push({ name: "Codex", detail: tilde(codex) });
|
|
24120
|
+
(found.has("Codex") ? written : ahead).push({ name: "Codex", detail: tilde(codex) });
|
|
23942
24121
|
} catch {
|
|
23943
24122
|
skipped.push({ name: "Codex", detail: `could not write ${tilde(codex)}` });
|
|
23944
24123
|
}
|
|
23945
24124
|
const windsurf = join6(homedir5(), ".codeium", "windsurf", "mcp_config.json");
|
|
23946
24125
|
if (existsSync6(dirname2(windsurf))) {
|
|
23947
|
-
|
|
23948
|
-
written.push({ name: "Windsurf", detail: tilde(windsurf) });
|
|
24126
|
+
install("Windsurf", windsurf, server);
|
|
23949
24127
|
} else {
|
|
23950
24128
|
skipped.push({ name: "Windsurf", detail: "app not found" });
|
|
23951
24129
|
}
|
|
@@ -23958,11 +24136,16 @@ function installMcpClients(home) {
|
|
|
23958
24136
|
name: "Replit Desktop",
|
|
23959
24137
|
detail: "add the HTTPS URL from Settings \u2192 Connect an agent"
|
|
23960
24138
|
});
|
|
23961
|
-
return { written, skipped };
|
|
24139
|
+
return { written, ahead, skipped, found: [...found] };
|
|
23962
24140
|
}
|
|
23963
24141
|
function removeServerFromJson(path, key = "mcpServers") {
|
|
23964
24142
|
if (!existsSync6(path)) return false;
|
|
23965
|
-
|
|
24143
|
+
let current;
|
|
24144
|
+
try {
|
|
24145
|
+
current = readJson(path);
|
|
24146
|
+
} catch {
|
|
24147
|
+
return false;
|
|
24148
|
+
}
|
|
23966
24149
|
const servers = current[key] ?? {};
|
|
23967
24150
|
if (!servers.pantheon) return false;
|
|
23968
24151
|
delete servers.pantheon;
|
|
@@ -23976,7 +24159,7 @@ function removeCodex() {
|
|
|
23976
24159
|
const existing = readFileSync5(path, "utf8");
|
|
23977
24160
|
if (!existing.includes("[mcp_servers.pantheon]")) return false;
|
|
23978
24161
|
const next = existing.replace(/\[mcp_servers\.pantheon\][\s\S]*?(?=\n\[(?!mcp_servers\.pantheon)|\s*$)/, "").replace(/\n{3,}/g, "\n\n").trimEnd();
|
|
23979
|
-
|
|
24162
|
+
writeAtomic(path, next ? `${next}
|
|
23980
24163
|
` : "");
|
|
23981
24164
|
return true;
|
|
23982
24165
|
}
|
|
@@ -24029,7 +24212,7 @@ function uninstallMcpClients() {
|
|
|
24029
24212
|
function installMcpFromConfig() {
|
|
24030
24213
|
const stored = loadMachineConfig();
|
|
24031
24214
|
if (!stored) throw new Error("Not connected. Run pantheon connect <code> first.");
|
|
24032
|
-
return installMcpClients(stored.config.home);
|
|
24215
|
+
return { ...installMcpClients(stored.config.home), apiUrl: stored.config.apiUrl };
|
|
24033
24216
|
}
|
|
24034
24217
|
|
|
24035
24218
|
// src/report.ts
|
|
@@ -24110,20 +24293,24 @@ async function connect(opts) {
|
|
|
24110
24293
|
let archived = "";
|
|
24111
24294
|
if (fresh) {
|
|
24112
24295
|
process.stdout.write(" Cloning the vault\u2026\n");
|
|
24113
|
-
|
|
24296
|
+
execFileSync3("git", ["-c", `credential.helper=${helper}`, "clone", body.cloneUrl, home], quiet);
|
|
24114
24297
|
} else {
|
|
24115
24298
|
archived = syncVault2(home, body.cloneUrl, helper, quiet);
|
|
24116
24299
|
}
|
|
24117
|
-
|
|
24118
|
-
|
|
24119
|
-
|
|
24300
|
+
execFileSync3("git", ["-C", home, "config", "credential.helper", helper], quiet);
|
|
24301
|
+
execFileSync3("git", ["-C", home, "config", "user.name", "Pantheon"], quiet);
|
|
24302
|
+
execFileSync3("git", ["-C", home, "config", "user.email", "pantheon@users.noreply.github.com"], quiet);
|
|
24120
24303
|
let written = [];
|
|
24304
|
+
let ahead = [];
|
|
24121
24305
|
let skipped = [];
|
|
24306
|
+
let found = [];
|
|
24122
24307
|
let failure = "";
|
|
24123
24308
|
try {
|
|
24124
24309
|
const result = installMcpClients(home);
|
|
24125
24310
|
written = result.written;
|
|
24311
|
+
ahead = result.ahead;
|
|
24126
24312
|
skipped = result.skipped;
|
|
24313
|
+
found = result.found;
|
|
24127
24314
|
} catch (error2) {
|
|
24128
24315
|
failure = error2 instanceof Error ? error2.message : String(error2);
|
|
24129
24316
|
}
|
|
@@ -24137,13 +24324,14 @@ async function connect(opts) {
|
|
|
24137
24324
|
...archived ? [field("Set aside", `${archived} \u2014 spaces from the old repo`)] : []
|
|
24138
24325
|
].join("\n"),
|
|
24139
24326
|
failure ? field("MCP", `failed \u2014 ${failure}`) : block("Configured", written),
|
|
24327
|
+
block(AHEAD, ahead),
|
|
24140
24328
|
block("Skipped", skipped),
|
|
24141
|
-
|
|
24329
|
+
nextSteps(found, body.apiUrl)
|
|
24142
24330
|
)
|
|
24143
24331
|
);
|
|
24144
24332
|
}
|
|
24145
24333
|
function syncVault2(home, cloneUrl, helper, quiet) {
|
|
24146
|
-
const git2 = (...args) =>
|
|
24334
|
+
const git2 = (...args) => execFileSync3("git", ["-c", `credential.helper=${helper}`, "-C", home, ...args], quiet);
|
|
24147
24335
|
try {
|
|
24148
24336
|
git2("pull", "--ff-only");
|
|
24149
24337
|
return "";
|
|
@@ -24158,17 +24346,17 @@ function syncVault2(home, cloneUrl, helper, quiet) {
|
|
|
24158
24346
|
const stamp2 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, 19);
|
|
24159
24347
|
const archive = `${home}-${stamp2}`;
|
|
24160
24348
|
process.stdout.write(" Vault belongs to a deleted repo; setting it aside\u2026\n");
|
|
24161
|
-
|
|
24162
|
-
|
|
24349
|
+
renameSync2(home, archive);
|
|
24350
|
+
execFileSync3("git", ["-c", `credential.helper=${helper}`, "clone", cloneUrl, home], quiet);
|
|
24163
24351
|
return archive;
|
|
24164
24352
|
}
|
|
24165
24353
|
function sharesHistory(home) {
|
|
24166
24354
|
try {
|
|
24167
|
-
const upstream =
|
|
24355
|
+
const upstream = execFileSync3("git", ["-C", home, "rev-parse", "@{u}"], {
|
|
24168
24356
|
stdio: ["ignore", "pipe", "pipe"],
|
|
24169
24357
|
encoding: "utf8"
|
|
24170
24358
|
}).trim();
|
|
24171
|
-
|
|
24359
|
+
execFileSync3("git", ["-C", home, "merge-base", "HEAD", upstream], {
|
|
24172
24360
|
stdio: ["ignore", "pipe", "pipe"]
|
|
24173
24361
|
});
|
|
24174
24362
|
return true;
|
|
@@ -24461,8 +24649,9 @@ async function main() {
|
|
|
24461
24649
|
console.log(
|
|
24462
24650
|
report(
|
|
24463
24651
|
block("Configured", result.written),
|
|
24652
|
+
block(AHEAD, result.ahead),
|
|
24464
24653
|
block("Skipped", result.skipped),
|
|
24465
|
-
|
|
24654
|
+
nextSteps(result.found, result.apiUrl)
|
|
24466
24655
|
)
|
|
24467
24656
|
);
|
|
24468
24657
|
return;
|
package/package.json
CHANGED