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
4 changes: 2 additions & 2 deletions .claude/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ The script caps the source diff at **4000 lines**. If a batch of commits exceeds

Defines tool permissions for Claude Code:

- **Always allow**: `yarn build/lint/format/test`, read-only git commands, reading all source files, writing/editing `.claude/**` and `**/CLAUDE.md`, common inspection commands (`ls`, `which`, etc.)
- **Ask before**: destructive git operations (`commit`, `push`, `reset`, `checkout`, etc.), `yarn clean`
- **Always allow**: `pnpm build/lint/format/test`, read-only git commands, reading all source files, writing/editing `.claude/**` and `**/CLAUDE.md`, common inspection commands (`ls`, `which`, etc.)
- **Ask before**: destructive git operations (`commit`, `push`, `reset`, `checkout`, etc.), `pnpm clean`
- **Always deny**: force push, `rm -rf`, `sudo`, reading build artifacts and binary files

Also configures MCP servers:
Expand Down
18 changes: 9 additions & 9 deletions .claude/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"respectGitIgnore": true,
"permissions": {
"allow": [
"Bash(yarn build)",
"Bash(yarn lint*)",
"Bash(yarn format*)",
"Bash(yarn typecheck)",
"Bash(yarn test)",
"Bash(yarn check-audio-enum-sync)",
"Bash(yarn workspace *)",
"Bash(pnpm build)",
"Bash(pnpm lint*)",
"Bash(pnpm format*)",
"Bash(pnpm typecheck)",
"Bash(pnpm test)",
"Bash(pnpm check-audio-enum-sync)",
"Bash(pnpm --filter *)",
"Bash(git status)",
"Bash(git diff*)",
"Bash(git log*)",
Expand Down Expand Up @@ -58,7 +58,7 @@
"Bash(git reset*)",
"Bash(git checkout *)",
"Bash(git stash*)",
"Bash(yarn clean)"
"Bash(pnpm clean)"
],
"deny": [
"Bash(git push --force*)",
Expand Down Expand Up @@ -91,7 +91,7 @@

"Read(**/CMakeFiles/**)",

"Read(yarn.lock)",
"Read(pnpm-lock.yaml)",
"Read(**/Gemfile.lock)",
"Read(**/Podfile.lock)",

Expand Down
103 changes: 58 additions & 45 deletions .claude/skills/build-compilation-dependencies/SKILL.md

Large diffs are not rendered by default.

13 changes: 7 additions & 6 deletions .claude/skills/build-compilation-dependencies/build-details.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ Resolves two paths that vary per machine/monorepo layout:

These vary per machine/monorepo layout, so they're computed at install time rather than hardcoded.

`ReactCommon` is joined onto react-native's **own** directory (`File.dirname(require.resolve('react-native/package.json'))`), never `<that dir>/../react-native`: isolated layouts (pnpm, Yarn's pnpm linker) store the package in a folder not named `react-native` (e.g. `.store/react-native-virtual-<hash>/package`), and the sibling lookup made `pod install` fail for those consumers. The `REACT_NATIVE_NODE_MODULES_DIR` fallback accepts either react-native's directory or the `node_modules` containing it.
`ReactCommon` is joined onto react-native's **own** directory (`File.dirname(require.resolve('react-native/package.json'))`), never `<that dir>/../react-native`: the script runs in consumers' projects under any package manager, and Yarn's pnpm linker stores the package in a folder not named `react-native` (`.store/react-native-virtual-<hash>/package`), so the sibling lookup made `pod install` fail there. The `REACT_NATIVE_NODE_MODULES_DIR` fallback accepts either react-native's directory or the `node_modules` containing it.

### System frameworks linked

Expand All @@ -246,7 +246,7 @@ Enables New Architecture: `ENV['RCT_NEW_ARCH_ENABLED'] = '1'` at the top. This i

The podfile resolves the minimum iOS version from RN's `min_ios_version_supported` helper — do not hardcode `14.0` in the Podfile itself.

**No hard-coded `node_modules` paths in fabric-example.** `RN_RELATIVE_PATH` (Podfile), `reactNativeDir` / `codegenDir` / `cliFile` / `hermesCommand` (`android/app/build.gradle`), the `@react-native/gradle-plugin` `includeBuild` (`settings.gradle`) and `apps/common-app/scripts/dependencies.js` all resolve packages with Node, so they hold for hoisted and isolated `node_modules`. Packages that are react-native's dependencies (gradle-plugin, codegen, hermes-compiler) are resolved from react-native's location, since the app doesn't declare them. The pbxproj sets `REACT_NATIVE_PATH` only at project level (written by `pod install` from `RN_RELATIVE_PATH`); targets inherit it — don't add target-level overrides. fabric-example declares every package its own JS config uses (babel preset, module-resolver, metro-config, RN CLI, `react-native-worklets` for its babel plugin) instead of relying on common-app's being hoisted.
**No hard-coded `node_modules` paths in fabric-example.** `reactNativeDir` / `codegenDir` / `cliFile` / `hermesCommand` (`android/app/build.gradle`), the `@react-native/gradle-plugin` `includeBuild` (`settings.gradle`) and `apps/common-app/scripts/dependencies.js` all resolve packages with Node, so they hold for hoisted and isolated `node_modules`. Packages that are react-native's dependencies (gradle-plugin, codegen, hermes-compiler) are resolved from react-native's location, since the app doesn't declare them. The Podfile takes react-native's path from the RN CLI (`config[:reactNativePath]` in the app target) and reuses it for the test-host target and `post_install`, so the test host must stay declared after the app target. Every target must use that same path string: under pnpm, Node's `require.resolve` returns the store path (`node_modules/.pnpm/react-native@…_<hash>/…`) while the CLI returns the app's link, and CocoaPods rejects the same pods from two different paths ("multiple dependencies with different sources"). The pbxproj sets `REACT_NATIVE_PATH` only at project level; `react_native_post_install` writes the resolved store path there, so `post_install` overwrites it with the link path to keep the hash out of the pbxproj. Targets inherit it — don't add target-level overrides. fabric-example declares every package its own JS config uses (babel preset, module-resolver, metro-config, RN CLI, `react-native-worklets` for its babel plugin) instead of relying on common-app's being hoisted.

---

Expand All @@ -256,18 +256,19 @@ The podfile resolves the minimum iOS version from RN's `min_ios_version_supporte

No Gradle, no Xcode, no prebuilt Android libraries needed.

### Sources resolved from `node_modules` (not from monorepo source directly)
### Sources and headers resolved from the package directory

```cmake
set(ROOT ${CMAKE_SOURCE_DIR}/../../../../..)
set(REACT_NATIVE_AUDIO_API_DIR "${ROOT}/node_modules/react-native-audio-api")
set(PACKAGE_DIR ${CMAKE_SOURCE_DIR}/../../..)
set(REACT_NATIVE_DIR "${PACKAGE_DIR}/node_modules/react-native")
set(REACT_NATIVE_AUDIO_API_DIR "${PACKAGE_DIR}")

file(GLOB_RECURSE RNAUDIOAPI_SRC CONFIGURE_DEPENDS
"${REACT_NATIVE_AUDIO_API_DIR}/common/cpp/audioapi/*.cpp"
)
```

This means **tests build against the installed/published version of the library** in `node_modules`, not the local `packages/` source directly. In a monorepo with yarn workspaces, `node_modules/react-native-audio-api` symlinks to `packages/react-native-audio-api`, so this works fine locally.
Tests compile the package's own `common/cpp` sources. react-native's headers come from the package's own `node_modules/react-native`: it is a devDependency of the library, so pnpm always links it there; the repo root `node_modules` only holds the root's own dependencies. The WPT addon (`wpt_tests/CMakeLists.txt`) and both clangd CMake projects use the same package-local paths (worklets: its own `node_modules/react-native` and `react-native-worklets`).

### Excluded from tests (not relevant for unit testing)

Expand Down
14 changes: 7 additions & 7 deletions .claude/skills/flow/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ New test files are picked up automatically by `GLOB_RECURSE` — no CMakeLists e

Run with:
```bash
yarn test # from repo root
pnpm test # from repo root
```

#### JS/TS tests (Jest)
Expand All @@ -202,7 +202,7 @@ Path: `packages/react-native-audio-api/tests/`

Run with:
```bash
yarn workspace react-native-audio-api test
pnpm --filter react-native-audio-api test
```

#### Example app (fabric-example)
Expand Down Expand Up @@ -233,11 +233,11 @@ Cover:
See the `post-work-checks` skill. At minimum before any PR:

```bash
yarn format # auto-fix formatting
yarn lint # JS/TS/C++/Kotlin linting
yarn typecheck # TypeScript
yarn test # C++ Google Tests
yarn check-audio-enum-sync # if you touched AudioEvent enums
pnpm format # auto-fix formatting
pnpm lint # JS/TS/C++/Kotlin linting
pnpm typecheck # TypeScript
pnpm test # C++ Google Tests
pnpm check-audio-enum-sync # if you touched AudioEvent enums
```

---
Expand Down
90 changes: 45 additions & 45 deletions .claude/skills/post-work-checks/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description: >
Documents what lefthook pre-commit hooks run automatically vs what must be run manually.
Use at the end of any implementation task before opening a PR.
Trigger phrases: "post-work", "before PR", "before commit", "check quality", "run linter",
"run tests", "format code", "lefthook", "pre-commit", "yarn test", "yarn lint",
"run tests", "format code", "lefthook", "pre-commit", "pnpm test", "pnpm lint",
"validate", "validate:fast", "validate:full".
---

Expand All @@ -22,12 +22,12 @@ Run these checks after any code change and before opening a PR.
CI always runs the **fast** tier (format, lint, typecheck, enum sync, TS build, C++ smoke + JS tests). Extended C++ categories (e.g. graph) run from `tests.yml` when matching paths change, or via `workflow_dispatch` booleans. CI does **not** build Android Gradle, iOS pods, or example apps. Use `validate.sh` locally to close that gap:

```bash
yarn validate:fast # CI parity — always run before opening a PR
yarn validate:cpp # C++ smoke
yarn validate:cpp-extended # C++ extended (all categories)
yarn validate:android # Android native build (requires ANDROID_HOME)
yarn validate:ios # iOS native build (macOS only)
yarn validate:full # --fast + C++ extended + --android + --ios
pnpm validate:fast # CI parity — always run before opening a PR
pnpm validate:cpp # C++ smoke
pnpm validate:cpp-extended # C++ extended (all categories)
pnpm validate:android # Android native build (requires ANDROID_HOME)
pnpm validate:ios # iOS native build (macOS only)
pnpm validate:full # --fast + C++ extended + --android + --ios
```

Equivalent: `./scripts/validate.sh --fast` (etc.)
Expand All @@ -43,18 +43,18 @@ Equivalent: `./scripts/validate.sh --fast` (etc.)
| `ios/audioapi/` | `--fast` + `--ios` |
| `CMakeLists.txt`, `build.gradle`, `podspec` | `--full` |

Graph changes under `common/cpp/audioapi/core/utils/graph/` → also run `yarn validate:cpp-extended` or `yarn workspace react-native-audio-api test:cpp:extended -- graph`.
Graph changes under `common/cpp/audioapi/core/utils/graph/` → also run `pnpm validate:cpp-extended` or `pnpm --filter react-native-audio-api test:cpp:extended -- graph`.

---

## Quick Reference — Individual Commands

```bash
yarn format # auto-fix all formatting
yarn lint # lint all workspaces
yarn typecheck # TypeScript type checking
yarn test # C++ + JS tests (library workspace)
yarn check-audio-enum-sync # only if a C++/Kotlin mirrored enum touched
pnpm format # auto-fix all formatting
pnpm lint # lint all workspaces
pnpm typecheck # TypeScript type checking
pnpm test # C++ + JS tests (library workspace)
pnpm check-audio-enum-sync # only if a C++/Kotlin mirrored enum touched
```

---
Expand All @@ -67,14 +67,14 @@ Hooks run when lefthook is installed (`lefthook install`).

| Hook | Command |
|---|---|
| Format check | `yarn format:check` (JS via Prettier, C++ via clang-format, Kotlin via ktlint) |
| Lint | `yarn lint` (JS/TS + C++ + Kotlin) |
| Type check | `yarn typecheck` (only when staged files match `*.{js,ts,jsx,tsx}`) |
| Format check | `pnpm format:check` (JS via Prettier, C++ via clang-format, Kotlin via ktlint) |
| Lint | `pnpm lint` (JS/TS + C++ + Kotlin) |
| Type check | `pnpm typecheck` (only when staged files match `*.{js,ts,jsx,tsx}`) |
| Commit message | `commitlint` |

**If a hook fails, the commit is aborted.** Fix the issue and re-commit — do NOT use `--no-verify`.

There is no pre-push hook — `yarn validate:fast` (and native/C++ extended tiers) are run manually before opening a PR. Native builds (`validate:android`, `validate:ios`, `validate:full`) and extended C++ (`validate:cpp-extended`) are never run by lefthook.
There is no pre-push hook — `pnpm validate:fast` (and native/C++ extended tiers) are run manually before opening a PR. Native builds (`validate:android`, `validate:ios`, `validate:full`) and extended C++ (`validate:cpp-extended`) are never run by lefthook.

---

Expand All @@ -85,48 +85,48 @@ These are not covered by lefthook:
### CI-parity gate (before opening a PR)

```bash
yarn validate:fast
pnpm validate:fast
```

### Native compile checks (when platform code changes)

```bash
yarn validate:android # yarn workspace … build:android (~3–4 min)
yarn validate:ios # yarn workspace … build:ios (macOS only)
yarn validate:full # --fast + C++ extended + --android + --ios
pnpm validate:android # pnpm --filter … build:android (~3–4 min)
pnpm validate:ios # pnpm --filter … build:ios (macOS only)
pnpm validate:full # --fast + C++ extended + --android + --ios
```

Autolinking registers workspace packages under their real `packages/` path (`apps/common-app/scripts/dependencies.js` follows the `node_modules` symlink), so Gradle and CocoaPods build local edits in `packages/react-native-audio-api/` directly.

### Extended graph (when graph / audio-thread code changes)

```bash
yarn validate:cpp-extended # all extended categories
# or: yarn workspace react-native-audio-api test:cpp:extended -- graph
pnpm validate:cpp-extended # all extended categories
# or: pnpm --filter react-native-audio-api test:cpp:extended -- graph
```

### C++ tests only

```bash
yarn validate:cpp # smoke via validate.sh
yarn workspace react-native-audio-api run test:cpp # smoke
yarn workspace react-native-audio-api run test:cpp:full # smoke + all extended
pnpm validate:cpp # smoke via validate.sh
pnpm --filter react-native-audio-api test:cpp # smoke
pnpm --filter react-native-audio-api test:cpp:full # smoke + all extended
```

**When**: after any change to `common/cpp/audioapi/core/`, `dsp/`, or `utils/` C++ files. Prefer smoke for a fast C++-only loop; see `common/cpp/test/TESTING.md`. Run `yarn validate:fast` before opening a PR.
**When**: after any change to `common/cpp/audioapi/core/`, `dsp/`, or `utils/` C++ files. Prefer smoke for a fast C++-only loop; see `common/cpp/test/TESTING.md`. Run `pnpm validate:fast` before opening a PR.

### Library unit tests (JS + C++)

```bash
yarn test # from monorepo root — runs test:js + test:cpp
pnpm test # from monorepo root — runs test:js + test:cpp
```

**When**: after any change to C++ files or TypeScript files in `src/`. Prefer this for a quick local test loop covering both TS and C++ logic; run `yarn validate:fast` before opening a PR.
**When**: after any change to C++ files or TypeScript files in `src/`. Prefer this for a quick local test loop covering both TS and C++ logic; run `pnpm validate:fast` before opening a PR.

### Native enum sync check

```bash
yarn check-audio-enum-sync
pnpm check-audio-enum-sync
```

Runs `packages/react-native-audio-api/scripts/check-enum-sync.sh`, which compares every
Expand All @@ -149,21 +149,21 @@ These scripts live on the `react-native-audio-api` workspace. From the monorepo

```bash
# TypeScript/JavaScript
yarn workspace react-native-audio-api lint:js
yarn workspace react-native-audio-api format:js
pnpm --filter react-native-audio-api lint:js
pnpm --filter react-native-audio-api format:js

# Shared C++
yarn workspace react-native-audio-api format:common
yarn workspace react-native-audio-api lint:cpp
pnpm --filter react-native-audio-api format:common
pnpm --filter react-native-audio-api lint:cpp

# Android
yarn workspace react-native-audio-api format:android:cpp
yarn workspace react-native-audio-api format:android:kotlin
yarn workspace react-native-audio-api lint:kotlin
pnpm --filter react-native-audio-api format:android:cpp
pnpm --filter react-native-audio-api format:android:kotlin
pnpm --filter react-native-audio-api lint:kotlin

# iOS
yarn workspace react-native-audio-api format:ios
yarn workspace react-native-audio-api lint:ios
pnpm --filter react-native-audio-api format:ios
pnpm --filter react-native-audio-api lint:ios
```

---
Expand All @@ -172,12 +172,12 @@ yarn workspace react-native-audio-api lint:ios

Later steps may surface issues caused by earlier ones — run in this order:

1. `yarn format` — fix formatting first (removes noise from lint)
2. `yarn lint` — catch remaining code issues
3. `yarn typecheck` — catch TypeScript errors
4. `yarn validate:fast` — full CI-parity gate (or `yarn test` / `test:cpp` for a quick local loop; always run `--fast` before opening a PR)
5. `yarn validate:cpp-extended` — when graph / audio-thread code changed
6. `yarn validate:android` / `yarn validate:ios` / `yarn validate:full` — when native code or build files changed (see decision table above)
1. `pnpm format` — fix formatting first (removes noise from lint)
2. `pnpm lint` — catch remaining code issues
3. `pnpm typecheck` — catch TypeScript errors
4. `pnpm validate:fast` — full CI-parity gate (or `pnpm test` / `test:cpp` for a quick local loop; always run `--fast` before opening a PR)
5. `pnpm validate:cpp-extended` — when graph / audio-thread code changed
6. `pnpm validate:android` / `pnpm validate:ios` / `pnpm validate:full` — when native code or build files changed (see decision table above)

---

Expand Down
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ packages/react-native-audio-api/common/cpp/audioapi/libs/** linguist-vendored
apps/** linguist-vendored
docs/** linguist-vendored
.github/** linguist-vendored
.yarn/** linguist-vendored
packages/audiodocs/** linguist-documentation
packages/react-native-audio-api/src/web-core/custom/signalsmithStretch/* linguist-vendored
2 changes: 1 addition & 1 deletion .github/actions/checkout-with-node/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ inputs:
required: false
default: '.nvmrc'
cache:
description: 'Package manager to cache (e.g. yarn, npm). Leave empty to disable caching.'
description: 'Package manager to cache (e.g. pnpm, npm). Leave empty to disable caching.'
required: false
default: ''

Expand Down
18 changes: 18 additions & 0 deletions .github/actions/setup-pnpm/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Setup pnpm
description: Install pnpm and the workspace dependencies, caching the pnpm store

runs:
using: composite
steps:
- name: Install pnpm
uses: pnpm/action-setup@v6

- name: Cache the pnpm store
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile
shell: bash
22 changes: 0 additions & 22 deletions .github/actions/setup-yarn/action.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ runs:
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-23 200
clang-format --version

- name: Setup Yarn
uses: ./.github/actions/setup-yarn
- name: Setup pnpm
uses: ./.github/actions/setup-pnpm
Loading
Loading