From 3662d77b74506274f9c4087ff09b49f3a7353f6a Mon Sep 17 00:00:00 2001 From: AmElmo Date: Wed, 25 Feb 2026 15:24:30 +0700 Subject: [PATCH 1/2] fix: resolve ESM-incompatible require() in constants and add standalone server entry - Replace `require()` with `fs.readFileSync` + `JSON.parse` in `getSpecWrightDir()` so package.json detection works under tsx/ESM - Add `import.meta.url` guard to web-server.ts so `tsx src/web-server.ts` actually starts the server --- src/config/constants.ts | 5 +++-- src/web-server.ts | 8 ++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/config/constants.ts b/src/config/constants.ts index 2d906b7..d7b3bb3 100644 --- a/src/config/constants.ts +++ b/src/config/constants.ts @@ -1,6 +1,7 @@ import { fileURLToPath } from 'url'; import { dirname } from 'path'; import path from 'path'; +import fs from 'fs'; // Get current directory (equivalent to SQUAD_DIR in bash) export const __filename = fileURLToPath(import.meta.url); @@ -14,7 +15,7 @@ export const getSpecWrightDir = (targetDir: string = process.cwd()): string => { // Check if we're in the specwright package itself or a target project const packagePath = path.join(targetDir, 'package.json'); try { - const pkg = require(packagePath); + const pkg = JSON.parse(fs.readFileSync(packagePath, 'utf-8')); if (pkg.name === 'specwright') { // We're in the specwright package itself (development mode) return targetDir; @@ -22,7 +23,7 @@ export const getSpecWrightDir = (targetDir: string = process.cwd()): string => { } catch { // No package.json or not specwright } - + // Target project - use specwright/ subfolder return path.join(targetDir, 'specwright'); }; diff --git a/src/web-server.ts b/src/web-server.ts index a0358b9..b49e1bb 100644 --- a/src/web-server.ts +++ b/src/web-server.ts @@ -3994,3 +3994,11 @@ ${suggestion || 'Implement this change directly in your code editor.'} return { server, wss, watcher }; } + +// Auto-start when run directly (e.g. `tsx src/web-server.ts`) +if (import.meta.url === `file://${process.argv[1]}`) { + startWebServer().catch((err) => { + console.error('Failed to start web server:', err); + process.exit(1); + }); +} From 3d0f86529c65afb0cce5104be048ef1b4a1fe16d Mon Sep 17 00:00:00 2001 From: AmElmo Date: Wed, 25 Feb 2026 15:45:48 +0700 Subject: [PATCH 2/2] fix(ui): replace placeholder Codex logo with official OpenAI icon The Codex CLI logo was a generic placeholder SVG. Replace it with the actual OpenAI icon from Simple Icons, since Codex CLI is an OpenAI product. --- src/web-ui/src/components/AIToolLogos.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/web-ui/src/components/AIToolLogos.tsx b/src/web-ui/src/components/AIToolLogos.tsx index a74fc31..32554b7 100644 --- a/src/web-ui/src/components/AIToolLogos.tsx +++ b/src/web-ui/src/components/AIToolLogos.tsx @@ -71,15 +71,13 @@ export const CodexLogo = ({ size = 40, className }: LogoProps) => ( width={size} height={size} viewBox="0 0 24 24" - fill="none" + fill="currentColor" xmlns="http://www.w3.org/2000/svg" className={className} role="img" > Codex - - - + );