Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
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
1,106 changes: 553 additions & 553 deletions .github/workflows/ci.yml

Large diffs are not rendered by default.

128 changes: 64 additions & 64 deletions .github/workflows/code-review.yml
Original file line number Diff line number Diff line change
@@ -1,64 +1,64 @@
name: DeepSeek CR
# AI code review on pull requests via hustcer/deepseek-review.
#
# Setup: add a repository secret named CHAT_TOKEN with your DeepSeek API key
# (Settings → Secrets and variables → Actions). Optionally override the model
# or base-url with the `with:` inputs below (e.g. a SiliconFlow / GitHub Models
# endpoint — see https://github.com/hustcer/deepseek-review for options).
#
# Skip a review by adding "skip cr" / "skip review" to the PR title or body,
# or lock the PR conversation.
on:
# Disabled — change to workflow_dispatch to run manually.
# Previously: pull_request_target + issue_comment triggers.
workflow_dispatch:
# pull_request_target:
# types:
# - opened # Triggers when a PR is opened
# - reopened # Triggers when a PR is reopened
# - synchronize # Triggers when a commit is pushed to the PR
# issue_comment:
# types:
# - created # Triggers when a comment is created on a PR (watch-mention)
permissions:
pull-requests: write
jobs:
setup-deepseek-review:
timeout-minutes: 30
runs-on: ubuntu-latest
name: DeepSeek Code Review
steps:
- name: DeepSeek Code Review
uses: hustcer/deepseek-review@v1
with:
chat-token: ${{ secrets.CHAT_TOKEN }}
# A prompt tuned to this monorepo: NativeScript plugin (TypeScript +
# Kotlin/Swift), a Rust wasm fixture, and an Nx workspace.
sys-prompt: |
You are a senior code reviewer for a NativeScript monorepo built
with Nx. The codebase spans: a TypeScript NativeScript plugin
(packages/ns-wasm3) that bridges WebAssembly (wasm3) to
iOS (Swift) and Android (Kotlin + Rust JNI); a Rust wasm-pack
fixture crate (packages/ns-wasm-fixture); and a
NativeScript test app (apps/ns-wasm-test) running Vitest
through vitest-ns on a device/emulator.
Review the diff for: correctness across the JS↔native wire
protocol (i64 must stay lossless as decimal strings, signed Java
byte[] handling, NSArray/NSData marshalling), memory safety in
wasm3 C interop, resource leaks (native runtimes must be
disposed/closed), TypeScript strictness, Rust unsafe usage, CI
workflow correctness, and test coverage. Flag security issues
(injection, secrets, unsafe FFI) first. Be concise; list concrete
problems with file:line references and actionable fixes.
# DeepSeek's own API is the default; uncomment to switch provider:
# model: deepseek-v4-flash
# base-url: https://api.deepseek.com
# exclude-patterns: pnpm-lock.yaml,package-lock.json,*.lock
# Trigger a review by commenting "@github-actions" on the PR
# (requires the issue_comment event above):
# watch-mention: "@github-actions"
name: DeepSeek CR

# AI code review on pull requests via hustcer/deepseek-review.
#
# Setup: add a repository secret named CHAT_TOKEN with your DeepSeek API key
# (Settings → Secrets and variables → Actions). Optionally override the model
# or base-url with the `with:` inputs below (e.g. a SiliconFlow / GitHub Models
# endpoint — see https://github.com/hustcer/deepseek-review for options).
#
# Skip a review by adding "skip cr" / "skip review" to the PR title or body,
# or lock the PR conversation.

on:
# Disabled — change to workflow_dispatch to run manually.
# Previously: pull_request_target + issue_comment triggers.
workflow_dispatch:
# pull_request_target:
# types:
# - opened # Triggers when a PR is opened
# - reopened # Triggers when a PR is reopened
# - synchronize # Triggers when a commit is pushed to the PR
# issue_comment:
# types:
# - created # Triggers when a comment is created on a PR (watch-mention)

permissions:
pull-requests: write

