@jspg-ai/coding-bb 0.0.1 → 0.0.2-beta.22
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/bin/cbb.js +6 -0
- package/cbb/bin/cbbm.js +6 -0
- package/cbb/dev-standards/rules/cbb-ai-behavior.md +103 -103
- package/cbb/dev-standards/rules/cbb-priority.md +55 -55
- package/cbb/lib/install/claude-code.js +2 -0
- package/cbb/lib/install/init.js +496 -290
- package/cbb/lib/install/opencode.js +31 -0
- package/cbb/lib/install/qoder.js +2 -0
- package/cbb/lib/install/workspaces.js +53 -13
- package/cbb/lib/openspec/index.js +3 -3
- package/cbb/lib/superpowers/index.js +1 -1
- package/cbb/lib/utils/check-update.js +16 -14
- package/cbb/lib/utils/gitignore.js +2 -1
- package/cbb/lib/utils/output.js +92 -4
- package/cbb/lib/utils/version.js +2 -31
- package/cbb/lib/wiki/cli.js +25 -25
- package/cbb/lib/wiki/index.js +16 -16
- package/cbb/tools/cbb-design-to-wiki/SKILL.md +14 -14
- package/cbb/tools/cbb-wiki-ops/SKILL.md +22 -22
- package/cbb/worktrees/_shared/scripts/find-target-worktree.js +2 -2
- package/cbb/worktrees/_shared/scripts/find-workspace-root.js +7 -7
- package/cbb/worktrees/_shared/scripts/push-core.js +18 -0
- package/cbb/worktrees/commands/{close.md → worktree-close.md} +8 -8
- package/cbb/worktrees/commands/{init.md → worktree-init.md} +9 -9
- package/cbb/worktrees/commands/{push.md → worktree-push.md} +3 -3
- package/cbb/worktrees/skills/{openspec-close-worktree → cbb-worktree-close}/SKILL.md +20 -20
- package/cbb/worktrees/skills/{openspec-close-worktree → cbb-worktree-close}/scripts/check-env.js +4 -4
- package/cbb/worktrees/skills/{openspec-close-worktree → cbb-worktree-close}/scripts/check-unarchived.js +1 -1
- package/cbb/worktrees/skills/{openspec-close-worktree → cbb-worktree-close}/scripts/delete-branches.js +3 -3
- package/cbb/worktrees/skills/{openspec-close-worktree → cbb-worktree-close}/scripts/discover-apps.js +6 -6
- package/cbb/worktrees/skills/{openspec-extend-worktree → cbb-worktree-close}/scripts/find-target-worktree.js +2 -2
- package/cbb/worktrees/skills/{openspec-push-worktrees → cbb-worktree-close}/scripts/find-workspace-root.js +7 -7
- package/cbb/worktrees/skills/{openspec-close-worktree → cbb-worktree-close}/scripts/remove-worktrees.js +4 -4
- package/cbb/worktrees/skills/{openspec-close-worktree → cbb-worktree-close}/scripts/safety-check.js +4 -4
- package/cbb/worktrees/skills/{openspec-init-worktree → cbb-worktree-init}/SKILL.md +81 -107
- package/cbb/worktrees/skills/{openspec-init-worktree → cbb-worktree-init}/scripts/auto-open.js +1 -1
- package/cbb/worktrees/skills/{openspec-init-worktree → cbb-worktree-init}/scripts/check-env-deep.js +4 -4
- package/cbb/worktrees/skills/{openspec-init-worktree → cbb-worktree-init}/scripts/check-env.js +6 -6
- package/cbb/worktrees/skills/{openspec-init-worktree → cbb-worktree-init}/scripts/check-repos.js +4 -4
- package/cbb/worktrees/skills/{openspec-init-worktree → cbb-worktree-init}/scripts/create-branches.js +4 -4
- package/cbb/worktrees/skills/{openspec-init-worktree → cbb-worktree-init}/scripts/create-worktrees.js +8 -7
- package/cbb/worktrees/skills/{openspec-close-worktree → cbb-worktree-init}/scripts/find-workspace-root.js +7 -7
- package/cbb/worktrees/skills/{openspec-init-worktree → cbb-worktree-init}/scripts/install-ai.js +33 -33
- package/cbb/worktrees/skills/{openspec-init-worktree → cbb-worktree-init}/scripts/parse-config.js +7 -7
- package/cbb/worktrees/skills/{openspec-init-worktree → cbb-worktree-init}/scripts/push-branches.js +9 -7
- package/cbb/worktrees/skills/{openspec-extend-worktree → cbb-worktree-init}/scripts/push-core.js +18 -0
- package/cbb/worktrees/skills/{openspec-init-worktree → cbb-worktree-init}/scripts/sync-repos.js +10 -12
- package/cbb/worktrees/skills/{openspec-init-worktree → cbb-worktree-init}/scripts/update-gitignore.js +19 -6
- package/cbb/worktrees/skills/{openspec-push-worktrees → cbb-worktree-push}/SKILL.md +16 -16
- package/cbb/worktrees/skills/{openspec-push-worktrees → cbb-worktree-push}/scripts/commit-worktrees.js +2 -2
- package/cbb/worktrees/skills/{openspec-push-worktrees → cbb-worktree-push}/scripts/find-target-worktree.js +2 -2
- package/cbb/worktrees/skills/{openspec-extend-worktree → cbb-worktree-push}/scripts/find-workspace-root.js +7 -7
- package/cbb/worktrees/skills/{openspec-push-worktrees → cbb-worktree-push}/scripts/push-core.js +18 -0
- package/cbb/worktrees/skills/{openspec-push-worktrees → cbb-worktree-push}/scripts/push-worktrees.js +7 -5
- package/config/workspace-config.sample.json +18 -0
- package/config/workspaces.json +11 -6
- package/openspec/.version +6 -6
- package/openspec/commands/apply.md +7 -7
- package/openspec/commands/archive.md +7 -7
- package/openspec/commands/bulk-archive.md +7 -7
- package/openspec/commands/continue.md +7 -7
- package/openspec/commands/explore.md +7 -7
- package/openspec/commands/ff.md +7 -7
- package/openspec/commands/new.md +7 -7
- package/openspec/commands/onboard.md +7 -7
- package/openspec/commands/propose.md +7 -7
- package/openspec/commands/sync.md +7 -7
- package/openspec/commands/update.md +7 -7
- package/openspec/commands/verify.md +7 -7
- package/openspec/skills/openspec-apply-change/SKILL.md +187 -187
- package/openspec/skills/openspec-archive-change/SKILL.md +181 -181
- package/openspec/skills/openspec-bulk-archive-change/SKILL.md +338 -338
- package/openspec/skills/openspec-continue-change/SKILL.md +117 -117
- package/openspec/skills/openspec-explore/SKILL.md +342 -342
- package/openspec/skills/openspec-ff-change/SKILL.md +116 -116
- package/openspec/skills/openspec-new-change/SKILL.md +76 -76
- package/openspec/skills/openspec-onboard/SKILL.md +560 -560
- package/openspec/skills/openspec-propose/SKILL.md +162 -162
- package/openspec/skills/openspec-sync-specs/SKILL.md +261 -261
- package/openspec/skills/openspec-update-change/SKILL.md +90 -90
- package/openspec/skills/openspec-verify-change/SKILL.md +174 -174
- package/package.json +4 -3
- package/superpowers/.version +6 -6
- package/superpowers/skills/brainstorming/SKILL.md +250 -250
- package/superpowers/skills/brainstorming/scripts/helper.js +167 -167
- package/superpowers/skills/brainstorming/scripts/start-server.sh +209 -209
- package/superpowers/skills/brainstorming/scripts/stop-server.sh +120 -120
- package/superpowers/skills/brainstorming/spec-document-reviewer-prompt.md +49 -49
- package/superpowers/skills/brainstorming/visual-companion.md +299 -299
- package/superpowers/skills/dispatching-parallel-agents/SKILL.md +167 -167
- package/superpowers/skills/executing-plans/SKILL.md +64 -64
- package/superpowers/skills/finishing-a-development-branch/SKILL.md +225 -225
- package/superpowers/skills/receiving-code-review/SKILL.md +205 -205
- package/superpowers/skills/requesting-code-review/SKILL.md +95 -95
- package/superpowers/skills/requesting-code-review/code-reviewer.md +181 -181
- package/superpowers/skills/subagent-driven-development/SKILL.md +568 -568
- package/superpowers/skills/subagent-driven-development/implementer-prompt.md +154 -154
- package/superpowers/skills/subagent-driven-development/re-review-prompt.md +115 -115
- package/superpowers/skills/subagent-driven-development/task-reviewer-prompt.md +207 -207
- package/superpowers/skills/systematic-debugging/CREATION-LOG.md +119 -119
- package/superpowers/skills/systematic-debugging/SKILL.md +283 -283
- package/superpowers/skills/systematic-debugging/condition-based-waiting-example.ts +158 -158
- package/superpowers/skills/systematic-debugging/condition-based-waiting.md +115 -115
- package/superpowers/skills/systematic-debugging/defense-in-depth.md +122 -122
- package/superpowers/skills/systematic-debugging/find-polluter.sh +72 -72
- package/superpowers/skills/systematic-debugging/root-cause-tracing.md +169 -169
- package/superpowers/skills/systematic-debugging/test-academic.md +14 -14
- package/superpowers/skills/systematic-debugging/test-pressure-1.md +58 -58
- package/superpowers/skills/systematic-debugging/test-pressure-2.md +68 -68
- package/superpowers/skills/systematic-debugging/test-pressure-3.md +69 -69
- package/superpowers/skills/test-driven-development/SKILL.md +320 -320
- package/superpowers/skills/test-driven-development/writing-good-tests.md +198 -198
- package/superpowers/skills/using-git-worktrees/SKILL.md +167 -167
- package/superpowers/skills/using-superpowers/SKILL.md +63 -63
- package/superpowers/skills/using-superpowers/references/antigravity-tools.md +23 -23
- package/superpowers/skills/using-superpowers/references/codex-tools.md +108 -108
- package/superpowers/skills/using-superpowers/references/gemini-tools.md +63 -63
- package/superpowers/skills/using-superpowers/references/hermes-tools.md +56 -56
- package/superpowers/skills/using-superpowers/references/pi-tools.md +16 -16
- package/superpowers/skills/verification-before-completion/SKILL.md +120 -120
- package/superpowers/skills/writing-plans/SKILL.md +171 -171
- package/superpowers/skills/writing-plans/plan-document-reviewer-prompt.md +49 -49
- package/superpowers/skills/writing-skills/SKILL.md +679 -679
- package/superpowers/skills/writing-skills/anthropic-best-practices.md +1150 -1150
- package/superpowers/skills/writing-skills/examples/CLAUDE_MD_TESTING.md +189 -189
- package/superpowers/skills/writing-skills/persuasion-principles.md +187 -187
- package/superpowers/skills/writing-skills/render-graphs.js +169 -169
- package/superpowers/skills/writing-skills/testing-skills-with-subagents.md +384 -384
- package/cbb/worktrees/commands/extend.md +0 -65
- package/cbb/worktrees/skills/openspec-close-worktree/scripts/find-target-worktree.js +0 -96
- package/cbb/worktrees/skills/openspec-extend-worktree/SKILL.md +0 -390
- package/cbb/worktrees/skills/openspec-extend-worktree/scripts/check-env.js +0 -95
- package/cbb/worktrees/skills/openspec-extend-worktree/scripts/check-repos.js +0 -98
- package/cbb/worktrees/skills/openspec-extend-worktree/scripts/create-branches-and-worktrees.js +0 -135
- package/cbb/worktrees/skills/openspec-extend-worktree/scripts/install-ai.js +0 -150
- package/cbb/worktrees/skills/openspec-extend-worktree/scripts/list-available-apps.js +0 -88
- package/cbb/worktrees/skills/openspec-extend-worktree/scripts/sync-repos.js +0 -93
- package/cbb/worktrees/skills/openspec-init-worktree/scripts/find-workspace-root.js +0 -67
- package/cbb/worktrees/skills/openspec-init-worktree/scripts/generate-app-options.js +0 -93
- package/cbb/worktrees/skills/openspec-init-worktree/scripts/push-core.js +0 -136
- package/cbb/worktrees/skills/openspec-push-worktrees/scripts/silence-popup.js +0 -23
- package/config/config.sample.json +0 -16
- /package/cbb/worktrees/skills/{openspec-close-worktree → cbb-worktree-close}/scripts/silence-popup.js +0 -0
- /package/cbb/worktrees/skills/{openspec-extend-worktree → cbb-worktree-init}/scripts/silence-popup.js +0 -0
- /package/cbb/worktrees/skills/{openspec-init-worktree → cbb-worktree-push}/scripts/silence-popup.js +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
3
|
-
description: "为一个需求在 workspace
|
|
2
|
+
name: cbb-worktree-init
|
|
3
|
+
description: "为一个需求在 workspace 与各关联应用仓库(= workspace-config.json 全量 apps)同步创建同名物理 git worktree,直聚在 `.worktrees/worktree-<需求名>/` 下。触发:用户明确要求创建需求工作空间/开发隔离环境,或为已有需求补齐新增应用(重跑本技能即幂等)。禁止自动串联 cbb-worktree-close——除非用户明确说了要关闭。"
|
|
4
4
|
license: MIT
|
|
5
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
6
|
metadata:
|
|
@@ -13,15 +13,16 @@ metadata:
|
|
|
13
13
|
|
|
14
14
|
为一个需求在 workspace 与各关联应用仓库同步创建同名 git worktree,物理直聚在 `.worktrees/worktree-<需求名>/` 目录下。当你需要跨多个微服务仓库并行开发某个需求时,本技能一次性完成工作空间和所有关联应用仓库的 worktree 创建。
|
|
15
15
|
|
|
16
|
-
**启动时声明:** "我正在使用
|
|
16
|
+
**启动时声明:** "我正在使用 cbb-worktree-init 技能来创建多仓库联动的隔离 worktree 环境。"
|
|
17
17
|
|
|
18
18
|
## 核心原则
|
|
19
19
|
|
|
20
20
|
- 本技能的所有原子操作封装为 `scripts/*.js` Node.js 脚本,**跨平台执行**(Windows PowerShell / macOS bash / Linux bash / Git Bash 均无需适配)
|
|
21
21
|
- 物理位置与 `init-worktree` 兼容:`.worktrees/worktree-<需求名>/<应用名>/`
|
|
22
22
|
- 所有仓库使用统一的分支名(不加前缀);worktree 目录名自动加 `worktree-` 前缀
|
|
23
|
-
- **本技能必须在业务工作空间根目录执行**(即由 `cbb setup` 初始化、包含 `
|
|
24
|
-
-
|
|
23
|
+
- **本技能必须在业务工作空间根目录执行**(即由 `cbb setup` 初始化、包含 `workspace-config.json` 的目录)
|
|
24
|
+
- 输入约定:**自由文本**(需求名等)直接在对话中提问并等待回复,禁止使用 `AskUserQuestion`;`AskUserQuestion` 仅用于固定选项决策场景(如 push 失败处理、远程分支已存在时的二选一)
|
|
25
|
+
- 关联应用固定为 `workspace-config.json` 的**全量 apps**(无勾选选择);需要增减应用时编辑该文件并重跑本技能(幂等)
|
|
25
26
|
|
|
26
27
|
---
|
|
27
28
|
|
|
@@ -31,7 +32,7 @@ metadata:
|
|
|
31
32
|
|
|
32
33
|
调用方式(推荐用绝对路径):
|
|
33
34
|
```
|
|
34
|
-
node "D:\workspace\<用户工作空间>\.qoder\skills\
|
|
35
|
+
node "D:\workspace\<用户工作空间>\.qoder\skills\cbb-worktree-init\scripts\<name>.js" <参数>
|
|
35
36
|
```
|
|
36
37
|
|
|
37
38
|
脚本输出:
|
|
@@ -44,7 +45,7 @@ node "D:\workspace\<用户工作空间>\.qoder\skills\openspec-init-worktree\scr
|
|
|
44
45
|
- `<branch>`:需求名字符串
|
|
45
46
|
- `<wt_path>`:worktree 绝对路径
|
|
46
47
|
|
|
47
|
-
所有脚本读
|
|
48
|
+
所有脚本读 workspace-config.json:app 列表从 `<ws_root>/workspace-config.json` 读取,不需要传 JSON 参数。
|
|
48
49
|
|
|
49
50
|
---
|
|
50
51
|
|
|
@@ -53,7 +54,7 @@ node "D:\workspace\<用户工作空间>\.qoder\skills\openspec-init-worktree\scr
|
|
|
53
54
|
### 0.1 环境健康探活
|
|
54
55
|
|
|
55
56
|
```bash
|
|
56
|
-
node "D:/workspace/<ws_root>/.qoder/skills/
|
|
57
|
+
node "D:/workspace/<ws_root>/.qoder/skills/cbb-worktree-init/scripts/check-env.js"
|
|
57
58
|
```
|
|
58
59
|
|
|
59
60
|
**解读输出**:
|
|
@@ -66,7 +67,7 @@ node "D:/workspace/<ws_root>/.qoder/skills/openspec-init-worktree/scripts/check-
|
|
|
66
67
|
提前检测网络/权限/版本问题,把可能在 Step 3.4 push 或 Step 4 install-ai 暴露的失败前移到流程最开始:
|
|
67
68
|
|
|
68
69
|
```bash
|
|
69
|
-
node "D:/workspace/<ws_root>/.qoder/skills/
|
|
70
|
+
node "D:/workspace/<ws_root>/.qoder/skills/cbb-worktree-init/scripts/check-env-deep.js"
|
|
70
71
|
```
|
|
71
72
|
|
|
72
73
|
**解读输出**:
|
|
@@ -79,10 +80,10 @@ node "D:/workspace/<ws_root>/.qoder/skills/openspec-init-worktree/scripts/check-
|
|
|
79
80
|
- cbb 是否已安装(未安装仅警告,由 Step 4 自动安装)
|
|
80
81
|
- `.worktrees/` 目录可写
|
|
81
82
|
|
|
82
|
-
### 0.2 读取并校验
|
|
83
|
+
### 0.2 读取并校验 workspace-config.json
|
|
83
84
|
|
|
84
85
|
```bash
|
|
85
|
-
node "D:/workspace/<ws_root>/.qoder/skills/
|
|
86
|
+
node "D:/workspace/<ws_root>/.qoder/skills/cbb-worktree-init/scripts/parse-config.js"
|
|
86
87
|
```
|
|
87
88
|
|
|
88
89
|
**解读输出**:
|
|
@@ -92,23 +93,23 @@ node "D:/workspace/<ws_root>/.qoder/skills/openspec-init-worktree/scripts/parse-
|
|
|
92
93
|
|
|
93
94
|
### 0.3 配置引导
|
|
94
95
|
|
|
95
|
-
当 `
|
|
96
|
+
当 `workspace-config.json` 缺失、`apps` 为空或格式错误时,向用户说明情况并给出两个选项:
|
|
96
97
|
|
|
97
98
|
```
|
|
98
|
-
⚠️ 当前工作空间尚未配置关联应用(
|
|
99
|
+
⚠️ 当前工作空间尚未配置关联应用(workspace-config.json 缺失或 apps 为空)。
|
|
99
100
|
worktree 需要知道要关联哪些应用仓库。
|
|
100
101
|
|
|
101
102
|
请选择:
|
|
102
|
-
[1] 我自行配置
|
|
103
|
-
[2] 提供应用仓库地址,我帮你写入
|
|
103
|
+
[1] 我自行配置 workspace-config.json,配好后告诉你继续
|
|
104
|
+
[2] 提供应用仓库地址,我帮你写入 workspace-config.json
|
|
104
105
|
```
|
|
105
106
|
|
|
106
107
|
**选项 1:用户自行配置**
|
|
107
108
|
- 停止当前技能流程
|
|
108
|
-
- 提示用户:*"请编辑
|
|
109
|
+
- 提示用户:*"请编辑 workspace-config.json 后回复'继续',或重新执行 init-worktree。"*
|
|
109
110
|
- 用户回复"继续"后,重新从 Step 0 开始校验
|
|
110
111
|
|
|
111
|
-
**选项 2:帮用户写入
|
|
112
|
+
**选项 2:帮用户写入 workspace-config.json**
|
|
112
113
|
- 直接在对话中请用户提供应用信息,格式示例:
|
|
113
114
|
```
|
|
114
115
|
应用名: ep-user-auth-app
|
|
@@ -119,7 +120,7 @@ worktree 需要知道要关联哪些应用仓库。
|
|
|
119
120
|
仓库地址: git@code.example.com:team/ep-user-info-server.git
|
|
120
121
|
类型: back(后端)
|
|
121
122
|
```
|
|
122
|
-
- 解析后写入 `
|
|
123
|
+
- 解析后写入 `workspace-config.json`:
|
|
123
124
|
```json
|
|
124
125
|
{
|
|
125
126
|
"apps": [
|
|
@@ -130,85 +131,51 @@ worktree 需要知道要关联哪些应用仓库。
|
|
|
130
131
|
```
|
|
131
132
|
- 写入成功后提交到当前分支(确保 Step 2 状态检查通过):
|
|
132
133
|
```bash
|
|
133
|
-
git add
|
|
134
|
-
git commit -m "chore: add
|
|
134
|
+
git add workspace-config.json
|
|
135
|
+
git commit -m "chore: add workspace-config.json"
|
|
135
136
|
```
|
|
136
137
|
> 若当前不在主分支上,提示用户切回主分支后再提交;若已在主分支上则直接提交。
|
|
137
138
|
- 提交后重新从 Step 0 校验,通过后继续 Step 1
|
|
138
139
|
|
|
139
|
-
> ⚠️ **禁止**:在
|
|
140
|
+
> ⚠️ **禁止**:在 workspace-config.json 无效时跳过本步骤直接创建 worktree,否则无法确定关联应用。
|
|
140
141
|
|
|
141
142
|
---
|
|
142
143
|
|
|
143
|
-
## Step 1
|
|
144
|
+
## Step 1:关联应用与代码同步
|
|
144
145
|
|
|
145
|
-
>
|
|
146
|
+
> ⓘ **关联应用 = `workspace-config.json` 的全量 apps,无勾选选择**。所有脚本自行从 `<ws_root>/workspace-config.json` 读取应用列表,无需 AI 传递应用参数。
|
|
147
|
+
> 需要增减应用时,编辑 `workspace-config.json` 后**重跑本技能**即可(幂等,已存在的分支/worktree 自动复用,详见「幂等重跑」章节)。
|
|
146
148
|
|
|
147
|
-
### 1.1
|
|
148
|
-
|
|
149
|
-
> **绝对禁止**:不要从 Step 0.2 `parse-config.js` 的输出中自行解析 JSON 来构造 options。`parse-config.js` 仅用于校验 CONFIG.json 是否有效,其输出**不包含**格式化后的 label。必须通过下方脚本获取 options。
|
|
150
|
-
|
|
151
|
-
1. **必须运行 `generate-app-options.js` 脚本**获取 options。这是获取应用选项的**唯一合法途径**。脚本内部用 `JSON.parse` 读取 CONFIG.json,用硬编码公式 `【sideLabel】 - app.name` 逐条生成 label——`app.name` 逐字符原样复制,绝不会被翻译或替换。
|
|
152
|
-
|
|
153
|
-
```bash
|
|
154
|
-
node ".qoder/skills/openspec-init-worktree/scripts/generate-app-options.js"
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
**解读输出**:
|
|
158
|
-
- 退出码 0 + 末行 `APP_OPTIONS [{...}]` → 提取该行 JSON 数组,即为 options
|
|
159
|
-
- 退出码 1/2 → 出错,**终止流程**
|
|
160
|
-
|
|
161
|
-
options 中每个元素含:
|
|
162
|
-
- `label`:直接用于 AskUserQuestion 的选项文本(已格式化,如 `【后端】 - ep-user-auth-app`)
|
|
163
|
-
- `name`:CONFIG.json 中 name 的原始值(用于后续步骤匹配)
|
|
164
|
-
|
|
165
|
-
2. **初始消息已点名应用名**:逐个按 `name` 在 options 中匹配;不在配置中的询问用户手动输入 git URL,然后跳到 1.3。
|
|
166
|
-
|
|
167
|
-
3. **否则使用 `AskUserQuestion`(`multiSelect: true`)让用户勾选**:将脚本输出的 options 数组**原样传入**,不增、不减、不改任何字段:
|
|
168
|
-
|
|
169
|
-
```
|
|
170
|
-
AskUserQuestion({
|
|
171
|
-
questions: [{
|
|
172
|
-
header: "关联应用",
|
|
173
|
-
multiSelect: true,
|
|
174
|
-
options: <脚本输出的 options 数组,不做任何修改>
|
|
175
|
-
}]
|
|
176
|
-
})
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
4. **解析选择结果**:从 `AskUserQuestion` 返回的选中项中提取应用名(去掉 `【后端】 - ` / `【前端】 - ` 前缀),得到选中的应用列表。用户未选任何项时终止流程。
|
|
180
|
-
|
|
181
|
-
### 1.2 同步 `.code/` 目录代码
|
|
149
|
+
### 1.1 同步 `.codespace/` 目录代码
|
|
182
150
|
|
|
183
151
|
```bash
|
|
184
152
|
# ws_root 来自 AI agent 维护的状态
|
|
185
|
-
node "D:/workspace/<ws_root>/.qoder/skills/
|
|
153
|
+
node "D:/workspace/<ws_root>/.qoder/skills/cbb-worktree-init/scripts/sync-repos.js" "<ws_root>"
|
|
186
154
|
```
|
|
187
155
|
|
|
188
156
|
**用法**:
|
|
189
|
-
- `<ws_root
|
|
190
|
-
- `<app1,app2,...>`:上一步选中的 apps 数组 JSON 字符串
|
|
157
|
+
- `<ws_root>`:工作空间根绝对路径(apps 由脚本内部从 `<ws_root>/workspace-config.json` 读取)
|
|
191
158
|
|
|
192
159
|
**解读输出**:
|
|
193
160
|
- 退出码 0 + 末行 `SYNC_RESULT [...]` → 全部成功
|
|
194
161
|
- 退出码 2 + 末行 `SYNC_RESULT [...]`(含 `clone-failed` 项)→ 部分 clone 失败,**终止流程**
|
|
195
162
|
|
|
196
|
-
> ⓘ **`.
|
|
163
|
+
> ⓘ **`.codespace/` 目录**:所有应用代码统一存放在工作空间的 `.codespace/` 下。基准代码由 `cbb setup` 命令首次 clone,本脚本检查时如已存在则 fetch 更新(秒级),不存在则 clone 兜底。该目录在 Step 3.2 加入 `.gitignore`,不被 workspace 仓库跟踪。
|
|
197
164
|
|
|
198
|
-
### 1.
|
|
165
|
+
### 1.2 最终输出
|
|
199
166
|
|
|
200
|
-
|
|
167
|
+
列出本次关联的应用(`workspace-config.json` 全量)及本地路径(保留序号便于复核),向用户展示并确认:
|
|
201
168
|
|
|
202
169
|
```
|
|
203
|
-
|
|
170
|
+
确认关联应用(workspace-config.json 全量):
|
|
204
171
|
后端:
|
|
205
|
-
[1] ep-user-auth-app → .
|
|
206
|
-
[2] ep-user-info-server → .
|
|
172
|
+
[1] ep-user-auth-app → .codespace/ep-user-auth-app
|
|
173
|
+
[2] ep-user-info-server → .codespace/ep-user-info-server
|
|
207
174
|
前端:
|
|
208
|
-
[3] ep-user-web → .
|
|
175
|
+
[3] ep-user-web → .codespace/ep-user-web
|
|
209
176
|
```
|
|
210
177
|
|
|
211
|
-
> 后续所有步骤中的 `APP_REPOS` 均指向 `$WS_ROOT/.
|
|
178
|
+
> 后续所有步骤中的 `APP_REPOS` 均指向 `$WS_ROOT/.codespace/<应用名>/`,不再依赖开发者手动配置本地路径。
|
|
212
179
|
|
|
213
180
|
---
|
|
214
181
|
|
|
@@ -227,7 +194,7 @@ node "D:/workspace/<ws_root>/.qoder/skills/openspec-init-worktree/scripts/sync-r
|
|
|
227
194
|
| 当前在主分支上 | ✅ | ❌ |
|
|
228
195
|
|
|
229
196
|
```bash
|
|
230
|
-
node "D:/workspace/<ws_root>/.qoder/skills/
|
|
197
|
+
node "D:/workspace/<ws_root>/.qoder/skills/cbb-worktree-init/scripts/check-repos.js" "<ws_root>"
|
|
231
198
|
```
|
|
232
199
|
|
|
233
200
|
**解读输出**:
|
|
@@ -255,10 +222,10 @@ node "D:/workspace/<ws_root>/.qoder/skills/openspec-init-worktree/scripts/check-
|
|
|
255
222
|
### 3.2 安全更新 .gitignore(前置)
|
|
256
223
|
|
|
257
224
|
```bash
|
|
258
|
-
node "D:/workspace/<ws_root>/.qoder/skills/
|
|
225
|
+
node "D:/workspace/<ws_root>/.qoder/skills/cbb-worktree-init/scripts/update-gitignore.js "<ws_root>" "<branch>"
|
|
259
226
|
```
|
|
260
227
|
|
|
261
|
-
脚本内部自动完成:stash 保护 → 切分支 → 添加 `.worktrees/` 和 `.
|
|
228
|
+
脚本内部自动完成:stash 保护 → 切分支 → 添加 `.worktrees/` 和 `.codespace/` → 提交 → 切回 → pop stash
|
|
262
229
|
|
|
263
230
|
**解读输出**:
|
|
264
231
|
- 退出码 0 + 末行 `GITIGNORE_OK` → 成功
|
|
@@ -269,7 +236,7 @@ node "D:/workspace/<ws_root>/.qoder/skills/openspec-init-worktree/scripts/update
|
|
|
269
236
|
### 3.3 创建分支
|
|
270
237
|
|
|
271
238
|
```bash
|
|
272
|
-
node "D:/workspace/<ws_root>/.qoder/skills/
|
|
239
|
+
node "D:/workspace/<ws_root>/.qoder/skills/cbb-worktree-init/scripts/create-branches.js" "<ws_root>" "<branch>"
|
|
273
240
|
```
|
|
274
241
|
|
|
275
242
|
**解读输出**:
|
|
@@ -294,7 +261,7 @@ node "D:/workspace/<ws_root>/.qoder/skills/openspec-init-worktree/scripts/create
|
|
|
294
261
|
### 3.4 推送并建立 upstream
|
|
295
262
|
|
|
296
263
|
```bash
|
|
297
|
-
node "D:/workspace/<ws_root>/.qoder/skills/
|
|
264
|
+
node "D:/workspace/<ws_root>/.qoder/skills/cbb-worktree-init/scripts/push-branches.js" "<ws_root>" "<branch>"
|
|
298
265
|
```
|
|
299
266
|
|
|
300
267
|
脚本内部自动完成:
|
|
@@ -305,6 +272,7 @@ node "D:/workspace/<ws_root>/.qoder/skills/openspec-init-worktree/scripts/push-b
|
|
|
305
272
|
|
|
306
273
|
**解读输出:**
|
|
307
274
|
- 退出码 0 + 末行 `PUSH_RESULT [...]` → 全部推送成功,继续 Step 3.5
|
|
275
|
+
- 结果项 `skipped`(远程分支已存在且与本地一致)→ 幂等跳过,非失败
|
|
308
276
|
- 退出码 2 + 末行 `PUSH_RESULT [...]`(含 `failed` 或 `remote-exists` 项)→ **阻塞流程,AI agent 必须询问用户决策**(见下方"失败处理")
|
|
309
277
|
|
|
310
278
|
**失败处理(AI agent 行为):**
|
|
@@ -321,7 +289,7 @@ node "D:/workspace/<ws_root>/.qoder/skills/openspec-init-worktree/scripts/push-b
|
|
|
321
289
|
### 3.5 创建 Worktree(含自愈清理)
|
|
322
290
|
|
|
323
291
|
```bash
|
|
324
|
-
node "D:/workspace/<ws_root>/.qoder/skills/
|
|
292
|
+
node "D:/workspace/<ws_root>/.qoder/skills/cbb-worktree-init/scripts/create-worktrees.js" "<ws_root>" "<branch>"
|
|
325
293
|
```
|
|
326
294
|
|
|
327
295
|
脚本内部自动完成:
|
|
@@ -345,27 +313,27 @@ WT_PATH d:\workspace\xxx\.worktrees\worktree-feature-login
|
|
|
345
313
|
|
|
346
314
|
> ⓘ **tracked 内容自动 checkout**:workspace 主分支 tracked 的所有内容(openspec/、cbb/ 等)在 workspace 工作树创建时**自动从 git 对象库 checkout**——**不需要 `cp`、`git clone` 或任何“带过来”动作**。各应用 worktree 同理。
|
|
347
315
|
|
|
348
|
-
> ⓘ **AI 配置目录(.claude/、.qoder/ 等)**:workspace 主分支中这些目录通常为 gitignore'd,不会自动出现在 worktree 中。本 skill 在 Step 4 统一在 worktree 内执行 `
|
|
316
|
+
> ⓘ **AI 配置目录(.claude/、.qoder/ 等)**:workspace 主分支中这些目录通常为 gitignore'd,不会自动出现在 worktree 中。本 skill 在 Step 4 统一在 worktree 内执行 `cbbm init -y` 安装 AI 配置,无需依赖用户手动配置。
|
|
349
317
|
|
|
350
318
|
---
|
|
351
319
|
|
|
352
320
|
## Step 4:安装 AI 配置(必要步骤)
|
|
353
321
|
|
|
354
322
|
workspace 主分支的 `.claude/` `.qoder/` `.cbb/` 通常为 gitignore'd,创建 worktree 时不会自动带入。
|
|
355
|
-
**本步骤在 worktree 内执行 `
|
|
323
|
+
**本步骤在 worktree 内执行 `cbbm init --yes` 是必要步骤**——缺失 AI 配置会导致后续
|
|
356
324
|
openspec-propose/apply/verify/ff 等技能全部不可用,worktree 将处于"半残"状态。
|
|
357
325
|
|
|
358
326
|
> 与 push-branches(Step 3.4)一致:**本步骤失败将阻塞 init-worktree**,用户必须手动恢复后重跑。
|
|
359
327
|
|
|
360
328
|
```bash
|
|
361
|
-
node "D:/workspace/<ws_root>/.qoder/skills/
|
|
329
|
+
node "D:/workspace/<ws_root>/.qoder/skills/cbb-worktree-init/scripts/install-ai.js "<wt_path>"
|
|
362
330
|
```
|
|
363
331
|
|
|
364
332
|
**解读输出**:
|
|
365
333
|
- 退出码 0 + 末行 `AI_INIT_OK` → 成功,继续 Step 5
|
|
366
334
|
- 退出码 1 → 参数错误(脚本 bug)
|
|
367
|
-
- 退出码 2 + 末行 `AI_INIT_FAILED` →
|
|
368
|
-
按错误提示手动执行 `cd "<wt_path>" &&
|
|
335
|
+
- 退出码 2 + 末行 `AI_INIT_FAILED` → cbbm init 执行失败,**init-worktree 中断**,
|
|
336
|
+
按错误提示手动执行 `cd "<wt_path>" && cbbm init --yes` 后重跑
|
|
369
337
|
|
|
370
338
|
> `-y` 表示非交互模式:默认选中所有适配器、前置依赖未安装时自动继续,适合 skill 自动化执行。
|
|
371
339
|
|
|
@@ -376,7 +344,7 @@ node "D:/workspace/<ws_root>/.qoder/skills/openspec-init-worktree/scripts/instal
|
|
|
376
344
|
所有步骤完成后,检测当前运行环境,**在新窗口打开 IDE** 并定位到 workspace worktree 目录。
|
|
377
345
|
|
|
378
346
|
```bash
|
|
379
|
-
node "D:/workspace/<ws_root>/.qoder/skills/
|
|
347
|
+
node "D:/workspace/<ws_root>/.qoder/skills/cbb-worktree-init/scripts/auto-open.js "<wt_path>"
|
|
380
348
|
```
|
|
381
349
|
|
|
382
350
|
**解读末行**:
|
|
@@ -394,31 +362,45 @@ node "D:/workspace/<ws_root>/.qoder/skills/openspec-init-worktree/scripts/auto-o
|
|
|
394
362
|
|
|
395
363
|
---
|
|
396
364
|
|
|
365
|
+
## 幂等重跑(增减应用 / 中断恢复)
|
|
366
|
+
|
|
367
|
+
本技能可安全重跑:在业务工作空间根目录用**同一个需求名**再执行一次即可。
|
|
368
|
+
|
|
369
|
+
| 场景 | 重跑行为 |
|
|
370
|
+
|------|----------|
|
|
371
|
+
| 空间新增了应用(编辑 `workspace-config.json` 后) | Step 1 拉取新应用代码 → Step 3.3 为新应用建分支 → Step 3.4 推送(已一致的分支 `skipped`,不一致则阻塞询问)→ Step 3.5 创建缺失的嵌套 worktree |
|
|
372
|
+
| 上次 init 中途失败 | 已存在的分支 / worktree 自动复用,`.gitignore` 处理自动跳过,仅补齐缺失部分 |
|
|
373
|
+
| 应用从 config 移除 | 已创建的分支 / worktree **不会**自动删除;如需清理用 `/cbb:worktree-close` 关闭后重建 |
|
|
374
|
+
|
|
375
|
+
> ⓘ 重跑**不会静默推送**开发中的本地提交:远程分支已存在但与本地不一致时,Step 3.4 走阻塞式 `remote-exists` 决策(展示 commit 元信息让用户选择)。
|
|
376
|
+
|
|
377
|
+
---
|
|
378
|
+
|
|
397
379
|
## 快速参考
|
|
398
380
|
|
|
399
381
|
| 场景 | 处理方式 |
|
|
400
382
|
|------|----------|
|
|
401
|
-
| `.worktrees/` 或 `.
|
|
383
|
+
| `.worktrees/` 或 `.codespace/` 未在 `.gitignore` | workspace 仓库自动添加并提交(在 Step 3.2) |
|
|
402
384
|
| `git worktree add` 权限被拒 | 沙箱降级,中断并告知用户 |
|
|
403
385
|
| 状态检查任一失败 | 终止并报告所有问题 |
|
|
404
386
|
| 部分应用 worktree 创建失败 | 提示已创建的回滚清理命令 |
|
|
405
387
|
| workspace 主分支 tracked 内容(openspec/、cbb/ 等) | 自动 checkout 到工作树,无需额外动作(cp/clone 都是多余的) |
|
|
406
|
-
| AI 配置目录(.claude/、.qoder/ 等) | gitignore'd,不在仓库中;**Step 4 是必要步骤**,执行 `
|
|
388
|
+
| AI 配置目录(.claude/、.qoder/ 等) | gitignore'd,不在仓库中;**Step 4 是必要步骤**,执行 `cbbm init --yes` 自动安装(失败会阻塞 init-worktree) |
|
|
407
389
|
| 需求名(同时作分支名和工作树目录名) | 用户在对话中纯文本输入,参考 Step 3.1 命名规则(kebab-case,禁 `..`、路径分隔符、空格) |
|
|
408
|
-
|
|
|
390
|
+
| 关联应用范围 | 固定为 `workspace-config.json` 全量 apps(无勾选);增减应用后重跑本技能(幂等) |
|
|
409
391
|
| 沙箱内 node 不可用 | 脚本 fail-fast 并提示用户到系统终端重试 |
|
|
410
392
|
| push 失败(SSH/HTTPS/网络/保护) | push-branches.js 退出码 2,AI 阻塞并询问用户三选项(修复后重试/跳过失败仓库/完全终止) |
|
|
411
393
|
| 远程分支已存在 | push-branches.js 输出 metadata,AI 展示 commit 元信息后询问两选项(关联/终止+重新创建) |
|
|
412
|
-
| 开发过程中推送所有 worktree | Step 3.4 仅覆盖创建时的空 commit;开发过程中产生的提交必须调 `/
|
|
394
|
+
| 开发过程中推送所有 worktree | Step 3.4 仅覆盖创建时的空 commit;开发过程中产生的提交必须调 `/cbb:worktree-push` 或 `cbb-worktree-push` skill 推送(详见该 skill) |
|
|
413
395
|
|
|
414
396
|
---
|
|
415
397
|
|
|
416
398
|
## 常见错误
|
|
417
399
|
|
|
418
|
-
### 跳过
|
|
400
|
+
### 跳过 workspace-config.json 直接硬编码仓库地址
|
|
419
401
|
|
|
420
402
|
- **问题:** 直接在代码中写死仓库 URL 或本地路径,不同团队的仓库地址不同
|
|
421
|
-
- **修复:** 始终从 `
|
|
403
|
+
- **修复:** 始终从 `workspace-config.json` 读取应用与远程仓库的映射;配置缺失/为空时按 Step 0.3 配置引导处理,不支持在流程中临时指定配置外的仓库
|
|
422
404
|
|
|
423
405
|
### 状态检查对 app 仓库执行完整五项检查
|
|
424
406
|
|
|
@@ -432,7 +414,7 @@ node "D:/workspace/<ws_root>/.qoder/skills/openspec-init-worktree/scripts/auto-o
|
|
|
432
414
|
|
|
433
415
|
### 忽略 .gitignore 安全验证
|
|
434
416
|
|
|
435
|
-
- **问题:** `.worktrees/` 或 `.
|
|
417
|
+
- **问题:** `.worktrees/` 或 `.codespace/` 目录未被忽略,工作树或代码目录内容被 git 跟踪
|
|
436
418
|
- **修复:** 创建工作树前必须用 `git check-ignore` 验证两者均已忽略
|
|
437
419
|
|
|
438
420
|
### 未先创建分支就直接创建 worktree
|
|
@@ -450,14 +432,9 @@ node "D:/workspace/<ws_root>/.qoder/skills/openspec-init-worktree/scripts/auto-o
|
|
|
450
432
|
- **问题:** 模型误以为工作树是"凭空组装"出来的,写出 `cp`、`cp -r`、`git clone`、`ln -s` 等脚本"把主目录内容带过去"——这都是无用功
|
|
451
433
|
- **修复:** workspace 主分支 tracked 的所有内容(openspec/、cbb/ 等)在 `git worktree add` 时**自动 checkout**;各应用 worktree 同理。如果准备写 cp/clone/symlink 来“带过来”代码,先停下来
|
|
452
434
|
|
|
453
|
-
### label 被 AI 翻译或丢失(已从根本上解决)
|
|
454
|
-
|
|
455
|
-
- **问题:** 历史版本中 Step 1.1 要求 AI 手动拼接 label 字符串,导致 `app.name` 被翻译(`ep-user-auth-app` → `智能客服Agent应用`)或完全丢失(只输出 `后端应用`)。
|
|
456
|
-
- **修复:** 改为调用 `generate-app-options.js` 脚本生成 options——脚本用硬编码公式 `【sideLabel】 - app.name` 逐条生成,`app.name` 逐字符原样复制,AI 只需将脚本输出的 options 数组原样传入 `AskUserQuestion`,不允许手动修改任何字段。
|
|
457
|
-
|
|
458
435
|
### 用 AskUserQuestion 收集自由文本输入
|
|
459
436
|
|
|
460
|
-
- **问题:**
|
|
437
|
+
- **问题:** 需求名需要用户自由输入文本,却用了 `AskUserQuestion` 工具,被迫提供预设选项
|
|
461
438
|
- **修复:** 自由文本输入场景一律**直接在对话中提问**并等待用户文本回复;`AskUserQuestion` 仅用于固定选项的选择场景
|
|
462
439
|
|
|
463
440
|
### 完成后未进入 worktree
|
|
@@ -473,7 +450,7 @@ node "D:/workspace/<ws_root>/.qoder/skills/openspec-init-worktree/scripts/auto-o
|
|
|
473
450
|
### 远程分支已存在时自动 set-upstream
|
|
474
451
|
|
|
475
452
|
- **问题:** 看到 origin/<branch> 已存在就直接 `git branch --set-upstream-to`,可能关联到他人的同名分支
|
|
476
|
-
- **修复:**
|
|
453
|
+
- **修复:** 与本地完全一致时脚本幂等跳过(`skipped`,非失败);不一致时输出 metadata 由用户决策(关联 vs 终止);AI 在 AskUserQuestion 之前必须先输出 commit 元信息作为二次确认
|
|
477
454
|
|
|
478
455
|
### 用 `git checkout -b` 在 push 后切分支
|
|
479
456
|
|
|
@@ -483,12 +460,12 @@ node "D:/workspace/<ws_root>/.qoder/skills/openspec-init-worktree/scripts/auto-o
|
|
|
483
460
|
### 把脚本调用与 Shell 变量混用
|
|
484
461
|
|
|
485
462
|
- **问题:** 试图在 Bash 调用中嵌套 Node 脚本与 shell 变量,导致变量解析失败
|
|
486
|
-
- **修复:** 所有脚本参数(`<ws_root>`、`<
|
|
463
|
+
- **修复:** 所有脚本参数(`<ws_root>`、`<branch>`)由 AI agent 在对话上下文中维护,**作为字符串参数传入脚本**,不要在 Bash 命令中拼 shell 变量
|
|
487
464
|
|
|
488
465
|
### 把 install-ai 当作可失败步骤
|
|
489
466
|
|
|
490
467
|
- **问题:** 以为 worktree 创建成功就能继续工作,忽略了 Step 4 失败,导致后续 openspec-* 技能全部报"找不到 skill"
|
|
491
|
-
- **修复:** Step 4 失败必须手动 `cd <wt_path> &&
|
|
468
|
+
- **修复:** Step 4 失败必须手动 `cd <wt_path> && cbbm init --yes`,然后重跑 init-worktree(脚本会自动跳过已初始化的部分)
|
|
492
469
|
|
|
493
470
|
---
|
|
494
471
|
|
|
@@ -499,10 +476,9 @@ node "D:/workspace/<ws_root>/.qoder/skills/openspec-init-worktree/scripts/auto-o
|
|
|
499
476
|
**绝不允许**
|
|
500
477
|
|
|
501
478
|
- 跳过或绕过 Step 2 状态检查;状态检查失败后继续
|
|
502
|
-
- workspace 仓库创建工作树前不验证 `.worktrees/` 和 `.
|
|
479
|
+
- workspace 仓库创建工作树前不验证 `.worktrees/` 和 `.codespace/` 在 `.gitignore`
|
|
503
480
|
- 用 `git checkout -b` 切分支后再建 worktree(分支检出冲突)
|
|
504
481
|
- 用 `AskUserQuestion` 收集自由文本(需求名 / 分支选项等)
|
|
505
|
-
- **Step 1.1 手动构造 AskUserQuestion options(禁止)**——必须调用 `generate-app-options.js` 脚本生成 options,将输出原样传入 `AskUserQuestion`,不得手动拼接 label。详见 [Step 1.1](#11-读取配置并选择应用)
|
|
506
482
|
- 沙箱内 node 不可用时强行继续 → 改为 fail-fast 提示用户
|
|
507
483
|
- **Step 3.4 推送失败后跳过失败仓库直接继续** → 必须阻塞并询问用户决策
|
|
508
484
|
- **远程分支已存在时脚本自动 set-upstream-to** → 必须由用户决策,避免关联到他人的同名分支
|
|
@@ -514,10 +490,9 @@ node "D:/workspace/<ws_root>/.qoder/skills/openspec-init-worktree/scripts/auto-o
|
|
|
514
490
|
- workspace 仓库标准检查(当前在主分支等),app 仓库轻量检查(fetch + `origin/main` 可用即可)
|
|
515
491
|
- app 仓库分支从 `origin/main` 创建(`git branch <需求名> ${REMOTE}/${MAIN}`),不依赖本地主分支状态
|
|
516
492
|
- 严格 Step 3.3 → Step 3.4 顺序(先统一创建分支,再统一创建 worktree;workspace 工作树先建,各应用按序补建)
|
|
517
|
-
- 所有脚本调用以 `node "<WS_ROOT>\.qoder\skills\
|
|
518
|
-
- **Step 1.1 调用 `AskUserQuestion` 前必须由脚本生成 options**:执行 `node ".qoder/skills/openspec-init-worktree/scripts/generate-app-options.js"`,将 `APP_OPTIONS` 输出的 JSON 数组原样传入 `AskUserQuestion` options,禁止手动修改。
|
|
493
|
+
- 所有脚本调用以 `node "<WS_ROOT>\.qoder\skills\cbb-worktree-init\scripts\<name>.js" "<绝对路径>" "<branch>"` 形式发起(apps 由脚本内部从 workspace-config.json 读取),**不依赖跨调用的 cwd**
|
|
519
494
|
- **Step 3.4 push 步骤必须执行且插入在 create-branches.js (3.3) 之后、create-worktrees.js (3.5) 之前** — 失败时阻塞整个 init-worktree 流程
|
|
520
|
-
- **Step 3.4 仅覆盖创建 worktree 时的空 commit** — 开发过程中产生的本地 commit(如 apply 任务实现)必须由用户在 worktree 中手动提交并调 `
|
|
495
|
+
- **Step 3.4 仅覆盖创建 worktree 时的空 commit** — 开发过程中产生的本地 commit(如 apply 任务实现)必须由用户在 worktree 中手动提交并调 `cbb-worktree-push` 推送;不允许依赖 Step 3.4 之后的自动推送(不存在)
|
|
521
496
|
|
|
522
497
|
---
|
|
523
498
|
|
|
@@ -526,14 +501,13 @@ node "D:/workspace/<ws_root>/.qoder/skills/openspec-init-worktree/scripts/auto-o
|
|
|
526
501
|
| 脚本 | 功能 | 参数 | 退出码 |
|
|
527
502
|
|------|------|------|--------|
|
|
528
503
|
| `check-env.js` | 环境探活 | 无 | 0/1/2 |
|
|
529
|
-
| `parse-config.js` | 解析
|
|
530
|
-
| `
|
|
531
|
-
| `
|
|
532
|
-
| `check-repos.js` | 状态检查 | ws_root, apps_json | 0/1/2 |
|
|
504
|
+
| `parse-config.js` | 解析 workspace-config.json | 无 | 0/1/2 |
|
|
505
|
+
| `sync-repos.js` | 同步 .codespace/ 仓库 | ws_root | 0/1/2 |
|
|
506
|
+
| `check-repos.js` | 状态检查 | ws_root | 0/1/2 |
|
|
533
507
|
| `update-gitignore.js` | 安全更新 .gitignore | ws_root, branch | 0/1/2 |
|
|
534
508
|
| `create-branches.js` | 创建分支 | ws_root, branch | 0/1/2 |
|
|
535
509
|
| `create-worktrees.js` | 创建 worktree(含自愈清理) | ws_root, branch | 0/1/2/3 |
|
|
536
510
|
| `install-ai.js` | 安装 AI 配置(**必要步骤**) | wt_path | 0/1/2 |
|
|
537
|
-
| `push-branches.js` | 推送并建立 upstream
|
|
511
|
+
| `push-branches.js` | 推送并建立 upstream(已一致则 skipped;带错误归类 + 元信息采集) | ws_root, branch | 0/1/2 |
|
|
538
512
|
| `check-env-deep.js` | 环境健康自检(Node 版本 / npm 源 / 权限) | 无 | 0/2 |
|
|
539
513
|
| `auto-open.js` | 环境感知自动打开(**新窗口**) | wt_path | 0(始终) |
|
package/cbb/worktrees/skills/{openspec-init-worktree → cbb-worktree-init}/scripts/check-env-deep.js
RENAMED
|
@@ -51,12 +51,12 @@ if (!npmPing.ok) {
|
|
|
51
51
|
console.log('✅ npm 官方源可达(https://registry.npmjs.org)');
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
// ── 3.
|
|
55
|
-
const cbbInfo = run('
|
|
54
|
+
// ── 3. cbbm 检测(软警告) ──
|
|
55
|
+
const cbbInfo = run('cbbm --version');
|
|
56
56
|
if (cbbInfo.ok) {
|
|
57
|
-
console.log('✅
|
|
57
|
+
console.log('✅ cbbm 已安装:' + cbbInfo.out);
|
|
58
58
|
} else {
|
|
59
|
-
console.log('⚠️
|
|
59
|
+
console.log('⚠️ cbbm 未安装(Step 4 install-ai 会自动安装,软警告不阻塞)');
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
// ── 4. .worktrees 目录可写性 ──
|
package/cbb/worktrees/skills/{openspec-init-worktree → cbb-worktree-init}/scripts/check-env.js
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
require('./silence-popup');
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* cbb-worktree-init 环境健康探活
|
|
5
5
|
*
|
|
6
6
|
* 提前发现 Qoder 沙箱 DLL 问题(0xc0000142)以及其他子进程启动失败。
|
|
7
7
|
* 失败时输出明确错误信息并以非零退出码终止,AI agent 据此决定是否继续。
|
|
@@ -48,7 +48,7 @@ console.log('✅ git OK:', checks.git.out);
|
|
|
48
48
|
const insideRepo = tryExec('git rev-parse --is-inside-work-tree');
|
|
49
49
|
if (!insideRepo.ok || insideRepo.out !== 'true') {
|
|
50
50
|
console.error('❌ 当前目录不是 Git 仓库');
|
|
51
|
-
console.error(' init-worktree 必须在工作空间根目录(包含
|
|
51
|
+
console.error(' init-worktree 必须在工作空间根目录(包含 workspace-config.json)下执行');
|
|
52
52
|
process.exit(2);
|
|
53
53
|
}
|
|
54
54
|
console.log('✅ 当前目录是 git 仓库');
|
|
@@ -61,12 +61,12 @@ if (!checks.node.ok) {
|
|
|
61
61
|
console.log('✅ node OK:', checks.node.out);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
// ── 选检:
|
|
65
|
-
checks.cbbInfo = tryExec('
|
|
64
|
+
// ── 选检:cbbm(Step 5 才需要) ────────────────────
|
|
65
|
+
checks.cbbInfo = tryExec('cbbm --version');
|
|
66
66
|
if (!checks.cbbInfo.ok) {
|
|
67
|
-
console.log('ℹ️
|
|
67
|
+
console.log('ℹ️ cbbm 未全局安装(Step 5 会兜底自动安装)');
|
|
68
68
|
} else {
|
|
69
|
-
console.log('✅
|
|
69
|
+
console.log('✅ cbbm OK:', checks.cbbInfo.out);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
// ── 沙箱检测 ─────────────────────────────────────────
|
package/cbb/worktrees/skills/{openspec-init-worktree → cbb-worktree-init}/scripts/check-repos.js
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
require('./silence-popup');
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* cbb-worktree-init 状态检查
|
|
5
5
|
*
|
|
6
6
|
* 用法:node check-repos.js <ws_root>
|
|
7
7
|
*
|
|
@@ -36,7 +36,7 @@ if (!wsRoot) {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
function loadAppsFromConfig() {
|
|
39
|
-
const configPath = path.join(wsRoot, "
|
|
39
|
+
const configPath = path.join(wsRoot, "workspace-config.json");
|
|
40
40
|
if (!fs.existsSync(configPath)) return null;
|
|
41
41
|
try {
|
|
42
42
|
const config = JSON.parse(fs.readFileSync(configPath, "utf-8"));
|
|
@@ -46,7 +46,7 @@ function loadAppsFromConfig() {
|
|
|
46
46
|
|
|
47
47
|
const apps = loadAppsFromConfig();
|
|
48
48
|
if (!apps) {
|
|
49
|
-
console.error("
|
|
49
|
+
console.error("workspace-config.json missing or apps empty");
|
|
50
50
|
process.exit(1);
|
|
51
51
|
}
|
|
52
52
|
|
|
@@ -155,7 +155,7 @@ if (wsResult.ok) {
|
|
|
155
155
|
|
|
156
156
|
// apps
|
|
157
157
|
for (const app of apps) {
|
|
158
|
-
const appPath = path.join(wsRoot, ".
|
|
158
|
+
const appPath = path.join(wsRoot, ".codespace", app.name);
|
|
159
159
|
const r = checkRepo(appPath, app.name, "app");
|
|
160
160
|
results.push(r);
|
|
161
161
|
if (r.ok) {
|
package/cbb/worktrees/skills/{openspec-init-worktree → cbb-worktree-init}/scripts/create-branches.js
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
require('./silence-popup');
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* cbb-worktree-init 分支创建
|
|
5
5
|
*
|
|
6
6
|
* Usage: node create-branches.js <ws_root> <branch>
|
|
7
7
|
*/
|
|
@@ -18,7 +18,7 @@ if (!wsRoot || !branch) {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
function loadAppsFromConfig() {
|
|
21
|
-
const configPath = path.join(wsRoot, '
|
|
21
|
+
const configPath = path.join(wsRoot, 'workspace-config.json');
|
|
22
22
|
if (!fs.existsSync(configPath)) return null;
|
|
23
23
|
try {
|
|
24
24
|
const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
@@ -28,7 +28,7 @@ function loadAppsFromConfig() {
|
|
|
28
28
|
|
|
29
29
|
const apps = loadAppsFromConfig();
|
|
30
30
|
if (!apps) {
|
|
31
|
-
console.error('
|
|
31
|
+
console.error('workspace-config.json missing or apps empty');
|
|
32
32
|
process.exit(1);
|
|
33
33
|
}
|
|
34
34
|
|
|
@@ -71,7 +71,7 @@ if (wsCheck.ok && wsCheck.out) {
|
|
|
71
71
|
|
|
72
72
|
// apps: create from origin/main
|
|
73
73
|
for (const app of apps) {
|
|
74
|
-
const appPath = path.join(wsRoot, '.
|
|
74
|
+
const appPath = path.join(wsRoot, '.codespace', app.name);
|
|
75
75
|
const appCheck = tryExec('git branch --list "' + branch + '"', appPath);
|
|
76
76
|
if (appCheck.ok && appCheck.out) {
|
|
77
77
|
console.log('Skip ' + app.name + ': branch exists, reuse');
|