Skip to content

Refine hooks for documentation file management#276

Merged
affaan-m merged 4 commits into
affaan-m:mainfrom
pangerlkr:patch-7
Feb 24, 2026
Merged

Refine hooks for documentation file management#276
affaan-m merged 4 commits into
affaan-m:mainfrom
pangerlkr:patch-7

Conversation

@pangerlkr

@pangerlkr pangerlkr commented Feb 24, 2026

Copy link
Copy Markdown
Contributor

Updated command hooks to improve documentation file handling and added warnings for non-standard documentation files.

Description

Type of Change

  • fix: Bug fix
  • feat: New feature
  • refactor: Code refactoring
  • docs: Documentation
  • test: Tests
  • chore: Maintenance/tooling
  • ci: CI/CD changes

Checklist

  • Tests pass locally (node tests/run-all.js)
  • Validation scripts pass
  • Follows conventional commits format
  • Updated relevant documentation

Summary by CodeRabbit

  • Bug Fixes
    • Creation of markdown/text documentation now proceeds; the system emits a non-blocking warning instead of preventing the write.
    • Detection of non-standard documentation improved: additional patterns are excluded, checks are case-insensitive, and path checks ignore docs/ and skills/ locations.
    • Messaging and review output updated to reflect warning-only behavior and to display clearer review links and file paths.

Updated command hooks to improve documentation file handling and added warnings for non-standard documentation files.
Copilot AI review requested due to automatic review settings February 24, 2026 07:57
@coderabbitai

coderabbitai Bot commented Feb 24, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 72d0ca8 and ce3e5a3.

📒 Files selected for processing (1)
  • hooks/README.md

📝 Walkthrough

Walkthrough

Replaced a blocking PreToolUse:Write hook behavior with a non-blocking warning for certain .md/.txt docs; broadened and made exclusion checks case-insensitive (added CHANGELOG, LICENSE, SKILL, and explicit docs/ and skills/ path exclusions); adjusted hook and PR messaging/formatting.

Changes

Cohort / File(s) Summary
Write & PR hook
hooks/hooks.json
Converted blocking exit for MD/TXT documentation writes into a warning-only log and allowed writes to proceed; expanded and case-insensitive exclusion patterns (added CHANGELOG, LICENSE, SKILL, and explicit docs/ and skills/ path checks); adjusted PR URL/log formatting and messages.
Hook docs
hooks/README.md
Renamed "Doc file blocker" to "Doc file warning"; documented the switch from blocking to warning behavior and listed expanded exclusions and cross-platform path notes.

Sequence Diagram(s)

(Skipped — changes are localized hook/message updates and do not introduce multi-component sequential flows requiring visualization.)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

Possibly related PRs

Suggested reviewers

  • affaan-m

Poem

🐰 I once would thump and halt the trail,
Now I tap the leaf and tell the tale.
A gentle warning, not a wall so high,
Hop on, write on — beneath the sky. ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: refining hooks for documentation file management by converting blocking behavior to warnings.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR refines command hooks for documentation file management by converting the documentation file creation hook from a blocking hook to a warning-only hook, and makes a minor formatting change to a tmux command reminder.

Changes:

  • Modified tmux command suggestion formatting (removed double spaces)
  • Converted documentation file hook from blocking (exit code 2) to warning-only (no exit)
  • Expanded allowed documentation file patterns to include CHANGELOG, LICENSE, SKILL (case-insensitive), and docs/skills directories

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread hooks/hooks.json Outdated
{
"type": "command",
"command": "node -e \"const fs=require('fs');let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{try{const i=JSON.parse(d);const p=i.tool_input?.file_path||'';if(/\\.(md|txt)$/.test(p)&&!/(README|CLAUDE|AGENTS|CONTRIBUTING)\\.md$/.test(p)&&!/\\.claude\\/plans\\//.test(p)){console.error('[Hook] BLOCKED: Unnecessary documentation file creation');console.error('[Hook] File: '+p);console.error('[Hook] Use README.md for documentation instead');process.exit(2)}}catch{}console.log(d)})\""
"command": "node -e \"let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{{try{const i=JSON.parse(d);const p=i.tool_input?.file_path||'';if(/\\\\.(md|txt)$/.test(p)&&!/(README|CLAUDE|AGENTS|CONTRIBUTING|CHANGELOG|LICENSE|SKILL)\\\\.md$/i.test(p)&&!/\\\\.claude\\\\/plans\\\\//.test(p)&&!/(^|\\\\/)(docs|skills)\\\\//.test(p)){console.error('[Hook] WARNING: Non-standard documentation file detected');console.error('[Hook] File: '+p);console.error('[Hook] Consider consolidating into README.md or docs/ directory')}}catch{}console.log(d)}})\""

Copilot AI Feb 24, 2026

Copy link

Choose a reason for hiding this comment

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

There are double closing braces at the end of the command string. The code has console.log(d)}})\"" which creates an extra closing brace. This will cause a syntax error when the Node.js command is executed. The previous version had console.log(d)})\"" which is correct. Remove one of the closing braces before the closing parenthesis.

