Skip to content

Make SPA the default dashboard experience#47

Closed
WellDunDun wants to merge 1 commit intodevfrom
WellDunDun/spa-default-dash
Closed

Make SPA the default dashboard experience#47
WellDunDun wants to merge 1 commit intodevfrom
WellDunDun/spa-default-dash

Conversation

@WellDunDun
Copy link
Collaborator

Summary

selftune dashboard (bare) now starts the live server with the React SPA instead of building static HTML. The SPA uses the SQLite v2 API endpoints and is the default experience when you run the command.

  • Default behavior changed: selftune dashboard → starts live server with SPA at /
  • Legacy static export: Still available via --export or --out flags
  • Auto-build: If SPA dist isn't found but source exists, automatically builds it
  • Backwards compat: --serve flag still accepted (now a no-op)
  • Fallback: If auto-build fails, legacy HTML dashboard serves at / with clear warning

What still uses old dashboard code

  • /legacy/ endpoint, /api/data, /api/events, badge/report endpoints, and static export remain for compatibility

What remains before full migration

  1. Migrate badge/report endpoints to SQLite
  2. Add regression detection to SQLite materializer
  3. Move monitoring snapshot computation to SQLite
  4. Wire up action buttons in SPA UI
  5. Remove legacy JSONL scan paths

🤖 Generated with Claude Code

`selftune dashboard` (bare) now starts the live server with the React
SPA instead of building static HTML. --serve is still accepted for
backwards compat. Legacy static export remains via --export/--out.
Auto-builds SPA if dist not found but source exists.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Mar 14, 2026

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Dashboard now runs as a live React SPA backed by SQLite.
    • Automatic SPA builds when needed, with fallback to legacy dashboard.
  • Changes

    • Default behavior now starts a live dashboard server instead of exporting HTML.
    • --port flag supported for port configuration.
    • Legacy export modes (--export, --out) retained for backward compatibility.
  • Documentation

    • Help text updated to reflect live server behavior.

Walkthrough

The dashboard infrastructure migrates from a legacy Bun.serve setup to serve a React SPA backed by SQLite v2. Auto-build logic is introduced to construct the SPA dist when missing; fallback to legacy dashboard on build failure. Default CLI behavior shifts from file export to live server startup, with backwards-compatible port support.

Changes

Cohort / File(s) Summary
Dashboard Server Infrastructure
cli/selftune/dashboard-server.ts
Rewrites server to serve React SPA with SQLite v2 layer. Adds auto-build logic that attempts Bun build when dist is missing and source exists; falls back to legacy dashboard on build failure. Introduces v2 endpoints (overview, per-skill reports) alongside legacy endpoint compatibility. Improves logging for SPA discovery, build attempts, and fallback paths.
Dashboard CLI Command & Help
cli/selftune/dashboard.ts, cli/selftune/index.ts
Reframes dashboard command from file-based HTML export to live SPA server startup as default behavior. Removes home directory operations and temp file generation. Preserves --export and --out modes as legacy data-embedded flows. Maintains backwards-compatible --port option. Updates help text to reflect server-first semantics and legacy export modes. Retains internal data embedding logic without functional changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The pull request title does not follow the required conventional commits format (feat|fix|docs|chore|refactor|test|perf|ci). Reformat title to use conventional commits, e.g.: 'feat: make SPA the default dashboard experience' or 'refactor: make SPA the default dashboard experience'.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Description check ✅ Passed The description is well-structured and directly related to the changeset, covering default behavior changes, backwards compatibility, auto-build logic, and fallback mechanisms.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch WellDunDun/spa-default-dash
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@cli/selftune/dashboard.ts`:
- Around line 176-179: The console.error call that logs the invalid port (using
args and portIdx) must be formatted as a single-line statement to satisfy Biome;
update the multi-line template string invocation of console.error to a
single-line call (keep the same message content referencing args[portIdx + 1])
and ensure the subsequent process.exit(1) remains unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 2e564861-e56e-4f2e-a886-73cb726aa2c5

📥 Commits

Reviewing files that changed from the base of the PR and between aec5f4f and 9e75775.

📒 Files selected for processing (3)
  • cli/selftune/dashboard-server.ts
  • cli/selftune/dashboard.ts
  • cli/selftune/index.ts

Comment on lines +176 to +179
console.error(
`Invalid port "${args[portIdx + 1]}": must be an integer between 1 and 65535.`,
);
process.exit(1);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix formatting to pass CI.

Pipeline failure indicates Biome expects this console.error call on a single line.

🔧 Proposed fix
-      console.error(
-        `Invalid port "${args[portIdx + 1]}": must be an integer between 1 and 65535.`,
-      );
+      console.error(`Invalid port "${args[portIdx + 1]}": must be an integer between 1 and 65535.`);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
console.error(
`Invalid port "${args[portIdx + 1]}": must be an integer between 1 and 65535.`,
);
process.exit(1);
console.error(`Invalid port "${args[portIdx + 1]}": must be an integer between 1 and 65535.`);
process.exit(1);
🧰 Tools
🪛 GitHub Actions: CI

[error] 176-178: Biome formatter failed: expected formatting of console.error call. The formatter shows the preferred single-line template: console.error(Invalid port "${args[portIdx + 1]}": must be an integer between 1 and 65535.);

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cli/selftune/dashboard.ts` around lines 176 - 179, The console.error call
that logs the invalid port (using args and portIdx) must be formatted as a
single-line statement to satisfy Biome; update the multi-line template string
invocation of console.error to a single-line call (keep the same message content
referencing args[portIdx + 1]) and ensure the subsequent process.exit(1) remains
unchanged.

@WellDunDun
Copy link
Collaborator Author

stacked on PR#44

@WellDunDun WellDunDun closed this Mar 14, 2026
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.

1 participant