Skip to content

Commit fff29a4

Browse files
committed
add UI
1 parent 8089abe commit fff29a4

14 files changed

Lines changed: 501 additions & 90 deletions

Makefile

Lines changed: 66 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,74 @@
1-
.PHONY: help install clean test test-race build release fmt vet check
1+
.PHONY: help install clean test test-race build build-cli build-sidecar node-deps stop-desktop frontend app dev start sidecar desktop-build fmt fmt-check vet check release
2+
3+
SHELL := pwsh.exe
4+
.SHELLFLAGS := -NoProfile -Command
25

36
VERSION ?= dev
47
GOFLAGS ?=
8+
FRONTEND_HOST ?= 127.0.0.1
9+
FRONTEND_PORT ?= 5173
10+
SIDECAR_HOST ?= 127.0.0.1
11+
SIDECAR_PORT ?= 0
12+
TAURI_MANIFEST ?= src-tauri/Cargo.toml
13+
TAURI_CONFIG ?= src-tauri/tauri.conf.json
14+
TAURI_CLI ?= ./frontend/node_modules/.bin/tauri.cmd
15+
SIDECAR_TARGET ?= src-tauri/binaries/cam-sidecar-x86_64-pc-windows-msvc.exe
516

617
help:
7-
@echo "Available commands:"
8-
@echo " make build - Build Go binaries into dist/"
9-
@echo " make install - Build and install cam/code-agent-manager"
10-
@echo " make test - Run Go test suite"
11-
@echo " make test-race - Run Go tests with race detector"
12-
@echo " make fmt - Format Go code"
13-
@echo " make vet - Run go vet"
14-
@echo " make check - Run fmt check, vet, tests, and install smoke test"
15-
@echo " make clean - Remove build artifacts"
18+
@Write-Output "Available commands:"
19+
@Write-Output " make start - Start the full Tauri desktop app (same as make app)"
20+
@Write-Output " make app - Start the Tauri desktop app (alias: make dev)"
21+
@Write-Output " make frontend - Start browser-only Vite frontend at $(FRONTEND_HOST):$(FRONTEND_PORT)"
22+
@Write-Output " make sidecar - Start Go sidecar API at $(SIDECAR_HOST):$(SIDECAR_PORT)"
23+
@Write-Output " make desktop-build - Build frontend, Go sidecar, and cargo-check Tauri shell"
24+
@Write-Output " make build - Build Go CLI binaries and sidecar into dist/"
25+
@Write-Output " make install - Build and install cam/code-agent-manager"
26+
@Write-Output " make test - Run Go test suite"
27+
@Write-Output " make test-race - Run Go tests with race detector"
28+
@Write-Output " make fmt - Format Go code"
29+
@Write-Output " make vet - Run go vet"
30+
@Write-Output " make check - Run fmt check, vet, tests, frontend tests, and sidecar build"
31+
@Write-Output " make clean - Remove build artifacts"
1632

1733
install:
18-
VERSION=$(VERSION) ./install.sh install
34+
bash ./install.sh install
1935

2036
clean:
21-
rm -rf dist/
22-
find . -type f -name "*.test" -delete
23-
find . -type f -name "coverage.out" -delete
37+
Remove-Item -Recurse -Force dist, frontend/dist, src-tauri/target, src-tauri/binaries -ErrorAction SilentlyContinue
38+
Get-ChildItem -Recurse -Filter *.test -ErrorAction SilentlyContinue | Remove-Item -Force -ErrorAction SilentlyContinue
39+
Get-ChildItem -Recurse -Filter coverage.out -ErrorAction SilentlyContinue | Remove-Item -Force -ErrorAction SilentlyContinue
40+
41+
build: build-cli build-sidecar
42+
43+
node-deps:
44+
npm --prefix frontend install
2445

