Skip to content

refactor: Lightweight CLI Path — read-only commands skip bootstrap (Phase 3) #90

@dean0x

Description

@dean0x

Epic: #87 — Architectural Simplification v0.6.0

Goal

Read-only CLI commands (beat task status, beat task logs, beat task list) should skip full bootstrap() entirely. Direct repository access is sufficient for queries — no event bus, no handlers, no worker pool, no recovery.

Sub-tasks

3a. Direct Database Reads for Query Commands

Change: Create a lightweight createReadOnlyContext() that opens SQLite and creates repositories — no event bus, no handlers, no worker pool, no recovery.

Files:

  • src/cli/read-only-context.tsNew file. Add createReadOnlyContext() function: opens Database, creates TaskRepository, ScheduleRepository, OutputCapture. Returns them directly.
  • src/cli/commands/ — Query commands (status, logs, list) use createReadOnlyContext(). Only run and delegate use full bootstrap().

3b. Skip Recovery for Short-Lived Commands

Change: Add skipRecovery option to bootstrap(). CLI run command sets this to false (it needs recovery). The MCP server always runs recovery.

File: src/bootstrap.ts — Add skipRecovery?: boolean to bootstrap options. Guard recovery execution.

Files Changed

Modified

  • src/bootstrap.tsskipRecovery option
  • src/cli/commands/ — query commands use read-only context

Added

  • src/cli/read-only-context.ts — lightweight context for read-only operations

Risk

Low — additive, no existing behavior changes. Query commands just take a faster path.

Verification

  • npm run build — clean compilation
  • npx biome check src/ tests/ — no lint issues
  • All test groups pass
  • beat task status <id> — fast response, no bootstrap overhead
  • beat task logs <id> — fast response, reads directly from SQLite
  • beat mcp start — full bootstrap still works as expected

Metadata

Metadata

Assignees

No one assigned

    Labels

    architectureArchitecture improvementenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions