Skip to content

feat: add --json flag, diff, export/import, watch#2

Merged
lu-zhengda merged 1 commit intomainfrom
feat/json-and-enhancements
Feb 15, 2026
Merged

feat: add --json flag, diff, export/import, watch#2
lu-zhengda merged 1 commit intomainfrom
feat/json-and-enhancements

Conversation

@lu-zhengda
Copy link
Copy Markdown
Owner

Summary

  • Add global --json persistent flag for machine-readable output on all subcommands (list, get, search, preset, backup)
  • Add json:"snake_case" struct tags to all exported types across internal packages
  • New diff <backup-file> subcommand to compare current defaults state against a backup snapshot
  • New export [file] subcommand to export managed defaults to a portable JSON file for cross-machine sharing
  • New import <file> subcommand to import and apply defaults from an export file
  • New watch <domain> <key> subcommand to monitor a defaults key for changes with configurable --interval
  • Add completions/ to .gitignore
  • Add unit tests for parsing functions and JSON output helper

Test plan

  • go build ./... passes
  • go vet ./... passes
  • go test -race ./... passes (new tests for parseImportValue, parseBoolImport, printJSON)
  • Manual: macfig list --json outputs valid JSON
  • Manual: macfig get <domain> <key> --json outputs structured result
  • Manual: macfig search <query> --json outputs structured results
  • Manual: macfig backup --json outputs backup info as JSON
  • Manual: macfig diff <backup-file> shows changes
  • Manual: macfig export creates portable JSON file
  • Manual: macfig import <file> applies settings from export
  • Manual: macfig watch <domain> <key> polls and reports changes

🤖 Generated with Claude Code

- Add global --json flag for machine-readable output on all subcommands
- Add json struct tags to all exported types (SearchResult, Setting,
  Category, Config, backup Entry/Backup, preset types)
- Add JSON output branch to list, get, search, preset, and backup commands
- New diff subcommand: compare current state against a backup snapshot
- New export subcommand: export managed defaults to portable JSON
- New import subcommand: import and apply defaults from export file
- New watch subcommand: monitor a key for changes with configurable interval
- Add completions/ to .gitignore
- Add tests for parsing and output functions
@lu-zhengda lu-zhengda merged commit 1183b3a into main Feb 15, 2026
1 check passed
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.

1 participant