Skip to content

Commit a9f6744

Browse files
titouanmathisclaude
andcommitted
Update CLAUDE.md and package.json with new check scripts
Co-authored-by: Claude <claude@anthropic.com>
1 parent 566bf65 commit a9f6744

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

CLAUDE.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ Instructions for AI agents contributing to this codebase.
44

55
## Git & Commits
66

7-
- Commit messages: English, simple verb-first sentences (e.g., "Add...", "Fix...", "Update...")
8-
- Always add `Co-authored-by: Claude <claude@anthropic.com>` trailer
9-
- **Tags**: Do NOT use `v` prefix (use `0.4.0` not `v0.4.0`)
7+
<!-- Commit format, Co-authored-by trailer, and tag prefix rules are enforced by git hooks:
8+
.husky/commit-msg → scripts/check-commit-msg.sh
9+
.husky/pre-push → rejects v-prefixed tags -->
10+
1011
- **Releases**: Do NOT create GitHub releases manually — they are created automatically by GitHub Actions when a tag is pushed
1112

1213
## Changelog
@@ -230,12 +231,10 @@ These rules are **mandatory** for all code in this monorepo:
230231

231232
3. **File system operations must be mocked.** Never read/write real user files in tests.
232233

233-
4. **Test file conventions:** Tests are colocated with source files: `foo.ts``foo.test.ts` in the same directory. CLI command tests live in their respective `src/commands/<resource>/` directory.
234+
4. **Test file conventions:** Tests are colocated with source files: `foo.ts``foo.test.ts` in the same directory. CLI command tests live in their respective `src/commands/<resource>/` directory. Run `npm run check:tests` to find missing test files.
234235

235236
5. **No real API calls in tests.** All HTTP requests must be mocked via DI (injected `fetch`) or mock API objects.
236237

237-
6. **Vitest configuration:** Root `vitest.config.ts` uses `projects: ['packages/*']` for single-process test runs across all packages. Each package has its own `vitest.config.ts`.
238-
239238
After changing `productive-core` source, rebuild before running CLI/MCP tests:
240239

241240
```bash
@@ -263,12 +262,20 @@ npm run lint # oxlint
263262
npm run lint:fix # oxlint --fix
264263
npm run format # oxfmt --write
265264
npm run typecheck # TypeScript check (all workspaces)
265+
npm run check # All static checks: lint + format + typecheck + test colocation
266+
npm run check:tests # Report source files missing colocated .test.ts
266267
npm run semgrep # Security/quality scan
267268
npm run version:patch # Bump patch version across all packages
268269
npm run version:minor # Bump minor version
269270
npm run version:major # Bump major version
270271
```
271272

273+
### Git Hooks (via Husky)
274+
275+
- **pre-commit**: lint-staged (oxlint + oxfmt) + semgrep secrets scan
276+
- **commit-msg**: validates commit format (capitalized verb, no conventional commits, Co-authored-by trailer)
277+
- **pre-push**: rejects v-prefixed tags, then build + test
278+
272279
## Adding a New Resource (step-by-step)
273280

274281
When adding a new Productive.io resource (e.g., `invoices`):

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040
"typecheck": "npm run typecheck --workspaces",
4141
"semgrep": "semgrep scan --config p/typescript --config p/nodejs --config p/secrets --config p/owasp-top-ten --error --exclude='node_modules' --exclude='dist' --exclude='coverage' .",
4242
"semgrep:secrets": "semgrep scan --config p/secrets --error --quiet --exclude='node_modules' --exclude='dist' --exclude='coverage' .",
43+
"check:tests": "sh scripts/check-test-colocation.sh",
44+
"check:commit-msg": "sh scripts/check-commit-msg.sh",
45+
"check": "npm run lint && npm run format:check && npm run typecheck && npm run check:tests",
4346
"clean": "rm -rf packages/*/dist packages/*/node_modules node_modules",
4447
"version:patch": "npm version --include-workspace-root --workspaces --no-git-tag-version patch",
4548
"version:minor": "npm version --include-workspace-root --workspaces --no-git-tag-version minor",

0 commit comments

Comments
 (0)