Skip to content

fix(unit-only): Add one glyph abstraction and route all TUI/console glyph... (#29)#29

Draft
aidandaly24 wants to merge 1 commit into
mainfrom
fix/29
Draft

fix(unit-only): Add one glyph abstraction and route all TUI/console glyph... (#29)#29
aidandaly24 wants to merge 1 commit into
mainfrom
fix/29

Conversation

@aidandaly24

Copy link
Copy Markdown
Owner

Refs aws#29

Issues

  • fix(unit-only): Add one glyph abstraction and route all TUI/console glyph... (#29) #29 — On legacy Windows consoles (CMD / older PowerShell using a non-UTF-8 code page), the TUI selection cursor, multi-select checkboxes, scroll arrows, step-indicator dots/arrows, and emoji render as mojibake (boxes or '?') instead of their intended glyphs. It is cosmetic — checkbox state is still conveyed by the [ ]/[x] brackets and color — but it makes the wizard look broken and hurts readability. Modern Windows Terminal renders the glyphs correctly.

Root cause

The CLI hardcodes BMP Unicode glyphs and emoji as raw string literals across its Ink component tree and console output with no Unicode-support detection and no ASCII fallback. Personally verified at v0.20.2: SelectList.tsx:57 ('❯'),48('↑'),67('↓'); MultiSelectList.tsx:42('↑'),47('[✓]'),51('❯'),59('↓'); AwsTargetConfigUI.tsx:175('❯'),176('[✓]'); StepIndicator.tsx:74('✓'/'●'/'○'),84('→'); AddGatewayScreen.tsx:286 and AddPaymentManagerScreen.tsx:221 ('[✓]'); HomeScreen.tsx:31 ('⚑'); commands/deploy/progress.ts:37,39 (console.log '✓'/'✗'). '❯' confirmed as UTF-8 e2 9d af (U+276F). No figures/is-unicode-supported dep; ink v6 Text.js has zero unicode handling, so no upstream fallback exists.

The fix

Add one glyph abstraction and route all TUI/console glyphs through it. Option A (lower risk): add figures (maps every glyph used here to ASCII via is-unicode-supported) and swap the literals at the cited file:lines. Option B: hand-roll src/cli/tui/utils/symbols.ts that detects Unicode support and exports cursor/check/arrow/dot constants with ASCII fallbacks ('>','x','^'/'v','*'/'o'). Apply the same to emoji sites and deploy/progress.ts. Optionally force chcp 65001 on Windows at startup for the mis-decode case. One layer fixes both #29 and #28. Design decision: figures dependency vs hand-rolled table.

Files touched: src/cli/tui/components/SelectList.tsx:48,57,67; MultiSelectList.tsx:42,47,51,59; AwsTargetConfigUI.tsx:175,176; StepIndicator.tsx:74,84; src/cli/tui/screens/mcp/AddGatewayScreen.tsx:286; src/cli/tui/screens/payment/AddPaymentManagerScreen.tsx:221; src/cli/tui/screens/home/HomeScreen.tsx:31; src/cli/commands/deploy/progress.ts:37,39; plus ~40 other emoji sites under src/cli/. New shared helper src/cli/tui/utils/symbols.ts (or add figures to package.json). Optional UTF-8 codepage setup in src/cli/index.ts / src/cli/cli.ts.

Validation evidence

The fix was verified by reproducing the original symptom and re-running after the change:

BEFORE (git show HEAD): SelectList.tsx etc. contained raw glyph literals (cursor/arrows) with 0 references to any symbol abstraction; package.json had NO figures/is-unicode-supported dep; src/cli/tui/utils/symbols.ts did not exist. So legacy-Windows terminals always received the raw glyphs -> mojibake, with no possible ASCII fallback. This is the exact original symptom.

AFTER (fix/29, build EXIT 0 -> OK .../dist/cli/index.mjs): a single symbols.ts abstraction with isUnicodeSupported() (honors AGENTCORE_ASCII override + is-unicode-supported-style heuristic, no new dependency) drives all 8 named call sites. Rendered-text evidence captured under both modes:

  • SelectList (ASCII off): "> Alpha / v 2 more" cursor and down arrow, zero non-ASCII.
  • MultiSelectList (ASCII off, scrolled): up arrow + checkbox [ ]/[x], zero non-ASCII; checked vs unchecked stay distinguishable.
  • StepIndicator (ASCII off): step marks x/*/o + branch -> , zero non-ASCII.
  • StepIndicator (Unicode on): originals preserved (no regression).
  • deploy/progress.ts createSpinnerProgress: ASCII -> OK/X, Unicode -> check/cross.
    Provided symbols.test.tsx passes 6/6; my independent adversarial repro test confirms the fix.

Test suite: green.


Staged on the fork as a draft for human review. Promote to aws/agentcore-cli after vetting.

…ack for legacy Windows consoles

Route all TUI selection cursors, checkboxes, scroll arrows, step-indicator
marks, and deploy progress glyphs through a single src/cli/tui/utils/symbols.ts
helper that detects Unicode support (honoring an AGENTCORE_ASCII override) and
falls back to ASCII ('>', 'x', '^'/'v', '*'/'o', '->', '[x]'/'[ ]') when the
terminal cannot render BMP glyphs. Prevents mojibake on legacy Windows CMD /
non-UTF-8 PowerShell while preserving the original glyphs on modern terminals.
No new runtime dependency.

Fixes #29
@github-actions github-actions Bot added size/m PR size: M agentcore-harness-reviewing AgentCore Harness review in progress and removed agentcore-harness-reviewing AgentCore Harness review in progress labels Jun 25, 2026
@github-actions

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 37.19% 13607 / 36587
🔵 Statements 36.46% 14468 / 39679
🔵 Functions 31.82% 2336 / 7339
🔵 Branches 31.14% 9016 / 28944
Generated in workflow #83 for commit 904a9b1 by the Vitest Coverage Report Action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/m PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant