safe-chains 0.221.0

Auto-allow safe bash commands in agentic coding tools
Documentation
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
[[command]]
name = "cargo"
description = "Rust package manager and build system with a very large subcommand surface. Build operations (build, test, check, clippy, doc, bench, run) execute build scripts (build.rs) from every crate in the dependency tree, which can run arbitrary code. `--manifest-path DIR/Cargo.toml` points any of these at a DIFFERENT project, so it selects whose code runs. The `--config KEY=VALUE` flag sets arbitrary Cargo config on the command line, including code-execution keys like `target.<cfg>.runner`, `build.rustc-wrapper`, and `[alias]` shell escapes — it is a general command-injection surface, so it is not exposed here (use `.cargo/config.toml` instead). install has two modes: `cargo install crate-name` downloads from crates.io (network), while `cargo install --path .` builds from local source only — we allow --path but block positional crate names, --git, --registry, and --index to prevent remote-source installs. fmt without --check rewrites files. publish without --dry-run uploads to a registry. Third-party subcommands (nextest, deny, clippy, etc.) are added via cargo plugins and each has its own flag surface. Cargo releases with each Rust edition (roughly every 6 weeks) and frequently adds new flags."
url = "https://doc.rust-lang.org/cargo/commands/"
bare_flags = ["--help", "--version", "-V", "-h"]
examples_safe = [
  "cargo fuzz --version",
  "cargo sweep --time 5",
  "cargo sweep -r --installed",
  "cargo sweep --dry-run --maxsize 500",
  "cargo run",
  "cargo run --release",
  "cargo run --bin server",
  "cargo build",
  "cargo test",
  "cargo fmt",
  "cargo fmt --all",
  "cargo fmt --check",
  "cargo fmt --manifest-path ./crates/core/Cargo.toml",
  "cargo about --version",
  "cargo about --help",
  "cargo about generate about.hbs",
  "cargo swift --version",
  "cargo swift package --help",
  "cargo swift init KeelFFI",
  "cargo swift init KeelFFI --lib-type static --vcs git",
  "cargo swift package --platforms ios --name KeelFFI --release --accept-all",
  "cargo swift package -p ios -p macos --name Foo",
  "cargo swift package --features foo --all-features",
]
examples_denied = [
  # every real cargo-fuzz sub turns an operand into a path; only the informational forms are listed
  "cargo fuzz cmin parse ~/.ssh",
  "cargo fuzz add ../../../etc/x",
  # sweep takes no PATH positional: `-r` over a spelled-out root would delete build output for
  # every project beneath it, which is disk-wide scale at a locus well outside the worktree.
  "cargo sweep -r /",
  "cargo sweep -r /Users/someone/projects",
  "cargo sweep -t 5 .",
  "cargo run --manifest-path /tmp/evil/Cargo.toml",
  "cargo run --manifest-path ~/x/Cargo.toml",
  "cargo build --manifest-path ~/evil/Cargo.toml",
  "cargo test --manifest-path /tmp/x/Cargo.toml",
  "cargo fmt --manifest-path /tmp/other/Cargo.toml",
  "cargo fmt --manifest-path ~/other/Cargo.toml",
  "cargo fmt -- /tmp/evil.rs",
  "cargo fmt /etc/passwd",
  "cargo run --config target.x86_64-unknown-linux-gnu.runner='sh -c evil'",
  "cargo build --config build.rustc-wrapper=/tmp/evil",
  "cargo swift package --platforms ios macos",
]

# `--manifest-path DIR/Cargo.toml` selects WHICH project cargo builds/tests/runs — a foreign one
# runs foreign build.rs/tests/binary, so its value is gated by EXECUTOR locus (worktree allows,
# `/tmp`/home/system deny) across every cargo sub that accepts it. See
# docs/design/behavioral-taxonomy-execution-origin.md.
[command.path_gate]
# `--fuzz-dir` sits beside `--manifest-path` for the same reason: it names the directory whose
# Cargo.toml is compiled and whose targets are then EXECUTED, so it selects whose code runs.
flags = { "--output-dir" = "write", "--output-path" = "write", "--manifest-path" = "exec", "--fuzz-dir" = "exec" }

