JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 65
  • Score
    100M100P100Q90166F
  • License MIT

AI coding assistant CLI โ€” supports OpenRouter, OpenAI, Anthropic, Google AI, Ollama, LM Studio, Local AI Foundry, and any OpenAI-compatible endpoint

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (bse-code) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    ๐Ÿค– bse-code

    The AI coding assistant that lives in your terminal โ€” works with ANY LLM, zero lock-in, zero compromise.

    Chat with your codebase, read and write files, run shell commands, connect MCP servers, build reusable skills, persist project memory, and pick up right where you left off โ€” all from a gorgeous interactive REPL.

    npm NuGet License: MIT


    โœจ Why bse-code?

    ๐ŸŒ Any LLM, anywhere OpenRouter, OpenAI, Anthropic, Google AI, Ollama, LM Studio, Local AI Foundry, or any OpenAI-compatible endpoint
    ๐Ÿ†“ Start for free OpenRouter's free tier gives you Gemini 2.5 Pro, Llama 4, DeepSeek R1 โ€” no credit card
    ๐Ÿ  Fully local Ollama or LM Studio โ€” no API key, no data leaving your machine
    ๐Ÿง  Context-aware Project memory, skills, and MCP tools injected automatically into every session
    ๐Ÿ’พ Session persistence Save and resume conversations per project โ€” never lose context again
    ๐ŸŽจ Beautiful terminal UI 6 built-in themes, interactive slash picker, history navigation, full cursor editing
    โšก Instant shell access !git status, !npm run build โ€” run any command without leaving the chat
    ๐Ÿ“‚ File injection @src/auth.ts โ€” drop any file or directory straight into your prompt

    ๐Ÿš€ Install

    Requires Node.js 18+. No .NET SDK needed โ€” the binary is bundled.

    npm install -g bse-code

    Also available as a .NET global tool: dotnet tool install --global bse-code


    ๐ŸŒ Supported Providers

    # Provider Models API Key
    1 ๐Ÿ”€ OpenRouter 100+ models, free tier available Yes (free at openrouter.ai)
    2 ๐ŸŸข OpenAI GPT-4o, o3, o1, GPT-3.5 Yes
    3 ๐ŸŸฃ Anthropic Claude 3.7/3.5 Sonnet, Haiku, Opus Yes
    4 ๐Ÿ”ต Google AI Gemini 2.5 Pro/Flash, 2.0, 1.5 Yes (free tier)
    5 ๐Ÿฆ™ Ollama llama3, mistral, qwen, deepseekโ€ฆ โŒ No (local)
    6 ๐Ÿ–ฅ๏ธ LM Studio Any model loaded in LM Studio โŒ No (local)
    7 ๐Ÿญ Local AI Foundry Phi-4, Phi-3.5 Mini, and more โŒ No (local)
    8 โš™๏ธ Custom Any OpenAI-compatible endpoint Optional

    ๐Ÿง™ First-run Setup

    On first run, an interactive wizard walks you through everything:

    1. ๐ŸŽฏ Pick a provider
    2. ๐Ÿ”— Set the base URL (pre-filled for known providers)
    3. ๐Ÿ”‘ Enter your API key (skipped for local providers)
    4. ๐Ÿค– Browse available models and pick one
    5. ๐Ÿ’พ Everything saved to ~/.bse-code/config.json

    Re-run the wizard any time:

    bse-code --config

    โšก Quick-start by provider

    ๐Ÿ”€ OpenRouter โ€” free models, no credit card

    bse-code --config
    # Select [1] OpenRouter โ†’ get a free key at https://openrouter.ai/keys
    # Pick Gemini 2.5 Pro, Llama 4, DeepSeek R1 โ€” all free!

    ๐Ÿฆ™ Ollama โ€” fully local, zero cost

    ollama pull llama3.2
    bse-code --config
    # Select [5] Ollama โ†’ accept default URL โ†’ pick your model

    ๐Ÿ’ป Usage

    bse-code
      โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
      โ”‚   โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—                โ”‚
      โ”‚   โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ•โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ•                โ”‚
      โ”‚   โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—   โ”€ code         โ”‚
      โ”‚   โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ•šโ•โ•โ•โ•โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ•                  โ”‚
      โ”‚   โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—                โ”‚
      โ”‚   โ•šโ•โ•โ•โ•โ•โ• โ•šโ•โ•โ•โ•โ•โ•โ•โ•šโ•โ•โ•โ•โ•โ•โ•                โ”‚
      โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
      provider: OpenRouter
      model   : google/gemini-2.5-pro-exp-03-25:free
      theme   : default
      cwd     : my-project
      ๐Ÿง  skills : 2 loaded
      ๐Ÿ”Œ mcp    : 5 tools from 1 server(s)
      ๐Ÿ’พ memory : 1 BSE.md file(s) loaded
      type /help for commands ยท /exit to quit ๐Ÿš€
    
     my-project (main) โฏ

    โšก One-shot mode

    bse-code -p "explain the auth flow in src/auth/"
    bse-code -p "list all TODO comments" --output-format json

    ๐Ÿณ๏ธ All CLI flags

    bse-code                              # ๐Ÿ” Interactive REPL
    bse-code -p "<prompt>"                # โšก One-shot prompt
    bse-code --model <model-id>           # ๐Ÿค– Override model for this session
    bse-code --theme <name>               # ๐ŸŽจ Set color theme for this session
    bse-code --output-format json|text    # ๐Ÿ“„ Output format (one-shot only)
    bse-code --config                     # โš™๏ธ  Re-run the setup wizard
    bse-code --version, -v                # ๐Ÿ”ข Show version
    bse-code --help, -h                   # โ“ Show help

    ๐Ÿช„ Special Input Prefixes

    @ โ€” File & directory injection

    Drop any file or folder straight into your prompt. Tab-completes paths as you type.

    @src/auth.ts explain this file
    @src/auth/ summarize all files in this folder
    @package.json what dependencies are outdated?

    Directories inject up to 20 files automatically โ€” perfect for asking about a whole module at once.

    ! โ€” Shell passthrough

    Run any shell command instantly, no AI involved, output right in your terminal.

    !git status
    !npm run build
    !ls -la src/

    โŒจ๏ธ REPL Slash Commands

    ๐Ÿ”ง Core

    Command Description
    /clear ๐Ÿงน Wipe conversation history โ€” fresh start
    /model [id] ๐Ÿค– Show current model or switch mid-session
    /compact [hint] ๐Ÿ—œ๏ธ Summarize history and trim tokens
    /stats ๐Ÿ“Š Session stats: duration, turns, tool calls, messages, model, provider, theme, skills, MCP tools
    /tools ๐Ÿ”ง List all available built-in and MCP tools
    /help โ“ Show all commands
    /exit or /quit ๐Ÿ‘‹ Quit

    ๐ŸŽจ Appearance

    Command Description
    /theme ๐ŸŽจ List all themes with active marker
    /theme <name> ๐ŸŽจ Switch theme โ€” persisted to config

    ๐Ÿง  Skills

    Command Description
    /skills ๐Ÿ“‹ List all loaded skills (user + project level)
    /<skill-name> โ–ถ๏ธ Invoke a skill
    /<skill-name> @file.ts โ–ถ๏ธ Invoke a skill with a file argument

    ๐Ÿ”Œ MCP

    Command Description
    /mcp ๐Ÿ”Œ List all connected MCP servers and their tools
    /mcp reload ๐Ÿ”„ Hot-reload MCP servers without restarting

    ๐Ÿ’พ Memory

    Command Description
    /memory ๐Ÿ’พ Show all loaded BSE.md files
    /memory add <text> โœ๏ธ Append a note to ./BSE.md instantly
    /memory refresh ๐Ÿ”„ Reload BSE.md files and refresh the system prompt
    /init ๐ŸŽ‰ Scaffold a BSE.md in the current directory

    ๐Ÿ“ Sessions

    Command Description
    /save <tag> ๐Ÿ’พ Save the current conversation with a tag
    /resume ๐Ÿ“‚ List all saved sessions for this project
    /resume <tag> โ–ถ๏ธ Restore a saved session and pick up where you left off

    ๐ŸŽฎ Interactive Input โ€” Feels Like a Real Shell

    / โ€” Slash command picker

    Type / and an inline menu pops up instantly:

      /  โ†‘โ†“ navigate ยท Enter select ยท Esc cancel
      โ–ถ /clear                ๐Ÿงน clear conversation history
        /model                ๐Ÿค– show or switch model
        /compact              ๐Ÿ—œ๏ธ  summarize history to save tokens
        /theme                ๐ŸŽจ list or set color theme
        /skills               ๐Ÿง  list loaded skills
        /mcp                  ๐Ÿ”Œ list MCP servers and tools
        /memory               ๐Ÿ’พ show loaded BSE.md files
        /save                 ๐Ÿ’พ save conversation
        /resume               โ–ถ๏ธ  list or resume a saved session
        โ€ฆ
    • โฌ†๏ธโฌ‡๏ธ Arrow keys navigate the list
    • โŒจ๏ธ Type more characters to filter live โ€” /th narrows to /theme
    • โ†ฉ๏ธ Enter selects, Esc cancels
    • โ‡ฅ Tab completes the top match
    • ๐Ÿง  Your skills appear right alongside built-in commands

    ๐Ÿ“œ History & cursor editing

    • โฌ†๏ธโฌ‡๏ธ arrows cycle through previous inputs โ€” just like your shell
    • โฌ…๏ธโžก๏ธ move the cursor anywhere in the line
    • Home / End jump to start or end
    • Backspace / Delete work at any cursor position
    • โ‡ฅ Tab on @<path> completes file and directory paths

    ๐Ÿง  Skills โ€” Reusable AI Workflows

    Skills are markdown files that give the AI reusable instructions or workflows. Write once, invoke from any project.

    ๐Ÿ“‚ Locations (both loaded and merged):

    • ~/.bse-code/skills/ โ€” user-level, available in every project
    • .bse-code/skills/ โ€” project-level, scoped to this repo

    Example skill (.bse-code/skills/review.md):

    # Code Review
    
    Review the provided code for:
    - Correctness and logic errors
    - Performance issues
    - Security vulnerabilities
    - Code style and readability

    Invoke it:

    /review
    /review @src/PaymentService.ts

    Skills are also injected into the system prompt automatically โ€” the AI always knows what's available. ๐Ÿš€


    ๐Ÿ’พ Project Memory (BSE.md)

    BSE.md files are loaded at startup and injected into every session's system prompt. Teach the AI about your project once โ€” it remembers forever.

    ๐Ÿ—๏ธ Hierarchy โ€” all three are merged:

    File Scope
    ~/.bse-code/BSE.md ๐ŸŒ Global โ€” your personal preferences across all projects
    ./BSE.md ๐Ÿ“ Project โ€” tech stack, commands, coding standards
    ./BSE.local.md ๐Ÿ”’ Local overrides โ€” add to .gitignore

    Scaffold one instantly:

    bse-code
    /init

    Add notes on the fly:

    /memory add always use async/await, never .then() chains
    /memory add run `npm test` before committing

    ๐Ÿ”Œ MCP (Model Context Protocol)

    Connect any external tool or service via MCP servers. GitHub, databases, Slack, custom APIs โ€” if it speaks MCP, it works here.

    Config file: ~/.bse-code/mcp.json

    {
      "mcpServers": {
        "filesystem": {
          "command": "npx",
          "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/dir"]
        },
        "github": {
          "command": "npx",
          "args": ["-y", "@modelcontextprotocol/server-github"],
          "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "your-token" }
        }
      }
    }
    • Tools available to the AI as mcp__serverName__toolName
    • Hot-reload without restarting: /mcp reload ๐Ÿ”„
    • Inspect what's connected: /mcp
    • Disable without removing: "disabled": true

    ๐Ÿ”จ Built-in AI Tools

    Tool What it does
    ๐Ÿ“– read_file Read any file's contents
    โœ๏ธ Write Write or create a file (auto-creates parent directories)
    ๐Ÿ–ฅ๏ธ Bash Execute shell commands โ€” cross-platform
    ๐Ÿ“‚ list_dir List files and subdirectories at a path
    ๐Ÿ” glob Find files matching a glob pattern (e.g. src/**/*.ts)
    ๐Ÿ”Ž grep Search files with a regex pattern (up to 200 matches, recursive)
    ๐Ÿ”Œ mcp__*__* Any tool from your connected MCP servers

    Tool calls are shown inline as the AI works โ€” you see exactly what it's doing in real time. โœ“ or โœ— per call.


    ๐Ÿ’พ Session Management

    Never lose a good conversation. Save any session with a tag and resume it later.

    /save auth-refactor
    /resume
    #   auth-refactor   2025-04-24 14:32   18 messages   [gpt-4o]
    #   bug-hunt        2025-04-23 09:15   31 messages   [claude-3-5-sonnet]
    
    /resume auth-refactor
    # โ–ถ๏ธ  Resumed session 'auth-refactor' (18 messages) โ€” welcome back!

    Sessions are stored per-project in ~/.bse-code/sessions/ โ€” isolated, no collisions.


    ๐Ÿ“Š Session Statistics

    /stats
      Session stats ๐Ÿ“Š
        โฑ  duration   : 00:23:41
        ๐Ÿ’ฌ turns      : 12
        ๐Ÿ”ง tool calls : 34
        ๐Ÿ“จ messages   : 47
        ๐Ÿค– model      : google/gemini-2.5-pro-exp-03-25:free
        ๐ŸŒ provider   : OpenRouter
        ๐ŸŽจ theme      : dracula
        ๐Ÿง  skills     : 3
        ๐Ÿ”Œ mcp tools  : 8

    ๐Ÿ—œ๏ธ Conversation Compaction

    Running low on context? Compact the conversation into a tight summary without losing the important bits.

    /compact
    /compact focus on the auth changes we made

    The AI summarizes, history is trimmed, you keep going โ€” same context, way fewer tokens. ๐ŸŽฏ


    ๐ŸŽจ Themes

    Theme Accent Vibe
    default ๐Ÿฉต Cyan Classic terminal
    dracula ๐Ÿ’œ Magenta/Purple Dark and moody
    monokai ๐Ÿ’› Yellow Warm and punchy
    ocean ๐Ÿ’™ Blue Cool and calm
    forest ๐Ÿ’š Green Fresh and focused
    light ๐Ÿฉต Dark on light For light terminals
    bse-code --theme dracula    # one session
    # or inside the REPL:
    /theme monokai              # persisted

    โš™๏ธ Configuration

    Config file: ~/.bse-code/config.json

    {
      "provider": "OpenRouter",
      "api_key": "sk-or-...",
      "model": "google/gemini-2.5-pro-exp-03-25:free",
      "base_url": "https://openrouter.ai/api/v1",
      "theme": "default"
    }

    ๐ŸŒ Environment variables (always override config)

    Variable Description
    BSE_PROVIDER Provider name (OpenRouter, OpenAI, Anthropic, Google, Ollama, LmStudio, LocalAiFoundry, Custom)
    BSE_API_KEY API key for the selected provider
    BSE_MODEL Model ID to use
    BSE_BASE_URL Override the API base URL

    ๐Ÿ”„ Legacy OPENROUTER_API_KEY, OPENROUTER_MODEL, OPENROUTER_BASE_URL still work as fallbacks.


    ๐Ÿ“ File Structure

    ~/.bse-code/
    โ”œโ”€โ”€ config.json          # โš™๏ธ  Provider, API key, model, base URL, theme
    โ”œโ”€โ”€ mcp.json             # ๐Ÿ”Œ MCP server definitions
    โ”œโ”€โ”€ BSE.md               # ๐ŸŒ Global memory
    โ”œโ”€โ”€ skills/
    โ”‚   โ””โ”€โ”€ *.md             # ๐Ÿง  User-level skills
    โ””โ”€โ”€ sessions/
        โ””โ”€โ”€ <project-hash>/  # ๐Ÿ’พ Saved conversations per project
    
    .bse-code/               # Project-level (commit to your repo)
    โ”œโ”€โ”€ BSE.md               # ๐Ÿ“ Project memory
    โ””โ”€โ”€ skills/
        โ””โ”€โ”€ *.md             # ๐Ÿง  Project-level skills
    
    ./BSE.md                 # ๐Ÿ“ Project memory (root level)
    ./BSE.local.md           # ๐Ÿ”’ Local overrides โ€” gitignore this

    ๐Ÿ“„ License

    MIT