Skip to content

Commit 691492f

Browse files
lewingCopilot
andcommitted
Address review: pure shell hook, broader matcher, keep fallback pointer
- Replace node -e with grep+shell (no external runtime dependency) - Broaden matcher to Bash|PowerShell for cross-platform coverage - Add one-line disclosure pointer back to copilot-instructions.md for discoverability in environments without hook support Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 148082d commit 691492f

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

.github/copilot-instructions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ When NOT running under CCA, guidance for creating commits and pushing changes:
4646
- Never push to an active PR without being explicitly asked, even in autopilot/yolo mode. Always wait for explicit instruction to push.
4747
- Never chain commit and push in the same command. Always commit first, report what was committed, then wait for an explicit push instruction. This creates a mandatory decision point.
4848
- Prefer creating a new commit rather than amending an existing one. Exceptions: (1) explicitly asked to amend, or (2) the existing commit is obviously broken with something minor (e.g., typo or comment fix) and hasn't been pushed yet.
49+
- **AI-generated content disclosure:** When posting to GitHub under a user account (not a bot/copilot app), include a visible `> [!NOTE]` indicating AI/Copilot-generated content. Enforced automatically via [`.github/hooks/hooks.json`](.github/hooks/hooks.json); skip only if the user explicitly opts out.
4950

5051
---
5152

.github/hooks/hooks.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
"hooks": {
44
"PreToolUse": [
55
{
6-
"matcher": "Bash",
6+
"matcher": "Bash|PowerShell",
77
"hooks": [
88
{
99
"type": "command",
10-
"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(/gh\\s+(pr|issue)\\s+(create|comment|edit|review|merge)/.test(cmd)){console.error('AI-GENERATED CONTENT DISCLOSURE: When posting to GitHub under a user account (not a bot/copilot app account), include a visible note (e.g. \\'> [!NOTE]\\') indicating the content was AI/Copilot-generated. Skip only if the user explicitly asked to omit it.')}}catch{}})\""
10+
"command": "grep -qE 'gh\\s+(pr|issue)\\s+(create|comment|edit|review|merge)' && echo 'AI-GENERATED CONTENT DISCLOSURE: When posting to GitHub under a user account (not a bot/copilot app account), include a visible note (e.g. > [!NOTE]) indicating the content was AI/Copilot-generated. Skip only if the user explicitly asked to omit it.' >&2; :"
1111
}
1212
],
1313
"description": "Remind to include AI-generated content disclosure when posting to GitHub via gh CLI"

0 commit comments

Comments
 (0)