# cargo-fuzz: a third-party cargo subcommand driving libFuzzer over targets in `fuzz/`.
# Researched against cargo-fuzz 0.13.2.
#
# ONLY the informational forms. `cargo fuzz --version` and `--help` print a string and touch
# nothing: operation observe, process locus, no network, no execution, no secret — which is what
# `Inert` projects. Every real subcommand is withheld, because each turns an operand into a path:
# `cmin` MINIFIES the directory it is handed (rewriting and removing files), `run` writes new inputs
# into it, `tmin`/`fmt`/`coverage` read an arbitrary input file, `add` interpolates its target NAME
# into `fuzz/fuzz_targets/<name>.rs`, and `init --target` does the same through a flag — an upstream
# footgun, since `init` documents `--target <TARGET>` as a target NAME while `build` documents
# `--target <TRIPLE>` as a build triple. One spelling, two meanings, one tool.
#
# `max_positional = 0` is what makes the Inert classification HONEST rather than aspirational, and
# is the whole reason this entry can exist safely. Without a bound, `max_positional` is unlimited,
# so `cargo fuzz cmin parse ~/.ssh` parsed as three unremarkable positionals and was admitted under
# an entry that claimed to describe `--version`. A classification is a claim about what the token
# sequence can DO, so the entry has to be shaped so no other token sequence reaches it.
[[command.sub]]
name = "fuzz"
level = "Inert"
max_positional = 0
standalone = ["--help", "--version", "-V", "-h"]

[[command.sub]]
name = "audit"
level = "Inert"
standalone = [
    "--deny", "--help", "--json", "--no-fetch", "--stale",
    "-h", "-n", "--quiet", "-q", "-v",
]
valued = [
    "--color", "--db", "--file", "--ignore",
    "--target-arch", "--target-os", "-f",
]

[[command.sub]]
name = "bench"
level = "SafeRead"
standalone = [
    "--all", "--workspace",
    "--all-features", "--all-targets", "--benches", "--bins", "--doc",
    "--examples", "--frozen", "--future-incompat-report", "--help", "--ignore-rust-version",
    "--keep-going", "--lib", "--locked", "--no-default-features", "--no-fail-fast",
    "--no-run", "--offline", "--release", "--tests", "--timings", "--unit-graph",
    "-h", "--quiet", "-q", "-v",
]
valued = [
    "--bench", "--bin", "--color", "--example",
    "--features", "--jobs", "--manifest-path", "--message-format",
    "--package", "--profile", "--target", "--target-dir", "--test",
    "-Z", "-j", "-p",
]

[[command.sub]]
name = "init"
level = "SafeWrite"
bare = true
max_positional = 1
standalone = [
    "--bin", "--frozen", "--help", "--lib", "--locked", "--offline",
    "-h", "--quiet", "-q", "-v",
]
valued = [
    "--color", "--edition", "--name", "--registry", "--vcs",
    "-Z",
]

[[command.sub]]
name = "new"
level = "SafeWrite"
bare = false
max_positional = 1
standalone = [
    "--bin", "--frozen", "--help", "--lib", "--locked", "--offline",
    "-h", "--quiet", "-q", "-v",
]
valued = [
    "--color", "--edition", "--name", "--registry", "--vcs",
    "-Z",
]

[[command.sub]]
name = "build"
level = "SafeWrite"
standalone = [
    "--all", "--workspace",
    "--all-features", "--all-targets", "--benches", "--bins", "--build-plan",
    "--examples", "--frozen", "--future-incompat-report", "--help", "--ignore-rust-version",
    "--keep-going", "--lib", "--locked", "--no-default-features", "--offline",
    "--release", "--tests", "--timings", "--unit-graph",
    "-h", "--quiet", "-q", "-v",
]
valued = [
    "--bench", "--bin", "--color", "--example",
    "--features", "--jobs", "--manifest-path", "--message-format",
    "--package", "--profile", "--target", "--target-dir", "--test",
    "-Z", "-j", "-p",
]

[[command.sub]]
name = "check"
level = "SafeRead"
standalone = [
    "--all", "--all-features", "--all-targets", "--benches", "--bins", "--examples",
    "--frozen", "--future-incompat-report", "--help", "--ignore-rust-version",
    "--keep-going", "--lib", "--locked", "--no-default-features", "--offline",
    "--release", "--tests", "--timings", "--unit-graph", "--version", "--workspace",
    "-V", "-h", "--quiet", "-q", "-v",
]
valued = [
    "--bench", "--bin", "--color", "--example",
    "--exclude", "--features", "--jobs", "--manifest-path", "--message-format",
    "--package", "--profile", "--target", "--target-dir", "--test",
    "-Z", "-j", "-p",
]

