Skip to content

Commit 2719a85

Browse files
authored
docs(rfd): Add RFD 060 for --explain config resolution flag (#466)
Add RFD 060, proposing a global `--explain` flag that traces JP's layered config resolution chain, showing users exactly where each field value originates. The motivation: when a config value isn't what the user expects, there's currently no way to find out which layer set it — file configs, env vars, conversation deltas, CLI flags, and alias resolution all silently compete. `--explain` makes that chain visible. Two modes are proposed: broad mode (bare `--explain`) groups all non-default fields by the layer that set them, and focused mode (`--explain=<field>`) traces a single field through every layer including "not set" and "not found" entries. Both modes support JSON output via `--format=json`. The implementation approach uses snapshot-and-diff provenance: `PartialAppConfig` is cloned after each layer is applied, and `delta()` is used to determine what each layer contributed. A `CliRecorder` captures the CLI flag-to-field mappings including alias resolution details. The flag suppresses command execution, following the precedent of e.g. `terraform plan`. --------- Signed-off-by: Jean Mertz <git@jeanmertz.com>
1 parent ea74542 commit 2719a85

5 files changed

Lines changed: 637 additions & 42 deletions

File tree

docs/.vitepress/rfd-summaries.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,5 +234,9 @@
234234
"059-shell-completions-and-man-pages.md": {
235235
"hash": "791b583757910d0f1687a180f4ec49fd2d7876ffd695ceffc546bcf4ae5b9c7c",
236236
"summary": "Add `jp completions` and `jp manpage` subcommands using clap_complete and clap_mangen for shell integration."
237+
},
238+
"060-config-explain.md": {
239+
"hash": "cfa8458677aef01bb18793dab19605f67968b23ad00905a9d02dbd1bc7647bc0",
240+
"summary": "Global `--explain` flag traces config resolution through 9 layers, showing where each field value originates."
237241
}
238242
}

docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"packageManager": "yarn@4.9.1",
44
"devDependencies": {
55
"typescript": "^5",
6-
"vitepress": "2.0.0-alpha.16",
6+
"vitepress": "2.0.0-alpha.17",
77
"vue": "^3.5.16"
88
}
99
}

docs/rfd/059-shell-completions-and-man-pages.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ for your shell:
106106

107107
`clap_complete` v4.4+ provides `CompleteEnv`, a dynamic completion system where
108108
the shell calls back into the binary itself when the user presses Tab. Instead
109-
of generating a large static script with all options baked in, `jp completions
110-
<shell>` generates a small shell script that registers `jp` as its own
111-
completer.
109+
of generating a large static script with all options baked in, the command `jp
110+
completions <shell>` generates a small shell script that registers `jp` as its
111+
own completer.
112112

113113
When the shell requests completions, it invokes `jp` with special environment
114114
variables. JP inspects the partial command line and returns candidates. This
@@ -348,8 +348,3 @@ changing the shell integration mechanism.
348348
`--cfg` completions
349349
- `SchemaType::Enum` in `schematic` — enum variant extraction for value
350350
completions
351-
- [RFD D11]: Config explain — provenance infrastructure
352-
- [RFD D12]: Interactive config — `--cfg` browser
353-
354-
[RFD D11]: D11-config-explain.md
355-
[RFD D12]: D12-interactive-config.md

0 commit comments

Comments
 (0)