feat(config): add config edit and jq-based config get#750
Conversation
There was a problem hiding this comment.
Pull request overview
Adds richer configuration management to the micasa CLI by introducing jq-based config querying and an interactive config edit flow, aligning CLI behavior with canonical ShowConfig output and improving editor command parsing.
Changes:
- Introduce
Config.Query()to run jq filters against resolved config with type-aware output formatting and secret redaction. - Add config editing helpers (
Editor,EditorCommand,EnsureConfigFile) and wire a newmicasa config editsubcommand. - Update CLI/tests to the new
micasa config get [filter]default behavior and add new dependencies (gojq,shlex).
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/config/query.go | New jq-powered config query + sanitization + output formatting helpers. |
| internal/config/edit.go | New editor detection/arg-splitting and config file bootstrap helper. |
| internal/config/edit_test.go | Unit tests for editor resolution/splitting and config file creation behavior. |
| internal/config/config.go | Get() now rejects section keys with a more explicit error path. |
| internal/app/model.go | Switch editor command parsing to shlex splitting for quoted paths. |
| cmd/micasa/main.go | Replace old config flags with config get (default) and config edit. |
| cmd/micasa/main_test.go | Update CLI integration tests for new config subcommands and edit behavior. |
| go.mod | Add github.com/itchyny/gojq and github.com/google/shlex. |
| go.sum | Dependency checksums for new modules. |
| flake.nix | Update vendorHash for new vendored deps. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is Additional details and impacted files
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 12 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
04a5ce9 to
d28843d
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 13 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
47b7cee to
2200cfc
Compare
833f1bc to
fab16d0
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 13 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
2dde05a to
195eebd
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 15 out of 16 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
195eebd to
9fc6686
Compare
9fc6686 to
b0b1a86
Compare
b0b1a86 to
a615861
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 15 out of 16 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
internal/app/model.go:2866
editorBinary()checks $EDITOR before $VISUAL, butconfig.Editor()(used bymicasa config edit) prioritizes $VISUAL over $EDITOR. This makes editor selection inconsistent between the TUI notes editor and the CLI config editor when both env vars are set. Please align the precedence (ideally prefer $VISUAL, or reuseconfig.Editor()here) so the app behaves consistently across commands/features.
raw := os.Getenv("EDITOR")
if raw == "" {
raw = os.Getenv("VISUAL")
}
a615861 to
01d5f02
Compare
01d5f02 to
69ace22
Compare
69ace22 to
6b64d65
Compare
6b64d65 to
805dc7f
Compare
805dc7f to
f6b848b
Compare
f6b848b to
7dfc3c1
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 15 out of 16 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
internal/app/model.go:2866
editorBinary()prefers $EDITOR before $VISUAL, but the new config editor helpers (config.Editor()/micasa config edit) prefer $VISUAL first. This inconsistency can lead to the TUI and CLI opening different editors for the same user configuration. Consider reusingconfig.Editor()here (or at least matching its precedence order) so editor resolution is consistent across the app.
raw := os.Getenv("EDITOR")
if raw == "" {
raw = os.Getenv("VISUAL")
}
Restructure `micasa config` into subcommands: - `config get [filter]`: query config values using jq syntax via embedded gojq. Identity filter (`.`) shows annotated TOML. Scalars print bare, objects as TOML, arrays as JSON. Sensitive fields (api_key) and empty values are stripped. - `config edit`: opens the config file in $VISUAL/$EDITOR with proper POSIX shell splitting via shlex. Creates the config file with example TOML if it doesn't exist. Also switches editorBinary() in internal/app to use shlex for consistent secure shell splitting across the codebase. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Avoids recurring $ escaping issues when running GraphQL queries/mutations inline in shell commands. The /rev skill now references these files via `-F query=@.claude/graphql/...` instead of inline query strings. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
7dfc3c1 to
c348e1c
Compare
Summary
micasa configintoconfig get [filter]andconfig editsubcommandsconfig getuses embedded gojq for jq-syntax queries against config values — identity filter shows annotated TOML, scalars print bare, objects as TOML, arrays as JSON; sensitive fields (api_key) and empty string values are strippedconfig editopens the config file in$VISUAL/$EDITORwith OS-specific command splitting (POSIX shlex on Unix,windows.DecomposeCommandLineon Windows), creating the file atomically with example TOML if it doesn't existeditorBinary()ininternal/appto use the same OS-awareconfig.SplitEditorCommand()for consistent cross-platform editor launchinggolang.org/x/sysas a direct dependency for Windows command-line parsing🤖 Generated with Claude Code