Skip to content

feat(dev-cli): add Bun-based local development CLI#1142

Draft
evanjacobson wants to merge 11 commits intomainfrom
improvement/kiloclaw-dev-cli
Draft

feat(dev-cli): add Bun-based local development CLI#1142
evanjacobson wants to merge 11 commits intomainfrom
improvement/kiloclaw-dev-cli

Conversation

@evanjacobson
Copy link
Contributor

Summary

  • Adds @kilocode/dev-cli — a Bun-based CLI at dev/cli/ that replaces scattered shell scripts with a composable tool for managing the repo's 20+ services
  • Understands service dependencies and selectively starts only what's needed
  • Includes project-specific commands that port the existing bash scripts (kiloclaw, code-review, auto-fix, app-builder)

Generic commands

pnpm kilo up [services...]      # Dependency-aware service startup
pnpm kilo down                  # Stop Docker infra
pnpm kilo status                # Health check everything
pnpm kilo env check             # Validate all env vars
pnpm kilo tunnel                # Cloudflared tunnel management
pnpm kilo logs                  # List/tail service logs

Project-specific commands

pnpm kilo kiloclaw setup        # Fly token, secrets, Vercel env sync
pnpm kilo kiloclaw push-dev     # Build + push controller Docker image
pnpm kilo code-review up        # 4-service orchestrator with colored logs
pnpm kilo code-review test-webhook  # HMAC-signed test webhook
pnpm kilo auto-fix up           # 4-service orchestrator
pnpm kilo auto-fix test-webhook # Test webhook
pnpm kilo app-builder up        # 9-service tmux session

Architecture

  • Service registry with 22 services (ports, dependencies, env files)
  • Topological dependency resolver with cycle detection
  • Process manager with colored log prefixing and graceful SIGINT/SIGKILL cleanup
  • Env validation against .dev.vars.example templates

Test plan

  • 15/15 unit tests pass (registry, resolver, env parsing)
  • pnpm kilo --help lists all commands, projects, and 22 services
  • pnpm kilo status shows Docker health + port checks
  • pnpm kilo env check validates env vars across all services
  • pnpm kilo logs lists all services with descriptions
  • pnpm kilo kiloclaw badcommand shows error + project help (not silent fallthrough)
  • Code reviewed by 4 parallel agents — all bugs found were fixed
  • Manual test: pnpm kilo up (starts Next.js + infra)
  • Manual test: pnpm kilo kiloclaw setup (needs Vercel/Fly auth)
  • Manual test: pnpm kilo app-builder up (needs tmux/ngrok)

…asks 4-16)

Implements the full dev CLI: process spawning with color-prefixed output,
UI helpers, docker/tunnel/migration infra, env validation, and all commands
(up, down, status, env, tunnel, logs) with a main entry point.
Ports preflight logic from kiloclaw/scripts/dev-start.sh and push logic
from kiloclaw/scripts/push-dev.sh into TypeScript project commands.
Also adds stub project definitions for code-review, auto-fix, and
app-builder which are referenced by the projects index.
Port cloudflare-app-builder/start-dev.sh to TypeScript as a ProjectDef with an `up` command that creates a 9-pane tmux session for all app-builder services.
Route `pnpm kilo <project> <command>` to project-specific handlers.
Projects: kiloclaw, code-review, auto-fix, app-builder.
- Fix router: unknown project subcommand now shows error instead of
  silently falling through to generic `up` command
- Fix kiloclaw push-dev: check .dev.vars exists before reading
- Fix app-builder: quote dir path in tmux send-keys for spaces
- Fix kiloclaw: rename kilocawDir → kiloclawDir typo
- Fix setDevVar: avoid double newline on append
}

const servicesWithEnv = services.filter(s => s.envFile);
let allGood = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Final success banner can be wrong

allGood is only flipped by the per-service loop below. If .env.local is missing or .vercel/project.json is absent, this function still reaches All environment checks passed!, which gives a false green result after already printing an error or warning.

