term-v0 Complete Guide

Term-V0 Demo
This is an experimental project - expect quirks, bugs, and incomplete features. This is a fun project for exploration and learning, not production use. Try it out if it works for you, but don't rely on it for critical tasks.

Installation

Global Installation (Recommended)

bash
npm install -g term-v0

One-time Use (No Installation)

bash
npx term-v0 "create a system monitor"

API Keys Setup

term-v0 requires an LLM provider to generate TUIs. Choose one of the following options:

Anthropic

Anthropic Claude

Recommended

Best quality results with Claude 3.5 Sonnet.

  1. 1.Get API key from console.anthropic.com
  2. 2.
    Set environment variable:

    macOS/Linux:

    bash
    export ANTHROPIC_API_KEY="sk-ant-..."
    # Make it permanent
    echo 'export ANTHROPIC_API_KEY="sk-ant-..."' >> ~/.zshrc
    source ~/.zshrc

    Windows:

    powershell
    # PowerShell as Administrator
    [System.Environment]::SetEnvironmentVariable('ANTHROPIC_API_KEY','sk-ant-...','User')

    Optional model selection:

    bash
    export ANTHROPIC_MODEL="claude-3-5-sonnet-latest"

OpenAI GPT

Fast and cost-effective

Fast and cost-effective with GPT-4.

  1. 1.Get API key from platform.openai.com
  2. 2.
    Set environment variable:
    bash
    export OPENAI_API_KEY="sk-..."
    # Optional: Choose model
    export OPENAI_MODEL="gpt-4o"
    # Optional: Custom endpoint
    export OPENAI_BASE_URL="https://..."

Ollama

Local & Free

Run models locally without API costs.

  1. 1.Install Ollama from ollama.ai
  2. 2.
    Pull and set a model:
    bash
    ollama pull llama3.2
    export OLLAMA_MODEL="llama3.2"
Need help with environment variables? Ask ChatGPT for assistance

Usage

Basic Commands

Generate a new app:

bash
term-v0 "create a file explorer with preview"

Configure provider:

bash
term-v0 --configure

List your apps:

bash
term-v0 --list

Run existing app:

bash
term-v0 --run-app my-app-name

Refine existing app:

bash
term-v0 --refine my-app-name

Advanced Options

Use specific UI library:

bash
term-v0 --library blessed "create a dashboard"
term-v0 --library ink "create a progress tracker"

Control refinement:

bash
term-v0 --refine-iters 3 "optimize the layout"

Set error fix attempts:

bash
term-v0 --fix-iters 5 "build a complex app"

Interactive mode (no arguments):

bash
term-v0
# Follow prompts

Example Prompts

A todo list with categories and priority levels
A file browser with search and preview
A system monitor showing CPU, memory, and disk usage
A dashboard for monitoring server stats
A text editor with syntax highlighting
A database query tool with table viewer

App Storage

Your generated apps are saved in:

macOS/Linux:

~/.term-v0/apps/

Windows:

%USERPROFILE%\.term-v0\apps\

Each app folder contains:

  • app.js - Generated application code
  • design.txt - Design document
  • App metadata and prompt history

Configuration & Help

Provider Configuration

bash
# Interactive setup
term-v0 --configure

# List available providers
term-v0 --list-providers

App Management

bash
# List all apps
term-v0 --list

# Run specific app
term-v0 --run-app "app-name"

# Refine app interactively
term-v0 --refine "app-name"

# Refine with specific prompt
term-v0 --refine "app-name" "make it more colorful"

Command Reference

CommandDescription
term-v0 [prompt]Generate new app
term-v0 --configureSetup LLM provider
term-v0 --listList saved apps
term-v0 --run-app <name>Run existing app
term-v0 --refine [name]Refine existing app
term-v0 --library <blessed|ink>Choose UI library
term-v0 --refine-iters <number>Refinement iterations
term-v0 --fix-iters <number>Error fix attempts
term-v0 --list-providersShow available providers
term-v0 --helpShow help

Self-Help Commands

bash
term-v0 --help                     # Show help
term-v0 --list-providers           # Check providers
term-v0 --configure                # Interactive setup

Troubleshooting

Common Issues

"No LLM provider configured"

  • • Run term-v0 --configure
  • • Ensure API keys are set in environment variables
  • • Restart terminal after setting variables

App generation fails

  • • Check API key validity
  • • Verify internet connection
  • • Try simpler prompts
  • • Check provider status/limits

Generated app won't run

  • • Check for syntax errors in generated code
  • • Try refining: term-v0 --refine app-name
  • • Generate with different library: --library ink

Permission errors

  • • Ensure proper file permissions in ~/.term-v0/ directory
  • • Try running with appropriate permissions

Ollama not working

  • • Ensure Ollama service is running: ollama serve
  • • Check if model is pulled: ollama list
  • • Verify OLLAMA_MODEL environment variable

Reset Configuration

bash
# Remove config directory to start fresh
rm -rf ~/.term-v0/

Debug Mode

bash
# Run with verbose output
DEBUG=* term-v0 "your prompt"

If Something Breaks

  1. 1. Check the troubleshooting section above
  2. 2. Try regenerating the app with a simpler prompt
  3. 3. Reset configuration: rm -rf ~/.term-v0/
  4. 4. Restart terminal and try again
  5. 5. Check if your API provider is working

Security Notice

term-v0 generates and executes code based on your prompts. Please follow these security guidelines:
  • Review generated code before running in production environments
  • Use in isolated environments when testing unfamiliar code
  • Be specific with prompts to get expected behavior
  • Don't run on systems with sensitive data without review
  • Generated apps have access to your system - use caution

Known Limitations

  • Experimental software - expect bugs and incomplete features
  • Generated code quality varies based on prompt complexity
  • Limited error handling in generated applications
  • No automatic testing of generated code
  • Refinement may break working functionality
  • Provider API limits may affect generation

Tips & Best Practices

Writing Good Prompts

  • Be specific about functionality
  • Mention UI elements you want
  • Specify data sources if needed
  • Include interaction requirements

✅ Good:

"Create a file manager with tree view, file preview pane, and search functionality"

❌ Avoid:

"Make a file thing"

Refinement Tips

  • • Start simple, then refine for complexity
  • • Be specific about what to change
  • • Test frequently during refinement
  • • Save working versions before major changes

Performance

  • • Use blessed library for better performance
  • • Avoid overly complex initial prompts
  • • Refine incrementally rather than major rewrites

Getting Help

Remember: This is experimental software for fun and exploration. If it doesn't work perfectly, that's expected!

License

MIT License - Feel free to experiment, modify, and have fun!

Happy TUI building! 🚀

Start creating amazing terminal interfaces today