{"id":50998830,"url":"https://github.com/thedavidweng/strudel-tui","last_synced_at":"2026-06-20T12:03:31.859Z","repository":{"id":363012896,"uuid":"1261637562","full_name":"thedavidweng/strudel-tui","owner":"thedavidweng","description":"Terminal-based live coding interface for Strudel with AI agent","archived":false,"fork":false,"pushed_at":"2026-06-15T07:20:22.000Z","size":209,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-15T09:10:08.537Z","etag":null,"topics":["ai-agent","bun","live-coding","music","strudel","terminal","tidal-cycles","tui"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thedavidweng.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-06-07T00:42:35.000Z","updated_at":"2026-06-15T07:20:26.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/thedavidweng/strudel-tui","commit_stats":null,"previous_names":["thedavidweng/strudel-tui"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/thedavidweng/strudel-tui","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thedavidweng%2Fstrudel-tui","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thedavidweng%2Fstrudel-tui/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thedavidweng%2Fstrudel-tui/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thedavidweng%2Fstrudel-tui/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thedavidweng","download_url":"https://codeload.github.com/thedavidweng/strudel-tui/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thedavidweng%2Fstrudel-tui/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34568743,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-20T02:00:06.407Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-agent","bun","live-coding","music","strudel","terminal","tidal-cycles","tui"],"created_at":"2026-06-20T12:03:31.087Z","updated_at":"2026-06-20T12:03:31.850Z","avatar_url":"https://github.com/thedavidweng.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ch1 align=\"center\"\u003estrudel-tui\u003c/h1\u003e\n  \u003cp align=\"center\"\u003e\n    Terminal-based live coding interface for \u003ca href=\"https://strudel.cc\"\u003eStrudel\u003c/a\u003e with AI agent\n  \u003c/p\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/thedavidweng/strudel-tui/blob/main/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/badge/license-MIT-blue.svg\" alt=\"License\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/thedavidweng/strudel-tui/releases\"\u003e\u003cimg src=\"https://img.shields.io/github/v/release/thedavidweng/strudel-tui\" alt=\"Release\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/thedavidweng/strudel-tui/actions\"\u003e\u003cimg src=\"https://img.shields.io/github/actions/workflow/status/thedavidweng/strudel-tui/ci.yml?branch=main\" alt=\"CI\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://bun.sh\"\u003e\u003cimg src=\"https://img.shields.io/badge/bun-%3E%3D1.3.12-f9f1e1?logo=bun\" alt=\"Bun\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://strudel.cc\"\u003e\u003cimg src=\"https://img.shields.io/badge/strudel-powered-ff69b4\" alt=\"Strudel\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n**strudel-tui** is a lightweight, single-binary terminal application for live coding music with [Strudel](https://strudel.cc) — the JavaScript port of the Tidal Cycles pattern language. Chat with an AI agent, edit patterns, and play them back, all from your terminal.\n\n## Features\n\n- **Interactive TUI** — Terminal UI built with [pi-tui](https://github.com/earendil-works/pi) with message history, pattern editor, and status bar\n- **IME Support** — Full input method editor support for CJK and other complex scripts\n- **AI Agent** — Chat naturally to create and edit patterns. Supports any OpenAI-compatible API (OpenAI, DeepSeek, Qwen, Moonshot, OpenRouter, etc.)\n- **Audio Playback** — Patterns play through a hidden WebView using Strudel's WebAudio engine. No Electron, no bundled browser\n- **Pattern Engine** — Validates, transpiles, and analyzes patterns using `@strudel/core` and `@strudel/transpiler`\n- **Single Binary** — Compiles to a standalone executable with `bun build --compile`\n- **Cross-Platform** — macOS (arm64/x64), Linux (arm64/x64), Windows (x64)\n\n## Getting Started\n\n### Prerequisites\n\n- [Bun](https://bun.sh) v1.3.12 or later\n\n### Install\n\n**Homebrew (macOS):**\n\n```bash\nbrew tap thedavidweng/tap\nbrew install --cask strudel-tui\n```\n\n**From source:**\n\n```bash\ngit clone https://github.com/thedavidweng/strudel-tui.git\ncd strudel-tui\nbun install\n```\n\n### Run\n\n```bash\nbun run src/index.ts\n```\n\n### Configure AI Agent (Optional)\n\n```bash\n# Interactive wizard — select provider and enter API key\nbun run src/index.ts config init\n\n# Or set directly\nbun run src/index.ts config set apiKey sk-...\nbun run src/index.ts config set baseUrl https://api.deepseek.com/v1\nbun run src/index.ts config set model deepseek-chat\n```\n\nSupported providers: OpenAI, DeepSeek, Moonshot (Kimi), Zhipu (GLM), Qwen (Tongyi), OpenRouter, or any OpenAI-compatible endpoint.\n\nYou can also use environment variables or CLI flags:\n\n```bash\n# Environment variables\nOPENAI_API_KEY=sk-... bun run src/index.ts\n\n# CLI flags\nbun run src/index.ts --api-key sk-... --base-url https://api.deepseek.com/v1 --model deepseek-chat\n```\n\n### Build Binary\n\n```bash\nbun run build\n# Output: bin/strudel-tui\n\n# Run the binary\n./bin/strudel-tui --help\n```\n\n## Usage\n\n### TUI Interface\n\nThe terminal UI uses a sidebar layout:\n\n```\n┌──────────────────────────────┬──────────────────┐\n│ STOPPED | BPM: 130 | shortcuts                  │  ← Status bar\n├──────────────────────────────┼──────────────────┤\n│                              │ \u003e make a chill   │\n│  1 | s(\"bd sn\").lpf(800)    │ # generate...    │\n│                              │ \u003c note(\"c d e f\")│\n│ Pattern Editor               │                  │\n│                              │ Message          │\n│                              │ History          │\n│ \u003e _                          │                  │\n│ Input                        │                  │\n└──────────────────────────────┴──────────────────┘\n```\n\n### Commands\n\nType these in the input box:\n\n| Command | Description |\n|---------|-------------|\n| `play` / `start` / `go` | Start audio playback of the current pattern |\n| `stop` / `pause` / `hush` | Stop all playing patterns |\n| `make \u003cdescription\u003e` | Generate a pattern from a text description |\n| `edit \u003cinstruction\u003e` | Modify the current pattern (e.g. `edit make it slower`) |\n| `validate` / `check` | Validate the current pattern for syntax errors |\n| `undo` | Revert to the previous pattern |\n| `redo` | Re-apply the last undone pattern change |\n| `help` | Show available commands and shortcuts |\n\nWith AI agent enabled, you can chat naturally:\n\n```\n\u003e make a jazzy drum loop at 120 bpm\n\u003e add some reverb to that\n\u003e make it half time\n\u003e play it\n```\n\n### Keyboard Shortcuts\n\n| Keys | Description |\n|------|-------------|\n| `Ctrl+P` | Toggle play/stop |\n| `Ctrl+S` | Save current pattern to file |\n| `Ctrl+L` | Clear message history |\n| `Ctrl+C` | Quit |\n| `Up/Down` | Scroll through input history |\n\n### CLI Options\n\n```\nstrudel-tui [OPTIONS] [COMMAND]\n\nOPTIONS\n  -p, --pattern=\u003cfile\u003e    Load a .strudel pattern file on startup\n  --bpm=\u003cnumber\u003e          Set initial BPM (default: 130)\n  --debug                 Enable debug logging\n  --api-key=\u003ckey\u003e         OpenAI-compatible API key (overrides config)\n  --base-url=\u003curl\u003e        API base URL (overrides config)\n  --model=\u003cname\u003e          Model name (overrides config)\n\nCOMMANDS\n  config                  Manage configuration\n    config init           Interactive setup wizard\n    config set \u003ck\u003e \u003cv\u003e    Set a config value (apiKey, baseUrl, model, temperature, maxTokens)\n    config show           Show current configuration\n```\n\n### Edit Instructions\n\nWhen using keyword mode (no AI agent), these edit instructions are supported:\n\n| Instruction | Effect |\n|-------------|--------|\n| `faster` / `speed up` | `.fast(2)` |\n| `slower` / `slow down` | `.slow(2)` |\n| `louder` | `.gain(1.5)` |\n| `quieter` / `softer` | `.gain(0.5)` |\n| `reverse` / `backwards` | `.rev()` |\n| `reverb` | `.room(0.5)` |\n| `delay` | `.delay(0.5)` |\n| `distort` | `.distort(0.5)` |\n| `filter` / `low pass` | `.lpf(800)` |\n| `high pass` | `.hpf(800)` |\n| `remove last` | Remove the last transform |\n\n## Example Patterns\n\nThe `patterns/` directory contains sample `.strudel` files:\n\n| Pattern | Description |\n|---------|-------------|\n| `techno130` | Four-on-the-floor kick and hi-hat at 130 BPM |\n| `basic-beat` | Simple 4/4 kick and snare |\n| `ambient` | Slow ambient pad |\n| `breakbeat` | Breakbeat rhythm |\n| `melody` | Simple melodic pattern |\n| `acid` | Acid bassline |\n\nLoad a pattern on startup:\n\n```bash\nbun run src/index.ts --pattern patterns/acid.strudel\n```\n\n## Architecture\n\n```\nsrc/\n├── index.ts                  # CLI entry point (citty)\n├── config/\n│   └── ConfigManager.ts      # ~/.strudel-tui/config.json\n├── llm/\n│   ├── OpenAIClient.ts       # OpenAI-compatible streaming client\n│   └── tools.ts              # Tool definitions for function calling\n├── agent/\n│   ├── Agent.ts              # AI agent with LLM + keyword fallback\n│   ├── DiffGenerator.ts      # Pattern diff generation\n│   ├── SessionHistory.ts     # Conversation and pattern history\n│   └── HelpText.ts           # Help text constants\n├── engine/\n│   ├── StrudelEngineWrapper.ts  # Pattern validation, analysis, generation\n│   └── PatternLoader.ts      # Load/save .strudel files\n├── audio/\n│   └── AudioController.ts    # Bun.WebView audio playback\n└── tui/\n    ├── App.tsx               # Main TUI layout (pi-tui component tree)\n    ├── ConfigWizard.tsx       # Interactive config setup\n    ├── StatusBar.tsx          # Playback state, BPM, shortcuts\n    ├── MessageHistory.tsx     # Chat and system messages\n    ├── PatternEditor.tsx      # Current pattern display\n    ├── InputBox.tsx           # User input with IME support\n    ├── SlashCommandMenu.tsx   # Slash command autocomplete\n    └── MoonSpinner.tsx        # Loading spinner animation\n```\n\nTUI components use [pi-tui](https://github.com/earendil-works/pi)'s imperative component model — each component implements `render(width): string[]` to produce terminal output. No React/JSX; components are plain classes that compose via parent-child relationships.\n\n## Development\n\n```bash\n# Run in development mode\nbun run dev\n\n# Run tests\nbun test\n\n# Build binary\nbun run build\n\n# Run goreleaser (requires goreleaser CLI)\nmake release\n```\n\n## Acknowledgments\n\n- **[pi-tui](https://github.com/earendil-works/pi)** — The terminal UI framework powering strudel-tui, by Mario Zechner (badlogic), Armin Ronacher (mitsuhiko), and contributors. MIT License.\n- **[Kimi Code](https://github.com/MoonshotAI/kimi-code)** (PI Agent) — By Moonshot AI. The TUI architecture, component patterns, and input handling design are heavily referenced from Kimi Code. MIT License.\n- **[Strudel](https://strudel.cc)** — The live coding music framework that strudel-tui is built on.\n- **[Tidal Cycles](https://tidalcycles.org)** — The pattern language that inspired Strudel.\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthedavidweng%2Fstrudel-tui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthedavidweng%2Fstrudel-tui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthedavidweng%2Fstrudel-tui/lists"}