Skip to content

fix(hooks): judge each command as one line with any grep - #196

Merged
furedea merged 1 commit into
mainfrom
fix/judge-commands-as-one-line
Oct 17, 2026
Merged

furedea merged 1 commit into
mainfrom
fix/judge-commands-as-one-line

Conversation

@furedea-agent

@furedea-agent furedea-agent Bot commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

The real fix for #192, replacing the GNU grep lookup from #193 and #195.

  • Before matching, line breaks become spaces. Every grep then sees one line. Anchors span the whole command, and a newline inside a quoted argument can no longer hide a later line from an anchored rule. For example, gh api 'repos/x↵' --method DELETE used to pass as a read under macOS grep.
  • Plain grep without --null-data. GNU and BSD grep behave the same here, so the GNU grep lookup is removed.

Closes #192

Verification

  • uv run --frozen pytest tests: 1516 passed.
  • PATH=/usr/bin:$PATH uv run --frozen pytest tests/agents/hooks (macOS grep first): 963 passed.
  • The new contract runs under both greps. It checks that ^…$ matches the whole multi-line command and never a single line of it.
  • ruff and ty passed.

🤖 Generated with Claude Code

BSD grep ignores --null-data record boundaries, so anchors matched
single lines of a multi-line command, and a newline inside a quoted
argument could let a later line escape an anchored rule. Line breaks
now become spaces before matching, so GNU and BSD grep agree and no
GNU grep lookup is needed.

Closes #192

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@furedea
furedea merged commit c482c30 into main Oct 17, 2026
11 checks passed
@furedea
furedea deleted the fix/judge-commands-as-one-line branch October 17, 2026 12:10
@furedea-agent furedea-agent Bot mentioned this pull request Nov 20, 2026
3 of 4 tasks
furedea added a commit that referenced this pull request Nov 20, 2026
agent-config を v0.3.1 に更新する.`flake.lock` の `agent-config` だけを変える.

| 入力         | 変更前              | 変更後              |
| ------------ | ------------------- | ------------------- |
| agent-config | `2514f2d`(v0.3.0) | `3dfa0ad`(v0.3.1) |

v0.3.1 の主な変更:`gh` の確認の削減(#254,#256,#262),#196 の Jev 規則の修正(#257〜#260).

- [x] `3dfa0ad` が v0.3.1 タグのコミットであることを確認
- [x] `nix flake check --no-build` が通る
- [x] `darwinConfigurations.mba.system` をローカルで build
- [ ] CI

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: furedea <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
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.

子セッションで BSD grep が使われ,フックの判定がずれる

1 participant