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/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/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 = ` - +