From 623f24556db2bef8742b7f2ca145b805beb3d98c Mon Sep 17 00:00:00 2001 From: Al Johri Date: Mon, 16 Mar 2026 11:17:09 -0400 Subject: [PATCH 1/2] feat: add --project-label flag to issue list command Filter issues by project label name, showing issues from all projects that have a given label. Uses Linear's native GraphQL project label filtering rather than a two-step query. --- src/commands/issue/issue-list.ts | 25 ++++++++++++++ src/utils/linear.ts | 3 ++ .../__snapshots__/issue-list.test.ts.snap | 33 ++++++++++--------- 3 files changed, 45 insertions(+), 16 deletions(-) diff --git a/src/commands/issue/issue-list.ts b/src/commands/issue/issue-list.ts index 841bfcc5..1b31cf3f 100644 --- a/src/commands/issue/issue-list.ts +++ b/src/commands/issue/issue-list.ts @@ -82,6 +82,10 @@ export const listCommand = new Command() "--project ", "Filter by project name", ) + .option( + "--project-label ", + "Filter by project label name (shows issues from all projects with this label)", + ) .option( "--cycle ", "Filter by cycle name, number, or 'active'", @@ -113,6 +117,7 @@ export const listCommand = new Command() allStates, team, project, + projectLabel, cycle, milestone, limit, @@ -163,6 +168,16 @@ export const listCommand = new Command() ) } + if (project != null && projectLabel != null) { + throw new ValidationError( + "Cannot use --project and --project-label together", + { + suggestion: + "Use --project to filter by a single project, or --project-label to filter by all projects with a given label.", + }, + ) + } + let projectId: string | undefined if (project != null) { projectId = await getProjectIdByName(project) @@ -193,6 +208,15 @@ export const listCommand = new Command() let milestoneId: string | undefined if (milestone != null) { + if (projectLabel != null) { + throw new ValidationError( + "--milestone cannot be used with --project-label", + { + suggestion: + "Use --project to specify a single project when filtering by milestone.", + }, + ) + } if (projectId == null) { throw new ValidationError( "--milestone requires --project to be set", @@ -221,6 +245,7 @@ export const listCommand = new Command() sort, cycleId, milestoneId, + projectLabel, ) spinner?.stop() const issues = result.issues?.nodes || [] diff --git a/src/utils/linear.ts b/src/utils/linear.ts index cd4d2c0c..a93b2610 100644 --- a/src/utils/linear.ts +++ b/src/utils/linear.ts @@ -422,6 +422,7 @@ export async function fetchIssuesForState( sortParam?: "manual" | "priority", cycleId?: string, milestoneId?: string, + projectLabel?: string, ) { const sort = sortParam ?? getOption("issue_sort") as "manual" | "priority" | undefined @@ -459,6 +460,8 @@ export async function fetchIssuesForState( if (projectId) { filter.project = { id: { eq: projectId } } + } else if (projectLabel) { + filter.project = { labels: { name: { eqIgnoreCase: projectLabel } } } } if (cycleId) { diff --git a/test/commands/issue/__snapshots__/issue-list.test.ts.snap b/test/commands/issue/__snapshots__/issue-list.test.ts.snap index 68b208a7..d971ea8c 100644 --- a/test/commands/issue/__snapshots__/issue-list.test.ts.snap +++ b/test/commands/issue/__snapshots__/issue-list.test.ts.snap @@ -11,22 +11,23 @@ Description: Options: - -h, --help - Show this help. - -s, --state - Filter by issue state (can be repeated for multiple states) (Default: [ \\x1b[32m"unstarted"\\x1b[39m ], Values: \\x1b[32m"triage"\\x1b[39m, \\x1b[32m"backlog"\\x1b[39m, - \\x1b[32m"unstarted"\\x1b[39m, \\x1b[32m"started"\\x1b[39m, \\x1b[32m"completed"\\x1b[39m, \\x1b[32m"canceled"\\x1b[39m) - --all-states - Show issues from all states - --assignee - Filter by assignee (username) - -A, --all-assignees - Show issues for all assignees - -U, --unassigned - Show only unassigned issues - --sort - Sort order (can also be set via LINEAR_ISSUE_SORT) (Values: \\x1b[32m"manual"\\x1b[39m, \\x1b[32m"priority"\\x1b[39m) - --team - Team to list issues for (if not your default team) - --project - Filter by project name - --cycle - Filter by cycle name, number, or 'active' - --milestone - Filter by project milestone name (requires --project) - --limit - Maximum number of issues to fetch (default: 50, use 0 for unlimited) (Default: \\x1b[33m50\\x1b[39m) - -w, --web - Open in web browser - -a, --app - Open in Linear.app - --no-pager - Disable automatic paging for long output + -h, --help - Show this help. + -s, --state - Filter by issue state (can be repeated for multiple states) (Default: [ \\x1b[32m"unstarted"\\x1b[39m ], Values: \\x1b[32m"triage"\\x1b[39m, \\x1b[32m"backlog"\\x1b[39m, + \\x1b[32m"unstarted"\\x1b[39m, \\x1b[32m"started"\\x1b[39m, \\x1b[32m"completed"\\x1b[39m, \\x1b[32m"canceled"\\x1b[39m) + --all-states - Show issues from all states + --assignee - Filter by assignee (username) + -A, --all-assignees - Show issues for all assignees + -U, --unassigned - Show only unassigned issues + --sort - Sort order (can also be set via LINEAR_ISSUE_SORT) (Values: \\x1b[32m"manual"\\x1b[39m, \\x1b[32m"priority"\\x1b[39m) + --team - Team to list issues for (if not your default team) + --project - Filter by project name + --project-label - Filter by project label name (shows issues from all projects with this label) + --cycle - Filter by cycle name, number, or 'active' + --milestone - Filter by project milestone name (requires --project) + --limit - Maximum number of issues to fetch (default: 50, use 0 for unlimited) (Default: \\x1b[33m50\\x1b[39m) + -w, --web - Open in web browser + -a, --app - Open in Linear.app + --no-pager - Disable automatic paging for long output \` stderr: From 0ef2c295e26c900db72d1e9097bef1e4e699d808 Mon Sep 17 00:00:00 2001 From: Al Johri Date: Mon, 16 Mar 2026 11:26:47 -0400 Subject: [PATCH 2/2] chore: regenerate skill docs for --project-label flag --- skills/linear-cli/references/issue.md | 35 ++++++++++++++------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/skills/linear-cli/references/issue.md b/skills/linear-cli/references/issue.md index 12de728d..710d34ca 100644 --- a/skills/linear-cli/references/issue.md +++ b/skills/linear-cli/references/issue.md @@ -67,23 +67,24 @@ Description: Options: - -h, --help - Show this help. - -w, --workspace - Target workspace (uses credentials) - -s, --state - Filter by issue state (can be repeated for multiple states) (Default: [ "unstarted" ], Values: "triage", "backlog", - "unstarted", "started", "completed", "canceled") - --all-states - Show issues from all states - --assignee - Filter by assignee (username) - -A, --all-assignees - Show issues for all assignees - -U, --unassigned - Show only unassigned issues - --sort - Sort order (can also be set via LINEAR_ISSUE_SORT) (Values: "manual", "priority") - --team - Team to list issues for (if not your default team) - --project - Filter by project name - --cycle - Filter by cycle name, number, or 'active' - --milestone - Filter by project milestone name (requires --project) - --limit - Maximum number of issues to fetch (default: 50, use 0 for unlimited) (Default: 50) - -w, --web - Open in web browser - -a, --app - Open in Linear.app - --no-pager - Disable automatic paging for long output + -h, --help - Show this help. + -w, --workspace - Target workspace (uses credentials) + -s, --state - Filter by issue state (can be repeated for multiple states) (Default: [ "unstarted" ], Values: "triage", "backlog", + "unstarted", "started", "completed", "canceled") + --all-states - Show issues from all states + --assignee - Filter by assignee (username) + -A, --all-assignees - Show issues for all assignees + -U, --unassigned - Show only unassigned issues + --sort - Sort order (can also be set via LINEAR_ISSUE_SORT) (Values: "manual", "priority") + --team - Team to list issues for (if not your default team) + --project - Filter by project name + --project-label - Filter by project label name (shows issues from all projects with this label) + --cycle - Filter by cycle name, number, or 'active' + --milestone - Filter by project milestone name (requires --project) + --limit - Maximum number of issues to fetch (default: 50, use 0 for unlimited) (Default: 50) + -w, --web - Open in web browser + -a, --app - Open in Linear.app + --no-pager - Disable automatic paging for long output ``` ### title