[[command.sub]]
name = "clippy"
level = "SafeRead"
standalone = [
    "--all", "--all-features", "--all-targets", "--benches", "--bins", "--examples",
    "--frozen", "--future-incompat-report", "--help", "--ignore-rust-version",
    "--keep-going", "--lib", "--locked", "--no-default-features", "--no-deps",
    "--offline", "--release", "--tests", "--timings", "--unit-graph",
    "--version", "--workspace", "-V", "-h", "--quiet", "-q", "-v",
]
valued = [
    "--bench", "--bin", "--color", "--example",
    "--exclude", "--features", "--jobs", "--manifest-path", "--message-format",
    "--package", "--profile", "--target", "--target-dir", "--test",
    "-Z", "-j", "-p",
]

[[command.sub]]
name = "deny"
level = "Inert"
bare = false
standalone = [
    "--all-features", "--help", "--version", "--no-default-features",
    "-h", "--quiet", "-q", "-v",
]
valued = [
    "--color", "--exclude", "--features",
    "--format", "--manifest-path", "--target", "--workspace",
]

[[command.sub]]
name = "doc"
level = "SafeWrite"
standalone = [
    "--all", "--all-features", "--bins", "--document-private-items", "--examples",
    "--frozen", "--future-incompat-report", "--help", "--ignore-rust-version",
    "--keep-going", "--locked", "--no-default-features", "--no-deps",
    "--offline", "--open", "--release", "--timings", "--unit-graph", "--workspace",
    "-h", "--quiet", "-q", "-v",
]
valued = [
    "--bin", "--color", "--example",
    "--features", "--jobs", "--manifest-path", "--message-format",
    "--package", "--profile", "--target", "--target-dir",
    "-Z", "-j", "-p",
]

# fmt rewrites the current package/workspace's own source in place — a recoverable, local,
# no-exec/no-net worktree edit (SafeWrite). It runs no build script (rustfmt parses, it does not
# compile), so it is NOT an executor: pointing `--manifest-path` at a FOREIGN project only rewrites
# that project's files, gated by the command-level `--manifest-path = "exec"` locus gate (which
# denies /tmp/home/system targets, stricter than a write gate). `--check` reports diffs without
# writing; it rides the same SafeWrite sub (a threshold user wanting it distinctly read-only is the
# only case a future per-flag split would refine).
[[command.sub]]
name = "fmt"
level = "SafeWrite"
# No positionals: `cargo fmt` selects its target by --package/--manifest-path, never by path. This
# also denies the `cargo fmt -- <rustfmt args>` passthrough, whose trailing FILE args rustfmt would
# rewrite at an arbitrary (possibly out-of-workspace) locus we can't gate through the opaque `--`.
max_positional = 0
standalone = ["--all", "--check", "--help", "-h", "--quiet", "-q", "-v"]
valued = ["--manifest-path", "--message-format", "--package", "-p"]

[[command.sub]]
name = "help"
level = "Inert"
max_positional = 1
tolerate_unknown_short = true
tolerate_unknown_long = true

[[command.sub]]
name = "info"
level = "Inert"
bare = false
standalone = ["--frozen", "--help", "--locked", "--offline", "-h", "--quiet", "-q", "-v"]
valued = ["--color", "--index", "--registry"]

[[command.sub]]
name = "install"
level = "SafeWrite"
bare = false
max_positional = 0
standalone = [
    "--all-features", "--bins", "--debug",
    "--force", "--frozen", "--help",
    "--ignore-rust-version", "--keep-going",
    "--locked", "--no-default-features", "--no-track",
    "--offline", "--quiet", "--timings", "--verbose",
    "-f", "-h", "-q", "-v",
]
valued = [
    "--bin", "--color", "--example",
    "--features", "--jobs", "--message-format",
    "--path", "--profile", "--root",
    "--target", "--target-dir",
    "-F", "-Z", "-j",
]

[[command.sub]]
name = "license"
level = "Inert"
standalone = ["--frozen", "--help", "--locked", "--offline", "-h", "--quiet", "-q", "-v"]
valued = ["--color", "--manifest-path"]

[[command.sub]]
name = "locate-project"
level = "Inert"
standalone = ["--frozen", "--help", "--locked", "--offline", "-h", "--quiet", "-q", "-v"]
valued = ["--color", "--manifest-path"]

