Skip to content

Add TUI UI and CLI I/O tests #19

Closed

Description

@WTW0313

Context

Skillpack needs test coverage for the Ink TUI and the CLI process contract without coupling UI tests to provider scanning or user directories.

Agreed approach

  • Split Terminal UI Tests from CLI I/O Tests.
  • Terminal UI Tests render an injectable app surface with Ink Testing Library, shared inventory fixtures, fixed terminal sizes, normalized output, and a mock SkillManager.
  • CLI I/O Tests exercise an injectable CLI runner for stdin/stdout, alternate screen buffer control, signal handlers, render lifecycle, and process exit.
  • Keep only a thin process-level smoke test for the built binary.
  • Use snapshots only for stable normalized golden frames; use semantic assertions for interaction behavior.
  • First phase covers navigation, detail routing, search, help, terminal envelope states, and entry/confirmation state for toggle/update/remove/install flows.
  • Do not run real provider mutations, external skills commands, system file manager opens, or real signals inside the Vitest process.

Implementation units

  1. Test infrastructure:

    • Add ink-testing-library as a TUI devDependency.
    • Extract an injectable AppSurface while keeping App responsible for real manager initialization.
    • Extract runSkillpackCli for terminal lifecycle and process I/O.
    • Add TUI test harness, inventory fixtures, output normalization, and deterministic cleanup.
  2. First tests:

    • Inventory initial frame snapshot.
    • Keyboard navigation, detail routing, search, help overlay.
    • Too-small terminal state.
    • Toggle/update/remove/install entry or confirmation state.
    • CLI I/O runner output ordering and lifecycle tests.

References

  • ADR: docs/adr/0038-split-tui-ui-tests-from-cli-io-tests.md
  • Test guide: packages/tui/tests/README.md

Activity

  1. WTW0313 commented on Jul 2, 2026

    @WTW0313
    OwnerAuthor

    Implemented locally on branch refactor/ui-polish.

    Completed scope:

    • Added ink-testing-library to the TUI package.
    • Added AppSurface so Terminal UI Tests can render with injected manager/config/terminal size without scanning user directories.
    • Added runSkillpackCli so CLI I/O Tests can verify terminal control sequences, signal unmount, render lifecycle, and process exit through injected streams/process/render.
    • Added TUI test README, inventory fixtures, mock SkillManager, render harness, ANSI/frame normalization, and keyboard helpers.
    • Added Terminal UI Tests for inventory snapshot, keyboard navigation, detail routing, search, help overlay, too-small terminal snapshot, toggle mutation entry, remove confirmation, update check, and install entry.
    • Added CLI I/O Tests for alternate screen lifecycle ordering, SIGTERM unmount, and terminal restoration on render lifecycle failure.

    Verification:

    • pnpm --filter skillpack-tui test
    • pnpm test
    • pnpm build

    Note: no real provider mutations, external skills commands, system file manager opens, or real signals in the Vitest process are used by the new tests.

  2. WTW0313 commented on Jul 2, 2026

    @WTW0313
    OwnerAuthor

    Committed implementation on refactor/ui-polish:

    • Commit: 587e377 (test(tui): add terminal UI and CLI I/O coverage)
    • Branch status: local branch is ahead of origin/refactor/ui-polish by 1 commit.

    Verification completed before commit:

    • pnpm --filter skillpack-tui test
    • pnpm test
    • pnpm build

    The implementation keeps Terminal UI Tests and CLI I/O Tests separated as described in ADR 0038 and avoids real provider mutations, external skills commands, system file manager opens, and real signals inside the Vitest process.

  3. linked a pull request that will close this issue[codex] Polish responsive TUI experience #20on Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agentFully specified and ready for an AFK agent

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions