Skip to main content
Version: v1 (Current)

Interactive TUI

The GxP Toolkit includes an interactive Terminal User Interface (TUI) for managing development services. Launch it explicitly with gxdev ui from an existing project directory. Bare gxdev prints plain CLI help; gxdev dev starts the plain CLI service workflow. The TUI requires a compiled dist/tui/index.js bundle and an interactive stdin/stdout terminal.

note

The TUI is designed for managing running services within an existing project. To create a new project, use gxdev init from the command line first. Initialization can offer development-server/browser launch choices; those are not a guarantee of TUI entry. Run gxdev ui explicitly when you want this interface.

Quick Start​

# Launch an idle TUI
gxdev ui

# Enter the TUI and auto-start development services
gxdev dev --ui

# TUI dispatcher HTTP flag (the plain CLI uses --no-https=true instead)
gxdev dev --ui --no-https

Interface Overview​

Illustrative layout; use the actual status, service names and command controls from your installed toolkit.

┌─────────────────────────────────────────────────────────────┐
│ GxP DevStudio │ my-plugin │ ← Header
├─────────────────────────────────────────────────────────────┤
│ [System] [Vite] [Socket] [Chrome] │ ← Tab Bar
├─────────────────────────────────────────────────────────────┤
│ │
│ Service logs appear here... │ ← Log Panel
│ Each tab shows logs from its service │
│ │
├─────────────────────────────────────────────────────────────┤
│ > /dev --with-socket │ ← Command Input
│ Ctrl+C: Exit Ctrl+L: Clear ←/→: Switch tabs │ ← Hints
└─────────────────────────────────────────────────────────────┘

Components​

ComponentDescription
HeaderShows DevStudio branding and working-directory name
Tab BarService tabs with status indicators
Log PanelReal-time logs from the active service
Command InputSlash command entry with autocomplete
HintsKeyboard shortcuts reference

Services​

The TUI manages multiple services, each with its own tab:

ServiceTab NameDescription
SystemSystemGeneral messages and help output
ViteViteDevelopment server logs
Socket.IOSocketSocket server logs (if enabled)
ChromeChromeChrome extension launcher
FirefoxFirefoxFirefox extension launcher

Service Status Indicators​

Each tab shows the managed process status. “Running” is inferred from output markers or a three-second fallback while the child exists; it is not an HTTP, socket, provider or browser health check:

IndicatorStatus
● (green)Running
○ (gray)Stopped
◐ (yellow)Starting
✕ (red)Error

Slash Commands​

Enter commands in the input field. All commands start with /.

Development Commands​

/dev # Start Vite and the socket relay by default
/dev --with-socket # Relay already starts by default; not required
/dev --with-mock # Start Vite + Socket.IO + Mock API
/dev --no-socket # Start Vite only (skip Socket.IO even if enabled)
/dev --no-https # Select HTTP for Vite; relay TLS is separate
/dev --firefox # Start + launch Firefox extension
/dev --chrome # Start + launch Chrome extension

Socket Commands​

/socket # Start Socket.IO server
/socket --with-mock # Start with Mock API enabled
/socket list # List available socket events
/socket send <event> # Send a socket event
/socket send <event> <id> # Send with custom identifier

Extension Commands​

/ext chrome # Launch Chrome with extension
/ext firefox # Launch Firefox with extension

Launching is a write operation: the TUI replaces defaults.json in the selected project-local or toolkit fallback extension directory. It sets enabled/proxy/cache defaults and a localhost redirect to /src/Plugin.vue. Keep intended custom defaults separately and verify the resolved directory before launch. A read-only toolkit installation can reject a fallback write.

Standalone /ext chrome and /ext firefox use launcher defaults of HTTPS/3060. /dev --chrome or /dev --firefox passes the development command's selected protocol and port, but verify the actual Vite URL: missing certificates can make Vite fall back to HTTP while the extension was configured for HTTPS. A launched browser is not proof that its redirect target matches the running server.

Service Management​

/stop # Stop current service
/stop <service> # Stop specific service (vite, socket, ext-chrome, ext-firefox)
/restart # Restart current service
/restart <service> # Restart specific service

/stop requests SIGTERM for the tracked process group (falling back to the child) and can send SIGKILL after two seconds if it has not exited. Wait for the process outcome rather than treating command submission as proof it stopped.

/restart uses the last stored service configuration, requests termination and starts again after the close event plus a short delay. It refuses a service with no stored configuration, including the System tab. Inspect the resulting listener/options when changing environment settings; a restart is not confirmation that new settings were applied.

/quit, /exit and Ctrl+C use force-stop cleanup for tracked children/process groups. Save work and stop deliberately before exiting when graceful application cleanup matters. These mechanisms do not certify cleanup of every detached browser process or external task.

Utility Commands​

