hx config init: write a commented sample config #142

Merged
hermes merged 1 commits from feat/config-init into main 2026-10-09 14:00:06 +00:00
Collaborator

hx config init [--project] [--force] writes a fully commented sample config to ~/.hx/config.toml ($HX_HOME), or with --project to .hx/config.toml. It refuses to overwrite an existing file unless --force is given.

The sample (crates/hx-cli/src/config.sample.toml, embedded with include_str!) has every key: top-level settings, [openai_compat], [lsp], [[lsp.servers]] and [[extensions]]. Each line shows the default or an example.

Test sample_config_parses parses the sample once as-is and once with every # prefix stripped, using the real Config (deny_unknown_fields). A renamed or missing key, or a wrong type, fails the test, so the sample stays in sync with Config. A newly added Config field is not caught automatically.

Checked by hand: first run writes the file, second run errors, --force overwrites. README links the command. tests/all.sh green.

`hx config init [--project] [--force]` writes a fully commented sample config to `~/.hx/config.toml` (`$HX_HOME`), or with `--project` to `.hx/config.toml`. It refuses to overwrite an existing file unless `--force` is given. The sample (`crates/hx-cli/src/config.sample.toml`, embedded with `include_str!`) has every key: top-level settings, `[openai_compat]`, `[lsp]`, `[[lsp.servers]]` and `[[extensions]]`. Each line shows the default or an example. Test `sample_config_parses` parses the sample once as-is and once with every `# ` prefix stripped, using the real `Config` (`deny_unknown_fields`). A renamed or missing key, or a wrong type, fails the test, so the sample stays in sync with `Config`. A newly added `Config` field is not caught automatically. Checked by hand: first run writes the file, second run errors, `--force` overwrites. README links the command. `tests/all.sh` green.
hermes added 1 commit 2026-10-09 13:59:41 +00:00
hermes merged commit 7e29515821 into main 2026-10-09 14:00:05 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: johannes/hx#142