Skip to content

fix(omp-hooks): inGitRepo bail-early, accept type!(scope): form, echo subject - #157

Merged
danielvm-git merged 1 commit into
mainfrom
fix/omp-hooks-improvements
Oct 25, 2026
Merged

danielvm-git merged 1 commit into
mainfrom
fix/omp-hooks-improvements

Conversation

@danielvm-git

Copy link
Copy Markdown
Owner

Fixes #147. Fixes #151.

Changes

1. inGitRepo(cwd) bail-early — fixes #147

The tool_call handler now calls git rev-parse --git-dir with stdio: "ignore" before any other git work. If the session root is not a git repo, the handler returns immediately — no more fatal: not a git repository stderr spam on every command when working outside a git repo.

Credit: approach proposed by @ak-a-ra in #147.

2. Accept type!(scope): breaking form — fixes #151

CONVENTIONAL_RE was written for the spec-canonical type(scope)!: form. Many real-world repos use type!(scope): instead. The updated regex accepts the bang on either side of the optional scope:

// Before
/^(feat|fix|...)(\([^)]+\))?!?:\s.+/
// After
/^(feat|fix|...)!?(?:\([^)]+\))?!?:\s.+/

3. Echo the rejected subject — fixes #151

The blocked message now includes the actual first line of the commit message so the author can see what was rejected:

BLOCKED: Commit subject 'refactor!(config): move the set' must follow Conventional Commits: <type>(<scope>): <subject>.

Credit: analysis and proposed fix by @barbarum in #151.

🤖 Generated with Claude Code

…subject

Fixes #147. Fixes #151.

Three improvements to extensions/omp-hooks.ts:

1. inGitRepo(cwd) bail-early (#147): the tool_call handler now runs a cheap
   `git rev-parse --git-dir` with stdio:ignore before any branch query. If the
   session root is not a git repo, all git guards exit immediately — no more
   `fatal: not a git repository` stderr spam on every command outside a repo.

2. Accept type!(scope): form (#151): CONVENTIONAL_RE now matches the bang on
   either side of the optional scope group:
     /^(...)!?(?:\([^)]+\))?!?:\s.+/
   `refactor!(config): ...` was previously hard-blocked; it now passes.
   `refactor(config)!: ...` and `refactor: ...` still pass unchanged.

3. Echo the rejected subject (#151): the blocked reason now includes the actual
   subject line so the author can see what was rejected without guessing.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@danielvm-git
danielvm-git merged commit 9e1b11a into main Oct 25, 2026
@danielvm-git
danielvm-git deleted the fix/omp-hooks-improvements branch October 25, 2026 11:21
github-actions Bot pushed a commit that referenced this pull request Oct 25, 2026
## [2.88.11](v2.88.10...v2.88.11) (2026-10-25)

### Bug Fixes

* **guard:** resolve git branch per command target, not process cwd ([#154](#154)) ([07c7498](07c7498))
* **lockfile:** add missing slash in skill path + self-contained resolve_repo_root ([#156](#156)) ([04bda15](04bda15))
* **omp-hooks:** inGitRepo bail-early, accept type!(scope) form, echo subject ([#157](#157)) ([9e1b11a](9e1b11a)), closes [#147](#147) [#151](#151) [#151](#151)

### Performance Improvements

* **sync:** render all skills in one bash process per adapter ([#155](#155)) ([1b56463](1b56463)), closes [#137](#137)
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 2.88.11 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

1 participant