Thank you for your interest in contributing! Focus Timer is designed from the ground up for community extension. Whether you're fixing a bug, adding a feature, or writing a plugin, this document will get you oriented quickly.
- Code of Conduct
- Ways to Contribute
- Development Setup
- Branch Strategy
- Pull Request Process
- Commit Message Format
- Code Style
- Where Things Live
Be kind, be patient, be constructive. We follow the Contributor Covenant v2.1.
| Type | Description |
|---|---|
| 🐛 Bug fix | Open an issue first describing the behaviour; then submit a PR |
| ✨ Feature | Discuss in an issue before starting; check the roadmap for alignment |
| 🔌 Plugin | No issue needed — plugins are standalone; add to src/plugins/ |
| 📝 Docs | Spelling, clarity, missing examples — all welcome |
| 🧪 Tests | We always need more coverage on pure utility functions |
| 🎨 UI / CSS | Keep the dark theme aesthetic; test at 340px popup width |
-
Clone the repo:
git clone https://github.com/your-org/focus-timer.git cd focus-timer/focus-timer-v5 -
Load the unpacked extension in Chrome:
- Navigate to
chrome://extensions - Enable Developer mode
- Click Load unpacked → select the
focus-timer-v5/directory
- Navigate to
-
After making changes:
- Click the reload icon on
chrome://extensionsto pick up background.js changes - Content script and popup changes take effect immediately on the next page load / popup open
- Click the reload icon on
-
Inspect the service worker: On
chrome://extensions, click "service worker" next to Focus Timer to open DevTools for the background script.
main ← stable releases only
dev ← integration branch for features
feature/<name> ← your feature branch, forked from dev
fix/<name> ← bug fix branch, forked from dev
Please fork from dev, not main.
- Open an issue or comment on an existing one to signal your intent.
- Fork the repo and create your branch from
dev. - Make your changes following the Code Style guide.
- Test locally: load the extension, run a session end-to-end.
- Write a clear PR description: what changed, why, and how to test it.
- A maintainer will review within 7 days. Expect at least one round of feedback.
PR checklist:
- No business logic in
background.js(belongs in a module) - New public functions have JSDoc comments
- No hardcoded strings that belong in
storageAdapter.KEYS - Extension loads without errors on
chrome://extensions - A full session (start → complete → reflection) works end-to-end
We follow Conventional Commits:
type(scope): short description
[optional body]
[optional footer]
Types: feat, fix, docs, style, refactor, test, chore
Scopes: core, timer, scoring, distraction, visual, insights, reflection, plugin, ui, manifest
Examples:
feat(scoring): add bonus for sessions with zero tab switches
fix(visual): ensure content script re-applies after SPA navigation
docs(plugin): add example for onTick hook
See CODE_STYLE.md for the full style guide.
Short version:
- ES2020+, no transpiler
'use strict'in every module- Async/await over
.then()chains - JSDoc on every exported function
- 2-space indentation
- Single quotes
const api = typeof browser !== "undefined" ? browser : chrome
| What | Where |
|---|---|
| Timer state machine | src/core/timerEngine.js |
| Session objects & streaks | src/core/sessionManager.js |
| Score formula | src/core/scoringEngine.js |
All api.storage calls |
src/core/storageAdapter.js |
| Event hook system | src/core/eventBus.js |
| Distraction visit tracking | src/features/distractionTracking/ |
| Reflection save/load | src/features/reflectionSystem/ |
| Tab messaging / content inject | src/features/visualEnforcement/ |
| Pattern analysis & suggestions | src/features/insightsEngine/ |
| In-page overlays & indicator | content.js / content.css |
| Popup UI | popup.js / popup.html / styles.css |
| Chrome event wiring | background.js |
| Example plugin | src/plugins/consoleLogger.js |