|
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 |
2 | 5 |
|
3 | 6 | VERSION ?= dev |
4 | 7 | 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 |
5 | 16 |
|
6 | 17 | 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" |
16 | 32 |
|
17 | 33 | install: |
18 | | - VERSION=$(VERSION) ./install.sh install |
| 34 | + bash ./install.sh install |
19 | 35 |
|
20 | 36 | 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 |
24 | 45 |
|
25 | | -build: |
26 | | - mkdir -p dist |
| 46 | +build-cli: |
| 47 | + New-Item -ItemType Directory -Force dist | Out-Null |
27 | 48 | go build $(GOFLAGS) -ldflags "-X main.version=$(VERSION)" -o dist/cam ./cmd/cam |
28 | 49 | go build $(GOFLAGS) -ldflags "-X main.version=$(VERSION)" -o dist/code-agent-manager ./cmd/code-agent-manager |
29 | 50 |
|
| 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 | + |
30 | 72 | test: |
31 | 73 | go test $(GOFLAGS) ./... |
32 | 74 |
|
|
37 | 79 | gofmt -s -w cmd internal |
38 | 80 |
|
39 | 81 | 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 } |
41 | 83 |
|
42 | 84 | vet: |
43 | 85 | go vet ./... |
44 | 86 |
|
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!" |
48 | 92 |
|
49 | 93 | 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 |
0 commit comments