Skip to content
Merged
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
8 changes: 4 additions & 4 deletions skills/linear-cli/references/issue.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ Options:
--start - Start the issue after creation
-a, --assignee <assignee> - Assign the issue to 'self' or someone (by username or name)
--due-date <dueDate> - Due date of the issue
-p, --parent <parent> - Parent issue (if any) as a team_number code
--priority <priority> - Priority of the issue (1-4, descending priority)
--parent <parent> - Parent issue (if any) as a team_number code
-p, --priority <priority> - Priority of the issue (1-4, descending priority)
--estimate <estimate> - Points estimate of the issue
-d, --description <description> - Description of the issue
--description-file <path> - Read description from a file (preferred for markdown content)
Expand Down Expand Up @@ -304,8 +304,8 @@ Options:
-w, --workspace <slug> - Target workspace (uses credentials)
-a, --assignee <assignee> - Assign the issue to 'self' or someone (by username or name)
--due-date <dueDate> - Due date of the issue
-p, --parent <parent> - Parent issue (if any) as a team_number code
--priority <priority> - Priority of the issue (1-4, descending priority)
--parent <parent> - Parent issue (if any) as a team_number code
-p, --priority <priority> - Priority of the issue (1-4, descending priority)
--estimate <estimate> - Points estimate of the issue
-d, --description <description> - Description of the issue
--description-file <path> - Read description from a file (preferred for markdown content)
Expand Down
4 changes: 2 additions & 2 deletions src/commands/issue/issue-create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -460,11 +460,11 @@ export const createCommand = new Command()
"Due date of the issue",
)
.option(
"-p, --parent <parent:string>",
"--parent <parent:string>",
"Parent issue (if any) as a team_number code",
)
.option(
"--priority <priority:number>",
"-p, --priority <priority:number>",
"Priority of the issue (1-4, descending priority)",
)
.option(
Expand Down
4 changes: 2 additions & 2 deletions src/commands/issue/issue-update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ export const updateCommand = new Command()
"Due date of the issue",
)
.option(
"-p, --parent <parent:string>",
"--parent <parent:string>",
"Parent issue (if any) as a team_number code",
)
.option(
"--priority <priority:number>",
"-p, --priority <priority:number>",
"Priority of the issue (1-4, descending priority)",
)
.option(
Expand Down
14 changes: 12 additions & 2 deletions test/commands/issue/__snapshots__/issue-create.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ Options:
--start - Start the issue after creation
-a, --assignee <assignee> - Assign the issue to 'self' or someone (by username or name)
--due-date <dueDate> - Due date of the issue
-p, --parent <parent> - Parent issue (if any) as a team_number code
--priority <priority> - Priority of the issue (1-4, descending priority)
--parent <parent> - Parent issue (if any) as a team_number code
-p, --priority <priority> - Priority of the issue (1-4, descending priority)
--estimate <estimate> - Points estimate of the issue
-d, --description <description> - Description of the issue
--description-file <path> - Read description from a file (preferred for markdown content)
Expand Down Expand Up @@ -65,6 +65,16 @@ stderr:
""
`;

snapshot[`Issue Create Command - Short Flag -p Is Priority 1`] = `
stdout:
"Creating issue in ENG

https://linear.app/test-team/issue/ENG-999/test-priority-flag
"
stderr:
""
`;

snapshot[`Issue Create Command - With Cycle 1`] = `
stdout:
"Creating issue in ENG
Expand Down
15 changes: 13 additions & 2 deletions test/commands/issue/__snapshots__/issue-update.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ Options:
-h, --help - Show this help.
-a, --assignee <assignee> - Assign the issue to 'self' or someone (by username or name)
--due-date <dueDate> - Due date of the issue
-p, --parent <parent> - Parent issue (if any) as a team_number code
--priority <priority> - Priority of the issue (1-4, descending priority)
--parent <parent> - Parent issue (if any) as a team_number code
-p, --priority <priority> - Priority of the issue (1-4, descending priority)
--estimate <estimate> - Points estimate of the issue
-d, --description <description> - Description of the issue
--description-file <path> - Read description from a file (preferred for markdown content)
Expand Down Expand Up @@ -65,6 +65,17 @@ stderr:
""
`;

snapshot[`Issue Update Command - Short Flag -p Is Priority 1`] = `
stdout:
"Updating issue ENG-123

✓ Updated issue ENG-123: Test Issue
https://linear.app/test-team/issue/ENG-123/test-issue
"
stderr:
""
`;

snapshot[`Issue Update Command - With Cycle 1`] = `
stdout:
"Updating issue ENG-123
Expand Down
87 changes: 87 additions & 0 deletions test/commands/issue/issue-create.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,93 @@ await snapshotTest({
},
})

