Commit Graph

21 Commits

Author SHA1 Message Date
Peter Schilling f86356d435 fix: show issue documents in issue view
Fixes #183
2026-04-02 11:49:05 -07:00
Peter Schilling c4feb0866b fix: accept alphanumeric Linear issue team keys 2026-04-02 09:30:13 -07:00
Peter Schilling b4aea366f6 feat: add issue search command 2026-04-02 04:58:17 +00:00
Peter Schilling 4113c4d4fc test: make issue list output deterministic 2026-04-01 14:59:12 +00:00
Peter Schilling fc8530ad26 fix: improve git command error handling with CliError
- Use CliError instead of generic Error for all git command failures
- Add proper error checking to getCurrentBranch() and getRepoDir()
- Improve error handling in startVcsWork() git operations
- Add comprehensive tests for git error handling
- Ensure consistent error reporting across git utilities

Fixes #62
2026-02-17 20:49:58 -08:00
Ben Drucker 3582fc5700 feat: add api subcommand for raw GraphQL access (#121)
Adds a `linear api` subcommand for making raw GraphQL requests,
mirroring [`gh api`](https://cli.github.com/manual/gh_api) conventions.

## Changes

- Accepts a GraphQL query as a positional arg, from stdin with `-`, or
via auto-detected piped input
- `--variable key=value` for typed variable coercion (booleans, numbers,
null, `@file` for file reads, `@-` for stdin)
- `--variables-json '{"key": "value"}'` for passing all variables as a
JSON object (merged with `--variable`, which takes precedence)
- `--paginate` walks `pageInfo.endCursor` automatically and outputs
concatenated `nodes` array
- `--silent` suppresses response output while exit code still reflects
errors
- Pretty-prints JSON when stdout is a TTY, raw JSON otherwise for piping
to `jq`
- Exits with code 1 on HTTP errors (status >= 400) and GraphQL-level
errors
- Uses raw `fetch` so users see the exact server response including both
`data` and `errors` fields

## Testing

- Snapshot tests using `MockLinearServer` cover query resolution,
variable handling (type coercion, `@file`, `--variables-json`,
precedence), output modes, pagination (multi-page, single-page,
non-connection), auth errors, and `--silent` behavior for both
successful and HTTP error responses
- Manual testing against live Linear API: cycles, workflow states,
notifications (with `--paginate`), non-existent issue lookup, variable
type mismatch errors, stdin piping

## Related

- Closes #123
2026-02-09 09:36:55 -08:00
Peter Schilling 430ac0402d feat: add user-friendly error handling with LINEAR_DEBUG support
Fixes #116

Error messages are now clean and user-friendly by default. Stack traces
are only shown when LINEAR_DEBUG=1 is set, similar to RUST_BACKTRACE.

Changes:
- Add src/utils/errors.ts with error handling infrastructure:
  - CliError base class with user-facing messages and suggestions
  - NotFoundError for entity lookups
  - ValidationError for invalid input
  - AuthError for authentication issues
  - handleError() for consistent error display
  - extractGraphQLMessage() to parse Linear API errors
- Update all commands to use handleError() for consistent error display
- Error output goes to stderr with ✗ prefix
- GraphQL errors show userPresentableMessage when available

Example before:
  Error: Entity not found: Issue: {"response":{"data":null...

Example after:
  ✗ Issue not found: FAKE-9999
2026-02-01 22:51:12 -08:00
Peter Schilling 59dce3cf19 fix: use centralized shouldShowSpinner() for all spinner checks
Updated bulk.ts to use the centralized shouldShowSpinner() function instead
of directly checking Deno.stdout.isTerminal(). This ensures progress display
during bulk operations also respects the NO_COLOR environment variable.

Fixes #113
2026-02-01 20:38:23 -08:00
Peter Schilling af20b0f310 use --allow-all instead of fine grained permissions
this thing runs exec loosely so i don't think they afford me mcuh, and they frequently cause problems
2026-01-29 16:33:18 +00:00
Peter Schilling 908bae467f fix: error when --workspace flag specifies unknown workspace
Previously, --workspace would silently fall back to other credential
sources when the specified workspace wasn't found. Now it errors with
a helpful message suggesting `linear auth login` or `linear auth list`.

Also errors when both LINEAR_API_KEY env var and --workspace are set,
since these are conflicting ways to specify credentials.

Added error handling guidelines to CLAUDE.md to prevent silent failures.
2026-01-27 13:02:46 -08:00
Sam Gbafa cd45a8a6aa Add initiative, label, and bulk operation support (#95)
This PR adds several major features to linear-cli:

- **Initiative management**: Full CRUD support for initiatives including
list, view, create, archive, unarchive, update, and delete commands
- **Initiative-project linking**: Commands to add and remove projects
from initiatives
- **Label management**: List, create, and delete commands for labels
with team filtering
- **Project creation**: New `project create` command with interactive
mode and initiative linking
- **Team deletion**: New `team delete` command with confirmation
- **Bulk operations**: New utility supporting bulk operations across
commands (issue delete now supports multiple IDs)

## New Commands

### Initiatives
- `linear initiative list` - List all initiatives with filtering options
- `linear initiative view <id>` - View initiative details including
linked projects
- `linear initiative create` - Create new initiative (interactive or via
flags)
- `linear initiative archive <id>` - Archive an initiative
- `linear initiative unarchive <id>` - Unarchive an initiative  
- `linear initiative update <id>` - Update initiative properties
- `linear initiative delete <id>` - Delete an initiative (with
confirmation)
- `linear initiative add-project` - Link a project to an initiative
- `linear initiative remove-project` - Remove project from initiative

### Labels
- `linear label list` - List labels with optional team filter
- `linear label create` - Create a new label
- `linear label delete <id>` - Delete a label

### Projects
- `linear project create` - Create a new project with team, lead, dates,
status, and optional initiative linking

### Teams
- `linear team delete <id>` - Delete a team (with confirmation)
2026-01-21 08:45:54 -08:00
Kirt Lillywhite 1268b667fb feat: support loading config from user home directory
Add support for loading `.linear.toml` from user's home directory as a
fallback when no project-level config exists:
- Unix: `~/.config/linear/linear.toml` or `$XDG_CONFIG_HOME/linear/linear.toml`
- Windows: `%APPDATA%\linear\linear.toml`

Config precedence (highest to lowest):
1. CLI flags
2. Environment variables
3. Project config (`.linear.toml` in cwd or repo root)
4. User home config

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 13:28:32 -08:00
Peter Schilling 77dd899d47 change format of issue describe output (jj-vcs)
this also adds --references flag for non-closing linear magic words (jj-vcs)

Claude-session-id: 7d48da37-dc2f-4c72-9570-f4500f227643
2025-12-01 09:24:02 -08:00
Peter Schilling be2dd51073 Add jj-vcs support for issue detection
Enable finding the current Linear issue from jj commit trailers, matching
the existing git branch-based detection. Users can now work with either git
or jj version control systems.

- Extract Linear-issue trailer parsing into getJjLinearIssue() utility
- Create getCurrentIssueFromVcs() abstraction for VCS-agnostic issue lookup
- Update getIssueIdentifier() to use new VCS-aware detection
- Support both git branch names and jj commit trailers seamlessly

Claude-session-id: cf951f85-34da-4328-be9d-241ff092feea
2025-10-21 11:55:05 -07:00
Peter Schilling 4bb3bef0c7 change formatting rules: no prose wrap, no semi colons 2025-09-02 22:13:34 -07:00
Peter Schilling bd5e507041 pager leaves content visible after quitting
fixes CLI-55
2025-08-21 08:41:27 -07:00
Peter Schilling 76e2ba8ffd Fix issue create with parent, auto inherit project from parent 2025-08-19 15:17:26 -07:00
Peter Schilling 1edf814b48 CLI-47 Support referencing issues with integer only IDs (#52)
https://linear.app/schpet/issue/CLI-47/allow-integer-only-issue-ids-if-theres-a-team-set
2025-08-19 08:50:24 -07:00
Peter Schilling 592000f70a Various improvements (#51)
**Fixed:**
- state column is now dynamically sized with max 20 chars and
auto-truncation

**Changed:**
- linear issue list now sorts by workflow state first
- issue pr create no longer opens browser by default, added --web flag
- removed 'about' prefix from relative timestamps

**Added:**
- automatic paging for issue view command with --no-pager flag and pager
- pager support for issue list command with --no-pager option
2025-08-18 21:52:46 -07:00
Peter Schilling 3af23fd92e CLI-23 Add linear issue update non-interactive command, support same flags as create (#50)
https://linear.app/schpet/issue/CLI-23/add-linear-issue-update-non-interactive-command-support-same-flags-as
2025-08-17 07:18:21 -07:00
Peter Schilling c125a2e805 test issue-create 2025-08-14 19:51:32 -07:00