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

@devclocked/tracker-core

v2.1.2

Published

Shared SDK for DevClocked tracker applications (VS Code, Chrome, Desktop)

Readme

@devclocked/tracker-core

Shared SDK for DevClocked tracker applications (VS Code, Chrome, Desktop).

Features

  • Unified API: Same interface across all tracker applications
  • Offline Support: Local queue with exponential retry
  • Auto Authentication: JWT token management with refresh
  • Cross-Platform: Works in browser, Node.js, and VS Code
  • Privacy First: User-controlled exclusion patterns
  • Real-time Sync: Automatic session and tick synchronization

Installation

npm install @devclocked/tracker-core

Quick Start

import { TrackerClient, StorageAdapter } from '@devclocked/tracker-core';

// Create a storage adapter for your environment
const storage = new YourStorageAdapter();

// Initialize the tracker client
const tracker = new TrackerClient({
  supabaseUrl: 'https://your-project.supabase.co',
  supabaseAnonKey: 'your-anon-key',
  source: 'vscode', // or 'chrome', 'desktop'
  clientId: 'unique-client-id',
  deviceName: 'My Development Machine',
  debug: true
}, storage);

// Authenticate with Supabase access token
await tracker.authenticate('your-access-token');

// Start tracking a session
const session = await tracker.startSession('https://github.com/user/repo', 'main');

// Send activity ticks
await tracker.sendTick('/src/components/App.tsx', 'file', {
  repo_url: 'https://github.com/user/repo',
  branch: 'main',
  language: 'typescript',
  is_write: true
});

// End the session
await tracker.endSession(session.id);

API Reference

TrackerClient

Main class for all tracker operations.

Methods

  • authenticate(token: string) - Authenticate with Supabase
  • startSession(repo?, branch?, projectName?) - Start a new session
  • endSession(sessionId?) - End current or specified session
  • getActiveSession() - Get current active session
  • sendTick(entity, type, metadata?) - Send activity tick
  • flushQueue() - Manually flush the tick queue
  • linkCommit(sessionId, sha, repo, committedAt) - Link commit to session
  • sendTelemetry(events) - Send telemetry events
  • getTrackerState() - Get current tracker state
  • getQueueStats() - Get queue statistics
  • clearQueue() - Clear the tick queue
  • destroy() - Cleanup resources

StorageAdapter

Abstract class for cross-platform storage. Implement this for your environment.

Methods

  • get(key: string) - Get value by key
  • set(key: string, value: string) - Set value by key
  • remove(key: string) - Remove value by key
  • clear() - Clear all values
  • keys() - Get all keys
  • getObject<T>(key: string) - Get JSON object
  • setObject<T>(key: string, value: T) - Set JSON object

AuthManager

Handles authentication and token management.

Methods

  • authenticate(token: string) - Authenticate with token
  • isAuthenticated() - Check authentication status
  • getAccessToken() - Get current access token
  • refreshToken() - Refresh access token
  • logout() - Logout and clear state

TickQueue

Manages local queue with retry logic.

Methods

  • enqueueTicks(ticks: TickData[]) - Add ticks to queue
  • enqueueTelemetry(events: TelemetryEvent[]) - Add telemetry to queue
  • processQueue(processor) - Process queue items
  • getQueueStats() - Get queue statistics
  • clearQueue() - Clear all items

Storage Adapter Implementations

Browser (IndexedDB)

import { StorageAdapter } from '@devclocked/tracker-core';

class BrowserStorageAdapter extends StorageAdapter {
  private db: IDBDatabase;

  async get(key: string): Promise<string | null> {
    // Implement IndexedDB get
  }

  async set(key: string, value: string): Promise<void> {
    // Implement IndexedDB set
  }

  // ... implement other methods
}

Node.js (File System)

import { StorageAdapter } from '@devclocked/tracker-core';
import fs from 'fs/promises';
import path from 'path';

class NodeStorageAdapter extends StorageAdapter {
  private storageDir: string;

  async get(key: string): Promise<string | null> {
    try {
      const filePath = path.join(this.storageDir, key);
      return await fs.readFile(filePath, 'utf-8');
    } catch {
      return null;
    }
  }

  async set(key: string, value: string): Promise<void> {
    const filePath = path.join(this.storageDir, key);
    await fs.writeFile(filePath, value, 'utf-8');
  }

  // ... implement other methods
}

VS Code (GlobalState)

import { StorageAdapter } from '@devclocked/tracker-core';
import * as vscode from 'vscode';

class VSCodeStorageAdapter extends StorageAdapter {
  constructor(private context: vscode.ExtensionContext) {
    super();
  }

  async get(key: string): Promise<string | null> {
    return this.context.globalState.get(key) || null;
  }

  async set(key: string, value: string): Promise<void> {
    await this.context.globalState.update(key, value);
  }

  // ... implement other methods
}

Configuration

TrackerConfig

interface TrackerConfig {
  supabaseUrl: string;        // Your Supabase project URL
  supabaseAnonKey: string;    // Your Supabase anon key
  source: TrackerSource;     // 'vscode' | 'chrome' | 'desktop'
  clientId: string;           // Unique client identifier
  deviceName?: string;        // Optional device name
  debug?: boolean;           // Enable debug logging
}

Error Handling

The SDK includes comprehensive error handling:

  • Authentication errors: Invalid tokens, expired sessions
  • Network errors: Connection failures, timeouts
  • Rate limiting: Automatic retry with exponential backoff
  • Queue management: Persistent storage of failed requests

Privacy & Security

  • Local storage: All data stored locally until successfully synced
  • Encryption: Sensitive data encrypted at rest
  • User control: Exclusion patterns for private work
  • No content logging: Only metadata (paths, URLs, timestamps)

License

MIT