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
//! The coding agents Ditto launches that are described by data rather than
//! code.
//!
//! The first tools each earned bespoke handling: opencode spreads itself over
//! three XDG bases, OMP is selected by name rather than by directory, Claude
//! Code carries a status line. The rest differ from one another only in what
//! they are called, which variable moves their directory, and which file in it
//! means they are signed in. A match arm per tool in every module would bury
//! those differences under the repetition, so each of these is one entry here
//! and one arm reading it everywhere else.
//!
//! Every fact in an entry was read from the tool's own documentation or source
//! rather than remembered, and the comment beside an entry says what was
//! uncertain when it was written. Any agent that runs in a terminal and can be
//! pointed at a directory belongs here; add it when it appears.
/// How a tool finds its directory, which is the one thing Ditto has to change
/// to run it as somebody else.
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub enum Home {
/// One variable names the directory. `native` is where the tool keeps it,
/// relative to the home directory, when the variable is unset.
Variable {
variable: &'static str,
native: &'static str,
},
/// The variable names a directory the tool creates `native` inside, as
/// `GEMINI_CLI_HOME` does. A managed profile is given a directory of its
/// own for it, the way a private home works, without touching `HOME`.
Parent {
variable: &'static str,
native: &'static str,
},
/// The tool appends `subdir` to each XDG base it reads, so a profile pins
/// the three bases the way it already does for opencode. Paths in the spec
/// then begin with the base they belong to: `config/`, `data/`, or `state/`.
Xdg { subdir: &'static str },
/// Nothing but `HOME` decides, so a managed profile is handed a private one
/// with the user's real home mirrored into it, as fx is. `native` is the
/// directory the tool makes inside it, and `owned` names any other entries
/// of the home that carry its account and so are not mirrored either.
Private {
native: &'static str,
owned: &'static [&'static str],
},
}
#[derive(Debug, Eq, Hash, PartialEq)]
pub struct Spec {
/// The subcommand, the shell function, the `tools[].tool` key, and the
/// directory name inside a profile. The same as the executable, so that
/// what a person types to run the tool is what they type to run it through
/// Ditto.
pub key: &'static str,
pub label: &'static str,
pub executable: &'static str,
/// Overrides the executable, as `DITTO_CLAUDE_BIN` does for Claude Code.
pub bin_variable: &'static str,
pub home: Home,
/// Set for managed profiles only, typically to move a login the tool would
/// otherwise keep in a user-wide keychain into the profile's directory,
/// where it can be somebody else's.
pub managed_env: &'static [(&'static str, &'static str)],
/// Files whose presence means the profile is signed in, relative to the
/// tool's directory. Empty when the tool keeps its login only in a keychain
/// or an environment variable, which Ditto cannot read.
pub credentials: &'static [&'static str],
/// Configuration a profile reads from the user's own copy rather than
/// starting without: settings, instructions, skills, commands. Never a
/// credential, a session, or a cache; see `shared.rs` for why the list
/// must stay an allowlist.
pub shared: &'static [&'static str],
/// Where conversations live, for `sync --history`.
pub sessions: &'static [&'static str],
/// Arguments that open the tool's own sign-in and sign-out. `None` when it
/// only signs in from inside its interface.
pub login: Option<&'static [&'static str]>,
pub logout: Option<&'static [&'static str]>,
}
impl Spec {
/// Position in [`ALL`], which is how per-tool state is stored without a
/// field per tool. Found by key rather than by address: `ALL` is a
/// constant, so a reference taken to it in one place need not point at the
/// same bytes as one taken elsewhere.
pub fn index(&'static self) -> usize {
ALL.iter()
.position(|spec| spec.key == self.key)
.expect("every Spec handed out is an entry of tools::ALL")
}
}
pub const ALL: &[Spec] = &[
Spec {
key: "gemini",
label: "Gemini CLI",
executable: "gemini",
bin_variable: "DITTO_GEMINI_BIN",
// `GEMINI_CLI_HOME` is the directory `.gemini` is created inside, not
// the directory itself. Leave `GEMINI_FORCE_ENCRYPTED_FILE_STORAGE`
// unset: it moves the login into the keychain, which is user-wide.
home: Home::Parent {
variable: "GEMINI_CLI_HOME",
native: ".gemini",
},
managed_env: &[],
credentials: &["oauth_creds.json", "google_accounts.json"],
shared: &[
"settings.json",
"GEMINI.md",
"keybindings.json",
"commands",
"skills",
"agents",
"policies",
"extensions",
"trustedFolders.json",
],
sessions: &["tmp", "history"],
login: None,
logout: None,
},
Spec {
key: "qwen",
label: "Qwen Code",
executable: "qwen",
bin_variable: "DITTO_QWEN_BIN",
home: Home::Variable {
variable: "QWEN_HOME",
native: ".qwen",
},
managed_env: &[],
credentials: &["oauth_creds.json"],
// `settings.json` carries `modelProviders[].apiKey`, so it stays with
// the account rather than being shared.
shared: &["memory.md", "commands", "skills", "workflows", "extensions"],
sessions: &["projects", "file-history"],
login: None,
logout: None,
},
Spec {
key: "openclaude",
label: "OpenClaude",
executable: "openclaude",
bin_variable: "DITTO_OPENCLAUDE_BIN",
// Reads its own variable and deliberately ignores `CLAUDE_CONFIG_DIR`.
// The login goes to the macOS Keychain first, which is user-wide, with
// `.credentials.json` only as its fallback; no switch forces the file.
home: Home::Variable {
variable: "OPENCLAUDE_CONFIG_DIR",
native: ".openclaude",
},
managed_env: &[],
credentials: &[".credentials.json"],
shared: &[
"settings.json",
"keybindings.json",
"CLAUDE.md",
"agents",
"commands",
"skills",
"plugins",
"hooks",
],
sessions: &["projects"],
login: Some(&["auth", "login"]),
logout: Some(&["auth", "logout"]),
},
Spec {
key: "copilot",
label: "Copilot",
executable: "copilot",
bin_variable: "DITTO_COPILOT_BIN",
// The token lives in the OS keychain keyed by GitHub host and user,
// not by `COPILOT_HOME`, and `config.json` exists whether or not it
// holds the plaintext fallback, so there is no file to read a login
// from. `COPILOT_GITHUB_TOKEN` in the environment outranks both.
home: Home::Variable {
variable: "COPILOT_HOME",
native: ".copilot",
},
managed_env: &[],
credentials: &[],
shared: &[
"settings.json",
"lsp-config.json",
"hooks",
"skills",
"agents",
"instructions",
],
sessions: &["session-state", "history-session-state"],
login: Some(&["login"]),
logout: None,
},
Spec {
key: "cursor-agent",
label: "Cursor Agent",
// Newer installers name the binary `agent` and keep `cursor-agent` as
// the compatible name; `DITTO_CURSOR_AGENT_BIN=agent` if only that one
// is present. `CURSOR_CONFIG_DIR` is documented for `cli-config.json`
// alone, so whether it also moves the chats is unverified.
executable: "cursor-agent",
bin_variable: "DITTO_CURSOR_AGENT_BIN",
home: Home::Variable {
variable: "CURSOR_CONFIG_DIR",
native: ".cursor",
},
// The credential store is the OS keychain unless asked for a file; the
// file's name is not documented, so the login still cannot be read.
managed_env: &[("AGENT_CLI_CREDENTIAL_STORE", "file")],
credentials: &[],
shared: &[
"settings.json",
"sandbox.json",
"hooks.json",
"agents",
"skills",
"plugins",
],
sessions: &["chats", "projects"],
login: Some(&["login"]),
logout: Some(&["logout"]),
},
Spec {
key: "grok",
label: "Grok",
executable: "grok",
bin_variable: "DITTO_GROK_BIN",
home: Home::Variable {
variable: "GROK_HOME",
native: ".grok",
},
managed_env: &[],
credentials: &["auth.json"],
shared: &[
"config.toml",
"managed_config.toml",
"hooks",
"skills",
"rules",
"workflows",
"memory",
],
sessions: &["sessions"],
login: Some(&["login"]),
logout: Some(&["logout"]),
},
Spec {
key: "devin",
label: "Devin",
executable: "devin",
bin_variable: "DITTO_DEVIN_BIN",
// Only the data base is documented by name; the configuration is said
// to follow the XDG convention without the variable being named, and
// the `DEVIN_HOME` third-party launchers set is not in Devin's own
// documentation. The data base also holds the downloaded CLI versions,
// so a managed profile downloads its own copy once.
home: Home::Xdg { subdir: "devin" },
managed_env: &[],
credentials: &["data/credentials.toml"],
shared: &["config/config.json", "config/skills"],
sessions: &["data/cli/transcripts"],
login: Some(&["auth", "login"]),
logout: Some(&["auth", "logout"]),
},
Spec {
key: "kimi",
label: "Kimi Code",
executable: "kimi",
bin_variable: "DITTO_KIMI_BIN",
home: Home::Variable {
variable: "KIMI_CODE_HOME",
native: ".kimi-code",
},
managed_env: &[],
credentials: &["credentials"],
// `config.toml` holds `[providers.*].api_key`, so it stays with the
// account.
shared: &["tui.toml", "AGENTS.md", "skills", "plugins"],
sessions: &["sessions", "user-history"],
login: Some(&["login"]),
logout: None,
},
Spec {
key: "cline",
label: "Cline",
executable: "cline",
bin_variable: "DITTO_CLINE_BIN",
// `CLINE_DIR` is read by the source but absent from the documented
// variable table; `--config <dir>` is its documented equivalent.
home: Home::Variable {
variable: "CLINE_DIR",
native: ".cline",
},
managed_env: &[],
credentials: &["data/settings/providers.json"],
shared: &[
"rules",
"skills",
"hooks",
"workflows",
"agents",
"plugins",
"data/settings/global-settings.json",
"data/settings/models.json",
],
sessions: &["data/db", "data/sessions"],
login: Some(&["auth"]),
logout: None,
},
Spec {
key: "codebuff",
label: "Codebuff",
executable: "codebuff",
bin_variable: "DITTO_CODEBUFF_BIN",
// Hard-coded below the home directory and not XDG, despite the path.
// The npm package is a launcher that downloads the real binary into
// this directory, which is why that download is shared rather than
// repeated per profile.
home: Home::Private {
native: ".config/manicode",
owned: &[],
},
managed_env: &[],
credentials: &["credentials.json"],
shared: &["settings.json", "codebuff"],
sessions: &["projects"],
login: Some(&["login"]),
logout: None,
},
Spec {
key: "cn",
label: "Continue",
executable: "cn",
bin_variable: "DITTO_CN_BIN",
// Current builds have no sign-in at all: Hub authentication was
// removed and model keys go in `config.yaml`, so there is no login to
// read. `auth.json` under this directory is where one would return.
home: Home::Variable {
variable: "CONTINUE_GLOBAL_DIR",
native: ".continue",
},
managed_env: &[],
credentials: &[],
shared: &[
"config.yaml",
"rules",
"prompts",
"skills",
"permissions.yaml",
"settings.json",
".continuerc.json",
],
sessions: &["sessions"],
login: None,
logout: None,
},
Spec {
key: "command-code",
label: "Command Code",
executable: "command-code",
bin_variable: "DITTO_COMMAND_CODE_BIN",
// Closed source; every path in the bundle is `HOME`, `USERPROFILE`, or
// the home directory, and no variable of its own was found.
home: Home::Private {
native: ".commandcode",
owned: &[],
},
managed_env: &[],
credentials: &["auth.json"],
shared: &[
"settings.json",
"providers.json",
"keybindings.json",
"skills",
"agents",
"commands",
"mods",
],
sessions: &["projects", "file-history"],
login: Some(&["login"]),
logout: Some(&["logout"]),
},
Spec {
key: "hermes",
label: "Hermes Agent",
executable: "hermes",
bin_variable: "DITTO_HERMES_BIN",
// Hermes falls back to the user's own `auth.json` when `HERMES_HOME`
// is inside `~/.hermes` or its parent is named `profiles`. A managed
// profile's directory is neither, which is what keeps that off.
home: Home::Variable {
variable: "HERMES_HOME",
native: ".hermes",
},
managed_env: &[],
credentials: &["auth.json", ".env"],
shared: &["config.yaml", "SOUL.md", "skills"],
sessions: &["sessions"],
login: None,
logout: None,
},
Spec {
key: "openclaw",
label: "OpenClaw",
executable: "openclaw",
bin_variable: "DITTO_OPENCLAW_BIN",
// `openclaw.json` carries `auth.profiles` beside the preferences, so it
// stays with the account rather than being shared.
home: Home::Variable {
variable: "OPENCLAW_STATE_DIR",
native: ".openclaw",
},
managed_env: &[],
credentials: &["credentials", "secrets.json", ".env"],
shared: &["skills"],
sessions: &["agents"],
login: Some(&["models", "auth", "login"]),
logout: None,
},
Spec {
key: "vibe",
label: "Mistral Vibe",
executable: "vibe",
bin_variable: "DITTO_VIBE_BIN",
home: Home::Variable {
variable: "VIBE_HOME",
native: ".vibe",
},
// The key goes to the OS keyring unless the keyring is refused, in
// which case it is written to `.env` here. The variable is named for
// Vibe's tests but is how its source decides.
managed_env: &[("VIBE_TEST_DISABLE_KEYRING", "1")],
credentials: &[".env"],
shared: &[
"config.toml",
"agents",
"prompts",
"skills",
"tools",
"plugins",
"hooks.toml",
"AGENTS.md",
"trusted_folders.toml",
],
sessions: &["logs/session"],
login: None,
logout: None,
},
Spec {
key: "acli",
label: "Rovo Dev",
// Rovo Dev is a plugin of Atlassian's `acli` (`acli rovodev run`) with
// no binary of its own. It keeps its files in `~/.rovodev` and its
// login in `~/.acli`, both hard-coded, so both stay out of the mirror.
// What `~/.acli` holds is undocumented.
executable: "acli",
bin_variable: "DITTO_ACLI_BIN",
home: Home::Private {
native: ".rovodev",
owned: &[".acli"],
},
managed_env: &[],
credentials: &["../.acli"],
shared: &["config.yml", "AGENTS.md"],
sessions: &["sessions"],
login: Some(&["rovodev", "auth", "login"]),
logout: Some(&["rovodev", "auth", "logout"]),
},
Spec {
key: "amp",
label: "Amp",
executable: "amp",
bin_variable: "DITTO_AMP_BIN",
// Read out of the shipped bundle rather than documented: settings
// under the config base, `secrets.json` under the data base. On macOS
// its daemon and IDE state ignore the data base and stay under the
// home directory, and threads live on ampcode.com rather than on disk.
home: Home::Xdg { subdir: "amp" },
managed_env: &[],
credentials: &["data/secrets.json"],
shared: &[
"config/settings.json",
"config/settings.jsonc",
"config/plugins",
"config/skills",
"config/AGENTS.md",
],
sessions: &[],
login: Some(&["login"]),
logout: Some(&["logout"]),
},
Spec {
key: "droid",
label: "Droid",
executable: "droid",
bin_variable: "DITTO_DROID_BIN",
// Closed source with no variable of its own. The login goes to the OS
// keyring unless refused; where the fallback file lands is not
// documented, so the login still cannot be read.
home: Home::Private {
native: ".factory",
owned: &[],
},
managed_env: &[("FACTORY_DISABLE_KEYRING", "1")],
credentials: &[],
shared: &[
"settings.json",
"hooks.json",
"config.json",
"commands",
"droids",
"skills",
"AGENTS.md",
"specs",
"docs",
],
sessions: &["projects"],
login: None,
logout: None,
},
Spec {
key: "goose",
label: "Goose",
executable: "goose",
bin_variable: "DITTO_GOOSE_BIN",
// `GOOSE_PATH_ROOT` would move the same directories, but Goose's
// built-in MCP servers read the XDG bases directly and ignore it, so
// the bases are what a profile pins. Every secret sits in one keyring
// item unless the keyring is refused, in which case `secrets.yaml`
// holds them.
home: Home::Xdg { subdir: "goose" },
managed_env: &[("GOOSE_DISABLE_KEYRING", "1")],
credentials: &["config/secrets.yaml"],
shared: &[
"config/config.yaml",
"config/permission.yaml",
"config/permissions",
"config/prompts",
"config/recipes",
"config/skills",
"config/agents",
"config/custom_providers",
"config/.goosehints",
"config/AGENTS.md",
],
sessions: &["data/sessions"],
login: None,
logout: None,
},
Spec {
key: "aider",
label: "Aider",
executable: "aider",
bin_variable: "DITTO_AIDER_BIN",
// Keeps `~/.aider.conf.yml`, `~/.env`, and `~/.aider/` beside each
// other with no variable for any of them. The mirror carries the
// configuration files across; `.env` holds API keys and stays behind.
// Chat and input histories live in the repository, not the home.
home: Home::Private {
native: ".aider",
owned: &[".env"],
},
managed_env: &[],
credentials: &["oauth-keys.env"],
shared: &[],
sessions: &[],
login: None,
logout: None,
},
Spec {
key: "crush",
label: "Crush",
executable: "crush",
bin_variable: "DITTO_CRUSH_BIN",
// `CRUSH_GLOBAL_CONFIG` and `CRUSH_GLOBAL_DATA` move only the two
// `crush.json` files; the bases move everything. Conversations live in
// the project's `.crush/` directory rather than the home.
home: Home::Xdg { subdir: "crush" },
managed_env: &[],
credentials: &["data/crush.json"],
shared: &[
"config/crush.json",
"config/crushrc",
"config/CRUSH.md",
"config/skills",
],
sessions: &[],
login: Some(&["login"]),
logout: Some(&["logout"]),
},
Spec {
key: "kilo",
label: "Kilo Code",
executable: "kilo",
bin_variable: "DITTO_KILO_BIN",
// An opencode fork with opencode's split: configuration under one base
// and credentials under another, so the configuration directory is
// shared whole, as opencode's is. `KILO_CONFIG_DIR` only adds a
// directory to the ones read.
home: Home::Xdg { subdir: "kilo" },
managed_env: &[],
credentials: &["data/auth.json"],
shared: &["config"],
sessions: &["data/storage"],
login: Some(&["auth", "login"]),
logout: Some(&["auth", "logout"]),
},
Spec {
key: "kiro-cli",
label: "Kiro",
executable: "kiro-cli",
bin_variable: "DITTO_KIRO_CLI_BIN",
// `KIRO_HOME` moves `~/.kiro` but not the data directory holding the
// login, which only an undocumented variable moves and which is under
// `Library/Application Support` on macOS and the XDG data base
// elsewhere. Both are derived from the home directory, so a private
// home moves everything at once, with those two kept out of the mirror.
home: Home::Private {
native: ".kiro",
owned: &[
".local/share/kiro-cli",
"Library/Application Support/kiro-cli",
],
},
managed_env: &[],
credentials: &[
"../Library/Application Support/kiro-cli/data.sqlite3",
"../.local/share/kiro-cli/data.sqlite3",
],
shared: &[
"settings/cli.json",
"settings/permissions.yaml",
"agents",
"steering",
"skills",
"hooks",
"prompts",
"powers",
],
sessions: &["sessions"],
login: Some(&["login"]),
logout: Some(&["logout"]),
},
Spec {
key: "auggie",
label: "Auggie",
executable: "auggie",
bin_variable: "DITTO_AUGGIE_BIN",
// `--augment-cache-dir` moves the session and the sessions, but the
// rules, commands, and skills stay under the home directory.
home: Home::Private {
native: ".augment",
owned: &[],
},
managed_env: &[],
credentials: &["session.json"],
shared: &[
"settings.json",
"commands",
"rules",
"skills",
"agents",
"plugins",
],
sessions: &["sessions"],
login: Some(&["login"]),
logout: Some(&["logout"]),
},
Spec {
key: "agy",
label: "Antigravity",
executable: "agy",
bin_variable: "DITTO_AGY_BIN",
// Closed source and derived from the home directory alone, with
// nothing honoured from the environment. The Google login goes to the
// OS keychain with no way to refuse it, so a profile isolates the
// configuration and conversations while the login stays the user's;
// only `GEMINI_API_KEY` is profile-local. `~/.gemini/config` and
// `GEMINI.md` are shared with the Antigravity IDE and reach the
// profile through the mirror.
home: Home::Private {
native: ".gemini/antigravity-cli",
owned: &[],
},
managed_env: &[],
credentials: &[],
shared: &["settings.json", "keybindings.json", "skills", "plugins"],
sessions: &["conversations", "brain"],
login: None,
logout: None,
},
Spec {
key: "mimo",
label: "MiMo Code",
executable: "mimo",
bin_variable: "DITTO_MIMO_BIN",
// An opencode fork. `MIMOCODE_HOME` would move the cache along with
// everything else, so the bases are pinned instead, as for opencode.
home: Home::Xdg { subdir: "mimocode" },
managed_env: &[],
credentials: &["data/auth.json"],
shared: &["config"],
sessions: &["data/storage", "data/snapshot"],
login: Some(&["providers", "login"]),
logout: Some(&["providers", "logout"]),
},
Spec {
key: "ante",
label: "Ante",
executable: "ante",
bin_variable: "DITTO_ANTE_BIN",
home: Home::Variable {
variable: "ANTE_HOME",
native: ".ante",
},
managed_env: &[],
credentials: &["auth"],
// `models` holds downloaded local models, shared so that a profile
// does not download them again.
shared: &[
"settings.json",
"catalog.json",
"AGENTS.md",
"skills",
"agents",
"offline-config.json",
"verified_models.json",
"models",
],
sessions: &["sessions", "projects"],
login: Some(&["auth", "login"]),
logout: None,
},
Spec {
key: "traecli",
label: "Trae",
executable: "traecli",
bin_variable: "DITTO_TRAECLI_BIN",
// The least certain entry. Trae's documentation describes a 1.0 layout
// with no variable; integrators of the current release agree on
// `~/.trae` with `TRAE_HOME` moving it, but that is unofficial, and
// the installer could not be reached to check. A private home moves
// whatever the binary derives from the home directory. The SSO token
// may also be in the OS keyring, which a profile does not isolate.
home: Home::Private {
native: ".trae",
owned: &[],
},
managed_env: &[],
credentials: &["cli/auth.json"],
shared: &[],
sessions: &["cli/sessions", "cli/archived_sessions"],
login: None,
logout: None,
},
Spec {
key: "autohand",
label: "Autohand",
executable: "autohand",
bin_variable: "DITTO_AUTOHAND_BIN",
// The login sits in `config.json` beside the settings, so neither can
// be shared nor read for a sign-in state.
home: Home::Variable {
variable: "AUTOHAND_HOME",
native: ".autohand",
},
managed_env: &[],
credentials: &[],
shared: &[
"AGENTS.md",
"skills",
"commands",
"agents",
"tools",
"extensions",
"plans",
"themes",
"hooks",
],
sessions: &["sessions"],
login: Some(&["--login"]),
logout: Some(&["--logout"]),
},
];
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn keys_are_unique_and_match_what_a_shell_can_call() {
// A key is a subcommand, a shell function name, and a directory name at
// once, so it has to be something all three accept, and no two tools
// can answer to the same one.
let mut seen = std::collections::HashSet::new();
for spec in ALL {
assert!(seen.insert(spec.key), "duplicate key {}", spec.key);
assert!(
spec.key
.chars()
.all(|c| c.is_ascii_lowercase() || c.is_ascii_digit() || c == '-'),
"key {} is not a plain command name",
spec.key
);
assert_eq!(
spec.bin_variable,
format!("DITTO_{}_BIN", spec.key.to_uppercase().replace('-', "_")),
"{} names its override differently from every other tool",
spec.key
);
let paths = spec
.credentials
.iter()
.chain(spec.shared)
.chain(spec.sessions);
match spec.home {
Home::Xdg { .. } => {
for path in paths {
assert!(
["config", "data", "state"]
.iter()
.any(|base| path == base || path.starts_with(&format!("{base}/"))),
"{}: XDG path {path} must name its base first",
spec.key
);
}
}
Home::Variable { native, .. } | Home::Parent { native, .. } => {
assert!(!native.is_empty(), "{} has no native directory", spec.key);
}
Home::Private { native, owned } => {
assert!(!native.is_empty(), "{} has no native directory", spec.key);
for entry in owned {
assert!(!entry.is_empty(), "{} owns an empty path", spec.key);
}
}
}
}
}
/// The label is drawn in a fixed-width column of the picker, and one that
/// overflows it pushes the state off the row.
#[test]
fn labels_fit_the_pickers_tool_column() {
for spec in ALL {
assert!(
spec.label.chars().count() <= 13,
"{} is too wide",
spec.label
);
}
}
}