GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(client-runtime): "Codex (hub)" badges read CH instead of C( (#22918) · Pipyakas/t3code@2fd28bf

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages/client-runtime/src/state
    • providerInstanceDisplay.test.ts
    • providerInstanceDisplay.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/client-runtime/src/state/providerInstanceDisplay.test.ts‎

Copy file name to clipboardExpand all lines: packages/client-runtime/src/state/providerInstanceDisplay.test.ts
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ const codex = ProviderDriverKind.make("codex");
1212
const acpRegistry = ProviderDriverKind.make("acpRegistry");
1313

1414
describe("providerInstanceInitials", () => {
15+
it("treats punctuation as a word break but keeps apostrophes between letters", () => {
16+
expect(providerInstanceInitials("Codex (hub)")).toBe("CH");
17+
expect(providerInstanceInitials("work_codex")).toBe("WC");
18+
expect(providerInstanceInitials("Theo's Codex")).toBe("TC");
19+
expect(providerInstanceInitials("Codex 'hub'")).toBe("CH");
20+
expect(providerInstanceInitials("‘hub’")).toBe("HU");
21+
expect(providerInstanceInitials("(hub)")).toBe("HU");
22+
});
23+
1524
it("keeps an emoji whole instead of splitting its surrogate pair", () => {
1625
expect(providerInstanceInitials("😀 Work")).toBe("😀W");
1726
expect(providerInstanceInitials("😀")).toBe("😀");
Collapse file

‎packages/client-runtime/src/state/providerInstanceDisplay.ts‎

Copy file name to clipboardExpand all lines: packages/client-runtime/src/state/providerInstanceDisplay.ts
+8-1Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,14 @@ export function resolveProviderInstanceDisplayName(
2727
}
2828

2929
export function providerInstanceInitials(label: string): string {
30-
const words = label.replace(/[_-]+/g, " ").split(/\s+/u).filter(Boolean);
30+
// Punctuation separates words so "Codex (hub)" reads CH, not C(. An apostrophe
31+
// inside a word stays ("Theo's Codex" is TC); a quoting one does not
32+
// ("Codex 'hub'" is CH).
33+
const words = label
34+
.replace(/[^\P{P}'’]+/gu, " ")
35+
.split(/\s+/u)
36+
.map((word) => word.replace(/^['’]+|['’]+$/gu, ""))
37+
.filter(Boolean);
3138
if (words.length === 0) return "";
3239
if (words.length === 1) return Array.from(words[0]!).slice(0, 2).join("").toUpperCase();
3340
return words

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.