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

@sylphx/code

v1.0.1

Published

Sylphx Code - Unified CLI tool (TUI and headless modes)

Readme

@sylphx/code

Terminal UI for Sylphx Code

Beautiful Ink-based interface with vim-inspired navigation.


🎯 Overview

The Terminal UI (TUI) provides a powerful command-line interface for Sylphx Code. Built with Ink (React for CLIs), it offers a modern terminal experience with real-time AI streaming, multi-session management, and intuitive keyboard controls.


📦 Installation

# Using bun (monorepo)
bun install
bun build:code

# Run from monorepo root
bun dev:code

# Or from package
cd packages/code
bun dev

✨ Features

Vim-Inspired Navigation

  • j/k - Navigate up/down in lists
  • h/l - Navigate left/right in tabs
  • / - Start search/filter
  • Esc - Cancel input, close modals
  • Enter - Select item, submit input
  • Ctrl+C - Quit application

Real-time Streaming

  • Live AI responses - See tokens as they arrive
  • Tool execution feedback - Watch bash commands run
  • Markdown rendering - Syntax-highlighted code blocks
  • Progress indicators - Spinners for loading states

Multi-Session Management

  • Session switching - Quick session selector (Ctrl+S)
  • Session persistence - All conversations saved to DB
  • Session history - Browse previous chats
  • Session metadata - View agent, rules, timestamps

Slash Commands

  • /new - Create new session
  • /switch - Switch session
  • /settings - Configure agent/rules
  • /provider - Set AI provider
  • /help - Show command list
  • /quit - Exit application

🚀 Quick Start

First Run

# 1. Build packages
bun run build

# 2. Start TUI
bun dev:code

# 3. Configure AI provider
> /provider set openrouter YOUR_API_KEY

# 4. Start chatting
> Write a function that validates email addresses

Configuration

The TUI reads configuration from:

  1. Environment variables (SYLPHX_API_KEY, SYLPHX_PROVIDER)
  2. Config file (~/.sylphxrc)
  3. Interactive prompts (first run)

Example ~/.sylphxrc:

{
  "provider": "openrouter",
  "apiKey": "sk-or-...",
  "model": "anthropic/claude-3-5-sonnet",
  "defaultAgentId": "coder",
  "defaultEnabledRuleIds": ["rule1", "rule2"]
}

🏗️ Architecture

┌─────────────────────────────────┐
│  Ink Components (React)         │
│  ├── ChatScreen                 │  ← Main chat interface
│  ├── SettingsScreen             │  ← Agent/rule config
│  └── SessionSelector            │  ← Session management
├─────────────────────────────────┤
│  @sylphx/code-client            │  ← Shared hooks & stores
│  - Event-driven state           │
│  - tRPC client (in-process)     │
│  - Zustand stores               │
├─────────────────────────────────┤
│  @sylphx/code-server            │  ← Embedded server
│  - tRPC router                  │
│  - Business logic               │
│  - Streaming service            │
├─────────────────────────────────┤
│  @sylphx/code-core              │  ← Headless SDK
│  - AI providers                 │
│  - Tool execution               │
│  - Session persistence          │
└─────────────────────────────────┘

In-Process Communication

The TUI embeds the server for zero-overhead communication:

// Traditional CLI (HTTP localhost)
CLI → HTTP → Server → Business Logic
(~3ms per call)

// Sylphx Code TUI (in-process)
CLI → Direct Function Call → Business Logic
(~0.1ms, 30x faster)

📁 Project Structure

src/
├── screens/             # Main UI screens
│   ├── chat/           # Chat interface
│   │   ├── ChatScreen.tsx
│   │   ├── MessageList.tsx
│   │   ├── ChatInput.tsx
│   │   └── streaming/  # Streaming logic
│   ├── settings/       # Settings UI
│   └── dashboard/      # Session dashboard
├── components/         # Reusable components
│   ├── SessionSelector.tsx
│   ├── AgentSelector.tsx
│   ├── RuleSelector.tsx
│   └── Spinner.tsx
├── commands/           # Slash commands
│   ├── new.ts          # /new
│   ├── switch.ts       # /switch
│   ├── settings.ts     # /settings
│   └── provider.ts     # /provider
├── utils/              # Utilities
│   ├── markdown.ts     # Markdown rendering
│   └── keybindings.ts  # Keyboard shortcuts
└── index.ts            # Entry point

🎨 Customization

Custom Theme

import { Text } from 'ink';

// Use chalk for colors
import chalk from 'chalk';

<Text color="cyan">AI Response:</Text>
<Text color={chalk.green}>Success!</Text>

Custom Commands

Add to src/commands/:

// src/commands/custom.ts
export async function customCommand(args: string[]) {
  console.log('Custom command:', args);
  // Your logic here
}

// Register in src/commands/index.ts
export const commands = {
  custom: customCommand,
  // ...
};

🔧 Development

Debug Mode

# Enable debug logs
DEBUG=sylphx:* bun dev:code

# Specific namespaces
DEBUG=sylphx:streaming:* bun dev:code
DEBUG=sylphx:trpc:* bun dev:code

Watch Mode

# Auto-rebuild on changes
bun --cwd packages/code dev

Testing

# Run tests
bun test

# Watch mode
bun test:watch

📊 Performance

  • ~0.1ms in-process tRPC calls (30x faster than HTTP)
  • 39ms build time with bunup
  • Instant hot reload in development
  • Zero network latency - no HTTP overhead

🎯 Use Cases

Daily Coding Assistant

# Start session
bun dev:code

# Ask questions
> How do I implement JWT authentication in Express?

# Execute code
> Write a middleware function for JWT validation

# Save session (automatic)
# Resume later with /switch

Rapid Prototyping

# Create new session
> /new

# Quick iterations
> Write a REST API for user management
> Add authentication
> Add tests

# All code saved in chat history

Learning Tool

# Ask for explanations
> Explain how React hooks work

# Request examples
> Show me examples of useEffect cleanup

# Get best practices
> What are common React anti-patterns?

🔗 Related Packages


📄 License

MIT © 2024 Sylphx Ltd


🔗 Links


v0.1.0 - Pure UI Client Architecture

Fast. Beautiful. Terminal-native.