Skip to content

Commit 8820021

Browse files
celiasclaude
andcommitted
chore: add guardrails — TypeScript fixes, ESLint, Prettier, Husky, CI (GAB-19)
- Fix 7 TypeScript errors in reddit-poller.ts (implicit any, possibly undefined comicswapData fields); add RawRedditPost interface for the raw Reddit API response shape - Add Prettier (.prettierrc, .prettierignore, format/format:check scripts); reformat all files to enforce consistent style - Add root ESLint flat config targeting *.ts; fix dashboard eslint.config.js to also lint *.ts/*.tsx (was js/jsx only); add lint/lint:fix scripts - Add Husky pre-commit hook running lint-staged + tsc --noEmit - Add GitHub Actions CI workflow (lint, format:check, tsc, build on push/PR to main) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 9f8ac91 commit 8820021

32 files changed

Lines changed: 1700 additions & 268 deletions

.claude/agents/image-strategy.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ Execution requirements:
138138
- Asynchronous queue/worker so poller cadence and API latency are unaffected
139139
- Rate limiting + retries with backoff
140140
- Confidence policy:
141-
- >= 0.85 auto-attach
141+
- > = 0.85 auto-attach
142142
- 0.60 to 0.84 hold for manual-review path
143143
- < 0.60 keep empty
144144

.claude/commands/junior-review.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Pull up ticket $ARGUMENTS from Linear and review the plan like a junior engineer
33
Your job is NOT to implement it. Your job is to ask every question you can think of before a single line of code gets written.
44

55
For every statement in the plan, ask yourself:
6+
67
- What if this fails? What's the fallback?
78
- Is this ambiguous? Could I interpret it two different ways?
89
- What are the edge cases?

.claude/commands/lessons-learned.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Something went wrong or took too long. Let's capture it.
22

33
Ask me:
4+
45
1. What happened?
56
2. Why did it happen? (Push past "I messed up" — what's the systemic reason?)
67
3. What's the rule going forward to prevent this?

.claude/commands/work-ticket.md

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@ Pull up ticket $ARGUMENTS from Linear using get_issue.
22

33
1. Read the ticket fully — acceptance criteria, implementation plan, testing plan, and any comments.
44

5-
**Before doing any work, check if it's already done:**
6-
2. Search the codebase for evidence the work described in the ticket already exists (grep for key identifiers, function names, routes, or UI elements mentioned in the acceptance criteria).
7-
3. Check git log on main for recent commits that may have addressed this work.
8-
4. If the work appears already complete, tell me what you found and ask whether to close the ticket as-is or continue.
5+
**Before doing any work, check if it's already done:** 2. Search the codebase for evidence the work described in the ticket already exists (grep for key identifiers, function names, routes, or UI elements mentioned in the acceptance criteria). 3. Check git log on main for recent commits that may have addressed this work. 4. If the work appears already complete, tell me what you found and ask whether to close the ticket as-is or continue.
96

10-
**If work is not already done:**
11-
5. Use list_issue_statuses to find the correct "Done" or "Complete" status ID for this team.
12-
6. Implement everything described in the ticket. Reference specific files and follow the implementation plan order.
13-
7. Run any relevant tests and verify acceptance criteria are met.
14-
8. Show me a summary of what was done and ask for confirmation before closing.
15-
9. On confirmation, use save_issue to move the ticket to the "Done" status.
16-
10. Use save_comment to add a brief summary of what was implemented and any notable decisions made.
7+
**If work is not already done:** 5. Use list_issue_statuses to find the correct "Done" or "Complete" status ID for this team. 6. Implement everything described in the ticket. Reference specific files and follow the implementation plan order. 7. Run any relevant tests and verify acceptance criteria are met. 8. Show me a summary of what was done and ask for confirmation before closing. 9. On confirmation, use save_issue to move the ticket to the "Done" status. 10. Use save_comment to add a brief summary of what was implemented and any notable decisions made.

.github/instructions/api-files.instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ try {
2626
const response = await fetch(url);
2727
if (!response.ok) {
2828
throw new Error(
29-
`API request failed: ${response.status} ${response.statusText}`,
29+
`API request failed: ${response.status} ${response.statusText}`
3030
);
3131
}
3232
const data = await response.json();

.github/workflows/ci.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: CI
2+
on:
3+
push:
4+
branches: [main]
5+
pull_request:
6+
branches: [main]
7+
8+
jobs:
9+
validate:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-node@v4
14+
with:
15+
node-version: 20
16+
cache: npm
17+
- run: npm ci
18+
- run: npm run lint
19+
- run: npm run format:check
20+
- run: npx tsc --noEmit
21+
- run: npm run build

.husky/pre-commit

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
npx lint-staged
2+
npx tsc --noEmit

.prettierignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
dist
3+
generated
4+
dashboard/dist

.prettierrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"semi": true,
3+
"singleQuote": false,
4+
"tabWidth": 2,
5+
"trailingComma": "es5",
6+
"printWidth": 80
7+
}

CLAUDE.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ Comic Hunter monitors Reddit for free and cheap comic deals, scores posts by key
1515

1616
## Architecture — 3 Processes
1717

18-
| Process | File | Port | Purpose |
19-
|---------|------|------|---------|
20-
| Reddit Poller | `reddit-poller.ts` || Polls subreddits, scores posts, saves alerts, fires Discord webhooks |
21-
| API Server | `api-server.ts` | 3001 | Express — serves alerts and keyword data to the dashboard |
22-
| Dashboard | `dashboard/` | 5173 | React — real-time alert browser with filters |
18+
| Process | File | Port | Purpose |
19+
| ------------- | ------------------ | ---- | -------------------------------------------------------------------- |
20+
| Reddit Poller | `reddit-poller.ts` | | Polls subreddits, scores posts, saves alerts, fires Discord webhooks |
21+
| API Server | `api-server.ts` | 3001 | Express — serves alerts and keyword data to the dashboard |
22+
| Dashboard | `dashboard/` | 5173 | React — real-time alert browser with filters |
2323

2424
## Common Commands
2525

0 commit comments

Comments
 (0)