Skip to content

feat(mcpbstage): add mcpb bundle staging CLI#9

Merged
AcidSailor merged 4 commits into
mainfrom
feat/mcpbstage
Jul 7, 2026
Merged

feat(mcpbstage): add mcpb bundle staging CLI#9
AcidSailor merged 4 commits into
mainfrom
feat/mcpbstage

Conversation

@AcidSailor

Copy link
Copy Markdown
Owner

Adds cmd/mcpbstage, a small stdlib + kong CLI that stages the contents of an .mcpb bundle for the real mcpb pack to validate + zip.

Why

The go-scaffolds go-mcp template packs .mcpb bundles with an inline shell block (brittle globs, jq version-stamp, per-platform cp) copied into every generated MCP server. This factors the fragile staging half into one versioned, testable tool; mcpb pack still owns validation + zipping.

What it does

mcpbstage --dist dist --manifest mcpb/manifest.json --out dist/mcpb:

  1. reads the release version from GoReleaser's dist/metadata.json;
  2. parses the manifest's server.mcp_config (command + platform_overrides) to learn which platform binaries the bundle declares — manifest-driven, no hardcoded platform list;
  3. resolves each binary's path from dist/artifacts.json (Binary entries) — no globbing;
  4. writes <out>/manifest.json with the version stamped in (preserving all other keys), and copies each binary to <out>/server/<name> at mode 0755.

Fails loudly if any input is missing or a declared platform has no matching artifact.

Tests

go test ./cmd/mcpbstage/ — 3/3 (layout + version stamp + 0755, missing-binary, missing-metadata). task ci clean. kong is imported only by cmd/mcpbstage.

Release note

Intended to ship as v0.6.0 (new feature). The go-scaffolds template PR pins this version and can't be verified end-to-end until v0.6.0 is tagged/published.

Spec + plan: docs/superpowers/{specs,plans}/2026-07-07-shared-mcpb-staging*.

🤖 Generated with Claude Code

Address PR review findings:

- findArtifact: match on goos/goarch, then disambiguate multiple Binary
  artifacts (multiple builds or goamd64/goarm variants) by the manifest's
  binary name; refuse to guess — zero or an irreducibly-ambiguous match set
  is a loud error, never a silently-wrong binary staged under the target name.
- parseTargets: a present-but-empty command now fails loudly, naming the
  platform, instead of silently dropping it from the bundle.
- copyTree: a nested asset directory is an unsupported layout and errors
  rather than being silently omitted from the bundle.
- Docs: CLAUDE.md and README no longer claim "no main/cmd"; both note the
  cmd/mcpbstage build-time CLI and its Architecture entry.
- Tests: cover the sibling-asset copy (previously masked), nested-dir error,
  empty-override and unparseable-command rejections, nested-key preservation
  in stampVersion, idempotency, and findArtifact's variant/multi-build paths.
@AcidSailor AcidSailor marked this pull request as ready for review July 7, 2026 14:34
@AcidSailor AcidSailor merged commit 2c84448 into main Jul 7, 2026
2 checks passed
@AcidSailor AcidSailor deleted the feat/mcpbstage branch July 7, 2026 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant