KiCAD-Schematic-Manipulation: Command for Claude Code

.claude/commands/dev/publish-pypi.md

publish-pypi is a command for Claude Code from richard-luc/KiCAD-Schematic-Manipulation. It costs 0 tokens per session (1,791 once invoked), scanned A, a copy of publish-pypi, MIT.

A command that builds and publishes the MCP KiCAD Schematic API package to PyPI, Python’s public package repository.

In plain words
What is it for?
Use it to publish a package to PyPI or Test PyPI, perform a dry run, choose a version, skip tests, or bypass confirmation prompts.
Why use it?
It organizes version selection, testing, package building, and uploading so the release process is repeatable.

Command for Claude Code

Written for Claude Code: installed under .claude/. Also seen: positional $N argument.

This is richard-luc/KiCAD-Schematic-Manipulation's own configuration. It tells Claude Code how to work on KiCAD-Schematic-Manipulation itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything KiCAD-Schematic-Manipulation configures →

Reuse

Borrowing it

Nothing to install: this file belongs to richard-luc/KiCAD-Schematic-Manipulation. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/richard-luc/KiCAD-Schematic-Manipulation/main/.claude/commands/dev/publish-pypi.md
Clone the repo
git clone --depth 1 https://github.com/richard-luc/KiCAD-Schematic-Manipulation

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for publish-pypi

README.md
[![agentmods](https://agentmods.dev/badge/commands/richard-luc/kicad-schematic-manipulation/publish-pypi/github.svg)](https://agentmods.dev/commands/richard-luc/kicad-schematic-manipulation/publish-pypi)
Your own site
<a href="https://agentmods.dev/commands/richard-luc/kicad-schematic-manipulation/publish-pypi"><img src="https://agentmods.dev/badge/commands/richard-luc/kicad-schematic-manipulation/publish-pypi/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for publish-pypi

Your own site · 80×15
<a href="https://agentmods.dev/commands/richard-luc/kicad-schematic-manipulation/publish-pypi"><img src="https://agentmods.dev/badge/commands/richard-luc/kicad-schematic-manipulation/publish-pypi.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,791 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 88% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.01791
Opus 5 $0.00000 $0.00896
Sonnet 5 $0.00000 $0.00358
Haiku 4.5 $0.00000 $0.00179

Measured 10d ago against content hash 3ffae4ad057c, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

publish-pypi scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

88% identical to publish-pypi — 14 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

.claude/commands/dev/publish-pypi.md · 229 lines

How it starts

The opening of the file, as written. The whole thing — 229 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Publish to PyPI - MCP KiCAD Schematic API

Usage

/publish-pypi [options]

Description

Builds and publishes the MCP KiCAD Schematic API server package to PyPI, making it available for installation via pip install KiCAD-Schematic-Manipulation.

Options

  • --version=auto - Version increment: auto, patch, minor, major, or specific version (e.g., 1.2.3)
  • --test-pypi - Upload to Test PyPI instead of production
  • --dry-run - Build package but don't upload
  • --skip-tests - Skip running tests before publishing
  • --force - Bypass confirmation prompts

Implementation

#!/bin/bash

# Parse arguments
VERSION="auto"
TEST_PYPI=false
DRY_RUN=false
SKIP_TESTS=false
FORCE=false

while [[ $# -gt 0 ]]; do
    case $1 in
        --version=*)
            VERSION="${1#*=}"
            shift
            ;;
        --test-pypi)
            TEST_PYPI=true
            shift
            ;;
        --dry-run)
            DRY_RUN=true
            shift
            ;;
        --skip-tests)
            SKIP_TESTS=true
            shift
            ;;
        --force)
            FORCE=true
            shift
            ;;
        *)
            echo "Unknown option: $1"
            exit 1
            ;;
    esac
done

# Ensure we're in project root
if [[ ! -f "pyproject.toml" ]]; then
    echo "❌ Must run from KiCAD-Schematic-Manipulation root"
    exit 1
fi

# Get current version
CURRENT_VERSION=$(grep 'version = ' pyproject.toml | sed 's/.*version = "\(.*\)".*/\1/')
echo "📋 Current version: $CURRENT_VERSION"

