From 2a4053c360432c620161217302393f4d0feafb68 Mon Sep 17 00:00:00 2001 From: YG Park Date: Sat, 8 Aug 2026 15:48:22 +0900 Subject: [PATCH 1/2] fix(support): read current closed-ticket status --- src/lib/support.ts | 10 +++++++++- tests/support.test.ts | 16 +++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/lib/support.ts b/src/lib/support.ts index 042deaf..52826c3 100644 --- a/src/lib/support.ts +++ b/src/lib/support.ts @@ -319,9 +319,17 @@ export function parseSupportTicketDetails(html: string): SupportTicketDetails { const ticketId = attribute(ticketTag, "data-ticket-id"); const orgType = attribute(ticketTag, "data-org-type"); const orgId = attribute(ticketTag, "data-org-id"); - const status = html + const stateTag = html.match( + /<([a-z][\w-]*)\b[^>]*class="[^"]*\bState\b[^"]*"[^>]*>([\s\S]*?)<\/\1>/i, + ); + const stateLabel = stateTag ? htmlToText(stateTag[2] ?? "").toLowerCase() : ""; + const legacyState = stateTag?.[0] .match(/class="[^"]*\bState--(open|closed)\b/i)?.[1] ?.toLowerCase(); + const status = + stateLabel === "open" || stateLabel === "closed" + ? stateLabel + : legacyState; if ( !ticketId || !orgType || diff --git a/tests/support.test.ts b/tests/support.test.ts index a34c60d..873338d 100644 --- a/tests/support.test.ts +++ b/tests/support.test.ts @@ -40,7 +40,7 @@ const personal: SupportAccount = { const organization: SupportAccount = { ...personal, id: "org-id", - identifier: "Circles Inc.", + identifier: "Example Corp.", type: "Organization", }; @@ -83,7 +83,7 @@ describe("Support ticket selection", () => { }); it("matches an explicit account case-insensitively", () => { - expect(selectSupportAccount(bootstrap.accounts, "circles inc.")).toBe( + expect(selectSupportAccount(bootstrap.accounts, "example corp.")).toBe( organization, ); }); @@ -221,8 +221,18 @@ describe("support ticket view", () => { it("reads a closed ticket without requiring a comment form", () => { const closed = TICKET_DETAILS_HTML - .replace("State--open", "State--closed") + .replace( + 'class="State State--open">Open', + 'class="State bgColor-done-emphasis">Closed', + ) .replace(/
/, ""); expect(parseSupportTicketDetails(closed).status).toBe("closed"); }); + + it("keeps compatibility with the legacy status class", () => { + const legacyClosed = TICKET_DETAILS_HTML + .replace("State--open", "State--closed") + .replace(">Open", ">"); + expect(parseSupportTicketDetails(legacyClosed).status).toBe("closed"); + }); }); From f010c092e09cf17129b69f32f36a6ca2b24de7af Mon Sep 17 00:00:00 2001 From: YG Park Date: Sat, 8 Aug 2026 15:48:22 +0900 Subject: [PATCH 2/2] test: anonymize public GitHub examples --- README.md | 4 ++-- skills/guide/SKILL.md | 6 ++--- tests/delete-parser.test.ts | 4 ++-- tests/pat.test.ts | 48 ++++++++++++++++++------------------- 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 12a26b9..bc5cd21 100644 --- a/README.md +++ b/README.md @@ -218,13 +218,13 @@ gh2 support view 1234567 gh2 support view 1234567 --scope personal/0 --output json gh2 support create \ - --account "Circles Inc." \ + --account "Example Corp." \ --subject "Remove sensitive data from repository history" \ --body-file ./ticket.md # Submit the reviewed ticket gh2 support create \ - --account "Circles Inc." \ + --account "Example Corp." \ --subject "Remove sensitive data from repository history" \ --body-file ./ticket.md \ --yes diff --git a/skills/guide/SKILL.md b/skills/guide/SKILL.md index 59b35cd..5277a98 100644 --- a/skills/guide/SKILL.md +++ b/skills/guide/SKILL.md @@ -22,7 +22,7 @@ All config files are `github..json` where `stage ∈ {local, prod}`: ```json { "appId": 2864083, - "name": "circlesac-yg2", + "name": "example-app", "webhookSecret": "...", "privateKey": "" } @@ -198,13 +198,13 @@ gh2 support view 1234567 --scope personal/0 --output json # Dry run: authenticates and prints the exact ticket without creating it gh2 support create \ - --account "Circles Inc." \ + --account "Example Corp." \ --subject "Remove sensitive data from repository history" \ --body-file ./ticket.md # Submit only after reviewing the dry run gh2 support create \ - --account "Circles Inc." \ + --account "Example Corp." \ --subject "Remove sensitive data from repository history" \ --body-file ./ticket.md \ --yes diff --git a/tests/delete-parser.test.ts b/tests/delete-parser.test.ts index 69f3350..caa57b3 100644 --- a/tests/delete-parser.test.ts +++ b/tests/delete-parser.test.ts @@ -61,8 +61,8 @@ describe("parseDeleteForm", () => { describe("confirmValueFromPattern", () => { it("reconstructs the app name from a case-insensitive char-class pattern", () => { expect( - confirmValueFromPattern("[cC][iI][rR][cC][lL][eE][sS][aA][cC]-[yY][gG]2"), - ).toBe("circlesac-yg2"); + confirmValueFromPattern("[eE][xX][aA][mM][pP][lL][eE]-[aA][pP][pP]"), + ).toBe("example-app"); }); it("keeps literal characters (digits, hyphens) as-is", () => { diff --git a/tests/pat.test.ts b/tests/pat.test.ts index a9b1b9a..d30ad33 100644 --- a/tests/pat.test.ts +++ b/tests/pat.test.ts @@ -27,14 +27,14 @@ const PAT_FORM_HTML = ` - + - + `; @@ -47,7 +47,7 @@ const ACCESS_HTML = ` - +