Skip to content

Commit d35e892

Browse files
authored
docs: add native architecture guidance (#265)
1 parent 25379ec commit d35e892

3 files changed

Lines changed: 32 additions & 4 deletions

File tree

‎AGENTS.md‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- Use repo Node.js/pnpm versions (`package.json`)
66
- `pnpm` workspace; shared deps in `pnpm-workspace.yaml` catalogs
77
- TypeScript, Rsbuild/Rslib/Rstest/Rslint, Prettier
8+
- Rust/Cargo workspace with a NAPI-RS binding under `crates/`
89

910
## Commands
1011

@@ -24,12 +25,19 @@ pnpm check:spell
2425

2526
# focused work
2627
pnpm --filter rstack build
28+
pnpm --filter rstack build:native
2729
pnpm --filter rstack test
2830
```
2931

3032
## Testing
3133

32-
- Run `pnpm build` once before `pnpm test` command
34+
- Run `pnpm build` and `pnpm --filter rstack build:native` before `pnpm test`
35+
36+
## Native
37+
38+
- Follow `crates/AGENTS.md` for Rust changes
39+
- Keep the JS bridge lazy; use the generated loader directly
40+
- Regenerate binding files with `build:native`
3341

3442
## Documentation
3543

@@ -39,7 +47,8 @@ pnpm --filter rstack test
3947
## Project structure
4048

4149
```text
42-
packages/rstack/ # CLI package
43-
examples/* # example projects
44-
scripts/ # repo tooling
50+
crates/ # Rust crates
51+
packages/rstack/ # CLI package and private native bridge
52+
examples/* # example projects
53+
scripts/ # repo tooling
4554
```

‎crates/AGENTS.md‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# AGENTS.md
2+
3+
## Architecture
4+
5+
- Keep `rstack-binding` a thin Node/NAPI adapter
6+
- Put reusable or domain logic in separate crates
7+
- Coordinate binding changes with the private JS loader and its Rstest coverage
8+
9+
## Checks
10+
11+
Run from the repository root:
12+
13+
```bash
14+
cargo fmt --all -- --check
15+
cargo clippy --workspace --all-targets --locked -- -D warnings
16+
cargo test --workspace --locked
17+
pnpm --filter rstack build:native
18+
```

‎scripts/dictionary.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Custom Dictionary Words
22
applypatch
3+
clippy
34
dirents
45
errexit
56
extglob

0 commit comments

Comments
 (0)