Skip to content

Add --format json to --list-operations; hint on unknown operations in validation - #122

Merged
matthewhorridge merged 1 commit into
mainfrom
feat/agent-friendly-listing
Jul 9, 2026
Merged

Add --format json to --list-operations; hint on unknown operations in validation#122
matthewhorridge merged 1 commit into
mainfrom
feat/agent-friendly-listing

Conversation

@matthewhorridge

Copy link
Copy Markdown
Contributor

Summary

  • harmonize --list-operations --format json emits a machine-readable listing: [{operation, summary, help}] where help is the full class docstring — for case/coalesce that includes complete authoring examples, so tools and AI agents that write rules files get authoring guidance, not just names
  • Validation detects unknown operation names explicitly and adds a did-you-mean suggestion (unknown operation 'normalize_bool' (did you mean 'normalize_boolean'?))
  • When any unknown operation is reported, the validate output ends with hint: run 'harmonize --list-operations' to see the available operations

Sample validate output:

bad_rules.yaml: INVALID
  rule 1 (target 'b'): operation 1: unknown operation 'frobnicate' (did you mean 'truncate'?)
  rule 2: 'target' must be a non-empty string
  rule 2: operation 1 ('extract_regex'): Invalid regex pattern: '('
hint: run 'harmonize --list-operations' to see the available operations

Test plan

  • New tests: JSON listing covers the full registry with non-empty summary/help and authoring examples present for case; did-you-mean suggestion; hint shown on unknown operations and absent otherwise
  • pytest tests — 224 passed

🤖 Generated with Claude Code

'harmonize --list-operations --format json' emits a machine-readable
listing with the FULL class docstring per operation - for case and
coalesce that includes complete authoring examples - so tools and AI
agents that write rules files get authoring guidance, not just names.

Validation now detects unknown operation names explicitly, adds a
difflib did-you-mean suggestion, and the CLI prints a pointer to
--list-operations when any unknown operation is reported.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@matthewhorridge
matthewhorridge merged commit 55a6f1d into main Jul 9, 2026
1 check passed
@matthewhorridge
matthewhorridge deleted the feat/agent-friendly-listing branch July 9, 2026 17:58
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