dcdpr / dcdpr/jp

Add front matter support to `QUERY_MESSAGE.md` for editor-based configuration

Open
#217 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Rust
Stars
16
Forks
3
Avg merge
1d 1h
Merged PRs (30d)
121

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

Resources

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading crates/jp_cli/src/editor.rs and the PartialConfig-related code in crates/jp_config/src/config.rs and crates/jp_config/src/fs.rs; issue 91 is also listed as context. Done means YAML, TOML, and JSON front matter can be parsed after editing, mapped into PartialConfig, merged after the editor closes, covered by tests, and documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, developer-experience
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.