Skip to content

Commit fd07f0f

Browse files
committed
Merge remote-tracking branch 'origin/main' into oai-truncate
2 parents a5de7e1 + 0a0cf31 commit fd07f0f

File tree

14 files changed

+313
-110
lines changed

14 files changed

+313
-110
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
branches: ["main"]
66
pull_request:
77
branches: ["**"]
8+
merge_group:
89
workflow_dispatch: # Allow manual triggering
910

1011
jobs:
@@ -47,7 +48,7 @@ jobs:
4748
echo "⚠️ No notarization credentials - skipping notarization"
4849
fi
4950
50-
bun run dist:mac
51+
make dist-mac
5152
5253
- name: Upload macOS DMG (x64)
5354
uses: actions/upload-artifact@v4
@@ -84,7 +85,7 @@ jobs:
8485
run: bun run build
8586

8687
- name: Package for Linux
87-
run: bun run dist:linux
88+
run: make dist-linux
8889

8990
- name: Upload Linux AppImage
9091
uses: actions/upload-artifact@v4

.github/workflows/ci.yml

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ on:
55
branches: ["main"]
66
pull_request:
77
branches: ["**"]
8+
merge_group:
89

910
jobs:
10-
lint:
11-
name: Lint
11+
static-check:
12+
name: Static Checks (lint + typecheck + fmt)
1213
runs-on: ubuntu-latest-8-cores
1314
steps:
1415
- name: Checkout code
@@ -25,26 +26,13 @@ jobs:
2526
- name: Generate version file
2627
run: ./scripts/generate-version.sh
2728

28-
- name: Run lint
29-
run: bun lint
30-
31-
fmt-check:
32-
name: Format Check
33-
runs-on: ubuntu-latest-8-cores
34-
steps:
35-
- name: Checkout code
36-
uses: actions/checkout@v4
37-
38-
- name: Setup Bun
39-
uses: oven-sh/setup-bun@v2
40-
with:
41-
bun-version: latest
42-
43-
- name: Install dependencies
44-
run: bun install --frozen-lockfile
29+
- name: Install shfmt
30+
run: |
31+
curl -sS https://webinstall.dev/shfmt | bash
32+
echo "$HOME/.local/bin" >> $GITHUB_PATH
4533
46-
- name: Check formatting
47-
run: bun fmt:check
34+
- name: Run static checks
35+
run: make -j3 static-check
4836

4937
test:
5038
name: Test
@@ -62,7 +50,7 @@ jobs:
6250
run: bun install --frozen-lockfile
6351

6452
- name: Run tests
65-
run: bun test
53+
run: make test-unit
6654

6755
integration-test:
6856
name: Integration Tests
@@ -80,7 +68,7 @@ jobs:
8068
run: bun install --frozen-lockfile
8169

8270
- name: Run integration tests
83-
run: bun test:integration
71+
run: make test-integration
8472
env:
8573
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
8674
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ dist
6161
release
6262

6363
# Documentation
64-
docs/vercel/
64+
ai-sdk-docs/
6565
docs/book/
6666
docs/mermaid-init.js
6767
docs/mermaid.min.js

