cccc
cccc copied to clipboard
Feat/cli dev command
- 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
- src/cccc/cli/main.py (modified)
- Added from .dev_cmds import * import
- Registered dev subcommand with argparse, supports --port flag for custom Vite port
- 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