return;
}

if (svc.type === 'infra') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: logs migrations always targets a nonexistent Compose service

migrations is registered as an infra service, but it runs pnpm drizzle migrate rather than a docker compose service. This branch will execute docker compose ... logs -f migrations, so pnpm kilo logs migrations fails immediately instead of showing anything useful.


const portServices = services.filter(s => s.port && s.type !== 'infra');
for (const svc of portServices) {
const listening = await isPortListening(svc.port!);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Port-only checks misreport services that share a port

This status view assumes one service per port, but the new registry assigns 8792 to both auto-fix and db-proxy, and 8795 to both kiloclaw and git-token. If either process is running, this loop marks the sibling service as running too, so pnpm kilo status produces false positives.

const skipRoot = args.includes('--no-root');

const logDir = join(root, 'dev', '.dev-logs', 'review');
await Bun.write(join(logDir, '.gitkeep'), '');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Startup can fail on a fresh checkout

This repository does not include dev/.dev-logs/review/, and Bun.write() does not create missing parent directories. On a clean checkout, pnpm kilo code-review up will throw here before any services start.

const skipRoot = args.includes('--no-root');

const logDir = join(root, 'dev', '.dev-logs', 'auto-fix');
await Bun.write(join(logDir, '.gitkeep'), '');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Startup can fail on a fresh checkout

This repository does not include dev/.dev-logs/auto-fix/, and Bun.write() does not create missing parent directories. On a clean checkout, pnpm kilo auto-fix up will throw here before any services start.

@kilo-code-bot
Copy link
Contributor

kilo-code-bot bot commented Mar 16, 2026

Code Review Summary

Status: 5 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 5
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
dev/cli/src/commands/env.ts 26 Final success banner can report a pass even after earlier env setup errors/warnings.
dev/cli/src/commands/logs.ts 21 logs migrations always calls docker compose logs for a service that does not exist.
dev/cli/src/commands/status.ts 20 Port-only status checks produce false positives for services that share a port.
dev/cli/src/projects/code-review.ts 51 Creating the review log file fails on a fresh checkout because the parent directory is missing.
dev/cli/src/projects/auto-fix.ts 53 Creating the auto-fix log file fails on a fresh checkout because the parent directory is missing.

Fix these issues in Kilo Cloud

Other Observations (not in diff)

None.

Files Reviewed (31 files)
  • dev/cli/src/commands/env.ts - 1 issue
  • dev/cli/src/commands/logs.ts - 1 issue
  • dev/cli/src/commands/status.ts - 1 issue
  • dev/cli/src/projects/code-review.ts - 1 issue
  • dev/cli/src/projects/auto-fix.ts - 1 issue
  • DEVELOPMENT.md, dev/cli/bun.lock, dev/cli/package.json, dev/cli/src/commands/down.ts, dev/cli/src/commands/tunnel.ts, dev/cli/src/commands/up.ts, dev/cli/src/index.ts, dev/cli/src/infra/docker.ts, dev/cli/src/infra/migrations.ts, dev/cli/src/infra/tunnel.ts, dev/cli/src/projects/app-builder.ts, dev/cli/src/projects/index.ts, dev/cli/src/projects/kiloclaw.ts, dev/cli/src/projects/types.ts, dev/cli/src/services/registry.ts, dev/cli/src/services/resolver.ts, dev/cli/src/utils/env.ts, dev/cli/src/utils/process.ts, dev/cli/src/utils/ui.ts, dev/cli/test/env.test.ts, dev/cli/test/registry.test.ts, dev/cli/test/resolver.test.ts, dev/cli/tsconfig.json, package.json, pnpm-lock.yaml, pnpm-workspace.yaml - no issues

Reviewed by gpt-5.4-20260305 · 826,008 tokens

@evanjacobson evanjacobson marked this pull request as draft March 16, 2026 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant