napi-binding
Skill1 starsChanged 6 months agoMITView on GitHub
Patterns for exposing ProcessFork Rust APIs to TypeScript via napi-rs 2.x.
- Installs packages
In this repository5 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- kvcache-formatSkill
- pyo3-bindingSkill
- rust-patternSkill
- test-harnessSkill
The file
Files
napi-rs binding patterns
Function exposure
use napi_derive::napi;
#[napi]
pub async fn snapshot(agent_id: String) -> napi::Result<String> {
pf_core::snapshot(&agent_id)
.await
.map(|cid| cid.to_string())
.map_err(|e| napi::Error::from_reason(e.to_string()))
}async fn exposed via #[napi] returns a JS Promise automatically when the
tokio_rt feature is enabled (already on in workspace).
Build
napi build --release from crates/pf-ts/. Outputs an index.node per
target. Cross-compile in CI: napi build --target aarch64-apple-darwin,
etc.
Package
crates/pf-ts/package.json declares the napi.binaryName and per-platform
optional deps. Users npm install @processfork/sdk and napi resolves the
right binary automatically.
Types
napi build auto-generates index.d.ts. Don't hand-edit; if you need
richer types wrap in TypeScript at crates/pf-ts/ts/index.ts.
Errors
Map pf_core::Error via napi::Error::from_reason for v1; richer error
codes in v1.1.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

