| name | val-town-cli |
| description | Manage Val Town projects using the vt CLI. Use when working with Vals (Val Town serverless functions), syncing code to Val Town, creating HTTP endpoints, streaming logs, or managing Val Town branches. Triggers on tasks involving Val Town development, val creation/editing, or when user mentions "vt", "val town", or "vals". |
Val Town CLI
The vt CLI manages Val Town projects locally. Key concepts:
- Val: A serverless function/project hosted on Val Town
- HTTP Val: A val that serves HTTP requests (filename must contain "http", e.g.,
index.http.tsx)
- Branch: Version control within a val (not git branches)
Quick Reference
| Task | Command |
|---|
| Create new val | vt create my-val |
| Clone existing | vt clone username/valName |
| Push changes | vt push |
| Pull updates | vt pull |
| Auto-sync | vt watch |
| View in browser | vt browse |
| Stream logs | vt tail |
| Check status | vt status |
| List your vals | vt list |
Common Workflows
Create and develop a new val
vt create my-api
cd my-api
vt push
vt browse
Clone and modify existing val
vt clone username/valName
cd valName
vt push
Live development with auto-sync
cd my-val
vt watch
Work on a feature branch
cd my-val
vt checkout -b my-feature
vt push
vt checkout main
File Naming Conventions
Val Town detects file types by naming patterns:
| Pattern | Val Type |
|---|
*.http.ts, *.http.tsx | HTTP endpoint |
*.cron.ts | Scheduled cron job |
*.email.ts | Email handler |
Other .ts/.tsx files | Script val |
Example: To create an HTTP API, name the file api.http.ts or index.http.tsx.
Command Details
Create
vt create my-val
vt create my-val ./existing-folder
vt create my-val --private
vt create my-val --org-name myorg
Clone
vt clone
vt clone username/valName
vt clone https://www.val.town/x/user/val
vt clone username/valName .
Remix
Fork someone else's val:
vt remix std/reactHonoStarter myWebsite
cd myWebsite
vt watch
Branches
vt branch
vt checkout main
vt checkout -b feature
vt branch -D feature
Logs
vt tail
vt tail @user/valName
vt tail --print-headers
vt tail --reverse-logs
Configuration
vt config options
vt config set dangerousOperations.confirmation false
vt config ignore
Project Structure
After cloning/creating, a val directory contains:
.vt/ - Metadata (like .git)
.vtignore - Files to exclude from sync
deno.json - Deno LSP configuration
- Source files (
.ts, .tsx, etc.)
Tips
- Use
vt push --dry-run to preview changes before pushing
- Use
vt checkout --dry-run to preview branch switch effects
- HTTP vals require "http" in the filename to be recognized as endpoints
- The
vt watch command enables live reloading with the browser companion extension