/clear # Clear current log panel
/help # Show help message
/quit # Exit the TUI
/exit # Exit the TUI

AI Assistant​

The current TUI uses /ai, not the older /gemini command family:

/ai # Open the current provider's chat panel
/ai model # Show current/available providers
/ai model codex # Select an available provider (claude, codex, gemini)
/ai status # Show provider availability/status
/ai ask Explain this component
/ai clear # Clear the local conversation

Provider availability/authentication belongs to the configured local provider tooling. These commands do not grant project permissions or enable a project-facing AI interface. A prompt can load project context and invoke a provider; inspect the intended provider and workspace before sending it. See AI Agents and MCP for provider setup, source-writing behavior and limitations.

Keyboard Shortcuts​

ShortcutAction
TabComplete the selected command suggestion; reserved for command input
← / →Switch tabs (left/right)
Cmd+1 through Cmd+9Jump to tab by number
Ctrl+1 through Ctrl+9Jump to tab by number (alternative)

Log Panel​

ShortcutAction
Shift+↑Scroll logs up
Shift+↓Scroll logs down
Cmd+↑Jump to top of logs
Cmd+↓Jump to bottom of logs
Ctrl+LClear current log panel

Service Control​

ShortcutAction
Ctrl+KStop current service
Ctrl+CExit application (stops all services)

Command Input​

ShortcutAction
↑Previous suggestion while suggestions are visible; otherwise command history
↓Next suggestion while suggestions are visible; otherwise command history
TabAutocomplete command
EnterExecute command
EscapeRequests input/suggestion clearing; inspect the field before Enter

Command Autocomplete​

The TUI provides intelligent autocomplete:

  1. Type / to start a command
  2. Type partial command name
  3. Matching suggestions appear as you type; use ↑/↓ to move through them
  4. Press Tab to complete the selected command; argument placeholders still need your values
  5. Press Enter to submit the current command. Escape requests clearing, but a mounted synthetic-terminal check with the current input dependency left a residual /; verify the field and clear any remaining text before submitting. This is not a claim that every terminal behaves identically.

Example:

> /de # Type partial command
/dev # Autocomplete suggestion
/dev --with-socket
/dev --no-https

Service Auto-Start​

The dispatcher enters the TUI only for gxdev ui or invocations containing --ui (except pass-through exec/test). Supported startup commands include gxdev dev --ui, gxdev socket --ui, gxdev ext:chrome --ui and gxdev ext:firefox --ui. Bare gxdev ui starts idle.

For dev --ui, the dispatcher forwards its bare --no-https flag and optional --with-socket/-s startup signal. It does not forward every plain CLI option: do not assume outer --with-mock, --chrome, --port or --no-socket configures the TUI's /dev call. Start idle and enter the desired slash command when you need those behaviors:

/dev --with-mock --no-https
/ext chrome

Inside the TUI, /dev starts Vite plus the relay by default unless --no-socket is present. --with-mock enables mock routes for the relay it starts. An already-running Vite causes an early return, and an already-running relay is not restarted with a new mock setting; stop/restart the relevant services and inspect /health when changing mode. SOCKET_IO_ENABLED is not the startup switch used by this handler. Vite HTTP selection does not force the independently configured relay to HTTP.

Log Panel Features​

Log coloring​

The log panel applies text-pattern colors for Vite/socket, error, warning and startup lines. Matching order matters: a Vite-tagged error can receive the Vite color. Color is a display hint, not a severity classifier or a successful-operation result.

Auto-Scroll​

The log panel auto-scrolls to show new content. Scrolling up disables auto-scroll until you return to the bottom.

Log Persistence​

The service manager keeps up to 1,000 log lines per service and trims older lines. The rendered app also holds log state, so do not treat that manager cap as a guarantee about all UI memory. The session is not a durable log archive. Restart can retain the existing in-memory lines. Use /clear or Ctrl+L to clear the active tab. Capture a redacted failure report before clearing or exiting if you need it for diagnosis.

Welcome Screen​

When no service is selected/resolved, the TUI renders its welcome screen. Stopped services can still retain tabs and logs; stopping all children does not necessarily return to the welcome screen. Its introductory content includes:

  • Quick start commands
  • Keyboard shortcut reference
  • Project information
┌─────────────────────────────────────────────────────────────┐
│ │
│ Welcome to GxP DevTools │
│ │
│ Quick Start: │
│ /dev Start development server │
│ /dev --with-socket Start with Socket.IO │
│ /help Show all commands │
│ │
│ Use ←/→ to switch tabs, Ctrl+C to exit │
│ │
└─────────────────────────────────────────────────────────────┘

AI Panel​