Suggested change
"command": "node -e \"let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{{try{const i=JSON.parse(d);const p=i.tool_input?.file_path||'';if(/\\\\.(md|txt)$/.test(p)&&!/(README|CLAUDE|AGENTS|CONTRIBUTING|CHANGELOG|LICENSE|SKILL)\\\\.md$/i.test(p)&&!/\\\\.claude\\\\/plans\\\\//.test(p)&&!/(^|\\\\/)(docs|skills)\\\\//.test(p)){console.error('[Hook] WARNING: Non-standard documentation file detected');console.error('[Hook] File: '+p);console.error('[Hook] Consider consolidating into README.md or docs/ directory')}}catch{}console.log(d)}})\""
"command": "node -e \"let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{try{const i=JSON.parse(d);const p=i.tool_input?.file_path||'';if(/\\\\.(md|txt)$/.test(p)&&!/(README|CLAUDE|AGENTS|CONTRIBUTING|CHANGELOG|LICENSE|SKILL)\\\\.md$/i.test(p)&&!/\\\\.claude\\\\/plans\\\\//.test(p)&&!/(^|\\\\/)(docs|skills)\\\\//.test(p)){console.error('[Hook] WARNING: Non-standard documentation file detected');console.error('[Hook] File: '+p);console.error('[Hook] Consider consolidating into README.md or docs/ directory')}}catch{}console.log(d)})\""

Copilot uses AI. Check for mistakes.
Comment thread hooks/hooks.json Outdated
{
"type": "command",
"command": "node -e \"const fs=require('fs');let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{try{const i=JSON.parse(d);const p=i.tool_input?.file_path||'';if(/\\.(md|txt)$/.test(p)&&!/(README|CLAUDE|AGENTS|CONTRIBUTING)\\.md$/.test(p)&&!/\\.claude\\/plans\\//.test(p)){console.error('[Hook] BLOCKED: Unnecessary documentation file creation');console.error('[Hook] File: '+p);console.error('[Hook] Use README.md for documentation instead');process.exit(2)}}catch{}console.log(d)})\""
"command": "node -e \"let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{{try{const i=JSON.parse(d);const p=i.tool_input?.file_path||'';if(/\\\\.(md|txt)$/.test(p)&&!/(README|CLAUDE|AGENTS|CONTRIBUTING|CHANGELOG|LICENSE|SKILL)\\\\.md$/i.test(p)&&!/\\\\.claude\\\\/plans\\\\//.test(p)&&!/(^|\\\\/)(docs|skills)\\\\//.test(p)){console.error('[Hook] WARNING: Non-standard documentation file detected');console.error('[Hook] File: '+p);console.error('[Hook] Consider consolidating into README.md or docs/ directory')}}catch{}console.log(d)}})\""

Copilot AI Feb 24, 2026

Copy link

Choose a reason for hiding this comment

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

The regex patterns have excessive backslash escaping. The patterns use quadruple backslashes \\\\ which will result in double backslashes \\ in the actual JavaScript string, breaking the regex. For example, /\\\\.(md|txt)$/ should be /\\.(md|txt)$/ (single backslash before the dot). Similarly, \\\\.md$ should be \\.md$, and \\\\.claude\\\\/ should be \\.claude\\/. The previous version correctly used double backslashes in the JSON string to represent single backslashes in JavaScript.

Suggested change
"command": "node -e \"let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{{try{const i=JSON.parse(d);const p=i.tool_input?.file_path||'';if(/\\\\.(md|txt)$/.test(p)&&!/(README|CLAUDE|AGENTS|CONTRIBUTING|CHANGELOG|LICENSE|SKILL)\\\\.md$/i.test(p)&&!/\\\\.claude\\\\/plans\\\\//.test(p)&&!/(^|\\\\/)(docs|skills)\\\\//.test(p)){console.error('[Hook] WARNING: Non-standard documentation file detected');console.error('[Hook] File: '+p);console.error('[Hook] Consider consolidating into README.md or docs/ directory')}}catch{}console.log(d)}})\""
"command": "node -e \"let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{{try{const i=JSON.parse(d);const p=i.tool_input?.file_path||'';if(/\\.(md|txt)$/.test(p)&&!/(README|CLAUDE|AGENTS|CONTRIBUTING|CHANGELOG|LICENSE|SKILL)\\.md$/i.test(p)&&!/\\.claude\\/plans\\//.test(p)&&!/(^|\\/)(docs|skills)\\//.test(p)){console.error('[Hook] WARNING: Non-standard documentation file detected');console.error('[Hook] File: '+p);console.error('[Hook] Consider consolidating into README.md or docs/ directory')}}catch{}console.log(d)}})\""

Copilot uses AI. Check for mistakes.
Comment thread hooks/hooks.json Outdated
{
"type": "command",
"command": "node -e \"let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{try{const i=JSON.parse(d);const cmd=i.tool_input?.command||'';if(process.platform!=='win32'&&!process.env.TMUX&&/(npm (install|test)|pnpm (install|test)|yarn (install|test)?|bun (install|test)|cargo build|make\\b|docker\\b|pytest|vitest|playwright)/.test(cmd)){console.error('[Hook] Consider running in tmux for session persistence');console.error('[Hook] tmux new -s dev | tmux attach -t dev')}}catch{}console.log(d)})\""
"command": "node -e \"let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{try{const i=JSON.parse(d);const cmd=i.tool_input?.command||'';if(process.platform!=='win32'&&!process.env.TMUX&&/(npm (install|test)|pnpm (install|test)|yarn (install|test)?|bun (install|test)|cargo build|make\\b|docker\\b|pytest|vitest|playwright)/.test(cmd)){console.error('[Hook] Consider running in tmux for session persistence');console.error('[Hook] tmux new -s dev | tmux attach -t dev')}}catch{}console.log(d)})\""

Copilot AI Feb 24, 2026

Copy link

Choose a reason for hiding this comment

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

The tmux command suggestion has been changed from two separate commands separated by double spaces tmux new -s dev | tmux attach -t dev to a single pipe tmux new -s dev | tmux attach -t dev. However, this piped command is logically incorrect. The tmux new -s dev creates and attaches to a new session, so the second part tmux attach -t dev would never execute (or would execute within the tmux session). The original version with double spaces was meant to show two alternative commands, not a pipe. Consider reverting this change or clarifying the intended usage, such as using "OR" or showing them on separate lines.

Suggested change
"command": "node -e \"let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{try{const i=JSON.parse(d);const cmd=i.tool_input?.command||'';if(process.platform!=='win32'&&!process.env.TMUX&&/(npm (install|test)|pnpm (install|test)|yarn (install|test)?|bun (install|test)|cargo build|make\\b|docker\\b|pytest|vitest|playwright)/.test(cmd)){console.error('[Hook] Consider running in tmux for session persistence');console.error('[Hook] tmux new -s dev | tmux attach -t dev')}}catch{}console.log(d)})\""
"command": "node -e \"let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{try{const i=JSON.parse(d);const cmd=i.tool_input?.command||'';if(process.platform!=='win32'&&!process.env.TMUX&&/(npm (install|test)|pnpm (install|test)|yarn (install|test)?|bun (install|test)|cargo build|make\\b|docker\\b|pytest|vitest|playwright)/.test(cmd)){console.error('[Hook] Consider running in tmux for session persistence');console.error('[Hook] tmux new -s dev # create a new session');console.error('[Hook] tmux attach -t dev # attach to the session')}}catch{}console.log(d)})\""

Copilot uses AI. Check for mistakes.
Comment thread hooks/hooks.json Outdated
}
],
"description": "Block creation of random .md files - keeps docs consolidated"
"description": "Warn about random .md files - keeps docs consolidated without blocking"

