typegraph-mcp 0.9.35 → 0.9.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.ts +51 -27
- package/dist/cli.js +34 -22
- package/package.json +1 -1
package/cli.ts
CHANGED
|
@@ -41,6 +41,12 @@ interface LegacyGlobalCodexCleanup {
|
|
|
41
41
|
nextContent: string;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
interface RemovePluginOptions {
|
|
45
|
+
removeGlobalCodex: boolean;
|
|
46
|
+
legacyGlobalCodexCleanup: LegacyGlobalCodexCleanup | null;
|
|
47
|
+
warnAboutGlobalCodex: boolean;
|
|
48
|
+
}
|
|
49
|
+
|
|
44
50
|
// ─── Constants ───────────────────────────────────────────────────────────────
|
|
45
51
|
|
|
46
52
|
const AGENT_SNIPPET = `
|
|
@@ -413,6 +419,41 @@ function removeLegacyGlobalCodexMcp(cleanup: LegacyGlobalCodexCleanup): void {
|
|
|
413
419
|
p.log.info("~/.codex/config.toml: removed stale global typegraph MCP server entry for this project");
|
|
414
420
|
}
|
|
415
421
|
|
|
422
|
+
async function resolveRemovePluginOptions(
|
|
423
|
+
projectRoot: string,
|
|
424
|
+
yes: boolean,
|
|
425
|
+
cleanGlobalCodex: boolean
|
|
426
|
+
): Promise<RemovePluginOptions> {
|
|
427
|
+
const legacyGlobalCodexCleanup = findLegacyGlobalCodexCleanup(projectRoot);
|
|
428
|
+
let removeGlobalCodex = cleanGlobalCodex;
|
|
429
|
+
|
|
430
|
+
if (legacyGlobalCodexCleanup && !cleanGlobalCodex && !yes) {
|
|
431
|
+
const shouldRemoveGlobal = await p.confirm({
|
|
432
|
+
message: "Also remove the stale global Codex MCP entry for this project from ~/.codex/config.toml?",
|
|
433
|
+
initialValue: false,
|
|
434
|
+
});
|
|
435
|
+
if (p.isCancel(shouldRemoveGlobal)) {
|
|
436
|
+
p.cancel("Removal cancelled.");
|
|
437
|
+
process.exit(0);
|
|
438
|
+
}
|
|
439
|
+
removeGlobalCodex = shouldRemoveGlobal;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
return {
|
|
443
|
+
removeGlobalCodex,
|
|
444
|
+
legacyGlobalCodexCleanup,
|
|
445
|
+
warnAboutGlobalCodex: legacyGlobalCodexCleanup !== null && !removeGlobalCodex,
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
function warnAboutStaleGlobalCodex(): void {
|
|
450
|
+
p.log.warn(
|
|
451
|
+
"Left a stale global Codex MCP entry for this project in ~/.codex/config.toml. " +
|
|
452
|
+
"Codex may show MCP startup warnings or errors until you remove it. " +
|
|
453
|
+
"Re-run `typegraph-mcp remove --clean-global-codex` or remove the `typegraph` block manually."
|
|
454
|
+
);
|
|
455
|
+
}
|
|
456
|
+
|
|
416
457
|
/** Register the typegraph MCP server in agent-specific config files */
|
|
417
458
|
function registerMcpServers(projectRoot: string, selectedAgents: AgentId[]): void {
|
|
418
459
|
if (selectedAgents.includes("cursor")) {
|
|
@@ -724,7 +765,11 @@ async function setup(yes: boolean): Promise<void> {
|
|
|
724
765
|
}
|
|
725
766
|
|
|
726
767
|
if (action === "remove") {
|
|
727
|
-
await
|
|
768
|
+
const removeOptions = await resolveRemovePluginOptions(projectRoot, false, false);
|
|
769
|
+
await removePlugin(projectRoot, targetDir, removeOptions);
|
|
770
|
+
if (removeOptions.warnAboutGlobalCodex) {
|
|
771
|
+
warnAboutStaleGlobalCodex();
|
|
772
|
+
}
|
|
728
773
|
return;
|
|
729
774
|
}
|
|
730
775
|
|
|
@@ -869,7 +914,7 @@ async function setup(yes: boolean): Promise<void> {
|
|
|
869
914
|
async function removePlugin(
|
|
870
915
|
projectRoot: string,
|
|
871
916
|
pluginDir: string,
|
|
872
|
-
options:
|
|
917
|
+
options: RemovePluginOptions
|
|
873
918
|
): Promise<void> {
|
|
874
919
|
const s = p.spinner();
|
|
875
920
|
s.start("Removing typegraph-mcp...");
|
|
@@ -1056,32 +1101,11 @@ async function remove(yes: boolean): Promise<void> {
|
|
|
1056
1101
|
}
|
|
1057
1102
|
}
|
|
1058
1103
|
|
|
1059
|
-
const
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
if (legacyGlobalCodexCleanup && !cleanGlobalCodex && !yes) {
|
|
1063
|
-
const shouldRemoveGlobal = await p.confirm({
|
|
1064
|
-
message: "Also remove the stale global Codex MCP entry for this project from ~/.codex/config.toml?",
|
|
1065
|
-
initialValue: false,
|
|
1066
|
-
});
|
|
1067
|
-
if (p.isCancel(shouldRemoveGlobal)) {
|
|
1068
|
-
p.cancel("Removal cancelled.");
|
|
1069
|
-
process.exit(0);
|
|
1070
|
-
}
|
|
1071
|
-
removeGlobalCodex = shouldRemoveGlobal;
|
|
1072
|
-
}
|
|
1073
|
-
|
|
1074
|
-
await removePlugin(projectRoot, pluginDir, {
|
|
1075
|
-
removeGlobalCodex,
|
|
1076
|
-
legacyGlobalCodexCleanup,
|
|
1077
|
-
});
|
|
1104
|
+
const removeOptions = await resolveRemovePluginOptions(projectRoot, yes, cleanGlobalCodex);
|
|
1105
|
+
await removePlugin(projectRoot, pluginDir, removeOptions);
|
|
1078
1106
|
|
|
1079
|
-
if (
|
|
1080
|
-
|
|
1081
|
-
"Left a stale global Codex MCP entry for this project in ~/.codex/config.toml. " +
|
|
1082
|
-
"Codex may show MCP startup warnings or errors until you remove it. " +
|
|
1083
|
-
"Re-run `typegraph-mcp remove --clean-global-codex` or remove the `typegraph` block manually."
|
|
1084
|
-
);
|
|
1107
|
+
if (removeOptions.warnAboutGlobalCodex) {
|
|
1108
|
+
warnAboutStaleGlobalCodex();
|
|
1085
1109
|
}
|
|
1086
1110
|
}
|
|
1087
1111
|
|
package/dist/cli.js
CHANGED
|
@@ -3202,6 +3202,31 @@ function removeLegacyGlobalCodexMcp(cleanup) {
|
|
|
3202
3202
|
}
|
|
3203
3203
|
p.log.info("~/.codex/config.toml: removed stale global typegraph MCP server entry for this project");
|
|
3204
3204
|
}
|
|
3205
|
+
async function resolveRemovePluginOptions(projectRoot3, yes2, cleanGlobalCodex) {
|
|
3206
|
+
const legacyGlobalCodexCleanup = findLegacyGlobalCodexCleanup(projectRoot3);
|
|
3207
|
+
let removeGlobalCodex = cleanGlobalCodex;
|
|
3208
|
+
if (legacyGlobalCodexCleanup && !cleanGlobalCodex && !yes2) {
|
|
3209
|
+
const shouldRemoveGlobal = await p.confirm({
|
|
3210
|
+
message: "Also remove the stale global Codex MCP entry for this project from ~/.codex/config.toml?",
|
|
3211
|
+
initialValue: false
|
|
3212
|
+
});
|
|
3213
|
+
if (p.isCancel(shouldRemoveGlobal)) {
|
|
3214
|
+
p.cancel("Removal cancelled.");
|
|
3215
|
+
process.exit(0);
|
|
3216
|
+
}
|
|
3217
|
+
removeGlobalCodex = shouldRemoveGlobal;
|
|
3218
|
+
}
|
|
3219
|
+
return {
|
|
3220
|
+
removeGlobalCodex,
|
|
3221
|
+
legacyGlobalCodexCleanup,
|
|
3222
|
+
warnAboutGlobalCodex: legacyGlobalCodexCleanup !== null && !removeGlobalCodex
|
|
3223
|
+
};
|
|
3224
|
+
}
|
|
3225
|
+
function warnAboutStaleGlobalCodex() {
|
|
3226
|
+
p.log.warn(
|
|
3227
|
+
"Left a stale global Codex MCP entry for this project in ~/.codex/config.toml. Codex may show MCP startup warnings or errors until you remove it. Re-run `typegraph-mcp remove --clean-global-codex` or remove the `typegraph` block manually."
|
|
3228
|
+
);
|
|
3229
|
+
}
|
|
3205
3230
|
function registerMcpServers(projectRoot3, selectedAgents) {
|
|
3206
3231
|
if (selectedAgents.includes("cursor")) {
|
|
3207
3232
|
registerJsonMcp(projectRoot3, ".cursor/mcp.json", "mcpServers");
|
|
@@ -3439,7 +3464,11 @@ async function setup(yes2) {
|
|
|
3439
3464
|
process.exit(0);
|
|
3440
3465
|
}
|
|
3441
3466
|
if (action === "remove") {
|
|
3442
|
-
await
|
|
3467
|
+
const removeOptions = await resolveRemovePluginOptions(projectRoot3, false, false);
|
|
3468
|
+
await removePlugin(projectRoot3, targetDir, removeOptions);
|
|
3469
|
+
if (removeOptions.warnAboutGlobalCodex) {
|
|
3470
|
+
warnAboutStaleGlobalCodex();
|
|
3471
|
+
}
|
|
3443
3472
|
return;
|
|
3444
3473
|
}
|
|
3445
3474
|
if (action === "exit") {
|
|
@@ -3681,27 +3710,10 @@ async function remove(yes2) {
|
|
|
3681
3710
|
process.exit(0);
|
|
3682
3711
|
}
|
|
3683
3712
|
}
|
|
3684
|
-
const
|
|
3685
|
-
|
|
3686
|
-
if (
|
|
3687
|
-
|
|
3688
|
-
message: "Also remove the stale global Codex MCP entry for this project from ~/.codex/config.toml?",
|
|
3689
|
-
initialValue: false
|
|
3690
|
-
});
|
|
3691
|
-
if (p.isCancel(shouldRemoveGlobal)) {
|
|
3692
|
-
p.cancel("Removal cancelled.");
|
|
3693
|
-
process.exit(0);
|
|
3694
|
-
}
|
|
3695
|
-
removeGlobalCodex = shouldRemoveGlobal;
|
|
3696
|
-
}
|
|
3697
|
-
await removePlugin(projectRoot3, pluginDir, {
|
|
3698
|
-
removeGlobalCodex,
|
|
3699
|
-
legacyGlobalCodexCleanup
|
|
3700
|
-
});
|
|
3701
|
-
if (legacyGlobalCodexCleanup && !removeGlobalCodex) {
|
|
3702
|
-
p.log.warn(
|
|
3703
|
-
"Left a stale global Codex MCP entry for this project in ~/.codex/config.toml. Codex may show MCP startup warnings or errors until you remove it. Re-run `typegraph-mcp remove --clean-global-codex` or remove the `typegraph` block manually."
|
|
3704
|
-
);
|
|
3713
|
+
const removeOptions = await resolveRemovePluginOptions(projectRoot3, yes2, cleanGlobalCodex);
|
|
3714
|
+
await removePlugin(projectRoot3, pluginDir, removeOptions);
|
|
3715
|
+
if (removeOptions.warnAboutGlobalCodex) {
|
|
3716
|
+
warnAboutStaleGlobalCodex();
|
|
3705
3717
|
}
|
|
3706
3718
|
}
|
|
3707
3719
|
function resolvePluginDir() {
|