feat: -filters --json (machine-readable filter list)#45
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #25.
imgcli -filters --jsonemits[{"name","syntax","description"}, ...]so agents/tools can enumerate + validate filters programmatically — generated from the registry, always in sync with the binary.util(shared, no dup);-filtersdispatches on--json(order-independent).make checknow validates the JSON.Per #25's decision: minimal name/syntax/description (no registry-wide param metadata).
🤖 Generated with Claude Code