cccc icon indicating copy to clipboard operation
cccc copied to clipboard

Feat/cli dev command

Open howold-lab opened this issue 8 months ago • 0 comments

  1. src/cccc/cli/dev_cmds.py (new)

Core implementation of cccc dev command. The cmd_dev() function:

  • Locates web/ directory — walks up from source file to find the web/ directory containing package.json
  • Pre-flight checks — verifies node_modules exists and npm is in PATH
  • Starts daemon — reuses existing logic; detects running daemon and reuses it, restarts on version mismatch
  • Starts uvicorn — runs API server on a background thread (:8848), serving /api/* routes
  • Starts Vite dev server — spawns npm run dev as subprocess (:5173) with HMR, proxying /api to :8848
  • Process lifecycle management — monitor threads detect daemon/vite crashes; Ctrl+C gracefully shuts down in order: vite → uvicorn → daemon
  1. src/cccc/cli/main.py (modified)
  • Added from .dev_cmds import * import
  • Registered dev subcommand with argparse, supports --port flag for custom Vite port
  1. src/cccc/cli/init.py (modified)
  • Added from .dev_cmds import * import
  • Added cccc.cli.dev_cmds to _PATCH_FORWARD_MODULES tuple for consistent attribute forwarding

howold-lab avatar Mar 11 '26 02:03 howold-lab