chore: release 0.3.0 with idx-mcp

Bump the workspace and npm packages to 0.3.0. The release workflow
builds and attaches idx-mcp binaries next to idx, the npm launcher and
installer pick their binary from package.json so npm/idx-mcp reuses
them, and the npm smoke test covers both packages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
hermes 2026-10-14 19:01:29 +00:00
commit 8e3323e4f7
15 changed files with 186 additions and 92 deletions

View file

@ -5,12 +5,17 @@ const fs = require("node:fs");
const path = require("node:path");
const { spawn } = require("node:child_process");
const binaryName = process.platform === "win32" ? "idx.exe" : "idx";
const packageManifest = JSON.parse(
fs.readFileSync(path.join(__dirname, "..", "package.json"), "utf8"),
);
const nativeBinary = packageManifest.nativeBinary || "idx";
const packageName = packageManifest.name;
const binaryName = process.platform === "win32" ? `${nativeBinary}.exe` : nativeBinary;
const binaryPath = path.join(__dirname, "..", "bin", binaryName);
if (!fs.existsSync(binaryPath)) {
console.error(`idx-cli: installed binary not found at ${binaryPath}`);
console.error("idx-cli: rerun npm install or set IDX_BINARY_URL for a local binary");
console.error(`${packageName}: installed binary not found at ${binaryPath}`);
console.error(`${packageName}: rerun npm install or set IDX_BINARY_URL for a local binary`);
process.exit(1);
}
@ -24,7 +29,7 @@ for (const signal of ["SIGTERM", "SIGHUP"]) {
process.on("SIGINT", () => {});
child.once("error", (error) => {
console.error(`idx-cli: failed to start ${binaryPath}: ${error.message}`);
console.error(`${packageName}: failed to start ${binaryPath}: ${error.message}`);
process.exit(1);
});

View file

@ -13,7 +13,11 @@ const packageRoot = path.resolve(__dirname, "..");
const packageManifest = JSON.parse(
fs.readFileSync(path.join(packageRoot, "package.json"), "utf8"),
);
const binaryName = process.platform === "win32" ? "idx.exe" : "idx";
// The package names its native binary (`idx` or `idx-mcp`); release assets
// are named `<binary>-<platform>`.
const nativeBinary = packageManifest.nativeBinary || "idx";
const packageName = packageManifest.name;
const binaryName = process.platform === "win32" ? `${nativeBinary}.exe` : nativeBinary;
const binaryDirectory = path.join(packageRoot, "bin");
const binaryPath = path.join(binaryDirectory, binaryName);
const githubRepository = "0xrsydn/idx-cli";
@ -24,22 +28,22 @@ const targets = {
"linux/x64": {
label: "linux-x64",
triple: "x86_64-unknown-linux-gnu",
asset: "idx-linux-x64",
asset: `${nativeBinary}-linux-x64`,
},
"linux/arm64": {
label: "linux-arm64",
triple: "aarch64-unknown-linux-gnu",
asset: "idx-linux-arm64",
asset: `${nativeBinary}-linux-arm64`,
},
"darwin/arm64": {
label: "darwin-arm64",
triple: "aarch64-apple-darwin",
asset: "idx-darwin-arm64",
asset: `${nativeBinary}-darwin-arm64`,
},
"darwin/x64": {
label: "darwin-x64",
triple: "x86_64-apple-darwin",
asset: "idx-darwin-x64",
asset: `${nativeBinary}-darwin-x64`,
},
};
@ -111,7 +115,7 @@ function request(url, onResponse, redirects = 0) {
{
headers: {
Accept: "application/octet-stream",
"User-Agent": `idx-cli-npm/${packageManifest.version}`,
"User-Agent": `${packageName}-npm/${packageManifest.version}`,
},
},
(response) => {
@ -226,7 +230,7 @@ async function main() {
// `npm install` inside the Rust checkout should not fetch a release binary.
if (!override && fs.existsSync(path.join(packageRoot, "Cargo.toml"))) {
console.log("idx-cli: source checkout detected; skipping binary download (set IDX_BINARY_URL to override)");
console.log(`${packageName}: source checkout detected; skipping binary download (set IDX_BINARY_URL to override)`);
return;
}
@ -241,22 +245,22 @@ async function main() {
verifyChecksum(localPath, overrideSha256, localPath);
}
replaceWithLocalBinary(localPath);
console.log(`idx-cli: installed local binary from ${path.resolve(localPath)}`);
console.log(`${packageName}: installed local binary from ${path.resolve(localPath)}`);
return;
}
console.log(`idx-cli: downloading binary from IDX_BINARY_URL (${override})`);
console.log(`${packageName}: downloading binary from IDX_BINARY_URL (${override})`);
} else {
console.log(`idx-cli: downloading ${target.asset} for ${target.label} from ${source}`);
console.log(`${packageName}: downloading ${target.asset} for ${target.label} from ${source}`);
}
const expectedSha256 = override
? overrideSha256
: await expectedReleaseChecksum(target.asset);
await replaceWithDownloadedBinary(source, expectedSha256);
console.log(`idx-cli: installed binary at ${binaryPath}`);
console.log(`${packageName}: installed binary at ${binaryPath}`);
}
main().catch((error) => {
console.error(`idx-cli: ${error.message}`);
console.error(`${packageName}: ${error.message}`);
process.exit(1);
});

View file

@ -3,7 +3,6 @@ set -Eeuo pipefail
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
smoke_dir="$(mktemp -d "${TMPDIR:-/tmp}/idx-cli-npm-smoke.XXXXXX")"
install_dir="${smoke_dir}/install"
npm_cache="${smoke_dir}/npm-cache"
cleanup() {
@ -21,54 +20,64 @@ trap on_error ERR
cd "$repo_root"
release_binary="${repo_root}/target/release/idx"
if [[ -x "$release_binary" ]]; then
echo "npm smoke: reusing ${release_binary}"
# Packs the npm package in <dir>, installs it with the local release binary,
# and checks that `<bin> --help` prints `<usage>`.
smoke_package() {
local package_dir="$1" bin="$2" usage="$3"
local release_binary="${repo_root}/target/release/${bin}"
local work="${smoke_dir}/${bin}"
local install_dir="${work}/install"
mkdir -p "$work" "$install_dir"
if [[ ! -x "$release_binary" ]]; then
echo "npm smoke: release binary was not produced at ${release_binary}" >&2
exit 1
fi
echo "npm smoke: packing ${package_dir}"
local tarball_name tarball
tarball_name="$(cd "$package_dir" && npm_config_cache="$npm_cache" npm pack --silent --pack-destination "$work" | tail -n 1)"
tarball="${work}/${tarball_name}"
if [[ -z "$tarball_name" || ! -f "$tarball" ]]; then
echo "npm smoke: expected tarball was not produced at ${tarball}" >&2
exit 1
fi
local binary_url
binary_url="$(node -e 'const { pathToFileURL } = require("node:url"); process.stdout.write(pathToFileURL(process.argv[1]).href)' "$release_binary")"
echo "npm smoke: installing ${tarball_name} into ${install_dir}"
npm_config_cache="$npm_cache" IDX_BINARY_URL="$binary_url" npm install \
--prefix "$install_dir" \
"$tarball" \
--no-save \
--no-package-lock \
--no-audit \
--no-fund \
--foreground-scripts
local resolved_bin="${install_dir}/node_modules/.bin/${bin}"
if [[ ! -x "$resolved_bin" ]]; then
echo "npm smoke: npm did not create an executable bin link at ${resolved_bin}" >&2
exit 1
fi
echo "npm smoke: running installed ${bin} --help"
"$resolved_bin" --help | tee "${work}/help.txt"
if ! grep -q "$usage" "${work}/help.txt"; then
echo "npm smoke: ${bin} --help did not contain '${usage}'" >&2
exit 1
fi
}
if [[ -x target/release/idx && -x target/release/idx-mcp ]]; then
echo "npm smoke: reusing target/release/{idx,idx-mcp}"
else
echo "npm smoke: building ${release_binary}"
cargo build --release --locked
echo "npm smoke: building release binaries"
cargo build --release --locked -p idx-cli -p idx-mcp
fi
if [[ ! -x "$release_binary" ]]; then
echo "npm smoke: release binary was not produced at ${release_binary}" >&2
exit 1
fi
echo "npm smoke: packing wrapper"
mkdir -p "$npm_cache"
tarball_name="$(npm_config_cache="$npm_cache" npm pack --silent --pack-destination "$smoke_dir" | tail -n 1)"
tarball="${smoke_dir}/${tarball_name}"
if [[ -z "$tarball_name" || ! -f "$tarball" ]]; then
echo "npm smoke: expected tarball was not produced at ${tarball}" >&2
exit 1
fi
mkdir -p "$install_dir"
binary_url="$(node -e 'const { pathToFileURL } = require("node:url"); process.stdout.write(pathToFileURL(process.argv[1]).href)' "$release_binary")"
echo "npm smoke: installing tarball into ${install_dir}"
npm_config_cache="$npm_cache" IDX_BINARY_URL="$binary_url" npm install \
--prefix "$install_dir" \
"$tarball" \
--no-save \
--no-package-lock \
--no-audit \
--no-fund \
--foreground-scripts
resolved_bin="${install_dir}/node_modules/.bin/idx"
if [[ ! -x "$resolved_bin" ]]; then
echo "npm smoke: npm did not create an executable bin link at ${resolved_bin}" >&2
exit 1
fi
help_output="${smoke_dir}/help.txt"
echo "npm smoke: running installed idx --help"
"$resolved_bin" --help | tee "$help_output"
if ! grep -q "Usage: idx" "$help_output"; then
echo "npm smoke: --help output did not contain the expected usage line" >&2
exit 1
fi
echo "npm smoke: running installed idx config --help"
"$resolved_bin" config --help
echo "npm smoke: PASS (pack, install, --help, and config --help)"
smoke_package "$repo_root" idx "Usage: idx"
"${smoke_dir}/idx/install/node_modules/.bin/idx" config --help >/dev/null
smoke_package "${repo_root}/npm/idx-mcp" idx-mcp "Usage: idx-mcp"
echo "npm smoke: PASS (idx-cli and idx-mcp: pack, install, --help)"