Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .claude/agents/coderabbit-pr-reviewer.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ After implementing all fixes:

1. **Format Code**
- Rust: `cargo fmt --all`
- TypeScript: `pnpm format`
- TypeScript: `bun run format`

2. **Check Compilation**
- Rust: `cargo check -p affected_crate`
- TypeScript: `pnpm typecheck`
- TypeScript: `bun run typecheck`

3. **Lint Check**
- Rust: `cargo clippy`
- TypeScript: `pnpm lint`
- TypeScript: `bun run lint`

## Critical Rules

Expand Down
33 changes: 23 additions & 10 deletions .github/actions/setup-js/action.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,42 @@
name: Setup JS (pnpm & node)
description: Sets up pnpm & node with dependencies and caching
name: Setup JS (Bun & Node)
description: Sets up Bun 1.4.0 and Node with frozen dependencies and caching
runs:
using: "composite"
steps:
- name: Install pnpm
uses: pnpm/action-setup@v6
with:
run_install: false

- name: Setup node
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm

- name: Setup Bun
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6
with:
bun-version: 1.4.0

- name: Cache Bun packages
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830
with:
path: ${{ runner.temp }}/bun-cache
key: ${{ runner.os }}-${{ runner.arch }}-bun-1.4.0-${{ hashFiles('bun.lock') }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Scope the Bun dependency cache to trusted refs

Bun cache keys have no trusted-ref namespace and use a broad cross-ref restore prefix.

Separate PR and trusted-branch cache namespaces, or disable caching for untrusted PR jobs.

AI prompt
Check if this security scanner issue is valid. If so, understand the root cause and fix it. If appropriate, update or add tests. Keep the change focused and preserve intended behavior.

<file name=".github/actions/setup-js/action.yml">
<violation number="1" location=".github/actions/setup-js/action.yml:20">
<priority>P2</priority>
<title>Scope the Bun dependency cache to trusted refs</title>
<evidence>The cache key is `${{ runner.os }}-${{ runner.arch }}-bun-1.4.0-${{ hashFiles('bun.lock') }}` and the restore key is the broad `${{ runner.os }}-${{ runner.arch }}-bun-1.4.0-`. The key contains no branch or event trust boundary, so caches produced from untrusted PR execution can be eligible for reuse by other refs sharing the Bun prefix.</evidence>
<recommendation>Use separate cache namespaces for trusted default-branch/release jobs and untrusted pull-request jobs, or disable the cache for untrusted PRs. Keep restore keys equally scoped and verify that restored package-cache contents cannot override lockfile integrity checks.</recommendation>
</violation>
</file>

restore-keys: |
${{ runner.os }}-${{ runner.arch }}-bun-1.4.0-

- name: Install frontend dependencies
shell: bash
env:
BUN_INSTALL_CACHE_DIR: ${{ runner.temp }}/bun-cache
run: |
set -euo pipefail
for attempt in 1 2 3; do
if pnpm install; then
if bun install --frozen-lockfile; then
exit 0
fi
if [[ "$attempt" == "3" ]]; then
exit 1
fi
sleep $((attempt * 30))
done

- name: Verify Bun installation
shell: bash
run: bun run check:bun
47 changes: 32 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
desktop:
- '.gitattributes'
- '.github/actions/install-desktop-deps/**'
- '.github/actions/setup-js/**'
- '.github/workflows/ci.yml'
- 'apps/cli/**'
- 'apps/desktop/**'
Expand All @@ -52,7 +53,9 @@ jobs:
- 'scripts/verify-gpui-release-inputs.mjs'
- 'Cargo.toml'
- 'Cargo.lock'
- 'pnpm-lock.yaml'
- 'bun.lock'
- 'bunfig.toml'
- 'package.json'
rust:
- '.cargo/**'
- '.github/**'
Expand All @@ -64,7 +67,9 @@ jobs:
- 'Cargo.lock'
tauri-plugins:
- 'Cargo.lock'
- 'pnpm-lock.yaml'
- 'bun.lock'
- 'scripts/check-tauri-plugin-versions*'
- 'apps/desktop/package.json'

- name: Output branch name
id: branch
Expand All @@ -80,10 +85,25 @@ jobs:

- uses: ./.github/actions/setup-js

- run: pnpm web exec next typegen
- run: bun run --cwd apps/web next typegen

- name: Test workspace tooling
run: node --test scripts/bun-scripts.test.mjs scripts/check-tauri-plugin-versions.test.mjs

- name: Test web React compatibility
run: >-
bun run --cwd apps/web test
__tests__/unit/embed-video-playback-chrome.test.ts
__tests__/unit/homepage-demo-accessibility.test.ts
__tests__/unit/linkified-text.test.ts
__tests__/unit/loom-import-ui.test.ts
__tests__/unit/media-player-store-refs.test.ts
Comment thread
richiemcilroy marked this conversation as resolved.
__tests__/unit/signed-baa-card.test.ts
__tests__/unit/summary-editor.test.ts
__tests__/unit/sso-login-pages.test.ts

- name: Typecheck
run: pnpm typecheck
run: bun run typecheck

mobile:
name: Mobile
Expand All @@ -97,19 +117,19 @@ jobs:
- name: Check Expo dependencies
env:
EXPO_OFFLINE: "1"
run: pnpm --dir apps/mobile exec expo install --check
run: bun run --cwd apps/mobile expo install --check

- name: Run Expo Doctor
env:
EXPO_OFFLINE: "1"
working-directory: apps/mobile
run: pnpm dlx expo-doctor@1.20.1
run: bunx expo-doctor@1.20.1

- name: Typecheck
run: pnpm --dir apps/mobile typecheck
run: bun run --cwd apps/mobile typecheck

- name: Test
run: pnpm --dir apps/mobile test
run: bun run --cwd apps/mobile test

format-biome:
name: Format (Biome)
Expand Down Expand Up @@ -271,7 +291,7 @@ jobs:

- name: Run cap-setup
shell: bash
run: pnpm -w cap-setup
run: bun run cap-setup
env:
RUST_TARGET_TRIPLE: ${{ matrix.settings.target }}

Expand All @@ -284,7 +304,7 @@ jobs:
shell: bash
run: |
node --test scripts/linux-bundle-config.test.mjs scripts/finalize-linux-appimage.test.mjs
pnpm --dir apps/desktop exec vitest run scripts/prepare.test.js
bun run --cwd apps/desktop vitest run scripts/prepare.test.js
cargo test --locked -p cap-utils -p cap-cli-install --lib
cargo test --locked -p cap --bin cap record::tests
cargo test --locked -p cap-recording --lib -- --test-threads=1
Expand Down Expand Up @@ -317,7 +337,7 @@ jobs:

- name: Build app
working-directory: apps/desktop
run: pnpm tauri build --debug --target ${{ matrix.settings.target }} --no-bundle
run: bun run tauri build --debug --target ${{ matrix.settings.target }} --no-bundle
env:
LD_LIBRARY_PATH: ${{ runner.os == 'Linux' && format('{0}/target/native-deps/lib:{0}/target/debug:{0}/target/{1}/debug', github.workspace, matrix.settings.target) || '' }}
RUST_TARGET_TRIPLE: ${{ matrix.settings.target }}
Expand All @@ -331,10 +351,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 20
- uses: ./.github/actions/setup-js

- name: Run verify
shell: bash
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/desktop-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ jobs:

- name: Run cap-setup
shell: bash
run: pnpm -w cap-setup
run: bun run cap-setup
env:
RUST_TARGET_TRIPLE: ${{ matrix.settings.target }}
APPLE_SIGNING_IDENTITY: ${{ runner.os == 'macOS' && secrets.APPLE_SIGNING_IDENTITY || '' }}
Expand Down Expand Up @@ -348,7 +348,7 @@ jobs:

- name: Build app
working-directory: apps/desktop
run: ${{ runner.os == 'Linux' && 'CARGO_PROFILE_RELEASE_DEBUG=0 node ../../scripts/build-linux-packages.mjs' || runner.os == 'macOS' && hashFiles('scripts/build-macos-packages.mjs') != '' && 'node ../../scripts/build-macos-packages.mjs' || 'pnpm build:tauri --target' }} ${{ matrix.settings.target }} --config src-tauri/tauri.prod.conf.json ${{ runner.os == 'Windows' && '--bundles nsis' || runner.os == 'Linux' && '--verbose' || '' }}
run: ${{ runner.os == 'Linux' && 'CARGO_PROFILE_RELEASE_DEBUG=0 node ../../scripts/build-linux-packages.mjs' || runner.os == 'macOS' && hashFiles('scripts/build-macos-packages.mjs') != '' && 'node ../../scripts/build-macos-packages.mjs' || 'bun run build:tauri --target' }} ${{ matrix.settings.target }} --config src-tauri/tauri.prod.conf.json ${{ runner.os == 'Windows' && '--bundles nsis' || runner.os == 'Linux' && '--verbose' || '' }}
env:
# https://github.com/tauri-apps/tauri-action/issues/740
CI: false
Expand Down Expand Up @@ -411,7 +411,7 @@ jobs:
if: ${{ runner.os == 'Windows' }}
working-directory: apps/desktop
shell: bash
run: pnpm tauri bundle --target ${{ matrix.settings.target }} --bundles nsis --config src-tauri/tauri.prod.conf.json
run: bun run tauri bundle --target ${{ matrix.settings.target }} --bundles nsis --config src-tauri/tauri.prod.conf.json
env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
Expand Down Expand Up @@ -792,7 +792,7 @@ jobs:
for exe in "$BUNDLE_DIR"/*.exe; do
echo "Re-signing $(basename "$exe") for Tauri updater..."
rm -f "${exe}.sig"
pnpm tauri signer sign -k "$TAURI_SIGNING_PRIVATE_KEY" -p "$TAURI_SIGNING_PRIVATE_KEY_PASSWORD" "$exe"
bun run tauri signer sign -k "$TAURI_SIGNING_PRIVATE_KEY" -p "$TAURI_SIGNING_PRIVATE_KEY_PASSWORD" "$exe"
if [[ ! -s "${exe}.sig" ]]; then
echo "::error::Windows production updater signature missing for $exe"
exit 1
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/publish-chrome-extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,21 @@ jobs:
done

- name: Typecheck
run: pnpm --filter "@cap/chrome-extension..." typecheck
run: bun run --filter "@cap/chrome-extension..." typecheck

- name: Test
run: pnpm --filter @cap/chrome-extension test
run: bun run --filter @cap/chrome-extension test

- name: Install Playwright browser
if: ${{ inputs.run_e2e }}
run: pnpm --filter @cap/chrome-extension test:e2e:install
run: bun run --filter @cap/chrome-extension test:e2e:install

- name: Test E2E
if: ${{ inputs.run_e2e }}
run: pnpm --filter @cap/chrome-extension test:e2e
run: bun run --filter @cap/chrome-extension test:e2e

- name: Build
run: pnpm --filter @cap/chrome-extension build
run: bun run --filter @cap/chrome-extension build

- name: Package
id: package
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/recording-reliability.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- "packages/database/**"
- "packages/web-*/**"
- "crates/recording/**"
- "pnpm-lock.yaml"
- "bun.lock"
- ".github/workflows/recording-reliability.yml"
push:
branches: [main]
Expand All @@ -19,7 +19,7 @@ on:
- "packages/database/**"
- "packages/web-*/**"
- "crates/recording/**"
- "pnpm-lock.yaml"
- "bun.lock"
- ".github/workflows/recording-reliability.yml"

permissions:
Expand All @@ -40,7 +40,7 @@ jobs:
- name: Verify recording contracts
working-directory: apps/web
run: |
pnpm exec vitest run \
bun run vitest run \
__tests__/unit/audio-level-publication.test.ts \
__tests__/unit/recording-output.test.ts \
__tests__/unit/recording-storage-lifecycle.test.ts \
Expand Down
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
.deepsec

Expand Down Expand Up @@ -36,13 +35,10 @@ outputs
*.sln
*.sw?
.turbo
bun.lock
pnpm-lock.yaml
.zed
.output
.vinxi
native-deps*
apps/storybook/storybook-static
.tinyb

**/.tinyb
Expand Down
2 changes: 0 additions & 2 deletions .npmrc

This file was deleted.

30 changes: 15 additions & 15 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ These rules are enforced by CI (`cargo clippy -D warnings`, Biome). Fixing them

### Zero-tolerance rules
- **Default to no code comments. Add a comment only after solving a bug or working through a complex issue, and only when it captures non-obvious context that a future investigator or reviewer genuinely needs** — e.g. why the fix looks the way it does, the upstream/platform bug being worked around, a non-obvious invariant or trade-off chosen after investigation, or a link to the PR/issue that explains the decision. Bad cases that remain banned: narrating what the code does, restating types, JSDoc that paraphrases parameter names, "TODO: refactor" or "this should be cleaner" notes, and any comment that just describes the change you are currently making. When in doubt, prefer better naming/types over a comment. Applies to every language: Rust, TS, JS, Python, shell, SQL, TOML, etc.
- **Never hand-edit generated files**: `**/tauri.ts`, `apps/desktop/src-tauri/gen/**`, `packages/ui-solid/src/auto-imports.d.ts`, Drizzle migration SQL under `packages/database/migrations/`. These are regenerated (e.g. `tauri.ts` only on debug desktop runs) but stay committed because CI typecheck and fresh clones depend on them; commit binding changes alongside the Rust change that produced them. For database schema changes, run `pnpm db:generate` and commit the generated SQL, snapshot, and journal changes alongside the schema change. Generating and committing these artifacts is required; modifying generated output by hand is prohibited. Note: `apps/desktop/src/utils/queries.ts` is hand-written, not generated — edit it normally.
- **Never start additional dev servers** (`pnpm dev`, `pnpm dev:web`, `pnpm dev:desktop`, Docker services). Assume they are already running.
- **Never hand-edit generated files**: `**/tauri.ts`, `apps/desktop/src-tauri/gen/**`, `packages/ui-solid/src/auto-imports.d.ts`, Drizzle migration SQL under `packages/database/migrations/`. These are regenerated (e.g. `tauri.ts` only on debug desktop runs) but stay committed because CI typecheck and fresh clones depend on them; commit binding changes alongside the Rust change that produced them. For database schema changes, run `bun run db:generate` and commit the generated SQL, snapshot, and journal changes alongside the schema change. Generating and committing these artifacts is required; modifying generated output by hand is prohibited. Note: `apps/desktop/src/utils/queries.ts` is hand-written, not generated — edit it normally.
- **Never start additional dev servers** (`bun run dev`, `bun run dev:web`, `bun run dev:desktop`, Docker services). Assume they are already running.

### Post-edit checks (run before you say "done")
- Prefer scoped, fast checks over full workspace gates. Do not run long full-repo checks by default.
- Touched any Rust file → `cargo fmt --all` and `cargo check -p <crate>`. Add `--all-targets`, `--workspace`, or clippy only when explicitly requested, when preparing CI/PR final validation, or when the change needs broader coverage.
- Touched any TS / JS / JSON / CSS / MD file → run the narrowest applicable formatter/linter on touched files first, such as `pnpm exec biome check --write <files>`. Use full `pnpm format`, `pnpm lint`, and `pnpm typecheck` only when explicitly requested or when the change spans shared types/packages.
- Touched DB schema → `pnpm db:generate` before relying on it.
- Touched any TS / JS / JSON / CSS / MD file → run the narrowest applicable formatter/linter on touched files first, such as `bun run biome check --write <files>`. Use full `bun run format`, `bun run lint`, and `bun run typecheck` only when explicitly requested or when the change spans shared types/packages.
- Touched DB schema → `bun run db:generate` before relying on it.

### Rust — write the clippy-clean form the FIRST time
All patterns below are `deny` in the workspace `[workspace.lints]` in `Cargo.toml`. Do not emit the left column; always emit the right column.
Expand Down Expand Up @@ -56,18 +56,18 @@ Additionally, `unused_must_use = "deny"` applies to all Rust code: every `Result
- `scripts/*`, `infra/`, and `packages/local-docker/` for tooling and local services.

## Build, Test, Develop
- Install: `pnpm install`; setup: `pnpm env-setup` then `pnpm cap-setup`.
- Dev: `pnpm dev` (web+desktop). Desktop only: `pnpm dev:desktop`. Web only: `pnpm dev:web` or `cd apps/web && pnpm dev`.
- Build: `pnpm build` (Turbo). Desktop release: `pnpm tauri:build`.
- DB: `pnpm db:generate` → `pnpm db:push` → `pnpm db:studio`.
- Docker: `pnpm docker:up | docker:stop | docker:clean`.
- Quality: `pnpm lint`, `pnpm format`, `pnpm typecheck`. Rust: `cargo build -p <crate>`, `cargo test -p <crate>`.
- Install: `bun install`; setup: `bun run env-setup` then `bun run cap-setup`.
- Dev: `bun run dev` (web+desktop). Desktop only: `bun run dev:desktop`. Web only: `bun run dev:web` or `cd apps/web && bun run dev`.
- Build: `bun run build` (Turbo). Desktop release: `bun run tauri:build`.
- DB: `bun run db:generate` → `bun run db:push` → `bun run db:studio`.
- Docker: `bun run docker:up | docker:stop | docker:clean`.
- Quality: `bun run lint`, `bun run format`, `bun run typecheck`. Rust: `cargo build -p <crate>`, `cargo test -p <crate>`.

## Coding Style & Naming
- TypeScript / JS / JSON / CSS: **tab indent** and **double-quoted** strings, enforced by Biome (see `biome.json`). Do not configure per-file overrides.
- Rust: `rustfmt` default style + the denied clippy lints in the Pre-Generation Invariants above.
- Naming: files kebab‑case (`user-menu.tsx`); React/Solid components PascalCase; hooks `useX`; Rust modules snake_case; crates kebab‑case.
- Runtime: Node 20, pnpm 10.5.2, Rust 1.88+, Docker for MySQL/MinIO.
- Runtime: Node 20, Bun 1.4.0, Rust 1.88+, Docker for MySQL/MinIO.

(See **Pre-Generation Invariants** at the top of this file for the comments policy and the denied clippy/Biome patterns. Those are the source of truth — do not duplicate or weaken them here.)

Expand All @@ -82,11 +82,11 @@ Additionally, `unused_must_use = "deny"` applies to all Rust code: every `Result
- PRs: clear description, linked issues, screenshots/GIFs for UI, env/migration notes. Keep scope tight and update docs when behavior changes.

## Agent‑Specific Practices
- Do not start extra servers; use `pnpm dev:web` or `pnpm dev:desktop` as needed.
- Do not start extra servers; use `bun run dev:web` or `bun run dev:desktop` as needed.
- Prefer existing scripts and Turbo filters over ad‑hoc commands; clear `.turbo` only when necessary.
- Database flow: always `db:generate` → `db:push` before relying on new schema.
- Keep secrets out of VCS; configure via `.env` from `pnpm env-setup`.
- macOS note: desktop permissions (screen/mic) apply to the terminal running `pnpm dev:desktop`.
- Keep secrets out of VCS; configure via `.env` from `bun run env-setup`.
- macOS note: desktop permissions (screen/mic) apply to the terminal running `bun run dev:desktop`.
- All other agent-facing rules (comments policy, no editing generated files, clippy/Biome shape, post-edit gates) live in **Pre-Generation Invariants** at the top of this file.

## Deep Investigation Default
Expand All @@ -112,5 +112,5 @@ Prefer the smallest correct fix, but only after checking whether the narrow fix
Before declaring any task complete, the agent should run the fastest useful check for every file type it touched and report anything skipped.

- **Rust**: `cargo fmt --all` and `cargo check -p <crate>` for the touched crate. Add `--all-targets`, `--workspace`, or `cargo clippy -p <crate> --all-targets -- -D warnings` only for explicit requests, CI/PR final validation, or changes that need broader coverage.
- **TS / JS / JSON / CSS / MD**: prefer scoped checks such as `pnpm exec biome check --write <files>`. Use full `pnpm format`, `pnpm lint`, and `pnpm typecheck` only when explicitly requested or when the change is broad enough to justify it.
- **TS / JS / JSON / CSS / MD**: prefer scoped checks such as `bun run biome check --write <files>`. Use full `bun run format`, `bun run lint`, and `bun run typecheck` only when explicitly requested or when the change is broad enough to justify it.
- If a scoped check fails, fix the violation in the source (do NOT suppress with `#[allow(...)]`, `// biome-ignore`, or `any` unless explicitly approved). The Pre-Generation Invariants show the correct form for every denied lint.
Loading
Loading