@jspg-ai/coding-bb 0.0.3-beta.6 → 0.0.3-beta.8
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.
- package/cbb/dev-standards/rules/cbb-ai-behavior.md +1 -1
- package/cbb/lib/install/claude-code.js +1 -3
- package/cbb/lib/install/codebuddy.js +0 -2
- package/cbb/lib/install/init.js +115 -85
- package/cbb/lib/install/opencode.js +1 -5
- package/cbb/lib/install/qoder.js +1 -3
- package/cbb/lib/install/trae.js +0 -2
- package/cbb/lib/openspec/index.js +337 -554
- package/cbb/lib/superpowers/index.js +246 -265
- package/cbb/lib/utils/tar.js +92 -0
- package/cbb/lib/utils/upstream.js +90 -0
- package/cbb/worktrees/skills/cbb-worktree-close/SKILL.md +31 -22
- package/cbb/worktrees/skills/cbb-worktree-init/SKILL.md +21 -22
- package/cbb/worktrees/skills/cbb-worktree-push/SKILL.md +66 -30
- package/config/openspec/schemas/spec-driven/schema.yaml +21 -30
- package/config/openspec/schemas/spec-driven/templates/design.md +0 -18
- package/config/openspec/schemas/spec-driven/templates/proposal.md +4 -3
- package/config/upstream-mirrors.json +12 -0
- package/config/workspace-agents.sample.md +6 -6
- package/openspec/.version +2 -3
- package/openspec/commands/apply.md +189 -175
- package/openspec/commands/archive.md +237 -216
- package/openspec/commands/bulk-archive.md +355 -327
- package/openspec/commands/continue.md +116 -105
- package/openspec/commands/explore.md +230 -199
- package/openspec/commands/ff.md +115 -104
- package/openspec/commands/new.md +74 -63
- package/openspec/commands/onboard.md +557 -548
- package/openspec/commands/propose.md +161 -150
- package/openspec/commands/sync.md +277 -249
- package/openspec/commands/update.md +92 -80
- package/openspec/commands/verify.md +175 -162
- package/openspec/skills/openspec-apply-change/SKILL.md +20 -5
- package/openspec/skills/openspec-archive-change/SKILL.md +30 -8
- package/openspec/skills/openspec-bulk-archive-change/SKILL.md +36 -6
- package/openspec/skills/openspec-continue-change/SKILL.md +14 -2
- package/openspec/skills/openspec-explore/SKILL.md +21 -9
- package/openspec/skills/openspec-ff-change/SKILL.md +14 -2
- package/openspec/skills/openspec-new-change/SKILL.md +13 -1
- package/openspec/skills/openspec-onboard/SKILL.md +49 -39
- package/openspec/skills/openspec-propose/SKILL.md +15 -3
- package/openspec/skills/openspec-sync-specs/SKILL.md +31 -2
- package/openspec/skills/openspec-update-change/SKILL.md +27 -14
- package/openspec/skills/openspec-verify-change/SKILL.md +17 -3
- package/package.json +1 -1
- package/superpowers/.version +4 -4
- package/superpowers/skills/brainstorming/SKILL.md +47 -12
- package/superpowers/skills/brainstorming/scripts/frame-template.html +213 -213
- package/superpowers/skills/brainstorming/scripts/server.cjs +723 -723
- package/superpowers/skills/brainstorming/visual-companion.md +6 -6
- package/superpowers/skills/diagnosing-superpowers/SKILL.md +120 -0
- package/superpowers/skills/diagnosing-superpowers/prompts/analyst-common.md +38 -0
- package/superpowers/skills/diagnosing-superpowers/prompts/cost-and-time.md +28 -0
- package/superpowers/skills/diagnosing-superpowers/prompts/plan-adherence.md +29 -0
- package/superpowers/skills/diagnosing-superpowers/prompts/quality-evidence.md +26 -0
- package/superpowers/skills/diagnosing-superpowers/prompts/repeated-work.md +30 -0
- package/superpowers/skills/diagnosing-superpowers/prompts/request-conflicts.md +20 -0
- package/superpowers/skills/diagnosing-superpowers/prompts/scrub-audit.md +33 -0
- package/superpowers/skills/diagnosing-superpowers/prompts/scrub.md +29 -0
- package/superpowers/skills/diagnosing-superpowers/prompts/similar-session.md +38 -0
- package/superpowers/skills/diagnosing-superpowers/prompts/skill-timeline.md +30 -0
- package/superpowers/skills/diagnosing-superpowers/prompts/stumbles.md +28 -0
- package/superpowers/skills/diagnosing-superpowers/references/context-safety.md +22 -0
- package/superpowers/skills/diagnosing-superpowers/references/github-issues.md +47 -0
- package/superpowers/skills/diagnosing-superpowers/references/redaction-policy.md +34 -0
- package/superpowers/skills/diagnosing-superpowers/references/session-discovery.md +31 -0
- package/superpowers/skills/diagnosing-superpowers/templates/bundle-README.md +77 -0
- package/superpowers/skills/diagnosing-superpowers/templates/case.md +64 -0
- package/superpowers/skills/diagnosing-superpowers/templates/issue.md +51 -0
- package/superpowers/skills/diagnosing-superpowers/templates/report.md +82 -0
- package/superpowers/skills/executing-plans/SKILL.md +350 -41
- package/superpowers/skills/executing-plans/scripts/task-done +52 -0
- package/superpowers/skills/executing-plans/scripts/task-start +28 -0
- package/superpowers/skills/requesting-code-review/SKILL.md +1 -1
- package/superpowers/skills/requesting-code-review/code-reviewer.md +17 -0
- package/superpowers/skills/subagent-driven-development/SKILL.md +18 -18
- package/superpowers/skills/subagent-driven-development/re-review-prompt.md +1 -1
- package/superpowers/skills/subagent-driven-development/scripts/review-package +53 -46
- package/superpowers/skills/subagent-driven-development/scripts/sdd-workspace +82 -40
- package/superpowers/skills/subagent-driven-development/scripts/task-brief +43 -41
- package/superpowers/skills/subagent-driven-development/task-reviewer-prompt.md +2 -2
- package/superpowers/skills/systematic-debugging/root-cause-tracing.md +1 -1
- package/superpowers/skills/test-driven-development/SKILL.md +10 -0
- package/superpowers/skills/using-superpowers/SKILL.md +2 -0
- package/superpowers/skills/using-superpowers/references/claude-code-tools.md +29 -0
- package/superpowers/skills/using-superpowers/references/muse-tools.md +35 -0
- package/superpowers/skills/writing-plans/SKILL.md +30 -9
- package/superpowers/skills/writing-skills/SKILL.md +4 -2
- package/superpowers/skills/writing-skills/graphviz-conventions.dot +171 -171
- package/cbb/worktrees/commands/worktree-close.md +0 -63
- package/cbb/worktrees/commands/worktree-init.md +0 -50
- package/cbb/worktrees/commands/worktree-push.md +0 -42
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 上游内容拉取的共享工具。
|
|
5
|
+
*
|
|
6
|
+
* 维护者侧(cbbm update --upstream-*)需要访问 GitHub / npm registry。
|
|
7
|
+
* 本模块提供:
|
|
8
|
+
* - 镜像前缀列表加载(config/upstream-mirrors.json,仓库内维护)
|
|
9
|
+
* - 带重定向跟随的 HTTPS GET
|
|
10
|
+
* - 「按镜像列表依次尝试」的拉取策略(首个成功即用)
|
|
11
|
+
*
|
|
12
|
+
* 镜像前缀为空字符串表示直连;列表末位通常放 "" 作为兜底。
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
const fs = require('fs');
|
|
16
|
+
const https = require('https');
|
|
17
|
+
const path = require('path');
|
|
18
|
+
|
|
19
|
+
const SHARED_STANDARDS_DIR = path.join(__dirname, '..', '..', '..');
|
|
20
|
+
const MIRRORS_FILE = path.join(SHARED_STANDARDS_DIR, 'config', 'upstream-mirrors.json');
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* 读取指定上游的镜像前缀列表。
|
|
24
|
+
* 文件缺失 / 解析失败 / 未配置该上游时返回 [''](仅直连)。
|
|
25
|
+
* @param {string} name - 上游名(如 'superpowers')
|
|
26
|
+
* @returns {string[]}
|
|
27
|
+
*/
|
|
28
|
+
function loadMirrors(name) {
|
|
29
|
+
try {
|
|
30
|
+
const data = JSON.parse(fs.readFileSync(MIRRORS_FILE, 'utf-8'));
|
|
31
|
+
const list = data[name];
|
|
32
|
+
if (Array.isArray(list) && list.length > 0) {
|
|
33
|
+
return list.map(m => String(m));
|
|
34
|
+
}
|
|
35
|
+
} catch (_) { /* 回退到直连 */ }
|
|
36
|
+
return [''];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* 发起 HTTPS GET,跟随重定向(最多 8 次),返回响应体 Buffer。
|
|
41
|
+
* @param {string} url
|
|
42
|
+
* @param {number} [redirectCount]
|
|
43
|
+
* @returns {Promise<Buffer>}
|
|
44
|
+
*/
|
|
45
|
+
function httpsGetBuffer(url, redirectCount = 0) {
|
|
46
|
+
if (redirectCount > 8) return Promise.reject(new Error('Too many redirects'));
|
|
47
|
+
return new Promise((resolve, reject) => {
|
|
48
|
+
https.get(url, { headers: { 'User-Agent': 'cbb-cli' } }, res => {
|
|
49
|
+
if ([301, 302, 307, 308].includes(res.statusCode) && res.headers.location) {
|
|
50
|
+
res.resume();
|
|
51
|
+
return httpsGetBuffer(res.headers.location, redirectCount + 1).then(resolve, reject);
|
|
52
|
+
}
|
|
53
|
+
if (res.statusCode !== 200) {
|
|
54
|
+
res.resume();
|
|
55
|
+
return reject(new Error(`HTTP ${res.statusCode}: ${url}`));
|
|
56
|
+
}
|
|
57
|
+
const chunks = [];
|
|
58
|
+
res.on('data', c => chunks.push(c));
|
|
59
|
+
res.on('end', () => resolve(Buffer.concat(chunks)));
|
|
60
|
+
res.on('error', reject);
|
|
61
|
+
}).on('error', reject);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* 按镜像列表依次尝试拉取,首个成功即返回。
|
|
67
|
+
* @param {string[]} mirrors - 镜像前缀列表('' = 直连)
|
|
68
|
+
* @param {(prefix: string) => string} buildUrl - 由前缀构造完整 URL
|
|
69
|
+
* @returns {Promise<{buffer: Buffer, mirror: string, url: string}>}
|
|
70
|
+
*/
|
|
71
|
+
async function fetchWithMirrors(mirrors, buildUrl) {
|
|
72
|
+
const errors = [];
|
|
73
|
+
for (const mirror of mirrors) {
|
|
74
|
+
const url = buildUrl(mirror);
|
|
75
|
+
try {
|
|
76
|
+
const buffer = await httpsGetBuffer(url);
|
|
77
|
+
return { buffer, mirror, url };
|
|
78
|
+
} catch (err) {
|
|
79
|
+
errors.push(`${mirror || '(直连)'}: ${err.message}`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
throw new Error(`所有镜像均失败:\n ${errors.join('\n ')}`);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
module.exports = {
|
|
86
|
+
MIRRORS_FILE,
|
|
87
|
+
loadMirrors,
|
|
88
|
+
httpsGetBuffer,
|
|
89
|
+
fetchWithMirrors,
|
|
90
|
+
};
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: cbb-worktree-close
|
|
3
3
|
description: "关闭/清理/删除需求工作空间的 worktree 和分支。触发:用户明确说关闭/清理/删除 worktree、结束隔离开发、合并完要清理。禁止在 cbb-worktree-init 执行后自动调用——只有用户主动要求关闭时才触发。"
|
|
4
|
-
license: MIT
|
|
5
|
-
compatibility: Requires git (>=2.30) and Node.js (>=16.7.0). All commands are pure Node.js scripts under `scripts/`, fully cross-platform (Windows / macOS / Linux, bash / PowerShell / Git Bash).
|
|
6
|
-
metadata:
|
|
7
|
-
author: Contributors
|
|
8
|
-
version: "2.0"
|
|
9
|
-
generatedBy: coding-bb
|
|
10
4
|
---
|
|
11
5
|
|
|
12
6
|
# Close Worktree(跨平台脚本化版本 v2.0)
|
|
@@ -29,12 +23,28 @@ metadata:
|
|
|
29
23
|
|
|
30
24
|
---
|
|
31
25
|
|
|
26
|
+
## 调用脚本的统一方式
|
|
27
|
+
|
|
28
|
+
**重要**:本技能的所有脚本位于**本 SKILL.md 所在目录的 `scripts/` 下**(skill 目录)。
|
|
29
|
+
|
|
30
|
+
调用时用**本技能目录的绝对路径**拼接脚本名(AI 读取本 SKILL.md 时即已知该目录),例如:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
node "<skill_dir>/scripts/<name>.js" <参数>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
> - `<skill_dir>` = 本 SKILL.md 所在目录的绝对路径(AI 从读取路径即可推出)
|
|
37
|
+
> - **cwd 必须保持在工作空间根目录**:脚本按 cwd 定位 `workspace-config.json` 与 git 仓库
|
|
38
|
+
> - 不要用 `./scripts/...` 裸相对路径(AI 的 cwd 不是技能目录,会解析失败)
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
32
42
|
## Step 0:前置校验
|
|
33
43
|
|
|
34
44
|
### 0.1 环境健康探活
|
|
35
45
|
|
|
36
46
|
```bash
|
|
37
|
-
node "
|
|
47
|
+
node "<skill_dir>/scripts/check-env.js"
|
|
38
48
|
```
|
|
39
49
|
|
|
40
50
|
**解读输出**:
|
|
@@ -45,7 +55,7 @@ node "D:/workspace/<ws_root>/.cbb/skills/cbb-worktree-close/scripts/check-env.js
|
|
|
45
55
|
### 0.2 定位工作空间根目录
|
|
46
56
|
|
|
47
57
|
```bash
|
|
48
|
-
node "
|
|
58
|
+
node "<skill_dir>/scripts/find-workspace-root.js"
|
|
49
59
|
```
|
|
50
60
|
|
|
51
61
|
**解读输出**:
|
|
@@ -69,7 +79,7 @@ node "D:/workspace/<ws_root>/.cbb/skills/cbb-worktree-close/scripts/find-workspa
|
|
|
69
79
|
3. AI agent 列出 `.worktrees/` 下的所有 worktree:
|
|
70
80
|
|
|
71
81
|
```bash
|
|
72
|
-
node "
|
|
82
|
+
node "<skill_dir>/scripts/find-target-worktree.js "<ws_root>"
|
|
73
83
|
```
|
|
74
84
|
|
|
75
85
|
> 注:本技能支持工作空间根目录或 worktree 内执行,find-target-worktree 自动从 cwd 反推或列出。
|
|
@@ -84,7 +94,7 @@ node "D:/workspace/<ws_root>/.cbb/skills/cbb-worktree-close/scripts/find-target-
|
|
|
84
94
|
### 1.2 发现关联应用 worktree
|
|
85
95
|
|
|
86
96
|
```bash
|
|
87
|
-
node "
|
|
97
|
+
node "<skill_dir>/scripts/discover-apps.js "<ws_root>" "<branch>"
|
|
88
98
|
```
|
|
89
99
|
|
|
90
100
|
脚本自动从 `workspace-config.json` 读取应用列表,扫描 `.worktrees/worktree-<branch>/<应用名>/` 实际存在的子目录。
|
|
@@ -93,12 +103,12 @@ node "D:/workspace/<ws_root>/.cbb/skills/cbb-worktree-close/scripts/discover-app
|
|
|
93
103
|
- `workspace` 字段:workspace worktree 绝对路径(AI agent 记录供后续命令使用)
|
|
94
104
|
- `apps` 数组:实际存在的应用 worktree 列表(每项含 `name`, `repo`, `side`, `wt_path`, `app_path`)
|
|
95
105
|
|
|
96
|
-
> 说明:app worktree 物理嵌套在 workspace worktree 内,移除 workspace worktree 时嵌套的子目录会一并消失,但各 app 仓库的 git worktree 元数据(`.git/worktrees/`)仍需通过 `git worktree remove` 逐个清理。AI
|
|
106
|
+
> 说明:app worktree 物理嵌套在 workspace worktree 内,移除 workspace worktree 时嵌套的子目录会一并消失,但各 app 仓库的 git worktree 元数据(`.git/worktrees/`)仍需通过 `git worktree remove` 逐个清理。AI 配置只装在业务空间根(单层安装),worktree 内没有 AI 配置目录,无需特殊处理。
|
|
97
107
|
|
|
98
108
|
### 1.3 检查未归档 change
|
|
99
109
|
|
|
100
110
|
```bash
|
|
101
|
-
node "
|
|
111
|
+
node "<skill_dir>/scripts/check-unarchived.js "<ws_root>"
|
|
102
112
|
```
|
|
103
113
|
|
|
104
114
|
脚本扫描 `openspec/changes/` 目录,筛选出非 `archive/` 子目录的 change 名称列表。
|
|
@@ -117,7 +127,7 @@ node "D:/workspace/<ws_root>/.cbb/skills/cbb-worktree-close/scripts/check-unarch
|
|
|
117
127
|
对 workspace worktree 和每个关联应用 worktree,依次执行三项检查并汇总成安全状态表。**这是破坏性操作前的必经环节,结果将驱动 Step 3 的用户决策。**
|
|
118
128
|
|
|
119
129
|
```bash
|
|
120
|
-
node "
|
|
130
|
+
node "<skill_dir>/scripts/safety-check.js "<ws_root>" "<branch>"
|
|
121
131
|
```
|
|
122
132
|
|
|
123
133
|
脚本内部对每个仓库自动执行:
|
|
@@ -226,10 +236,10 @@ AskUserQuestion({
|
|
|
226
236
|
|
|
227
237
|
```bash
|
|
228
238
|
# 仅删本地分支(已合并自动 -d,未合并自动 -D;含 squash 合并 -D 兜底)
|
|
229
|
-
node "<
|
|
239
|
+
node "<skill_dir>/scripts/delete-branches.js" "<ws_root>" "<branch>" local
|
|
230
240
|
|
|
231
241
|
# 删本地 + 远程分支
|
|
232
|
-
node "<
|
|
242
|
+
node "<skill_dir>/scripts/delete-branches.js" "<ws_root>" "<branch>" local_remote
|
|
233
243
|
```
|
|
234
244
|
|
|
235
245
|
**调用前的强警告**(调用方需自评):
|
|
@@ -260,7 +270,7 @@ node "<skill>/scripts/delete-branches.js" "<ws_root>" "<branch>" local_remote
|
|
|
260
270
|
[中止] 终止流程,我先手动处理
|
|
261
271
|
```
|
|
262
272
|
|
|
263
|
-
- 用户选择「先推送」→ AI 引导用户执行 `cbb-worktree-push
|
|
273
|
+
- 用户选择「先推送」→ AI 引导用户执行 `cbb-worktree-push` skill(或 `/cbb-worktree-push`),完成后**重新跑** Step 2 safety-check 确认 `unpushed_count = 0` 再回到本步骤
|
|
264
274
|
- 用户选择「接受丢失」→ 必须二次确认(ahead 提交真的会丢),确认后继续 Step 4
|
|
265
275
|
- 用户选择「中止」→ 终止流程
|
|
266
276
|
|
|
@@ -289,7 +299,7 @@ node "<skill>/scripts/delete-branches.js" "<ws_root>" "<branch>" local_remote
|
|
|
289
299
|
**顺序:先移除各应用 worktree,再移除 workspace worktree**(逆序于创建;也为后续删分支扫清"分支仍被检出"的障碍)。
|
|
290
300
|
|
|
291
301
|
```bash
|
|
292
|
-
node "
|
|
302
|
+
node "<skill_dir>/scripts/remove-worktrees.js "<ws_root>" "<branch>" "<force>"
|
|
293
303
|
```
|
|
294
304
|
|
|
295
305
|
**三层降级策略**:`git worktree remove` 实际包含两个动作——①清理 git 元数据(`.git/worktrees/`)②删除物理目录。当 IDE 占用目录时 ② 会被 Windows 文件锁阻塞,但 ① 永远不受影响。脚本将这两个动作解耦:
|
|
@@ -333,9 +343,9 @@ node "D:/workspace/<ws_root>/.cbb/skills/cbb-worktree-close/scripts/remove-workt
|
|
|
333
343
|
如用户在 Step 1.1 选定 worktree 时已要求"删除分支",或运行后需要单独清理,可在此步骤**手动调用**:
|
|
334
344
|
|
|
335
345
|
```bash
|
|
336
|
-
node "<
|
|
346
|
+
node "<skill_dir>/scripts/delete-branches.js" "<ws_root>" "<branch>" local
|
|
337
347
|
# 或
|
|
338
|
-
node "<
|
|
348
|
+
node "<skill_dir>/scripts/delete-branches.js" "<ws_root>" "<branch>" local_remote
|
|
339
349
|
```
|
|
340
350
|
|
|
341
351
|
脚本内部对每个仓库:
|
|
@@ -388,7 +398,6 @@ git -C "<ws_root>" worktree list
|
|
|
388
398
|
⏭️ fix-payment-timeout → 用户选择跳过
|
|
389
399
|
(无未归档 change 时不显示本节)
|
|
390
400
|
分支处理:feature-xxx 已保留(默认行为;如需删除分支,手动调用 scripts/delete-branches.js)
|
|
391
|
-
AI 配置:worktree 内独立安装,随 worktree 删除而清理;工作空间根目录的 AI 配置保留
|
|
392
401
|
剩余工作空间 worktree:<列出仍存在的,或 "无" >
|
|
393
402
|
Workspace cleaned up.
|
|
394
403
|
```
|
|
@@ -411,7 +420,7 @@ git -C "<ws_root>" worktree list
|
|
|
411
420
|
- 未经用户确认用 `--force` 丢弃未提交修改,或主动调用 `delete-branches.js` 对未合并分支执行 `-D` 强删
|
|
412
421
|
- 操作 `.worktrees/worktree-<需求名>` 以外的任何 worktree(如 `~/.qoder/worktree/...` 会话 worktree)
|
|
413
422
|
- 移除/删除前跳过 Step 2 安全评估
|
|
414
|
-
- 删除工作空间根目录的 AI 配置目录(`.claude/`、`.qoder/`、`.
|
|
423
|
+
- 删除工作空间根目录的 AI 配置目录(`.claude/`、`.qoder/`、`.opencode/` 等)
|
|
415
424
|
- 用 `AskUserQuestion` 收集自由文本(分支名等直接对话提问)
|
|
416
425
|
- 手动改任何仓库的 `.gitignore`(关闭流程不碰它)
|
|
417
426
|
- 运行环境 node 不可用时强行继续 → 改为 fail-fast 提示用户
|
|
@@ -429,7 +438,7 @@ git -C "<ws_root>" worktree list
|
|
|
429
438
|
- **合并判定依赖刷新后的远程引用,故 Step 2.0 先主动 `git fetch`**:feature 多由他人经 MR 合入远端,本地引用否则会陈旧误判
|
|
430
439
|
- **并行块用临时文件收结果、不用共享变量**:原 bash 版本中 `&` 后台任务跑在独立子 shell;Node.js 同步执行无此问题
|
|
431
440
|
- **`.gitignore` 无需清理**:创建时的 `.worktrees/` 条目提交在 feature 分支上,删分支时随分支消失(未合并)或无害保留(已合并)
|
|
432
|
-
- **AI
|
|
441
|
+
- **AI 配置只装在空间根(单层安装)**:worktree 内没有 AI 配置目录,关闭时无需处理
|
|
433
442
|
- **部分 `worktree remove` 失败**:已移除的无需回退,未移除的报告详情让用户处理后重跑
|
|
434
443
|
- **Windows IDE 目录锁的三层降级**:`git worktree remove` 内部做两件事——①清元数据 ②删目录。Windows 文件锁只阻塞 ②,不阻塞 ①
|
|
435
444
|
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: cbb-worktree-init
|
|
3
3
|
description: "为一个需求在 workspace 与各关联应用仓库(= workspace-config.json 全量 apps)同步创建同名物理 git worktree,直聚在 `.worktrees/worktree-<需求名>/` 下。触发:用户明确要求创建需求工作空间/开发隔离环境,或为已有需求补齐新增应用(重跑本技能即幂等)。禁止自动串联 cbb-worktree-close——除非用户明确说了要关闭。"
|
|
4
|
-
license: MIT
|
|
5
|
-
compatibility: Requires git (>=2.30) and Node.js (>=16.7.0). All commands are pure Node.js scripts under `scripts/`, fully cross-platform (Windows / macOS / Linux, bash / PowerShell / Git Bash).
|
|
6
|
-
metadata:
|
|
7
|
-
author: Contributors
|
|
8
|
-
version: "2.0"
|
|
9
|
-
generatedBy: coding-bb
|
|
10
4
|
---
|
|
11
5
|
|
|
12
6
|
# Init Worktree(跨平台脚本化版本 v2.0)
|
|
@@ -28,13 +22,18 @@ metadata:
|
|
|
28
22
|
|
|
29
23
|
## 调用脚本的统一方式
|
|
30
24
|
|
|
31
|
-
|
|
25
|
+
**重要**:本技能的所有脚本位于**本 SKILL.md 所在目录的 `scripts/` 下**(skill 目录)。
|
|
32
26
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
27
|
+
调用时用**本技能目录的绝对路径**拼接脚本名(AI 读取本 SKILL.md 时即已知该目录),例如:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
node "<skill_dir>/scripts/<name>.js" <参数>
|
|
36
31
|
```
|
|
37
32
|
|
|
33
|
+
> - `<skill_dir>` = 本 SKILL.md 所在目录的绝对路径(AI 从读取路径即可推出)
|
|
34
|
+
> - **cwd 必须保持在工作空间根目录**:脚本按 cwd 定位 `workspace-config.json` 与 git 仓库
|
|
35
|
+
> - 不要用 `./scripts/...` 裸相对路径(AI 的 cwd 不是技能目录,会解析失败)
|
|
36
|
+
|
|
38
37
|
脚本输出:
|
|
39
38
|
- 人类可读报告(OK / FAIL / WARN)
|
|
40
39
|
- 机器可读摘要(末行以 XXX_OK / XXX_FAILED / XXX_RESULT 开头)
|
|
@@ -54,7 +53,7 @@ node "D:\workspace\<用户工作空间>\.cbb\skills\cbb-worktree-init\scripts\<n
|
|
|
54
53
|
### 0.1 环境健康探活
|
|
55
54
|
|
|
56
55
|
```bash
|
|
57
|
-
node "
|
|
56
|
+
node "<skill_dir>/scripts/check-env.js"
|
|
58
57
|
```
|
|
59
58
|
|
|
60
59
|
**解读输出**:
|
|
@@ -67,7 +66,7 @@ node "D:/workspace/<ws_root>/.cbb/skills/cbb-worktree-init/scripts/check-env.js"
|
|
|
67
66
|
提前检测权限/版本问题,把可能在后续步骤暴露的失败前移到流程最开始:
|
|
68
67
|
|
|
69
68
|
```bash
|
|
70
|
-
node "
|
|
69
|
+
node "<skill_dir>/scripts/check-env-deep.js"
|
|
71
70
|
```
|
|
72
71
|
|
|
73
72
|
**解读输出**:
|
|
@@ -81,7 +80,7 @@ node "D:/workspace/<ws_root>/.cbb/skills/cbb-worktree-init/scripts/check-env-dee
|
|
|
81
80
|
### 0.2 读取并校验 workspace-config.json
|
|
82
81
|
|
|
83
82
|
```bash
|
|
84
|
-
node "
|
|
83
|
+
node "<skill_dir>/scripts/parse-config.js"
|
|
85
84
|
```
|
|
86
85
|
|
|
87
86
|
**解读输出**:
|
|
@@ -148,7 +147,7 @@ worktree 需要知道要关联哪些应用仓库。
|
|
|
148
147
|
|
|
149
148
|
```bash
|
|
150
149
|
# ws_root 来自 AI agent 维护的状态
|
|
151
|
-
node "
|
|
150
|
+
node "<skill_dir>/scripts/sync-repos.js" "<ws_root>"
|
|
152
151
|
```
|
|
153
152
|
|
|
154
153
|
**用法**:
|
|
@@ -192,7 +191,7 @@ node "D:/workspace/<ws_root>/.cbb/skills/cbb-worktree-init/scripts/sync-repos.js
|
|
|
192
191
|
| 当前在主分支上 | ✅ | ❌ |
|
|
193
192
|
|
|
194
193
|
```bash
|
|
195
|
-
node "
|
|
194
|
+
node "<skill_dir>/scripts/check-repos.js" "<ws_root>"
|
|
196
195
|
```
|
|
197
196
|
|
|
198
197
|
**解读输出**:
|
|
@@ -220,7 +219,7 @@ node "D:/workspace/<ws_root>/.cbb/skills/cbb-worktree-init/scripts/check-repos.j
|
|
|
220
219
|
### 3.2 安全更新 .gitignore(前置)
|
|
221
220
|
|
|
222
221
|
```bash
|
|
223
|
-
node "
|
|
222
|
+
node "<skill_dir>/scripts/update-gitignore.js "<ws_root>" "<branch>"
|
|
224
223
|
```
|
|
225
224
|
|
|
226
225
|
脚本内部自动完成:stash 保护 → 切分支 → 添加 `.worktrees/` 和 `.codespace/` → 提交 → 切回 → pop stash
|
|
@@ -234,7 +233,7 @@ node "D:/workspace/<ws_root>/.cbb/skills/cbb-worktree-init/scripts/update-gitign
|
|
|
234
233
|
### 3.3 创建分支
|
|
235
234
|
|
|
236
235
|
```bash
|
|
237
|
-
node "
|
|
236
|
+
node "<skill_dir>/scripts/create-branches.js" "<ws_root>" "<branch>"
|
|
238
237
|
```
|
|
239
238
|
|
|
240
239
|
**解读输出**:
|
|
@@ -259,7 +258,7 @@ node "D:/workspace/<ws_root>/.cbb/skills/cbb-worktree-init/scripts/create-branch
|
|
|
259
258
|
### 3.4 推送并建立 upstream
|
|
260
259
|
|
|
261
260
|
```bash
|
|
262
|
-
node "
|
|
261
|
+
node "<skill_dir>/scripts/push-branches.js" "<ws_root>" "<branch>"
|
|
263
262
|
```
|
|
264
263
|
|
|
265
264
|
脚本内部自动完成:
|
|
@@ -287,7 +286,7 @@ node "D:/workspace/<ws_root>/.cbb/skills/cbb-worktree-init/scripts/push-branches
|
|
|
287
286
|
### 3.5 创建 Worktree(含自愈清理)
|
|
288
287
|
|
|
289
288
|
```bash
|
|
290
|
-
node "
|
|
289
|
+
node "<skill_dir>/scripts/create-worktrees.js" "<ws_root>" "<branch>"
|
|
291
290
|
```
|
|
292
291
|
|
|
293
292
|
脚本内部自动完成:
|
|
@@ -347,7 +346,7 @@ WT_PATH d:\workspace\xxx\.worktrees\worktree-feature-login
|
|
|
347
346
|
|------|----------|
|
|
348
347
|
| 空间新增了应用(编辑 `workspace-config.json` 后) | Step 1 拉取新应用代码 → Step 3.3 为新应用建分支 → Step 3.4 推送(已一致的分支 `skipped`,不一致则阻塞询问)→ Step 3.5 创建缺失的嵌套 worktree |
|
|
349
348
|
| 上次 init 中途失败 | 已存在的分支 / worktree 自动复用,`.gitignore` 处理自动跳过,仅补齐缺失部分 |
|
|
350
|
-
| 应用从 config 移除 | 已创建的分支 / worktree **不会**自动删除;如需清理用
|
|
349
|
+
| 应用从 config 移除 | 已创建的分支 / worktree **不会**自动删除;如需清理用 `cbb-worktree-close` skill 关闭后重建 |
|
|
351
350
|
|
|
352
351
|
> ⓘ 重跑**不会静默推送**开发中的本地提交:远程分支已存在但与本地不一致时,Step 3.4 走阻塞式 `remote-exists` 决策(展示 commit 元信息让用户选择)。
|
|
353
352
|
|
|
@@ -368,7 +367,7 @@ WT_PATH d:\workspace\xxx\.worktrees\worktree-feature-login
|
|
|
368
367
|
| 运行环境 node 不可用 | 脚本 fail-fast 并提示用户到系统终端重试 |
|
|
369
368
|
| push 失败(SSH/HTTPS/网络/保护) | push-branches.js 退出码 2,AI 阻塞并询问用户三选项(修复后重试/跳过失败仓库/完全终止) |
|
|
370
369
|
| 远程分支已存在 | push-branches.js 输出 metadata,AI 展示 commit 元信息后询问两选项(关联/终止+重新创建) |
|
|
371
|
-
| 开发过程中推送所有 worktree | Step 3.4 仅覆盖创建时的空 commit;开发过程中产生的提交必须调
|
|
370
|
+
| 开发过程中推送所有 worktree | Step 3.4 仅覆盖创建时的空 commit;开发过程中产生的提交必须调 `cbb-worktree-push` skill 推送(详见该 skill) |
|
|
372
371
|
|
|
373
372
|
---
|
|
374
373
|
|
|
@@ -467,7 +466,7 @@ WT_PATH d:\workspace\xxx\.worktrees\worktree-feature-login
|
|
|
467
466
|
- workspace 仓库标准检查(当前在主分支等),app 仓库轻量检查(fetch + `origin/main` 可用即可)
|
|
468
467
|
- app 仓库分支从 `origin/main` 创建(`git branch <需求名> ${REMOTE}/${MAIN}`),不依赖本地主分支状态
|
|
469
468
|
- 严格 Step 3.3 → Step 3.4 顺序(先统一创建分支,再统一创建 worktree;workspace 工作树先建,各应用按序补建)
|
|
470
|
-
- 所有脚本调用以 `node "<
|
|
469
|
+
- 所有脚本调用以 `node "<skill_dir>/scripts/<name>.js" "<绝对路径>" "<branch>"` 形式发起(apps 由脚本内部从 workspace-config.json 读取);**执行时 cwd 保持在工作空间根**(`check-env.js` / `parse-config.js` 按 cwd 定位)
|
|
471
470
|
- **Step 3.4 push 步骤必须执行且插入在 create-branches.js (3.3) 之后、create-worktrees.js (3.5) 之前** — 失败时阻塞整个 init-worktree 流程
|
|
472
471
|
- **Step 3.4 仅覆盖创建 worktree 时的空 commit** — 开发过程中产生的本地 commit(如 apply 任务实现)必须由用户在 worktree 中手动提交并调 `cbb-worktree-push` 推送;不允许依赖 Step 3.4 之后的自动推送(不存在)
|
|
473
472
|
|
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: cbb-worktree-push
|
|
3
|
-
description: "
|
|
4
|
-
license: MIT
|
|
5
|
-
compatibility: Requires git (>=2.30) and Node.js (>=16.7.0). All commands are pure Node.js scripts under `scripts/`, fully cross-platform (Windows / macOS / Linux, bash / PowerShell / Git Bash).
|
|
6
|
-
metadata:
|
|
7
|
-
author: Contributors
|
|
8
|
-
version: "1.0"
|
|
9
|
-
generatedBy: coding-bb
|
|
3
|
+
description: "提交并推送当前需求的所有关联仓库(跨 worktree 批量)。触发:用户说'提交'/'commit'/'push'/'推送'/'提交并push'/'推到远端';用户在 .worktrees/worktree-<需求名>/ 下工作要求批量推送;apply 完成后准备推送所有 worktree;close-worktree 前需要先推送未提交改动。注意:本技能会先识别场景——不在 cbb 工作空间时降级为普通单仓库提交推送。"
|
|
10
4
|
---
|
|
11
5
|
|
|
12
6
|
# Push Worktrees(跨平台脚本化版本 v1.0)
|
|
13
7
|
|
|
14
|
-
|
|
8
|
+
提交并推送当前需求的所有关联仓库(跨 worktree 批量)。专门解决"开发完成后批量推送"和"用户口语化提交并push"两类场景,弥补 [cbb-worktree-init Step 3.4](file:///d:/workspace/va-ai/coding-bb/cbb/worktrees/skills/cbb-worktree-init/SKILL.md) 仅推送初始空 commit 的缺口。
|
|
15
9
|
|
|
16
|
-
|
|
10
|
+
> **本技能描述含宽泛触发词("提交"/"push"),允许被误触发**。因此第一步永远是 **Step 0 场景识别**:在 cbb 工作空间内才走跨 worktree 批量流程;在普通 git 仓库降级为单仓库提交推送;非 git 目录则退出。
|
|
11
|
+
|
|
12
|
+
**启动时声明:** "我正在使用 cbb-worktree-push 技能来推送当前需求的关联仓库。"
|
|
17
13
|
|
|
18
14
|
## 核心原则
|
|
19
15
|
|
|
@@ -30,12 +26,18 @@ metadata:
|
|
|
30
26
|
|
|
31
27
|
## 调用脚本的统一方式
|
|
32
28
|
|
|
33
|
-
|
|
29
|
+
**重要**:本技能的所有脚本位于**本 SKILL.md 所在目录的 `scripts/` 下**(skill 目录)。
|
|
30
|
+
|
|
31
|
+
调用时用**本技能目录的绝对路径**拼接脚本名(AI 读取本 SKILL.md 时即已知该目录):
|
|
34
32
|
|
|
35
33
|
```
|
|
36
|
-
node "<
|
|
34
|
+
node "<skill_dir>/scripts/<name>.js" <参数>
|
|
37
35
|
```
|
|
38
36
|
|
|
37
|
+
> - `<skill_dir>` = 本 SKILL.md 所在目录的绝对路径(AI 从读取路径即可推出)
|
|
38
|
+
> - **cwd 必须保持在工作空间根目录**:脚本按 cwd 定位 `workspace-config.json` 与 git 仓库
|
|
39
|
+
> - 不要用 `./scripts/...` 裸相对路径(AI 的 cwd 不是技能目录,会解析失败)
|
|
40
|
+
|
|
39
41
|
脚本输出:
|
|
40
42
|
- 人类可读报告(OK / FAIL / WARN)
|
|
41
43
|
- 机器可读摘要(末行以 `COMMIT_RESULT` / `PUSH_RESULT` 开头)
|
|
@@ -43,22 +45,48 @@ node "<ws_root>/.cbb/skills/cbb-worktree-push/scripts/<name>.js" <参数>
|
|
|
43
45
|
|
|
44
46
|
---
|
|
45
47
|
|
|
46
|
-
## Step 0
|
|
48
|
+
## Step 0:场景识别(先判场景,再定策略)
|
|
49
|
+
|
|
50
|
+
**本技能允许被"提交"/"push"这类宽泛措辞误触发**。执行任何操作前,先判断当前处于哪种场景,按场景选择策略——**不要硬套 cbb 工作空间流程**。
|
|
51
|
+
|
|
52
|
+
判断依据(任一命中即定场景):
|
|
53
|
+
|
|
54
|
+
| 场景 | 判据 | 策略 |
|
|
55
|
+
|------|------|------|
|
|
56
|
+
| **A. cbb 工作空间根** | cwd(或其 git 顶层)含 `workspace-config.json`;`find-workspace-root.js` 退出码 0 | 走 **Step 1 → 6** 的跨 worktree 批量流程 |
|
|
57
|
+
| **B. worktree 内** | cwd 命中 `<ws_root>/.worktrees/worktree-<需求名>/` | 用 cwd 反推 `<需求名>`,走 **Step 1 → 6** 批量流程 |
|
|
58
|
+
| **C. 普通 git 仓库** | 在 git 仓库内,但无 `workspace-config.json`(`find-workspace-root.js` 退出码 1) | **降级为单仓库提交推送**:不调 worktree 脚本,按常规 `git add -u` → 向用户询问 commit 信息 → `git commit` → `git push`(保留本 skill 的"必问 commit 信息"约束) |
|
|
59
|
+
| **D. 非 git 目录** | `git rev-parse --is-inside-work-tree` 失败 | 说明"当前目录不是 git 仓库",终止,不做任何操作 |
|
|
60
|
+
|
|
61
|
+
**判场景与定位(A/B 场景):**
|
|
47
62
|
|
|
48
63
|
```bash
|
|
49
|
-
node "<
|
|
64
|
+
node "<skill_dir>/scripts/find-workspace-root.js"
|
|
50
65
|
```
|
|
51
66
|
|
|
52
67
|
**解读末行**:
|
|
53
|
-
- 退出码 0 + 末行(纯路径) → WS_ROOT
|
|
54
|
-
- 退出码 1 →
|
|
68
|
+
- 退出码 0 + 末行(纯路径) → WS_ROOT(场景 A/B),继续 Step 1
|
|
69
|
+
- 退出码 1 → 无工作空间:**先判断场景 C 还是 D**(`git rev-parse --is-inside-work-tree`):
|
|
70
|
+
- 是 git 仓库 → 场景 C,按降级策略走(见下)
|
|
71
|
+
- 不是 → 场景 D,终止
|
|
72
|
+
|
|
73
|
+
**场景 C 降级流程**(普通仓库误触):
|
|
74
|
+
|
|
75
|
+
1. `git status` 报告改动现状
|
|
76
|
+
2. 直接对话询问 commit 信息(**禁止**自动生成)
|
|
77
|
+
3. `git add -u`(默认不含未追踪文件;用户明确要求时才 `git add -A`)
|
|
78
|
+
4. `git commit -m "<用户提供的信息>"`
|
|
79
|
+
5. `git push`(无 upstream 时先询问用户是否 `-u`)
|
|
80
|
+
6. 汇报结果;**不要**提及 worktree 批量流程
|
|
81
|
+
|
|
82
|
+
> 场景 C 是兜底:让"提交代码"在普通仓库里也能正常完成,而不是因找不到 `workspace-config.json` 报错。
|
|
55
83
|
|
|
56
84
|
---
|
|
57
85
|
|
|
58
|
-
## Step 1:识别目标 worktree
|
|
86
|
+
## Step 1:识别目标 worktree(A/B 场景)
|
|
59
87
|
|
|
60
88
|
```bash
|
|
61
|
-
node "<
|
|
89
|
+
node "<skill_dir>/scripts/find-target-worktree.js" "<ws_root>"
|
|
62
90
|
```
|
|
63
91
|
|
|
64
92
|
**解读末行**:
|
|
@@ -72,7 +100,7 @@ node "<ws_root>/.cbb/skills/cbb-worktree-push/scripts/find-target-worktree.js" "
|
|
|
72
100
|
|
|
73
101
|
```bash
|
|
74
102
|
# 仅 commit 阶段先做 dry-run 预览
|
|
75
|
-
node "<
|
|
103
|
+
node "<skill_dir>/scripts/commit-worktrees.js" "<ws_root>" "<branch>" --message "preview" --dry-run
|
|
76
104
|
```
|
|
77
105
|
|
|
78
106
|
**解读末行 `COMMIT_RESULT`**:每项仓库的状态
|
|
@@ -119,16 +147,16 @@ AI agent 在执行真实 commit 前**必须**在对话中向用户确认 commit
|
|
|
119
147
|
|
|
120
148
|
```bash
|
|
121
149
|
# 统一信息
|
|
122
|
-
node "<
|
|
150
|
+
node "<skill_dir>/scripts/commit-worktrees.js" "<ws_root>" "<branch>" --message "feat(<branch>): 实现客户运费逻辑"
|
|
123
151
|
|
|
124
152
|
# 多仓库分别
|
|
125
|
-
node "
|
|
153
|
+
node "<skill_dir>/scripts/commit-worktrees.js" "<ws_root>" "<branch>" --per-repo "ep-foo-app:feat(<branch>): 实现 saveClientExpectFreight;ep-bar-app:refactor(<branch>): 拆分 PlanService"
|
|
126
154
|
|
|
127
155
|
# 含未追踪文件
|
|
128
|
-
node "
|
|
156
|
+
node "<skill_dir>/scripts/commit-worktrees.js" "<ws_root>" "<branch>" --message "..." --untracked
|
|
129
157
|
|
|
130
158
|
# wt_path 形式(用户在 worktree 内)
|
|
131
|
-
node "
|
|
159
|
+
node "<skill_dir>/scripts/commit-worktrees.js" "<ws_root>/.worktrees/worktree-<branch>" --message "..."
|
|
132
160
|
```
|
|
133
161
|
|
|
134
162
|
**选项**:
|
|
@@ -155,10 +183,10 @@ node "..." "<ws_root>/.worktrees/worktree-<branch>" --message "..."
|
|
|
155
183
|
## Step 5:批量 push
|
|
156
184
|
|
|
157
185
|
```bash
|
|
158
|
-
node "<
|
|
186
|
+
node "<skill_dir>/scripts/push-worktrees.js" "<ws_root>" "<branch>"
|
|
159
187
|
|
|
160
188
|
# 或 wt_path 形式
|
|
161
|
-
node "
|
|
189
|
+
node "<skill_dir>/scripts/push-worktrees.js" "<ws_root>/.worktrees/worktree-<branch>"
|
|
162
190
|
```
|
|
163
191
|
|
|
164
192
|
**解读末行 `PUSH_RESULT`**:
|
|
@@ -210,8 +238,7 @@ node "..." "<ws_root>/.worktrees/worktree-<branch>"
|
|
|
210
238
|
workspace: ✅ origin/<branch>
|
|
211
239
|
ep-foo-app: ✅ origin/<branch>
|
|
212
240
|
ep-bar-app: ⚠️ 远程分支已存在(需用户决策 → 已关联)
|
|
213
|
-
|
|
214
|
-
后续:可继续开发 / 调 /opsx:verify 验证 / 调 /opsx:archive 归档 / 调 /cbb:worktree-close 关闭
|
|
241
|
+
后续:可继续开发 / 调 /opsx:verify 验证 / 调 /opsx:archive 归档 / 调 `cbb-worktree-close` skill 关闭
|
|
215
242
|
```
|
|
216
243
|
|
|
217
244
|
---
|
|
@@ -220,8 +247,11 @@ node "..." "<ws_root>/.worktrees/worktree-<branch>"
|
|
|
220
247
|
|
|
221
248
|
| 场景 | 处理方式 |
|
|
222
249
|
|------|----------|
|
|
223
|
-
|
|
|
224
|
-
|
|
|
250
|
+
| **任何触发** | **先做 Step 0 场景识别**,再决定策略 |
|
|
251
|
+
| 场景 A:cwd 在 cbb 工作空间根 | find-workspace-root 成功 → 多个 worktree 时让用户选 |
|
|
252
|
+
| 场景 B:cwd 在 worktree 内 | 自动用 cwd 反推分支,扫描后进入询问 commit 信息 |
|
|
253
|
+
| 场景 C:cwd 在普通 git 仓库(无 workspace-config.json) | **降级为单仓库提交推送**,不调用 worktree 脚本 |
|
|
254
|
+
| 场景 D:cwd 非 git 目录 | 说明情况并终止,不做任何操作 |
|
|
225
255
|
| commit 信息缺失 | 必须询问用户;禁止自动生成(可基于 apply task 上下文给建议) |
|
|
226
256
|
| 多仓库需不同 commit 信息 | 用 `--per-repo "ep-foo:m1;ep-bar:m2"`,必须由用户逐条提供 |
|
|
227
257
|
| 仓库干净 | commit-worktrees 自动 skipped,只 push 不 commit |
|
|
@@ -236,6 +266,11 @@ node "..." "<ws_root>/.worktrees/worktree-<branch>"
|
|
|
236
266
|
|
|
237
267
|
## 常见错误
|
|
238
268
|
|
|
269
|
+
### 误触后硬套 worktree 流程
|
|
270
|
+
|
|
271
|
+
- **问题:** 用户在普通仓库说"提交代码",技能被 description 匹配触发,直接跑 `find-workspace-root.js` 失败并报错终止
|
|
272
|
+
- **修复:** Step 0 先判场景;场景 C(普通 git 仓库)降级为单仓库提交推送,不调用 worktree 脚本、不提及批量流程
|
|
273
|
+
|
|
239
274
|
### 自动生成 commit 信息不让用户确认
|
|
240
275
|
|
|
241
276
|
- **问题:** agent 拍脑袋写 "feat: xxx",与用户实际意图不符
|
|
@@ -286,8 +321,9 @@ node "..." "<ws_root>/.worktrees/worktree-<branch>"
|
|
|
286
321
|
|
|
287
322
|
**必须执行**
|
|
288
323
|
|
|
289
|
-
- 严格按 Step 0 → 1 → 2 → 3 → 4 → 5 → 6
|
|
290
|
-
- 所有脚本调用以 `node "
|
|
324
|
+
- 严格按 Step 0 → 1 → 2 → 3 → 4 → 5 → 6 顺序执行(场景 C/D 除外,按 Step 0 降级策略)
|
|
325
|
+
- 所有脚本调用以 `node "<skill_dir>/scripts/<name>.js"` 形式发起(`<skill_dir>` = 本 SKILL.md 所在目录)
|
|
326
|
+
- 执行脚本时 cwd 保持在工作空间根;场景 C 降级时按普通 git 流程
|
|
291
327
|
- Step 2 dry-run 必跑,让用户看到将要 commit 的内容
|
|
292
328
|
- Step 3 必问用户 commit 信息(自由文本),禁止自动生成
|
|
293
329
|
- commit 信息涉及业务语义时(feature/refactor/fix 等)必须从 apply task 上下文生成建议并由用户确认
|