@jspg-ai/coding-bb 0.0.3-beta.9 → 0.0.5-beta.1
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/README.md +1 -0
- package/cbb/dev-standards/rules/cbb-ai-behavior.md +0 -15
- package/cbb/dev-standards/rules/cbb-workspace-discipline.md +38 -0
- package/cbb/lib/external/index.js +228 -0
- package/cbb/lib/install/agents-nav.js +92 -0
- package/cbb/lib/install/claude-code.js +8 -1
- package/cbb/lib/install/command-skill.js +105 -0
- package/cbb/lib/install/init.js +399 -129
- package/cbb/lib/install/minimax.js +60 -0
- package/cbb/lib/install/rule-rewrite.js +1 -1
- package/cbb/lib/install/setup-decision.js +92 -0
- package/cbb/lib/install/tool-selection.js +23 -0
- package/cbb/lib/install/trae.js +18 -8
- package/cbb/lib/install/workbuddy.js +36 -0
- package/cbb/lib/install/workspaces.js +15 -61
- package/cbb/lib/utils/check-update.js +13 -5
- package/cbb/lib/utils/githook.js +230 -0
- package/cbb/lib/utils/gitignore.js +17 -4
- package/cbb/lib/utils/plugin-hook.js +92 -0
- package/cbb/worktrees/_shared/scripts/check-local-state.js +114 -0
- package/cbb/worktrees/_shared/scripts/check-unarchived.js +77 -0
- package/cbb/worktrees/_shared/scripts/delete-branches.js +147 -0
- package/cbb/worktrees/_shared/scripts/deprecate-branches.js +119 -0
- package/cbb/worktrees/_shared/scripts/find-target-worktree.js +148 -96
- package/cbb/worktrees/_shared/scripts/find-workspace-root.js +8 -8
- package/cbb/worktrees/_shared/scripts/install-git-hook.js +70 -0
- package/cbb/worktrees/_shared/scripts/junction-ai-config.js +192 -0
- package/cbb/worktrees/_shared/scripts/merge-branches.js +580 -0
- package/cbb/worktrees/_shared/scripts/push-core.js +1 -1
- package/cbb/worktrees/_shared/scripts/silence-popup.js +1 -1
- package/cbb/worktrees/_shared/scripts/start-local.js +180 -0
- package/cbb/worktrees/skills/cbb-local-mode/SKILL.md +194 -0
- package/cbb/worktrees/skills/cbb-local-mode/scripts/check-local-state.js +114 -0
- package/cbb/worktrees/skills/cbb-local-mode/scripts/delete-branches.js +147 -0
- package/cbb/worktrees/skills/cbb-local-mode/scripts/deprecate-branches.js +119 -0
- package/cbb/worktrees/skills/cbb-local-mode/scripts/install-git-hook.js +70 -0
- package/cbb/worktrees/skills/cbb-local-mode/scripts/merge-branches.js +580 -0
- package/cbb/worktrees/skills/cbb-local-mode/scripts/silence-popup.js +23 -0
- package/cbb/worktrees/skills/cbb-local-mode/scripts/start-local.js +180 -0
- package/cbb/worktrees/skills/cbb-worktree-close/SKILL.md +134 -81
- package/cbb/worktrees/skills/cbb-worktree-close/scripts/check-env.js +3 -3
- package/cbb/worktrees/skills/cbb-worktree-close/scripts/check-unarchived.js +77 -48
- package/cbb/worktrees/skills/cbb-worktree-close/scripts/delete-branches.js +147 -136
- package/cbb/worktrees/skills/cbb-worktree-close/scripts/deprecate-branches.js +119 -0
- package/cbb/worktrees/skills/cbb-worktree-close/scripts/discover-apps.js +14 -5
- package/cbb/worktrees/skills/cbb-worktree-close/scripts/find-target-worktree.js +148 -96
- package/cbb/worktrees/skills/cbb-worktree-close/scripts/find-workspace-root.js +8 -8
- package/cbb/worktrees/skills/cbb-worktree-close/scripts/junction-ai-config.js +192 -0
- package/cbb/worktrees/skills/cbb-worktree-close/scripts/merge-branches.js +580 -0
- package/cbb/worktrees/skills/cbb-worktree-close/scripts/remove-worktrees.js +44 -9
- package/cbb/worktrees/skills/cbb-worktree-close/scripts/safety-check.js +15 -4
- package/cbb/worktrees/skills/cbb-worktree-close/scripts/silence-popup.js +1 -1
- package/cbb/worktrees/skills/cbb-worktree-init/SKILL.md +131 -120
- package/cbb/worktrees/skills/cbb-worktree-init/scripts/check-env.js +1 -1
- package/cbb/worktrees/skills/cbb-worktree-init/scripts/check-repos.js +2 -2
- package/cbb/worktrees/skills/cbb-worktree-init/scripts/create-branches.js +33 -8
- package/cbb/worktrees/skills/cbb-worktree-init/scripts/create-worktrees.js +60 -46
- package/cbb/worktrees/skills/cbb-worktree-init/scripts/install-git-hook.js +70 -0
- package/cbb/worktrees/skills/cbb-worktree-init/scripts/junction-ai-config.js +192 -0
- package/cbb/worktrees/skills/cbb-worktree-init/scripts/parse-config.js +7 -7
- package/cbb/worktrees/skills/cbb-worktree-init/scripts/push-branches.js +3 -3
- package/cbb/worktrees/skills/cbb-worktree-init/scripts/push-core.js +1 -1
- package/cbb/worktrees/skills/cbb-worktree-init/scripts/silence-popup.js +1 -1
- package/cbb/worktrees/skills/cbb-worktree-init/scripts/sync-repos.js +11 -7
- package/cbb/worktrees/skills/cbb-worktree-init/scripts/update-gitignore.js +17 -5
- package/cbb/worktrees/skills/cbb-worktree-push/SKILL.md +213 -56
- package/cbb/worktrees/skills/cbb-worktree-push/scripts/check-unarchived.js +77 -0
- package/cbb/worktrees/skills/cbb-worktree-push/scripts/commit-worktrees.js +70 -12
- package/cbb/worktrees/skills/cbb-worktree-push/scripts/find-target-worktree.js +148 -96
- package/cbb/worktrees/skills/cbb-worktree-push/scripts/find-workspace-root.js +8 -8
- package/cbb/worktrees/skills/cbb-worktree-push/scripts/make-mr-urls.js +211 -0
- package/cbb/worktrees/skills/cbb-worktree-push/scripts/merge-branches.js +580 -0
- package/cbb/worktrees/skills/cbb-worktree-push/scripts/push-core.js +1 -1
- package/cbb/worktrees/skills/cbb-worktree-push/scripts/push-worktrees.js +67 -20
- package/cbb/worktrees/skills/cbb-worktree-push/scripts/silence-popup.js +1 -1
- package/config/{workspace-config.sample.json → CBB-WORKSPACE.sample.json} +1 -1
- package/config/openspec/schemas/spec-driven/schema.yaml +20 -0
- package/config/upstream-mirrors.json +5 -0
- package/external/frontend-design/.version +6 -0
- package/external/frontend-design/LICENSE.txt +177 -0
- package/external/frontend-design/SKILL.md +71 -0
- package/openspec/.version +2 -2
- package/openspec/commands/archive.md +15 -8
- package/openspec/commands/bulk-archive.md +13 -6
- package/openspec/commands/continue.md +0 -1
- package/openspec/commands/explore.md +1 -1
- package/openspec/commands/ff.md +1 -1
- package/openspec/commands/onboard.md +9 -4
- package/openspec/commands/update.md +11 -5
- package/openspec/commands/verify.md +57 -26
- package/openspec/skills/openspec-apply-change/SKILL.md +1 -1
- package/openspec/skills/openspec-archive-change/SKILL.md +16 -9
- package/openspec/skills/openspec-bulk-archive-change/SKILL.md +14 -7
- package/openspec/skills/openspec-continue-change/SKILL.md +1 -2
- package/openspec/skills/openspec-explore/SKILL.md +2 -2
- package/openspec/skills/openspec-ff-change/SKILL.md +2 -2
- package/openspec/skills/openspec-new-change/SKILL.md +1 -1
- package/openspec/skills/openspec-onboard/SKILL.md +10 -5
- package/openspec/skills/openspec-propose/SKILL.md +1 -1
- package/openspec/skills/openspec-sync-specs/SKILL.md +1 -1
- package/openspec/skills/openspec-update-change/SKILL.md +12 -6
- package/openspec/skills/openspec-verify-change/SKILL.md +59 -27
- package/package.json +3 -2
- package/superpowers/.version +3 -3
- package/superpowers/skills/writing-plans/SKILL.md +32 -20
- package/cbb/lib/install/codebuddy.js +0 -30
- package/cbb/worktrees/skills/cbb-worktree-init/scripts/find-workspace-root.js +0 -67
- package/config/workspace-agents.sample.md +0 -41
- package/superpowers/skills/writing-plans/plan-document-reviewer-prompt.md +0 -49
|
@@ -0,0 +1,580 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
require('./silence-popup');
|
|
3
|
+
/**
|
|
4
|
+
* 收尾 / 交付合并门禁 —— 直合并通道 + 合并判定(ADR 0007 / 0008)
|
|
5
|
+
*
|
|
6
|
+
* 把需求分支合并进目标分支并推送远端:
|
|
7
|
+
* - 供 cbb-worktree-close / cbb-local-mode 的收尾门禁调用(默认目标 = 主干)
|
|
8
|
+
* - 供 cbb-worktree-push Step 7 的"直接合并"出口调用(--target 可指定测试分支)
|
|
9
|
+
* 默认交付走 MR(人工在浏览器合入);本脚本是用户在门禁处**显式确认**后的
|
|
10
|
+
* "由 agent 直接完成合并"通道。
|
|
11
|
+
*
|
|
12
|
+
* 用法:
|
|
13
|
+
* node merge-branches.js <ws_root> <branch> [--apps a,b] [--target <分支>] [--allow-checkout] [--dry-run]
|
|
14
|
+
* node merge-branches.js <ws_root> <branch> [--apps a,b] [--target <分支>] --check # 仅判定,不合并
|
|
15
|
+
*
|
|
16
|
+
* 目标分支:
|
|
17
|
+
* 缺省 / --target 等于该仓库探测主干 → 主干快路径(本地主干检出上 merge --no-ff → push;
|
|
18
|
+
* 检出未提交改动 autostash 让路,交付后自动恢复)
|
|
19
|
+
* --target 指定非主干分支:目标 == 当前检出 → 就地合并(同主干快路径处理)
|
|
20
|
+
* 否则 → 临时 worktree(基于 origin/<target>,不动用户检出)
|
|
21
|
+
*
|
|
22
|
+
* 模式:
|
|
23
|
+
* --check 逐仓库判定是否已合并到目标(主干含 release-* 中转 / squash / cherry-pick 兜底,
|
|
24
|
+
* 算法与 cbb-worktree-close 的 safety-check.js 同源);不修改任何状态
|
|
25
|
+
* 默认 两阶段(ADR 0007):
|
|
26
|
+
* 1. 预检:逐仓库校验(目标可解析 / 分支存在 / 主干不领先 origin);
|
|
27
|
+
* 检出上未提交改动(含未跟踪)不再拦截——执行阶段自动暂存让路(autostash)
|
|
28
|
+
* 任一不过 → 退出 2,不执行任何合并
|
|
29
|
+
* 2. 执行:autostash(如有)→ checkout 目标 → pull --ff-only → merge --no-ff
|
|
30
|
+
* → push → 自动恢复暂存;执行中失败 → 先恢复暂存再停止并报告已完成清单
|
|
31
|
+
* (不回滚;重跑幂等)。恢复冲突时保留 stash 条目交用户决策
|
|
32
|
+
* ("后提交者解决":暂存侧改动适配已交付主干,agent 代解或用户手动二选一)
|
|
33
|
+
* --dry-run 只做预检,不执行
|
|
34
|
+
*
|
|
35
|
+
* 恢复机制取舍:先 pop --index(还原 staged 分区);若其失败且有冲突,reset --hard 回到
|
|
36
|
+
* 本次合并的 HEAD 后 plain apply 一次——保证冲突只"单次应用"落盘(双重应用风险为零),
|
|
37
|
+
* 代价是冲突场景下 staged/unstaged 分区扁平化(内容无损)。ignored 文件不参与暂存。
|
|
38
|
+
* 退出码:0 全部成功(含 skipped / merged)/ 1 参数错误 / 2 预检或执行失败(含 need-mr /
|
|
39
|
+
* unmerged / autostashPending——交付已完成,只是暂存未恢复,按 AUTOSTASH_PENDING 行处理)
|
|
40
|
+
* 末行:MERGE_RESULT [...] 或 MERGE_CHECK_RESULT [...]
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
const { execSync } = require('child_process');
|
|
44
|
+
const fs = require('fs');
|
|
45
|
+
const os = require('os');
|
|
46
|
+
const path = require('path');
|
|
47
|
+
|
|
48
|
+
function run(cmd, cwd) {
|
|
49
|
+
try {
|
|
50
|
+
return {
|
|
51
|
+
ok: true,
|
|
52
|
+
out: execSync(cmd, {
|
|
53
|
+
cwd,
|
|
54
|
+
encoding: 'utf-8',
|
|
55
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
56
|
+
timeout: 120000,
|
|
57
|
+
env: { ...process.env, GIT_TERMINAL_PROMPT: '0' },
|
|
58
|
+
}).trim(),
|
|
59
|
+
};
|
|
60
|
+
} catch (e) {
|
|
61
|
+
return { ok: false, err: (e.stderr || e.message || String(e)).trim() };
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function detectMain(repoPath) {
|
|
66
|
+
const remote = run('git remote', repoPath);
|
|
67
|
+
if (!remote.ok || !remote.out) return '';
|
|
68
|
+
const r = remote.out.split(/\r?\n/)[0];
|
|
69
|
+
const symbolic = run('git symbolic-ref "refs/remotes/' + r + '/HEAD"', repoPath);
|
|
70
|
+
if (symbolic.ok && symbolic.out) return symbolic.out.replace('refs/remotes/' + r + '/', '');
|
|
71
|
+
return '';
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// ── 合并判定(与 cbb-worktree-close/scripts/safety-check.js 同源) ──
|
|
75
|
+
// 0=merged, 1=unmerged, 2=to-ref-missing
|
|
76
|
+
function mergedTo(repoPath, from, to) {
|
|
77
|
+
if (!run('git rev-parse --verify --quiet "' + from + '"', repoPath).ok) return 1;
|
|
78
|
+
if (!run('git rev-parse --verify --quiet "' + to + '"', repoPath).ok) return 2;
|
|
79
|
+
if (run('git merge-base --is-ancestor "' + from + '" "' + to + '" && echo Y', repoPath).out === 'Y') return 0;
|
|
80
|
+
// 跨平台:不用 grep(Windows 无 grep),解析 git cherry 输出(+ 前缀 = 未合并提交)
|
|
81
|
+
const cherry = run('git cherry "' + to + '" "' + from + '"', repoPath);
|
|
82
|
+
if (!cherry.ok) return 1;
|
|
83
|
+
if (cherry.out.split(/\r?\n/).filter(Boolean).some(l => l.indexOf('+') === 0)) return 1;
|
|
84
|
+
return 0;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function mergedToMain(repoPath, branchName, main) {
|
|
88
|
+
if (mergedTo(repoPath, branchName, main) === 0) return 'main';
|
|
89
|
+
if (mergedTo(repoPath, branchName, 'origin/' + main) === 0) return 'origin/' + main;
|
|
90
|
+
const releaseList = run('git for-each-ref --format="%(refname:short)" "refs/heads/release-*" "refs/remotes/origin/release-*"', repoPath);
|
|
91
|
+
if (releaseList.ok && releaseList.out) {
|
|
92
|
+
const releases = releaseList.out.split(/\r?\n/).filter(Boolean).sort();
|
|
93
|
+
for (const rel of releases) {
|
|
94
|
+
if (mergedTo(repoPath, branchName, rel) === 0) {
|
|
95
|
+
if (mergedTo(repoPath, rel, main) === 0) return 'main-via-' + rel;
|
|
96
|
+
if (mergedTo(repoPath, rel, 'origin/' + main) === 0) return 'origin/' + main + '-via-' + rel;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** 目标为具体分支时的已合并判定(含 origin 镜像,不做 release 中转) */
|
|
104
|
+
function mergedToTarget(repoPath, branchName, target) {
|
|
105
|
+
if (mergedTo(repoPath, branchName, target) === 0) return target;
|
|
106
|
+
if (mergedTo(repoPath, branchName, 'origin/' + target) === 0) return 'origin/' + target;
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function classifyPushError(stderr) {
|
|
111
|
+
const s = (stderr || '').toLowerCase();
|
|
112
|
+
if (s.includes('protected branch') || s.includes('deny updating')) return 'branch-protected';
|
|
113
|
+
if (s.includes('non-fast-forward') || s.includes('fetch first') || s.includes('rejected')) return 'non-fast-forward';
|
|
114
|
+
if (s.includes('permission denied (publickey)')) return 'ssh-auth-failed';
|
|
115
|
+
if (s.includes('authentication failed')) return 'https-auth-failed';
|
|
116
|
+
if (s.includes('could not resolve host') || s.includes('connection refused') || s.includes('hung up')) return 'network-unreachable';
|
|
117
|
+
return 'unknown';
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function loadApps(wsRoot) {
|
|
121
|
+
try {
|
|
122
|
+
const config = JSON.parse(fs.readFileSync(path.join(wsRoot, 'CBB-WORKSPACE.json'), 'utf-8'));
|
|
123
|
+
return Array.isArray(config.apps) ? config.apps : [];
|
|
124
|
+
} catch (e) {
|
|
125
|
+
return [];
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** 参与仓库:workspace(根 = 主干检出)+ 各 app(.codespace/<app> = 主干检出) */
|
|
130
|
+
function buildRepos(wsRoot, appFilter) {
|
|
131
|
+
const repos = [{ name: 'workspace', repo: wsRoot, work: wsRoot }];
|
|
132
|
+
for (const app of loadApps(wsRoot)) {
|
|
133
|
+
if (appFilter && !appFilter.has(app.name)) continue;
|
|
134
|
+
const dir = path.join(wsRoot, '.codespace', app.name);
|
|
135
|
+
repos.push({ name: app.name, repo: dir, work: dir });
|
|
136
|
+
}
|
|
137
|
+
return repos;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function hasRef(repoPath, ref) {
|
|
141
|
+
return run('git rev-parse --verify --quiet "' + ref + '"', repoPath).ok;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** 清理临时 worktree(失败仅警告,不阻断) */
|
|
145
|
+
function cleanupTempWorktree(repoPath, tmpDir) {
|
|
146
|
+
if (!tmpDir) return;
|
|
147
|
+
const removed = run('git worktree remove --force "' + tmpDir + '"', repoPath);
|
|
148
|
+
if (!removed.ok && fs.existsSync(tmpDir)) {
|
|
149
|
+
try { fs.rmSync(tmpDir, { recursive: true, force: true }); } catch (e) { /* Windows 锁:留给用户 */ }
|
|
150
|
+
}
|
|
151
|
+
run('git worktree prune', repoPath);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// ── autostash 让路 / 恢复(检出上的未提交改动不阻断直合并,ADR 0008 扩展) ──
|
|
155
|
+
|
|
156
|
+
/** 统计检出上未提交项(含未跟踪),仅用于预检输出注记;-1 = 状态不可读 */
|
|
157
|
+
function countUncommitted(workPath) {
|
|
158
|
+
const s = run('git status --porcelain', workPath);
|
|
159
|
+
if (!s.ok) return -1;
|
|
160
|
+
return s.out ? s.out.split(/\r?\n/).filter(Boolean).length : 0;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* 暂存检出上的未提交改动(含未跟踪,不含 ignored),为合并让路。
|
|
165
|
+
* 经 refs/stash 前后对比判断是否真的建了条目(无改动时 stash 不建条目)。
|
|
166
|
+
* 返回 { ok, created, oid, stashId } 或 { ok: false, err }
|
|
167
|
+
*/
|
|
168
|
+
function autostashPush(workPath, tag) {
|
|
169
|
+
const before = run('git rev-parse -q --verify "refs/stash"', workPath);
|
|
170
|
+
const stamp = new Date().toISOString().slice(0, 19).replace('T', ' ');
|
|
171
|
+
const msg = 'cbb-autostash ' + tag + ' [' + stamp + ']';
|
|
172
|
+
const push = run('git stash push --include-untracked -m "' + msg + '"', workPath);
|
|
173
|
+
if (!push.ok) return { ok: false, err: (push.err || push.out || 'stash push 失败').split(/\r?\n/)[0] };
|
|
174
|
+
const after = run('git rev-parse -q --verify "refs/stash"', workPath);
|
|
175
|
+
const oid = after.out || '';
|
|
176
|
+
return { ok: true, created: !!oid && oid !== (before.out || ''), oid, stashId: msg };
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function conflictedPaths(workPath) {
|
|
180
|
+
const d = run('git diff --name-only --diff-filter=U', workPath);
|
|
181
|
+
return d.ok && d.out ? d.out.split(/\r?\n/).filter(Boolean) : [];
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* 单次恢复尝试 + 分类。返回:
|
|
186
|
+
* { done } 完全恢复(pop 成功,或 apply 完整成功 + drop 成功)
|
|
187
|
+
* { conflicted } 冲突标记留在树里,stash 条目保留
|
|
188
|
+
* { dirty, files } 有改动但非标记冲突 / apply 异常部分应用——现场保留,交人工核对
|
|
189
|
+
* { preserved } 无法自动恢复且树未被污染(如未跟踪占位冲突)
|
|
190
|
+
* 防双重应用:pop --index 失败可能留下"半应用"树(工作区改了、index 没还原),
|
|
191
|
+
* 盲目 plain pop 会在半应用之上再应用一次。故失败后先 reset --hard 回到 HEAD,
|
|
192
|
+
* 再 plain apply 一次(干净基线上的单次应用),结果只有"标记冲突"或"完整应用"两种。
|
|
193
|
+
*/
|
|
194
|
+
function tryRestoreStash(workPath, idx) {
|
|
195
|
+
const ref = '"stash@{' + idx + '}"';
|
|
196
|
+
const pop = run('git stash pop --index ' + ref, workPath);
|
|
197
|
+
if (pop.ok) return { done: true };
|
|
198
|
+
const conflicted = conflictedPaths(workPath);
|
|
199
|
+
if (conflicted.length === 0) {
|
|
200
|
+
// 非冲突类失败(如未跟踪文件还原撞车):树可能已被部分应用——如实分类,绝不谎报"未动"
|
|
201
|
+
const s = run('git status --porcelain --untracked-files=no', workPath);
|
|
202
|
+
if (s.ok && s.out) return { dirty: true, files: s.out.split(/\r?\n/).filter(Boolean) };
|
|
203
|
+
return { preserved: true };
|
|
204
|
+
}
|
|
205
|
+
// 有冲突标记:--index 的失败树状态不透明(半应用 + unmerged 索引,checkout -- 会拒绝)。
|
|
206
|
+
// 先 reset --hard 回到本次合并的 HEAD(用户改动安全躺在 stash 里),再 plain apply 一次,
|
|
207
|
+
// 让冲突以标准 stash-pop-conflict 形态单次落盘(标记 + 条目保留),杜绝双重应用。
|
|
208
|
+
const undo = run('git reset --hard --quiet', workPath);
|
|
209
|
+
if (!undo.ok) return { conflicted: true };
|
|
210
|
+
const apply = run('git stash apply ' + ref, workPath);
|
|
211
|
+
if (conflictedPaths(workPath).length > 0) return { conflicted: true };
|
|
212
|
+
if (!apply.ok) {
|
|
213
|
+
const s2 = run('git status --porcelain --untracked-files=no', workPath);
|
|
214
|
+
if (s2.ok && s2.out) return { dirty: true, files: s2.out.split(/\r?\n/).filter(Boolean) };
|
|
215
|
+
return { preserved: true };
|
|
216
|
+
}
|
|
217
|
+
// plain apply 完全成功(首轮失败仅因 --index 还原不了 staged 分区):补 drop 收尾
|
|
218
|
+
const drop = run('git stash drop ' + ref, workPath);
|
|
219
|
+
if (drop.ok) return { done: true };
|
|
220
|
+
return { dirty: true, files: conflictedPaths(workPath) };
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* 恢复 autostash。返回 { state, files?, note? }:
|
|
225
|
+
* none 未建条目,无需恢复
|
|
226
|
+
* restored 已完全恢复
|
|
227
|
+
* conflict 恢复冲突(标记在树里、条目保留)——后提交者解决,交用户决策
|
|
228
|
+
* dirty apply 异常 / 部分应用——现场保留交人工核对
|
|
229
|
+
* preserved 无法自动恢复且树未被污染——条目保留交人工
|
|
230
|
+
* stash-moved stash 顶层已非本次条目——绝不动别人的 stash,保留现场
|
|
231
|
+
*/
|
|
232
|
+
function autostashPop(workPath, st) {
|
|
233
|
+
if (!st.ok || !st.created) return { state: 'none' };
|
|
234
|
+
const cur = run('git rev-parse -q --verify "refs/stash"', workPath);
|
|
235
|
+
if (!cur.ok || cur.out !== st.oid) {
|
|
236
|
+
return { state: 'stash-moved', note: 'stash 顶层条目非本次自动暂存(' + st.stashId + '),未自动恢复' };
|
|
237
|
+
}
|
|
238
|
+
const list = run('git stash list', workPath);
|
|
239
|
+
const top = list.ok ? (list.out.split(/\r?\n/)[0] || '') : '';
|
|
240
|
+
const m = top.match(/^stash@\{(\d+)\}/);
|
|
241
|
+
if (!m) return { state: 'preserved', note: 'stash 列表解析失败(' + st.stashId + ')' };
|
|
242
|
+
const r = tryRestoreStash(workPath, m[1]);
|
|
243
|
+
if (r.done) return { state: 'restored' };
|
|
244
|
+
if (r.conflicted) return { state: 'conflict', files: conflictedPaths(workPath), note: '条目保留:' + top };
|
|
245
|
+
if (r.dirty) return { state: 'dirty', files: r.files, note: '条目保留:' + top };
|
|
246
|
+
return { state: 'preserved', note: '条目保留:' + top };
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
function main() {
|
|
250
|
+
const args = process.argv.slice(2);
|
|
251
|
+
const wsRoot = args[0];
|
|
252
|
+
const branch = args[1];
|
|
253
|
+
|
|
254
|
+
if (!wsRoot || !branch || branch.indexOf('--') === 0) {
|
|
255
|
+
console.error('Usage: node merge-branches.js <ws_root> <branch> [--apps a,b] [--target b] [--allow-checkout] [--dry-run] [--check]');
|
|
256
|
+
process.exit(1);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
const appsIdx = args.indexOf('--apps');
|
|
260
|
+
const appFilter = appsIdx >= 0
|
|
261
|
+
? new Set((args[appsIdx + 1] || '').split(',').map(s => s.trim()).filter(Boolean))
|
|
262
|
+
: null;
|
|
263
|
+
const targetIdx = args.indexOf('--target');
|
|
264
|
+
const targetArg = targetIdx >= 0 ? (args[targetIdx + 1] || '').trim() : '';
|
|
265
|
+
if (targetIdx >= 0 && !targetArg) {
|
|
266
|
+
console.error('--target 需要提供分支名');
|
|
267
|
+
process.exit(1);
|
|
268
|
+
}
|
|
269
|
+
const allowCheckout = args.includes('--allow-checkout');
|
|
270
|
+
const dryRun = args.includes('--dry-run');
|
|
271
|
+
const checkOnly = args.includes('--check');
|
|
272
|
+
|
|
273
|
+
const repos = buildRepos(wsRoot, appFilter);
|
|
274
|
+
|
|
275
|
+
// ── --check:仅判定每仓库是否已合并到目标 ─────────────────
|
|
276
|
+
if (checkOnly) {
|
|
277
|
+
const results = [];
|
|
278
|
+
for (const rp of repos) {
|
|
279
|
+
const rec = { name: rp.name, status: 'unmerged', merged: null, main: null, target: null };
|
|
280
|
+
if (!fs.existsSync(path.join(rp.repo, '.git'))) {
|
|
281
|
+
rec.status = 'no-repo';
|
|
282
|
+
results.push(rec);
|
|
283
|
+
continue;
|
|
284
|
+
}
|
|
285
|
+
run('git fetch --quiet origin', rp.repo);
|
|
286
|
+
const main = detectMain(rp.repo);
|
|
287
|
+
if (!main) {
|
|
288
|
+
rec.status = 'failed';
|
|
289
|
+
results.push(rec);
|
|
290
|
+
continue;
|
|
291
|
+
}
|
|
292
|
+
rec.main = main;
|
|
293
|
+
const target = targetArg || main;
|
|
294
|
+
rec.target = target;
|
|
295
|
+
if (!hasRef(rp.repo, 'refs/heads/' + branch)) {
|
|
296
|
+
rec.status = 'no-branch';
|
|
297
|
+
results.push(rec);
|
|
298
|
+
continue;
|
|
299
|
+
}
|
|
300
|
+
const merged = (!targetArg || target === main)
|
|
301
|
+
? mergedToMain(rp.repo, branch, main)
|
|
302
|
+
: mergedToTarget(rp.repo, branch, target);
|
|
303
|
+
rec.merged = merged;
|
|
304
|
+
rec.status = merged ? 'merged' : 'unmerged';
|
|
305
|
+
results.push(rec);
|
|
306
|
+
}
|
|
307
|
+
results.forEach(r => console.log(r.status.toUpperCase() + ' ' + r.name + (r.merged ? ' → ' + r.merged : '') + (r.target ? ' [target: ' + r.target + ']' : '')));
|
|
308
|
+
const ok = results.every(r => r.status !== 'unmerged' && r.status !== 'failed');
|
|
309
|
+
console.log('---');
|
|
310
|
+
console.log('MERGE_CHECK_RESULT', JSON.stringify({ branch, target: targetArg || null, results }));
|
|
311
|
+
process.exit(ok ? 0 : 2);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
// ── 阶段 1:预检 ──────────────────────────────────────────
|
|
315
|
+
const prechecks = [];
|
|
316
|
+
for (const rp of repos) {
|
|
317
|
+
const rec = { name: rp.name, status: 'ok', main: null, target: null, temp: false, reason: null, uncommitted: 0 };
|
|
318
|
+
if (!fs.existsSync(path.join(rp.repo, '.git'))) {
|
|
319
|
+
rec.status = 'skipped';
|
|
320
|
+
rec.reason = 'no-repo';
|
|
321
|
+
prechecks.push(rec);
|
|
322
|
+
continue;
|
|
323
|
+
}
|
|
324
|
+
const fetch = run('git fetch --quiet origin', rp.repo);
|
|
325
|
+
if (!fetch.ok) {
|
|
326
|
+
rec.status = 'failed';
|
|
327
|
+
rec.reason = 'fetch-failed';
|
|
328
|
+
prechecks.push(rec);
|
|
329
|
+
continue;
|
|
330
|
+
}
|
|
331
|
+
const main = detectMain(rp.repo);
|
|
332
|
+
if (!main) {
|
|
333
|
+
rec.status = 'failed';
|
|
334
|
+
rec.reason = 'cannot-detect-main';
|
|
335
|
+
prechecks.push(rec);
|
|
336
|
+
continue;
|
|
337
|
+
}
|
|
338
|
+
rec.main = main;
|
|
339
|
+
const target = targetArg || main;
|
|
340
|
+
rec.target = target;
|
|
341
|
+
|
|
342
|
+
if (!hasRef(rp.repo, 'refs/heads/' + branch)) {
|
|
343
|
+
rec.status = 'skipped';
|
|
344
|
+
rec.reason = 'no-branch';
|
|
345
|
+
prechecks.push(rec);
|
|
346
|
+
continue;
|
|
347
|
+
}
|
|
348
|
+
const targetLocal = hasRef(rp.repo, 'refs/heads/' + target);
|
|
349
|
+
const targetRemote = hasRef(rp.repo, 'refs/remotes/origin/' + target);
|
|
350
|
+
if (!targetLocal && !targetRemote) {
|
|
351
|
+
rec.status = 'failed';
|
|
352
|
+
rec.reason = 'target-not-found';
|
|
353
|
+
prechecks.push(rec);
|
|
354
|
+
continue;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
if (target === main) {
|
|
358
|
+
// 主干路径(快路径,与 ADR 0007 收尾门禁一致)
|
|
359
|
+
if (mergedToMain(rp.repo, branch, main)) {
|
|
360
|
+
rec.status = 'skipped';
|
|
361
|
+
rec.reason = 'already-merged';
|
|
362
|
+
prechecks.push(rec);
|
|
363
|
+
continue;
|
|
364
|
+
}
|
|
365
|
+
// 检出脏不再拦截:记录未提交项数,执行阶段 autostash 让路、合并后恢复(ADR 0008 扩展)
|
|
366
|
+
rec.uncommitted = countUncommitted(rp.work);
|
|
367
|
+
const current = run('git branch --show-current', rp.work);
|
|
368
|
+
if (current.out && current.out !== main && !allowCheckout) {
|
|
369
|
+
rec.status = 'failed';
|
|
370
|
+
rec.reason = 'not-on-main';
|
|
371
|
+
prechecks.push(rec);
|
|
372
|
+
continue;
|
|
373
|
+
}
|
|
374
|
+
const ahead = run('git rev-list --count "origin/' + main + '..' + main + '"', rp.repo);
|
|
375
|
+
if (ahead.ok && ahead.out && parseInt(ahead.out, 10) > 0) {
|
|
376
|
+
rec.status = 'failed';
|
|
377
|
+
rec.reason = 'main-ahead-of-origin';
|
|
378
|
+
prechecks.push(rec);
|
|
379
|
+
continue;
|
|
380
|
+
}
|
|
381
|
+
} else {
|
|
382
|
+
// 指定分支路径:已合并则跳过;当前检出即目标 → 就地(autostash);否则临时 worktree
|
|
383
|
+
if (mergedToTarget(rp.repo, branch, target)) {
|
|
384
|
+
rec.status = 'skipped';
|
|
385
|
+
rec.reason = 'already-merged';
|
|
386
|
+
prechecks.push(rec);
|
|
387
|
+
continue;
|
|
388
|
+
}
|
|
389
|
+
const current = run('git branch --show-current', rp.work);
|
|
390
|
+
if (current.out === target) {
|
|
391
|
+
// 就地合并:同主干快路径,检出脏不拦截,执行阶段 autostash 让路 / 恢复
|
|
392
|
+
rec.uncommitted = countUncommitted(rp.work);
|
|
393
|
+
} else {
|
|
394
|
+
rec.temp = true; // 执行阶段创建临时 worktree(基于 origin/<target>,不碰用户检出)
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
prechecks.push(rec);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
const hasPrecheckFailure = prechecks.some(p => p.status === 'failed');
|
|
401
|
+
prechecks.forEach(p => {
|
|
402
|
+
if (p.status === 'failed') console.log('FAIL ' + p.name + ': ' + p.reason);
|
|
403
|
+
else if (p.status === 'skipped') console.log('SKIP ' + p.name + ': ' + p.reason);
|
|
404
|
+
else {
|
|
405
|
+
let note = p.temp ? '(临时 worktree)' : '';
|
|
406
|
+
if (!p.temp && p.uncommitted > 0) note += '(检出有 ' + p.uncommitted + ' 项未提交改动,将自动暂存、合并后恢复)';
|
|
407
|
+
console.log('OK ' + p.name + ' → 合并至 ' + p.target + note);
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
|
|
411
|
+
if (hasPrecheckFailure) {
|
|
412
|
+
console.log('---');
|
|
413
|
+
console.log('MERGE_RESULT', JSON.stringify({ phase: 'precheck', results: prechecks }));
|
|
414
|
+
process.exit(2);
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
if (dryRun) {
|
|
418
|
+
console.log('---');
|
|
419
|
+
console.log('MERGE_RESULT', JSON.stringify({ phase: 'precheck', dry_run: true, results: prechecks }));
|
|
420
|
+
process.exit(0);
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
// ── 阶段 2:执行(停止式,不回滚) ────────────────────────
|
|
424
|
+
const results = prechecks.map(p => ({ ...p, status: p.status, detail: null }));
|
|
425
|
+
let stopped = false;
|
|
426
|
+
|
|
427
|
+
for (let i = 0; i < prechecks.length; i += 1) {
|
|
428
|
+
const p = prechecks[i];
|
|
429
|
+
const rp = repos[i];
|
|
430
|
+
if (p.status !== 'ok') continue;
|
|
431
|
+
if (stopped) {
|
|
432
|
+
results[i].status = 'not-attempted';
|
|
433
|
+
continue;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
const target = p.target;
|
|
437
|
+
const mergeMsg = "Merge branch '" + branch + "'";
|
|
438
|
+
let st = null; // autostash 句柄(仅主干 / 就地路径建)
|
|
439
|
+
// 统一出口:凡建过暂存,离开本仓库前必恢复;恢复未完全 → autostashPending(退出码 2 交用户决策)
|
|
440
|
+
const finish = (status, detail) => {
|
|
441
|
+
let pending = false;
|
|
442
|
+
if (st) {
|
|
443
|
+
const pr = autostashPop(rp.work, st);
|
|
444
|
+
if (pr.state !== 'none' && pr.state !== 'restored') {
|
|
445
|
+
pending = true;
|
|
446
|
+
detail += '; autostash-' + pr.state +
|
|
447
|
+
(pr.files && pr.files.length ? ' [' + pr.files.join(', ') + ']' : '') +
|
|
448
|
+
(pr.note ? ' ' + pr.note : '');
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
results[i].status = status;
|
|
452
|
+
results[i].detail = detail;
|
|
453
|
+
results[i].autostashPending = pending;
|
|
454
|
+
if (status !== 'merged' && status !== 'skipped') stopped = true;
|
|
455
|
+
};
|
|
456
|
+
|
|
457
|
+
if (target === p.main) {
|
|
458
|
+
// ── 主干路径(快路径):检出未提交改动 autostash 让路,交付后自动恢复 ──
|
|
459
|
+
st = autostashPush(rp.work, 'merge-' + branch + '-into-' + target);
|
|
460
|
+
if (!st.ok) {
|
|
461
|
+
finish('failed', 'autostash-failed: ' + st.err);
|
|
462
|
+
continue;
|
|
463
|
+
}
|
|
464
|
+
const current = run('git branch --show-current', rp.work);
|
|
465
|
+
if (current.out !== target) {
|
|
466
|
+
const co = run('git checkout --quiet "' + target + '"', rp.work);
|
|
467
|
+
if (!co.ok) {
|
|
468
|
+
finish('failed', 'checkout-failed: ' + co.err.split(/\r?\n/)[0]);
|
|
469
|
+
continue;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
const pull = run('git pull --ff-only --quiet origin "' + target + '"', rp.repo);
|
|
473
|
+
if (!pull.ok) {
|
|
474
|
+
finish('failed', 'pull-failed: ' + pull.err.split(/\r?\n/)[0]);
|
|
475
|
+
continue;
|
|
476
|
+
}
|
|
477
|
+
const merge = run('git merge --no-ff -m "' + mergeMsg + '" "' + branch + '"', rp.repo);
|
|
478
|
+
if (!merge.ok) {
|
|
479
|
+
run('git merge --abort', rp.repo);
|
|
480
|
+
finish('failed', 'merge-failed: ' + merge.err.split(/\r?\n/)[0]);
|
|
481
|
+
continue;
|
|
482
|
+
}
|
|
483
|
+
let push = run('git push origin "' + target + '"', rp.repo);
|
|
484
|
+
if (!push.ok) {
|
|
485
|
+
const code = classifyPushError(push.err);
|
|
486
|
+
if (code === 'non-fast-forward') {
|
|
487
|
+
const retryPull = run('git pull --ff-only --quiet origin "' + target + '"', rp.repo);
|
|
488
|
+
push = retryPull.ok ? run('git push origin "' + target + '"', rp.repo) : retryPull;
|
|
489
|
+
}
|
|
490
|
+
if (!push.ok) {
|
|
491
|
+
const code2 = classifyPushError(push.err);
|
|
492
|
+
if (code2 === 'branch-protected') {
|
|
493
|
+
finish('need-mr', 'branch-protected(目标分支受保护,请改用 MR 出口)');
|
|
494
|
+
} else {
|
|
495
|
+
finish('failed', 'push-failed: ' + (push.err || '').split(/\r?\n/)[0]);
|
|
496
|
+
}
|
|
497
|
+
continue;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
finish('merged', 'merged+pushed origin/' + target);
|
|
501
|
+
continue;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
// ── 指定分支路径(当前检出即目标 → 就地 + autostash;否则临时 worktree,不碰检出) ──
|
|
505
|
+
let workDir = rp.work;
|
|
506
|
+
let tmpDir = null;
|
|
507
|
+
const current = run('git branch --show-current', rp.work);
|
|
508
|
+
if (current.out !== target) {
|
|
509
|
+
tmpDir = path.join(os.tmpdir(), 'cbb-merge-' + process.pid + '-' + i);
|
|
510
|
+
const base = hasRef(rp.repo, 'refs/remotes/origin/' + target) ? 'origin/' + target : target;
|
|
511
|
+
const add = run('git worktree add --detach "' + tmpDir + '" "' + base + '"', rp.repo);
|
|
512
|
+
if (!add.ok) {
|
|
513
|
+
finish('failed', 'worktree-add-failed: ' + add.err.split(/\r?\n/)[0]);
|
|
514
|
+
continue;
|
|
515
|
+
}
|
|
516
|
+
workDir = tmpDir;
|
|
517
|
+
} else {
|
|
518
|
+
st = autostashPush(rp.work, 'merge-' + branch + '-into-' + target);
|
|
519
|
+
if (!st.ok) {
|
|
520
|
+
finish('failed', 'autostash-failed: ' + st.err);
|
|
521
|
+
continue;
|
|
522
|
+
}
|
|
523
|
+
const pull = run('git pull --ff-only --quiet origin "' + target + '"', rp.repo);
|
|
524
|
+
if (!pull.ok) {
|
|
525
|
+
finish('failed', 'pull-failed: ' + pull.err.split(/\r?\n/)[0]);
|
|
526
|
+
continue;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
const merge = run('git merge --no-ff -m "' + mergeMsg + '" "' + branch + '"', workDir);
|
|
531
|
+
if (!merge.ok) {
|
|
532
|
+
run('git merge --abort', workDir);
|
|
533
|
+
cleanupTempWorktree(rp.repo, tmpDir);
|
|
534
|
+
finish('failed', 'merge-failed: ' + merge.err.split(/\r?\n/)[0]);
|
|
535
|
+
continue;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
let push = run('git push origin "HEAD:refs/heads/' + target + '"', workDir);
|
|
539
|
+
if (!push.ok) {
|
|
540
|
+
const code = classifyPushError(push.err);
|
|
541
|
+
if (code === 'non-fast-forward') {
|
|
542
|
+
// 远端已前进:在合并工作区 ff 同步后重试一次
|
|
543
|
+
const retry = run('git fetch --quiet origin "' + target + '" && git reset --hard FETCH_HEAD', workDir);
|
|
544
|
+
if (retry.ok) {
|
|
545
|
+
const rem = run('git merge --no-ff -m "' + mergeMsg + '" "' + branch + '"', workDir);
|
|
546
|
+
if (rem.ok) push = run('git push origin "HEAD:refs/heads/' + target + '"', workDir);
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
if (!push.ok) {
|
|
550
|
+
const code2 = classifyPushError(push.err);
|
|
551
|
+
cleanupTempWorktree(rp.repo, tmpDir);
|
|
552
|
+
if (code2 === 'branch-protected') {
|
|
553
|
+
finish('need-mr', 'branch-protected(目标分支受保护,请改用 MR 出口)');
|
|
554
|
+
} else {
|
|
555
|
+
finish('failed', 'push-failed: ' + (push.err || '').split(/\r?\n/)[0]);
|
|
556
|
+
}
|
|
557
|
+
continue;
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
cleanupTempWorktree(rp.repo, tmpDir);
|
|
561
|
+
finish('merged', 'merged+pushed origin/' + target + (tmpDir ? '(临时 worktree)' : ''));
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
results.forEach(r => {
|
|
565
|
+
console.log(r.status.toUpperCase() + ' ' + r.name + (r.detail ? ' — ' + r.detail : ''));
|
|
566
|
+
if (r.autostashPending) {
|
|
567
|
+
console.log('AUTOSTASH_PENDING ' + r.name + ': 暂存的未提交改动未自动恢复(stash 条目保留)——列冲突点,用户二选一:agent 解决 / 手动解决(协议见 SKILL 解读)');
|
|
568
|
+
}
|
|
569
|
+
});
|
|
570
|
+
|
|
571
|
+
// autostashPending 按失败退出:交付可能已完成,但用户改动还挂在 stash,必须决策处理后重跑确认
|
|
572
|
+
const ok = results.every(r => (r.status === 'merged' || r.status === 'skipped') && !r.autostashPending);
|
|
573
|
+
console.log('---');
|
|
574
|
+
console.log('MERGE_RESULT', JSON.stringify({ phase: 'execute', target: targetArg || null, results }));
|
|
575
|
+
process.exit(ok ? 0 : 2);
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
if (require.main === module) main();
|
|
579
|
+
|
|
580
|
+
module.exports = { run, detectMain, mergedTo, mergedToMain, mergedToTarget, classifyPushError, loadApps, buildRepos, autostashPush, autostashPop };
|
|
@@ -3,7 +3,7 @@ require('./silence-popup');
|
|
|
3
3
|
* openspec-shared 推送核心模块
|
|
4
4
|
*
|
|
5
5
|
* 唯一真源:cbb/worktrees/_shared/scripts/push-core.js
|
|
6
|
-
* 由 scripts/sync-shared.js 展开到各 skill 的 scripts/ 下(init
|
|
6
|
+
* 由 scripts/sync-shared.js 展开到各 skill 的 scripts/ 下(init / push)。
|
|
7
7
|
*
|
|
8
8
|
* 公开 API:
|
|
9
9
|
* - tryExec(cmd, cwd, execImpl) 包装 execSync,统一返回 {ok, out|err}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// koffi is resolved from cbb global install (no local node_modules needed).
|
|
5
5
|
//
|
|
6
6
|
// 唯一真源:cbb/worktrees/_shared/scripts/silence-popup.js
|
|
7
|
-
// 由 scripts/sync-shared.js 展开到各 skill 的 scripts/ 下(init /
|
|
7
|
+
// 由 scripts/sync-shared.js 展开到各 skill 的 scripts/ 下(init / close / push / local-mode)。
|
|
8
8
|
// skill 内同目录引用:脚本第一行 `require('./silence-popup')`。
|
|
9
9
|
if (process.platform === 'win32') {
|
|
10
10
|
try {
|