Skip to content

Improve issue mine's no-team error and suggest linear config in repos#255

Merged
schpetbot merged 1 commit into
mainfrom
issue-mine-team-error
Jul 23, 2026
Merged

Improve issue mine's no-team error and suggest linear config in repos#255
schpetbot merged 1 commit into
mainfrom
issue-mine-team-error

Conversation

@schpetbot

Copy link
Copy Markdown
Collaborator

Follow-up to #253 / #254, addressing the other rough edge in the out-of-the-box experience:

❯ linear issue mine
✗ Failed to list issues: Could not determine team key from directory name or team flag

What changed

issue mine (and its list/l aliases) now reports the same error as issue query when no team can be determined, with an actionable suggestion — and when run inside a git work tree, it additionally points at linear config, which links the repository to a team by generating .linear.toml:

# outside a repo
✗ Failed to list issues: No default team configured and no team scope provided
  Use --team <key> to specify a team.

# inside a repo
✗ Failed to list issues: No default team configured and no team scope provided
  Use --team <key> to specify a team, or run `linear config` to link this repository to a team.

The old message was also inaccurate: the team never comes from the directory name — only from --team, LINEAR_TEAM_ID, or team_id config.

Repo detection is a new isInsideGitRepo() helper in src/utils/git.ts that is deliberately best-effort: any failure (git missing, not a repo, dubious ownership, spawn error) yields false, so the optional hint can never replace the actionable team error with a git crash. It checks git rev-parse --is-inside-work-tree's stdout, not just its exit code (which is 0-with-"false" inside .git dirs and bare repos), and covers colocated jj repos via their .git.

Tests

  • Unit tests for isInsideGitRepo (non-repo, repo, nested dir).
  • Two subprocess regression tests asserting the exact two-line stderr for the in-repo and non-repo variants. Subprocess with a clean env/cwd is required: the repo's own .linear.toml sets team_id, so the error path is unreachable in-process from the repo root.

Deferred

The same stale message exists in cycle list, cycle view, team states, and team members; they can adopt isInsideGitRepo() and this error shape in a follow-up. issue start's "Could not determine team ID" and adding the linear config hint to issue query are likewise out of scope here.

When no team can be determined, issue mine (and its list alias) now uses
the same message as issue query — 'No default team configured and no team
scope provided' — instead of the inaccurate 'Could not determine team key
from directory name or team flag' (the team only ever comes from the
--team flag, LINEAR_TEAM_ID, or team_id config; directory names are not
consulted). The error now carries a suggestion: always offer --team
<key>, and when run inside a git work tree, also point at linear config,
which links the repository to a team by generating .linear.toml.

Repo detection is a new best-effort isInsideGitRepo() helper: any git
failure (not a repo, dubious ownership) counts as false so the optional
hint can never turn the team error into a git crash. The same stale
message remains in cycle-list, cycle-view, team-states, and team-members;
those are deferred so they can adopt the helper in a follow-up.
@schpetbot
schpetbot merged commit eb6f074 into main Jul 23, 2026
15 checks passed
@schpetbot
schpetbot deleted the issue-mine-team-error branch July 23, 2026 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants