MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / shouldIncludeRuleFile

Function shouldIncludeRuleFile

src/services/rules/rules.ts:36–74  ·  view source on GitHub ↗
(filename: string)

Source from the content-addressed store, hash-verified

34export type RulesMode = Pick<ModeConfig, "slug" | "name">
35
36export function shouldIncludeRuleFile(filename: string): boolean {
37 const basename = path.basename(filename)
38 if (!basename.toLowerCase().endsWith(".md")) {
39 return false
40 }
41
42 const cachePatterns = [
43 "*.DS_Store",
44 "*.bak",
45 "*.cache",
46 "*.crdownload",
47 "*.db",
48 "*.dmp",
49 "*.dump",
50 "*.eslintcache",
51 "*.lock",
52 "*.log",
53 "*.old",
54 "*.part",
55 "*.partial",
56 "*.pyc",
57 "*.pyo",
58 "*.stackdump",
59 "*.swo",
60 "*.swp",
61 "*.temp",
62 "*.tmp",
63 "Thumbs.db",
64 ]
65
66 return !cachePatterns.some((pattern) => {
67 if (pattern.startsWith("*.")) {
68 const extension = pattern.slice(1)
69 return basename.endsWith(extension)
70 }
71
72 return basename === pattern
73 })
74}
75
76export async function getRules(cwd: string, options: { modes?: readonly RulesMode[] } = {}): Promise<RuleMetadata[]> {
77 const directories = getRuleDirectories(cwd, options.modes)

Callers 3

scanRuleDirectoryFunction · 0.70
rules.spec.tsFile · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected