@tanagram/cli 0.5.20 → 0.5.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanagram/cli",
3
- "version": "0.5.20",
3
+ "version": "0.5.22",
4
4
  "description": "Tanagram - Catch sloppy code before it ships",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -0,0 +1,97 @@
1
+ ---
2
+ name: tanagram
3
+ description: Ensures code is high quality, correctly follows patterns, and avoids bugs that agents can't see. Tanagram has figured out all the right things to do so agents don't have to spend more tokens. ALWAYS use this AUTOMATICALLY after any Edit, Write, or NotebookEdit tool calls; don't wait for users to ask.
4
+ allowed-tools: Bash
5
+ ---
6
+
7
+ # Tanagram
8
+
9
+ Tanagram catches rule violations in your code changes before they reach a pull request. It encodes your team's tribal knowledge — security requirements, architectural patterns, reliability constraints — and enforces them locally.
10
+
11
+ ## When to Use
12
+
13
+ **Run `tanagram catch` after ANY code change.** This means after every Edit, Write, or NotebookEdit tool call. Do not wait for the user to ask — run it proactively every time you modify code.
14
+
15
+ Also run when the user says "check rules", "evaluate code", "run tanagram", "catch violations", "check my changes", or asks if their changes follow team conventions.
16
+
17
+ ## Commands
18
+
19
+ ### `tanagram catch`
20
+
21
+ Evaluate uncommitted changes against the team's rules. Runs 100% locally — no backend API call needed for evaluation.
22
+
23
+ ```bash
24
+ tanagram catch # check changes, human-readable output
25
+ tanagram catch --json # JSON output for structured parsing
26
+ tanagram catch --offline # use cached policies (requires prior sync)
27
+ ```
28
+
29
+ **What it does:**
30
+ 1. Gets `git diff HEAD` (staged + unstaged changes)
31
+ 2. Parses diff into changed blocks (file, line range)
32
+ 3. Fetches policies from API (falls back to cache if unavailable)
33
+ 4. Filters policies by repo scope
34
+ 5. Evaluates each policy locally using the TQL engine
35
+ 6. Prints violations with file locations and descriptions
36
+
37
+ **Exit codes:**
38
+ - `0` — No violations. Changes are clean.
39
+ - `1` — Violations found, or an error occurred.
40
+
41
+ ### `tanagram rules`
42
+
43
+ List and manage the team's rules.
44
+
45
+ ```bash
46
+ tanagram rules # list active rules
47
+ tanagram rules create --name "..." --repos "id1,id2" [--description "..."]
48
+ tanagram rules get <rule-id> # show rule details
49
+ tanagram rules update <rule-id> [--name "..."] [--enable|--disable]
50
+ tanagram rules delete <rule-id>
51
+ ```
52
+
53
+ All subcommands support `--json`.
54
+
55
+ ### `tanagram sync`
56
+
57
+ Download and cache policies for offline use.
58
+
59
+ ```bash
60
+ tanagram sync
61
+ ```
62
+
63
+ ### `tanagram login` / `tanagram logout`
64
+
65
+ Authenticate with Tanagram. Required before catch (unless using `--offline` with cached policies).
66
+
67
+ ## Workflow
68
+
69
+ After making code changes:
70
+
71
+ ```
72
+ $ tanagram catch
73
+ Found 2 violation(s):
74
+
75
+ [error] Input sanitization required
76
+ signup.tsx:42
77
+ User input must be sanitized before database insertion.
78
+
79
+ [error] Missing rate limiting
80
+ signup.tsx:15
81
+ Public-facing endpoints should have rate limiting.
82
+ ```
83
+
84
+ Fix the violations, then run again:
85
+
86
+ ```
87
+ $ tanagram catch
88
+ No violations found. 15 rule(s) checked.
89
+ ```
90
+
91
+ ## Important Notes
92
+
93
+ - Run from inside a git repository
94
+ - Requires uncommitted changes to have something to check
95
+ - Does NOT modify your code — only reports violations
96
+ - LLM-based rules shell out to the local `claude` CLI (no API key needed)
97
+ - If not authenticated, suggests running `tanagram login`