[[command.sub]]
name = "metadata"
level = "Inert"
standalone = [
    "--all-features", "--frozen", "--help", "--locked",
    "--no-default-features", "--no-deps", "--offline",
    "-h", "--quiet", "-q", "-v",
]
valued = [
    "--color", "--features", "--filter-platform",
    "--format-version", "--manifest-path",
]

[[command.sub]]
name = "package"
guard = "--list"
guard_short = "-l"
level = "Inert"
bare = false
standalone = [
    "--all-features", "--allow-dirty", "--exclude-lockfile",
    "--frozen", "--help", "--keep-going",
    "--list", "--locked", "--no-default-features",
    "--no-metadata", "--no-verify", "--offline", "--workspace",
    "-h", "-l", "--quiet", "-q", "-v",
]
valued = [
    "--color", "--exclude", "--features",
    "--index", "--jobs", "--lockfile-path",
    "--manifest-path", "--message-format",
    "--package", "--registry", "--target", "--target-dir",
    "-F", "-Z", "-j", "-p",
]

[[command.sub]]
name = "pkgid"
level = "Inert"
standalone = ["--frozen", "--help", "--locked", "--offline", "-h", "--quiet", "-q", "-v"]
valued = ["--color", "--manifest-path"]

[[command.sub]]
name = "publish"
guard = "--dry-run"
guard_short = "-n"
level = "SafeRead"
bare = false
standalone = [
    "--all-features", "--allow-dirty", "--dry-run",
    "--frozen", "--help", "--keep-going",
    "--locked", "--no-default-features", "--no-verify",
    "--offline", "--workspace",
    "-h", "-n", "--quiet", "-q", "-v",
]
valued = [
    "--color", "--exclude", "--features",
    "--index", "--jobs", "--lockfile-path", "--manifest-path",
    "--package", "--registry", "--target", "--target-dir",
    "-F", "-Z", "-j", "-p",
]

[[command.sub]]
name = "read-manifest"
level = "Inert"
standalone = ["--frozen", "--help", "--locked", "--offline", "-h", "--quiet", "-q", "-v"]
valued = ["--color", "--manifest-path"]

# `cargo run` compiles and runs THIS project's binary — the executor is the current project
# (the dev loop), so it is allowed just like `cargo build`/`cargo test`, which already compile
# and run project code. `--manifest-path DIR/Cargo.toml` (a foreign project) is denied by the
# command-level path_gate above, uniformly across the cargo family. Positionals after `--` are
# the program's own arguments (data, not gated).
[[command.sub]]
name = "run"
executor = "project"
bare = true
standalone = [
    "--all-features", "--frozen", "--help", "--ignore-rust-version",
    "--locked", "--no-default-features", "--offline", "--release",
    "--timings", "--unit-graph", "-h", "--quiet", "-q", "-v",
]
valued = [
    "--bin", "--color", "--example", "--features",
    "--jobs", "--manifest-path", "--message-format", "--package",
    "--profile", "--target", "--target-dir", "-Z", "-j", "-p",
]

[[command.sub]]
name = "search"
level = "Inert"
bare = false
standalone = ["--frozen", "--help", "--locked", "--offline", "-h", "--quiet", "-q", "-v"]
valued = ["--color", "--index", "--limit", "--registry"]

[[command.sub]]
name = "test"
level = "SafeRead"
standalone = [
    "--all",
    "--all-features", "--all-targets", "--benches", "--bins", "--doc",
    "--examples", "--frozen", "--future-incompat-report", "--help", "--ignore-rust-version",
    "--keep-going", "--lib", "--locked", "--no-default-features", "--no-fail-fast",
    "--no-run", "--offline", "--release", "--tests", "--timings", "--unit-graph",
    "--workspace", "-h", "--quiet", "-q", "-v",
]
valued = [
    "--bench", "--bin", "--color", "--example", "--exclude",
    "--features", "--jobs", "--manifest-path", "--message-format",
    "--package", "--profile", "--target", "--target-dir", "--test",
    "-Z", "-j", "-p",
]

[[command.sub]]
name = "tree"
level = "Inert"
standalone = [
    "--all-features", "--duplicates", "--frozen", "--help", "--ignore-rust-version",
    "--locked", "--no-dedupe", "--no-default-features", "--offline",
    "-d", "-e", "-h", "-i", "--quiet", "-q", "-v",
]
valued = [
    "--charset", "--color", "--depth", "--edges",
    "--features", "--format", "--invert", "--manifest-path",
    "--package", "--prefix", "--prune", "--target",
    "-p",
]