// Test that -p is priority (not parent), resolving the flag conflict
await snapshotTest({
name: "Issue Create Command - Short Flag -p Is Priority",
meta: import.meta,
colors: false,
args: [
"--title",
"Test priority flag",
"--team",
"ENG",
"-p",
"2",
"--parent",
"ENG-220",
"--no-interactive",
],
denoArgs: commonDenoArgs,
async fn() {
const { cleanup } = await setupMockLinearServer([
// Mock response for getTeamIdByKey()
{
queryName: "GetTeamIdByKey",
variables: { team: "ENG" },
response: {
data: {
teams: {
nodes: [{ id: "team-eng-id" }],
},
},
},
},
// Mock response for getIssueId("ENG-220") - resolves parent identifier to ID
{
queryName: "GetIssueId",
variables: { id: "ENG-220" },
response: {
data: {
issue: {
id: "parent-issue-id",
},
},
},
},
// Mock response for fetchParentIssueData("parent-issue-id")
{
queryName: "GetParentIssueData",
variables: { id: "parent-issue-id" },
response: {
data: {
issue: {
title: "Parent Issue",
identifier: "ENG-220",
project: null,
},
},
},
},
// Mock response for the create issue mutation
{
queryName: "CreateIssue",
response: {
data: {
issueCreate: {
success: true,
issue: {
id: "issue-new-priority",
identifier: "ENG-999",
url:
"https://linear.app/test-team/issue/ENG-999/test-priority-flag",
team: {
key: "ENG",
},
},
},
},
},
},
], { LINEAR_TEAM_ID: "ENG" })

try {
await createCommand.parse()
} finally {
await cleanup()
}
},
})

// Test creating an issue with cycle
await snapshotTest({
name: "Issue Create Command - With Cycle",
Expand Down
66 changes: 66 additions & 0 deletions test/commands/issue/issue-update.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,72 @@ await snapshotTest({
},
})

// Test that -p is priority (not parent), resolving the flag conflict
await snapshotTest({
name: "Issue Update Command - Short Flag -p Is Priority",
meta: import.meta,
colors: false,
args: [
"ENG-123",
"-p",
"2",
"--parent",
"ENG-220",
],
denoArgs: commonDenoArgs,
async fn() {
const { cleanup } = await setupMockLinearServer([
// Mock response for getTeamIdByKey()
{
queryName: "GetTeamIdByKey",
variables: { team: "ENG" },
response: {
data: {
teams: {
nodes: [{ id: "team-eng-id" }],
},
},
},
},
// Mock response for getIssueId("ENG-220") - resolves parent identifier to ID
{
queryName: "GetIssueId",
variables: { id: "ENG-220" },
response: {
data: {
issue: {
id: "parent-issue-id",
},
},
},
},
// Mock response for the update issue mutation
{
queryName: "UpdateIssue",
response: {
data: {
issueUpdate: {
success: true,
issue: {
id: "issue-existing-123",
identifier: "ENG-123",
url: "https://linear.app/test-team/issue/ENG-123/test-issue",
title: "Test Issue",
},
},
},
},
},
], { LINEAR_TEAM_ID: "ENG" })

try {
await updateCommand.parse()
} finally {
await cleanup()
}
},
})

// Test updating an issue with cycle
await snapshotTest({
name: "Issue Update Command - With Cycle",
Expand Down