@liangjie559567/ultrapower 5.5.40 → 5.5.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
{
|
|
9
9
|
"name": "ultrapower",
|
|
10
10
|
"description": "Disciplined multi-agent orchestration: workflow enforcement + parallel execution",
|
|
11
|
-
"version": "5.5.
|
|
11
|
+
"version": "5.5.42",
|
|
12
12
|
"source": {
|
|
13
13
|
"source": "npm",
|
|
14
14
|
"package": "@liangjie559567/ultrapower",
|
|
15
|
-
"version": "5.5.
|
|
15
|
+
"version": "5.5.42"
|
|
16
16
|
},
|
|
17
17
|
"author": {
|
|
18
18
|
"name": "liangjie559567"
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
# ultrapower 插件发布完整指南
|
|
2
|
+
|
|
3
|
+
## 📋 目录
|
|
4
|
+
|
|
5
|
+
1. [快速发布流程](#快速发布流程)
|
|
6
|
+
2. [发布架构](#发布架构)
|
|
7
|
+
3. [详细步骤](#详细步骤)
|
|
8
|
+
4. [高级配置](#高级配置)
|
|
9
|
+
5. [故障排查](#故障排查)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 快速发布流程
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# 1. 更新版本
|
|
17
|
+
node scripts/bump-version.mjs 5.5.41
|
|
18
|
+
|
|
19
|
+
# 2. 提交到 dev
|
|
20
|
+
git add .
|
|
21
|
+
git commit -m "chore: bump version to 5.5.41"
|
|
22
|
+
git push origin dev
|
|
23
|
+
|
|
24
|
+
# 3. 合并到 main(触发自动发布)
|
|
25
|
+
git checkout main
|
|
26
|
+
git merge dev
|
|
27
|
+
git push origin main
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
GitHub Actions 自动执行:构建 → 测试 → NPM 发布 → GitHub Release → 插件市场同步
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## 发布架构
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
版本更新 → 构建验证 → NPM 发布 → GitHub Release → 插件市场同步
|
|
38
|
+
↓ ↓ ↓ ↓ ↓
|
|
39
|
+
bump-version tsc+test npm publish gh release git push dev
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### 5 步流水线
|
|
43
|
+
|
|
44
|
+
1. **Preflight** - 版本同步校验(5 个配置文件)
|
|
45
|
+
2. **Validate** - TypeScript + 构建 + 测试
|
|
46
|
+
3. **Publish** - NPM 发布(带 provenance)
|
|
47
|
+
4. **Release** - GitHub Release 创建
|
|
48
|
+
5. **Sync** - Marketplace 同步到 dev 分支
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## 详细步骤
|
|
53
|
+
|
|
54
|
+
### Step 1: 版本号更新
|
|
55
|
+
|
|
56
|
+
**自动同步 5 个文件:**
|
|
57
|
+
- `package.json`
|
|
58
|
+
- `.claude-plugin/plugin.json`
|
|
59
|
+
- `.cursor-plugin/plugin.json`
|
|
60
|
+
- `.claude-plugin/marketplace.json`
|
|
61
|
+
- `marketplace.json`
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
node scripts/bump-version.mjs 5.5.41
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**验证版本一致性:**
|
|
68
|
+
```bash
|
|
69
|
+
node scripts/bump-version.mjs
|
|
70
|
+
# 输出: ✓ All in sync
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Step 2: 本地验证
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# TypeScript 类型检查
|
|
77
|
+
tsc --noEmit
|
|
78
|
+
|
|
79
|
+
# 完整构建
|
|
80
|
+
npm run build
|
|
81
|
+
|
|
82
|
+
# 运行测试
|
|
83
|
+
npm test
|
|
84
|
+
|
|
85
|
+
# 预览打包内容
|
|
86
|
+
npm pack --dry-run
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Step 3: 提交变更
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
git add .
|
|
93
|
+
git commit -m "chore: bump version to 5.5.41"
|
|
94
|
+
git push origin dev
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Step 4: 触发发布
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# 合并到 main 触发 GitHub Actions
|
|
101
|
+
git checkout main
|
|
102
|
+
git merge dev
|
|
103
|
+
git push origin main
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Step 5: 验证发布
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# 检查 NPM
|
|
110
|
+
npm view @liangjie559567/ultrapower@5.5.41
|
|
111
|
+
|
|
112
|
+
# 检查 GitHub Release
|
|
113
|
+
gh release view v5.5.41
|
|
114
|
+
|
|
115
|
+
# 检查 provenance
|
|
116
|
+
npm audit signatures
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## 高级配置
|
|
122
|
+
|
|
123
|
+
### NPM Provenance(供应链安全)
|
|
124
|
+
|
|
125
|
+
**已启用:** 发布时自动添加 `--provenance` 标志
|
|
126
|
+
|
|
127
|
+
**验证:**
|
|
128
|
+
```bash
|
|
129
|
+
npm audit signatures
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**查看 provenance:**
|
|
133
|
+
访问 https://www.npmjs.com/package/@liangjie559567/ultrapower
|
|
134
|
+
查看验证徽章
|
|
135
|
+
|
|
136
|
+
### GitHub Actions 缓存
|
|
137
|
+
|
|
138
|
+
**已启用:** 依赖缓存加速 CI/CD
|
|
139
|
+
|
|
140
|
+
**缓存策略:**
|
|
141
|
+
- 路径:`~/.npm`
|
|
142
|
+
- 键:`${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}`
|
|
143
|
+
- 节省时间:30-60 秒
|
|
144
|
+
|
|
145
|
+
### Changesets 集成
|
|
146
|
+
|
|
147
|
+
**当前配置:** 使用 Changesets action 自动化版本管理
|
|
148
|
+
|
|
149
|
+
**工作流:**
|
|
150
|
+
1. 推送到 main → Changesets 检测变更
|
|
151
|
+
2. 有 changeset → 创建版本 PR
|
|
152
|
+
3. 合并 PR → 自动发布
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## 故障排查
|
|
157
|
+
|
|
158
|
+
### 常见问题
|
|
159
|
+
|
|
160
|
+
**Q: 版本不一致错误**
|
|
161
|
+
```bash
|
|
162
|
+
# 重新同步版本
|
|
163
|
+
node scripts/bump-version.mjs 5.5.41
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**Q: 循环依赖错误**
|
|
167
|
+
```bash
|
|
168
|
+
# 检查 package.json dependencies
|
|
169
|
+
# 确保不包含 @liangjie559567/ultrapower
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**Q: NPM 发布失败**
|
|
173
|
+
```bash
|
|
174
|
+
# 检查 NPM_TOKEN
|
|
175
|
+
echo $NPM_TOKEN
|
|
176
|
+
|
|
177
|
+
# 手动发布
|
|
178
|
+
npm publish --access public --provenance
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
**Q: GitHub Release 失败**
|
|
182
|
+
```bash
|
|
183
|
+
# 手动创建
|
|
184
|
+
gh release create v5.5.41 --generate-notes
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### 发布失败恢复
|
|
188
|
+
|
|
189
|
+
详见 [RELEASE_RECOVERY.md](./RELEASE_RECOVERY.md)
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## 安全最佳实践
|
|
194
|
+
|
|
195
|
+
✅ **已实施:**
|
|
196
|
+
- NPM provenance 声明
|
|
197
|
+
- GitHub Actions 权限最小化
|
|
198
|
+
- 短期证书(非长期密钥)
|
|
199
|
+
- 依赖缓存(加速 + 安全)
|
|
200
|
+
|
|
201
|
+
✅ **版本控制:**
|
|
202
|
+
- 严格 semver 格式验证
|
|
203
|
+
- 5 文件版本同步
|
|
204
|
+
- 循环依赖检测
|
|
205
|
+
|
|
206
|
+
✅ **发布验证:**
|
|
207
|
+
- 构建前类型检查
|
|
208
|
+
- 测试门禁
|
|
209
|
+
- 打包内容预览
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## 参考资料
|
|
214
|
+
|
|
215
|
+
- [NPM Package Provenance](https://github.blog/2023-04-19-introducing-npm-package-provenance)
|
|
216
|
+
- [GitHub Actions Caching](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows)
|
|
217
|
+
- [Changesets Documentation](https://github.com/changesets/changesets)
|
|
218
|
+
- [发布失败恢复指南](./RELEASE_RECOVERY.md)
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# 发布失败恢复指南
|
|
2
|
+
|
|
3
|
+
## 快速诊断
|
|
4
|
+
|
|
5
|
+
发布流程的 5 个步骤:
|
|
6
|
+
1. **Preflight** - 版本同步校验
|
|
7
|
+
2. **Validate** - 构建 + 测试
|
|
8
|
+
3. **Publish** - NPM 发布
|
|
9
|
+
4. **Release** - GitHub Release
|
|
10
|
+
5. **Sync** - Marketplace 同步
|
|
11
|
+
|
|
12
|
+
## 恢复策略
|
|
13
|
+
|
|
14
|
+
### 场景 1: NPM 发布成功,但后续步骤失败
|
|
15
|
+
|
|
16
|
+
**症状:** 包已在 npmjs.com 上,但没有 GitHub Release
|
|
17
|
+
|
|
18
|
+
**恢复步骤:**
|
|
19
|
+
```bash
|
|
20
|
+
# 方案 A: 手动创建 GitHub Release
|
|
21
|
+
gh release create v5.5.40 --generate-notes
|
|
22
|
+
|
|
23
|
+
# 方案 B: 标记为弃用并重新发布(< 72小时)
|
|
24
|
+
npm deprecate @liangjie559567/ultrapower@5.5.40 "Incomplete release, use 5.5.41"
|
|
25
|
+
node scripts/bump-version.mjs 5.5.41
|
|
26
|
+
npm run build
|
|
27
|
+
npm publish --provenance
|
|
28
|
+
gh release create v5.5.41 --generate-notes
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### 场景 2: 发布后发现严重 Bug
|
|
32
|
+
|
|
33
|
+
**72 小时内且无依赖:**
|
|
34
|
+
```bash
|
|
35
|
+
npm unpublish @liangjie559567/ultrapower@5.5.40
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**任何时候(推荐):**
|
|
39
|
+
```bash
|
|
40
|
+
npm deprecate @liangjie559567/ultrapower@5.5.40 "Critical bug, use 5.5.41"
|
|
41
|
+
node scripts/bump-version.mjs 5.5.41
|
|
42
|
+
npm run build
|
|
43
|
+
npm test
|
|
44
|
+
npm publish --provenance
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 场景 3: 从特定步骤恢复
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# 从 publish 步骤开始
|
|
51
|
+
node scripts/release-local.mjs --start-from=publish
|
|
52
|
+
|
|
53
|
+
# 从 release 步骤开始
|
|
54
|
+
node scripts/release-local.mjs --start-from=release
|
|
55
|
+
|
|
56
|
+
# 从 sync 步骤开始
|
|
57
|
+
node scripts/release-local.mjs --start-from=sync
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## 预防措施
|
|
61
|
+
|
|
62
|
+
### 发布前检查清单
|
|
63
|
+
|
|
64
|
+
- [ ] 所有测试通过 (`npm test`)
|
|
65
|
+
- [ ] 版本号已更新且一致 (`node scripts/bump-version.mjs`)
|
|
66
|
+
- [ ] 无循环依赖
|
|
67
|
+
- [ ] Git 工作区干净
|
|
68
|
+
- [ ] 本地验证打包内容 (`npm pack --dry-run`)
|
|
69
|
+
|
|
70
|
+
### Dry-run 测试
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
# 完整 dry-run(不实际执行)
|
|
74
|
+
npm run release:dry-run
|
|
75
|
+
|
|
76
|
+
# 或
|
|
77
|
+
node scripts/release-local.mjs --dry-run
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## 紧急联系
|
|
81
|
+
|
|
82
|
+
- NPM 包页面: https://www.npmjs.com/package/@liangjie559567/ultrapower
|
|
83
|
+
- GitHub Releases: https://github.com/liangjie559567/ultrapower/releases
|
|
84
|
+
- 问题报告: https://github.com/liangjie559567/ultrapower/issues
|
package/package.json
CHANGED
|
@@ -29,7 +29,7 @@ export async function preflight(opts = {}) {
|
|
|
29
29
|
export async function validateBuild(opts = {}) {
|
|
30
30
|
const { skipTests = false, dryRun = false } = opts;
|
|
31
31
|
try {
|
|
32
|
-
run('tsc --noEmit', dryRun);
|
|
32
|
+
run('npx tsc --noEmit', dryRun);
|
|
33
33
|
run('npm run build', dryRun);
|
|
34
34
|
if (!skipTests) run('npm run test:run', dryRun);
|
|
35
35
|
return { success: true, output: 'Build validation passed' };
|
|
@@ -39,10 +39,11 @@ export async function validateBuild(opts = {}) {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
export async function publishNpm(opts = {}) {
|
|
42
|
-
const { dryRun = false, tag = 'latest' } = opts;
|
|
42
|
+
const { dryRun = false, tag = 'latest', provenance = true } = opts;
|
|
43
43
|
const version = getVersion();
|
|
44
44
|
try {
|
|
45
|
-
|
|
45
|
+
const provenanceFlag = provenance && process.env.GITHUB_ACTIONS ? '--provenance' : '';
|
|
46
|
+
run(`npm publish --access public --tag ${tag} ${provenanceFlag}`.trim(), dryRun);
|
|
46
47
|
return { success: true, version };
|
|
47
48
|
} catch (err) {
|
|
48
49
|
return { success: false, version, output: err.message };
|
|
@@ -78,6 +79,17 @@ export async function syncMarketplace(opts = {}) {
|
|
|
78
79
|
if (p.source?.version !== version) { p.source.version = version; changed = true; }
|
|
79
80
|
}
|
|
80
81
|
|
|
82
|
+
if (!changed) {
|
|
83
|
+
console.log('syncMarketplace: versions already in sync');
|
|
84
|
+
return { success: true };
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (dryRun) {
|
|
88
|
+
console.log('[dry-run] Would update marketplace.json and plugin.json');
|
|
89
|
+
console.log('[dry-run] Would commit and push to dev');
|
|
90
|
+
return { success: true };
|
|
91
|
+
}
|
|
92
|
+
|
|
81
93
|
// Sync plugin.json
|
|
82
94
|
const pluginPath = resolve('.claude-plugin/plugin.json');
|
|
83
95
|
const plugin = JSON.parse(readFileSync(pluginPath, 'utf-8'));
|
|
@@ -93,9 +105,9 @@ export async function syncMarketplace(opts = {}) {
|
|
|
93
105
|
|
|
94
106
|
writeFileSync(marketplacePath, JSON.stringify(market, null, 2) + '\n');
|
|
95
107
|
writeFileSync(pluginPath, JSON.stringify(plugin, null, 2) + '\n');
|
|
96
|
-
run(`git add .claude-plugin/marketplace.json .claude-plugin/plugin.json`, dryRun);
|
|
97
108
|
|
|
98
109
|
try {
|
|
110
|
+
run(`git add .claude-plugin/marketplace.json .claude-plugin/plugin.json`, dryRun);
|
|
99
111
|
run(`git commit -m "chore: sync marketplace.json to v${version}"`, dryRun);
|
|
100
112
|
run(`git push origin HEAD:dev`, dryRun);
|
|
101
113
|
console.log(`syncMarketplace: updated to v${version} and pushed to dev`);
|
|
@@ -143,7 +155,12 @@ if (cliStep && ['preflight', 'validate', 'publish', 'release', 'sync'].includes(
|
|
|
143
155
|
const dryRun = process.argv.includes('--dry-run');
|
|
144
156
|
const version = process.env.GITHUB_REF_NAME?.replace(/^v/, '') || undefined;
|
|
145
157
|
const stepMap = { preflight, validate: validateBuild, publish: publishNpm, release: createGithubRelease, sync: syncMarketplace };
|
|
146
|
-
stepMap[cliStep]({ dryRun, version })
|
|
147
|
-
|
|
148
|
-
|
|
158
|
+
stepMap[cliStep]({ dryRun, version })
|
|
159
|
+
.then(r => {
|
|
160
|
+
if (!r.success) { console.error(`Step ${cliStep} failed: ${r.output ?? ''}`); process.exit(1); }
|
|
161
|
+
})
|
|
162
|
+
.catch(err => {
|
|
163
|
+
console.error(`Step ${cliStep} threw exception: ${err.message}`);
|
|
164
|
+
process.exit(1);
|
|
165
|
+
});
|
|
149
166
|
}
|