Skip to content

feat(cli): add setup and dev commands for cross-platform frontend…#292

Open
digger-yu wants to merge 1 commit into
HKUDS:mainfrom
digger-yu:patch1
Open

feat(cli): add setup and dev commands for cross-platform frontend…#292
digger-yu wants to merge 1 commit into
HKUDS:mainfrom
digger-yu:patch1

Conversation

@digger-yu

@digger-yu digger-yu commented Jun 23, 2026

Copy link
Copy Markdown

… workflow

Summary

feat(cli): add setup and dev commands for cross-platform frontend…

Why

Add two new CLI subcommands to simplify the frontend build and dev workflow
across Windows, Linux, and macOS.

- `vibe-trading setup`: One-command frontend setup
  - Detects Node.js / npm availability
  - Runs `npm install` in frontend/
  - Uses platform-aware build commands:
    - Windows: `npm exec --package=typescript tsc -b` +
               `npm exec --package=vite vite build`
    - Linux/macOS: `npm run build`
  - Prints per-step progress and exits non-zero on failure

- `vibe-trading dev`: One-command development mode
  - Starts FastAPI backend (default port 8899) in background
  - Starts Vite dev server (port 5173) in background
  - Prints both service URLs
  - Handles Ctrl+C graceful shutdown of both processes
  - Supports `--port` override

____
The behavior of npx on Windows differs from that on Linux/macOS. When you directly run npx tsc, if the tsc command cannot be found locally, it will search the npm registry for a package named tsc, rather than the tsc binary file in the typescript package. Coincidentally, there is an abandoned package named tsc on the npm registry that dates back 10 years, so npx downloaded that useless package

Files changed:

  • agent/cli/_legacy.py: cmd_setup(), cmd_dev(), _which(), _run_step()
  • agent/cli/main.py: typer wrapper commands

All 40 existing CLI tests pass.

Changes

    modified:   agent/cli/_legacy.py
    modified:   agent/cli/main.py

Test Plan

  • Existing tests pass (pytest --ignore=agent/tests/e2e_backtest --tb=short -q)
  • New tests added (if applicable)
  • Tested manually (describe below)

Checklist

  • No changes to protected areas (src/agent/, src/session/, src/providers/) without prior discussion
  • No hardcoded values (API keys, file paths, magic numbers)
  • Code follows CONTRIBUTING.md guidelines
  • Documentation updated (if user-facing change)

… workflow

Signed-off-by: digger yu <digger-yu@outlook.com>
@warren618

Copy link
Copy Markdown
Collaborator

Thanks @digger-yu — the cross-platform setup/dev workflow is genuinely useful, and the Windows npx tsc footgun (npm pulling that abandoned 10-year-old tsc package instead of the local binary) is a real one worth fixing. Before this can land, though, the diff has a few issues:

1. 🔴 Blocker — the branch is reverting a critical fix. The diff deletes the Robinhood OAuth handling in cmd_live_authorize_authorize_timeout_seconds(), the tool_timeout raise, and max_list_tools_attempts=1. Those landed in a530ced (#281) to fix #259, and the max_list_tools_attempts=1 part specifically prevents a transient retry from spawning a second OAuth callback server and orphaning the user's sign-in. Your branch is based before #281, so the diff against current main removes it. Please rebase onto latest main so the PR only adds the new commands and leaves cmd_live_authorize untouched.

2. 🔴 dev backend won't start. cmd_dev launches the backend with cwd=AGENT_DIR.parent (repo root) running python -m cli._legacy serve — but the cli package lives under agent/ (AGENT_DIR), so from the repo root that's a ModuleNotFoundError. Run it from AGENT_DIR (or invoke the installed vibe-trading serve entry point).

3. 🟡 dev prints the wrong frontend URL. It hardcodes http://localhost:5173, but frontend/vite.config.ts sets port: 5899, so the printed link won't open. Read the port from the vite config / env, or at least use 5899.

4. 🟡 No tests for cmd_setup / cmd_dev. A couple covering the Node/npm-missing paths and the platform-aware build-command selection would be good given this is a new user-facing entry point.

Fix 1–3 (1 is the must) and I'll re-review. Thanks for tackling the cross-platform gap! 🙏

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.

2 participants