[IMP] core: Provide AI-friendly instructions and prevent PTY hangs#222
Merged
[IMP] core: Provide AI-friendly instructions and prevent PTY hangs#222
Conversation
…on universally In environments where an agent operates inside an Integrated Terminal (like Cursor or Copilot), a Pseudo-TTY (PTY) is allocated. This causes the pre-commit hook to evaluate `[ -c /dev/tty ] && [ -t 1 ]` as TRUE, trapping the agent in the interactive `read` prompt indefinitely since agents cannot type "y". This commit improves the safety net by: 1. Adding a 10-second timeout (`-t 10`) to the interactive prompt. If no input is received (e.g. from an agent), it assumes "Y" and proceeds to run the linter. 2. Removing the `[ ! -c /dev/tty ]` condition from the failure instructions block. This ensures that the 🤖 AUTOMATION & AI AGENT INSTRUCTION is printed universally whenever the hook fails, serving as a vital recovery manual for both agents (in PTYs), headless CI environments, and human developers.
a06ac5c to
19100b1
Compare
By embedding an AI agent skill directly into the pre-commit-vauxoo repository, developers can symlink this skill into their global AI environments (like ~/.gemini/antigravity/skills/). This natively teaches any AI agent working on 15+ different Odoo projects to ALWAYS verify and install pre-commit-vauxoo before making a commit, preventing silent CI failures and enforcing the ecosystem's quality rules.
19100b1 to
9086a33
Compare
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.
This PR enhances the pre-commit hook to be resilient in headless and AI agent environments, while also shipping a native agent skill.
1. Robust Hook Execution (Code)
In environments where an agent operates inside an Integrated Terminal (like Cursor or Copilot), a Pseudo-TTY (PTY) is allocated. This previously trapped the agent in the interactive
readprompt indefinitely.-t 10) to the interactive prompt. If no input is received, it assumes "Y" and proceeds.🤖 AUTOMATION & AI AGENT INSTRUCTIONblock with recovery steps (git add, fix lints, retry). This is printed universally, regardless of TTY presence.2. Native AI Skill (.agents)
Ships
.agents/skills/vauxoo-pre-commit/SKILL.mddirectly in the repository.Developers can symlink this skill into their global AI environments (e.g.,
~/.gemini/antigravity/skills/). This natively teaches any AI agent working on Odoo projects to ALWAYS verify and installpre-commit-vauxoobefore committing, preventing silent CI failures.cc @moylop260 as requested by @nhomar for review.