/ai or /ai chat opens the panel when the current provider is available; /ai status and /ai model help diagnose selection. Treat suggestions as proposed work to review. Editing app-manifest.json, changing a runtime store value and writing legacy datastore fixture data are different operations; an AI answer does not prove a saved manifest or installed app changed.

Configuration​

Environment Variables​

The TUI respects these environment variables:

VariableDescription
NODE_PORTTUI Vite launcher reads the project .env value, falling back to 3060; verify launcher/browser context separately
SOCKET_IO_PORTSocket server port (default: 3069)
SOCKET_IO_ENABLEDNot used by the current /dev startup decision; use --no-socket to omit the relay
USE_HTTPSInspect the service-specific config; TUI /dev --no-https explicitly selects Vite HTTP

Project Detection​

Launch from the intended project directory. The header displays the last path segment of process.cwd(), not the package name. The TUI loads that directory's .env; its services and source tools use the working directory unless their specific handler supplies another context. A plausible header name does not prove the correct manifest or project was selected.

Socket listing uses the project's socket-events/ directory when present, otherwise the toolkit event directory. An existing empty project directory does not merge in toolkit examples. Extension services look for a project-local browser-extensions/<browser> first, then a toolkit fallback. Verify the resolved path before editing or launching an extension; changing to a similarly named directory is not a project switch inside an already-running TUI.

Error Handling​

Service Crashes​

If a service crashes:

  1. Inspect the child exit or spawn error and its log. A nonzero exit becomes an error; a zero or signal-only close can be shown as stopped.
  2. Confirm the expected endpoint is no longer serving before replacing or retrying it.
  3. Use /restart <service> only when its stored configuration is still appropriate. Check the new process and endpoint instead of relying on the indicator alone.

Port Conflicts​

If a port is in use:

Error: Port 3060 is already in use

Solutions:

  1. Identify the listener and stop only your own intended development service.
  2. Set the appropriate Vite or relay port and restart with aligned browser/HMR settings; they use separate listeners.
  3. Do not rely on an outer gxdev dev --ui --port ... flag: that value is not forwarded to TUI startup. See Troubleshooting for the plain CLI and configuration distinctions.

Extension Launch Failures​

If browser extension fails to launch:

  1. Check browser is installed
  2. Verify extension directory exists
  3. Check browser isn't already running with conflicting profile

Building the TUI​

The TUI is built with TypeScript and Ink (React for terminal):

# Build TUI (in gx-devtools repo)
npm run build:tui

# Watch mode for development
npm run dev:tui

Architecture​

bin/lib/tui/
├── index.tsx # Entry point
├── App.tsx # Main application component
├── components/
│ ├── Header.tsx # Header bar
│ ├── TabBar.tsx # Service tabs
│ ├── LogPanel.tsx # Log output area
│ ├── CommandInput.tsx # Input with autocomplete
│ ├── WelcomeScreen.tsx # Initial welcome
│ └── AIPanel.tsx # Current multi-provider AI panel
└── services/
│ ├── index.ts # Service exports
│ ├── ServiceManager.ts # Process state and lifecycle
│ ├── ViteService.ts # Vite launch configuration
│ ├── SocketService.ts # Relay and event helpers
│ ├── ExtensionService.ts # Browser launchers/defaults
│ └── AIService.ts # Current AI provider integration

Tips and Tricks​

Quick Development Start​

# Start the TUI, then enter the desired service command
gxdev ui
# Inside the TUI: /dev --with-mock --chrome

Monitor Multiple Services​

Use Cmd+1, Cmd+2, etc. to quickly jump between service tabs while monitoring logs.

Test Socket Events​

/socket send reads the selected event JSON and sends its event/channel/data to localhost using SOCKET_IO_PORT (default 3069). It tries HTTPS first and falls back to HTTP only for a request error whose message includes ECONNREFUSED; a TLS protocol mismatch can fail without fallback. Verify the relay's actual protocol rather than assuming the sender always negotiates it.

A 200 response is treated as successful submission to /emit, not confirmation that the intended browser listener received or applied the event. The optional identifier rewrites a channel with at least two dot-separated parts to private.<second-part>.<identifier>; it does not preserve arbitrary channel formats. Confirm the resulting channel and downstream behavior. See Socket Events for local simulation boundaries.

  1. Start the relay with /dev or /socket, then verify its actual origin/protocol
  2. Run /socket list to see available events
  3. Run /socket send EventName to test
  4. Check your plugin's response in the preview and browser console. Use the Vite and socket tabs to diagnose server/transport logs; those logs alone do not confirm browser receipt or rendering.

Clear and Restart​

/clear # Clear logs
/restart vite # Restart dev server

Quick Exit​

Ctrl+C invokes force-stop cleanup and exits. Use /stop <service> first when you need to give a service time to handle termination, then verify the outcome. Do not assume an external provider or separately detached browser was shut down merely because the TUI closed.