Skip to content

feat(config): add config edit and jq-based config get#750

Merged
cpcloud merged 2 commits intomainfrom
worktree-rosy-growing-giraffe
Mar 11, 2026
Merged

feat(config): add config edit and jq-based config get#750
cpcloud merged 2 commits intomainfrom
worktree-rosy-growing-giraffe

Conversation

@cpcloud
Copy link
Owner

@cpcloud cpcloud commented Mar 10, 2026

Summary

  • Restructure micasa config into config get [filter] and config edit subcommands
  • config get uses 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 stripped
  • config edit opens the config file in $VISUAL/$EDITOR with OS-specific command splitting (POSIX shlex on Unix, windows.DecomposeCommandLine on Windows), creating the file atomically with example TOML if it doesn't exist
  • Switch editorBinary() in internal/app to use the same OS-aware config.SplitEditorCommand() for consistent cross-platform editor launching
  • Add golang.org/x/sys as a direct dependency for Windows command-line parsing

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings March 10, 2026 16:18
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 new micasa config edit subcommand.
  • 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
Copy link

codecov bot commented Mar 10, 2026

Codecov Report

❌ Patch coverage is 50.00000% with 116 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.29%. Comparing base (f923a61) to head (c348e1c).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
internal/config/query.go 54.61% 44 Missing and 15 partials ⚠️
cmd/micasa/main.go 0.00% 18 Missing ⚠️
internal/config/edit.go 64.58% 12 Missing and 5 partials ⚠️
internal/app/model.go 0.00% 9 Missing ⚠️
internal/config/config.go 40.00% 5 Missing and 1 partial ⚠️
internal/config/edit_windows.go 55.55% 2 Missing and 2 partials ⚠️
internal/config/edit_unix.go 62.50% 2 Missing and 1 partial ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
internal/config/edit_unix.go 62.50% <62.50%> (ø)
internal/config/edit_windows.go 55.55% <55.55%> (ø)
internal/config/config.go 89.72% <40.00%> (-0.93%) ⬇️
internal/app/model.go 62.12% <0.00%> (-0.25%) ⬇️
internal/config/edit.go 64.58% <64.58%> (ø)
cmd/micasa/main.go 3.18% <0.00%> (-0.14%) ⬇️
internal/config/query.go 54.61% <54.61%> (ø)

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI review requested due to automatic review settings March 10, 2026 23:16
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot AI review requested due to automatic review settings March 11, 2026 01:33
@cpcloud cpcloud force-pushed the worktree-rosy-growing-giraffe branch from 04a5ce9 to d28843d Compare March 11, 2026 01:33
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@cpcloud cpcloud force-pushed the worktree-rosy-growing-giraffe branch from 47b7cee to 2200cfc Compare March 11, 2026 10:07
Copilot AI review requested due to automatic review settings March 11, 2026 10:14
@cpcloud cpcloud force-pushed the worktree-rosy-growing-giraffe branch from 833f1bc to fab16d0 Compare March 11, 2026 10:23
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot AI review requested due to automatic review settings March 11, 2026 10:44
@cpcloud cpcloud force-pushed the worktree-rosy-growing-giraffe branch from 2dde05a to 195eebd Compare March 11, 2026 10:46
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@cpcloud cpcloud force-pushed the worktree-rosy-growing-giraffe branch from 195eebd to 9fc6686 Compare March 11, 2026 11:03
Copilot AI review requested due to automatic review settings March 11, 2026 11:05
@cpcloud cpcloud force-pushed the worktree-rosy-growing-giraffe branch from 9fc6686 to b0b1a86 Compare March 11, 2026 11:05
@cpcloud cpcloud force-pushed the worktree-rosy-growing-giraffe branch from b0b1a86 to a615861 Compare March 11, 2026 11:06
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, but config.Editor() (used by micasa 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 reuse config.Editor() here) so the app behaves consistently across commands/features.
	raw := os.Getenv("EDITOR")
	if raw == "" {
		raw = os.Getenv("VISUAL")
	}

@cpcloud cpcloud force-pushed the worktree-rosy-growing-giraffe branch from a615861 to 01d5f02 Compare March 11, 2026 11:26
Copilot AI review requested due to automatic review settings March 11, 2026 11:34
@cpcloud cpcloud force-pushed the worktree-rosy-growing-giraffe branch from 01d5f02 to 69ace22 Compare March 11, 2026 11:34
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 16 changed files in this pull request and generated 2 comments.

@cpcloud cpcloud force-pushed the worktree-rosy-growing-giraffe branch from 69ace22 to 6b64d65 Compare March 11, 2026 12:24
Copilot AI review requested due to automatic review settings March 11, 2026 12:42
@cpcloud cpcloud force-pushed the worktree-rosy-growing-giraffe branch from 6b64d65 to 805dc7f Compare March 11, 2026 12:42
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 16 out of 17 changed files in this pull request and generated 1 comment.

@cpcloud cpcloud force-pushed the worktree-rosy-growing-giraffe branch from 805dc7f to f6b848b Compare March 11, 2026 13:05
Copilot AI review requested due to automatic review settings March 11, 2026 13:18
@cpcloud cpcloud force-pushed the worktree-rosy-growing-giraffe branch from f6b848b to 7dfc3c1 Compare March 11, 2026 13:18
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 reusing config.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")
	}

cpcloud and others added 2 commits March 11, 2026 09:30
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>
@cpcloud cpcloud force-pushed the worktree-rosy-growing-giraffe branch from 7dfc3c1 to c348e1c Compare March 11, 2026 13:31
@cpcloud cpcloud merged commit edc6aa5 into main Mar 11, 2026
25 checks passed
@cpcloud cpcloud deleted the worktree-rosy-growing-giraffe branch March 11, 2026 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants