Skip to content

refactor: split proxy.ts into 3-module SRP structure #275

Description

@dean0x

Problem

src/cli/commands/proxy.ts is 918 lines with multiple responsibilities: relay lifecycle management (spawn/wait/kill), CLI argument handling (enable/disable/status), configuration state management, and TUI integration.

Context

  • Surgical extractions already landed (CPLX-2/3/7): spawnRelayAndWaitForPort, resolveProcessState, formatProcessLine, readPidFile
  • Full SRP refactor requires splitting into 3-5 focused modules
  • Discretionary improvement; code is functional but violates single-responsibility principle
  • Ripples to init.ts and agents.ts importers

Proposed Structure

  1. proxy-relay.ts — Relay lifecycle (spawn, wait for health, kill, doctor)
  2. proxy-config.ts — Configuration state (read/write settings.json, apply routing)
  3. proxy-cli.ts — CLI commands (enable/disable/status actions)
  4. proxy.ts — Re-export main entry point

Acceptance Criteria

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    tech-debtTechnical debt items to address

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions