@ebragas/linear-cli 0.9.0

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.
Files changed (3) hide show
  1. package/README.md +211 -0
  2. package/dist/cli.js +2321 -0
  3. package/package.json +54 -0
package/README.md ADDED
@@ -0,0 +1,211 @@
1
+ # @ebragas/linear-cli
2
+
3
+ CLI tool for AI agents to interact with Linear using per-agent OAuth identity. Each agent authenticates as its own Linear application entity (`actor=app`), making it assignable, mentionable, and independently trackable.
4
+
5
+ ## Quick Start
6
+
7
+ ```bash
8
+ # Install globally
9
+ npm install -g @ebragas/linear-cli
10
+
11
+ # Authenticate an agent (client credentials — recommended)
12
+ linear auth setup --client-credentials \
13
+ --agent eve \
14
+ --client-id <your-client-id> \
15
+ --client-secret <your-client-secret>
16
+
17
+ # Verify authentication
18
+ linear auth whoami --agent eve
19
+ ```
20
+
21
+ ### Prerequisites
22
+
23
+ 1. Register an OAuth application per agent at [linear.app/settings/api/applications/new](https://linear.app/settings/api/applications/new)
24
+ 2. Note the **Client ID** and **Client Secret**
25
+ 3. Node.js v22+
26
+
27
+ ## Command Reference
28
+
29
+ ### `auth` — Authentication Management
30
+
31
+ ```bash
32
+ linear auth setup --client-credentials --agent <id> --client-id <id> --client-secret <secret>
33
+ linear auth setup --oauth --agent <id> --client-id <id> --client-secret <secret> [--port 9876]
34
+ linear auth whoami --agent <id>
35
+ linear auth refresh --agent <id>
36
+ linear auth revoke --agent <id>
37
+ ```
38
+
39
+ ### `issue` — Issue Management
40
+
41
+ ```bash
42
+ linear issue list [--assignee <user>] [--state <state>] [--team <team>] [--label <label>] [--limit <n>]
43
+ linear issue get <id>
44
+ linear issue create --title <text> --team <team> [--description <text>] [--assignee <user>] [--state <state>] [--label <label>...] [--blocks <id>...] [--blocked-by <id>...]
45
+ linear issue update <id> [--title <text>] [--assignee <user>] [--state <state>]
46
+ linear issue transition <id> <state>
47
+ linear issue search <query> [--team <team>]
48
+ linear issue archive <id>
49
+ linear issue delete <id>
50
+ ```
51
+
52
+ ### `comment` — Comments
53
+
54
+ ```bash
55
+ linear comment list <issue-id>
56
+ linear comment add <issue-id> --body <text> [--reply-to <comment-id>]
57
+ linear comment add <issue-id> --body-file <path>
58
+ linear comment update <comment-id> --body <text>
59
+ ```
60
+
61
+ ### `inbox` — Notifications
62
+
63
+ ```bash
64
+ linear inbox [--include-archived] [--type <type>] [--category <cat>] [--since <date>]
65
+ linear inbox dismiss <id>
66
+ linear inbox dismiss-all
67
+ ```
68
+
69
+ ### `delegate` — Delegation Shortcuts
70
+
71
+ ```bash
72
+ linear delegate <issue-id> --to <agent>
73
+ linear delegate list
74
+ linear delegate remove <issue-id>
75
+ ```
76
+
77
+ ### `label` — Label Management
78
+
79
+ ```bash
80
+ linear label list [--team <team>]
81
+ linear label create --name <text> [--color <hex>] [--team <team>]
82
+ ```
83
+
84
+ ### `user` — User Discovery
85
+
86
+ ```bash
87
+ linear user list [--type <user|app|bot>] [--team <team>]
88
+ linear user search <query>
89
+ linear user me
90
+ ```
91
+
92
+ ### `team` / `project` / `state` — Workspace Discovery
93
+
94
+ ```bash
95
+ linear team list
96
+ linear team members <team>
97
+ linear project create --name <text> --team <team> [--description <text>] [--content <text>] [--start-date <date>] [--target-date <date>] [--lead <user>] [--priority <n>]
98
+ linear project list [--team <team>]
99
+ linear project get <id>
100
+ linear state list [--team <team>]
101
+ ```
102
+
103
+ ### `attachment` — External URL Attachments
104
+
105
+ ```bash
106
+ linear attachment add <issue-id> --url <url> [--title <text>]
107
+ linear attachment list <issue-id>
108
+ linear attachment remove <attachment-id>
109
+ ```
110
+
111
+ ## Global Options
112
+
113
+ | Flag | Env Var | Description |
114
+ |------|---------|-------------|
115
+ | `--agent <id>` | `LINEAR_AGENT_ID` | Agent identifier (required) |
116
+ | `--credentials-dir <path>` | `LINEAR_AGENT_CREDENTIALS_DIR` | Credentials directory (default: `~/.linear/credentials/`) |
117
+ | `--format <json\|text>` | — | Output format (default: auto-detect TTY) |
118
+
119
+ ## Configuration
120
+
121
+ ### Credentials
122
+
123
+ Stored at `<credentials-dir>/<agent-id>.json` with `600` permissions:
124
+
125
+ ```json
126
+ {
127
+ "authMethod": "client_credentials",
128
+ "clientId": "...",
129
+ "clientSecret": "...",
130
+ "accessToken": "...",
131
+ "refreshToken": null,
132
+ "tokenExpiresAt": "2026-03-24T10:00:00Z",
133
+ "actorId": "...",
134
+ "workspaceId": "...",
135
+ "workspaceSlug": "..."
136
+ }
137
+ ```
138
+
139
+ ### Workflow State Cache
140
+
141
+ States are cached per-team at `<credentials-dir>/<agent-id>.cache.json` with a 24-hour TTL. Automatically populated on first use of `--state` or `issue transition`.
142
+
143
+ ## Error Codes
144
+
145
+ | Code | Error | Behavior |
146
+ |------|-------|----------|
147
+ | 1 | Rate limited | Wait for reset, retry once |
148
+ | 2 | Authentication | Refresh token, retry once |
149
+ | 3 | Forbidden | Fail immediately |
150
+ | 4 | Validation | Fail with helpful message |
151
+ | 5 | Network | Retry once after 2s |
152
+ | 6 | Partial success | Report failures alongside result |
153
+
154
+ ## Example: Agent Heartbeat Workflow
155
+
156
+ ```bash
157
+ #!/bin/bash
158
+ AGENT="eve"
159
+
160
+ # 1. Check inbox for new work
161
+ linear inbox --agent $AGENT --format json
162
+
163
+ # 2. Check delegated issues
164
+ linear delegate list --agent $AGENT --format json
165
+
166
+ # 3. Work on an issue
167
+ linear issue transition MAIN-42 "In Progress" --agent $AGENT
168
+ linear comment add MAIN-42 --body "Starting work." --agent $AGENT
169
+
170
+ # 4. Complete and hand off
171
+ linear issue transition MAIN-42 "Awaiting Review" --agent $AGENT
172
+ linear comment add MAIN-42 --body "Done. Ready for review." --agent $AGENT
173
+
174
+ # 5. Dismiss processed notifications
175
+ linear inbox dismiss-all --agent $AGENT
176
+ ```
177
+
178
+ ## OpenClaw Skill
179
+
180
+ An [OpenClaw](https://openclaw.dev) skill for using this CLI with AI agents lives at [`skills/linear-cli/SKILL.md`](skills/linear-cli/SKILL.md). The skill teaches agents the command patterns, JSON output format, multi-line content handling, and error recovery for this CLI.
181
+
182
+ ### Installation
183
+
184
+ Install via symlink so skill updates apply automatically whenever you pull new versions of this repo:
185
+
186
+ ```bash
187
+ # From your OpenClaw workspace root
188
+ ln -s /path/to/linear-agent-cli/skills/linear-cli workspace/skills/linear-cli
189
+ ```
190
+
191
+ Or using an absolute path from the repo directory:
192
+
193
+ ```bash
194
+ ln -s "$(pwd)/skills/linear-cli" /path/to/your-workspace/workspace/skills/linear-cli
195
+ ```
196
+
197
+ The skill requires the `linear` binary to be in `$PATH`. OpenClaw will not load it if the binary is missing.
198
+
199
+ ## Development
200
+
201
+ ```bash
202
+ npm install
203
+ npm run build
204
+ npm test
205
+ ```
206
+
207
+ Integration tests (requires Linear credentials):
208
+
209
+ ```bash
210
+ LINEAR_TEST_AGENT_ID=... LINEAR_TEST_CLIENT_ID=... LINEAR_TEST_CLIENT_SECRET=... npm run test:integration
211
+ ```