Skip to content

Commit 9ef3519

Browse files
committed
Merge remote-tracking branch 'origin/main' into fe-perf
2 parents 65a8513 + cdc142a commit 9ef3519

37 files changed

+1100
-377
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
name: Build
22

33
on:
4-
push:
5-
branches: ["main"]
64
pull_request:
75
branches: ["**"]
6+
merge_group:
87
workflow_dispatch: # Allow manual triggering
98

109
jobs:
@@ -47,7 +46,7 @@ jobs:
4746
echo "⚠️ No notarization credentials - skipping notarization"
4847
fi
4948
50-
bun run dist:mac
49+
make dist-mac
5150
5251
- name: Upload macOS DMG (x64)
5352
uses: actions/upload-artifact@v4
@@ -84,7 +83,7 @@ jobs:
8483
run: bun run build
8584

8685
- name: Package for Linux
87-
run: bun run dist:linux
86+
run: make dist-linux
8887

8988
- name: Upload Linux AppImage
9089
uses: actions/upload-artifact@v4

.github/workflows/ci.yml

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
name: CI
22

33
on:
4-
push:
5-
branches: ["main"]
64
pull_request:
75
branches: ["**"]
6+
merge_group:
87

98
jobs:
10-
lint:
11-
name: Lint
9+
static-check:
10+
name: Static Checks (lint + typecheck + fmt)
1211
runs-on: ubuntu-latest-8-cores
1312
steps:
1413
- name: Checkout code
@@ -25,26 +24,13 @@ jobs:
2524
- name: Generate version file
2625
run: ./scripts/generate-version.sh
2726

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
27+
- name: Install shfmt
28+
run: |
29+
curl -sS https://webinstall.dev/shfmt | bash
30+
echo "$HOME/.local/bin" >> $GITHUB_PATH
4531
46-
- name: Check formatting
47-
run: bun fmt:check
32+
- name: Run static checks
33+
run: make -j3 static-check
4834

4935
test:
5036
name: Test
@@ -62,7 +48,7 @@ jobs:
6248
run: bun install --frozen-lockfile
6349

6450
- name: Run tests
65-
run: bun test
51+
run: make test-unit
6652

6753
integration-test:
6854
name: Integration Tests
@@ -80,7 +66,7 @@ jobs:
8066
run: bun install --frozen-lockfile
8167

8268
- name: Run integration tests
83-
run: bun test:integration
69+
run: make test-integration
8470
env:
8571
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
8672
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

README.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,38 @@ A cross-platform desktop application for embarassingly parallel development.
1919

2020
Download pre-built binaries from [GitHub Actions artifacts](https://github.com/coder/cmux/actions/workflows/build.yml):
2121

22-
- **macOS**: Universal binary DMG (Intel + Apple Silicon)
22+
- **macOS**: Signed and notarized DMG (separate builds for Intel/Apple Silicon)
2323
- **Linux**: AppImage
2424

2525
## Development
2626

2727
See [AGENTS.md](./AGENTS.md) for development setup and guidelines.
2828

29+
### Documentation Style Guide
30+
31+
When writing user-facing documentation, follow these principles:
32+
33+
**Minimum Viable Documentation** - Write only what users need to complete their task successfully. Assume users are:
34+
35+
- Capable of using basic UIs without instruction
36+
- Able to debug issues without pre-written troubleshooting
37+
- Smart enough to apply security best practices without being told
38+
39+
**Delete:**
40+
41+
- Step-by-step UI walkthroughs for obvious interactions ("Click the button", "Enter the value", "Click Save")
42+
- Troubleshooting sections for hypothetical problems that haven't occurred
43+
- Best practices and security advice (users will research when needed)
44+
- Multiple ways to do the same thing (pick one, preferably the simplest)
45+
- Verification/testing sections
46+
47+
**Keep:**
48+
49+
- Core setup steps with technical details
50+
- Non-obvious facts about how things work
51+
- Actual command examples
52+
- Brief, clear explanations
53+
2954
## Features
3055

3156
- 🔀 Git worktree integration for multi-branch workflows

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.

docs/SUMMARY.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@
44
- [Install](./install.md)
55
- [Keyboard Shortcuts](./keybinds.md)
66
- [Context Management](./context-management.md)
7+
- [Project Secrets](./project-secrets.md)
8+
- [Agentic Git Identity](./agentic-git-identity.md)
79
- [AGENTS](./AGENTS.md)

0 commit comments

Comments
 (0)