npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@samyx/repl-tui

v0.0.2

Published

A TUI (Terminal User Interface) builder using Ink (React) based on repl-builder definitions

Readme

@samyx/repl-tui

A TUI (Terminal User Interface) builder using Ink (React for CLI) based on repl-builder definitions.

Features

  • Tabbed Navigation: Switch between Commands, History, and Direct REPL views
  • Dynamic Forms: Automatically generates input forms from command argument/flag definitions
  • Command History: Track all executed commands with their outputs
  • Direct REPL Access: Raw terminal-like input for power users
  • Themeable: Customize colors and appearance
  • Works with any Node.js runtime: tsx, node, bun, etc.

Installation

npm install @samyx/repl-tui @samyx/repl-builder
# or
bun add @samyx/repl-tui @samyx/repl-builder

Quick Start

import { replBuilder } from '@samyx/repl-builder';
import { createReplTui } from '@samyx/repl-tui';

// Build your REPL with commands
const repl = replBuilder()
  .command({
    name: 'greet',
    description: 'Greet someone',
    args: [{ name: 'name', description: 'Name to greet', required: true }],
    flags: [{ name: 'loud', alias: 'l', description: 'Shout the greeting' }],
    execute(args, ctx) {
      const name = args[0];
      const loud = args.includes('--loud') || args.includes('-l');
      ctx.print(loud ? `HELLO ${name.toUpperCase()}!` : `Hello, ${name}!`);
      return 0;
    }
  })
  .build();

// Launch the TUI
createReplTui(repl);

Run with:

npx tsx your-app.tsx
# or
bun run your-app.tsx

Configuration

TUI Configuration

import { createReplTui, type TuiConfig } from '@samyx/repl-tui';

const config: TuiConfig = {
  // Title displayed at the top
  title: 'My App',

  // Initial tab to show: 'commands' | 'history' | 'repl'
  initialTab: 'commands',

  // Whether to show built-in commands (help, exit, etc.)
  showBuiltins: true,

  // Custom theme (Ink color names)
  theme: {
    primary: 'cyan',
    secondary: 'blue',
    error: 'red',
    success: 'green',
    warning: 'yellow',
    muted: 'gray',
  },
};

createReplTui(repl, config);

Using ReplConfig Directly

You can also pass a ReplConfig object instead of a Repl instance:

import { createReplTui } from '@samyx/repl-tui';

createReplTui({
  prompt: 'myapp> ',
  includeBuiltins: true,
  welcome: 'Welcome to My App!',
});

Tabs

Commands Tab

  • Lists all available commands
  • Select a command to see its form
  • Fill in arguments and flags
  • Execute and see output in real-time

History Tab

  • Browse all executed commands
  • View output and errors for each entry
  • Clear history when needed

Direct REPL Tab

  • Raw terminal-like interface
  • Type commands directly
  • Full command history within the session

Keyboard Shortcuts

This TUI uses Vim-like modal navigation with two modes:

  • NORMAL mode: Navigate with simple keys (no modifier keys needed)
  • INSERT mode: Type into text fields

Modes

| Key | Action | |-----|--------| | i / Enter | Enter INSERT mode (edit text fields) | | Escape | Return to NORMAL mode |

Normal Mode - Global

| Key | Action | |-----|--------| | 1 | Switch to Commands tab | | 2 | Switch to History tab | | 3 | Switch to Direct REPL tab (auto-enters INSERT) | | ? | Open help modal | | q | Quit the application |

Normal Mode - Commands Tab

| Key | Action | |-----|--------| | Tab | Switch focus between list and form | | j / | Move down in list or form | | k / | Move up in list or form | | Enter | Select command / Go to form | | e | Execute current command | | Space | Toggle boolean flags | | c | Clear form values | | Escape | Return to command list |

Insert Mode

| Key | Action | |-----|--------| | Tab | Move to next field | | Escape | Return to NORMAL mode | | (type) | Edit the focused text field |

History Tab

| Key | Action | |-----|--------| | j / k / / | Navigate history entries | | c | Clear all history |

Custom Components

For advanced use cases, you can import individual components:

import React from 'react';
import { render } from 'ink';
import {
  Layout,
  HistoryPanel,
  DirectRepl,
  createAdapter,
} from '@samyx/repl-tui';

const adapter = createAdapter(myRepl);

render(
  <Layout adapter={adapter} config={{ title: 'Custom App' }} />
);

Custom Hooks

For building custom TUI layouts:

import { useCommandState, useHistoryState } from '@samyx/repl-tui';

function MyCustomTui({ adapter }) {
  const commandState = useCommandState(adapter);
  const historyState = useHistoryState();

  // Use the state managers in your custom components
}

TypeScript Configuration

Add to your tsconfig.json:

{
  "compilerOptions": {
    "jsx": "react-jsx"
  }
}

Dependencies

  • ink - React for CLI
  • ink-text-input - Text input component
  • ink-select-input - Selection component
  • react - React framework
  • @samyx/repl-builder - REPL builder (peer dependency)

License

MIT