[[command.sub]]
name = "verify-project"
level = "Inert"
standalone = ["--frozen", "--help", "--locked", "--offline", "-h", "--quiet", "-q", "-v"]
valued = ["--color", "--manifest-path"]

[[command.sub]]
name = "nextest"
nested_bare = true
standalone = ["--help", "--version", "-V", "-h"]
[[command.sub.sub]]
name = "run"
level = "SafeRead"
standalone = [
    "--all-features", "--all-targets", "--help", "--lib",
    "--locked", "--no-capture", "--no-default-features",
    "--no-fail-fast", "--release", "--status-level",
    "-h",
]
valued = [
    "--bin", "--cargo-profile", "--color",
    "--exclude", "--features", "--jobs", "--manifest-path",
    "--package", "--partition", "--profile", "--retries",
    "--target", "--target-dir", "--test", "--test-threads",
    "--threads",
    "-E", "-j", "-p",
]
[[command.sub.sub]]
name = "list"
standalone = [
    "--all-features", "--help", "--lib", "--locked",
    "--no-default-features", "--release",
    "-T", "-h",
]
valued = [
    "--bin", "--color", "--exclude",
    "--features", "--manifest-path", "--message-format",
    "--package", "--partition", "--profile",
    "--target", "--target-dir", "--test",
    "-E", "-p",
]
[[command.sub.sub]]
name = "show-config"
standalone = ["--help", "-h"]
[[command.sub.sub]]
name = "archive"
level = "SafeWrite"
standalone = ["--all-features", "--help", "--locked", "--no-default-features", "--release", "-h"]
valued = ["--archive-file", "--archive-format", "--cargo-profile", "--features", "--manifest-path", "--package", "--target", "--target-dir", "-p"]

[[command.sub]]
name = "outdated"
standalone = [
    "--aggressive", "--color", "--depth", "--exit-code",
    "--features", "--help", "--manifest-path", "--packages",
    "--root-deps-only", "--verbose", "--workspace",
    "-R", "-V", "-d", "-h", "-n", "--quiet", "-q", "-r", "-v", "-w",
]
valued = [
    "--color", "--depth", "--exclude", "--features",
    "--ignore", "--manifest-path", "--packages",
    "-d", "-e", "-i", "-p",
]

[[command.sub]]
name = "machete"
standalone = [
    "--help", "--skip-target-dir", "--with-metadata",
    "-V", "-h",
]

[[command.sub]]
name = "semver-checks"
[[command.sub.sub]]
name = "check-release"
standalone = [
    "--all-features", "--default-features", "--help",
    "--verbose",
    "-h", "-v",
]
valued = [
    "--baseline-rev", "--baseline-root", "--baseline-version",
    "--color", "--config-path", "--current-rustdoc",
    "--exclude", "--features", "--manifest-path",
    "--package", "--release-type", "--target",
    "-j", "-p",
]

# swift = the cargo-swift plugin (0.7.1), building Swift packages from Rust via UniFFI.
# `init` scaffolds a new library crate (local worktree writes, like `cargo init`). `package`
# cargo-sweep (0.8.0) deletes stale build artifacts out of `target/` — the selective form of
# `cargo clean`, which is already SafeWrite here for the same reason: everything it removes is
# regenerated by the next build, so the loss is time, not data. Selection is by age (`--time`),
# installed toolchains (`--installed`/`--toolchains`), a size ceiling (`--maxsize`), or a stamp file
# written by an earlier `--stamp` run; `--dry-run` reports without deleting.
#
# The breadth flags are why this takes no PATH positional. `--recursive` walks every Cargo project
# below the given path and `--hidden` makes that walk descend dotted directories, so
# `cargo sweep -r --time 0 /` would delete build output for every project on the machine. Each
# deletion is individually recoverable, but the scale is the whole disk and the locus is far outside
# the worktree, which is not a SafeWrite shape.
#
# `max_positional = 0` keeps the everyday forms working — the tool defaults to the current directory,
# so `cargo sweep --time 5` and `cargo sweep -r` sweep the project you are in — while a spelled-out
# path of any kind falls to manual approval. The command-level `path_gate` above cannot help here:
# it gates flag VALUES, and this sub's paths are bare positionals.
[[command.sub]]
name = "sweep"
level = "SafeWrite"
max_positional = 0
standalone = [
    "--all", "--dry-run", "--file", "--help", "--hidden", "--installed", "--recursive",
    "--stamp", "--verbose", "--version",
    "-V", "-a", "-d", "-f", "-h", "-i", "-r", "-s", "-v",
]
valued = ["--maxsize", "--time", "--toolchains", "-m", "-t"]

