Skip to content

Commit 1d3970c

Browse files
authored
Fix AI file exclusion (#54)
1 parent abad371 commit 1d3970c

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

.pre-commit-hooks.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
entry: duolingo/pre-commit-hooks:1.11.0 /entry
44
language: docker_image
55
types: [text]
6-
exclude: &sync_ai_rules_output (AGENTS|CLAUDE|copilot-instructions)\.md$
76

87
- id: sync-ai-rules
98
name: Sync AI Rules
@@ -22,7 +21,6 @@
2221
entry: /entry
2322
language: docker
2423
types: [text]
25-
exclude: *sync_ai_rules_output
2624

2725
- id: sync-ai-rules-dev
2826
name: Sync AI Rules (dev)

entry.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,9 +494,14 @@ const HOOKS: Record<HookName, LockableHook> = {
494494
/** Files that match this pattern should never be processed */
495495
const GLOBAL_EXCLUDES = (() => {
496496
const FOLDER_EXCLUDES = ["build", "node_modules"];
497-
const FILE_EXCLUDES = ["gradlew"];
497+
const FILE_EXCLUDES = [
498+
"AGENTS.md", // Generated by sync-ai-rules pre-commit hook
499+
"CLAUDE.md", // Generated by sync-ai-rules pre-commit hook
500+
"copilot-instructions.md", // Generated by sync-ai-rules pre-commit hook
501+
"gradlew",
502+
];
498503
return RegExp(
499-
`(^|/)((${FOLDER_EXCLUDES.join("|")})/|(${FILE_EXCLUDES.join("|")})$)`,
504+
`(^|/)((${FOLDER_EXCLUDES.join("|")})/|(${FILE_EXCLUDES.map(f => f.replace(/\./g, "\\.")).join("|")})$)`,
500505
);
501506
})();
502507

0 commit comments

Comments
 (0)