Skip to content

[1.9] Port use_npx_openspec hook and hook-test - #1068

Merged
dimuon merged 2 commits into
elastic:masterfrom
dimuon:llm-sdlc/1.9-use-npx-openspec-hook
Oct 1, 2026
Merged

dimuon merged 2 commits into
elastic:masterfrom
dimuon:llm-sdlc/1.9-use-npx-openspec-hook

Conversation

@dimuon

@dimuon dimuon commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Port the stack provider hook that rewrites a bare openspec to npx openspec, plus make hook-test.
  • Cursor loads it from .cursor/hooks.json. Claude Code loads the same script and leaves Bash calls unchanged, because the rewrite only handles tool_name Shell.

Relates to elastic/cp-hosted-team#4371.

Test plan

  • make hook-test (8 tests)
  • make help shows hook-test

Made with Cursor

Cursor loads it from .cursor/hooks.json. make hook-test covers the rewrite.

Co-authored-by: Cursor <cursoragent@cursor.com>
@dimuon
dimuon requested a review from a team as a code owner September 29, 2026 11:14
Copilot AI balanced review requested due to automatic review settings September 29, 2026 11:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The regex can mutate quoted text while missing real multiline OpenSpec invocations.

Review effort: Balanced
Findings: 1 Medium severity

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-test and 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.

Comment thread .agents/hooks/use_npx_openspec.js
@dimuon
dimuon requested a review from tobio September 29, 2026 16:08
Copilot AI balanced review requested due to automatic review settings October 1, 2026 13:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The hook integration, tests, Make target, and documentation are internally consistent with no unresolved correctness issues.

Review effort: Balanced
Findings: None

Resolved since last review (1)

@dimuon
dimuon merged commit 848d9a0 into elastic:master Oct 1, 2026
6 checks passed
@dimuon
dimuon deleted the llm-sdlc/1.9-use-npx-openspec-hook branch October 1, 2026 14: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.

3 participants