Skip to content

feat: -filters --json (machine-readable filter list)#45

Merged
swperb merged 1 commit into
mainfrom
feat/filters-json
Jun 15, 2026
Merged

feat: -filters --json (machine-readable filter list)#45
swperb merged 1 commit into
mainfrom
feat/filters-json

Conversation

@swperb

@swperb swperb commented Jun 15, 2026

Copy link
Copy Markdown
Owner

Closes #25. imgcli -filters --json emits [{"name","syntax","description"}, ...] so agents/tools can enumerate + validate filters programmatically — generated from the registry, always in sync with the binary.

  • Moved the JSON escaper to util (shared, no dup); -filters dispatches on --json (order-independent).
  • Docs updated; make check now validates the JSON.
  • Verified: valid JSON, 29 entries match the human list, ASan/UBSan clean.

Per #25's decision: minimal name/syntax/description (no registry-wide param metadata).

🤖 Generated with Claude Code

Closes #25. Adds `imgcli -filters --json`, emitting a JSON array of
{name, syntax, description} per filter so agents/build tools can enumerate and
validate the available filters programmatically. Generated from the FILTERS[]
registry, so it's always in sync with the binary.

- filters.c: filters_print_json() + split_usage() (splits each usage string into
  syntax + description on the first 2+ space run).
- Moved the JSON string escaper (json_str) from main.c to util so filters.c can
  share it (no duplication).
- main.c: -filters dispatches to the JSON printer when --json is set (order-
  independent).
- AGENTS.md/README documented; `make check` now validates the JSON output.

Verified: valid JSON, 29 entries matching the human list, ASan/UBSan clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@swperb swperb merged commit 8604d79 into main Jun 15, 2026
7 checks passed
@swperb swperb deleted the feat/filters-json branch June 15, 2026 15:24
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.

Machine-readable filter list: -filters --json

1 participant