worktree-bay 2.3.5 → 2.3.7
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/dist/commands/add.js +5 -7
- package/dist/commands/completion.js +2 -0
- package/dist/commands/rm.js +4 -6
- package/dist/engine.js +0 -1
- package/package.json +1 -1
package/dist/commands/add.js
CHANGED
|
@@ -23,10 +23,11 @@ export async function addCommand(cfg, feature, service, branch, base) {
|
|
|
23
23
|
const ctxBase = { cfg, service, sp, slot: p.slot, slug: p.slug, dir: p.dir, repo: p.repo };
|
|
24
24
|
const ctx = { ...ctxBase, vars: buildVars(cfg, ctxBase) };
|
|
25
25
|
if (fs.existsSync(p.dir)) { // 幂等重入:worktree 已在 → 不重建/不重跑 setup,但确保 dev server 在跑
|
|
26
|
-
log(t(
|
|
26
|
+
log(t(`${service} · 已就绪 · 槽 ${p.slot} · 端口 ${ctx.vars.port}`, `${service} · ready · slot ${p.slot} · port ${ctx.vars.port}`));
|
|
27
27
|
await ensureStarted(ctx);
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
|
+
log(t(`${service} · 槽 ${p.slot} · 端口 ${ctx.vars.port} · 分支 ${br}`, `${service} · slot ${p.slot} · port ${ctx.vars.port} · branch ${br}`));
|
|
30
31
|
const resolvedBase = base ?? `origin/${mainBranch(p.repo)}`;
|
|
31
32
|
try {
|
|
32
33
|
await bringUp(ctx, resolvedBase, br);
|
|
@@ -38,13 +39,10 @@ export async function addCommand(cfg, feature, service, branch, base) {
|
|
|
38
39
|
throw e;
|
|
39
40
|
}
|
|
40
41
|
await ensureStarted(ctx);
|
|
41
|
-
log(t(`✓ ${service} 挂入 "${feature}"(槽 ${p.slot},端口 ${ctx.vars.port},分支 ${br})`, `✓ ${service} added to "${feature}" (slot ${p.slot}, port ${ctx.vars.port}, branch ${br})`));
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
|
-
// up: 一条命令为功能批量起多个服务(claim 自动 +
|
|
44
|
+
// up: 一条命令为功能批量起多个服务(claim 自动 + 各服务默认分支)。每个服务由 addCommand 自己打印简洁标题。
|
|
45
45
|
export async function upCommand(cfg, feature, services, base) {
|
|
46
|
-
for (
|
|
47
|
-
|
|
48
|
-
await addCommand(cfg, feature, services[i], undefined, base);
|
|
49
|
-
}
|
|
46
|
+
for (const service of services)
|
|
47
|
+
await addCommand(cfg, feature, service, undefined, base);
|
|
50
48
|
}
|
|
@@ -19,6 +19,8 @@ export function complete(cfg, words) {
|
|
|
19
19
|
return Object.values(readLabels(cfg));
|
|
20
20
|
if (['add', 'run', 'sh', 'path'].includes(sub) && pos === 2)
|
|
21
21
|
return Object.keys(cfg.services);
|
|
22
|
+
if (sub === 'run' && pos === 3)
|
|
23
|
+
return Object.keys(cfg.services[prev[2]]?.run ?? {}); // run <feature> <service> <name>:补该服务的 run 命令名
|
|
22
24
|
if (sub === 'up' && pos >= 2)
|
|
23
25
|
return Object.keys(cfg.services); // up 接变长服务列表
|
|
24
26
|
return [];
|
package/dist/commands/rm.js
CHANGED
|
@@ -19,19 +19,17 @@ export async function rmCommand(cfg, feature, service, force) {
|
|
|
19
19
|
await withLock(cfg.workspaceRoot, async () => {
|
|
20
20
|
let removed = 0;
|
|
21
21
|
const occs = resolveRm(cfg, feature, service);
|
|
22
|
-
for (
|
|
23
|
-
const o = occs[i];
|
|
22
|
+
for (const o of occs) {
|
|
24
23
|
const repo = repoPath(cfg, o.service);
|
|
25
24
|
const branch = currentBranch(o.dir);
|
|
26
|
-
const tag = t(`[${i + 1}/${occs.length}]`, `[${i + 1}/${occs.length}]`);
|
|
27
25
|
if (!force && (isDirty(o.dir) || hasUnpushed(repo, branch))) {
|
|
28
|
-
warn(t(
|
|
26
|
+
warn(t(`${o.service} · 跳过:有未提交或未推送的改动。先提交/推送,或加 -f 强删(会丢改动)。`, `${o.service} · skipped: uncommitted or unpushed changes. Commit/push first, or pass -f to force-remove (discards them).`));
|
|
29
27
|
continue;
|
|
30
28
|
}
|
|
31
|
-
log(t(
|
|
29
|
+
log(t(`${o.service} · 拆除…`, `${o.service} · tearing down…`));
|
|
32
30
|
const stopped = stopManaged(cfg.workspaceRoot, o.dir); // 先停 dev server(释放对 worktree 文件的占用)
|
|
33
31
|
if (stopped)
|
|
34
|
-
log(t(`
|
|
32
|
+
log(t(` ✓ 已停止 dev server(pid ${stopped.pid})`, ` ✓ stopped dev server (pid ${stopped.pid})`));
|
|
35
33
|
const sp = cfg.services[o.service];
|
|
36
34
|
if (sp.teardown) {
|
|
37
35
|
const vars = buildVars(cfg, { cfg, service: o.service, sp, slot: o.slot, slug: o.slug, dir: o.dir, repo });
|
package/dist/engine.js
CHANGED
|
@@ -43,7 +43,6 @@ export async function bringUp(ctx, base, branch) {
|
|
|
43
43
|
const { sp, dir, repo, vars } = ctx;
|
|
44
44
|
if (await portInUse(Number(vars.port)))
|
|
45
45
|
throw new Error(t(`端口 ${vars.port} 已被占用。先停掉占用它的进程,或用 \`worktree-bay gc\`/\`worktree-bay down <功能>\` 释放其它槽后重试。`, `port ${vars.port} is already in use. Stop whatever is using it, or free a slot with \`worktree-bay gc\`/\`worktree-bay down <feature>\`, then retry.`));
|
|
46
|
-
log(t(` → 创建 worktree(分支 ${branch})…`, ` → creating worktree (branch ${branch})…`));
|
|
47
46
|
addWorktree(repo, dir, branch, base);
|
|
48
47
|
for (const rel of sp.copy ?? []) {
|
|
49
48
|
// dereference: vendor/node_modules 含符号链接,Windows 下原样复制符号链接会失败,跟随并拷目标内容。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "worktree-bay",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.7",
|
|
4
4
|
"description": "Per-feature git worktree + port slots for parallel multi-service development: auto deps, env wiring, frontend-to-backend, merge-aware reclaim, plus an MCP server for AI agents.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"git",
|