feat: wire up web dashboard via libscope serve --dashboard#265
Conversation
Add --dashboard flag to the serve command that starts the web UI server from src/web/server.ts (default port 3377). The dashboard serves: - GET / → HTML dashboard with document stats, topics, recent activity - GET /graph → Knowledge graph visualization Port and host are configurable via --port and --host flags. Updated CLI reference docs. Closes #259 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Wires the existing web dashboard HTTP server into the libscope serve CLI entrypoint by adding a new --dashboard mode and documenting the updated serve command behavior.
Changes:
- Add
--dashboardflag tolibscope serveto start the web dashboard server (default port 3377). - Adjust
--porthandling so it’s optional and defaults by mode (API: 3378, dashboard: 3377). - Update CLI reference docs to include the new flag, options, and examples.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/cli/index.ts | Adds --dashboard serve mode and updates port defaulting logic per mode. |
| docs/reference/cli.md | Documents serve --dashboard, including options and examples. |
| Start the MCP server, REST API, or web dashboard. | ||
|
|
||
| ```bash | ||
| libscope serve # MCP server (stdio) | ||
| libscope serve --api # REST API | ||
| libscope serve --api --port 3378 | ||
| libscope serve # MCP server (stdio) | ||
| libscope serve --api # REST API (port 3378) | ||
| libscope serve --dashboard # Web dashboard UI (port 3377) | ||
| libscope serve --dashboard --port 8080 | ||
| ``` | ||
|
|
||
| | Option | Description | | ||
| |--------|-------------| | ||
| | `--api` | Start REST API instead of MCP server | | ||
| | `--port <n>` | REST API port (default: 3378) | | ||
| | `--dashboard` | Start the web dashboard UI | | ||
| | `--port <n>` | Server port (default: 3378 for API, 3377 for dashboard) | | ||
| | `--host <h>` | Server host (default: localhost) | |
There was a problem hiding this comment.
The CLI docs now describe --dashboard, but the README still documents only libscope serve --api under the “REST API” section. If this PR closes #259, consider updating README.md as well so users discover the dashboard entrypoint consistently.
| .action(async (opts: { api?: boolean; dashboard?: boolean; port?: string; host: string }) => { | ||
| if (opts.dashboard) { | ||
| const { db, provider } = initializeAppWithEmbedding(); | ||
| const { startWebServer } = await import("../web/server.js"); | ||
| const defaultPort = 3377; |
There was a problem hiding this comment.
--api and --dashboard can both be provided, but the current branching silently prioritizes --dashboard. This makes the CLI behavior ambiguous; consider explicitly rejecting the combination (print an error and exit non-zero) or wiring it to start both servers if that’s intended.
Summary
Wire up the existing web dashboard server (
src/web/server.ts) to the CLI so users can start it withlibscope serve --dashboard.Changes
src/cli/index.ts: Add--dashboardflag toservecommand that starts the web UI server (port 3377 default)docs/reference/cli.md: Updated serve command docs with new flag, all options, and examplesUsage
The dashboard serves:
GET /→ HTML dashboard with document stats, topics, recent activityGET /graph→ Interactive knowledge graph visualizationGET /api/*→ Dashboard API endpoints (search, documents, stats)Closes #259