JSPM

@tigtech/tig

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q45058F
  • License MIT

Automatic AI context capture via post-commit hook for Cursor IDE

Package Exports

  • @tigtech/tig
  • @tigtech/tig/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@tigtech/tig) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Tig - Automatic AI Context Capture

Tig automatically captures Cursor AI chats, code diffs, and commit context using post-commit git hooks with cloud storage via Supabase edge functions.

Features

  • Automatic Capture: Saves context on every commit via post-commit hook
  • Cloud Storage: Stores data in Supabase cloud storage via edge functions
  • Cursor Integration: Extracts AI chats directly from Cursor's SQLite database
  • No Manual Logging: Completely automatic - no need to remember to log interactions
  • Comprehensive Context: Includes commit info, changed files, diffs, and AI conversations
  • Simple & Clean: No local files or UUIDs - everything stored in the cloud
  • GitHub OAuth: Secure authentication with GitHub using OAuth device flow
  • PR View: Automatic comment on PRs with link to view all interactions from that PR
  • Tig Blame: Map any line of code back to the AI interaction that created it

Installation

Install globally via npm:

npm install -g @tigtech/tig

Quick Start (NPM Installation)

After installing via npm:

  1. Login to Tig with GitHub:

    tig login
  2. Run setup:

    tig setup

    During setup, you'll interactively select which AI platforms to extract from:

    • Cursor (enabled by default)
    • Claude Code (disabled by default)

    Use arrow keys and space to toggle, Enter to confirm.

  3. Start committing - Tig will automatically capture context on every commit!

Notes:

  • GitHub authentication is required for private repositories.
  • Tig setup automatically checks if the Tig Connector GitHub App is installed on your repository. If missing, it will:
    • Open the installation page in your browser
    • Wait for you to complete the installation
    • Verify and continue setup automatically
  • The GitHub App is required for automatic branch updates after PR merges.
  • For headless environments, use tig setup --no-interactive to skip prompts and use defaults.

How It Works

Post-Commit Hook

After you commit, the git hook automatically:

  1. Extracts all chats related to your project
  2. Captures current commit information (hash, message, author, changed files)
  3. Caches interactions in ~/.tig/config.json

Pre-Push Hook

  1. Sends data to Supabase cloud storage via edge function
  2. Logs success/failure status

Usage

Just commit normally - context is saved automatically:

# Make your changes
git add .
git commit -m "Add authentication system"
git push origin main

Manual Commands

# Check setup status
tig status     # Verify Tig status

# Resolve code to AI interactions
tig blame path/to/file.py:42  # Find the exact prompt which generated a line of code

# Bulk upload all existing chats
tig upload-chats  # Upload all chats with a synthetic upload-chats commit

# GitHub OAuth authentication
tig login      # Login to GitHub using OAuth device flow
tig whoami     # Show current GitHub username
tig logout     # Logout from GitHub

# Uninstall from a repository
tig uninstall  # Remove git hooks from current repository

Tig Blame: Code-to-Conversation Resolution ✨

Tig blame maps any line of code back to the AI interaction that created it:

# Find which AI interaction introduced a specific line
tig blame src/app.py:127

# Real example output:
# File: src/app.py:127
# Commit: abc123def456
# Found 1 matching interaction(s):
#
# 1. Interaction: uuid-1234
#    Preview: Add user authentication with JWT tokens...
#    Link: https://app.usetig.dev/conversations/conv-id?interaction=uuid-1234

See documentation/database/blame/ for performance optimization options.

PR View: Automatic Comment Linking ✨ NEW

When you create a pull request, Tig automatically posts a comment with a link to view all AI interactions from commits in that PR:

How it works:

  1. Create a PR as usual on GitHub
  2. Tig GitHub App automatically detects the PR
  3. If interactions exist for commits in the PR, a comment is posted with a link
  4. Click the link to view all interactions chronologically in the Tig web app

Example:

PR created: feature/auth → main
↓
Tig posts comment: https://app.usetig.dev/repos/owner/repo/pulls/123
↓
Click link to see all AI interactions from this PR

Requirements:

  • Tig GitHub App must be installed on your repository
  • tig setup handles this automatically during installation

The PR view shows:

  • All AI interactions from commits in the PR
  • Chronological timeline of prompts and responses
  • Links to related conversations and commits
  • Clean, unified view of the development process

Bulk Upload Existing Chats

After setting up Tig in an existing project, you can backfill all your historical Cursor chats using:

tig upload-chats

This command:

  • Extracts all Cursor chat interactions for your project
  • Creates a synthetic commit with ID like 'upload-chats-<mock_commit_hash>'
  • Sets the commit timestamp to include all discovered chats
  • Uploads everything to Supabase in one bulk operation

Note: This is useful when you've been using Cursor for a while and want to capture all past AI interactions. The synthetic commit allows you to view all historical chats in your Tig dashboard.

Uninstalling from a Project

To remove Tig from a specific repository:

tig uninstall

This command will:

  • Remove the pre-commit and post-commit hooks from .git/hooks/
  • Only remove hooks that were created by Tig (verifies before removing)
  • Preserve all previously uploaded data in cloud storage
  • Keep your GitHub authentication (use tig logout to remove separately)

Complete Removal

To completely remove Tig from your system:

  1. Remove from each repository (where you've run tig setup):

    cd /path/to/your/project
    tig uninstall
  2. Logout from GitHub:

    tig logout
  3. Uninstall the npm package:

    npm uninstall -g tig-cursor

Note: Uninstalling does not delete your data from cloud storage. All previously captured interactions remain accessible in your Supabase dashboard.

GitHub OAuth Authentication

Tig supports secure authentication with GitHub using OAuth device flow:

Login

tig login

This will:

  1. Start the GitHub OAuth device flow
  2. Display a verification URL and code (e.g., https://github.com/login/device and code XXXX-XXXX)
  3. Wait for you to authorize the app in your browser
  4. Store the access token locally in ~/.tig/config.json

Check Login Status

tig whoami

Shows your GitHub username if logged in, or "Not logged in" if not authenticated.

Logout

tig logout

Clears the stored GitHub token and logs you out.

Token Storage

  • Tokens are stored securely in ~/.tig/config.json
  • The file contains a JSON object with a github_token property
  • Tokens are automatically validated when used
  • Tokens require user:email and repo scopes for full functionality
  • The repo scope is needed to access private repositories and organization repositories

Troubleshooting

GitHub Authentication Issues

Error: "Repository not found or not accessible"

  • Make sure you're logged in: tig login
  • Ensure your token has the repo scope (required for private repos and org repos)
  • If you previously logged in with insufficient scopes, run: tig logout then tig login

Error: "GitHub token expired or invalid"

  • Run tig logout then tig login to re-authenticate

Error: "Access denied to repository"

  • Check if you have access to the private repository
  • Ensure your GitHub token has the repo scope
  • For organization repositories, make sure you're a member with appropriate permissions