
Testing Mastracode TUI
FreeInteractively test terminal UI features in Mastracode.
Free · Opens the source repo
What Testing Mastracode TUI does
Testing Mastracode TUI is a specialized tool designed for developers and testers who need to validate the terminal user interface of the Mastracode application. It provides an interactive environment within Konsole, allowing users to explore and test various features of the Mastracode terminal UI, including model configurations, thread lifecycles, and task state isolation. This skill is particularly useful for those involved in the development and maintenance of Mastracode, as it enables real-time testing and troubleshooting of UI components and their behaviors.
The setup process involves building Mastracode and its dependencies, which can be done using pnpm commands. Users are guided through the necessary steps to configure a custom provider using OpenRouter, ensuring they can access the required models even without direct API keys from Anthropic or OpenAI. Once configured, users can launch the Mastracode interface and utilize a set of commands to create threads, switch models, and navigate through the TUI effectively.
In addition to interactive testing, the skill includes programmatic rendering tests that help identify visual bugs in the UI. By running specific scripts, developers can measure component rendering across different terminal widths and ensure consistent visual output. This approach is crucial for catching rendering issues that may not be immediately apparent during manual testing.
Overall, Testing Mastracode TUI is an essential tool for developers working with Mastracode, providing them with the capabilities needed to ensure a robust and user-friendly terminal interface. It streamlines the testing process, allowing for efficient identification and resolution of potential issues in the UI.
When to use it
Use this skill when you need to validate the functionality and appearance of the Mastracode terminal UI during development or testing phases.
When not to use it
This skill may not be suitable for users who are not working with the Mastracode application or those who require a graphical user interface rather than a terminal-based one.
What you can build with it
Testing UI Components
Use the skill to interactively test various UI components in the Mastracode terminal, ensuring they function as expected.
Validating Model Configurations
Quickly validate and switch between different model configurations to see their effects on the terminal UI.
Identifying Rendering Bugs
Run programmatic tests to catch visual bugs in the UI that may not be obvious during manual inspection.
How to install Testing Mastracode TUI
View source1. Install with the skills CLI
npx skills add mastra-ai/mastra/testing-mastracode-tui --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by mastra-aiTesting Mastracode TUI
Guide for interactive testing of mastracode's terminal UI in Konsole.
Devin Secrets Needed
OPENROUTER_API_KEY— for using OpenRouter as a custom provider when Anthropic/OpenAI keys are unavailable
Prerequisites
-
Build mastracode and its dependencies:
cd /home/ubuntu/repos/mastra COREPACK_ENABLE_STRICT=0 pnpm build:mastracodeThis may take a few minutes. If
pnpmhas corepack issues, install directly:npm install -g pnpm@10.11.0 -
If the build fails due to pre-existing DTS errors in
@mastra/coreor@mastra/memory, use--continueto let downstream packages (including mastracode) still build:COREPACK_ENABLE_STRICT=0 pnpm turbo build --filter ./mastracode --continue -
If unit tests fail with missing
@mastra/core/workspace, runpnpm build:corefirst.
Configuring a Custom Provider (OpenRouter)
If you don't have a direct Anthropic/OpenAI API key, configure OpenRouter as a custom provider:
-
Edit
~/.local/share/mastracode/settings.json:{ "customProviders": [ { "name": "OpenRouter", "url": "https://openrouter.ai/api/v1", "apiKey": "<OPENROUTER_API_KEY value>", "models": ["minimax/minimax-m2.7"] } ], "models": { "activeModelPackId": "custom:Custom", "modeDefaults": { "build": "openrouter/minimax/minimax-m2.7", "plan": "openrouter/minimax/minimax-m2.7", "fast": "openrouter/minimax/minimax-m2.7" } }, "customModelPacks": [ { "name": "Custom", "models": { "build": "openrouter/minimax/minimax-m2.7", "plan": "openrouter/minimax/minimax-m2.7", "fast": "openrouter/minimax/minimax-m2.7" }, "createdAt": "2026-01-01T00:00:00.000Z" } ] } -
After launching mastracode, you may also need to activate the custom pack via
/models→ select "Custom" → "Activate". -
Verify the status bar at the bottom shows the correct model (e.g.,
build openrouter/minimax/minimax-m2.7).
Launching Mastracode
cd /home/ubuntu/repos/mastra/mastracode
COREPACK_ENABLE_STRICT=0 pnpm cli
On first launch, mastracode may show a setup wizard. Select "Skip" to proceed to the main TUI without configuring models interactively.
Key TUI Commands
| Command | Action |
|---|---|
/new | Create a new empty thread |
/threads | Open thread selector (↑↓ navigate, Enter select) |
/clone | Clone current thread |
/models | Switch model pack |
/help | Show all available commands |
Programmatic Rendering Tests
For visual/rendering bugs (e.g., border alignment, padding, wrapping), writing a quick tsx script that directly renders the component is more reliable than visual inspection alone:
cd /home/ubuntu/repos/mastra/mastracode
npx tsx test-script.ts
Key approach:
- Import the component directly (e.g.,
UserMessageComponentfrom./src/tui/components/user-message.js) - Render at specific widths and strip ANSI codes to measure visible character widths
- Assert all lines have identical visible width (for bordered components)
- Test at multiple terminal widths (40, 60, 80, 100, 120+) to catch edge cases
- Filter out trailing empty lines from
Spacercomponents when measuring - For before/after comparisons, simulate the old logic inline to confirm the bug exists
This approach catches bugs that are hard to see visually and provides concrete pass/fail evidence.
Testing Thread State Isolation
The key scenario for thread state testing:
-
Generate tasks: Ask the model to use the
task_writetool explicitly. Some models (e.g., minimax) may not call it automatically — you may need to say something like: "Please use the task_write tool to create a task list with 3 items: Fix login bug, Add unit tests, Update docs" -
Verify tasks visible: Look for the "Tasks [0/N completed]" section with ○/▶/✓ icons between the status line and the editor input.
-
Test
/new: The task progress component should completely disappear. The screen should show only "Ready for new conversation" and an empty input. -
Test
/threadsswitch: Switch back to the original thread — messages and tasks should restore correctly. -
Test
/clone: Cloned threads should start with empty tasks (tasks are ephemeral, not persisted to clones).
Common Issues
- Observational memory errors: You may see errors about
GOOGLE_GENERATIVE_AI_API_KEYfor the OM model. Fix this by setting the OM model to an OpenRouter model via/omor in settings.json (models.omModelOverride). Configure the OM model if you expect observation to trigger during testing. - Model not calling tools: Less capable models may not use mastracode's tool system. Explicitly instruct them to use specific tools by name.
- Status bar shows wrong model: After changing settings.json, you may need to use
/modelsin the TUI to activate the custom pack. - Build failures: If
pnpm clifails with module resolution errors, runpnpm build:mastracode(or with--continue) from the repo root to build all transitive dependencies. - User message rendering without LLM: The user message box renders immediately on Enter, before any LLM response. You can test rendering bugs without a working LLM connection — just submit a message and inspect the bordered box.
Running Unit Tests
cd /home/ubuntu/repos/mastra
COREPACK_ENABLE_STRICT=0 pnpm --filter mastracode exec vitest run src/tui/__tests__/
Some pre-existing test failures may exist in the broader test suite — focus on tests relevant to the feature being verified.
Frequently asked questions about Testing Mastracode TUI
Similar skills
Playwright Component Testing
Test React and Vue components in isolation with Playwright.
Fluent UI Blazor
Integrate Fluent UI components in Blazor applications effortlessly.
Build MCP App
Create interactive UI widgets for MCP servers.
Web Design Reviewer
Identify and fix design issues in websites efficiently.
Markstream Install
Seamlessly integrate Markstream for Markdown rendering.
GSAP & Framer Scroll Animation
Create advanced scroll animations effortlessly.
