Skip to content

Commit 926e59e

Browse files
committed
fix(validate_marketplace_counts): use exclude parameter in all counter strategies
All four counter strategies (_count_agent_md, _count_commands, _count_hooks, _count_skill_dirs) now properly use the exclude parameter passed from the strategy interface. Previously they accepted the parameter but ignored it, which violated the uniform interface contract. - _count_agent_md: Now filters out excluded filenames - _count_commands: Now uses passed exclude set (defaults to CLAUDE.md) - _count_hooks: Now passes exclude to _walk_files instead of empty set - _count_skill_dirs: Now filters out excluded directory names
1 parent 19353b5 commit 926e59e

1 file changed

Lines changed: 16 additions & 7 deletions

File tree

build/scripts/validate_marketplace_counts.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,26 +72,35 @@ def _count_md_agents(directory: Path, exclude: set[str] | None = None) -> int:
7272

7373

7474
def _count_agent_md(directory: Path, exclude: set[str] | None = None) -> int:
75-
"""Count .agent.md files in a directory."""
76-
return sum(1 for f in directory.glob("*.agent.md") if f.is_file())
75+
"""Count .agent.md files in a directory, excluding specific filenames."""
76+
exclude = exclude or set()
77+
return sum(
78+
1
79+
for f in directory.glob("*.agent.md")
80+
if f.is_file() and f.name not in exclude
81+
)
7782

7883

7984
def _count_commands(directory: Path, exclude: set[str] | None = None) -> int:
80-
"""Count command .md files recursively, excluding CLAUDE.md.
85+
"""Count command .md files recursively, excluding specific filenames.
8186
8287
Walks pruning EXCLUDED_DIRS; safe against vendored subtrees.
88+
Defaults to excluding CLAUDE.md if no exclude set is provided.
8389
"""
84-
return _walk_files(directory, ".md", {"CLAUDE.md"})
90+
exclude = exclude if exclude is not None else {"CLAUDE.md"}
91+
return _walk_files(directory, ".md", exclude)
8592

8693

8794
def _count_hooks(directory: Path, exclude: set[str] | None = None) -> int:
8895
"""Count hook .py scripts (all levels), pruning EXCLUDED_DIRS."""
89-
return _walk_files(directory, ".py", set())
96+
exclude = exclude or set()
97+
return _walk_files(directory, ".py", exclude)
9098

9199

92100
def _count_skill_dirs(directory: Path, exclude: set[str] | None = None) -> int:
93-
"""Count immediate subdirectories (each is a skill)."""
94-
return sum(1 for d in directory.iterdir() if d.is_dir())
101+
"""Count immediate subdirectories (each is a skill), excluding specific names."""
102+
exclude = exclude or set()
103+
return sum(1 for d in directory.iterdir() if d.is_dir() and d.name not in exclude)
95104

96105

97106
# Strategy registry. Add new keys ONLY when introducing a fundamentally

0 commit comments

Comments
 (0)