Skip to content

Commit 9b8d301

Browse files
anvansterclaude
andcommitted
fix(release): correct npm metadata and gate publishing on engine assets
npm rewrote four `bin` paths and `repository.url` on every publish and reported the bin entries as "invalid and removed". The entries in fact survived - 0.19.0 and 0.19.1 both carry all of theirs on the registry - but the warning was indistinguishable from a real failure and cost a publish that was aborted on the assumption it had broken something. Store the forms npm normalizes to, so a clean publish is silent and any future warning means something. package-npm.sh treated a package.json/server.json version mismatch as a warning, printed into the middle of npm pack output where it scrolls past. The two files are published to two different registries under one version, and republishing that version cannot correct a disagreement between them, so this now aborts instead. The package ships no engine: every install fetches one from the release tagged with the engine's version. Publishing ahead of those assets makes a package that installs cleanly and then has nothing to run, so the assets are probed before packing rather than trusted. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017rVbt7rENTwXkdHt3Bpgb5
1 parent 284c8e5 commit 9b8d301

2 files changed

Lines changed: 24 additions & 7 deletions

File tree

mcp-package/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"license": "Apache-2.0",
88
"repository": {
99
"type": "git",
10-
"url": "https://github.com/codegraph-ai/CodeGraph"
10+
"url": "git+https://github.com/codegraph-ai/CodeGraph.git"
1111
},
1212
"keywords": [
1313
"mcp",
@@ -20,10 +20,10 @@
2020
"copilot"
2121
],
2222
"bin": {
23-
"codegraph-mcp": "./bin/codegraph-mcp.js",
24-
"codegraph-daemon": "./bin/codegraph-daemon.js",
25-
"codegraph-mcp-install-hooks": "./bin/install-hooks.js",
26-
"codegraph-mcp-fetch-engine": "./bin/fetch-engine-cli.js"
23+
"codegraph-mcp": "bin/codegraph-mcp.js",
24+
"codegraph-daemon": "bin/codegraph-daemon.js",
25+
"codegraph-mcp-install-hooks": "bin/install-hooks.js",
26+
"codegraph-mcp-fetch-engine": "bin/fetch-engine-cli.js"
2727
},
2828
"files": [
2929
"bin/",

scripts/package-npm.sh

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
# Package the npm MCP server distribution.
66
# Run from the repo root after all platform binaries are built.
77
#
8-
# Usage:
98
# The engine is not bundled: it is fetched from the GitHub release at install
109
# time by bin/postinstall.js. Publish the release assets first with
1110
# ./scripts/publish-release-assets.sh, or installs of this version will fail to
@@ -60,9 +59,27 @@ echo ""
6059
echo "package.json version: $PKG_VERSION"
6160
echo "server.json version: $SERVER_VERSION"
6261

62+
# A mismatch here is fatal rather than a warning. The two files are published to
63+
# two different registries under one version, and a warning scrolls past in the
64+
# npm pack output - leaving npmjs.com and the MCP Registry disagreeing about what
65+
# this release is, which cannot be corrected by republishing the same version.
6366
if [ "$PKG_VERSION" != "$SERVER_VERSION" ]; then
64-
echo "WARNING: version mismatch between package.json and server.json"
67+
echo "ERROR: version mismatch between package.json ($PKG_VERSION) and server.json ($SERVER_VERSION)" >&2
68+
exit 1
69+
fi
70+
71+
# The npm package contains no engine; every install fetches one from the release
72+
# tagged with this version. Publishing before those assets exist produces a
73+
# package that installs cleanly and then has nothing to run.
74+
ENGINE_VERSION=$(node -e "console.log(require('$PKG_DIR/bin/fetch-engine').ENGINE_VERSION)")
75+
echo "engine version: $ENGINE_VERSION (fetched at install time)"
76+
if ! curl -fsSL -o /dev/null \
77+
"https://github.com/codegraph-ai/CodeGraph/releases/download/v${ENGINE_VERSION}/codegraph-server-linux-x64.sha256"; then
78+
echo "ERROR: no published engine assets for v${ENGINE_VERSION}" >&2
79+
echo " Run ./scripts/publish-release-assets.sh first, or installs will find no engine." >&2
80+
exit 1
6581
fi
82+
echo " ✓ engine assets are published for v${ENGINE_VERSION}"
6683

6784
# Step 4: Pack
6885
echo ""

0 commit comments

Comments
 (0)