pantheon-cli 0.2.25 → 0.2.27
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 +222 -80
- package/package.json +1 -1
package/dist/pantheon.mjs
CHANGED
|
@@ -23365,6 +23365,136 @@ async function syncVault(home, opts = {}) {
|
|
|
23365
23365
|
}
|
|
23366
23366
|
}
|
|
23367
23367
|
|
|
23368
|
+
// ../core/src/shares.ts
|
|
23369
|
+
import { existsSync as existsSync6, mkdirSync as mkdirSync5, readdirSync as readdirSync4, readFileSync as readFileSync5, rmSync as rmSync3, writeFileSync as writeFileSync5 } from "node:fs";
|
|
23370
|
+
import { dirname as dirname2, join as join6 } from "node:path";
|
|
23371
|
+
function ledgerPath(root) {
|
|
23372
|
+
return join6(root, "manifest.json");
|
|
23373
|
+
}
|
|
23374
|
+
function readLedger(root) {
|
|
23375
|
+
try {
|
|
23376
|
+
return JSON.parse(readFileSync5(ledgerPath(root), "utf8"));
|
|
23377
|
+
} catch {
|
|
23378
|
+
return {};
|
|
23379
|
+
}
|
|
23380
|
+
}
|
|
23381
|
+
function safeSegment(value) {
|
|
23382
|
+
const clean = (value || "").trim();
|
|
23383
|
+
if (!clean || clean === "." || clean === "..") return null;
|
|
23384
|
+
if (clean.includes("/") || clean.includes("\\") || clean.includes("\0")) return null;
|
|
23385
|
+
return clean;
|
|
23386
|
+
}
|
|
23387
|
+
function safeRelative(value) {
|
|
23388
|
+
const parts = (value || "").split("/").filter(Boolean);
|
|
23389
|
+
if (!parts.length) return null;
|
|
23390
|
+
if (parts.some((part) => !safeSegment(part))) return null;
|
|
23391
|
+
return parts.join("/");
|
|
23392
|
+
}
|
|
23393
|
+
async function fetchShares(apiUrl, auth) {
|
|
23394
|
+
const res = await fetch(`${apiUrl}/api/cli/shares`, { headers: { authorization: auth } });
|
|
23395
|
+
if (!res.ok) throw new Error(`Could not list shares (${res.status}).`);
|
|
23396
|
+
const body = await res.json();
|
|
23397
|
+
if (!Array.isArray(body.shares)) throw new Error("Could not read the share list.");
|
|
23398
|
+
return body.shares;
|
|
23399
|
+
}
|
|
23400
|
+
async function pullShares(home) {
|
|
23401
|
+
const stored = loadMachineConfig();
|
|
23402
|
+
if (!stored) return { ok: false, spaces: 0, fetched: 0, error: "Not connected." };
|
|
23403
|
+
const auth = `Bearer ${stored.config.machineId}.${stored.credentials.machineSecret}`;
|
|
23404
|
+
const root = sharedHome(home);
|
|
23405
|
+
let shares;
|
|
23406
|
+
try {
|
|
23407
|
+
shares = await fetchShares(stored.config.apiUrl, auth);
|
|
23408
|
+
} catch (error2) {
|
|
23409
|
+
return {
|
|
23410
|
+
ok: false,
|
|
23411
|
+
spaces: 0,
|
|
23412
|
+
fetched: 0,
|
|
23413
|
+
error: error2 instanceof Error ? error2.message : String(error2)
|
|
23414
|
+
};
|
|
23415
|
+
}
|
|
23416
|
+
if (!shares.length) {
|
|
23417
|
+
if (existsSync6(root)) rmSync3(root, { recursive: true, force: true });
|
|
23418
|
+
return { ok: true, spaces: 0, fetched: 0 };
|
|
23419
|
+
}
|
|
23420
|
+
mkdirSync5(root, { recursive: true });
|
|
23421
|
+
const ledger = readLedger(root);
|
|
23422
|
+
const next = {};
|
|
23423
|
+
const keep = /* @__PURE__ */ new Set();
|
|
23424
|
+
const jobs = [];
|
|
23425
|
+
for (const share of shares) {
|
|
23426
|
+
const owner = safeSegment(share.owner);
|
|
23427
|
+
const slug = safeSegment(share.slug);
|
|
23428
|
+
if (!owner || !slug) continue;
|
|
23429
|
+
keep.add(`${owner}/${slug}`);
|
|
23430
|
+
const spaceDir2 = join6(root, owner, slug);
|
|
23431
|
+
const wanted = /* @__PURE__ */ new Set();
|
|
23432
|
+
for (const file of share.files || []) {
|
|
23433
|
+
const relative2 = safeRelative(file.path);
|
|
23434
|
+
if (!relative2) continue;
|
|
23435
|
+
wanted.add(relative2);
|
|
23436
|
+
const key = `${owner}/${slug}/${relative2}`;
|
|
23437
|
+
next[key] = file.sha;
|
|
23438
|
+
const dest = join6(spaceDir2, relative2);
|
|
23439
|
+
if (ledger[key] === file.sha && existsSync6(dest)) continue;
|
|
23440
|
+
jobs.push({ key, owner, slug, relative: relative2, dest });
|
|
23441
|
+
}
|
|
23442
|
+
prune(spaceDir2, spaceDir2, wanted);
|
|
23443
|
+
}
|
|
23444
|
+
let fetched = 0;
|
|
23445
|
+
await pool(jobs, async (job) => {
|
|
23446
|
+
const url = `${stored.config.apiUrl}/api/cli/shares/${encodeURIComponent(job.owner)}/${encodeURIComponent(job.slug)}?path=${encodeURIComponent(job.relative)}`;
|
|
23447
|
+
const res = await fetch(url, { headers: { authorization: auth } }).catch(() => null);
|
|
23448
|
+
if (!res?.ok) {
|
|
23449
|
+
delete next[job.key];
|
|
23450
|
+
return;
|
|
23451
|
+
}
|
|
23452
|
+
mkdirSync5(dirname2(job.dest), { recursive: true });
|
|
23453
|
+
writeFileSync5(job.dest, Buffer.from(await res.arrayBuffer()));
|
|
23454
|
+
fetched += 1;
|
|
23455
|
+
});
|
|
23456
|
+
for (const owner of dirNames(root)) {
|
|
23457
|
+
for (const slug of dirNames(join6(root, owner))) {
|
|
23458
|
+
if (keep.has(`${owner}/${slug}`)) continue;
|
|
23459
|
+
rmSync3(join6(root, owner, slug), { recursive: true, force: true });
|
|
23460
|
+
}
|
|
23461
|
+
if (!dirNames(join6(root, owner)).length) rmSync3(join6(root, owner), { recursive: true, force: true });
|
|
23462
|
+
}
|
|
23463
|
+
writeFileSync5(ledgerPath(root), `${JSON.stringify(next, null, 2)}
|
|
23464
|
+
`);
|
|
23465
|
+
return { ok: true, spaces: keep.size, fetched };
|
|
23466
|
+
}
|
|
23467
|
+
async function pool(items, run, limit = 12) {
|
|
23468
|
+
let cursor = 0;
|
|
23469
|
+
const workers = Array.from({ length: Math.min(limit, items.length) }, async () => {
|
|
23470
|
+
while (cursor < items.length) {
|
|
23471
|
+
const item = items[cursor++];
|
|
23472
|
+
await run(item);
|
|
23473
|
+
}
|
|
23474
|
+
});
|
|
23475
|
+
await Promise.all(workers);
|
|
23476
|
+
}
|
|
23477
|
+
function prune(base, dir, wanted) {
|
|
23478
|
+
if (!existsSync6(dir)) return;
|
|
23479
|
+
for (const entry of readdirSync4(dir, { withFileTypes: true })) {
|
|
23480
|
+
const full = join6(dir, entry.name);
|
|
23481
|
+
if (entry.isDirectory()) {
|
|
23482
|
+
prune(base, full, wanted);
|
|
23483
|
+
if (!readdirSync4(full).length) rmSync3(full, { recursive: true, force: true });
|
|
23484
|
+
continue;
|
|
23485
|
+
}
|
|
23486
|
+
const relative2 = full.slice(base.length + 1).split("\\").join("/");
|
|
23487
|
+
if (!wanted.has(relative2)) rmSync3(full, { force: true });
|
|
23488
|
+
}
|
|
23489
|
+
}
|
|
23490
|
+
function dirNames(root) {
|
|
23491
|
+
try {
|
|
23492
|
+
return readdirSync4(root, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
|
|
23493
|
+
} catch {
|
|
23494
|
+
return [];
|
|
23495
|
+
}
|
|
23496
|
+
}
|
|
23497
|
+
|
|
23368
23498
|
// ../mcp/src/index.ts
|
|
23369
23499
|
function readRoot(home, space) {
|
|
23370
23500
|
return resolveSpace(home, space).root;
|
|
@@ -23374,7 +23504,12 @@ function writeRoot(home, space) {
|
|
|
23374
23504
|
}
|
|
23375
23505
|
function defaultHooks() {
|
|
23376
23506
|
return {
|
|
23377
|
-
pull: (home) =>
|
|
23507
|
+
pull: async (home) => {
|
|
23508
|
+
const sync2 = await syncVault(home, { push: false });
|
|
23509
|
+
await pullShares(home).catch(() => {
|
|
23510
|
+
});
|
|
23511
|
+
return sync2;
|
|
23512
|
+
},
|
|
23378
23513
|
push: (home, message) => syncVault(home, { push: true, message })
|
|
23379
23514
|
};
|
|
23380
23515
|
}
|
|
@@ -23818,24 +23953,24 @@ import { hostname as hostname3 } from "node:os";
|
|
|
23818
23953
|
|
|
23819
23954
|
// src/connect.ts
|
|
23820
23955
|
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
23821
|
-
import { existsSync as
|
|
23956
|
+
import { existsSync as existsSync8, mkdirSync as mkdirSync7, renameSync as renameSync2 } from "node:fs";
|
|
23822
23957
|
import { hostname as hostname2 } from "node:os";
|
|
23823
|
-
import { join as
|
|
23958
|
+
import { join as join8 } from "node:path";
|
|
23824
23959
|
|
|
23825
23960
|
// src/mcp-install.ts
|
|
23826
|
-
import { existsSync as
|
|
23961
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync6, readFileSync as readFileSync6, renameSync, unlinkSync as unlinkSync2, writeFileSync as writeFileSync6 } from "node:fs";
|
|
23827
23962
|
import { homedir as homedir5 } from "node:os";
|
|
23828
|
-
import { dirname as
|
|
23963
|
+
import { dirname as dirname3, join as join7 } from "node:path";
|
|
23829
23964
|
import { fileURLToPath } from "node:url";
|
|
23830
|
-
var here =
|
|
23965
|
+
var here = dirname3(fileURLToPath(import.meta.url));
|
|
23831
23966
|
function pantheonBin() {
|
|
23832
23967
|
const self = fileURLToPath(import.meta.url);
|
|
23833
|
-
if (self.endsWith(".ts")) return
|
|
23968
|
+
if (self.endsWith(".ts")) return join7(here, "../bin/pantheon.mjs");
|
|
23834
23969
|
return self;
|
|
23835
23970
|
}
|
|
23836
23971
|
function launchEnv(home) {
|
|
23837
|
-
const nodeDir =
|
|
23838
|
-
const binDir =
|
|
23972
|
+
const nodeDir = dirname3(process.execPath);
|
|
23973
|
+
const binDir = dirname3(pantheonBin());
|
|
23839
23974
|
const sep = process.platform === "win32" ? ";" : ":";
|
|
23840
23975
|
const pathKey = process.platform === "win32" ? "Path" : "PATH";
|
|
23841
23976
|
return {
|
|
@@ -23923,8 +24058,8 @@ function isPlainObject3(value) {
|
|
|
23923
24058
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
23924
24059
|
}
|
|
23925
24060
|
function readJson(path) {
|
|
23926
|
-
if (!
|
|
23927
|
-
const text2 =
|
|
24061
|
+
if (!existsSync7(path)) return {};
|
|
24062
|
+
const text2 = readFileSync6(path, "utf8").replace(/^\uFEFF/, "");
|
|
23928
24063
|
if (!text2.trim()) return {};
|
|
23929
24064
|
let value;
|
|
23930
24065
|
try {
|
|
@@ -23943,13 +24078,13 @@ function readJson(path) {
|
|
|
23943
24078
|
return value;
|
|
23944
24079
|
}
|
|
23945
24080
|
function writeAtomic(path, text2) {
|
|
23946
|
-
|
|
24081
|
+
mkdirSync6(dirname3(path), { recursive: true });
|
|
23947
24082
|
const temp = `${path}.pantheon-${process.pid}.tmp`;
|
|
23948
24083
|
try {
|
|
23949
|
-
|
|
24084
|
+
writeFileSync6(temp, text2);
|
|
23950
24085
|
renameSync(temp, path);
|
|
23951
24086
|
} catch (error2) {
|
|
23952
|
-
if (
|
|
24087
|
+
if (existsSync7(temp)) unlinkSync2(temp);
|
|
23953
24088
|
throw error2;
|
|
23954
24089
|
}
|
|
23955
24090
|
}
|
|
@@ -23968,20 +24103,20 @@ function tomlString(value) {
|
|
|
23968
24103
|
}
|
|
23969
24104
|
function chatgptDesktopPath() {
|
|
23970
24105
|
if (process.platform !== "darwin") return null;
|
|
23971
|
-
return
|
|
24106
|
+
return join7(homedir5(), "Library", "Application Support", "ChatGPT", "chatgpt_mcp_config.json");
|
|
23972
24107
|
}
|
|
23973
24108
|
function claudeDesktopPath() {
|
|
23974
24109
|
if (process.platform === "darwin") {
|
|
23975
|
-
return
|
|
24110
|
+
return join7(homedir5(), "Library", "Application Support", "Claude", "claude_desktop_config.json");
|
|
23976
24111
|
}
|
|
23977
24112
|
if (process.platform === "win32") {
|
|
23978
|
-
return
|
|
24113
|
+
return join7(process.env.APPDATA || homedir5(), "Claude", "claude_desktop_config.json");
|
|
23979
24114
|
}
|
|
23980
|
-
return
|
|
24115
|
+
return join7(homedir5(), ".config", "Claude", "claude_desktop_config.json");
|
|
23981
24116
|
}
|
|
23982
24117
|
function upsertCodex(home) {
|
|
23983
|
-
const path =
|
|
23984
|
-
|
|
24118
|
+
const path = join7(homedir5(), ".codex", "config.toml");
|
|
24119
|
+
mkdirSync6(dirname3(path), { recursive: true });
|
|
23985
24120
|
const server = mcpServer(home);
|
|
23986
24121
|
const args = server.args.map(tomlString).join(", ");
|
|
23987
24122
|
const block2 = [
|
|
@@ -23994,11 +24129,11 @@ function upsertCodex(home) {
|
|
|
23994
24129
|
`PANTHEON_HOME = ${tomlString(home)}`,
|
|
23995
24130
|
""
|
|
23996
24131
|
].join("\n");
|
|
23997
|
-
if (!
|
|
24132
|
+
if (!existsSync7(path)) {
|
|
23998
24133
|
writeAtomic(path, block2);
|
|
23999
24134
|
return;
|
|
24000
24135
|
}
|
|
24001
|
-
const existing =
|
|
24136
|
+
const existing = readFileSync6(path, "utf8");
|
|
24002
24137
|
if (existing.includes("[mcp_servers.pantheon]")) {
|
|
24003
24138
|
const next = existing.replace(
|
|
24004
24139
|
/\[mcp_servers\.pantheon\][\s\S]*?(?=\n\[(?!mcp_servers\.pantheon)|\s*$)/,
|
|
@@ -24054,7 +24189,7 @@ Parse the rest of the argument as the fact. Only then call pantheon_remember, ev
|
|
|
24054
24189
|
}
|
|
24055
24190
|
];
|
|
24056
24191
|
function writeCodexSkill() {
|
|
24057
|
-
const dirs2 = [
|
|
24192
|
+
const dirs2 = [join7(homedir5(), ".agents", "skills", "pantheon"), join7(homedir5(), ".codex", "skills", "pantheon")];
|
|
24058
24193
|
const skill = `---
|
|
24059
24194
|
name: pantheon
|
|
24060
24195
|
description: Use when the user types /pantheon-handoff, /pantheon-resume, /pantheon-park, /pantheon-remember, /pantheon-spaces, /pantheon-help, mentions Pantheon, conscience, spaces, or wants to hand off or resume an agent conversation. Always call pantheon_* MCP tools first. Never invent Pantheon space names from memory.
|
|
@@ -24119,17 +24254,17 @@ where the work was, which is the part the human asked for, so never fold that
|
|
|
24119
24254
|
into cells.
|
|
24120
24255
|
`;
|
|
24121
24256
|
for (const dir of dirs2) {
|
|
24122
|
-
|
|
24123
|
-
|
|
24257
|
+
mkdirSync6(dir, { recursive: true });
|
|
24258
|
+
writeFileSync6(join7(dir, "SKILL.md"), skill);
|
|
24124
24259
|
}
|
|
24125
24260
|
}
|
|
24126
24261
|
function writeSlashCommands() {
|
|
24127
|
-
const dirs2 = [
|
|
24262
|
+
const dirs2 = [join7(homedir5(), ".cursor", "commands"), join7(homedir5(), ".claude", "commands")];
|
|
24128
24263
|
for (const dir of dirs2) {
|
|
24129
|
-
|
|
24264
|
+
mkdirSync6(dir, { recursive: true });
|
|
24130
24265
|
for (const command of slashCommands) {
|
|
24131
|
-
|
|
24132
|
-
|
|
24266
|
+
writeFileSync6(
|
|
24267
|
+
join7(dir, `${command.name}.md`),
|
|
24133
24268
|
`---
|
|
24134
24269
|
description: ${command.description}
|
|
24135
24270
|
---
|
|
@@ -24152,42 +24287,42 @@ function detectApps() {
|
|
|
24152
24287
|
const home = homedir5();
|
|
24153
24288
|
const mac = process.platform === "darwin";
|
|
24154
24289
|
const win = process.platform === "win32";
|
|
24155
|
-
const local = process.env.LOCALAPPDATA ||
|
|
24156
|
-
const roaming = process.env.APPDATA ||
|
|
24290
|
+
const local = process.env.LOCALAPPDATA || join7(home, "AppData", "Local");
|
|
24291
|
+
const roaming = process.env.APPDATA || join7(home, "AppData", "Roaming");
|
|
24157
24292
|
const evidence = {
|
|
24158
24293
|
Cursor: [
|
|
24159
|
-
|
|
24160
|
-
|
|
24161
|
-
|
|
24162
|
-
...mac ? ["/Applications/Cursor.app",
|
|
24163
|
-
...win ? [
|
|
24294
|
+
join7(home, ".cursor", "extensions"),
|
|
24295
|
+
join7(home, ".cursor", "argv.json"),
|
|
24296
|
+
join7(home, ".cursor", "cli"),
|
|
24297
|
+
...mac ? ["/Applications/Cursor.app", join7(home, "Applications", "Cursor.app")] : [],
|
|
24298
|
+
...win ? [join7(local, "Programs", "cursor")] : []
|
|
24164
24299
|
],
|
|
24165
24300
|
"Claude Code": [
|
|
24166
|
-
|
|
24167
|
-
|
|
24168
|
-
|
|
24169
|
-
|
|
24301
|
+
join7(home, ".claude", "projects"),
|
|
24302
|
+
join7(home, ".claude", "settings.json"),
|
|
24303
|
+
join7(home, ".claude", "history.jsonl"),
|
|
24304
|
+
join7(home, ".claude", "statsig")
|
|
24170
24305
|
],
|
|
24171
24306
|
"Claude Desktop": [
|
|
24172
|
-
...mac ? ["/Applications/Claude.app",
|
|
24173
|
-
...win ? [
|
|
24174
|
-
...!mac && !win ? [
|
|
24307
|
+
...mac ? ["/Applications/Claude.app", join7(home, "Applications", "Claude.app")] : [],
|
|
24308
|
+
...win ? [join7(local, "AnthropicClaude"), join7(roaming, "Claude", "window-state.json")] : [],
|
|
24309
|
+
...!mac && !win ? [join7(home, ".config", "Claude", "window-state.json")] : []
|
|
24175
24310
|
],
|
|
24176
|
-
"ChatGPT.app": mac ? ["/Applications/ChatGPT.app",
|
|
24311
|
+
"ChatGPT.app": mac ? ["/Applications/ChatGPT.app", join7(home, "Applications", "ChatGPT.app")] : [],
|
|
24177
24312
|
Codex: [
|
|
24178
|
-
|
|
24179
|
-
|
|
24180
|
-
|
|
24181
|
-
|
|
24313
|
+
join7(home, ".codex", "sessions"),
|
|
24314
|
+
join7(home, ".codex", "auth.json"),
|
|
24315
|
+
join7(home, ".codex", "history.jsonl"),
|
|
24316
|
+
join7(home, ".codex", "log")
|
|
24182
24317
|
],
|
|
24183
24318
|
Windsurf: [
|
|
24184
|
-
|
|
24185
|
-
...mac ? ["/Applications/Windsurf.app",
|
|
24319
|
+
join7(home, ".codeium", "windsurf"),
|
|
24320
|
+
...mac ? ["/Applications/Windsurf.app", join7(home, "Applications", "Windsurf.app")] : []
|
|
24186
24321
|
]
|
|
24187
24322
|
};
|
|
24188
24323
|
const found = /* @__PURE__ */ new Set();
|
|
24189
24324
|
for (const [name, paths] of Object.entries(evidence)) {
|
|
24190
|
-
if (paths.some((path) =>
|
|
24325
|
+
if (paths.some((path) => existsSync7(path))) found.add(name);
|
|
24191
24326
|
}
|
|
24192
24327
|
return found;
|
|
24193
24328
|
}
|
|
@@ -24216,25 +24351,25 @@ function installMcpClients(home) {
|
|
|
24216
24351
|
skipped.push({ name, detail: why.replace(homedir5(), "~") });
|
|
24217
24352
|
}
|
|
24218
24353
|
};
|
|
24219
|
-
install("Cursor",
|
|
24220
|
-
install("Claude Code",
|
|
24354
|
+
install("Cursor", join7(homedir5(), ".cursor", "mcp.json"), server);
|
|
24355
|
+
install("Claude Code", join7(homedir5(), ".claude.json"), mcpServer(home, true));
|
|
24221
24356
|
const desktop = claudeDesktopPath();
|
|
24222
|
-
if (
|
|
24357
|
+
if (existsSync7(dirname3(desktop)) || process.platform === "darwin" || process.platform === "win32") {
|
|
24223
24358
|
install("Claude Desktop", desktop, server);
|
|
24224
24359
|
} else {
|
|
24225
24360
|
skipped.push({ name: "Claude Desktop", detail: "app not found" });
|
|
24226
24361
|
}
|
|
24227
24362
|
const chatgpt = chatgptDesktopPath();
|
|
24228
|
-
if (chatgpt &&
|
|
24229
|
-
const codex =
|
|
24363
|
+
if (chatgpt && existsSync7(dirname3(chatgpt))) install("ChatGPT.app", chatgpt, server);
|
|
24364
|
+
const codex = join7(homedir5(), ".codex", "config.toml");
|
|
24230
24365
|
try {
|
|
24231
24366
|
upsertCodex(home);
|
|
24232
24367
|
(found.has("Codex") ? written : ahead).push({ name: "Codex", detail: tilde(codex) });
|
|
24233
24368
|
} catch {
|
|
24234
24369
|
skipped.push({ name: "Codex", detail: `could not write ${tilde(codex)}` });
|
|
24235
24370
|
}
|
|
24236
|
-
const windsurf =
|
|
24237
|
-
if (
|
|
24371
|
+
const windsurf = join7(homedir5(), ".codeium", "windsurf", "mcp_config.json");
|
|
24372
|
+
if (existsSync7(dirname3(windsurf))) {
|
|
24238
24373
|
install("Windsurf", windsurf, server);
|
|
24239
24374
|
} else {
|
|
24240
24375
|
skipped.push({ name: "Windsurf", detail: "app not found" });
|
|
@@ -24251,7 +24386,7 @@ function installMcpClients(home) {
|
|
|
24251
24386
|
return { written, ahead, skipped, found: [...found] };
|
|
24252
24387
|
}
|
|
24253
24388
|
function removeServerFromJson(path, key = "mcpServers") {
|
|
24254
|
-
if (!
|
|
24389
|
+
if (!existsSync7(path)) return false;
|
|
24255
24390
|
let current;
|
|
24256
24391
|
try {
|
|
24257
24392
|
current = readJson(path);
|
|
@@ -24266,9 +24401,9 @@ function removeServerFromJson(path, key = "mcpServers") {
|
|
|
24266
24401
|
return true;
|
|
24267
24402
|
}
|
|
24268
24403
|
function removeCodex() {
|
|
24269
|
-
const path =
|
|
24270
|
-
if (!
|
|
24271
|
-
const existing =
|
|
24404
|
+
const path = join7(homedir5(), ".codex", "config.toml");
|
|
24405
|
+
if (!existsSync7(path)) return false;
|
|
24406
|
+
const existing = readFileSync6(path, "utf8");
|
|
24272
24407
|
if (!existing.includes("[mcp_servers.pantheon]")) return false;
|
|
24273
24408
|
const next = existing.replace(/\[mcp_servers\.pantheon\][\s\S]*?(?=\n\[(?!mcp_servers\.pantheon)|\s*$)/, "").replace(/\n{3,}/g, "\n\n").trimEnd();
|
|
24274
24409
|
writeAtomic(path, next ? `${next}
|
|
@@ -24276,12 +24411,12 @@ function removeCodex() {
|
|
|
24276
24411
|
return true;
|
|
24277
24412
|
}
|
|
24278
24413
|
function removeSlashCommands() {
|
|
24279
|
-
const dirs2 = [
|
|
24414
|
+
const dirs2 = [join7(homedir5(), ".cursor", "commands"), join7(homedir5(), ".claude", "commands")];
|
|
24280
24415
|
let removed = 0;
|
|
24281
24416
|
for (const dir of dirs2) {
|
|
24282
24417
|
for (const command of slashCommands) {
|
|
24283
|
-
const file =
|
|
24284
|
-
if (!
|
|
24418
|
+
const file = join7(dir, `${command.name}.md`);
|
|
24419
|
+
if (!existsSync7(file)) continue;
|
|
24285
24420
|
unlinkSync2(file);
|
|
24286
24421
|
removed += 1;
|
|
24287
24422
|
}
|
|
@@ -24290,32 +24425,32 @@ function removeSlashCommands() {
|
|
|
24290
24425
|
}
|
|
24291
24426
|
function uninstallMcpClients() {
|
|
24292
24427
|
const removed = [];
|
|
24293
|
-
if (removeServerFromJson(
|
|
24294
|
-
if (removeServerFromJson(
|
|
24428
|
+
if (removeServerFromJson(join7(homedir5(), ".cursor", "mcp.json"))) removed.push("Cursor");
|
|
24429
|
+
if (removeServerFromJson(join7(homedir5(), ".claude.json"))) removed.push("Claude Code");
|
|
24295
24430
|
if (removeServerFromJson(claudeDesktopPath())) removed.push("Claude Desktop");
|
|
24296
24431
|
const chatgpt = chatgptDesktopPath();
|
|
24297
24432
|
if (chatgpt && removeServerFromJson(chatgpt)) removed.push("ChatGPT.app (shared MCP file)");
|
|
24298
24433
|
if (removeCodex()) removed.push("ChatGPT.app / Codex");
|
|
24299
|
-
if (removeServerFromJson(
|
|
24434
|
+
if (removeServerFromJson(join7(homedir5(), ".codeium", "windsurf", "mcp_config.json"))) {
|
|
24300
24435
|
removed.push("Windsurf");
|
|
24301
24436
|
}
|
|
24302
24437
|
const slash2 = removeSlashCommands();
|
|
24303
24438
|
if (slash2) removed.push("/pantheon-* commands");
|
|
24304
24439
|
for (const dir of [
|
|
24305
|
-
|
|
24306
|
-
|
|
24440
|
+
join7(homedir5(), ".agents", "skills", "pantheon"),
|
|
24441
|
+
join7(homedir5(), ".codex", "skills", "pantheon")
|
|
24307
24442
|
]) {
|
|
24308
|
-
const file =
|
|
24309
|
-
if (!
|
|
24443
|
+
const file = join7(dir, "SKILL.md");
|
|
24444
|
+
if (!existsSync7(file)) continue;
|
|
24310
24445
|
unlinkSync2(file);
|
|
24311
24446
|
removed.push("ChatGPT / Codex skill");
|
|
24312
24447
|
break;
|
|
24313
24448
|
}
|
|
24314
24449
|
for (const launcher of [
|
|
24315
|
-
|
|
24316
|
-
|
|
24450
|
+
join7(homedir5(), ".local", "bin", "pantheon-mcp"),
|
|
24451
|
+
join7(homedir5(), ".local", "bin", "pantheon-mcp.cmd")
|
|
24317
24452
|
]) {
|
|
24318
|
-
if (!
|
|
24453
|
+
if (!existsSync7(launcher)) continue;
|
|
24319
24454
|
unlinkSync2(launcher);
|
|
24320
24455
|
removed.push("pantheon-mcp launcher");
|
|
24321
24456
|
}
|
|
@@ -24398,10 +24533,10 @@ async function connect(opts) {
|
|
|
24398
24533
|
},
|
|
24399
24534
|
{ machineSecret: body.machineSecret }
|
|
24400
24535
|
);
|
|
24401
|
-
|
|
24536
|
+
mkdirSync7(home, { recursive: true });
|
|
24402
24537
|
const auth = authArgs();
|
|
24403
24538
|
const quiet = { stdio: ["ignore", "pipe", "pipe"] };
|
|
24404
|
-
const fresh = !
|
|
24539
|
+
const fresh = !existsSync8(join8(home, ".git"));
|
|
24405
24540
|
let archived = "";
|
|
24406
24541
|
if (fresh) {
|
|
24407
24542
|
process.stdout.write(" Cloning the vault\u2026\n");
|
|
@@ -24449,7 +24584,7 @@ function syncVault2(home, cloneUrl, auth, quiet) {
|
|
|
24449
24584
|
git2("pull", "--ff-only");
|
|
24450
24585
|
return "";
|
|
24451
24586
|
} catch (error2) {
|
|
24452
|
-
if (!
|
|
24587
|
+
if (!existsSync8(join8(home, ".git"))) throw error2;
|
|
24453
24588
|
}
|
|
24454
24589
|
if (sharesHistory(home)) {
|
|
24455
24590
|
process.stdout.write(" Merging work from another machine\u2026\n");
|
|
@@ -24665,7 +24800,7 @@ function printSpaces() {
|
|
|
24665
24800
|
}
|
|
24666
24801
|
|
|
24667
24802
|
// src/status.ts
|
|
24668
|
-
import { existsSync as
|
|
24803
|
+
import { existsSync as existsSync9 } from "node:fs";
|
|
24669
24804
|
function printStatus() {
|
|
24670
24805
|
const stored = loadMachineConfig();
|
|
24671
24806
|
if (!stored) {
|
|
@@ -24679,7 +24814,7 @@ function printStatus() {
|
|
|
24679
24814
|
field("GitHub", config2.account),
|
|
24680
24815
|
field("Install", String(config2.installationId)),
|
|
24681
24816
|
field("Repo", `${config2.repo} (private)`),
|
|
24682
|
-
field("Vault", `${config2.home}${
|
|
24817
|
+
field("Vault", `${config2.home}${existsSync9(config2.home) ? "" : " (missing)"}`),
|
|
24683
24818
|
field("API", config2.apiUrl),
|
|
24684
24819
|
field("Machine", config2.machineId)
|
|
24685
24820
|
].join("\n")
|
|
@@ -24699,6 +24834,13 @@ async function sync() {
|
|
|
24699
24834
|
result.pushed ? "pushed" : null
|
|
24700
24835
|
].filter(Boolean);
|
|
24701
24836
|
console.log(` Vault ${bits.join(", ")}`);
|
|
24837
|
+
const shared = await pullShares(stored.config.home);
|
|
24838
|
+
if (shared.ok && shared.spaces) {
|
|
24839
|
+
const detail = shared.fetched ? `${shared.fetched} files fetched` : "up to date";
|
|
24840
|
+
console.log(` Shared ${shared.spaces} ${shared.spaces === 1 ? "space" : "spaces"}, ${detail}`);
|
|
24841
|
+
} else if (!shared.ok) {
|
|
24842
|
+
console.log(` Shared could not refresh \u2014 ${shared.error}`);
|
|
24843
|
+
}
|
|
24702
24844
|
}
|
|
24703
24845
|
|
|
24704
24846
|
// src/index.ts
|
package/package.json
CHANGED