feat: remove old vanilla JS/CSS frontend, make React SPA the sole entry for ccw view

Remove the entire old template-based frontend (~106K lines) and make the React
SPA the only way to access the ccw dashboard via `ccw view`.

Key changes:
- Delete all old frontend files: dashboard-css/ (37 CSS), dashboard-js/ (59 JS),
  assets/, dashboard.html, and legacy HTML templates
- Delete dashboard-generator.ts and dashboard-generator-patch.ts
- Simplify server.ts: remove ~234 lines of old frontend code (template constants,
  MODULE_CSS_FILES/MODULE_FILES arrays, generateServerDashboard(), /assets/* serving)
- Rebase React frontend from /react/ to root / (vite.config.ts, react-frontend.ts)
- Add /react/* -> /* 301 redirect for backward compatibility
- Remove --frontend and --new CLI flags from view and serve commands
- Remove generateDashboard export from public API (index.ts)
- Simplify serve.ts and view.ts to always use React without conditional branching
- Update all affected tests (unit, e2e) for React-only architecture

BREAKING CHANGE: --frontend and --new CLI flags removed; generateDashboard export
removed from ccw package; /react/ base path changed to /
This commit is contained in:
catlog22
2026-02-13 17:26:03 +08:00
parent 31f37751fc
commit bcb736709f
136 changed files with 204 additions and 115952 deletions

View File

@@ -9,8 +9,6 @@ interface ViewOptions {
path?: string;
host?: string;
browser?: boolean;
frontend?: 'js' | 'react' | 'both';
new?: boolean;
}
interface SwitchWorkspaceResult {
@@ -77,8 +75,6 @@ export async function viewCommand(options: ViewOptions): Promise<void> {
const port = Number(options.port) || 3456;
const host = options.host || '127.0.0.1';
const browserHost = host === '0.0.0.0' || host === '::' ? 'localhost' : host;
// --new flag is shorthand for --frontend react
const frontend = options.new ? 'react' : (options.frontend || 'js');
// Resolve workspace path
let workspacePath = process.cwd();
@@ -105,12 +101,7 @@ export async function viewCommand(options: ViewOptions): Promise<void> {
if (result.success) {
console.log(chalk.green(` Workspace switched successfully`));
// Determine URL based on frontend type
let urlPath = '';
if (frontend === 'react') {
urlPath = '/react';
}
const url = `http://${browserHost}:${port}${urlPath}/?path=${encodeURIComponent(workspacePath)}`;
const url = `http://${browserHost}:${port}/?path=${encodeURIComponent(workspacePath)}`;
if (options.browser !== false) {
console.log(chalk.cyan(' Opening in browser...'));
@@ -135,8 +126,7 @@ export async function viewCommand(options: ViewOptions): Promise<void> {
path: workspacePath,
port: port,
host,
browser: options.browser,
frontend: frontend
browser: options.browser
});
}
}