refactor: standardize PR state representation across the application

Updated the PR state handling to use a consistent uppercase format ('OPEN', 'MERGED', 'CLOSED') throughout the codebase. This includes changes to the worktree metadata interface, PR creation logic, and related tests to ensure uniformity and prevent potential mismatches in state representation.

Additionally, modified the GitHub PR fetching logic to retrieve all PR states, allowing for better detection of state changes.

This refactor enhances clarity and consistency in how PR states are managed and displayed.
This commit is contained in:
Shirone
2026-01-17 23:58:19 +01:00
parent 044c3d50d1
commit 5b1e0105f4
5 changed files with 63 additions and 29 deletions

View File

@@ -1,8 +1,12 @@
/** GitHub PR states as returned by the GitHub API */
export type PRState = 'OPEN' | 'MERGED' | 'CLOSED';
export interface WorktreePRInfo {
number: number;
url: string;
title: string;
state: string;
/** PR state: OPEN, MERGED, or CLOSED */
state: PRState;
createdAt: string;
}
@@ -43,7 +47,8 @@ export interface PRInfo {
number: number;
title: string;
url: string;
state: string;
/** PR state: OPEN, MERGED, or CLOSED */
state: PRState;
author: string;
body: string;
comments: Array<{