-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Support YAML, TOML, and JSON front matter in the QUERY_MESSAGE.md file opened by jp query --new, allowing configuration values to be set from within the editor instead of only via CLI arguments.
Context
Currently when using jp query --new, an editor opens with QUERY_MESSAGE.md containing conversation history below a cut marker. While the configuration system supports CLI arguments like --cfg assistant.system_prompt="hello world", there's no way to modify configuration once the editor is open. This creates a workflow limitation where you cannot adjust configuration values during the editing session without closing the editor and restarting with different CLI arguments.
Alternatives
The current workaround is to close the editor and restart jp query --new with different CLI configuration arguments, but this is disruptive to the editing workflow.
Proposed Implementation
Parse front matter from the QUERY_MESSAGE.md file after the editor closes, supporting the same YAML (---/---), TOML (+++/+++), and JSON ({...}) formats as Hugo/Jekyll. Front matter configuration would be merged with the existing configuration system using the same PartialConfig mechanism, allowing it to override or add to configuration values that haven't been consumed yet by the time the editor closes.
Tasks
- Add front matter detection and parsing logic to
crates/jp_cli/src/editor.rs - Extract configuration values from parsed front matter into
PartialConfig - Merge front matter configuration with existing configuration after editor closes
- Add tests for YAML, TOML, and JSON front matter parsing
- Update documentation to explain front matter configuration syntax