-
-
Notifications
You must be signed in to change notification settings - Fork 0
fix(cli): restore a publishable manifest and a real bin entry point #727
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| #!/usr/bin/env bun | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: #!/bin/sh
set -eu
file=packages/affinescript-cli/bin/affinescript.js
if command -v node >/dev/null 2>&1 &&
! command -v bun >/dev/null 2>&1 &&
[ "$(sed -n '1p' "$file")" = '#!/usr/bin/env bun' ]; then
echo "The executable requires Bun on a Node-only installation." >&2
exit 1
fiRepository: hyperpolymath/affinescript Length of output: 221 🏁 Script executed: #!/bin/sh
set -eu
printf '%s\n' '--- packages/affinescript-cli/bin/affinescript.js ---'
cat -n packages/affinescript-cli/bin/affinescript.js
printf '%s\n' '--- packages/affinescript-cli/package.json ---'
cat -n packages/affinescript-cli/package.json
printf '%s\n' '--- packages/affinescript-cli/mod.js:235-250 ---'
sed -n '235,250p' packages/affinescript-cli/mod.jsRepository: hyperpolymath/affinescript Length of output: 2587 Make the executable launcher compatible with Node.js. The 🤖 Prompt for AI Agents |
||
| // SPDX-License-Identifier: MPL-2.0 | ||
| // Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk> | ||
| // | ||
| // Executable entry point for the `affinescript` command. | ||
| // | ||
| // WHY THIS FILE EXISTS. `mod.js` already self-executes when it is the entry | ||
| // module, but it carries no hashbang, so it cannot be the target of a | ||
| // package.json `bin` field on Unix. This wrapper adds the hashbang and nothing | ||
| // else — all behaviour stays in mod.js. | ||
| import { run } from "../mod.js"; | ||
|
|
||
| const argv = typeof Deno !== "undefined" ? Deno.args : process.argv.slice(2); | ||
| const code = await run(argv); | ||
| if (typeof Deno !== "undefined") Deno.exit(code); | ||
| else process.exit(code); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| { | ||
| "name": "@hyperpolymath/affinescript", | ||
| "version": "0.1.2", | ||
| "description": "Ergonomic front door for the AffineScript compiler: downloads the pinned native binary for the host platform, verifies its SHA-256, caches it, and execs it.", | ||
| "license": "MPL-2.0", | ||
| "type": "module", | ||
| "bin": { | ||
| "affinescript": "./bin/affinescript.js" | ||
| }, | ||
| "exports": { | ||
| ".": "./mod.js" | ||
| }, | ||
| "files": [ | ||
| "bin/affinescript.js", | ||
| "mod.js", | ||
| "pins.js", | ||
| "mod.d.affine" | ||
| ], | ||
| "engines": { | ||
| "bun": ">=1.0.0", | ||
| "node": ">=18.0.0" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git+https://github.com/hyperpolymath/affinescript.git", | ||
| "directory": "packages/affinescript-cli" | ||
| }, | ||
| "homepage": "https://github.com/hyperpolymath/affinescript", | ||
| "keywords": ["affinescript", "compiler", "affine-types", "wasm"] | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔴 HIGH RISK
The hashbang
#!/usr/bin/env bunrestricts execution to environments where Bun is installed, contradicting theenginesfield inpackage.jsonthat explicitly supports Node.js (>= 18.0.0). On systems with only Node.js, theaffinescriptcommand will fail to execute. Usingnodeas the interpreter ensures compatibility with both Node and Bun.