diff --git a/src/commands/issue/issue-view.ts b/src/commands/issue/issue-view.ts index fdd590c1..1e300b63 100644 --- a/src/commands/issue/issue-view.ts +++ b/src/commands/issue/issue-view.ts @@ -5,7 +5,7 @@ import { fetchIssueDetails, getIssueIdentifier } from "../../utils/linear.ts" import { openIssuePage } from "../../utils/actions.ts" import { formatRelativeTime } from "../../utils/display.ts" import { pipeToUserPager, shouldUsePager } from "../../utils/pager.ts" -import { bold, underline } from "@std/fmt/colors" +import { bold, rgb24, underline } from "@std/fmt/colors" import { ensureDir } from "@std/fs" import { join } from "@std/path" import { encodeHex } from "@std/encoding/hex" @@ -122,8 +122,15 @@ export const viewCommand = new Command() const { identifier } = issueData - // Build metadata line with project and milestone + // Build metadata line with state, project and milestone const metaParts: string[] = [] + if (issueData.state) { + const coloredState = rgb24( + issueData.state.name, + parseInt(issueData.state.color.replace("#", ""), 16), + ) + metaParts.push(`**State:** ${coloredState}`) + } if (issueData.project) { metaParts.push(`**Project:** ${issueData.project.name}`) } diff --git a/test/commands/issue/__snapshots__/issue-view.test.ts.snap b/test/commands/issue/__snapshots__/issue-view.test.ts.snap index b8e1162f..bd64bc90 100644 --- a/test/commands/issue/__snapshots__/issue-view.test.ts.snap +++ b/test/commands/issue/__snapshots__/issue-view.test.ts.snap @@ -28,6 +28,8 @@ snapshot[`Issue View Command - With Mock Server Terminal No Comments 1`] = ` stdout: "# TEST-123: Fix authentication bug in login flow +**State:** In Progress + Users are experiencing issues logging in when their session expires. This affects the main authentication flow and needs to be resolved quickly. ## Steps to reproduce @@ -50,6 +52,8 @@ snapshot[`Issue View Command - With No Comments Flag 1`] = ` stdout: "# TEST-123: Fix authentication bug in login flow +**State:** In Progress + Users are experiencing issues logging in when their session expires. " stderr: @@ -60,6 +64,8 @@ snapshot[`Issue View Command - With Comments Default 1`] = ` stdout: "# TEST-123: Fix authentication bug in login flow +**State:** In Progress + Users are experiencing issues logging in when their session expires. ## Comments @@ -168,6 +174,8 @@ snapshot[`Issue View Command - With Parent And Sub-issues 1`] = ` stdout: "# TEST-456: Implement user authentication +**State:** In Progress + Add user authentication to the application. ## Parent @@ -190,7 +198,7 @@ snapshot[`Issue View Command - With Project And Milestone 1`] = ` stdout: "# TEST-789: Add monitoring dashboards -**Project:** Platform Infrastructure Q1 | **Milestone:** Phase 2: Observability +**State:** In Progress | **Project:** Platform Infrastructure Q1 | **Milestone:** Phase 2: Observability Set up Datadog dashboards for the new service. " @@ -202,7 +210,7 @@ snapshot[`Issue View Command - With Cycle 1`] = ` stdout: "# TEST-890: Implement rate limiting -**Project:** API Gateway v2 | **Cycle:** Sprint 7 +**State:** Todo | **Project:** API Gateway v2 | **Cycle:** Sprint 7 Add rate limiting to the API gateway. "