25-
build:
26-
mkdir -p dist
46+
build-cli:
47+
New-Item -ItemType Directory -Force dist | Out-Null
2748
go build $(GOFLAGS) -ldflags "-X main.version=$(VERSION)" -o dist/cam ./cmd/cam
2849
go build $(GOFLAGS) -ldflags "-X main.version=$(VERSION)" -o dist/code-agent-manager ./cmd/code-agent-manager
2950

51+
stop-desktop:
52+
$$processes = Get-Process cam-sidecar, cam-desktop -ErrorAction SilentlyContinue; if ($$processes) { $$processes | Stop-Process -Force -ErrorAction SilentlyContinue }; exit 0
53+
54+
build-sidecar: stop-desktop
55+
New-Item -ItemType Directory -Force dist, src-tauri/binaries | Out-Null
56+
go build $(GOFLAGS) -ldflags "-X main.version=$(VERSION)" -o dist/cam-sidecar ./cmd/cam-sidecar
57+
go build $(GOFLAGS) -ldflags "-X main.version=$(VERSION)" -o $(SIDECAR_TARGET) ./cmd/cam-sidecar
58+
59+
frontend:
60+
npm --prefix frontend run dev -- --host $(FRONTEND_HOST) --port $(FRONTEND_PORT) --strictPort
61+
62+
sidecar:
63+
go run ./cmd/cam-sidecar --host $(SIDECAR_HOST) --port $(SIDECAR_PORT)
64+
65+
app dev start: node-deps build-sidecar
66+
$$env:CARGO_HTTP_CHECK_REVOKE='false'; $(TAURI_CLI) dev --config $(TAURI_CONFIG)
67+
68+
desktop-build: build-sidecar
69+
npm --prefix frontend run build
70+
$$env:CARGO_HTTP_CHECK_REVOKE='false'; cargo check --manifest-path $(TAURI_MANIFEST)
71+
3072
test:
3173
go test $(GOFLAGS) ./...
3274

@@ -37,15 +79,17 @@ fmt:
3779
gofmt -s -w cmd internal
3880

3981
fmt-check:
40-
@test -z "$$(gofmt -s -l cmd internal)" || (gofmt -s -l cmd internal && exit 1)
82+
$$files = gofmt -s -l cmd internal; if ($$files) { $$files; exit 1 }
4183

4284
vet:
4385
go vet ./...
4486

45-
check: fmt-check vet test
46-
bash tests/verify_go_cli_install.sh
47-
@echo "All checks passed!"
87+
check: fmt-check vet test build-sidecar
88+
npm --prefix frontend test -- --run
89+
npm --prefix frontend run build
90+
$$env:CARGO_HTTP_CHECK_REVOKE='false'; cargo check --manifest-path $(TAURI_MANIFEST)
91+
Write-Output "All checks passed!"
4892

4993
release: clean check build
50-
@echo "Release build completed successfully!"
51-
@ls -lh dist/
94+
Write-Output "Release build completed successfully!"
95+
Get-ChildItem dist

README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,70 @@ go build -o dist/cam ./cmd/cam
9090

9191
5. **Select your assistant and start coding!**
9292