# compiles the crate and generates a Swift package — the same build-script-executing, dependency-
# and target-toolchain-fetching profile as `cargo build` (SafeWrite), plus local Swift-package
# output. `--accept-all`/`-y` only auto-confirms `rustup target add` (official Rust std, reversible),
# so it stays within the build profile. `--platforms`/`--features` accept one value per occurrence;
# the space-separated multi-value form (`--platforms ios macos`) falls to manual approval.
[[command.sub]]
name = "swift"
nested_bare = true
standalone = ["--accept-all", "--help", "--silent", "--version", "-V", "-h", "-s", "-y"]
[[command.sub.sub]]
name = "init"
level = "SafeWrite"
bare = false
max_positional = 1
standalone = ["--accept-all", "--help", "--macro", "--plain", "--silent", "-h", "-s", "-y"]
valued = ["--lib-type", "--vcs"]
[[command.sub.sub]]
name = "package"
level = "SafeWrite"
bare = true
max_positional = 0
standalone = [
    "--accept-all", "--all-features", "--help", "--no-default-features",
    "--release", "--silent", "--skip-toolchains-check", "--suppress-warnings",
    "-h", "-r", "-s", "-y",
]
valued = ["--features", "--lib-type", "--name", "--platforms", "-F", "-n", "-p"]

[[command.sub]]
name = "expand"
level = "SafeWrite"
standalone = [
    "--all-features", "--help", "--lib", "--no-default-features",
    "--release", "--tests", "--ugly",
    "-h",
]
valued = [
    "--bin", "--color", "--example", "--features",
    "--manifest-path", "--package", "--target", "--theme",
    "-p",
]

[[command.sub]]
name = "llvm-cov"
level = "SafeRead"
standalone = [
    "--all-features", "--all-targets", "--help", "--html", "--json",
    "--lcov", "--lib", "--locked", "--no-cfg-coverage",
    "--no-default-features", "--no-fail-fast", "--no-run",
    "--open", "--release", "--text",
    "-h",
]
valued = [
    "--bin", "--branch", "--codecov", "--cobertura",
    "--color", "--example", "--exclude",
    "--features", "--ignore-filename-regex", "--ignore-run-fail",
    "--jobs", "--manifest-path", "--output-dir", "--output-path",
    "--package", "--profile", "--target", "--target-dir", "--test",
    "-j", "-p",
]

[[command.sub]]
name = "update"
level = "SafeWrite"
standalone = [
    "--aggressive", "--dry-run", "--frozen", "--help",
    "--locked", "--offline", "--recursive", "--workspace",
    "-h", "--quiet", "-q", "-v",
]
valued = [
    "--color", "--manifest-path", "--package",
    "--precise",
    "-p",
]

[[command.sub]]
name = "generate-lockfile"
level = "SafeWrite"
standalone = [
    "--frozen", "--help", "--locked", "--offline",
    "-h", "--quiet", "-q", "-v",
]
valued = ["--color", "--manifest-path"]

[[command.sub]]
name = "version"
standalone = ["--help", "-h"]
tolerate_unknown_short = true

[[command.sub]]
name = "bloat"
level = "SafeWrite"
standalone = [
    "--crates", "--filter", "--help", "--lib",
    "--no-default-features", "--release", "--time",
    "--wide",
    "-h",
]
valued = [
    "--bin", "--example", "--features", "--jobs",
    "--manifest-path", "--message-format", "--package",
    "--target",
    "-j", "-n", "-p",
]

[[command.sub]]
name = "clean"
level = "SafeWrite"
standalone = [
    "--doc", "--dry-run", "--frozen", "--help", "--locked",
    "--offline", "--release", "--workspace",
    "-h", "-n", "--quiet", "-q", "-r", "-v",
]
valued = [
    "--color", "--lockfile-path", "--manifest-path",
    "--package", "--profile", "--target", "--target-dir",
    "-Z", "-p",
]

[[command.sub]]
name = "fetch"
level = "SafeWrite"
standalone = [
    "--frozen", "--help", "--locked", "--offline",
    "-h", "--quiet", "-q", "-v",
]
valued = [
    "--color", "--lockfile-path",
    "--manifest-path", "--target",
    "-Z",
]

[[command.sub]]
name = "vendor"
level = "SafeWrite"
max_positional = 1
standalone = [
    "--frozen", "--help", "--locked", "--no-delete",
    "--offline", "--respect-source-config", "--versioned-dirs",
    "-h", "--quiet", "-q", "-v",
]
valued = [
    "--color", "--lockfile-path",
    "--manifest-path", "--sync",
    "-Z", "-s",
]

[[command.sub]]
name = "config"

[[command.sub.sub]]
name = "get"
level = "Inert"
max_positional = 1
standalone = [
    "--frozen", "--help", "--locked", "--offline",
    "--show-origin",
    "-h", "--quiet", "-q", "-v",
]
valued = [
    "--color", "--format", "--merged",
    "-Z",
]

[[command.sub]]
name = "report"

[[command.sub.sub]]
name = "future-incompatibilities"
level = "Inert"
standalone = [
    "--frozen", "--help", "--locked", "--offline",
    "-h", "--quiet", "-q", "-v",
]
valued = [
    "--color", "--id", "--package",
    "-Z", "-p",
]

[[command.sub]]
name = "udeps"
level = "SafeRead"
standalone = [
    "--all", "--all-features", "--all-targets", "--benches",
    "--bins", "--examples", "--frozen", "--help", "--keep-going",
    "--lib", "--locked", "--no-default-features", "--offline",
    "--release", "--tests", "--workspace", "--version",
    "-V", "-h", "--quiet", "-q", "-v",
]
valued = [
    "--backend", "--bench", "--bin", "--color", "--example",
    "--exclude", "--features", "--jobs", "--manifest-path",
    "--message-format", "--output", "--package", "--profile",
    "--target", "--target-dir", "--test",
    "-j", "-p",
]

[[command.sub]]
name = "msrv"
standalone = [
    "--help", "--no-log", "--no-user-output", "--version",
    "-V", "-h",
]
valued = [
    "--log-level", "--log-target", "--manifest-path",
    "--output-format", "--path",
]

[[command.sub.sub]]
name = "find"
level = "SafeRead"
max_positional = 0
standalone = [
    "--all-features", "--bisect", "--help",
    "--ignore-lockfile", "--include-all-patch-releases",
    "--linear", "--no-check-feedback",
    "--no-default-features", "--no-log", "--no-user-output",
    "-h",
]
valued = [
    "--component", "--features", "--log-level", "--log-target",
    "--manifest-path", "--max", "--maximum", "--min", "--minimum",
    "--output-format", "--path", "--release-source", "--target",
]

[[command.sub.sub]]
name = "verify"
level = "SafeRead"
max_positional = 0
standalone = [
    "--all-features", "--help",
    "--ignore-lockfile", "--include-all-patch-releases",
    "--no-check-feedback", "--no-default-features",
    "--no-log", "--no-user-output",
    "-h",
]
valued = [
    "--component", "--features", "--log-level", "--log-target",
    "--manifest-path", "--max", "--maximum", "--min", "--minimum",
    "--output-format", "--path", "--release-source",
    "--rust-version", "--target",
]

[[command.sub.sub]]
name = "list"
level = "Inert"
standalone = [
    "--help", "--no-log", "--no-user-output",
    "-h",
]
valued = [
    "--log-level", "--log-target", "--manifest-path",
    "--output-format", "--path", "--variant",
]

[[command.sub.sub]]
name = "show"
level = "Inert"
standalone = [
    "--help", "--no-log", "--no-user-output",
    "-h",
]
valued = [
    "--log-level", "--log-target", "--manifest-path",
    "--output-format", "--path",
]

[[command.sub]]
name = "public-api"
level = "SafeRead"
standalone = [
    "--all-features", "--help", "--no-default-features",
    "--simplified", "--version",
    "-V", "-h", "-s",
]
valued = [
    "--color", "--features", "--manifest-path", "--omit",
    "--package", "--target",
    "-F", "-p",
]

[[command.sub]]
name = "about"
nested_bare = true
standalone = [
    "--help", "--version",
    "-V", "-h",
]
valued = ["--color", "-L"]

