Skip to content

Commit 87b9bc8

Browse files
committed
refactor: simplify server and bridge
Flatten the server into a minimal Bun app, replace the TypeScript bridge with the Go bridge, move served assets under static, and tighten command execution behavior with tests.
1 parent 8c26f5b commit 87b9bc8

33 files changed

Lines changed: 1825 additions & 1542 deletions

.github/workflows/ci.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,26 @@ jobs:
2424
with:
2525
bun-version: latest
2626

27+
- name: Setup Go
28+
uses: actions/setup-go@v5
29+
with:
30+
go-version: ">=1.22.0"
31+
2732
- name: Install dependencies
2833
run: bun install
2934

3035
- name: Typecheck
3136
run: bun run typecheck
3237

33-
- name: Build bridge binaries
38+
- name: Build bridge binaries (Go cross-compile)
3439
if: runner.os != 'Windows'
3540
run: bun run build
3641

3742
- name: Build Windows bridge binary
3843
if: runner.os == 'Windows'
39-
run: bun run build:bridge
44+
run: bun run build
4045
env:
41-
BUILD_TARGETS: bun-windows-x64
46+
BUILD_TARGETS: windows_amd64
4247

4348
- name: Run tests
4449
run: bun test

Dockerfile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
FROM oven/bun:1 AS builder
1+
FROM golang:1.23-bookworm AS bridgebuilder
22
WORKDIR /app
3-
COPY package.json tsconfig.json ./
4-
COPY server ./server
3+
COPY scripts/build-bridge.sh scripts/
54
COPY bridge ./bridge
6-
RUN bun run build:bridge
5+
RUN sh scripts/build-bridge.sh
76

87
FROM oven/bun:1-slim
98
WORKDIR /app
109
COPY package.json tsconfig.json ./
1110
COPY server ./server
1211
RUN mkdir -p public/bin
13-
COPY --from=builder /app/public/bin /app/public/bin
12+
COPY --from=bridgebuilder /app/public/bin /app/public/bin
1413
EXPOSE 8765
15-
CMD ["bun", "run", "server/src/index.ts"]
14+
CMD ["bun", "run", "server/index.ts"]

README.md

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
1-
**Connect Your Agent (CYA)**
1+
# CYA
22

3-
Temporary shell access for AI agents.
3+
AI agent shell relay. **Dev:** `bun install && bun dev` (needs **Go ≥ 1.22** so the bridge binaries can compile into `public/bin/`).
44

5-
**Run locally (Docker):**
6-
7-
```sh
8-
docker build -t cya . && docker run --rm -p 8765:8765 -e BASE_URL=http://localhost:8765 cya
9-
```
10-
11-
**Development:**
12-
13-
```sh
14-
bun install
15-
bun dev
16-
```
5+
**Docker:** `docker build -t cya . && docker run --rm -p 8765:8765 -e BASE_URL=http://localhost:8765 cya`

bridge/agent.ts

Lines changed: 0 additions & 173 deletions
This file was deleted.

bridge/build.ts

Lines changed: 0 additions & 37 deletions
This file was deleted.

bridge/go.mod

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module github.com/bgwastu/cya/bridge
2+
3+
go 1.22.0
4+
5+
require github.com/gorilla/websocket v1.5.3

bridge/go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
2+
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=

0 commit comments

Comments
 (0)