Files
claude-ms-todo/scripts/build-plugin.sh
Spencer McGuire 8dc821cd07 Add .plugin packaging (Cowork/Claude Code plugin variant)
plugin/ holds the plugin manifest, .mcp.json (CLAUDE_PLUGIN_ROOT paths), and
README; scripts/build-plugin.sh syncs the core client, esbuild-bundles the
server into a single ESM file (the plugin uploader rejects zip entries
containing "@", so no node_modules), and zips it as ms-todo.plugin. Same
server, two install formats (.mcpb + .plugin). Mirrors claude-msplanner.

Verified: the bundled server registers all 17 tools over stdio as ms-todo
v1.0.1.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 08:09:38 -06:00

30 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# Build ms-todo.plugin (the Cowork/Claude Code plugin bundle).
#
# The plugin uploader rejects zip entries containing "@" (npm scope directories
# like node_modules/@modelcontextprotocol), so we don't ship node_modules at
# all: esbuild bundles the server and its dependencies into a single ESM file.
# Output: ./ms-todo.plugin with contents at the archive root, as the plugin
# format requires.
set -euo pipefail
cd "$(dirname "$0")/.."
STAGE="$(mktemp -d)"
trap 'rm -rf "$STAGE"' EXIT
cp -R plugin/.claude-plugin "$STAGE/.claude-plugin"
cp plugin/.mcp.json plugin/README.md "$STAGE/"
mkdir -p "$STAGE/server"
# Sync the canonical core client into the extension, then install prod deps.
(cd mcp-extension && npm run sync --silent && npm ci --omit=dev --silent)
# The require() shim is for CJS dependencies inside the ESM bundle.
npx -y esbuild mcp-extension/server/index.mjs \
--bundle --platform=node --format=esm --target=node18 \
--banner:js="import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);" \
--outfile="$STAGE/server/index.mjs" --log-level=warning
rm -f ms-todo.plugin
(cd "$STAGE" && zip -qr - . -x "*.DS_Store") > ms-todo.plugin
echo "Built $(pwd)/ms-todo.plugin ($(du -h ms-todo.plugin | cut -f1 | tr -d ' '))"