[[command.sub.sub]]
name = "generate"
level = "SafeRead"
max_positional = 1
standalone = [
    "--all-features", "--fail", "--frozen", "--help",
    "--locked", "--no-default-features", "--offline",
    "--workspace",
    "-V", "-h",
]
valued = [
    "--color", "--features", "--format",
    "--manifest-path", "--name", "--target", "--threshold",
    "-L", "-c", "-m", "-n",
]

[[command.sub]]
name = "vet"
standalone = [
    "--frozen", "--help", "--locked",
    "--no-all-features", "--no-default-features",
    "--no-minimize-exemptions", "--no-registry-suggestions",
    "--version",
    "-V", "-h",
]
valued = [
    "--cache-dir", "--cargo-arg", "--features",
    "--filter-graph", "--manifest-path",
    "--output-format", "--store-path", "--verbose",
]

[[command.sub.sub]]
name = "check"
level = "SafeRead"
standalone = ["--help", "-h"]

[[command.sub.sub]]
name = "suggest"
level = "SafeRead"
standalone = ["--help", "-h"]

[[command.sub.sub]]
name = "dump-graph"
level = "Inert"
standalone = ["--help", "-h"]
valued = ["--depth"]

[[command.sub.sub]]
name = "explain-audit"
level = "Inert"
max_positional = 3
standalone = ["--help", "-h"]
valued = ["--criteria"]

[[command.sub]]
name = "geiger"
level = "SafeRead"
standalone = [
    "--all", "--all-dependencies", "--all-features",
    "--all-targets", "--build-dependencies",
    "--dev-dependencies", "--forbid-only", "--frozen",
    "--help", "--include-tests", "--invert", "--locked",
    "--no-default-features", "--no-indent", "--offline",
    "--prefix-depth", "--quiet", "--verbose", "--version",
    "-V", "-a", "-f", "-h", "-i", "-q", "-v",
]
valued = [
    "--color", "--features", "--format", "--manifest-path",
    "--output-format", "--package", "--section-name", "--target",
    "-Z", "-p",
]

[[command.sub]]
name = "criterion"
level = "SafeRead"
standalone = [
    "--all", "--all-features", "--all-targets", "--benches",
    "--bins", "--debug", "--examples", "--frozen", "--help",
    "--lib", "--locked", "--no-default-features",
    "--no-fail-fast", "--no-run", "--offline", "--tests",
    "--verbose", "--version", "--workspace",
    "-V", "-h", "-v",
]
valued = [
    "--bench", "--bin", "--color", "--criterion-manifest-path",
    "--example", "--exclude", "--features", "--history-description",
    "--history-id", "--jobs", "--manifest-path", "--message-format",
    "--output-format", "--package", "--plotting-backend",
    "--target", "--target-dir", "--test",
    "-Z", "-j", "-p",
]

[[command.sub]]
name = "cyclonedx"
level = "SafeWrite"
standalone = [
    "--all", "--all-features", "--help",
    "--license-strict", "--no-default-features", "--quiet",
    "--target-in-filename", "--top-level", "--verbose",
    "--version",
    "-V", "-a", "-h", "-q", "-v",
]
valued = [
    "--describe", "--features", "--format",
    "--license-accept-named", "--manifest-path",
    "--override-filename", "--spec-version", "--target",
    "-F", "-f",
]

[[command.sub]]
name = "watch"
candidate = true

[[command.sub]]
name = "binstall"
candidate = true


# `max_positional` is a SAFETY bound here, not tidiness. `cmin` minifies a corpus by rewriting the
# directory it is given, and `run` writes new inputs into it — both take that directory as a plain
# POSITIONAL, so `cargo fuzz cmin parse ~/.ssh` was an auto-approved destroy of an arbitrary
# directory. Path roles in pathgates.toml key on the command name only, and cargo's positionals are
# meaningful everywhere else (`cargo test <filter>`, `cargo run <args>`), so a `positional = "write"`
# role cannot be scoped to this subcommand. Bounding the count is what is expressible: the target
# NAME is allowed, an extra path is not. `fmt`/`tmin`/`add` take two because their second argument
# is an input file they read, or the new target's name.
#
# Cost, stated plainly: an explicit corpus directory (`cargo fuzz run t fuzz/corpus/t`) now needs
# approval. The implicit default corpus is unaffected, which is the common invocation.