Makefile

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
# Build System
2+
# ============
3+
# This Makefile orchestrates the cmux build process.
4+
#
5+
# Quick Start:
6+
# make help - Show all available targets
7+
# make dev - Start development server with hot reload
8+
# make build - Build all targets (parallel when possible)
9+
# make static-check - Run all static checks (lint + typecheck + fmt-check)
10+
# make test - Run tests
11+
#
12+
# Parallelism:
13+
# Use make -jN to run independent tasks concurrently (e.g., make -j4 build)
14+
#
15+
# Backwards Compatibility:
16+
# All commands also work via `bun run` (e.g., `bun run dev` calls `make dev`)
17+
#
18+
# Adding New Targets:
19+
# Add `## Description` after the target to make it appear in `make help`
20+
21+
.PHONY: all build dev start clean help
22+
.PHONY: build-main build-preload build-renderer
23+
.PHONY: lint lint-fix fmt fmt-check fmt-shell fmt-shell-check typecheck static-check
24+
.PHONY: test test-unit test-integration test-watch test-coverage
25+
.PHONY: dist dist-mac dist-win dist-linux
26+
.PHONY: docs docs-build docs-watch
27+
28+
# Prettier patterns for formatting
29+
PRETTIER_PATTERNS := 'src/**/*.{ts,tsx,json}' 'tests/**/*.{ts,json}' 'docs/**/*.{md,mdx}' '*.{json,md}'
30+
31+
# Default target
32+
all: build
33+
34+
## Help
35+
help: ## Show this help message
36+
@echo 'Usage: make [target]'
37+
@echo ''
38+
@echo 'Available targets:'
39+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'
40+
41+
## Development
42+
dev: build-main ## Start development server (Vite + TypeScript watcher)
43+
@bun x concurrently -k \
44+
"bun x concurrently \"bun x tsc -w -p tsconfig.main.json\" \"bun x tsc-alias -w -p tsconfig.main.json\"" \
45+
"vite"
46+
47+
start: build-main build-preload ## Build and start Electron app
48+
@electron .
49+
50+
## Build targets (can run in parallel)
51+
build: dist/version.txt build-renderer build-main build-preload ## Build all targets
52+
53+
build-main: dist/version.txt ## Build main process
54+
@echo "Building main process..."
55+
@bun x tsc -p tsconfig.main.json
56+
@bun x tsc-alias -p tsconfig.main.json
57+
58+
build-preload: ## Build preload script
59+
@echo "Building preload script..."
60+
@bun build src/preload.ts \
61+
--format=cjs \
62+
--target=node \
63+
--external=electron \
64+
--sourcemap=inline \
65+
--outfile=dist/preload.js
66+
67+
build-renderer: dist/version.txt ## Build renderer process
68+
@echo "Building renderer..."
69+
@bun x vite build
70+
71+
dist/version.txt: ## Generate version file
72+
@./scripts/generate-version.sh
73+
74+
## Quality checks (can run in parallel)
75+
static-check: lint typecheck fmt-check ## Run all static checks
76+
77+
lint: ## Run linter and typecheck
78+
@./scripts/lint.sh
79+
80+
lint-fix: ## Run linter with --fix
81+
@./scripts/lint.sh --fix
82+
83+
fmt: ## Format code with Prettier
84+
@echo "Formatting TypeScript/JSON/Markdown files..."
85+
@bun x prettier --write $(PRETTIER_PATTERNS)
86+
87+
fmt-check: ## Check code formatting
88+
@echo "Checking TypeScript/JSON/Markdown formatting..."
89+
@bun x prettier --check $(PRETTIER_PATTERNS) 2>&1 | grep -v 'No files matching'
90+
91+
fmt-shell: ## Format shell scripts with shfmt
92+
@./scripts/fmt.sh --shell
93+
94+
typecheck: ## Run TypeScript type checking
95+
@./scripts/typecheck.sh
96+
97+
## Testing
98+
test-integration: ## Run all tests (unit + integration)
99+
@bun test src
100+
@TEST_INTEGRATION=1 bun x jest tests
101+
102+
test-unit: ## Run unit tests
103+
@bun test src
104+
105+
test: test-unit ## Alias for test-unit
106+
107+
test-watch: ## Run tests in watch mode
108+
@./scripts/test.sh --watch
109+
110+
test-coverage: ## Run tests with coverage
111+
@./scripts/test.sh --coverage
112+
113+
## Distribution
114+
dist: build ## Build distributable packages
115+
@bun x electron-builder --publish never
116+
117+
dist-mac: build ## Build macOS distributable
118+
@bun x electron-builder --mac --publish never
119+
120+
dist-win: build ## Build Windows distributable
121+
@bun x electron-builder --win --publish never
122+
123+
dist-linux: build ## Build Linux distributable
124+
@bun x electron-builder --linux --publish never
125+
126+
## Documentation
127+
docs: ## Serve documentation locally
128+
@./scripts/docs.sh
129+
130+
docs-build: ## Build documentation
131+
@./scripts/docs_build.sh
132+
133+
docs-watch: ## Watch and rebuild documentation
134+
@cd docs && mdbook watch
135+
136+
## Clean
137+
clean: ## Clean build artifacts
138+
@echo "Cleaning build artifacts..."
139+
@rm -rf dist release
140+
@echo "Done!"
141+
142+
# Parallel build optimization - these can run concurrently
143+
.NOTPARALLEL: build-main # TypeScript can handle its own parallelism
144+
145+
fmt-shell-check: ## Check shell script formatting
146+
@if ! command -v shfmt &>/dev/null; then \
147+
echo "shfmt not found. Install with: brew install shfmt"; \
148+
exit 1; \
149+
fi
150+
@echo "Checking shell script formatting..."
151+
@shfmt -i 2 -ci -bn -d scripts

