Publish the @magnet-ai/magnet-mcp-server package to NPM with version bumping and git tagging. Use when user says "publish to npm", "npm publish", "deploy to npm", "release to npm", "publish package", "bump version and publish", or "release new version".
This skill guides users through correctly publishing the @magnet-ai/magnet-mcp-server package to NPM, including version management and git operations.
Use this skill when the user requests:
Check that the working directory is clean and on the correct branch:
git status
git branch --show-current
Requirements:
main branch for releasesIf there are uncommitted changes, inform the user and ask them to commit or stash changes first.
Ensure local branch is up to date:
git fetch origin
git status
If behind remote, pull the latest changes:
git pull origin main
Ensure dependencies are current:
pnpm install
Build the TypeScript project and verify:
pnpm build
Run type checking:
pnpm tsc --noEmit
Verify the build output exists:
ls -la dist/index.js
If the build fails, stop and inform the user about the errors.
Critical: Before publishing, verify no sensitive data will be leaked in the package.
Run npm pack in dry-run mode to see exactly what will be published:
npm pack --dry-run 2>&1
Review the file list carefully. The output shows all files that will be included in the tarball.
Verify these sensitive files are NOT in the pack output:
.env (contains API keys).mcp.json (contains API keys).claude/settings.local.json (local settings)*secret*, *credential*, or *private* files# This should return nothing or only show .env.sample
npm pack --dry-run 2>&1 | grep -E "\.env|\.mcp\.json|settings\.local|secret|credential|private" || echo "No sensitive files found"
If .env (without .sample) or .mcp.json appears, STOP and fix .gitignore before proceeding.
Check source files for hardcoded API keys or secrets (UUID pattern commonly used for API keys):
# Check for UUID-like strings in source files (potential API keys)
grep -rE "[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}" src/ dist/ --include="*.ts" --include="*.js" 2>/dev/null || echo "No hardcoded UUIDs found"
# Check for common secret patterns
grep -riE "(api[_-]?key|secret|password|token|credential)\s*[:=]\s*['\"][^'\"]{8,}['\"]" src/ --include="*.ts" 2>/dev/null || echo "No hardcoded secrets found"
If any hardcoded secrets are found, STOP and remove them before proceeding.
Confirm sensitive files are properly excluded:
# Check .gitignore has necessary entries
grep -E "^\.env|^\.mcp\.json|settings\.local" .gitignore
Expected entries:
.env* (with !.env.sample exception).mcp.json.claude/settings.local.jsonDisplay a summary to the user:
Security Audit Results:
✓ Package contents reviewed (X files)
✓ No sensitive files in package
✓ No hardcoded secrets in source
✓ .gitignore properly configured
Safe to proceed with publishing.
If any check fails, inform the user and do not proceed until issues are resolved.
Read the current version from package.json:
node -p "require('./package.json').version"
Display the current version to the user.
Use AskUserQuestion to determine the version bump type:
Question: "What type of version bump is this release?" Options:
Calculate the new version based on current version and selected bump type.
Update the version in package.json:
npm version <patch|minor|major> --no-git-tag-version
Note: We use --no-git-tag-version because we'll handle git operations ourselves for more control.
Verify the new version:
node -p "require('./package.json').version"
Commit the version change to git and push to remote before publishing. This ensures the working tree is clean for the publish step.
git add package.json
git commit -m "v{version}"
git push origin main
Check that the user is logged into NPM:
npm whoami
If not logged in, inform the user:
npm login and authenticate."@magnet-ai scopeUse AskUserQuestion for final confirmation:
Question: "Ready to publish version {new_version} to NPM?" Options:
Publish the package:
pnpm publish --access public
The prepublishOnly script will automatically run pnpm build before publishing.
Verify the publish succeeded by checking the npm registry:
npm view @magnet-ai/magnet-mcp-server version
Create a git tag for the release and push it:
git tag v{version}
git push origin v{version}
Inform the user of the successful release:
{version}v{version}mainIf git status shows uncommitted changes:
git stash to temporarily save changes, or git commit to commit themIf pnpm build fails:
pnpm install)If the security audit detects issues:
Sensitive file in package:
.env, .mcp.json).gitignore has the correct entryfiles field in package.json, ensure sensitive files aren't listednpm pack --dry-run to verify fixHardcoded secrets found:
Missing .gitignore entries:
.gitignore:
.env*
!.env.sample
.mcp.json
.claude/settings.local.json
npm pack --dry-runIf npm whoami fails:
npm login@magnet-ai scope accessnpm whoami before proceedingIf publish returns 403:
@magnet-ai scopenpm access ls-collaborators @magnet-ai/magnet-mcp-serverIf git tag fails because tag exists:
git tag -l v{version}git tag -d v{version}git push origin :refs/tags/v{version}If git push is rejected:
git pull --rebase origin mainUser: "Publish the latest bug fixes to npm"
Actions:
pnpm build and type checknpm pack --dry-run, verify no sensitive files, scan for hardcoded secretspnpm publish --access publicUser: "We added new tools, let's release a new version"
Actions:
User: "The last publish failed halfway, can you help?"
Actions:
node -p "require('./package.json').version"git log origin/main --oneline -1git tag -l v{version}npm view @magnet-ai/magnet-mcp-server version--no-git-checks.prepublishOnly script runs build automatically, but checking first catches errors early@magnet-ai/magnet-mcp-server requires --access public for public visibilityv (e.g., v0.2.8).env, .mcp.json, settings.local.json, and any files with secrets/credentials/keysSearch for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer