Imported from code-yeongyu/senpi (
crates/senpi-grep/AGENTS.md). Install upstream withnpx skills add code-yeongyu/senpi --skill senpi-grep. Copyright stays with the author.
crates/senpi-grep
senpi-grep is the Rust/N-API native grep implementation consumed by packages/coding-agent and bundled into Senpi binaries.
STRUCTURE
src/lib.rs N-API exports and ABI marker
build.rs N-API build setup
index.js, index.d.ts Node package loader/types
ABI CONTRACT
NATIVE_GREP_ABI_VERSION = "1"in the TypeScript loader and the exported__senpiGrepAbi1marker must agree; the Rust constant lives insrc/lib.rs.- ABI versioning is intentionally separate from CalVer. Change it only for an incompatible native contract and update both crate and loader tests.
index.jsandindex.d.tsare NAPI-RS-generated loader output; never hand-edit them. Regenerate withnpm exec --yes --package @napi-rs/cli@3.7.2 -- napi build --platformfromcrates/senpi-grep.- Keep the six targets declared in
package.jsonaligned when changing exports or build paths. Grep prebuilds are never tracked in git (crates/senpi-grep/*.nodeandpackages/coding-agent/native/prebuilds/); other hosts come fromnative-prebuilds.yml.
VALIDATION
- Run
cargo test -p senpi-grep --lockedfrom the repository root. - Rebuild the local addon with
npm exec --yes --package @napi-rs/cli@3.7.2 -- napi build --platform --releasefromcrates/senpi-grepafter native changes.