reqlanOverviewIdeasFilesCode filesClustersAttributesGraphPrint

Printable idea sheet

rust_binary_distribution

reqlan rq/distribution/distribution.rq:78

Katz 0.380

One platform-specific npm package per native_targets tuple: `@reqlan/analytical-<platform>-<arch>` ( napi suffixes: `linux-x64-gnu`, `linux-arm64-gnu`, `darwin-x64`, `darwin-arm64`, `win32-x64-msvc`, `win32-arm64-msvc` ).
Each package declares `os` and `cpu`, contains the matching core engine `.node`, and uses the `@reqlan/analytical` package. json version as the single source of truth. prepare-native-packages.mjs writes that version. Changesets ignores `@reqlan/analytical-*` in config.json. Git `@reqlan/analytical` does not list platform packages as `optionalDependencies`; this workspace links them through `packageExtensions` in pnpm-workspace.yaml. The published tarball lists pinned optionalDependencies ( `--publish-versions` ) ( version_management ).
CLI and MCP install the host-matching binary from those published optionalDependencies.
The published tarball runs published_host_native_install so a host miss prints a warning.
Published on the existing `analytical/v*` channel ( npm_distribution / release_tagging ); not a separate tag channel.
The napi build runs when this channel moved: a direct `analytical/v*` tag, or `analytical_tag` from deployment_flow. The first npm tag ( `npm_ref` ) can be `language/v*` in the same release, so that ref is not the native-build gate.
Website download listing and GitHub-release postinstall are later follow-ups ( out of scope here ).
Engine port: analytical_rust_port / native_bridge.
Per-target VSIX packaging uses the same package layout under analytical-native, filled by Azure from this git commit ( vsix_export, vsix_native_not_from_npm ). npm tarballs of those packages are for CLI / MCP only.
`collect-napi-binary.mjs` copies `reqlan-lsp` only with `--with-lsp`. The npm workflow does not pass that flag. Azure does, because the VSIX ships `bin/reqlan-lsp` ( rust_binary_distribution ).
Implementation: analytical-native, prepare-native-packages.mjs, require-natives-published.mjs, check-host-native.mjs, config.json, deploy-npm.yml build-native job, azure-pipelines.yml build_native job.

plan
goal
Ship per-architecture core engine binaries beside `@reqlan/analytical` so CLI, MCP, and per-target VSIXes can load the Rust engine for the extension-host platform.

constraints
- optionalDependencies (not devDependencies) for runtime consumers.
- VSIX binaries come from Azure `build_native` on the `ext/v*` git tag, not from npm.
- Trusted publishing and `analytical/v*` tagging stay npm_distribution / release_tagging for CLI/MCP.
- gnu-only linux; musl and GitHub-release postinstall out of scope.
- Website binary listing deferred.
- Do not publish `@reqlan/analytical` until every platform package of that version is deployed (rust_binary_distribution).

steps
1. Scaffold six platform packages with os/cpu and the napi binary. (done)
2. Wire optionalDependencies on published `@reqlan/analytical` only; git omits them so Changesets can ignore platform packages. (done)
3. Cross-compile `reqlan-napi` for native_targets on the npm channel. The platform package contains only the `.node`. That job does not build `reqlan-lsp`. (done in deploy-npm.yml)
4. Publish platform packages on `analytical/v*` before `@reqlan/analytical`.
5. Prefer optionalDependency resolution in the loader; keep crates/target fallback for local dev by walking to repo-root `crates/Cargo.toml` (not `packages/crates` from `out/native`). (done)
status
in-progress
tests
load-native.test.ts, native-packaging.test.ts, analytical, native-packaging.test.ts:deploy-npm builds natives when analytical was bumped, not when npm_ref is language, native-packaging.test.ts:analytical version is SSOT for platform packages; Changesets ignores them, analytical optionalDependencies are publish-only, not in git, require-natives-published.test.ts
todo
Trusted Publisher registration for platform packages on npmjs.com

Interactive page: rust_binary_distribution