summaryrefslogtreecommitdiffhomepage
path: root/scripts/stainless
blob: 3c868c9b84472c9399a04741f3340056ba72a3e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash

set -e

# Parse command line arguments
DEV_MODE=false
for arg in "$@"; do
    if [ "$arg" = "--dev" ]; then
        DEV_MODE=true
    fi
done

echo "Starting opencode server on port 4096..."
bun run ./packages/opencode/src/index.ts serve --port 4096 &
SERVER_PID=$!

echo "Waiting for server to start..."
sleep 3

echo "Fetching OpenAPI spec from http://127.0.0.1:4096/doc..."
curl -s http://127.0.0.1:4096/doc > openapi.json

echo "Stopping server..."
kill $SERVER_PID

echo "Running stl builds create..."
stl builds create --branch dev --pull --allow-empty --targets go 

echo "Cleaning up..."
rm -rf packages/tui/sdk
mv opencode-go/ packages/tui/sdk/
rm -rf packages/tui/sdk/.git

# Only run production build if not in dev mode
if [ "$DEV_MODE" = false ]; then
    echo "Kicking off production build..."
    stl builds create --branch main --wait=false
else
    echo "Skipping production build (--dev flag detected)"
fi

echo "Done!"