93+
---
94+
95+
## Desktop App and Developer Workflow
96+
97+
CAM now uses a **Tauri desktop shell** with a **Go sidecar API**. The same Go backend packages power both the terminal CLI and the desktop UI, so provider and launch behavior stays consistent across interfaces.
98+
99+
### Start the desktop app
100+
101+
Use `make start` from the repository root:
102+
103+
```bash
104+
make start
105+
```
106+
107+
`make start`, `make app`, and `make dev` all run the same full desktop startup path. They build the Go sidecar expected by Tauri, start the Vite frontend dev server through Tauri, and open the desktop window.
108+
109+
### Start browser-only frontend
110+
111+
Use this when you only want the React UI in a browser with mock/fallback data or a manually configured sidecar URL:
112+
113+
```bash
114+
make frontend
115+
```
116+
117+
The browser frontend listens on `http://127.0.0.1:5173` by default. Override the host or port when needed:
118+
119+
```bash
120+
make frontend FRONTEND_HOST=127.0.0.1 FRONTEND_PORT=5174
121+
```
122+
123+
### Start the Go sidecar directly
124+
125+
Use this for API testing without opening the desktop window:
126+
127+
```bash
128+
make sidecar
129+
```
130+
131+
By default, the sidecar binds to `127.0.0.1` and chooses a random port (`SIDECAR_PORT=0`). It prints startup JSON containing the selected port and bearer token. Override values when needed:
132+
133+
```bash
134+
make sidecar SIDECAR_PORT=54321
135+
```
136+
137+
### Build desktop assets and sidecar
138+
139+
```bash
140+
make desktop-build
141+
```
142+
143+
This runs the frontend production build, builds the Go sidecar, and checks the Tauri shell with Cargo. On Windows, the Makefile sets `CARGO_HTTP_CHECK_REVOKE=false` to avoid certificate revocation-check failures when Cargo downloads crates.
144+
145+
### Other useful make targets
146+
147+
```bash
148+
make start # start the full Tauri desktop app
149+
make build # build CLI binaries and sidecar into dist/
150+
make test # run Go tests
151+
make check # run Go vet, Go tests, frontend tests/build, sidecar build, and cargo check
152+
make clean # remove generated build outputs
153+
```
154+
155+
---
156+
93157
### Configuration files
94158

95159
CAM uses these main configuration files:
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Makefile App Workflow Implementation Plan
2+
3+
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
4+
5+
**Goal:** Make `make` the documented entrypoint for starting the Tauri desktop app, browser frontend, and Go sidecar.
6+
7+
**Architecture:** Keep existing Go CLI targets while adding Tauri/sidecar targets. `make app` starts the Tauri desktop shell, `make frontend` starts browser-only Vite, and `make sidecar` starts the Go sidecar for manual API testing.
8+
9+
**Tech Stack:** Make, Go, npm/Vite, Cargo/Tauri, README markdown.
10+
11+
---
12+
13+
## Files
14+
15+
- Modify: `Makefile` — add app/dev/sidecar/frontend/desktop-build targets and update help.
16+
- Modify: `README.md` — document Make-based app startup and Tauri + Go sidecar architecture.
17+
18+
## Task 1: Update Makefile
19+
20+
- [ ] Add variables for frontend host/port, sidecar host/port, and cargo revocation workaround.
21+
- [ ] Add `app` and `dev` aliases that run `cargo tauri dev --manifest-path src-tauri/Cargo.toml` with `CARGO_HTTP_CHECK_REVOKE=false`.
22+
- [ ] Add `frontend` target for browser-only Vite.
23+
- [ ] Add `sidecar` target for local sidecar API startup.
24+
- [ ] Add `desktop-build` target that runs frontend build, builds `cmd/cam-sidecar`, and runs `cargo check` for Tauri.
25+
- [ ] Keep existing `build`, `test`, `vet`, and `check` targets.
26+
27+
## Task 2: Update README
28+
29+
- [ ] Add a Desktop App section after Quick Start.
30+
- [ ] Document `make app`, `make frontend`, `make sidecar`, and `make desktop-build`.
31+
- [ ] Explain that the desktop app is Tauri + Go sidecar and browser mode remains available.
32+
33+
## Task 3: Verify
34+
35+
- [ ] Run `make help`.
36+
- [ ] Run `make desktop-build`.
37+
- [ ] Run `go test ./...`.
38+
- [ ] Run `npm --prefix frontend test -- --run`.
39+
- [ ] Run `git status --short`.
40+
41+
## Self-Review
42+
43+
- No placeholders.
44+
- Targets match current Tauri sidecar architecture.
45+
- README commands match Makefile target names.

frontend/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<head>
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='8' fill='%230f172a'/%3E%3Cpath d='M6 18h4l3-9 6 18 3-9h4' fill='none' stroke='%2360a5fa' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E" />
67
<title>code-agent-manager</title>
78
</head>
89
<body>

0 commit comments

Comments
 (0)