Imported from Archont561/ts-monorepo-template (
packages/native/npm/native/AGENTS.md). Install upstream withnpx skills add Archont561/ts-monorepo-template --skill native. Copyright stays with the author.
AGENTS.md — @myorg/native
The npm package wrapping the
nativecrate. Orientation in README.md, current state in CONTEXT.md.
Rules
- Never commit generated output:
index.js,index.d.ts,*.node,*.wasmand thenative-*-<platform>/packages are gitignored and rebuilt. - Never build a "cross-platform" package on a dev machine and publish it. Per-platform packages come from CI:
mnative create-npm-dirs+mnative artifacts. - Use
mnativefor everything —mnative checkfor the fast inner loop,mnative napi:build --only nativefor artifacts. Do notcdintocrates/and run cargo by hand. - Targets are declared in this package's
napi.targets; adding one grows the CI matrix automatically. Do not edit the workflow. - Rust lives in
../../crates/native(thin#[napi]wrappers) and../../crates/shared(the logic), TypeScript types are generated here. Never put#[napi]code in this directory. - Keep the binding thin: new Rust logic goes in a pure crate (
mnative add <name> --pure), the binding only wraps it. Mirror a new Cargo path dep as@myorg/native-crates: workspace:*viamnative sync. - Never add
typescriptorbunuphere —@myorg/tsand@myorg/bunupown them. - Import the addon only from server modules; a browser bundle cannot load
.node. - Keep the JS fallback in
@myorg/externalworking — native is optional at runtime.
File layout
| Path | Role |
|---|---|
package.json |
napi config: binaryName, targets, wasm |
tsconfig.json |
Extends @myorg/ts/library.json |
turbo.json |
Package tasks |
tests/ |
Bun tests against the built addon |
index.js / index.d.ts |
Generated — gitignored |
Before marking a task done
-
mnative fmt:check -
mnative clippy -
mnative check -
mnative test -
bun run build(napi build for this package) -
bun run typecheck - No generated file in the diff