Skip to content

feat(hooks): let analyze and format take their files as arguments - #175

Closed
ryzizub wants to merge 1 commit into
mainfrom
feat/hook-file-path-args
Closed

ryzizub wants to merge 1 commit into
mainfrom
feat/hook-file-path-args

Conversation

@ryzizub

@ryzizub ryzizub commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Description

analyze.sh and format.sh read the edited file from tool_input.file_path, which is how Claude Code reports an edit. Other hosts report edits differently (Codex's apply_patch has no file_path), and teaching the scripts each host's payload would make them less Claude-first.

Instead the scripts now take their files as arguments, through one shared hook_file_paths helper:

  • arguments given: use them, no payload read
  • none given: tool_input.file_path from the payload, unchanged for Claude Code
  • several files per run; analyze.sh reports every failure, then exits 2

A host-specific adapter passes the paths. VeryGoodOpenSource/vgv_ai_cli#51 does that for Codex from the generated hooks.json command, so nothing about Codex lives here.

Both scripts gain tests (stubbed dart, as the existing suites stub very_good); all six suites pass. Replaces #174.

Type of Change

  • New feature (feat)
  • Bug fix (fix)
  • Code refactor (refactor)
  • Documentation (docs)
  • CI change (ci)
  • Chore (chore)

🤖 Generated with Claude Code

The scripts read the edited file from tool_input.file_path, which is how
Claude Code reports an edit. A host that reports edits differently can now
pass the files as arguments instead, through the shared hook_file_paths
helper, so the scripts never learn a second payload shape. Both handle
several files per run, and analyze reports every failure before exiting 2.

Both gain tests that stub dart and assert which files it was asked to
handle, like the existing suites stub very_good.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@ryzizub ryzizub closed this Oct 6, 2026
@ryzizub
ryzizub deleted the feat/hook-file-path-args branch October 6, 2026 08:55
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