npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@geeknees/copilot-cli-wakatime

v0.1.0

Published

WakaTime heartbeats for GitHub Copilot CLI hooks

Downloads

18

Readme

copilot-cli-wakatime

npm version License: MIT

WakaTime integration for GitHub Copilot CLI. Track AI coding activity and time spent.

Features

  • Automatic time tracking for Copilot CLI sessions
  • Hooks into session lifecycle events (start, tool use, end)
  • 60-second heartbeat rate limiting per project
  • Cross-platform support (macOS, Linux, Windows)
  • Zero-config after setup

Prerequisites

  1. WakaTime account and API key
  2. WakaTime API key configured in ~/.wakatime.cfg:
    [settings]
    api_key = your-api-key-here
  3. GitHub Copilot CLI installed
  4. wakatime-cli installed and available in PATH

Installation

# Install the package globally
npm install -g @geeknees/copilot-cli-wakatime

# Navigate to your project directory
cd /path/to/your/project

# Initialize hooks configuration
copilot-cli-wakatime init

This creates .github/hooks/wakatime.json in your project with the necessary hook configuration.

How It Works

┌─────────────────────────────────────────────────────────────┐
│                  Copilot CLI Session                         │
└─────────────────────────┬───────────────────────────────────┘
                          │
                          ▼
┌─────────────────────────────────────────────────────────────┐
│                    Hook Events                               │
│   • sessionStart  - When session begins                      │
│   • postToolUse   - After each tool execution                │
│   • sessionEnd    - When session ends                        │
└─────────────────────────┬───────────────────────────────────┘
                          │
                          ▼
┌─────────────────────────────────────────────────────────────┐
│              copilot-cli-wakatime hook                       │
│   1. Receive event with payload (stdin)                      │
│   2. Skip if toolName starts with "wakatime-"                │
│   3. Detect Git repository root                              │
│   4. Check 60-second rate limit (per project)                │
│   5. Send heartbeat to WakaTime                              │
└─────────────────────────┬───────────────────────────────────┘
                          │
                          ▼
┌─────────────────────────────────────────────────────────────┐
│                   WakaTime Dashboard                         │
│   View your AI coding metrics at wakatime.com                │
└─────────────────────────────────────────────────────────────┘

Hook Events

| Event | Purpose | |-------|---------| | sessionStart | Triggered when a Copilot CLI session starts | | postToolUse | Triggered after each tool execution | | sessionEnd | Triggered when a Copilot CLI session ends |

Entity Tracking

The plugin sends heartbeats with:

  • Entity: .copilot-cli.ts (virtual file in repository root)
  • Project: Repository name (from Git root)
  • Plugin: copilot-cli-wakatime/0.1.0

Configuration

Project Setup

Run copilot-cli-wakatime init in your project to create .github/hooks/wakatime.json:

{
  "version": 1,
  "hooks": {
    "sessionStart": [
      {
        "type": "command",
        "bash": "copilot-cli-wakatime hook sessionStart",
        "timeoutSec": 10
      }
    ],
    "postToolUse": [
      {
        "type": "command",
        "bash": "copilot-cli-wakatime hook postToolUse",
        "timeoutSec": 10
      }
    ],
    "sessionEnd": [
      {
        "type": "command",
        "bash": "copilot-cli-wakatime hook sessionEnd",
        "timeoutSec": 10
      }
    ]
  }
}

Debug Mode

Enable debug output:

copilot-cli-wakatime hook sessionStart --debug

Debug information includes:

  • Event type
  • Tool name
  • Working directory
  • Repository root
  • Project name
  • WakaTime CLI exit status

Files & Locations

| File | Purpose | |------|---------| | .github/hooks/wakatime.json | Hook configuration (per project) | | ~/.wakatime.cfg | WakaTime API key and settings | | ~/.local/state/copilot-wakatime/* | Rate limiting state files | | .copilot-cli.ts | Virtual entity file (auto-created in repo root) |

The state directory follows XDG Base Directory specification and can be customized via XDG_STATE_HOME.

Development

# Clone the repository
git clone https://github.com/geeknees/copilot-cli-wakatime
cd copilot-cli-wakatime

# Install dependencies
npm install

# Build
npm run build

# Run tests
npm test

Project Structure

copilot-cli-wakatime/
├── src/
│   ├── cli.ts            # Main entry point
│   ├── hook.ts           # Hook event handler
│   ├── init.ts           # Hook configuration setup
│   └── util.ts           # Utilities (rate limiting, Git detection)
├── test/
│   ├── hook.test.ts      # Hook tests
│   ├── init.test.ts      # Init tests
│   └── util.test.ts      # Utility tests
├── package.json
├── tsconfig.json
└── README.md

Commands

| Command | Description | |---------|-------------| | copilot-cli-wakatime init | Create hooks configuration in current project | | copilot-cli-wakatime init --force | Overwrite existing hooks configuration | | copilot-cli-wakatime hook <event> | Process a hook event (called by Copilot CLI) | | copilot-cli-wakatime hook <event> --debug | Process with debug output |

Troubleshooting

No heartbeats being sent

  1. Check that your API key is configured in ~/.wakatime.cfg
  2. Verify .github/hooks/wakatime.json exists in your project
  3. Ensure wakatime-cli is installed and in your PATH
  4. Run with --debug flag to see detailed output

Rate limiting

Heartbeats are rate-limited to once per 60 seconds per project. This prevents excessive API calls while still capturing meaningful activity.

wakatime-cli not found

Install WakaTime CLI:

  • macOS: brew install wakatime-cli
  • Linux/Windows: https://github.com/wakatime/wakatime-cli/releases

Hooks not triggering

  1. Verify you're running Copilot CLI from the project directory
  2. Check that .github/hooks/wakatime.json is present
  3. Ensure the hooks file has correct JSON structure (run init again if needed)

Self-recursion prevention

The plugin automatically skips processing if toolName starts with wakatime-. This prevents infinite loops if WakaTime itself is instrumented.

Uninstall

# Remove hooks configuration from project
rm .github/hooks/wakatime.json

# Uninstall the package
npm uninstall -g @geeknees/copilot-cli-wakatime

License

MIT