# Calculate new version
if [[ "$VERSION" == "auto" ]]; then
    # Auto-increment patch version
    IFS='.' read -ra ADDR <<< "$CURRENT_VERSION"
    MAJOR="${ADDR[0]}"
    MINOR="${ADDR[1]}"
    PATCH="${ADDR[2]}"
    NEW_VERSION="$MAJOR.$MINOR.$((PATCH + 1))"
elif [[ "$VERSION" == "patch" ]]; then
    IFS='.' read -ra ADDR <<< "$CURRENT_VERSION"
    MAJOR="${ADDR[0]}"
    MINOR="${ADDR[1]}"
    PATCH="${ADDR[2]}"
    NEW_VERSION="$MAJOR.$MINOR.$((PATCH + 1))"
elif [[ "$VERSION" == "minor" ]]; then
    IFS='.' read -ra ADDR <<< "$CURRENT_VERSION"
    MAJOR="${ADDR[0]}"
    MINOR="${ADDR[1]}"
    NEW_VERSION="$MAJOR.$((MINOR + 1)).0"
elif [[ "$VERSION" == "major" ]]; then
    IFS='.' read -ra ADDR <<< "$CURRENT_VERSION"
    MAJOR="${ADDR[0]}"
    NEW_VERSION="$((MAJOR + 1)).0.0"
else
    NEW_VERSION="$VERSION"
fi

echo "🚀 Publishing version: $NEW_VERSION"

# Confirmation
if [[ "$FORCE" == "false" ]]; then
    read -p "Continue with version $NEW_VERSION? (y/N) " -n 1 -r
    echo
    if [[ ! $REPLY =~ ^[Yy]$ ]]; then
        echo "❌ Cancelled"
        exit 1
    fi
fi

# Run tests first
if [[ "$SKIP_TESTS" == "false" ]]; then
    echo "🧪 Running tests..."
    pytest tests/ -v || { echo "❌ Tests failed"; exit 1; }
    echo "✅ Tests passed"
fi

# Update version in files
echo "📝 Updating version to $NEW_VERSION..."
sed -i.bak "s/version = \".*\"/version = \"$NEW_VERSION\"/" pyproject.toml
sed -i.bak "s/__version__ = \".*\"/__version__ = \"$NEW_VERSION\"/" src/mcp_kicad_sch_api/__init__.py

# Clean up backup files
rm -f pyproject.toml.bak src/mcp_kicad_sch_api/__init__.py.bak

# Build package
echo "📦 Building package..."
python -m build || { echo "❌ Build failed"; exit 1; }

# Validate package
echo "✅ Validating package..."
python -m twine check dist/mcp_kicad_sch_api-$NEW_VERSION* || { echo "❌ Package validation failed"; exit 1; }

if [[ "$DRY_RUN" == "true" ]]; then
    echo "🏁 Dry run completed. Package built but not uploaded."
    echo "📦 Built: dist/mcp_kicad_sch_api-$NEW_VERSION*"
    exit 0
fi

# Upload to PyPI
if [[ "$TEST_PYPI" == "true" ]]; then
    echo "🚀 Uploading to Test PyPI..."
    python -m twine upload --repository testpypi dist/mcp_kicad_sch_api-$NEW_VERSION*
    echo "✅ Uploaded to Test PyPI: https://test.pypi.org/project/KiCAD-Schematic-Manipulation/$NEW_VERSION/"
else
    echo "🚀 Uploading to PyPI..."
    python -m twine upload dist/mcp_kicad_sch_api-$NEW_VERSION*
    echo "✅ Uploaded to PyPI: https://pypi.org/project/KiCAD-Schematic-Manipulation/$NEW_VERSION/"
fi

# Create git tag
echo "🏷️ Creating git tag..."
git add pyproject.toml src/mcp_kicad_sch_api/__init__.py
git commit -m "Release version $NEW_VERSION"
git tag "v$NEW_VERSION"
git push origin main --tags

echo "🎉 Release $NEW_VERSION completed successfully!"
echo "📦 Install with: pip install --upgrade KiCAD-Schematic-Manipulation"

Read the full file on GitHub · 229 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 229 lines · 0 tokens per session scan A 3ffae4ad057c

Subscribe to this mod's changes

publish-pypi is a command published in the GitHub repository richard-luc/KiCAD-Schematic-Manipulation (0 stars, last pushed 5mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,791 tokens. A static security scan graded it A with 0 findings. It is 88% identical to publish-pypi, differing in 14 lines, and is treated as a copy.