Metadata-Version: 2.4
Name: triple-publish-skill
Version: 1.0.0
Summary: AI skill for three-pipeline publishing — GitHub + npm + PyPI in one command
Author: redredchen01
License: MIT
Project-URL: Homepage, https://github.com/redredchen01/triple-publish-skill
Project-URL: Repository, https://github.com/redredchen01/triple-publish-skill
Keywords: publish,release,npm,pypi,github,ai-agent,skill
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Build Tools
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# 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.

[![npm](https://img.shields.io/npm/v/triple-publish-skill)](https://www.npmjs.com/package/triple-publish-skill)
[![PyPI](https://img.shields.io/pypi/v/triple-publish-skill)](https://pypi.org/project/triple-publish-skill/)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)

---

## 痛點 / The Problem

每次發布都要：

```bash
# 手動改版本號（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

```bash
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

```bash
mkdir -p .cursor/rules
cp triple-publish-skill/SKILL.md .cursor/rules/triple-publish.mdc
```

### Codex / Gemini CLI / 其他

```bash
cat triple-publish-skill/SKILL.md >> AGENTS.md   # 或 GEMINI.md
```

### npm 安裝

```bash
npm install triple-publish-skill
# 然後複製到你的 agent skills 目錄
```

### pip 安裝

```bash
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` → `version`
- `package.json` → `version`
- `SKILL.md` → frontmatter `version`
- `__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