jobs:
setup-deepseek-review:
timeout-minutes: 30
runs-on: ubuntu-latest
name: DeepSeek Code Review
steps:
- name: DeepSeek Code Review
uses: hustcer/deepseek-review@v1
with:
chat-token: ${{ secrets.CHAT_TOKEN }}
# A prompt tuned to this monorepo: NativeScript plugin (TypeScript +
# Kotlin/Swift), a Rust wasm fixture, and an Nx workspace.
sys-prompt: |
You are a senior code reviewer for a NativeScript monorepo built
with Nx. The codebase spans: a TypeScript NativeScript plugin
(packages/ns-wasm3) that bridges WebAssembly (wasm3) to
iOS (Swift) and Android (Kotlin + Rust JNI); a Rust wasm-pack
fixture crate (packages/ns-wasm-fixture); and a
NativeScript test app (apps/ns-wasm-test) running Rstest
through ns-rstest on a device/emulator.

Review the diff for: correctness across the JS↔native wire
protocol (i64 must stay lossless as decimal strings, signed Java
byte[] handling, NSArray/NSData marshalling), memory safety in
wasm3 C interop, resource leaks (native runtimes must be
disposed/closed), TypeScript strictness, Rust unsafe usage, CI
workflow correctness, and test coverage. Flag security issues
(injection, secrets, unsafe FFI) first. Be concise; list concrete
problems with file:line references and actionable fixes.
# DeepSeek's own API is the default; uncomment to switch provider:
# model: deepseek-v4-flash
# base-url: https://api.deepseek.com
# exclude-patterns: pnpm-lock.yaml,package-lock.json,*.lock
# Trigger a review by commenting "@github-actions" on the PR
# (requires the issue_comment event above):
# watch-mention: "@github-actions"
153 changes: 79 additions & 74 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,80 +1,85 @@
# See https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files for more about ignoring files.

# compiled output
dist
tmp
out-tsc

# dependencies
node_modules

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# misc
/.sass-cache
/connect.lock
/coverage
/apps/ns-wasm-test/test-output/
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings

# System Files
.DS_Store
Thumbs.db

.nx/cache
.nx/workspace-data
.cursor/rules/nx-rules.mdc
.github/instructions/nx.instructions.md

.claude/worktrees
.claude/settings.local.json
.nx/polygraph
.nx/self-healing
.nx/migrate-runs
vitest.config.*.timestamp*
# Added by code-review-graph
.code-review-graph/

