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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
env:
# CI runs no git hooks, so skip the cargo:hk source build (~3 min on every run).
# node/bun are still provisioned from mise.toml for parity with local dev.
MISE_DISABLE_TOOLS: cargo:hk
MISE_DISABLE_TOOLS: cargo:hk,mr-boxington
steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
Expand Down
32 changes: 27 additions & 5 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,34 @@ concurrency:
jobs:
build:
runs-on: ubuntu-latest
env:
CARGO_INCREMENTAL: 0
steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
persist-credentials: false

# The toolchain (and rustfmt/clippy components) is selected by
# rust-toolchain.toml via the runner's preinstalled rustup — no
# third-party action needed.
# rust-toolchain.toml via the runner's preinstalled rustup.
- name: Install pinned toolchain
run: rustup show active-toolchain || rustup toolchain install

# After the toolchain step: the cache key hashes the `rustc` on PATH.
- name: Set up mbx cache
uses: jdx/mr-boxington-action@88acf2bb50552c7c508cbac13e5f8c576b95b1de # v1.7.3
with:
version: 1.29.2
cache-generation: test-v1

- name: Format check
run: cargo fmt --all -- --check

- name: Clippy
run: cargo clippy --all-targets --all-features -- -D warnings
run: mbx clippy --all-targets --all-features -- -D warnings

- name: Test
run: cargo test --all-features --locked --workspace
run: mbx test --all-features --locked --workspace

ignored-tests:
# Network-gated: these tests download tree-sitter grammars from GitHub
Expand All @@ -60,11 +71,22 @@ jobs:
# grammar-fetch / parser-compat regressions.
if: github.event_name == 'workflow_dispatch' || github.event_name == 'schedule'
runs-on: ubuntu-latest
env:
CARGO_INCREMENTAL: 0
steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
persist-credentials: false

- name: Install pinned toolchain
run: rustup show active-toolchain || rustup toolchain install

- name: Set up mbx cache
uses: jdx/mr-boxington-action@88acf2bb50552c7c508cbac13e5f8c576b95b1de # v1.7.3
with:
version: 1.29.2
cache-generation: ignored-v1

- name: Test (ignored / network-gated)
run: cargo test --all-features --locked --workspace -- --ignored
run: mbx test --all-features --locked --workspace -- --ignored
13 changes: 12 additions & 1 deletion .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
runs-on: ubuntu-latest
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
CARGO_INCREMENTAL: 0
steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
Expand All @@ -27,11 +28,21 @@ jobs:
fetch-depth: 0

# --- Rust coverage (coverage/rust-lcov.info) ---
- name: Install pinned toolchain
run: rustup show active-toolchain || rustup toolchain install

# rust-toolchain.toml uses `profile = "minimal"`, so the llvm-tools-preview
# component (required by cargo-llvm-cov) is not present by default.
- name: Add llvm-tools-preview component
run: rustup component add llvm-tools-preview

# After the toolchain and llvm-tools steps: the cache key hashes the `rustc` on PATH.
- name: Set up mbx cache
Comment thread
amondnet marked this conversation as resolved.
Resolved
uses: jdx/mr-boxington-action@88acf2bb50552c7c508cbac13e5f8c576b95b1de # v1.7.3
with:
version: 1.29.2
cache-generation: coverage-v1

- name: Install cargo-llvm-cov
uses: taiki-e/install-action@9e1e5806d4a4822de933115878265be9aaa786d9 # v2
with:
Expand All @@ -42,7 +53,7 @@ jobs:
# offline (see ADR-0004). --all-features mirrors the Rust CI gate.
run: |
mkdir -p coverage
cargo llvm-cov --workspace --locked --all-features --lcov --output-path coverage/rust-lcov.info
mbx llvm-cov --workspace --locked --all-features --lcov --output-path coverage/rust-lcov.info