docs/AGENTS.md

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ This is especially important with rapid development where branches quickly fall
3030
./scripts/wait_pr_checks.sh <pr_number>
3131
```
3232

33-
This script polls every 5 seconds and fails immediately on CI failure or bad merge status.
33+
This script polls every 5 seconds and fails immediately on CI failure, bad merge status, or unresolved review comments.
3434

3535
**Key status values:**
3636

@@ -75,10 +75,14 @@ Only merge if the user explicitly says "merge it" or similar.
7575
## Docs
7676

7777
DO NOT visit https://sdk.vercel.ai/docs/ai-sdk-core. All of that content is already
78-
in `./docs/vercel/**.mdx`.
78+
in `./ai-sdk-docs/**.mdx`.
7979

8080
(Generate them with `./scripts/update_vercel_docs.sh` if they don't exist.)
8181

82+
### Documentation Guidelines
83+
84+
**Developer documentation should live inline with relevant code as comments.** The `docs/` directory contains user-facing documentation.
85+
8286
## Key Features
8387

8488
- Projects sidebar (left panel)
@@ -96,20 +100,32 @@ in `./docs/vercel/**.mdx`.
96100

97101
## Development Commands
98102

99-
- `bun dev` - Start development server (Vite + TypeScript watcher)
100-
- `bun start` - Start Electron app
101-
- `bun build` - Build the application
102-
- `bun lint` - Run ESLint & typecheck (also: `bun lint:fix`)
103-
- `bun fmt` - Format all source files with Prettier
104-
- `bun fmt:check` - Check if files are formatted correctly
103+
This project uses **Make** as the primary build orchestrator. See `Makefile` for inline documentation.
104+
105+
**Primary commands (use Make):**
106+
107+
- `make dev` - Start development server (Vite + TypeScript watcher)
108+
- `make start` - Build and start Electron app
109+
- `make build` - Build the application (with parallelism)
110+
- `make lint` - Run ESLint & typecheck
111+
- `make lint-fix` - Run ESLint with --fix
112+
- `make fmt` - Format all source files with Prettier
113+
- `make fmt-check` - Check if files are formatted correctly
114+
- `make typecheck` - Run TypeScript type checking
115+
- `make test` - Run unit tests
116+
- `make test-integration` - Run all tests (unit + integration)
117+
- `make clean` - Clean build artifacts
118+
- `make help` - Show all available targets
119+
120+
**Backwards compatibility:** Existing commands are available via `bun run` (e.g., `bun run dev` calls `make dev`). New commands will only be added to `Makefile`, not `package.json`.
105121

106122
## Refactoring
107123

108124
- When refactoring, use `git mv` to preserve file history instead of rewriting files from scratch
109125

110126
## Testing
111127

112-
- Always run `bun typecheck` and `bun typecheck:main` after making changes to verify types
128+
- Always run `make typecheck` after making changes to verify types (checks both main and renderer)
113129
- **Unit tests should be colocated with their business logic** - Place unit test files (\*.test.ts) in the same directory as the code they test (e.g., `aiService.test.ts` next to `aiService.ts`)
114130
- E2E and integration tests may live in `./tests/` directory, but unit tests must be colocated
115131
- Strive to decompose complex logic away from the components and into `.src/utils/`
@@ -356,8 +372,8 @@ The IPC layer is the boundary between backend and frontend. Follow these rules t
356372

357373
## Debugging
358374

359-
- `bun debug ui-messages --workspace <workspace-name>` - Show UI messages for a workspace
360-
- `bun debug ui-messages --workspace <workspace-name> --drop <n>` - Show messages with last n dropped
375+
- `bun run debug ui-messages --workspace <workspace-name>` - Show UI messages for a workspace
376+
- `bun run debug ui-messages --workspace <workspace-name> --drop <n>` - Show messages with last n dropped
361377
- Workspace names can be found in `~/.cmux/sessions/`
362378

363379
## UX Guidelines

docs/CLAUDE.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

package.json

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,28 @@
44
"description": "cmux - coder multiplexer",
55
"main": "dist/main.js",
66
"scripts": {
7-
"dev": "bun run build:main && concurrently -k \"bun run dev:main\" \"bun run dev:renderer\"",
8-
"dev:main": "concurrently \"tsc -w -p tsconfig.main.json\" \"tsc-alias -w -p tsconfig.main.json\"",
9-
"dev:renderer": "vite",
10-
"prebuild": "./scripts/generate-version.sh",
7+
"dev": "make dev",
118
"prebuild:main": "./scripts/generate-version.sh",
12-
"build": "bun run build:renderer && bun run build:main && bun run build:preload",
13-
"build:main": "tsc -p tsconfig.main.json && tsc-alias -p tsconfig.main.json",
14-
"build:preload": "bun build src/preload.ts --format=cjs --target=node --external=electron --sourcemap=inline --outfile=dist/preload.js",
15-
"build:renderer": "vite build",
16-
"start": "bun run build:main && bun run build:preload && electron .",
17-
"typecheck": "./scripts/typecheck.sh",
9+
"build": "make build",
10+
"start": "make start",
11+
"typecheck": "make typecheck",
1812
"debug": "bun src/debug/index.ts",
19-
"lint": "./scripts/lint.sh",
20-
"lint:fix": "./scripts/lint.sh --fix",
21-
"fmt": "./scripts/fmt.sh",
22-
"fmt:shell": "./scripts/fmt.sh --shell",
23-
"fmt:check": "./scripts/fmt.sh --check",
24-
"test": "bun test src",
25-
"test:watch": "./scripts/test.sh --watch",
26-
"test:coverage": "./scripts/test.sh --coverage",
27-
"test:integration": "bun test src && TEST_INTEGRATION=1 jest tests",
28-
"dist": "bun run build && electron-builder --publish never",
29-
"dist:mac": "bun run build && electron-builder --mac --publish never",
30-
"dist:win": "bun run build && electron-builder --win --publish never",
31-
"dist:linux": "bun run build && electron-builder --linux --publish never",
32-
"docs": "./scripts/docs.sh",
33-
"docs:build": "./scripts/docs_build.sh",
34-
"docs:watch": "cd docs && mdbook watch"
13+
"lint": "make lint",
14+
"lint:fix": "make lint-fix",
15+
"fmt": "make fmt",
16+
"fmt:shell": "make fmt-shell",
17+
"fmt:check": "make fmt-check",
18+
"test": "make test",
19+
"test:watch": "make test-watch",
20+
"test:coverage": "make test-coverage",
21+
"test:integration": "make test-integration",
22+
"dist": "make dist",
23+
"dist:mac": "make dist-mac",
24+
"dist:win": "make dist-win",
25+
"dist:linux": "make dist-linux",
26+
"docs": "make docs",
27+
"docs:build": "make docs-build",
28+
"docs:watch": "make docs-watch"
3529
},
3630
"dependencies": {
3731
"@ai-sdk/anthropic": "^2.0.20",

0 commit comments

Comments
 (0)