# Kotlin
**/.kotlin/errors/*.log

# Reasonix
.reasonix/desktop-topic-auto-title-meta.json
.reasonix/desktop-topic-created-at.json
.reasonix/desktop-topic-title-sources.json
.reasonix/desktop-topic-titles.json
.reasonix/tasks/

# DeepSeek CR local config (contains API token)
.deepseek-cr.config.json

reasonix.toml

/packages/ns-wasm3/src/vendors/wasm3-rust/target/

# pnpm local package store (created during resolution)
.pnpm-store
# See https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files for more about ignoring files.

# compiled output
dist
tmp
out-tsc

# dependencies
node_modules

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# misc
/.sass-cache
/connect.lock
/coverage
/apps/ns-wasm-test/test-output/
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings

# System Files
.DS_Store
Thumbs.db

.nx/cache
.nx/workspace-data
.cursor/rules/nx-rules.mdc
.github/instructions/nx.instructions.md

.claude/worktrees
.claude/settings.local.json
.nx/polygraph
.nx/self-healing
.nx/migrate-runs
vitest.config.*.timestamp*
# Added by code-review-graph
.code-review-graph/

# CodeGraph index
.codegraph/

# Kotlin
**/.kotlin/errors/*.log

# Reasonix
.reasonix/desktop-topic-auto-title-meta.json
.reasonix/desktop-topic-created-at.json
.reasonix/desktop-topic-title-sources.json
.reasonix/desktop-topic-titles.json
.reasonix/tasks/

# DeepSeek CR local config (contains API token)
.deepseek-cr.config.json

reasonix.toml

/packages/ns-wasm3/src/vendors/wasm3-rust/target/

# pnpm local package store (created during resolution)
.pnpm-store
.buck-out/
/buck-out
.buck-out/

# VS Code multi-root workspace
*.code-workspace

vite.config.*.timestamp*
64 changes: 49 additions & 15 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ TypeScript API (wire protocol, error mapping, and `WasmRuntime` / `WasmModule` /
`WasmFunction` class shapes). The Rust cargo workspace and UniFFI (uniffi-rs)
Kotlin/Swift bindings — together with the mirror-image native architecture
described in [Shared plugin architecture](#shared-plugin-architecture) — apply
to **ns-wasm3 and ns-wamr**. The newer runtimes (`ns-wasm-kit-runtime`, the
Swift-native WasmKit interpreter; `ns-endive`, the Java-native Endive
interpreter) share the same TypeScript adapter pattern, wire protocol, and
to **ns-wasm3, ns-wamr and ns-wasm-edge**. The newer runtimes
(`ns-wasm-kit-runtime`, the Swift-native WasmKit interpreter; `ns-wasm-chicory`
and `ns-endive`, the Java-native Chicory and Endive interpreters) share the
same TypeScript adapter pattern, wire protocol, and
`@cross-code/ns-wasm-core` foundation, but have their own per-engine native
layers. Only engine-specific detail lives in each package's AGENTS.md.

Expand All @@ -68,23 +69,41 @@ layers. Only engine-specific detail lives in each package's AGENTS.md.
iOS-only at this time (WasmKit is Swift-native and served through SwiftPM);
Android throws a clear unsupported error. Follows the same TypeScript
adapter pattern as the other two plugins.
- **`ns-wasm-edge`** (`@cross-code/ns-wasm-edge`) — plugin binding the
[WasmEdge](https://github.com/WasmEdge/WasmEdge) runtime (Swift Package on
iOS, Kotlin + Rust JNI (cargo-ndk) on Android). Follows the Rust/UniFFI
architecture of ns-wasm3/ns-wamr.
- **`ns-wasm-chicory`** (`@cross-code/ns-wasm-chicory`) — plugin binding the
[Chicory](https://github.com/dylibso/chicory) interpreter, a pure-Java
runtime (no NDK/Rust needed) — Android-only.
- **`ns-endive`** (`@cross-code/ns-endive`) — plugin binding the
[Endive](https://github.com/bytecodealliance/endive) interpreter — Java/JNI
on Android with a TypeScript adapter. Android-only.
- **`ns-rspack`** (`@cross-code/ns-rspack`) — **not a WASM plugin**: an
[rspack](https://rspack.rs) bundler for NativeScript apps that reuses
`@nativescript/webpack`'s configuration and swaps the webpack-only pieces for
rspack equivalents. Installed under the alias the {N} CLI resolves the
bundler by (`@nativescript/rspack`). See `packages/ns-rspack/README.md`
and `packages/ns-rspack/AGENTS.md`.
- **`ns-wry`** (`@cross-code/ns-wry`) — general-purpose NativeScript plugin
scaffold built on Rust + UniFFI (uniffi-rs) with cargo-ndk Android pipeline.
See `packages/ns-wry/AGENTS.md` for the bare-metal architecture; extend the
`wry-rust` workspace and `wry_ffi.udl` IDL to add engine-specific APIs.

### Vitest + NativeScript unit-test packages

- **`vitest-ns`** (`@cross-code/vitest-ns`) — a Vitest
custom pool that runs unit tests in NativeScript Worker runtimes. Read
`packages/vitest-ns/AGENTS.md` before changing its Node/device
protocol or webpack aliases.
- **`vitest-ns-ui`** (`@cross-code/vitest-ns-ui`) — an
optional NativeScript Core results view. It is presentation-only and should
remain removable for headless or CI usage.
- These packages support one-shot unit tests; they are not a component-testing
or end-to-end framework. Run their Nx `build`, `typecheck`, and `test`
targets with `pnpm exec nx`.
### Rstest + NativeScript unit-test package

- **`ns-rstest`** (`@cross-code/ns-rstest`) — runs Rstest unit tests in
NativeScript Worker runtimes. Rstest has no custom-pool API, so the package
owns its own Node host (`runNativeScriptTests`) and drives Rstest's own
runtime (`@rstest/core/internal/browser-runtime`) on the device. Read
`packages/ns-rstest/AGENTS.md` before changing its Node/device protocol or
bundler aliases.
- The optional on-device results view ships from the same package under
`@cross-code/ns-rstest/ui`. It is presentation-only and should remain
removable for headless or CI usage.
- The package supports one-shot unit tests; it is not a component-testing or
end-to-end framework. Run its Nx `build`, `typecheck`, and `test` targets
with `pnpm exec nx`.

**wamr native suites**: if the vendored WAMR C sources are ever absent, the
wamr native commands and CI jobs (`wamr-ios`, `wamr-android`) skip gracefully
Expand Down Expand Up @@ -475,6 +494,16 @@ Three test layers, each covering a different slice:
touch `wire.ts` or an adapter file. Details in
`apps/ns-wasm-test/AGENTS.md`.

### CI jobs are real gates — never `continue-on-error`

The CI jobs that run the test app's suite (`wasm-test-ios`,
`wasm-test-android` in `.github/workflows/ci.yml`) are the only place the
TypeScript adapters meet the real native layers, so a failure in either is a
release-blocking signal. **Do not add `continue-on-error` to any CI job** —
emulator/simulator flakiness must be fixed, not bypassed. If a job is
genuinely environment-broken, disable it with an `if:` condition and a
comment instead, never a silent `continue-on-error`.

### Kotlin linting (Detekt + Ktlint)

Each Android Gradle project (`platforms/android/<engine>-android/`) runs
Expand Down Expand Up @@ -616,8 +645,13 @@ wasm-pack-generated `.d.ts`. See `packages/ns-wasm-fixture/README.md`.
| `packages/ns-wasm3/AGENTS.md` | wasm3-specific: stack ABI, globals, fixtures, build/test |
| `packages/ns-wamr/AGENTS.md` | WAMR-specific: two-phase load, exec env, WASI, tiers, trampolines, shim |
| `packages/ns-wasm-kit-runtime/AGENTS.md` | WasmKit-specific: iOS-only Swift interpreter, Android unsupported stub |
| `packages/ns-wasm-edge/AGENTS.md` | (none — no per-package AGENTS yet; follows the Rust/UniFFI architecture of wasm3/wamr, see Shared plugin architecture above) |
| `packages/ns-wasm-chicory/AGENTS.md` | (none — no per-package AGENTS yet; pure-Java Android runtime, no NDK/Rust needed) |
| `packages/ns-endive/AGENTS.md` | (none — no per-package AGENTS yet; Java/JNI Android runtime with TypeScript adapter) |
| `packages/ns-rspack/AGENTS.md` | rspack bundler for NativeScript apps — CLI/IPC contract, compat layer, gotchas (also see `packages/ns-rspack/README.md` for usage) |
| `packages/ns-wry/AGENTS.md` | wry scaffold: Rust + UniFFI architecture, platform stubs, extension guide |
| `apps/ns-wasm-test/AGENTS.md` | test app: layout, design decisions, running the suites, adding specs |
| `apps/rspack-test-app` | rspack-bundled test app — workspace member, installs with the root `pnpm install`; see `packages/ns-rspack/README.md` |
| `apps/ns-wry-app` | test app: WebView demo, build-plugin-and-run workflow |

<!-- code-review-graph MCP tools -->
Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ automatically). This file exists only so older tools that look for

**Read `AGENTS.md` before exploring, building, or editing anything.**
It covers: Nx task conventions, the NativeScript plugins (ns-wamr,
ns-wasm3, ns-wry), the vitest-ns device test pool, the shared wire
ns-wasm3, ns-wry), the ns-rstest device test runner, the shared wire
protocol, native build pipelines (prebuilt xcframeworks, cargo-ndk,
Buck2 via `nx-buck2`), testing layers, and the code-review-graph MCP
tools that should be used before Grep/Glob/Read.
Loading
Loading