[1.9] Port use_npx_openspec hook and hook-test - #1068
Merged
Merged
Conversation
Cursor loads it from .cursor/hooks.json. make hook-test covers the rewrite. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The regex can mutate quoted text while missing real multiline OpenSpec invocations.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Adds agent hooks that rewrite bare openspec shell invocations to npx openspec.
Changes:
- Adds Cursor and agent hook configuration.
- Implements and tests the command-rewriting hook.
- Adds
make hook-testand updates workflow documentation.
| File | Description |
|---|---|
.agents/hooks/use_npx_openspec.js |
Implements hook rewriting. |
.agents/hooks/use_npx_openspec.test.mjs |
Adds eight hook tests. |
.agents/hooks.json |
Registers the agent hook. |
.agents/settings.json |
Configures Claude Code loading. |
.cursor/hooks.json |
Registers the Cursor hook. |
build/Makefile.test |
Adds hook-test. |
dev-docs/high-level/development-workflow.md |
Documents hook usage and testing. |
dev-docs/high-level/openspec-workflows.md |
Documents agent-specific behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
tobio
approved these changes
Oct 1, 2026
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.

Summary
openspectonpx openspec, plusmake hook-test..cursor/hooks.json. Claude Code loads the same script and leavesBashcalls unchanged, because the rewrite only handlestool_nameShell.Relates to elastic/cp-hosted-team#4371.
Test plan
make hook-test(8 tests)make helpshowshook-testMade with Cursor