Skip to content

Commit 83baa88

Browse files
chore: block comments that describe the edit history (#52)
Add scripts/check-comment-quality.mjs from fallow-rs/fallow with its node:test tests. The script blocks code comments that describe the edit history or narrate the session, such as "used to be" or "before this fix". CI runs the tests and the --all check. The Claude Code hooks in .claude/settings.json check edits before they land. A new AGENTS.md holds the "Write for the reader" rule. The current tree has no findings. The script stays identical to the fallow copy, so .fallowrc.json removes it from the fallow health checks.
1 parent 0ad26c9 commit 83baa88

6 files changed

Lines changed: 939 additions & 0 deletions

File tree

‎.claude/settings.json‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"hooks": {
3+
"PreToolUse": [
4+
{
5+
"matcher": "Edit|Write|MultiEdit",
6+
"hooks": [
7+
{
8+
"type": "command",
9+
"command": "root=$(git rev-parse --show-toplevel 2>/dev/null || pwd); node \"$root/scripts/check-comment-quality.mjs\" --claude-pre-tool",
10+
"statusMessage": "Checking new comments for narration and edit history..."
11+
}
12+
]
13+
}
14+
],
15+
"Stop": [
16+
{
17+
"hooks": [
18+
{
19+
"type": "command",
20+
"command": "root=$(git rev-parse --show-toplevel 2>/dev/null || pwd); node \"$root/scripts/check-comment-quality.mjs\" --working-tree --claude-hook",
21+
"statusMessage": "Checking added comments for routine narration..."
22+
}
23+
]
24+
}
25+
]
26+
}
27+
}

‎.fallowrc.json‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/fallow-rs/fallow/main/schema.json",
3+
"health": {
4+
"ignore": ["scripts/check-comment-quality.mjs"]
5+
}
6+
}

‎.github/workflows/ci.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ jobs:
2525
- run: npm run typecheck
2626
- run: npm run lint
2727
- run: npm run fmt:check
28+
- name: Comments describe the code as it is now
29+
run: |
30+
node --test scripts/check-comment-quality.test.mjs
31+
node scripts/check-comment-quality.mjs --all
2832
- run: npm test
2933
- run: npm run build
3034
- name: Evaluation inputs match their frozen labels and questions

‎AGENTS.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# fallow-verdict agent guide
2+
3+
## Write for the reader
4+
5+
Write code comments, docs, commit messages, PR text, and changelog entries
6+
for a reader who did not see the session. Do not put the conversation, the
7+
prompt, discarded attempts, or the edit history into them. Describe the code
8+
as it is now. For a regression, state what breaks without the code, and link
9+
the issue. `scripts/check-comment-quality.mjs` blocks narration and history
10+
comments in CI and in Claude edits.

0 commit comments

Comments
 (0)