feat: standalone add-sg-mcp binaries and install scripts for macOS, Linux and Windows - #6
Open
arunim2405 wants to merge 8 commits into
Open
arunim2405 wants to merge 8 commits into
arunim2405 wants to merge 8 commits into
Conversation
`bun run build:binary` compiles src/index.ts into a single executable that needs no Node.js. The skills are embedded as files; a compiled binary cannot cpSync out of Bun's virtual filesystem, so bundledSkillsDir() first writes the embedded skills to a private temp directory (removed on exit) and the installer runs unchanged. tests/e2e/sg-binary.test.ts compiles the binary and installs into a throwaway HOME; with ADD_SG_MCP_BINARY it tests a prebuilt executable instead. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
binaries.yml cross-compiles darwin-arm64, darwin-x64, linux-arm64, linux-x64 and windows-x64 (x64 on Bun's baseline build), runs each archive on its own OS, and on a published release (or a manual run with a tag) attaches the archives, SHA256SUMS and build provenance attestations to the release. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Windows checkouts convert the source SKILL.md files to CRLF while the embedded copies stay LF, so the smoke test compares normalized text. actions/attest-build-provenance v4 is a wrapper; use actions/attest directly with the artifact-metadata permission it documents. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Member
Author
|
Publish path tested end to end (before merge, since
Run on this PR's head: https://github.com/StackGuardian/add-sg-mcp/actions/runs/35393333010. Build + all 5 smoke tests green. |
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
arunim2405
marked this pull request as ready for review
September 18, 2026 21:00
`curl -fsSL …/releases/latest/download/install.sh | sh` (macOS, Linux) and `irm …/install.ps1 | iex` (Windows) pick the build for the machine, verify it against SHA256SUMS, install it (~/.local/bin, or %LOCALAPPDATA%\add-sg-mcp\bin added to the user PATH) and run it with any flags passed through. Under `curl | sh` the binary gets /dev/tty so its prompts work. ADD_SG_MCP_VERSION, ADD_SG_MCP_INSTALL_DIR, ADD_SG_MCP_DOWNLOAD_URL and ADD_SG_MCP_NO_RUN adjust it. binaries.yml shellchecks install.sh, attaches both scripts to the release (listed in SHA256SUMS and attested), and each smoke job runs tests/e2e/sg-install-script.test.ts against the real archives. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Member
Author
|
Install scripts: publish path tested end to end. Same method as before: a throwaway branch published to a draft
Only the real public link |
Lead with what a StackGuardian user needs: prerequisites (org, region, an agent), install with or without Node.js, how to check it works, what the MCP server's tools and the skills let an agent do (with example prompts), a comparison of the sign-in modes, everyday tasks, and troubleshooting checked against the CLI's behavior. Options, commands, install-script settings, per-agent notes, how it works and security move to a Reference section; development notes move to the end. The options list gains --token and --api-base, which the CLI already accepts. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The skills are shared by every StackGuardian-<org> entry, so removing one organization's entry with --name no longer removes them from the agents. remove without --name, and logout --purge, still take the skills out. Co-Authored-By: Claude Opus 5 (1M context) <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.
Stacked on #5 (
feat/auth-grant).Why
StackGuardian's users are DevOps and infra engineers, and many of them don't have Node.js, so
npx add-sg-mcpfails for them before it starts. With this PR, each GitHub release ships standalone executables (no Node.js, npm or Bun needed) and a one-line installer:curl -fsSL https://github.com/StackGuardian/add-sg-mcp/releases/latest/download/install.sh | shWhat
Binaries
bun run build:binarycompilessrc/index.tsinto one executable withbun build --compile, with the three skills embedded as files.cpSyncout of Bun's virtual filesystem. SobundledSkillsDir()first writes the embedded skills to a privatemkdtempdirectory, which is removed on exit, and the installer runs unchanged. The npm package still readsskills/from disk.Install scripts
install.sh(POSIX sh, macOS and Linux) andinstall.ps1(Windows):npxon unsupported systems: musl/Alpine (detected by the missing glibc loader), and non-x64 Windows.SHA256SUMS, and stop before installing anything if the checksum doesn't match.~/.local/bin, or on Windows to%LOCALAPPDATA%\add-sg-mcp\bin, which is added to the userPATH.add-sg-mcp, passing through any flags given withsh -s -- …or& ([scriptblock]::Create((irm …))) ….curl | sh, the binary reads from/dev/tty, so prompts and the browser sign-in work.install.shruns everything frommain "$@"on its last line, so a cut-off download does nothing.install.ps1runs inside one scriptblock and never callsexitunderiex, so it can't close the user's session.ADD_SG_MCP_VERSIONpicks a release.ADD_SG_MCP_INSTALL_DIRpicks where to install.ADD_SG_MCP_DOWNLOAD_URLpoints at a mirror; http(s) orfile://, which helps on machines without internet access.ADD_SG_MCP_NO_RUN=1installs without running..github/workflows/binaries.ymlshellcheckoninstall.sh.darwin-arm64,darwin-x64,linux-arm64,linux-x64andwindows-x64. The x64 builds use Bun's baseline variant, so CPUs and VMs without AVX2 can run them..tar.gzor.zip(binary + LICENSE + NOTICE), and writesSHA256SUMScovering the archives and both scripts.macos-latest,macos-15-intel,ubuntu-24.04-arm,ubuntu-latest,windows-latest):tests/e2e/sg-binary.test.ts: a real offline install into a throwaway HOME, checking the server entry and the skills.tests/e2e/sg-install-script.test.tsagainst the real release files: install + run, pipedcurl | shform,NO_RUN, and a tampered checksum that must abort.release: publishedor on a manual run with atag:package.json#version.actions/attest, SLSA provenance) and uploads it to the release.publishcan write), and the Bun version is pinned because its runtime ships inside every binary.release.yml(npm) is unchanged. None of the files kept identical to upstream were touched. CHANGELOG, RELEASING.md and the layout in AGENTS.md are updated.README rewritten for StackGuardian MCP users: prerequisites (org, region, an agent); install with or without Node.js; how to check it works; what the MCP server's tools and the three skills let an agent do, with example prompts taken from the server's tool descriptions; a comparison of the sign-in modes; everyday tasks; and troubleshooting, with each answer checked against the CLI code. Options, commands, install-script settings, per-agent notes, how it works and security are now under Reference; development notes are at the end. The options list gains
--tokenand--api-base, which the CLI already accepted.Fix:
remove --namekeeps the skills. The skills are shared by everyStackGuardian-<org>entry, so removing one organization's entry no longer takes them out of your agents.removewithout--name, andlogout --purge, still remove them. There's a new e2e test for this: two orgs, remove one, and the other entry and the skills stay.Test plan
bun run typecheck;bun run test: 21/21 files, including unit tests for extracting skills,sg-binary(compiles and runs the binary) andsg-install-script(runsinstall.shagainst a release built for this machine)bun run fallow -- --summary: no new findings, apart from the new test file being listed as "unused" like the other e2e testsinstall.shpasses shellcheck and runs underdashand macOSsh, both as a file and pipedbinaries.ymlgreen on this PR: build + 5 smoke jobs, each running the binary and the matching install script (install.ps1on Windows)Not in this PR
🤖 Generated with Claude Code