Copilot AI Feb 24, 2026

Copy link

Choose a reason for hiding this comment

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

The hook description and behavior have been changed from blocking to warning, but the corresponding documentation in hooks/README.md (line 26) still describes this as "Doc file blocker" with "2 (blocks)" exit code. The README should be updated to reflect that this is now a warning hook with "0 (warns)" exit code, and the name/description should be changed to match (e.g., "Doc file warning" or similar).

Suggested change
"description": "Warn about random .md files - keeps docs consolidated without blocking"
"description": "Doc file warning: warn about non-standard documentation files (exit code 0; warns only)"

Copilot uses AI. Check for mistakes.
Comment thread hooks/hooks.json Outdated
{
"type": "command",
"command": "node -e \"const fs=require('fs');let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{try{const i=JSON.parse(d);const p=i.tool_input?.file_path||'';if(/\\.(md|txt)$/.test(p)&&!/(README|CLAUDE|AGENTS|CONTRIBUTING)\\.md$/.test(p)&&!/\\.claude\\/plans\\//.test(p)){console.error('[Hook] BLOCKED: Unnecessary documentation file creation');console.error('[Hook] File: '+p);console.error('[Hook] Use README.md for documentation instead');process.exit(2)}}catch{}console.log(d)})\""
"command": "node -e \"let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{{try{const i=JSON.parse(d);const p=i.tool_input?.file_path||'';if(/\\\\.(md|txt)$/.test(p)&&!/(README|CLAUDE|AGENTS|CONTRIBUTING|CHANGELOG|LICENSE|SKILL)\\\\.md$/i.test(p)&&!/\\\\.claude\\\\/plans\\\\//.test(p)&&!/(^|\\\\/)(docs|skills)\\\\//.test(p)){console.error('[Hook] WARNING: Non-standard documentation file detected');console.error('[Hook] File: '+p);console.error('[Hook] Consider consolidating into README.md or docs/ directory')}}catch{}console.log(d)}})\""

Copilot AI Feb 24, 2026

Copy link

Choose a reason for hiding this comment

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

There are double opening braces after the arrow function in the command string. The code has ()=>{{try{ which creates an extra opening brace. This will cause a syntax error when the Node.js command is executed. The previous version had ()=>{try{ which is correct. Remove one of the opening braces after the arrow function.

Suggested change
"command": "node -e \"let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{{try{const i=JSON.parse(d);const p=i.tool_input?.file_path||'';if(/\\\\.(md|txt)$/.test(p)&&!/(README|CLAUDE|AGENTS|CONTRIBUTING|CHANGELOG|LICENSE|SKILL)\\\\.md$/i.test(p)&&!/\\\\.claude\\\\/plans\\\\//.test(p)&&!/(^|\\\\/)(docs|skills)\\\\//.test(p)){console.error('[Hook] WARNING: Non-standard documentation file detected');console.error('[Hook] File: '+p);console.error('[Hook] Consider consolidating into README.md or docs/ directory')}}catch{}console.log(d)}})\""
"command": "node -e \"let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{try{const i=JSON.parse(d);const p=i.tool_input?.file_path||'';if(/\\\\.(md|txt)$/.test(p)&&!/(README|CLAUDE|AGENTS|CONTRIBUTING|CHANGELOG|LICENSE|SKILL)\\\\.md$/i.test(p)&&!/\\\\.claude\\\\/plans\\\\//.test(p)&&!/(^|\\\\/)(docs|skills)\\\\//.test(p)){console.error('[Hook] WARNING: Non-standard documentation file detected');console.error('[Hook] File: '+p);console.error('[Hook] Consider consolidating into README.md or docs/ directory')}}catch{}console.log(d)})\""

Copilot uses AI. Check for mistakes.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
hooks/hooks.json (1)

40-40: Unnecessary double braces in the arrow function body.

()=>{{…}} introduces a redundant inner block statement. Every other inline hook in this file uses ()=>{…}. This is valid JS but inconsistent.

♻️ Proposed fix
-"command": "node -e \"let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{{try{const i=JSON.parse(d);const p=i.tool_input?.file_path||'';if(/\\\\.(md|txt)$/.test(p)&&!/(README|CLAUDE|AGENTS|CONTRIBUTING|CHANGELOG|LICENSE|SKILL)\\\\.md$/i.test(p)&&!/\\\\.claude\\\\/plans\\\\//.test(p)&&!/(^|\\\\/)(docs|skills)\\\\//.test(p)){console.error('[Hook] WARNING: Non-standard documentation file detected');console.error('[Hook] File: '+p);console.error('[Hook] Consider consolidating into README.md or docs/ directory')}}catch{}console.log(d)}})\""
+"command": "node -e \"let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{try{const i=JSON.parse(d);const p=i.tool_input?.file_path||'';if(/\\\\.(md|txt)$/.test(p)&&!/(README|CLAUDE|AGENTS|CONTRIBUTING|CHANGELOG|LICENSE|SKILL)\\\\.md$/i.test(p)&&!/\\\\.claude\\\\/plans\\\\//.test(p)&&!/(^|\\\\/)(docs|skills)\\\\//.test(p)){console.error('[Hook] WARNING: Non-standard documentation file detected');console.error('[Hook] File: '+p);console.error('[Hook] Consider consolidating into README.md or docs/ directory')}}catch{}console.log(d)})\""
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@hooks/hooks.json` at line 40, The inline hook command uses a redundant
double-brace arrow function body `()=>{{...}}`; update the arrow function to a
single block `()=>{...}` so the inner unnecessary block is removed (locate the
string starting with "node -e \"let
d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{{try{" and
change the `()=>{{`/`}})` sequence to `()=>{`/`})`), keeping the rest of the
command and behavior identical to preserve parsing and logging.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@hooks/hooks.json`:
- Line 40: The hook currently matches /\.(md|txt)$/ but the allowlist only
exempts names ending with ".md" via the regex
/(README|CLAUDE|AGENTS|CONTRIBUTING|CHANGELOG|LICENSE|SKILL)\.md$/i, so any .txt
(e.g., LICENSE.txt, requirements.txt) will always trigger; fix by either
restricting the match to /\.md$/ only or extend the allowlist to include common
.txt basenames (e.g., add REQUIREMENTS, LICENSE, NOTICE) in the existing
allowlist regex, keeping the other exclusion checks (/\.\claude\/plans\// and
/(^|\/)(docs|skills)\//) intact so behavior for those paths remains unchanged.

---

Nitpick comments:
In `@hooks/hooks.json`:
- Line 40: The inline hook command uses a redundant double-brace arrow function
body `()=>{{...}}`; update the arrow function to a single block `()=>{...}` so
the inner unnecessary block is removed (locate the string starting with "node -e
\"let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{{try{"
and change the `()=>{{`/`}})` sequence to `()=>{`/`})`), keeping the rest of the
command and behavior identical to preserve parsing and logging.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between db27ba1 and 0af5273.

📒 Files selected for processing (1)
  • hooks/hooks.json

Comment thread hooks/hooks.json Outdated
{
"type": "command",
"command": "node -e \"const fs=require('fs');let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{try{const i=JSON.parse(d);const p=i.tool_input?.file_path||'';if(/\\.(md|txt)$/.test(p)&&!/(README|CLAUDE|AGENTS|CONTRIBUTING)\\.md$/.test(p)&&!/\\.claude\\/plans\\//.test(p)){console.error('[Hook] BLOCKED: Unnecessary documentation file creation');console.error('[Hook] File: '+p);console.error('[Hook] Use README.md for documentation instead');process.exit(2)}}catch{}console.log(d)})\""
"command": "node -e \"let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{{try{const i=JSON.parse(d);const p=i.tool_input?.file_path||'';if(/\\\\.(md|txt)$/.test(p)&&!/(README|CLAUDE|AGENTS|CONTRIBUTING|CHANGELOG|LICENSE|SKILL)\\\\.md$/i.test(p)&&!/\\\\.claude\\\\/plans\\\\//.test(p)&&!/(^|\\\\/)(docs|skills)\\\\//.test(p)){console.error('[Hook] WARNING: Non-standard documentation file detected');console.error('[Hook] File: '+p);console.error('[Hook] Consider consolidating into README.md or docs/ directory')}}catch{}console.log(d)}})\""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

.txt files have no allowlist entries — warning fires on every .txt outside exempted directories.

The match condition is /\.(md|txt)$/ but the allowlist regex is /(README|CLAUDE|…|SKILL)\.md$/i, which covers .md names only. Files like requirements.txt, LICENSE.txt, or any project-level .txt file that isn't under docs/, skills/, or .claude/plans/ will always trigger the warning, regardless of their name or purpose.

If .txt alerting is intentional but selective, add corresponding allowlist entries (e.g. requirements, LICENSE, NOTICE); otherwise scope the trigger to .md only.

🛠️ Option A — restrict to .md only
-if(/\\\\.(md|txt)$/.test(p)&&
+if(/\\\\.md$/.test(p)&&
🛠️ Option B — extend the allowlist to cover common .txt names
-!/(README|CLAUDE|AGENTS|CONTRIBUTING|CHANGELOG|LICENSE|SKILL)\\\\.md$/i.test(p)
+!/(README|CLAUDE|AGENTS|CONTRIBUTING|CHANGELOG|LICENSE|SKILL)\\\\.(md|txt)$/i.test(p)&&!/(requirements|constraints|package)\\\\.txt$/i.test(p)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"command": "node -e \"let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{{try{const i=JSON.parse(d);const p=i.tool_input?.file_path||'';if(/\\\\.(md|txt)$/.test(p)&&!/(README|CLAUDE|AGENTS|CONTRIBUTING|CHANGELOG|LICENSE|SKILL)\\\\.md$/i.test(p)&&!/\\\\.claude\\\\/plans\\\\//.test(p)&&!/(^|\\\\/)(docs|skills)\\\\//.test(p)){console.error('[Hook] WARNING: Non-standard documentation file detected');console.error('[Hook] File: '+p);console.error('[Hook] Consider consolidating into README.md or docs/ directory')}}catch{}console.log(d)}})\""
"command": "node -e \"let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{{try{const i=JSON.parse(d);const p=i.tool_input?.file_path||'';if(/\\\\.md$/.test(p)&&!/(README|CLAUDE|AGENTS|CONTRIBUTING|CHANGELOG|LICENSE|SKILL)\\\\.md$/i.test(p)&&!/\\\\.claude\\\\/plans\\\\//.test(p)&&!/(^|\\\\/)(docs|skills)\\\\//.test(p)){console.error('[Hook] WARNING: Non-standard documentation file detected');console.error('[Hook] File: '+p);console.error('[Hook] Consider consolidating into README.md or docs/ directory')}}catch{}console.log(d)}})\""
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@hooks/hooks.json` at line 40, The hook currently matches /\.(md|txt)$/ but
the allowlist only exempts names ending with ".md" via the regex
/(README|CLAUDE|AGENTS|CONTRIBUTING|CHANGELOG|LICENSE|SKILL)\.md$/i, so any .txt
(e.g., LICENSE.txt, requirements.txt) will always trigger; fix by either
restricting the match to /\.md$/ only or extend the allowlist to include common
.txt basenames (e.g., add REQUIREMENTS, LICENSE, NOTICE) in the existing
allowlist regex, keeping the other exclusion checks (/\.\claude\/plans\// and
/(^|\/)(docs|skills)\//) intact so behavior for those paths remains unchanged.

@affaan-m affaan-m left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Automated review: checks are failing. Please fix failures before review.

…ehavior

Updated the Doc file blocker to a warning for non-standard files and improved path handling.

@affaan-m affaan-m left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Automated review: checks are failing. Please fix failures before review.

@affaan-m affaan-m left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Automated review: checks are failing. Please fix failures before review.

@affaan-m affaan-m left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Automated review: checks are failing. Please fix failures before review.

@affaan-m affaan-m left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Automated review: checks are failing. Please fix failures before review.

@affaan-m affaan-m left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Automated review: checks are failing. Please fix failures before review.

@affaan-m affaan-m left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Automated review: checks are failing. Please fix failures before review.

@affaan-m affaan-m left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Automated review: checks are failing. Please fix failures before review.

@affaan-m affaan-m left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Automated review: checks are failing. Please fix failures before review.

@affaan-m affaan-m left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Automated review: checks are failing. Please fix failures before review.

FrancescoRosciano pushed a commit to FRosciano-Mambo/everything-claude-code that referenced this pull request Jun 1, 2026
LGTM — Doc hook refinement from blocker to warning. Clean, well-scoped.
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