Skip to content

Commit 41f7d23

Browse files
committed
ci: add pre-push test hook and fix dry_run file count bug
- Add local pre-commit hook to run pytest before push - Fix writer to correctly report files_written=0 in dry_run mode - Prevents CI test failures from incorrect file counting
1 parent c0aa9c9 commit 41f7d23

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

.pre-commit-config.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,13 @@ repos:
3232
stages: [commit-msg]
3333
args:
3434
- "--extends=@commitlint/config-conventional"
35+
36+
- repo: local
37+
hooks:
38+
- id: run-tests
39+
name: Run pytest before push
40+
entry: pytest
41+
language: system
42+
stages: [pre-push]
43+
pass_filenames: false
44+
always_run: true

slash_commands/writer.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,19 @@ def generate(self) -> dict[str, Any]:
112112

113113
# Generate files
114114
files = []
115+
files_written = 0
115116
for prompt in prompts:
116117
for agent in agent_configs:
117118
file_info = self._generate_file(prompt, agent)
118119
if file_info:
119120
files.append(file_info)
121+
# Only count files that were actually written (not dry run)
122+
if not self.dry_run:
123+
files_written += 1
120124

121125
return {
122126
"prompts_loaded": len(prompts),
123-
"files_written": len(files),
127+
"files_written": files_written,
124128
"files": files,
125129
"prompts": [{"name": p.name, "path": str(p.path)} for p in prompts],
126130
"backups_created": self._backups_created,

0 commit comments

Comments
 (0)