feat: JavaScript SDK via napi-rs#29
Merged
lostmygithubaccount merged 2 commits intomainfrom Mar 17, 2026
Merged
Conversation
Add ascend-tools-js crate with napi-rs bindings for workspace, deployment, and flow operations. Includes demo Express app with htmx UI, build scripts (bin/build-js, bin/check-js, bin/preview), and CI setup for Node.js 22. The JS crate is a standalone cdylib (not in the Cargo workspace) with its own Cargo.lock. Core crate gains a `jsts` feature for conditional napi derive annotations on model structs. Otto bindings are excluded (separate PR). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
394d13f to
459f48c
Compare
| fi | ||
|
|
||
| # Install JS dependencies (napi-rs, ava, typescript) | ||
| if command -v npm &>/dev/null; then |
Contributor
Author
There was a problem hiding this comment.
use fnm (follow up)
|
|
||
| # wait for server to be ready | ||
| for i in {1..20}; do | ||
| curl -sf http://localhost:3000 >/dev/null 2>&1 && break |
Contributor
Author
There was a problem hiding this comment.
3000 conflicts w/ other things we use (follow up)
There was a problem hiding this comment.
Pull request overview
Adds a JavaScript/TypeScript SDK for Ascend Tools using napi-rs, including generated TS typings backed by the Rust core models, plus build/check tooling and a small demo app to exercise the bindings.
Changes:
- Introduce
ascend-tools-jsN-API crate exporting an asyncClientwrapper overascend-tools-core. - Add
jstsfeature + N-API type annotations to core model types for TS generation. - Add JS build/check scripts, CI setup for Node, and a demo Express+htmx app.
Reviewed changes
Copilot reviewed 15 out of 24 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/app/server.js | Express demo server that uses the JS SDK to list/work with workspaces/deployments/flows. |
| tests/app/public/index.html | Demo UI (tabs + htmx) for browsing SDK data. |
| tests/app/package.json | Demo app dependencies (local file install of the JS SDK + express). |
| tests/app/.gitignore | Ignore node_modules/ for the demo app. |
| src/ascend_tools/ascend-tools-js/src/lib.rs | N-API Client implementation + async task wrapper for Node.js. |
| src/ascend_tools/ascend-tools-js/package.json | JS package metadata + build/test scripts for the native module. |
| src/ascend_tools/ascend-tools-js/build.rs | napi_build::setup() integration for building the native module. |
| src/ascend_tools/ascend-tools-js/tests/index.spec.mjs | Minimal AVA tests ensuring exports/methods exist. |
| src/ascend_tools/ascend-tools-js/Cargo.toml | Rust crate config for the N-API cdylib and dependencies/features. |
| src/ascend_tools/ascend-tools-js/Cargo.lock | Separate lockfile for the JS native module crate/workspace. |
| src/ascend_tools/ascend-tools-js/.gitignore | Ignore build outputs (including generated JS/types/native binaries). |
| src/ascend_tools/ascend-tools-core/src/models.rs | Add conditional N-API annotations for TS type generation. |
| src/ascend_tools/ascend-tools-core/src/lib.rs | Adjust unsafe-code linting depending on jsts feature. |
| src/ascend_tools/ascend-tools-core/Cargo.toml | Add jsts feature and optional napi/napi-derive deps. |
| bin/setup | Install JS dependencies for the JS SDK package when npm is present. |
| bin/preview | Script to run the demo app locally. |
| bin/check-js | Build + test the JS SDK package. |
| bin/check | Run JS checks as part of the overall repo check script. |
| bin/build-js | Build the JS SDK package. |
| bin/build | Run JS build as part of the overall repo build script. |
| Cargo.toml | Add workspace-level release profile settings. |
| Cargo.lock | Add napi-related crates due to new optional feature usage. |
| .github/actions/setup/action.yml | Install Node.js in CI setup action. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Critical fixes: - Replace TypedTask panic with proper error handling to prevent Node process crashes - Add npm package files list to ensure built artifacts are published Bug fixes: - Validate limit parameter in flow-runs endpoint (return 400 on invalid input) - Add missing detail container to deployments page for click navigation Documentation: - Add comment explaining unsafe code policy relaxation with jsts feature Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #24
Stacks on: #25
Summary
ascend-tools-js: napi-rscdylibcrate withAsyncTask/TypedTaskfor async Node.js bridgingspawn_blockingbin/build-js,bin/check-js,bin/previewactions/setup-node@v4, npm install inbin/setupPR 5 of 6 for v1.0.
🤖 Generated with Claude Code