Commit 8836aab
feat(cli)!: unify config env to FIRMA_CONFIG (#627)
## Why
`firma sidecar` bound `--config` to `FIRMA_SIDECAR_CONFIG_FILE`,
`authority` bound no env, and the stack-inspection commands bound
`FIRMA_CONFIG` — all selecting the same unified `firma.toml`. The
`FIRMA_SIDECAR_CONFIG_FILE` name was also overloaded as a `firma run`
autostart sidecar-template source, so setting it for one purpose
silently affected the other. This unifies unified-config selection under
one canonical flag and env.
## What Changed
- Add a global `-c` / `--config` bound to `FIRMA_CONFIG` on the
top-level `firma` command (accepted before or after any subcommand);
`main.rs` threads the resolved path into each consumer.
- Remove the per-command unified-config `--config` from `control`,
`doctor`, `monitor`, `sidecar` (serve/start/stop), and `authority`.
`firma run --config` keeps working via the global (it was already the
unified-config selector).
- Fully retire `FIRMA_SIDECAR_CONFIG_FILE`, including the `firma run`
autostart template fallback (`TemplateSource::Env` removed; selection is
now `--sidecar-config` → `./firma_sidecar.toml` → synthesized minimal).
- Update docs (cli.md, README, manage-the-stack, firma-run, examples)
and extend the `--help` contract test to sidecar/authority.
## Risks / Notes
- **Breaking (`feat!`)**: `FIRMA_SIDECAR_CONFIG_FILE` is removed.
Migration: export `FIRMA_CONFIG` to select the unified `firma.toml`; use
`--sidecar-config <path>` (or `./firma_sidecar.toml`) for a `firma run`
autostart template.
- Config resolution precedence and fail-closed behavior are unchanged
(still owned by `firma-config-loader` `ConfigResolver`); the path — not
a pre-resolved config — is threaded because `doctor` reports resolution,
`run` may scaffold, and `sidecar start` uses a different resolver.
- As a clap global, `--config` is also accepted (and ignored) by
commands that do not consume the unified config (`token`, `policy`,
internal `__*`).
- Design/rationale: `docs/architecture/config-env-unification-plan.md`.
- Stacked on top of #619 (`amp/canonical-config-discovery`); base
retargets to `main` once that merges.
## AI Assistance
Claude Opus 4.8 (claude-opus-4-8).1 parent ae67384 commit 8836aab
26 files changed
Lines changed: 218 additions & 157 deletions
File tree
- crates
- firma-run
- src
- sidecar
- tests/integration
- firma
- src
- args
- services
- tests/integration
- docs-site/src/content/docs/guides
- docs
- architecture
- examples/firma-run
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
901 | 901 | | |
902 | 902 | | |
903 | 903 | | |
904 | | - | |
905 | | - | |
906 | | - | |
907 | | - | |
908 | 904 | | |
909 | 905 | | |
910 | 906 | | |
| |||
1006 | 1002 | | |
1007 | 1003 | | |
1008 | 1004 | | |
1009 | | - | |
1010 | 1005 | | |
1011 | 1006 | | |
1012 | 1007 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
303 | 303 | | |
304 | 304 | | |
305 | 305 | | |
306 | | - | |
307 | | - | |
308 | 306 | | |
309 | 307 | | |
310 | 308 | | |
| |||
352 | 350 | | |
353 | 351 | | |
354 | 352 | | |
355 | | - | |
356 | 353 | | |
357 | 354 | | |
358 | 355 | | |
| |||
372 | 369 | | |
373 | 370 | | |
374 | 371 | | |
375 | | - | |
| 372 | + | |
376 | 373 | | |
377 | 374 | | |
378 | 375 | | |
| |||
489 | 486 | | |
490 | 487 | | |
491 | 488 | | |
492 | | - | |
493 | | - | |
494 | | - | |
495 | | - | |
496 | | - | |
497 | 489 | | |
498 | 490 | | |
499 | 491 | | |
| |||
1058 | 1050 | | |
1059 | 1051 | | |
1060 | 1052 | | |
1061 | | - | |
1062 | 1053 | | |
1063 | 1054 | | |
1064 | 1055 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
65 | 64 | | |
66 | 65 | | |
67 | 66 | | |
| |||
104 | 103 | | |
105 | 104 | | |
106 | 105 | | |
107 | | - | |
108 | 106 | | |
109 | 107 | | |
110 | 108 | | |
| |||
Lines changed: 2 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | 54 | | |
56 | 55 | | |
57 | 56 | | |
| |||
269 | 268 | | |
270 | 269 | | |
271 | 270 | | |
272 | | - | |
| 271 | + | |
273 | 272 | | |
274 | 273 | | |
275 | 274 | | |
276 | | - | |
277 | 275 | | |
278 | | - | |
| 276 | + | |
279 | 277 | | |
280 | 278 | | |
281 | 279 | | |
| |||
284 | 282 | | |
285 | 283 | | |
286 | 284 | | |
287 | | - | |
288 | 285 | | |
289 | 286 | | |
290 | 287 | | |
291 | 288 | | |
292 | 289 | | |
293 | 290 | | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | 291 | | |
303 | 292 | | |
304 | 293 | | |
| |||
477 | 466 | | |
478 | 467 | | |
479 | 468 | | |
480 | | - | |
481 | 469 | | |
482 | 470 | | |
483 | 471 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | 24 | | |
26 | 25 | | |
27 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | 10 | | |
16 | 11 | | |
17 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | 10 | | |
15 | 11 | | |
16 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
| 9 | + | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
| |||
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | 20 | | |
26 | 21 | | |
27 | 22 | | |
| |||
55 | 50 | | |
56 | 51 | | |
57 | 52 | | |
58 | | - | |
59 | 53 | | |
60 | 54 | | |
61 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
74 | 79 | | |
75 | 80 | | |
76 | 81 | | |
| |||
0 commit comments