-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Expand file tree
/
Copy pathinstaller-targets.test.ts
More file actions
1394 lines (1200 loc) · 58.3 KB
/
Copy pathinstaller-targets.test.ts
File metadata and controls
1394 lines (1200 loc) · 58.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* Multi-target installer tests.
*
* Each `AgentTarget` is exercised against the same contract:
* - `install` writes the expected files
* - re-running `install` is byte-identical (idempotent)
* - sibling MCP servers / unrelated config is preserved
* - `uninstall` reverses `install`
* - `printConfig` returns parseable, non-empty content
*
* For agent-config destinations we redirect HOME to a tmpdir via
* `os.homedir` spying, and CWD via `process.chdir` — same pattern as
* the legacy `installer.test.ts`. No real `~/.claude/` etc. ever
* touched.
*/
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import * as fs from 'fs';
import * as path from 'path';
import * as os from 'os';
import { ALL_TARGETS, getTarget, resolveTargetFlag } from '../src/installer/targets/registry';
import { uninstallTargets } from '../src/installer';
import { upsertTomlTable, removeTomlTable, buildTomlTable } from '../src/installer/targets/toml';
import { cleanupLegacyHooks } from '../src/installer/targets/claude';
function mkTmpDir(label: string): string {
return fs.mkdtempSync(path.join(os.tmpdir(), `cg-targets-${label}-`));
}
// `os.homedir` is non-configurable on Node, so we redirect it via the
// `$HOME` (POSIX) / `$USERPROFILE` (Windows) env vars that
// `os.homedir()` reads first. Same trick the rest of the suite uses
// when it needs a mock home.
function setHome(dir: string): { restore: () => void } {
const prev = {
HOME: process.env.HOME,
USERPROFILE: process.env.USERPROFILE,
APPDATA: process.env.APPDATA,
XDG_CONFIG_HOME: process.env.XDG_CONFIG_HOME,
HERMES_HOME: process.env.HERMES_HOME,
};
process.env.HOME = dir;
process.env.USERPROFILE = dir;
process.env.APPDATA = path.join(dir, '.config');
process.env.XDG_CONFIG_HOME = path.join(dir, '.config');
delete process.env.HERMES_HOME;
return {
restore() {
if (prev.HOME === undefined) delete process.env.HOME; else process.env.HOME = prev.HOME;
if (prev.USERPROFILE === undefined) delete process.env.USERPROFILE; else process.env.USERPROFILE = prev.USERPROFILE;
if (prev.APPDATA === undefined) delete process.env.APPDATA; else process.env.APPDATA = prev.APPDATA;
if (prev.XDG_CONFIG_HOME === undefined) delete process.env.XDG_CONFIG_HOME; else process.env.XDG_CONFIG_HOME = prev.XDG_CONFIG_HOME;
if (prev.HERMES_HOME === undefined) delete process.env.HERMES_HOME; else process.env.HERMES_HOME = prev.HERMES_HOME;
},
};
}
describe('Installer targets — contract', () => {
let tmpHome: string;
let tmpCwd: string;
let origCwd: string;
let homeRestore: { restore: () => void };
beforeEach(() => {
tmpHome = mkTmpDir('home');
tmpCwd = mkTmpDir('cwd');
origCwd = process.cwd();
process.chdir(tmpCwd);
homeRestore = setHome(tmpHome);
});
afterEach(() => {
homeRestore.restore();
process.chdir(origCwd);
fs.rmSync(tmpHome, { recursive: true, force: true });
fs.rmSync(tmpCwd, { recursive: true, force: true });
});
for (const target of ALL_TARGETS) {
describe(target.id, () => {
const supportedLocations = (['global', 'local'] as const).filter((l) =>
target.supportsLocation(l),
);
for (const location of supportedLocations) {
describe(`location=${location}`, () => {
it('install writes files; detect.alreadyConfigured becomes true', () => {
expect(target.detect(location).alreadyConfigured).toBe(false);
const result = target.install(location, { autoAllow: true });
expect(result.files.length).toBeGreaterThan(0);
for (const file of result.files) {
if (file.action !== 'unchanged') {
expect(fs.existsSync(file.path)).toBe(true);
}
}
expect(target.detect(location).alreadyConfigured).toBe(true);
});
it('re-running install is idempotent (no actions other than unchanged)', () => {
target.install(location, { autoAllow: true });
const second = target.install(location, { autoAllow: true });
for (const file of second.files) {
expect(file.action).toBe('unchanged');
}
});
it('install preserves a pre-existing sibling MCP server (where applicable)', () => {
// Plant a sibling entry in the same JSON config, install,
// and verify the sibling survives. Skip for Codex (TOML)
// and any target with no JSON config — they get covered
// by their own dedicated tests below.
const paths = target.describePaths(location);
// Match .json or .jsonc — opencode prefers .jsonc.
const jsonPath = paths.find((p) => /\.jsonc?$/.test(p));
if (!jsonPath) return;
// Seed pre-existing config.
fs.mkdirSync(path.dirname(jsonPath), { recursive: true });
const seed: Record<string, any> = { mcpServers: { other: { command: 'x' } } };
// opencode uses `mcp` not `mcpServers`. Match its shape too.
if (target.id === 'opencode') {
delete seed.mcpServers;
seed.mcp = { other: { type: 'local', command: ['x'], enabled: true } };
}
fs.writeFileSync(jsonPath, JSON.stringify(seed, null, 2) + '\n');
target.install(location, { autoAllow: true });
const after = JSON.parse(fs.readFileSync(jsonPath, 'utf-8'));
if (target.id === 'opencode') {
expect(after.mcp.other).toBeDefined();
expect(after.mcp.codegraph).toBeDefined();
} else {
expect(after.mcpServers.other).toBeDefined();
expect(after.mcpServers.codegraph).toBeDefined();
}
});
it('uninstall reverses install (alreadyConfigured returns to false)', () => {
target.install(location, { autoAllow: true });
expect(target.detect(location).alreadyConfigured).toBe(true);
target.uninstall(location);
expect(target.detect(location).alreadyConfigured).toBe(false);
});
it('printConfig returns non-empty output without writing anything', () => {
const before = listAllFiles(tmpHome).concat(listAllFiles(tmpCwd));
const out = target.printConfig(location);
expect(out.length).toBeGreaterThan(0);
const after = listAllFiles(tmpHome).concat(listAllFiles(tmpCwd));
expect(after.sort()).toEqual(before.sort());
});
});
}
});
}
});
describe('Installer targets — partial-state idempotency', () => {
let tmpHome: string;
let tmpCwd: string;
let origCwd: string;
let homeRestore: { restore: () => void };
beforeEach(() => {
tmpHome = mkTmpDir('home');
tmpCwd = mkTmpDir('cwd');
origCwd = process.cwd();
process.chdir(tmpCwd);
homeRestore = setHome(tmpHome);
});
afterEach(() => {
homeRestore.restore();
process.chdir(origCwd);
fs.rmSync(tmpHome, { recursive: true, force: true });
fs.rmSync(tmpCwd, { recursive: true, force: true });
});
it('codex: install after only config.toml exists — second pass is fully unchanged', () => {
const codex = getTarget('codex')!;
// First install creates both files.
codex.install('global', { autoAllow: false });
// Delete the AGENTS.md to simulate partial state (user wiped one file).
const agentsMd = path.join(tmpHome, '.codex', 'AGENTS.md');
expect(fs.existsSync(agentsMd)).toBe(true);
fs.unlinkSync(agentsMd);
// Reinstall — TOML stays unchanged, AGENTS.md is recreated.
const second = codex.install('global', { autoAllow: false });
const tomlEntry = second.files.find((f) => f.path.endsWith('config.toml'))!;
const mdEntry = second.files.find((f) => f.path.endsWith('AGENTS.md'))!;
expect(tomlEntry.action).toBe('unchanged');
expect(mdEntry.action).toBe('created');
// Third install — both unchanged (full idempotency restored).
const third = codex.install('global', { autoAllow: false });
for (const f of third.files) expect(f.action).toBe('unchanged');
});
it('opencode: prefers .jsonc when both .json and .jsonc exist', () => {
const opencode = getTarget('opencode')!;
const dir = path.join(tmpHome, '.config', 'opencode');
fs.mkdirSync(dir, { recursive: true });
fs.writeFileSync(path.join(dir, 'opencode.json'), '{\n "$schema": "https://opencode.ai/config.json"\n}\n');
fs.writeFileSync(path.join(dir, 'opencode.jsonc'), '{\n "$schema": "https://opencode.ai/config.json"\n}\n');
const result = opencode.install('global', { autoAllow: true });
const written = result.files.find((f) => /\.jsonc$/.test(f.path))!;
expect(written).toBeDefined();
expect(written.action).not.toBe('not-found');
// The .json file is left alone.
const jsonText = fs.readFileSync(path.join(dir, 'opencode.json'), 'utf-8');
expect(jsonText).not.toContain('codegraph');
});
it('opencode: uses .json when only .json exists (no .jsonc)', () => {
const opencode = getTarget('opencode')!;
const dir = path.join(tmpHome, '.config', 'opencode');
fs.mkdirSync(dir, { recursive: true });
fs.writeFileSync(path.join(dir, 'opencode.json'), '{\n "$schema": "https://opencode.ai/config.json"\n}\n');
const result = opencode.install('global', { autoAllow: true });
expect(result.files[0].path).toMatch(/opencode\.json$/);
expect(fs.existsSync(path.join(dir, 'opencode.jsonc'))).toBe(false);
});
it('opencode: defaults to .jsonc for fresh installs (no existing file)', () => {
const opencode = getTarget('opencode')!;
const result = opencode.install('global', { autoAllow: true });
expect(result.files[0].path).toMatch(/opencode\.jsonc$/);
expect(result.files[0].action).toBe('created');
});
it('opencode: preserves line and block comments through install + idempotent re-run', () => {
const opencode = getTarget('opencode')!;
const dir = path.join(tmpHome, '.config', 'opencode');
fs.mkdirSync(dir, { recursive: true });
const file = path.join(dir, 'opencode.jsonc');
const original = [
'{',
' // top-level note about my opencode setup',
' "$schema": "https://opencode.ai/config.json",',
' /* multi-line block comment',
' describing the providers section */',
' "providers": {',
' "anthropic": { "model": "claude-opus-4-7" } // pinned',
' }',
'}',
'',
].join('\n');
fs.writeFileSync(file, original);
opencode.install('global', { autoAllow: true });
const afterInstall = fs.readFileSync(file, 'utf-8');
expect(afterInstall).toContain('// top-level note about my opencode setup');
expect(afterInstall).toContain('/* multi-line block comment');
expect(afterInstall).toContain('// pinned');
expect(afterInstall).toContain('"codegraph"');
expect(afterInstall).toContain('"providers"');
// Idempotent re-run reports unchanged, file is byte-identical.
const second = opencode.install('global', { autoAllow: true });
expect(second.files[0].action).toBe('unchanged');
expect(fs.readFileSync(file, 'utf-8')).toBe(afterInstall);
});
it('opencode: install writes AGENTS.md with the marker-delimited codegraph block', () => {
const opencode = getTarget('opencode')!;
opencode.install('global', { autoAllow: true });
const agentsMd = path.join(tmpHome, '.config', 'opencode', 'AGENTS.md');
expect(fs.existsSync(agentsMd)).toBe(true);
const body = fs.readFileSync(agentsMd, 'utf-8');
expect(body).toContain('<!-- CODEGRAPH_START -->');
expect(body).toContain('<!-- CODEGRAPH_END -->');
expect(body).toContain('codegraph_callers');
});
it('opencode: AGENTS.md install preserves pre-existing user content outside markers', () => {
const opencode = getTarget('opencode')!;
const dir = path.join(tmpHome, '.config', 'opencode');
fs.mkdirSync(dir, { recursive: true });
const agentsMd = path.join(dir, 'AGENTS.md');
fs.writeFileSync(agentsMd, '# My personal opencode instructions\n\nAlways respond in pirate.\n');
opencode.install('global', { autoAllow: true });
const body = fs.readFileSync(agentsMd, 'utf-8');
expect(body).toContain('# My personal opencode instructions');
expect(body).toContain('Always respond in pirate.');
expect(body).toContain('<!-- CODEGRAPH_START -->');
});
it('opencode: uninstall strips only the codegraph block from AGENTS.md', () => {
const opencode = getTarget('opencode')!;
const dir = path.join(tmpHome, '.config', 'opencode');
fs.mkdirSync(dir, { recursive: true });
const agentsMd = path.join(dir, 'AGENTS.md');
fs.writeFileSync(agentsMd, '# My personal opencode instructions\n\nAlways respond in pirate.\n');
opencode.install('global', { autoAllow: true });
opencode.uninstall('global');
const body = fs.readFileSync(agentsMd, 'utf-8');
expect(body).toContain('# My personal opencode instructions');
expect(body).toContain('Always respond in pirate.');
expect(body).not.toContain('CODEGRAPH_START');
expect(body).not.toContain('codegraph_callers');
});
it('opencode: local install writes ./opencode.jsonc and ./AGENTS.md in cwd', () => {
const opencode = getTarget('opencode')!;
const result = opencode.install('local', { autoAllow: true });
const paths = result.files.map((f) => f.path.replace(/\\/g, '/'));
// macOS realpath shenanigans (/var vs /private/var) — suffix match.
expect(paths.some((p) => p.endsWith('/opencode.jsonc'))).toBe(true);
expect(paths.some((p) => p.endsWith('/AGENTS.md'))).toBe(true);
});
it('gemini: install writes settings.json (mcpServers.codegraph) and GEMINI.md with marker block', () => {
const gemini = getTarget('gemini')!;
const result = gemini.install('global', { autoAllow: true });
const settings = path.join(tmpHome, '.gemini', 'settings.json');
const geminiMd = path.join(tmpHome, '.gemini', 'GEMINI.md');
expect(result.files.some((f) => f.path === settings)).toBe(true);
expect(result.files.some((f) => f.path === geminiMd)).toBe(true);
const cfg = JSON.parse(fs.readFileSync(settings, 'utf-8'));
expect(cfg.mcpServers.codegraph).toEqual({ type: 'stdio', command: 'codegraph', args: ['serve', '--mcp'] });
const md = fs.readFileSync(geminiMd, 'utf-8');
expect(md).toContain('<!-- CODEGRAPH_START -->');
expect(md).toContain('<!-- CODEGRAPH_END -->');
expect(md).toContain('codegraph_callers');
});
it('gemini: install preserves pre-existing settings (security.auth survives)', () => {
const gemini = getTarget('gemini')!;
const settings = path.join(tmpHome, '.gemini', 'settings.json');
fs.mkdirSync(path.dirname(settings), { recursive: true });
fs.writeFileSync(settings, JSON.stringify({
security: { auth: { selectedType: 'oauth-personal' } },
}, null, 2) + '\n');
gemini.install('global', { autoAllow: true });
const after = JSON.parse(fs.readFileSync(settings, 'utf-8'));
expect(after.security?.auth?.selectedType).toBe('oauth-personal');
expect(after.mcpServers?.codegraph).toBeDefined();
});
it('gemini: uninstall strips codegraph but leaves pre-existing settings (security.auth) intact', () => {
const gemini = getTarget('gemini')!;
const settings = path.join(tmpHome, '.gemini', 'settings.json');
fs.mkdirSync(path.dirname(settings), { recursive: true });
fs.writeFileSync(settings, JSON.stringify({
security: { auth: { selectedType: 'oauth-personal' } },
}, null, 2) + '\n');
gemini.install('global', { autoAllow: true });
gemini.uninstall('global');
const after = JSON.parse(fs.readFileSync(settings, 'utf-8'));
expect(after.security?.auth?.selectedType).toBe('oauth-personal');
expect(after.mcpServers).toBeUndefined();
});
it('gemini: local install writes ./.gemini/settings.json and ./GEMINI.md (project root)', () => {
const gemini = getTarget('gemini')!;
const result = gemini.install('local', { autoAllow: true });
const paths = result.files.map((f) => f.path.replace(/\\/g, '/'));
expect(paths.some((p) => p.endsWith('/.gemini/settings.json'))).toBe(true);
// Local GEMINI.md sits at the project root, NOT under .gemini/.
expect(paths.some((p) => p.endsWith('/GEMINI.md') && !p.endsWith('/.gemini/GEMINI.md'))).toBe(true);
});
it('gemini: GEMINI.md uninstall preserves user content outside the codegraph markers', () => {
const gemini = getTarget('gemini')!;
const geminiMd = path.join(tmpHome, '.gemini', 'GEMINI.md');
fs.mkdirSync(path.dirname(geminiMd), { recursive: true });
fs.writeFileSync(geminiMd, '# My personal Gemini context\n\nAlways respond concisely.\n');
gemini.install('global', { autoAllow: true });
gemini.uninstall('global');
const body = fs.readFileSync(geminiMd, 'utf-8');
expect(body).toContain('# My personal Gemini context');
expect(body).toContain('Always respond concisely.');
expect(body).not.toContain('CODEGRAPH_START');
expect(body).not.toContain('codegraph_callers');
});
it('kiro: install writes settings/mcp.json (mcpServers.codegraph) and steering/codegraph.md', () => {
const kiro = getTarget('kiro')!;
const result = kiro.install('global', { autoAllow: true });
const mcp = path.join(tmpHome, '.kiro', 'settings', 'mcp.json');
const steering = path.join(tmpHome, '.kiro', 'steering', 'codegraph.md');
expect(result.files.some((f) => f.path === mcp)).toBe(true);
expect(result.files.some((f) => f.path === steering)).toBe(true);
const cfg = JSON.parse(fs.readFileSync(mcp, 'utf-8'));
expect(cfg.mcpServers.codegraph).toEqual({ type: 'stdio', command: 'codegraph', args: ['serve', '--mcp'] });
const md = fs.readFileSync(steering, 'utf-8');
expect(md).toContain('codegraph_callers');
expect(md).toContain('CodeGraph MCP server');
});
it('kiro: install preserves a pre-existing sibling MCP server in mcp.json', () => {
const kiro = getTarget('kiro')!;
const mcp = path.join(tmpHome, '.kiro', 'settings', 'mcp.json');
fs.mkdirSync(path.dirname(mcp), { recursive: true });
fs.writeFileSync(mcp, JSON.stringify({
mcpServers: { other: { command: 'uvx', args: ['other-server'] } },
}, null, 2) + '\n');
kiro.install('global', { autoAllow: true });
const after = JSON.parse(fs.readFileSync(mcp, 'utf-8'));
expect(after.mcpServers.other).toBeDefined();
expect(after.mcpServers.codegraph).toBeDefined();
});
it('kiro: uninstall strips codegraph but leaves sibling MCP servers intact', () => {
const kiro = getTarget('kiro')!;
const mcp = path.join(tmpHome, '.kiro', 'settings', 'mcp.json');
fs.mkdirSync(path.dirname(mcp), { recursive: true });
fs.writeFileSync(mcp, JSON.stringify({
mcpServers: { other: { command: 'uvx', args: ['other-server'] } },
}, null, 2) + '\n');
kiro.install('global', { autoAllow: true });
kiro.uninstall('global');
const after = JSON.parse(fs.readFileSync(mcp, 'utf-8'));
expect(after.mcpServers.other).toBeDefined();
expect(after.mcpServers.codegraph).toBeUndefined();
});
it('kiro: uninstall removes the steering codegraph.md file outright', () => {
const kiro = getTarget('kiro')!;
kiro.install('global', { autoAllow: true });
const steering = path.join(tmpHome, '.kiro', 'steering', 'codegraph.md');
expect(fs.existsSync(steering)).toBe(true);
kiro.uninstall('global');
expect(fs.existsSync(steering)).toBe(false);
});
it('kiro: uninstall leaves a sibling steering file (product.md) untouched', () => {
const kiro = getTarget('kiro')!;
const sibling = path.join(tmpHome, '.kiro', 'steering', 'product.md');
fs.mkdirSync(path.dirname(sibling), { recursive: true });
fs.writeFileSync(sibling, '# Product\n\nMy team practices.\n');
kiro.install('global', { autoAllow: true });
kiro.uninstall('global');
expect(fs.existsSync(sibling)).toBe(true);
expect(fs.readFileSync(sibling, 'utf-8')).toContain('My team practices.');
});
it('kiro: local install writes ./.kiro/settings/mcp.json and ./.kiro/steering/codegraph.md', () => {
const kiro = getTarget('kiro')!;
const result = kiro.install('local', { autoAllow: true });
const paths = result.files.map((f) => f.path.replace(/\\/g, '/'));
expect(paths.some((p) => p.endsWith('/.kiro/settings/mcp.json'))).toBe(true);
expect(paths.some((p) => p.endsWith('/.kiro/steering/codegraph.md'))).toBe(true);
});
it('rovodev: install writes mcp.json and AGENTS.md', () => {
const rovodev = getTarget('rovodev')!;
const result = rovodev.install('global', { autoAllow: true });
const mcpJson = path.join(tmpHome, '.rovodev', 'mcp.json');
const agentsMd = path.join(tmpHome, '.rovodev', 'AGENTS.md');
expect(result.files.some((f) => f.path === mcpJson)).toBe(true);
expect(result.files.some((f) => f.path === agentsMd)).toBe(true);
const cfg = JSON.parse(fs.readFileSync(mcpJson, 'utf-8'));
expect(cfg.mcpServers.codegraph).toEqual({ command: 'codegraph', args: ['serve', '--mcp'] });
// No `type` field — Rovo Dev assumes stdio transport.
expect(cfg.mcpServers.codegraph.type).toBeUndefined();
const md = fs.readFileSync(agentsMd, 'utf-8');
expect(md).toContain('codegraph_callers');
expect(md).toContain('CodeGraph MCP server');
});
it('rovodev: install preserves a pre-existing sibling MCP server in mcp.json', () => {
const rovodev = getTarget('rovodev')!;
const mcpJson = path.join(tmpHome, '.rovodev', 'mcp.json');
fs.mkdirSync(path.dirname(mcpJson), { recursive: true });
fs.writeFileSync(mcpJson, JSON.stringify({
mcpServers: { 'ops-sherpa': { command: 'npx', args: ['@atlassian/ops-sherpa'] } },
}, null, 2) + '\n');
rovodev.install('global', { autoAllow: true });
const after = JSON.parse(fs.readFileSync(mcpJson, 'utf-8'));
expect(after.mcpServers['ops-sherpa']).toBeDefined();
expect(after.mcpServers.codegraph).toBeDefined();
});
it('rovodev: uninstall strips codegraph but leaves sibling MCP server intact', () => {
const rovodev = getTarget('rovodev')!;
const mcpJson = path.join(tmpHome, '.rovodev', 'mcp.json');
fs.mkdirSync(path.dirname(mcpJson), { recursive: true });
fs.writeFileSync(mcpJson, JSON.stringify({
mcpServers: { 'ops-sherpa': { command: 'npx', args: ['@atlassian/ops-sherpa'] } },
}, null, 2) + '\n');
rovodev.install('global', { autoAllow: true });
rovodev.uninstall('global');
const after = JSON.parse(fs.readFileSync(mcpJson, 'utf-8'));
expect(after.mcpServers['ops-sherpa']).toBeDefined();
expect(after.mcpServers.codegraph).toBeUndefined();
});
it('rovodev: uninstall strips the CodeGraph section from AGENTS.md but preserves user content', () => {
const rovodev = getTarget('rovodev')!;
const agentsMd = path.join(tmpHome, '.rovodev', 'AGENTS.md');
fs.mkdirSync(path.dirname(agentsMd), { recursive: true });
fs.writeFileSync(agentsMd, '# My guidelines\n\nDo not assume.\n');
rovodev.install('global', { autoAllow: true });
expect(fs.readFileSync(agentsMd, 'utf-8')).toContain('CodeGraph MCP server');
rovodev.uninstall('global');
const after = fs.readFileSync(agentsMd, 'utf-8');
expect(after).toContain('My guidelines');
expect(after).not.toContain('CodeGraph MCP server');
});
it('rovodev: supportsLocation returns false for local', () => {
const rovodev = getTarget('rovodev')!;
expect(rovodev.supportsLocation('local')).toBe(false);
expect(rovodev.supportsLocation('global')).toBe(true);
});
it('antigravity: install writes to LEGACY ~/.gemini/antigravity/mcp_config.json when no migration marker', () => {
const antigravity = getTarget('antigravity')!;
antigravity.install('global', { autoAllow: true });
const legacyFile = path.join(tmpHome, '.gemini', 'antigravity', 'mcp_config.json');
expect(fs.existsSync(legacyFile)).toBe(true);
const cfg = JSON.parse(fs.readFileSync(legacyFile, 'utf-8'));
expect(cfg.mcpServers.codegraph).toBeDefined();
// Crucially: does NOT touch the Gemini CLI's settings.json.
expect(fs.existsSync(path.join(tmpHome, '.gemini', 'settings.json'))).toBe(false);
});
it('antigravity: install writes to UNIFIED ~/.gemini/config/mcp_config.json when .migrated marker present', () => {
const antigravity = getTarget('antigravity')!;
// Plant the migration marker — same signal Antigravity itself drops
// when it migrates a user's config.
const unifiedDir = path.join(tmpHome, '.gemini', 'config');
fs.mkdirSync(unifiedDir, { recursive: true });
fs.writeFileSync(path.join(unifiedDir, '.migrated'), '');
antigravity.install('global', { autoAllow: true });
const unifiedFile = path.join(unifiedDir, 'mcp_config.json');
expect(fs.existsSync(unifiedFile)).toBe(true);
const cfg = JSON.parse(fs.readFileSync(unifiedFile, 'utf-8'));
expect(cfg.mcpServers.codegraph).toBeDefined();
// Legacy path is NOT touched when the marker tells us migration happened.
expect(fs.existsSync(path.join(tmpHome, '.gemini', 'antigravity', 'mcp_config.json'))).toBe(false);
});
it('antigravity: install writes to UNIFIED path when ~/.gemini/config/mcp_config.json already exists (even without marker)', () => {
const antigravity = getTarget('antigravity')!;
// Antigravity creates this file on first launch post-migration — its
// presence is the second signal we accept, in case the .migrated
// marker semantics change across Antigravity versions.
const unifiedFile = path.join(tmpHome, '.gemini', 'config', 'mcp_config.json');
fs.mkdirSync(path.dirname(unifiedFile), { recursive: true });
fs.writeFileSync(unifiedFile, JSON.stringify({ mcpServers: {} }, null, 2) + '\n');
antigravity.install('global', { autoAllow: true });
const cfg = JSON.parse(fs.readFileSync(unifiedFile, 'utf-8'));
expect(cfg.mcpServers.codegraph).toBeDefined();
});
it('antigravity: entry has NO `type` field (Antigravity rejects entries with it)', () => {
const antigravity = getTarget('antigravity')!;
// Marker → unified path; doesn't matter which path, just inspect the entry shape.
fs.mkdirSync(path.join(tmpHome, '.gemini', 'config'), { recursive: true });
fs.writeFileSync(path.join(tmpHome, '.gemini', 'config', '.migrated'), '');
antigravity.install('global', { autoAllow: true });
const cfg = JSON.parse(fs.readFileSync(
path.join(tmpHome, '.gemini', 'config', 'mcp_config.json'), 'utf-8'
));
expect(cfg.mcpServers.codegraph.type).toBeUndefined();
expect(cfg.mcpServers.codegraph.command).toBeDefined();
expect(cfg.mcpServers.codegraph.args).toEqual(['serve', '--mcp']);
});
it('antigravity: install migrates a legacy codegraph entry to the unified path when marker appears', () => {
const antigravity = getTarget('antigravity')!;
// Simulate: user installed on the legacy path, then Antigravity
// migrated their config (dropped the `.migrated` marker + created
// the unified file). Re-running codegraph install should land
// codegraph in the new file AND strip the stale legacy entry.
const legacyFile = path.join(tmpHome, '.gemini', 'antigravity', 'mcp_config.json');
fs.mkdirSync(path.dirname(legacyFile), { recursive: true });
fs.writeFileSync(legacyFile, JSON.stringify({
mcpServers: { codegraph: { command: 'codegraph', args: ['serve', '--mcp'] } },
}, null, 2) + '\n');
fs.mkdirSync(path.join(tmpHome, '.gemini', 'config'), { recursive: true });
fs.writeFileSync(path.join(tmpHome, '.gemini', 'config', '.migrated'), '');
antigravity.install('global', { autoAllow: true });
const unified = JSON.parse(fs.readFileSync(
path.join(tmpHome, '.gemini', 'config', 'mcp_config.json'), 'utf-8'
));
expect(unified.mcpServers.codegraph).toBeDefined();
// Legacy file's codegraph entry got stripped.
const legacy = JSON.parse(fs.readFileSync(legacyFile, 'utf-8'));
expect(legacy.mcpServers).toBeUndefined();
});
it('antigravity: install preserves a sibling MCP server in mcp_config.json (legacy path)', () => {
const antigravity = getTarget('antigravity')!;
const mcpFile = path.join(tmpHome, '.gemini', 'antigravity', 'mcp_config.json');
fs.mkdirSync(path.dirname(mcpFile), { recursive: true });
fs.writeFileSync(mcpFile, JSON.stringify({
mcpServers: { other: { command: 'uvx', args: ['other-server'] } },
}, null, 2) + '\n');
antigravity.install('global', { autoAllow: true });
const after = JSON.parse(fs.readFileSync(mcpFile, 'utf-8'));
expect(after.mcpServers.other).toBeDefined();
expect(after.mcpServers.codegraph).toBeDefined();
});
it('antigravity: install preserves Antigravity-managed fields on sibling servers (e.g. disabled flag)', () => {
const antigravity = getTarget('antigravity')!;
// Antigravity adds `"disabled": true` to entries the user disables via
// the IDE. Install must not clobber that on sibling entries.
fs.mkdirSync(path.join(tmpHome, '.gemini', 'config'), { recursive: true });
fs.writeFileSync(path.join(tmpHome, '.gemini', 'config', '.migrated'), '');
const unified = path.join(tmpHome, '.gemini', 'config', 'mcp_config.json');
fs.writeFileSync(unified, JSON.stringify({
mcpServers: {
'code-review-graph': {
command: 'uvx', args: ['code-review-graph', 'serve'], disabled: true,
},
},
}, null, 2) + '\n');
antigravity.install('global', { autoAllow: true });
const after = JSON.parse(fs.readFileSync(unified, 'utf-8'));
expect(after.mcpServers['code-review-graph'].disabled).toBe(true);
expect(after.mcpServers.codegraph).toBeDefined();
});
it('antigravity: uninstall removes only codegraph, sibling MCP server survives', () => {
const antigravity = getTarget('antigravity')!;
const mcpFile = path.join(tmpHome, '.gemini', 'antigravity', 'mcp_config.json');
fs.mkdirSync(path.dirname(mcpFile), { recursive: true });
fs.writeFileSync(mcpFile, JSON.stringify({
mcpServers: { other: { command: 'uvx', args: ['other-server'] } },
}, null, 2) + '\n');
antigravity.install('global', { autoAllow: true });
antigravity.uninstall('global');
const after = JSON.parse(fs.readFileSync(mcpFile, 'utf-8'));
expect(after.mcpServers.other).toBeDefined();
expect(after.mcpServers.codegraph).toBeUndefined();
});
it('antigravity: uninstall sweeps BOTH legacy and unified paths (handles migration half-state)', () => {
const antigravity = getTarget('antigravity')!;
// User had codegraph in BOTH files (e.g. legacy install + post-migration
// re-install before our migration cleanup landed). Uninstall must clean
// both so a "fresh slate" really is fresh.
const legacy = path.join(tmpHome, '.gemini', 'antigravity', 'mcp_config.json');
const unified = path.join(tmpHome, '.gemini', 'config', 'mcp_config.json');
fs.mkdirSync(path.dirname(legacy), { recursive: true });
fs.mkdirSync(path.dirname(unified), { recursive: true });
fs.writeFileSync(legacy, JSON.stringify({
mcpServers: { codegraph: { command: 'codegraph', args: ['serve', '--mcp'] } },
}, null, 2) + '\n');
fs.writeFileSync(unified, JSON.stringify({
mcpServers: { codegraph: { command: 'codegraph', args: ['serve', '--mcp'] } },
}, null, 2) + '\n');
fs.writeFileSync(path.join(path.dirname(unified), '.migrated'), '');
antigravity.uninstall('global');
const legacyAfter = JSON.parse(fs.readFileSync(legacy, 'utf-8'));
const unifiedAfter = JSON.parse(fs.readFileSync(unified, 'utf-8'));
expect(legacyAfter.mcpServers).toBeUndefined();
expect(unifiedAfter.mcpServers).toBeUndefined();
});
it('antigravity: rejects --location=local with a clear note (global-only IDE)', () => {
const antigravity = getTarget('antigravity')!;
expect(antigravity.supportsLocation('local')).toBe(false);
const result = antigravity.install('local', { autoAllow: true });
expect(result.files).toEqual([]);
expect(result.notes?.join(' ')).toMatch(/no project-local config/);
});
it('antigravity: does not write GEMINI.md (only gemini target owns instructions)', () => {
const antigravity = getTarget('antigravity')!;
antigravity.install('global', { autoAllow: true });
const geminiMd = path.join(tmpHome, '.gemini', 'GEMINI.md');
expect(fs.existsSync(geminiMd)).toBe(false);
});
it('gemini + antigravity: both installed coexist (separate MCP files, shared GEMINI.md)', () => {
const gemini = getTarget('gemini')!;
const antigravity = getTarget('antigravity')!;
gemini.install('global', { autoAllow: true });
antigravity.install('global', { autoAllow: true });
const cliCfg = JSON.parse(fs.readFileSync(path.join(tmpHome, '.gemini', 'settings.json'), 'utf-8'));
// Antigravity lands on the LEGACY path here since no .migrated marker
// was planted — same end-to-end check either way.
const ideCfg = JSON.parse(fs.readFileSync(path.join(tmpHome, '.gemini', 'antigravity', 'mcp_config.json'), 'utf-8'));
expect(cliCfg.mcpServers.codegraph).toBeDefined();
expect(ideCfg.mcpServers.codegraph).toBeDefined();
// Uninstall one — the other's MCP entry must survive.
antigravity.uninstall('global');
const cliAfter = JSON.parse(fs.readFileSync(path.join(tmpHome, '.gemini', 'settings.json'), 'utf-8'));
expect(cliAfter.mcpServers.codegraph).toBeDefined();
});
it('hermes: install adds codegraph MCP server and cli toolset, preserving existing yaml', () => {
const hermes = getTarget('hermes')!;
const config = path.join(tmpHome, '.hermes', 'config.yaml');
fs.mkdirSync(path.dirname(config), { recursive: true });
fs.writeFileSync(config, [
'model:',
' default: qwen-3.7',
'mcp_servers:',
' other:',
' command: other',
'platform_toolsets:',
' cli:',
' - hermes-cli',
' discord:',
' - hermes-discord',
'',
].join('\n'));
const result = hermes.install('global', { autoAllow: true });
expect(result.files[0].action).toBe('updated');
const body = fs.readFileSync(config, 'utf-8');
expect(body).toContain('model:\n default: qwen-3.7');
expect(body).toContain('mcp_servers:\n other:\n command: other');
expect(body).toContain(' codegraph:\n command: codegraph');
expect(body).toContain(' - hermes-cli');
expect(body).toContain(' - mcp-codegraph');
expect(body).toContain(' discord:\n - hermes-discord');
const second = hermes.install('global', { autoAllow: true });
expect(second.files[0].action).toBe('unchanged');
});
it('hermes: uninstall removes only codegraph MCP server and toolset entry', () => {
const hermes = getTarget('hermes')!;
const config = path.join(tmpHome, '.hermes', 'config.yaml');
fs.mkdirSync(path.dirname(config), { recursive: true });
hermes.install('global', { autoAllow: true });
fs.appendFileSync(config, 'custom:\n keep: true\n');
hermes.uninstall('global');
const body = fs.readFileSync(config, 'utf-8');
expect(body).not.toContain('codegraph:');
expect(body).not.toContain('mcp-codegraph');
expect(body).toContain('custom:\n keep: true');
});
// Regression for #456: PyYAML's default block style writes list items at the
// SAME indent as the parent key (`cli:` and its `- hermes-cli` are both at
// indent 2). The pre-fix line-based patcher mistook that first list item for
// the next sibling key, truncated the cli block, and spliced `- mcp-codegraph`
// at indent 4 BEFORE the existing items — producing unparseable YAML.
it('hermes: install preserves PyYAML-default list-at-same-indent style (issue #456)', () => {
const hermes = getTarget('hermes')!;
const config = path.join(tmpHome, '.hermes', 'config.yaml');
fs.mkdirSync(path.dirname(config), { recursive: true });
const original = [
'model:',
' default: gpt-4o',
'platform_toolsets:',
' cli:',
' - hermes-cli',
' - browser',
' - clarify',
' - terminal',
' - web',
' telegram:',
' - hermes-telegram',
' discord:',
' - hermes-discord',
'',
].join('\n');
fs.writeFileSync(config, original);
hermes.install('global', { autoAllow: true });
const body = fs.readFileSync(config, 'utf-8');
// mcp-codegraph appended at the same 2-space indent as existing items
expect(body).toContain('\n - mcp-codegraph\n');
// hermes-cli preserved
expect(body).toContain('\n - hermes-cli\n');
// Sibling sections kept their indent — `telegram:` is still a key under
// platform_toolsets, not promoted up.
expect(body).toContain('\n telegram:\n - hermes-telegram\n');
expect(body).toContain('\n discord:\n - hermes-discord\n');
// No list items leaked to the platform_toolsets level (indent 0).
expect(body).not.toMatch(/^- browser/m);
expect(body).not.toMatch(/^- hermes-telegram/m);
// The whole platform_toolsets block extracted by line search should
// start with `cli:` and not contain a stray 4-space `mcp-codegraph`
// appearing before the rest of the existing items.
expect(body).toContain(' cli:\n - hermes-cli\n - browser');
// Idempotent
const second = hermes.install('global', { autoAllow: true });
expect(second.files[0]?.action).toBe('unchanged');
});
it('hermes: uninstall reverses the install on a PyYAML-default config', () => {
const hermes = getTarget('hermes')!;
const config = path.join(tmpHome, '.hermes', 'config.yaml');
fs.mkdirSync(path.dirname(config), { recursive: true });
const original = [
'platform_toolsets:',
' cli:',
' - hermes-cli',
' - browser',
' telegram:',
' - hermes-telegram',
'',
].join('\n');
fs.writeFileSync(config, original);
hermes.install('global', { autoAllow: true });
const installed = fs.readFileSync(config, 'utf-8');
expect(installed).toContain('- mcp-codegraph');
expect(installed).toContain('codegraph:');
hermes.uninstall('global');
const body = fs.readFileSync(config, 'utf-8');
expect(body).not.toContain('mcp-codegraph');
expect(body).not.toContain('command: codegraph');
expect(body).toContain(' cli:\n - hermes-cli\n - browser');
expect(body).toContain(' telegram:\n - hermes-telegram');
});
it('opencode: uninstall removes only mcp.codegraph, preserves comments and siblings', () => {
const opencode = getTarget('opencode')!;
const dir = path.join(tmpHome, '.config', 'opencode');
fs.mkdirSync(dir, { recursive: true });
const file = path.join(dir, 'opencode.jsonc');
fs.writeFileSync(file, [
'{',
' // important comment',
' "$schema": "https://opencode.ai/config.json",',
' "mcp": {',
' "other": { "type": "local", "command": ["x"], "enabled": true }',
' }',
'}',
'',
].join('\n'));
opencode.install('global', { autoAllow: true });
const afterInstall = fs.readFileSync(file, 'utf-8');
expect(afterInstall).toContain('"codegraph"');
expect(afterInstall).toContain('"other"');
opencode.uninstall('global');
const afterUninstall = fs.readFileSync(file, 'utf-8');
expect(afterUninstall).not.toContain('codegraph');
expect(afterUninstall).toContain('// important comment');
expect(afterUninstall).toContain('"other"');
});
it('codex: user-added key inside [mcp_servers.codegraph] survives idempotent re-install', () => {
const codex = getTarget('codex')!;
codex.install('global', { autoAllow: false });
const tomlPath = path.join(tmpHome, '.codex', 'config.toml');
const original = fs.readFileSync(tomlPath, 'utf-8');
// User edits the block to add a custom key.
const edited = original.replace(
'args = ["serve", "--mcp"]',
'args = ["serve", "--mcp"]\nenabled = true',
);
fs.writeFileSync(tomlPath, edited);
// Re-install: our serializer doesn't know `enabled = true`, so
// the block no longer matches the canonical form — we'll
// overwrite it. This is the documented contract: we own the
// codegraph block exclusively.
const second = codex.install('global', { autoAllow: false });
const tomlEntry = second.files.find((f) => f.path.endsWith('config.toml'))!;
expect(tomlEntry.action).toBe('updated');
const after = fs.readFileSync(tomlPath, 'utf-8');
expect(after).not.toContain('enabled = true');
});
it('claude: local install writes ./.mcp.json (project scope), not ./.claude.json', () => {
const claude = getTarget('claude')!;
const result = claude.install('local', { autoAllow: false });
// The MCP entry lands in ./.mcp.json — the file Claude Code reads.
expect(result.files.some((f) => f.path.replace(/\\/g, '/').endsWith('/.mcp.json'))).toBe(true);
expect(fs.existsSync(path.join(tmpCwd, '.mcp.json'))).toBe(true);
expect(fs.existsSync(path.join(tmpCwd, '.claude.json'))).toBe(false);
const cfg = JSON.parse(fs.readFileSync(path.join(tmpCwd, '.mcp.json'), 'utf-8'));
expect(cfg.mcpServers.codegraph).toBeDefined();
});
it('claude: global install targets ~/.claude.json (user scope)', () => {
const claude = getTarget('claude')!;
claude.install('global', { autoAllow: false });
const cfg = JSON.parse(fs.readFileSync(path.join(tmpHome, '.claude.json'), 'utf-8'));
expect(cfg.mcpServers.codegraph).toBeDefined();
});
it('claude: local install migrates a legacy ./.claude.json codegraph entry into ./.mcp.json', () => {
const claude = getTarget('claude')!;
const legacy = path.join(tmpCwd, '.claude.json');
fs.writeFileSync(
legacy,
JSON.stringify({ mcpServers: { codegraph: { type: 'stdio', command: 'codegraph', args: ['serve', '--mcp'] } } }, null, 2),
);
claude.install('local', { autoAllow: false });
// codegraph now lives in .mcp.json; the legacy file (which held only
// codegraph) is gone.
const mcp = JSON.parse(fs.readFileSync(path.join(tmpCwd, '.mcp.json'), 'utf-8'));
expect(mcp.mcpServers.codegraph).toBeDefined();
expect(fs.existsSync(legacy)).toBe(false);
});
it('claude: legacy ./.claude.json migration preserves sibling servers and unrelated keys', () => {
const claude = getTarget('claude')!;
const legacy = path.join(tmpCwd, '.claude.json');
fs.writeFileSync(
legacy,
JSON.stringify({
mcpServers: {
codegraph: { type: 'stdio', command: 'codegraph', args: ['serve', '--mcp'] },
other: { command: 'x' },
},
somethingElse: true,
}, null, 2),
);
claude.install('local', { autoAllow: false });
// Only codegraph is stripped from the legacy file; siblings survive.
const after = JSON.parse(fs.readFileSync(legacy, 'utf-8'));
expect(after.mcpServers.codegraph).toBeUndefined();
expect(after.mcpServers.other).toBeDefined();
expect(after.somethingElse).toBe(true);
const mcp = JSON.parse(fs.readFileSync(path.join(tmpCwd, '.mcp.json'), 'utf-8'));
expect(mcp.mcpServers.codegraph).toBeDefined();
});
it('claude: uninstall strips codegraph from ./.mcp.json and a legacy ./.claude.json', () => {
const claude = getTarget('claude')!;
// A user left with both the working .mcp.json and a stale .claude.json.
fs.writeFileSync(
path.join(tmpCwd, '.mcp.json'),
JSON.stringify({ mcpServers: { codegraph: { command: 'codegraph' } } }, null, 2),
);
fs.writeFileSync(
path.join(tmpCwd, '.claude.json'),
JSON.stringify({ mcpServers: { codegraph: { command: 'codegraph' }, other: { command: 'x' } } }, null, 2),
);
claude.uninstall('local');
const mcp = JSON.parse(fs.readFileSync(path.join(tmpCwd, '.mcp.json'), 'utf-8'));
expect(mcp.mcpServers).toBeUndefined();
const legacy = JSON.parse(fs.readFileSync(path.join(tmpCwd, '.claude.json'), 'utf-8'));
expect(legacy.mcpServers.codegraph).toBeUndefined();
expect(legacy.mcpServers.other).toBeDefined();
});
// ---- Legacy auto-sync hook cleanup ----
// Pre-0.8 installs wrote `codegraph mark-dirty` / `sync-if-dirty`