|
| 1 | +# Contributing to claude-code-timelog |
| 2 | + |
| 3 | +## Prerequisites |
| 4 | + |
| 5 | +- Node.js 18 or later |
| 6 | +- Claude Code (for testing hooks) |
| 7 | + |
| 8 | +## Setup |
| 9 | + |
| 10 | +```bash |
| 11 | +git clone https://github.com/RemoteCTO/claude-code-timelog.git |
| 12 | +cd claude-code-timelog |
| 13 | +npm install |
| 14 | +npm test |
| 15 | +npm run lint |
| 16 | +``` |
| 17 | + |
| 18 | +## Project structure |
| 19 | + |
| 20 | +``` |
| 21 | +hooks/ Claude Code hook handlers |
| 22 | +scripts/ CLI scripts (report, backfill) |
| 23 | +lib/ Shared library code |
| 24 | +bin/ CLI entry point (claudelog) |
| 25 | +commands/ Plugin command definitions |
| 26 | +test/ Tests (mirrors source layout) |
| 27 | +``` |
| 28 | + |
| 29 | +**Hooks** run inside Claude Code sessions. |
| 30 | +**Scripts** run standalone from the terminal. |
| 31 | +**lib/** is shared between both. |
| 32 | + |
| 33 | +## Code style |
| 34 | + |
| 35 | +Code style is enforced by ESLint and |
| 36 | +editorconfig: |
| 37 | + |
| 38 | +- 80-character line limit |
| 39 | +- ESM modules (`.mjs` extension) |
| 40 | +- `prefer-const`, `no-var` |
| 41 | +- 2-space indentation |
| 42 | +- LF line endings |
| 43 | + |
| 44 | +Run `npm run lint` before submitting changes. |
| 45 | + |
| 46 | +## Testing |
| 47 | + |
| 48 | +Tests use Node's native test runner |
| 49 | +(`node --test`). |
| 50 | + |
| 51 | +- Write tests first (TDD) |
| 52 | +- Test behaviour, not implementation |
| 53 | +- Use real objects, not mocks |
| 54 | +- Keep tests focused and independent |
| 55 | + |
| 56 | +Run tests with `npm test`. Run a single file: |
| 57 | + |
| 58 | +```bash |
| 59 | +node --test test/lib/config.test.mjs |
| 60 | +``` |
| 61 | + |
| 62 | +Use `CLAUDE_TIMELOG_DIR` to point at a temp |
| 63 | +directory during development to avoid polluting |
| 64 | +your real timelog data. |
| 65 | + |
| 66 | +## Pull request process |
| 67 | + |
| 68 | +1. Fork the repository |
| 69 | +2. Create a feature branch from `main` |
| 70 | +3. Make your changes |
| 71 | +4. Write or update tests |
| 72 | +5. Update `CHANGELOG.md` under an `[Unreleased]` |
| 73 | + heading (see [Keep a Changelog][kac]) |
| 74 | +6. Run `npm test` and `npm run lint` |
| 75 | +7. Submit a pull request |
| 76 | + |
| 77 | +[kac]: https://keepachangelog.com/en/1.1.0/ |
| 78 | + |
| 79 | +Keep PRs focused on a single change. Include |
| 80 | +clear descriptions of what changed and why. |
| 81 | + |
| 82 | +## Commit messages |
| 83 | + |
| 84 | +Follow conventional commit format where |
| 85 | +appropriate: |
| 86 | + |
| 87 | +- `feat:` new features |
| 88 | +- `fix:` bug fixes |
| 89 | +- `docs:` documentation changes |
| 90 | +- `test:` test additions or changes |
| 91 | +- `refactor:` code changes without behaviour |
| 92 | + changes |
| 93 | + |
| 94 | +Keep commit messages concise and descriptive. |
| 95 | + |
| 96 | +## Questions |
| 97 | + |
| 98 | +Open an issue for questions or clarifications |
| 99 | +before starting significant changes. |
| 100 | + |
| 101 | +## Licence |
| 102 | + |
| 103 | +By contributing, you agree that your |
| 104 | +contributions will be licensed under the |
| 105 | +Apache 2.0 licence. |
0 commit comments