This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
# Build the plugin
./gradlew build
# Run IntelliJ IDE with the plugin installed for testing
./gradlew runIde
# Format code (uses Google Java Format via Spotless)
./gradlew spotlessApply
# Run tests
./gradlew test
# Verify plugin compatibility
./gradlew verifyPluginCodeClocker is an IntelliJ IDEA plugin that tracks coding time and activity. It operates in two modes:
- Local Mode (default): All tracking data stays on the user's machine
- Hub Mode (optional): Syncs data to CodeClocker Hub web dashboards via API key
Time Tracking Pipeline:
FocusListener(AWT event listener) → detects user activity in the IDETimeSpentActivityTracker→ manages activity detection with 2-minute inactivity timeoutTimeSpentPerProjectLogger→ accumulates time per project usingProjectTimeAccumulatorLocalStateRepository→ persists hourly activity snapshots to XML via IntelliJ'sPersistentStateComponentDataReportingTask→ scheduled task that reports accumulated data to Hub (if API key present)
VCS/Git Integration:
ChangesActivityTracker→ tracks added/removed lines from VCSGitCommitStatsListener(CheckinHandlerFactory) → captures commit statisticsBranchActivityTracker→ tracks time per git branch- Git features are optional via
git-features.xmlconfig that depends onGit4Idea
UI Components:
TimeTrackerWidget/TimeTrackerWidgetFactory→ status bar widget showing daily timeTimeTrackerPopup→ popup panel with detailed stats and goal progressBranchActivityToolWindowFactory→ tool window for branch activity reports
State Persistence:
- Local state stored in
codeclocker-local-state.xmlwith hourly granularity - Data retained for max 2 weeks, auto-cleaned on load
- Hour keys use UTC timezone (migration from local timezone happens automatically)
services/- Core tracking services (time tracking, VCS changes, per-project accumulation)local/- Local state persistence and data modelsreporting/- Hub sync and HTTP clients for data reportingwidget/- Status bar widget and popup UItoolwindow/- Branch activity tool windowgoal/- Daily/weekly goal tracking and notificationsanalytics/- Anonymous usage analyticsonboarding/- First-run onboarding flowapikey/- API key management for Hub Modegit/- Git/VCS integration handlers
- Application-level services registered in
plugin.xmlfor singleton tracking components - Project-level services for project-specific state
ListenerRegistratoris the main startup entry point that initializes all background tasks- Scheduled tasks use a shared
ScheduledExecutorthread pool
- Only add comments for complex logic; avoid commenting obvious code
- Update
pluginVersioningradle.properties - Add release note in
CHANGELOG.md