mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-17 13:13:35 +08:00
- Add Tauri sidecar architecture: Rust shell spawns claude-server binary, dynamic port allocation, health-check wait loop, graceful shutdown - Fix CORS middleware to accept `tauri://localhost` and `https://tauri.localhost` origins from Tauri WebView, and add CORS headers to /health endpoint - Enable native macOS window decorations (traffic lights) with Overlay title bar, add data-tauri-drag-region on sidebar for window dragging - Conditionally apply desktop-only padding (44px for traffic lights) vs web (12px) - Generate brand identity: light-background app icon, horizontal logo, full icon set (icns/ico/png) for Tauri bundle - Add brand mark + GitHub link in sidebar, replace mascot SVG with app icon in EmptySession page - Update README (zh/en) and docs hero image with new branding - Add sidecar build scripts and launcher entry points - Gitignore Rust target/, Tauri gen/, and brand-assets candidates Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
36 lines
1014 B
TypeScript
36 lines
1014 B
TypeScript
import path from 'node:path'
|
|
import { pathToFileURL } from 'node:url'
|
|
|
|
const { appRoot, args } = parseLauncherArgs()
|
|
|
|
process.env.CLAUDE_APP_ROOT = appRoot
|
|
process.env.CALLER_DIR ||= process.cwd()
|
|
process.argv = [process.argv[0]!, process.argv[1]!, ...args]
|
|
|
|
const preloadEntrypoint = pathToFileURL(path.join(appRoot, 'preload.ts')).href
|
|
const cliEntrypoint = pathToFileURL(path.join(appRoot, 'src/entrypoints/cli.tsx')).href
|
|
await import(preloadEntrypoint)
|
|
await import(cliEntrypoint)
|
|
|
|
function parseLauncherArgs() {
|
|
const rawArgs = process.argv.slice(2)
|
|
const nextArgs: string[] = []
|
|
let appRoot: string | null = process.env.CLAUDE_APP_ROOT ?? null
|
|
|
|
for (let index = 0; index < rawArgs.length; index++) {
|
|
const arg = rawArgs[index]
|
|
if (arg === '--app-root') {
|
|
appRoot = rawArgs[index + 1] ?? null
|
|
index += 1
|
|
continue
|
|
}
|
|
nextArgs.push(arg)
|
|
}
|
|
|
|
if (!appRoot) {
|
|
throw new Error('Missing --app-root for claude-cli sidecar')
|
|
}
|
|
|
|
return { appRoot, args: nextArgs }
|
|
}
|