Add 'aiui/' from commit 'e30ac1d1069532fb6d652d87e2d4a2fe9d1b4773'
git-subtree-dir: aiui git-subtree-mainline:0c4826f8ccgit-subtree-split:e30ac1d106
This commit is contained in:
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
# Start Claude proxy and Vite dev server together.
|
||||
# Both are killed when either exits or when this script receives SIGINT/SIGTERM.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
APP_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
|
||||
cd "$APP_DIR"
|
||||
|
||||
# Generate a dev API token if not already set
|
||||
if [ -z "${VITE_DEV_API_TOKEN:-}" ]; then
|
||||
export VITE_DEV_API_TOKEN=$(openssl rand -hex 16)
|
||||
fi
|
||||
|
||||
cleanup() {
|
||||
kill 0 2>/dev/null || true
|
||||
wait 2>/dev/null || true
|
||||
}
|
||||
trap cleanup EXIT INT TERM
|
||||
|
||||
# Use local node_modules binaries
|
||||
BIN="$APP_DIR/node_modules/.bin"
|
||||
|
||||
# Kill stale proxy from previous session (it has a different auth token)
|
||||
if lsof -ti:3141 > /dev/null 2>&1; then
|
||||
echo " Killing stale Claude proxy on :3141"
|
||||
kill $(lsof -ti:3141) 2>/dev/null || true
|
||||
sleep 0.3
|
||||
fi
|
||||
"$BIN/tsx" server/claude-proxy.ts &
|
||||
sleep 0.3
|
||||
|
||||
# Start Vite dev server in background (host binding controlled by vite.config.ts / VITE_HOST)
|
||||
"$BIN/vite" &
|
||||
|
||||
# Wait for all background jobs (compatible with bash 3.2 on macOS)
|
||||
wait
|
||||
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Generate .dev/chats.json from the seed prompt index.
|
||||
* Run: pnpm -C packages/app exec tsx scripts/generate-seed-chats.ts
|
||||
*/
|
||||
import { seedPromptsToConversation } from '../src/__tests__/fixtures/seedPrompts'
|
||||
import { writeFileSync, mkdirSync, existsSync } from 'fs'
|
||||
import { resolve, dirname } from 'path'
|
||||
|
||||
const outPath = resolve(dirname(new URL(import.meta.url).pathname), '../.dev/chats.json')
|
||||
const dir = dirname(outPath)
|
||||
if (!existsSync(dir)) mkdirSync(dir, { recursive: true })
|
||||
|
||||
const conv = seedPromptsToConversation()
|
||||
const data = {
|
||||
conversations: { [conv.id]: conv },
|
||||
activeConversationId: conv.id,
|
||||
}
|
||||
|
||||
writeFileSync(outPath, JSON.stringify(data, null, 2), 'utf-8')
|
||||
console.log(`Wrote seed conversation (${conv.messages.length / 2} prompts) to ${outPath}`)
|
||||
Reference in New Issue
Block a user