Package Exports
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 (@tanagram/cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Tanagram CLI
A lightweight Go CLI that enforces TQL policies on AI code changes via Claude Code hooks.
Quick Start
# 1. Install globally via npm
npm install -g @tanagram/cli
# 2. Login to Tanagram
tanagram login
# 3. Sync policies from your Tanagram account
tanagram sync-policies
# 4. Run via Claude Code Stop hook (automatic on first run)
tanagramInstallation
Requirements:
- Node.js >= 14.0.0
- Tanagram account with TQL policies configured
The CLI is written in Go but distributed via npm for easier installation. During installation, npm automatically downloads the Go compiler and builds the binary for your platform.
Usage
# Evaluate changes against TQL policies (run via Claude Code Stop hook)
tanagram
# or explicitly:
tanagram run
# Login to Tanagram
tanagram login
# Logout
tanagram logout
# Sync cloud policies from Tanagram
tanagram sync-policies
# View policies for current repository
tanagram list
# Show help
tanagram helpCommands
run(default) - Evaluate changed lines against TQL policieslogin- Authenticate with Tanagramlogout- Sign out and remove stored credentialssync-policies- Sync cloud policies from Tanagramlist- Show policies for current repositoryhelp- Show usage information
Claude Code Hook
The CLI runs as a Claude Code Stop hook to evaluate changes after each edit.
Automatic setup:
The hook is automatically configured in ~/.claude/settings.json on first run.
Manual setup:
Add this to your ~/.claude/settings.json:
{
"hooks": {
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "tanagram"
}
]
}
]
}
}How It Works
- Claude Code makes edits to files
- Stop hook fires, running
tanagram run - CLI reads transcript from Claude Code stdin
- Parses Write/Edit operations to find changed lines
- Evaluates changed lines against TQL policies
- If violations found, outputs to stderr
- Claude sees the violations and self-corrects
Exit Codes
0- No violations found2- Violations found (triggers Claude Code automatic fix behavior)
Tanagram Web Integration
Manage policies at tanagram.ai and enforce them locally:
# Connect your account
tanagram login
# Sync policies
tanagram sync-policies
# View policies
tanagram listFor on-prem installations, set the TANAGRAM_WEB_HOSTNAME environment variable:
export TANAGRAM_WEB_HOSTNAME=https://yourcompany.tanagram.ai
tanagram loginBuilt by @fluttermatt and the Tanagram team.