TaskJunkyDocs

Configuration

Project-level and global configuration for Switchyard.

Project config (.switchyard.json)

Create a per-project config file in any directory:

sy init
# or with overrides:
sy init --label myapp --port 3001 --command "pnpm dev"

Schema

.switchyard.json
{
  "label": "myapp",
  "port": 3001,
  "command": "pnpm run dev",
  "env": {
    "NODE_ENV": "development",
    "DEBUG": "true"
  }
}
FieldTypeDescription
labelstringProcess label (defaults to package.json name)
portnumberPreferred port (auto-resolves conflicts)
commandstringDev command (defaults to detected dev script)
envobjectEnvironment variables merged into the process

When you run sy run in a directory with .switchyard.json, these settings are used automatically.


Global config (~/.switchyard/config.json)

Global preferences that apply to all Switchyard operations:

sy config list          # show all with defaults
sy config set colorMode none
sy config get refreshInterval
KeyTypeDefaultDescription
portRangeStartnumber3000Start of port scan range
portRangeEndnumber9999End of port scan range
refreshIntervalnumber2000Watch mode refresh interval (ms)
colorModestringautoColor output: auto, dark, light, none
defaultDetachbooleanfalseDefault sy run to background mode
logRetentionDaysnumber7Days to retain log files

Monorepo detection

Switchyard automatically detects monorepos and reads their structure. No config needed — it reads everything from package.json.

What gets detected

SourceWhat
packageManager fieldpnpm, yarn, npm, or bun (no lock file guessing)
dependencies / devDependenciesFramework: Next.js, Vite, Nuxt, Remix, Astro, Gatsby, Express, etc.
pnpm-workspace.yaml or workspacesAvailable workspace apps
Script content (--port, PORT=)Default ports per app
Compound scripts (dev:web, api:dev)Workspace-specific run targets
turbo.json, nx.json, lerna.jsonOrchestrator detection

Running workspace apps

# Run by workspace name — checks compound scripts first, then filter
sy run web              # → pnpm run dev:web (if dev:web script exists)
sy run docs             # → pnpm run dev:docs

# From inside an app directory
cd apps/web && sy run   # → pnpm --filter web run dev

# At root with no target — shows all options
sy run
#   Monorepo detected — specify which app to run:
#     sy run <name>
#   Available:
#     Scripts:
#       web → pnpm run dev:web
#       docs → pnpm run dev:docs
#     Workspaces:
#       web (apps/web) → next
#       docs (apps/docs) → next

# See everything Switchyard knows
sy info

Per-workspace ports

Ports are auto-detected from script content. If apps/web/package.json has "dev": "next dev --port 3000", Switchyard uses 3000. Otherwise it falls back to framework defaults (Next.js → 3000, Vite → 5173, Astro → 4321).


Data directory

All Switchyard state lives in ~/.switchyard/:

~/.switchyard/
├── registry.json    # Registered processes (PID, label, port, command)
├── ports.json       # Port reservations
├── groups.json      # Process groups
├── config.json      # Global config
└── logs/            # Process logs (detached mode)
    └── <label>.log

The menubar app reads these same files — CLI and app stay in sync automatically.


Claude Code integration

Switchyard can auto-register dev servers launched via Claude Code hooks. Run sy hook to get the config:

Claude Code settings.json
{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Bash",
        "command": "sh -c 'sleep 2 && sy register \"$(basename \"$(pwd)\")\" 2>/dev/null || true'"
      }
    ]
  }
}

This fires after every Bash tool use and auto-labels any new dev server with the project directory name.

On this page