- name: Upload Rust coverage to Codecov
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
Expand Down
1 change: 1 addition & 0 deletions .miserc.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
auto_env = true
Comment thread
amondnet marked this conversation as resolved.
Resolved
Comment thread
amondnet marked this conversation as resolved.
Resolved
30 changes: 27 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ By participating, you agree to abide by our [Code of Conduct](./CODE_OF_CONDUCT.

## Getting started

`csp` is Rust-first (the workspace under `crates/`) with a thin JS toolchain for the npm wrapper and repo tooling. [mise](https://mise.jdx.dev/) pins the tool versions (node, bun, and the `hk` git-hook manager); the Rust toolchain is pinned separately by `rust-toolchain.toml`.
`csp` is Rust-first (the workspace under `crates/`) with a thin JS toolchain for the npm wrapper and repo tooling. [mise](https://mise.jdx.dev/) pins the tool versions (node, bun, the `hk` git-hook manager, and the `mbx` Cargo build cache); the Rust toolchain is pinned separately by `rust-toolchain.toml`.

```bash
git clone https://github.com/pleaseai/code-search.git
cd code-search
mise install # install pinned tool versions (node, bun, hk) and set up git hooks
mise install # install pinned tool versions (node, bun, hk, mbx) and set up git hooks
bun install # install JS dependencies
```

If you do not use mise, install the versions listed in `mise.toml` and `rust-toolchain.toml` manually, then run `bun install`. Rust builds use the standard `cargo` toolchain.
If you do not use mise, install the versions listed in `mise.toml` and `rust-toolchain.toml` manually, then run `bun install`. Rust builds use the standard `cargo` toolchain; `mbx` is optional (see [Faster local builds](#faster-local-builds-optional)).

## Development workflow

Expand All @@ -33,6 +33,30 @@ mise run check # full pre-commit gate: JS lint/typecheck + Rust fmt/clippy

For Rust changes, also run `cargo fmt --all` and `cargo clippy --all-targets --all-features -- -D warnings` (both are part of `mise run check`).

### Faster local builds (optional)

CI compiles Rust through [mbx (mr boxington)](https://mr-boxington.jdx.dev), a shared Cargo build
cache, via `jdx/mr-boxington-action`. `mise install` also installs `mbx` locally (pinned in
`mise.toml`), so a build in one worktree warms every other worktree. Run Cargo through it:

```bash
mise exec -- mbx build # or: mise exec -- mbx test --all-features --locked --workspace
mise exec -- mbx explain --last # why a build did or did not hit the cache
```

mise's `mr_boxington` Rust option is deliberately not used: a `rust` entry in `mise.toml`
needs a version, which would override `rust-toolchain.toml` (the sole owner of the Rust channel).
So plain `cargo` is not routed through `mbx`; call `mbx` explicitly. Set
`CARGO_INCREMENTAL=0` for the best hit rate.

There is no prebuilt `mbx` for Intel macOS, so `mise.macos-x64.toml` (loaded through `auto_env` in
`.miserc.toml`) builds it from crates.io via the `cargo:mbx` backend (Rust 1.91 or newer). Without
mise, run `cargo install mbx --version 1.29.2 --locked`.
Comment thread
amondnet marked this conversation as resolved.
Resolved
Comment thread
amondnet marked this conversation as resolved.
Resolved

`mbx` wraps `rustc` itself, so it **defers to any `RUSTC_WRAPPER` already set** (for example
`RUSTC_WRAPPER=sccache` in a shell profile) and then caches nothing. Unset the wrapper before
using it. The `mbx[cache]` summary line it prints shows the hit count.

## Commit messages

We follow [Conventional Commits](https://www.conventionalcommits.org/): `type(scope): subject`, where `type` is one of `feat`, `fix`, `docs`, `refactor`, `test`, `chore`, etc. Breaking changes include a `BREAKING CHANGE:` footer. Versioning and the changelog are generated automatically from these messages, so accurate types matter.
Expand Down
6 changes: 6 additions & 0 deletions mise.macos-x64.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# mr-boxington ships no darwin/x86_64 release archive, so build mbx from crates.io.
[tools]
mr-boxington = "1.29.2"

[tool_alias]
mr-boxington = "cargo:mbx"
Comment thread
amondnet marked this conversation as resolved.
Resolved
Comment thread
amondnet marked this conversation as resolved.
Resolved
5 changes: 4 additions & 1 deletion mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
# This repo is Rust-first (crates/) with a thin JS toolchain for the npm/ wrapper and SDK.
# - The Rust toolchain (channel, rustfmt, clippy) is owned solely by rust-toolchain.toml —
# do not double-pin it here.
# - Only node/bun (JS lint + typecheck) and hk (the git hook manager) are pinned via mise.
# - Only node/bun (JS lint + typecheck), hk (the git hook manager) and mbx (the Cargo build
# cache CLI) are pinned via mise. mise's `mr_boxington` Rust option is not used: a `rust`
# entry requires a version, which would override rust-toolchain.toml.

[tools]
node = "24"
Expand All @@ -15,6 +17,7 @@ bun = "1.3.14" # matches package.json packageManager
# Pinned to match the v1.48.0 hk.pkl amends — keep the two in sync on upgrades.
# Details: dev-tooling → references/git-hooks.md
"cargo:hk" = "1.48.0"
mr-boxington = "1.29.2"
Comment thread
amondnet marked this conversation as resolved.
Resolved
Comment thread
amondnet marked this conversation as resolved.
Resolved
Comment thread
amondnet marked this conversation as resolved.
Resolved

[env]
# Wrap hooks in `mise x` so the mise-managed node/bun are on PATH
Expand Down
Loading