@humanlayer/linear-cli 0.1.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 +181 -0
  2. package/dist/linear +0 -0
  3. package/package.json +41 -0
package/README.md ADDED
@@ -0,0 +1,181 @@
1
+ # Linear CLI
2
+
3
+ A command-line interface for interacting with Linear issue tracking, built with Bun as a single-file executable.
4
+
5
+ ## Features
6
+
7
+ - List your active assigned issues (`my-issues`, `list-issues`)
8
+ - View issue details and comments (`get-issue`)
9
+ - Add comments to issues (`add-comment`)
10
+ - Update issue status (`update-status`)
11
+ - Add links to issues (`add-link`)
12
+ - Download all images from issues (`fetch-images`)
13
+ - Automatically detect issue IDs from git branch names
14
+ - Shell completions for fish, zsh, and bash
15
+ - Cross-platform single-file executables
16
+ - Smart handling of environment variables (only requires API key for operations)
17
+
18
+ ## Project Structure
19
+
20
+ ```
21
+ src/
22
+ ├── index.ts # Main CLI entry point
23
+ ├── commands/ # Individual command implementations
24
+ │ ├── listIssues.ts
25
+ │ ├── getIssue.ts
26
+ │ ├── addComment.ts
27
+ │ ├── updateStatus.ts
28
+ │ ├── addLink.ts
29
+ │ ├── fetchImages.ts
30
+ │ ├── getIssueV2.ts
31
+ │ ├── listIssuesV2.ts
32
+ │ └── completion.ts
33
+ └── utils/ # Shared utility functions
34
+ ├── client.ts # Linear client initialization
35
+ ├── git.ts # Git integration utilities
36
+ └── images.ts # Image handling utilities
37
+ ```
38
+
39
+ ## Setup
40
+
41
+ 1. Make sure you have a Linear API key (you'll need it for actual operations, but not for help/completion):
42
+ ```
43
+ export LINEAR_API_KEY=your_api_key
44
+ ```
45
+
46
+ 2. Build the CLI:
47
+ ```bash
48
+ bun install
49
+ bun run build
50
+ ```
51
+
52
+ 3. The build creates a standalone executable that can be used directly or added to your PATH.
53
+
54
+ ## Usage
55
+
56
+ ```bash
57
+ # List your assigned active issues (only shows issues not marked as done/canceled)
58
+ ./linear-darwin-arm64 my-issues
59
+
60
+ # List and filter issues with advanced options
61
+ ./linear-darwin-arm64 list-issues --assignee "John Doe" --status "In Progress"
62
+
63
+ # View details of an issue
64
+ ./linear-darwin-arm64 get-issue ENG-123
65
+ # Or if your git branch contains the issue ID (e.g., feature/ENG-123-something)
66
+ ./linear-darwin-arm64 get-issue
67
+
68
+ # Add a comment to an issue (requires message as first parameter)
69
+ ./linear-darwin-arm64 add-comment "This is my comment" --issue-id ENG-123 # Explicit ID
70
+ ./linear-darwin-arm64 add-comment "This is my comment" # Uses git branch auto-detection
71
+
72
+ # Update issue status
73
+ ./linear-darwin-arm64 update-status ENG-123 "In Progress"
74
+
75
+ # Add a link to an issue
76
+ ./linear-darwin-arm64 add-link ENG-123 https://github.com/example/repo --title "Related PR"
77
+
78
+ # Download all images from an issue to local thoughts directory
79
+ ./linear-darwin-arm64 fetch-images ENG-123
80
+ ```
81
+
82
+ ### Fetch Images
83
+
84
+ Download all images from a Linear issue to the local thoughts directory:
85
+
86
+ ```bash
87
+ linear fetch-images ENG-123
88
+ ```
89
+
90
+ This command:
91
+ - Downloads all images embedded in the issue description and comments
92
+ - Saves them to `thoughts/shared/images/ENG-123/`
93
+ - Names files as `ENG-123-01.png`, `ENG-123-02.jpg`, etc.
94
+ - Outputs the list of saved file paths (one per line)
95
+ - Shows progress messages to stderr
96
+
97
+ Example output:
98
+ ```
99
+ Downloaded 2 images:
100
+ thoughts/shared/images/ENG-123/ENG-123-01.png
101
+ thoughts/shared/images/ENG-123/ENG-123-02.jpg
102
+ ```
103
+
104
+ ### Add Comment Requirements
105
+
106
+ - Message is required as the first parameter
107
+ - Issue ID is either:
108
+ - Auto-detected from git branch name (e.g., `feature/ENG-123-something`)
109
+ - Provided with the `--issue-id` or `-i` option (e.g., `-i ENG-123`)
110
+ - If neither is available, the tool will prompt you to use one of these options
111
+
112
+ ## Shell Completions
113
+
114
+ You can also manually generate and install completions for your shell with:
115
+
116
+ ```bash
117
+ # Fish
118
+ linear completion --fish > ~/.config/fish/completions/linear.fish
119
+
120
+ # Zsh
121
+ mkdir -p ~/.zsh/completions
122
+ linear completion --zsh > ~/.zsh/completions/_linear
123
+ # Add to .zshrc: fpath=(~/.zsh/completions $fpath)
124
+ # Then: autoload -U compinit && compinit
125
+
126
+ # Bash
127
+ mkdir -p ~/.bash_completion.d
128
+ linear completion --bash > ~/.bash_completion.d/linear
129
+ # Add to .bashrc: source ~/.bash_completion.d/linear
130
+ ```
131
+
132
+ ## Requirements
133
+
134
+ One of the following JavaScript runtimes:
135
+ - Bun (recommended for speed)
136
+ - Node.js with ts-node or tsx
137
+ - npm with npx
138
+
139
+ Required npm packages (installed automatically by setup.sh):
140
+ - @linear/sdk
141
+ - commander
142
+ - chalk
143
+ - inquirer
144
+
145
+ ## Development
146
+
147
+ ### Build Commands
148
+
149
+ ```bash
150
+ # Install dependencies
151
+ bun install
152
+
153
+ # Build for macOS ARM64
154
+ bun run build
155
+
156
+ # Build for Linux x64
157
+ bun run build:linux
158
+
159
+ # Development mode with watch
160
+ bun run dev
161
+
162
+ # Run from source
163
+ bun run start
164
+ ```
165
+
166
+ ### Build Output
167
+
168
+ The build process creates standalone executables:
169
+ - `linear-darwin-arm64` - macOS ARM64 (Apple Silicon)
170
+ - `linear-linux-x64` - Linux x64
171
+
172
+ These are single-file executables with the Bun runtime embedded, making them portable and requiring no dependencies at runtime.
173
+
174
+ ## Update your CLAUDE.md
175
+
176
+ You may find it helpful to add a note to your `~/.claude/CLAUDE.md`:
177
+
178
+ ```md
179
+ ## Linear
180
+ When asked to fetch a Linear ticket, use the globally installed Linear CLI: `linear get-issue ENG-XXXX > thoughts/shared/tickets/eng-XXXX.md`
181
+ ```
package/dist/linear ADDED
Binary file
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@humanlayer/linear-cli",
3
+ "version": "0.1.0",
4
+ "description": "Command line interface for Linear",
5
+ "type": "module",
6
+ "main": "./src/index.ts",
7
+ "exports": {
8
+ ".": "./src/index.ts"
9
+ },
10
+ "bin": {
11
+ "linear": "dist/linear"
12
+ },
13
+ "files": [
14
+ "dist/linear",
15
+ "README.md"
16
+ ],
17
+ "scripts": {
18
+ "prepack": "rm -rf dist && bun run build",
19
+ "build": "bun build ./src/cli.ts --compile --target=bun --outfile=dist/linear",
20
+ "build:macos": "bun build ./src/cli.ts --compile --target=bun-darwin-arm64 --outfile=dist/linear",
21
+ "build:linux": "bun build ./src/cli.ts --compile --target=bun-linux-x64 --outfile=dist/linear",
22
+ "dev": "bun build ./src/cli.ts --compile --watch --target=bun-darwin-arm64 --outfile=dist/linear",
23
+ "start": "bun run src/cli.ts"
24
+ },
25
+ "dependencies": {
26
+ "@linear/sdk": "^1.22.0",
27
+ "chalk": "^4.1.2",
28
+ "commander": "^9.4.1",
29
+ "inquirer": "^8.2.5",
30
+ "node-fetch": "^2.7.0",
31
+ "yaml": "^2.8.2"
32
+ },
33
+ "devDependencies": {
34
+ "@types/inquirer": "^8.2.5",
35
+ "@types/node": "^18.11.9",
36
+ "@types/node-fetch": "^2.6.13",
37
+ "brace-expansion": ">=2.0.2",
38
+ "ts-node": "^10.9.1",
39
+ "typescript": "^4.8.4"
40
+ }
41
+ }