triple-publish v1.0
一句話三管道發布 — GitHub + npm + PyPI,AI 自動偵測、跑測試、同步版本、全部上架。
One command to publish everywhere. Auto-detects project type, runs tests, syncs versions, ships to all registries.
痛點 / The Problem
每次發布都要:
# 手動改版本號(3 個檔案)
vim pyproject.toml # 改 version
vim package.json # 改 version
vim SKILL.md # 改 version
# 跑測試
pytest && npm test
# Git
git add -A && git commit -m "release v1.2.3" && git push && git tag v1.2.3 && git push --tags
# PyPI
rm -rf dist/ && python -m build && twine upload dist/*
# npm
npm publish --access public
重複、容易出錯、忘記同步版本號。
解法 / The Solution
你:幫我發布到 github & npm & pypi
AI 自動完成全部。
安裝 / Install
Claude Code
git clone https://github.com/redredchen01/triple-publish-skill.git
mkdir -p ~/.claude/skills/triple-publish
cp triple-publish-skill/SKILL.md ~/.claude/skills/triple-publish/SKILL.md
Cursor
mkdir -p .cursor/rules
cp triple-publish-skill/SKILL.md .cursor/rules/triple-publish.mdc
Codex / Gemini CLI / 其他
cat triple-publish-skill/SKILL.md >> AGENTS.md # 或 GEMINI.md
npm 安裝
npm install triple-publish-skill
# 然後複製到你的 agent skills 目錄
pip 安裝
pip install triple-publish-skill
使用方式 / Usage
觸發詞
| 語言 | 觸發詞 |
|---|---|
| 中文 | 發布、上架、三管道發布、推上去 |
| English | publish, release, ship it, triple publish |
| 日本語 | 公開、リリース |
範例
你:發布到 github npm pypi
你:ship it
你:三管道發布,版本升 minor
你:publish patch version
AI 自動流程
🔍 偵測專案類型...
Python (pyproject.toml) → PyPI ✓
Node.js (package.json) → npm ✓
Git remote → GitHub ✓
📋 版本檢查...
pyproject.toml: 0.4.0
package.json: 0.4.0
版本同步 ✓
目前版本 0.4.0,要升版嗎?(patch/minor/major/跳過)
你:patch
🔄 升版 0.4.0 → 0.4.1...
pyproject.toml ✓
package.json ✓
🧪 執行測試...
pytest: 20/20 passed ✓
npm test: passed ✓
📤 發布中...
GitHub: git commit + push ✓
npm: npm publish ✓
PyPI: build + twine upload ✓
🚀 Triple Publish 完成!
| 管道 | 版本 | 狀態 | 連結 |
|------|------|------|------|
| GitHub | v0.4.1 | ✅ | https://github.com/user/repo |
| npm | 0.4.1 | ✅ | https://npmjs.com/package/name |
| PyPI | 0.4.1 | ✅ | https://pypi.org/project/name/0.4.1/ |
功能特色
智慧偵測
自動判斷專案類型和可用的發布管道:
| 檔案 | 偵測為 | 發布到 |
|---|---|---|
pyproject.toml / setup.py |
Python | PyPI |
package.json |
Node.js | npm |
| 兩者都有 | 混合 | npm + PyPI |
| 有 git remote | 任何 | GitHub |
版本同步
自動檢查所有設定檔的版本是否一致:
pyproject.toml→versionpackage.json→versionSKILL.md→ frontmatterversion__init__.py→__version__
版本不一致會先告警,強制同步後才發布。
安全機制
| 機制 | 說明 |
|---|---|
| 測試先行 | 測試沒過就不發布 |
| 乾淨工作區 | 有未提交變更會先提示 |
| Token 不存檔 | PyPI/npm token 不寫入記憶或程式碼 |
| 確認再推 | git tag 前會先問 |
| 版本確認 | 自動升版前會先問 patch/minor/major |
Dry Run
不確定?先模擬:
你:dry run 三管道發布
AI 會顯示所有將執行的步驟,但不實際執行。
前置需求
| 工具 | 用途 | 安裝 |
|---|---|---|
git |
GitHub push | 系統內建 |
gh |
GitHub CLI(可選) | brew install gh |
npm |
npm publish | brew install node |
python3 |
PyPI build | brew install python |
build |
Python 打包 | pip install build |
twine |
PyPI 上傳 | pip install twine |
缺什麼工具就跳過那個管道,不會整個失敗。
支援平台
所有支援文字指令的 AI agent 都能用:
Claude Code、Codex、Gemini CLI、Cursor、Windsurf、Cline、Roo Code、Amp、OpenClaw 等。
常見問題 FAQ
Q: 只想發布到其中一個管道? 直接說:「只推 npm」或「只發 PyPI」。
Q: 版本已經存在怎麼辦? 報錯並建議升版。不會覆蓋已發布的版本。
Q: 沒有 npm/PyPI 帳號? 跳過那個管道,只發布有帳號的。
Q: Token 怎麼處理? 從環境變數或 config 讀取。不存在就即時詢問,用完即棄,不寫入任何檔案。
版本歷史
| 版本 | 日期 | 變更 |
|---|---|---|
| v1.0 | 2026-03-25 | 初版:自動偵測、版本同步、測試、三管道發布 |
Contributing
歡迎 PR:更多 registry 支援(Cargo/crates.io、Go modules、Homebrew)、CI/CD 整合、changelog 自動生成。
License
MIT
Metadata
Release files for triple-publish-skill 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| triple_publish_skill-1.0.0.tar.gz | 4.8 kB | Without provenance | Details for triple_publish_skill-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| triple_publish_skill-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for triple_publish_skill-1.0.0-py3-none-any.whl |
Total release size: 9.7 kB
Release files / triple_publish_skill-1.0.0.tar.gz
| Download URL | triple_publish_skill-1.0.0.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
74e3df453c90ad01ec38d66b27fabdc2832a156e9084fc5138714840fc2fdb47
|
|
BLAKE2b-256 checksum How to use checksums |
d612f5df2df988b7c3c351089345eb498ba3bd548ab6d0f1d8328fdd8a63cf6a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.12
|
Release files / triple_publish_skill-1.0.0-py3-none-any.whl
| Download URL | triple_publish_skill-1.0.0-py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7d05b33fb1fcdac2db6f35a755f152fbba251ed579a08f2a1ee155384c472c74
|
|
BLAKE2b-256 checksum How to use checksums |
117942b65f30dfef05222ef985cfa1fa6e6d7954c1533764ee58be5a32a9d270
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.12
|
Security for triple-publish-skill 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.