Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 18 additions & 17 deletions skills/linear-cli/references/issue.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,23 +67,24 @@ Description:

Options:

-h, --help - Show this help.
-w, --workspace <slug> - Target workspace (uses credentials)
-s, --state <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 <assignee> - Filter by assignee (username)
-A, --all-assignees - Show issues for all assignees
-U, --unassigned - Show only unassigned issues
--sort <sort> - Sort order (can also be set via LINEAR_ISSUE_SORT) (Values: "manual", "priority")
--team <team> - Team to list issues for (if not your default team)
--project <project> - Filter by project name
--cycle <cycle> - Filter by cycle name, number, or 'active'
--milestone <milestone> - Filter by project milestone name (requires --project)
--limit <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 <slug> - Target workspace (uses credentials)
-s, --state <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 <assignee> - Filter by assignee (username)
-A, --all-assignees - Show issues for all assignees
-U, --unassigned - Show only unassigned issues
--sort <sort> - Sort order (can also be set via LINEAR_ISSUE_SORT) (Values: "manual", "priority")
--team <team> - Team to list issues for (if not your default team)
--project <project> - Filter by project name
--project-label <projectLabel> - Filter by project label name (shows issues from all projects with this label)
--cycle <cycle> - Filter by cycle name, number, or 'active'
--milestone <milestone> - Filter by project milestone name (requires --project)
--limit <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
Expand Down
25 changes: 25 additions & 0 deletions src/commands/issue/issue-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ export const listCommand = new Command()
"--project <project:string>",
"Filter by project name",
)
.option(
"--project-label <projectLabel:string>",
"Filter by project label name (shows issues from all projects with this label)",
)
.option(
"--cycle <cycle:string>",
"Filter by cycle name, number, or 'active'",
Expand Down Expand Up @@ -113,6 +117,7 @@ export const listCommand = new Command()
allStates,
team,
project,
projectLabel,
cycle,
milestone,
limit,
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -221,6 +245,7 @@ export const listCommand = new Command()
sort,
cycleId,
milestoneId,
projectLabel,
)
spinner?.stop()
const issues = result.issues?.nodes || []
Expand Down
3 changes: 3 additions & 0 deletions src/utils/linear.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
33 changes: 17 additions & 16 deletions test/commands/issue/__snapshots__/issue-list.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,23 @@ Description:

Options:

-h, --help - Show this help.
-s, --state <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 <assignee> - Filter by assignee (username)
-A, --all-assignees - Show issues for all assignees
-U, --unassigned - Show only unassigned issues
--sort <sort> - Sort order (can also be set via LINEAR_ISSUE_SORT) (Values: \\x1b[32m"manual"\\x1b[39m, \\x1b[32m"priority"\\x1b[39m)
--team <team> - Team to list issues for (if not your default team)
--project <project> - Filter by project name
--cycle <cycle> - Filter by cycle name, number, or 'active'
--milestone <milestone> - Filter by project milestone name (requires --project)
--limit <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 <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 <assignee> - Filter by assignee (username)
-A, --all-assignees - Show issues for all assignees
-U, --unassigned - Show only unassigned issues
--sort <sort> - Sort order (can also be set via LINEAR_ISSUE_SORT) (Values: \\x1b[32m"manual"\\x1b[39m, \\x1b[32m"priority"\\x1b[39m)
--team <team> - Team to list issues for (if not your default team)
--project <project> - Filter by project name
--project-label <projectLabel> - Filter by project label name (shows issues from all projects with this label)
--cycle <cycle> - Filter by cycle name, number, or 'active'
--milestone <milestone> - Filter by project milestone name (requires --project)
--limit <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:
Expand Down
Loading