diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 717328f..dc075d7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -189,10 +189,18 @@ jobs: # release tag like v1.0.0 for a package whose version string # happens to contain "alpha"/"beta" as a substring isn't # mis-tagged on npm. - if [[ "${VERSION}" == *-alpha* ]]; then - npm publish --access public --tag alpha - elif [[ "${VERSION}" == *-beta* ]]; then - npm publish --access public --tag beta + # Any SemVer prerelease (identifier after the first "-") publishes + # under its own dist-tag, never "latest": alpha/beta/rc/next/... A + # tag like v1.1.0-rc.1 previously fell through to a bare publish and + # would have moved "latest" to a prerelease. + PRERELEASE="${VERSION#*-}" + if [[ "${PRERELEASE}" != "${VERSION}" ]]; then + DIST_TAG="${PRERELEASE%%.*}" # 1.0.0-rc.1 -> rc + DIST_TAG="${DIST_TAG%%+*}" # strip build metadata + DIST_TAG="$(printf '%s' "${DIST_TAG}" | tr -cd '[:alnum:]-')" + [[ -z "${DIST_TAG}" ]] && DIST_TAG="prerelease" + echo "Publishing prerelease ${VERSION} with --tag ${DIST_TAG}" + npm publish --access public --tag "${DIST_TAG}" else PKG_NAME=$(node -p "require('./package.json').name") PKG_VERSION=$(node -p "require('./package.json').version") @@ -288,8 +296,20 @@ jobs: try { execFileSync(binPath, process.argv.slice(2), { stdio: "inherit" }); } catch (e) { - if (e && typeof e === "object" && "status" in e) { - process.exit(e.status); + if (e && typeof e === "object") { + // Normal non-zero exit: pass the code through. + if (typeof e.status === "number") { + process.exit(e.status); + } + // Signal death (SIGTERM/SIGSEGV/...): execFileSync reports + // status: null + signal. Exiting with e.status here becomes + // process.exit(null) -> 0, turning a killed process into + // "success" for any caller checking $?. Use the shell + // convention 128+signal instead (SIGTERM -> 143). + if (e.signal) { + const signum = (os.constants && os.constants.signals && os.constants.signals[e.signal]) || 0; + process.exit(signum ? 128 + signum : 1); + } } throw e; } @@ -300,10 +320,18 @@ jobs: # release tag like v1.0.0 for a package whose version string # happens to contain "alpha"/"beta" as a substring isn't # mis-tagged on npm. - if [[ "${VERSION}" == *-alpha* ]]; then - npm publish --access public --tag alpha - elif [[ "${VERSION}" == *-beta* ]]; then - npm publish --access public --tag beta + # Any SemVer prerelease (identifier after the first "-") publishes + # under its own dist-tag, never "latest": alpha/beta/rc/next/... A + # tag like v1.1.0-rc.1 previously fell through to a bare publish and + # would have moved "latest" to a prerelease. + PRERELEASE="${VERSION#*-}" + if [[ "${PRERELEASE}" != "${VERSION}" ]]; then + DIST_TAG="${PRERELEASE%%.*}" # 1.0.0-rc.1 -> rc + DIST_TAG="${DIST_TAG%%+*}" # strip build metadata + DIST_TAG="$(printf '%s' "${DIST_TAG}" | tr -cd '[:alnum:]-')" + [[ -z "${DIST_TAG}" ]] && DIST_TAG="prerelease" + echo "Publishing prerelease ${VERSION} with --tag ${DIST_TAG}" + npm publish --access public --tag "${DIST_TAG}" else PKG_NAME=$(node -p "require('./package.json').name") PKG_VERSION=$(node -p "require('./package.json').version") diff --git a/Cargo.lock b/Cargo.lock index 3797534..f7b4afb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10,7 +10,7 @@ checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" [[package]] name = "agentmail-cli" -version = "1.0.0" +version = "1.0.1" dependencies = [ "agentmail_sdk", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index 9607486..537d8b2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "agentmail-cli" -version = "1.0.0" +version = "1.0.1" edition = "2021" description = "Command-line interface for the AgentMail API. Send, receive, reply, and manage threaded email conversations from your terminal." license = "MIT"