openspec validate hangs when runnings as pre-commit hook #367
Copy link
Copy link
Description
We use pre-commit to ensure that our code is linted before committing.
We have noticed that pre-commit hangs when it goes to run this check.
I wanted to run openspec validate there
repos:
- repo: local
hooks:
- id: openspec-validate
name: Validate OpenSpec
language: script
entry: openspec
args:
- "validate"
- "--specs"
- "--strict"
- "--no-interactive"
pass_filenames: false
files: ^openspec/specs/
For some reason this hook just hangs. Running the command locally works - as does wrapping the call in a separate script:
#!/bin/sh
set -e
# Disable any potential interactive features
export CI=true
export OPENSPEC_NO_INTERACTIVE=1
# Close stdin and exec
exec openspec validate --specs --strict --no-interactive 0<&-
I've created a repo to help test this out:
https://github.com/greenkiwi/openspec-pre-commit-hook-issue
It has all the files and hooks.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
TabishB commentedon Dec 21, 2025
@greenkiwi I have a feeling it's something to do with the non-interactive flag not being respected because of something funky happening with @inquirer/prompts. I'm taking a look now.
fix(cli): prevent hang in pre-commit hooks by using dynamic imports
fix(cli): prevent hang in pre-commit hooks by using dynamic imports (F…
feat(cli): add external issue tracking support (OpenSplx-#2)
feat(cli): add external issue tracking support (OpenSplx-#2)
greenkiwi commentedon Dec 22, 2025
@TabishB I'm still setting this issue. I'm happy to add anything to get more debugging.
fix(cli): use dynamic import for @inquirer/prompts in config command
chore: add ESLint with no-restricted-imports rule for @InQuirer
fix(cli): use dynamic import for @inquirer/prompts in config command (#…
chore: sync upstream parent/main (#7)
fix(cli): use dynamic import for @inquirer/prompts in config command (F…
fix(cli): use dynamic import for @inquirer/prompts in config command (F…
fix(lint): use dynamic imports for @inquirer/prompts
feat(review): add review system for validating implementations agains…
fix(cli): prevent hang in pre-commit hooks by using dynamic imports (F…
fix(cli): use dynamic import for @inquirer/prompts in config command (F…
fix(cli): prevent hang in pre-commit hooks by using dynamic imports (F…
fix(cli): use dynamic import for @inquirer/prompts in config command (F…