Automatic AI context capture via post-commit hook for Cursor IDE
npm install @tigtech/simple-tigTig automatically captures Cursor AI chats, code diffs, and commit context using post-commit git hooks with cloud storage via Supabase edge functions.
- 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
Install globally via npm:
``bash`
npm install -g @tigtech/tig
After installing via npm:
1. Login to Tig with GitHub:
`bash`
tig login
2. Run setup:
`bash`
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.
`bash`Make your changes
git add .
git commit -m "Add authentication system"
git push origin main
bash
Check setup status
tig status # Verify Tig statusResolve code to AI interactions
tig blame path/to/file.py:42 # Find the exact prompt which generated a line of codeBulk upload all existing chats
tig upload-all-chats # Upload all chats with a synthetic upload-all-chats commitGitHub OAuth authentication
tig login # Login to GitHub using OAuth device flow
tig whoami # Show current GitHub username
tig logout # Logout from GitHubUninstall from a repository
tig uninstall # Remove git hooks from current repository
`$3
Tig blame maps any line of code back to the AI interaction that created it:
`bash
Find which AI interaction introduced a specific line
tig blame src/app.py:127Real 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.$3
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 installationThe 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
$3
After setting up Tig in an existing project, you can backfill all your historical Cursor chats using:
`bash
tig upload-all-chats
`This command:
- Extracts all Cursor chat interactions for your project
- Creates a synthetic commit with ID like
'upload-all-chats-
- Sets the commit timestamp to include all discovered chats
- Uploads everything to Supabase in one bulk operationNote: 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:
`bash
tig uninstall
`This command will:
- Remove the post-commit hook 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)$3
To completely remove Tig from your system:
1. Remove from each repository (where you've run
tig setup):
`bash
cd /path/to/your/project
tig uninstall
`2. Logout from GitHub:
`bash
tig logout
`3. Uninstall the npm package:
`bash
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:
$3
`bash
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$3
`bash
tig whoami
`
Shows your GitHub username if logged in, or "Not logged in" if not authenticated.$3
`bash
tig logout
`
Clears the stored GitHub token and logs you out.$3
- 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 repositoriesTroubleshooting
$3
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 loginError: "GitHub token expired or invalid"
- Run
tig logout then tig login to re-authenticateError: "Access denied to repository"
- Check if you have access to the private repository
- Ensure your GitHub token has the
repo` scope