vde-worktree 0.0.12 → 0.0.14
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.ja.md +4 -0
- package/README.md +4 -1
- package/dist/index.mjs +92 -46
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.ja.md
CHANGED
|
@@ -111,6 +111,7 @@ autoload -Uz compinit && compinit
|
|
|
111
111
|
- `--verbose`: 詳細ログ
|
|
112
112
|
- `--no-hooks`: 今回のみ hook 無効化(`--allow-unsafe` 必須)
|
|
113
113
|
- `--allow-unsafe`: unsafe 操作の明示同意
|
|
114
|
+
- `--no-gh`: 今回の実行で `gh` による PR merged 判定を無効化
|
|
114
115
|
- `--hook-timeout-ms <ms>`: hook timeout 上書き
|
|
115
116
|
- `--lock-timeout-ms <ms>`: repo lock timeout 上書き
|
|
116
117
|
|
|
@@ -133,12 +134,14 @@ vw init
|
|
|
133
134
|
```bash
|
|
134
135
|
vw list
|
|
135
136
|
vw list --json
|
|
137
|
+
vw list --no-gh
|
|
136
138
|
```
|
|
137
139
|
|
|
138
140
|
機能:
|
|
139
141
|
|
|
140
142
|
- Git の porcelain 情報から worktree 一覧を取得
|
|
141
143
|
- branch/path/dirty/lock/merged/upstream を表示
|
|
144
|
+
- `--no-gh` 指定時は PR merged 判定をスキップ(`merged.byPR` は `null`)
|
|
142
145
|
- 対話ターミナルでは Catppuccin 風の ANSI 色で表示
|
|
143
146
|
|
|
144
147
|
### `status`
|
|
@@ -434,6 +437,7 @@ vw completion zsh --install
|
|
|
434
437
|
- `gh auth` 未設定
|
|
435
438
|
- API 失敗
|
|
436
439
|
- `git config vde-worktree.enableGh false`
|
|
440
|
+
- `--no-gh` を指定して実行
|
|
437
441
|
|
|
438
442
|
## JSON 契約
|
|
439
443
|
|
package/README.md
CHANGED
|
@@ -111,6 +111,7 @@ After `vw init`, the tool manages:
|
|
|
111
111
|
- `--verbose`: verbose logging
|
|
112
112
|
- `--no-hooks`: disable hooks for this run (requires `--allow-unsafe`)
|
|
113
113
|
- `--allow-unsafe`: explicit unsafe override
|
|
114
|
+
- `--no-gh`: disable GitHub CLI based PR merge checks for this run
|
|
114
115
|
- `--hook-timeout-ms <ms>`: hook timeout override
|
|
115
116
|
- `--lock-timeout-ms <ms>`: repository lock timeout override
|
|
116
117
|
|
|
@@ -133,12 +134,14 @@ What it does:
|
|
|
133
134
|
```bash
|
|
134
135
|
vw list
|
|
135
136
|
vw list --json
|
|
137
|
+
vw list --no-gh
|
|
136
138
|
```
|
|
137
139
|
|
|
138
140
|
What it does:
|
|
139
141
|
|
|
140
142
|
- Lists all worktrees from Git porcelain output
|
|
141
143
|
- Includes metadata such as branch, path, dirty, lock, merged, and upstream status
|
|
144
|
+
- With `--no-gh`, skips PR-based merge checks (`merged.byPR` becomes `null`)
|
|
142
145
|
- In interactive terminal, uses Catppuccin-style ANSI colors
|
|
143
146
|
|
|
144
147
|
### `status`
|
|
@@ -428,7 +431,7 @@ Overall policy:
|
|
|
428
431
|
- `byPR === false` => `overall = false`
|
|
429
432
|
- `byPR === null` => fallback to `byAncestry`
|
|
430
433
|
|
|
431
|
-
`byPR` becomes `null` when PR lookup is unavailable (for example: `gh` missing, auth missing, API error,
|
|
434
|
+
`byPR` becomes `null` when PR lookup is unavailable (for example: `gh` missing, auth missing, API error, `vde-worktree.enableGh=false`, or `--no-gh`).
|
|
432
435
|
|
|
433
436
|
## JSON Contract
|
|
434
437
|
|
package/dist/index.mjs
CHANGED
|
@@ -833,21 +833,45 @@ const defaultRunGh = async ({ cwd, args }) => {
|
|
|
833
833
|
stderr: result.stderr
|
|
834
834
|
};
|
|
835
835
|
};
|
|
836
|
-
const
|
|
836
|
+
const toTargetBranches = ({ branches, baseBranch }) => {
|
|
837
|
+
const uniqueBranches = /* @__PURE__ */ new Set();
|
|
838
|
+
for (const branch of branches) {
|
|
839
|
+
if (typeof branch !== "string" || branch.length === 0) continue;
|
|
840
|
+
if (branch === baseBranch) continue;
|
|
841
|
+
uniqueBranches.add(branch);
|
|
842
|
+
}
|
|
843
|
+
return [...uniqueBranches];
|
|
844
|
+
};
|
|
845
|
+
const buildUnknownBranchMap = (branches) => {
|
|
846
|
+
return new Map(branches.map((branch) => [branch, null]));
|
|
847
|
+
};
|
|
848
|
+
const parseMergedBranches = ({ raw, targetBranches }) => {
|
|
837
849
|
try {
|
|
838
850
|
const parsed = JSON.parse(raw);
|
|
839
851
|
if (Array.isArray(parsed) !== true) return null;
|
|
840
852
|
const records = parsed;
|
|
841
|
-
|
|
842
|
-
|
|
853
|
+
const mergedBranches = /* @__PURE__ */ new Set();
|
|
854
|
+
for (const record of records) {
|
|
855
|
+
if (typeof record?.headRefName !== "string" || record.headRefName.length === 0) continue;
|
|
856
|
+
if (targetBranches.has(record.headRefName) !== true) continue;
|
|
857
|
+
if (typeof record.mergedAt !== "string" || record.mergedAt.length === 0) continue;
|
|
858
|
+
mergedBranches.add(record.headRefName);
|
|
859
|
+
}
|
|
860
|
+
return mergedBranches;
|
|
843
861
|
} catch {
|
|
844
862
|
return null;
|
|
845
863
|
}
|
|
846
864
|
};
|
|
847
|
-
const
|
|
848
|
-
if (enabled !== true) return
|
|
849
|
-
if (baseBranch === null) return
|
|
865
|
+
const resolveMergedByPrBatch = async ({ repoRoot, baseBranch, branches, enabled = true, runGh = defaultRunGh }) => {
|
|
866
|
+
if (enabled !== true) return /* @__PURE__ */ new Map();
|
|
867
|
+
if (baseBranch === null) return /* @__PURE__ */ new Map();
|
|
868
|
+
const targetBranches = toTargetBranches({
|
|
869
|
+
branches,
|
|
870
|
+
baseBranch
|
|
871
|
+
});
|
|
872
|
+
if (targetBranches.length === 0) return /* @__PURE__ */ new Map();
|
|
850
873
|
try {
|
|
874
|
+
const targetBranchSet = new Set(targetBranches);
|
|
851
875
|
const result = await runGh({
|
|
852
876
|
cwd: repoRoot,
|
|
853
877
|
args: [
|
|
@@ -855,21 +879,28 @@ const resolveMergedByPr = async ({ repoRoot, branch, baseBranch, enabled = true,
|
|
|
855
879
|
"list",
|
|
856
880
|
"--state",
|
|
857
881
|
"merged",
|
|
858
|
-
"--head",
|
|
859
|
-
branch,
|
|
860
882
|
"--base",
|
|
861
883
|
baseBranch,
|
|
884
|
+
"--search",
|
|
885
|
+
targetBranches.map((branch) => `head:${branch}`).join(" OR "),
|
|
862
886
|
"--limit",
|
|
863
|
-
"
|
|
887
|
+
"1000",
|
|
864
888
|
"--json",
|
|
865
|
-
"mergedAt"
|
|
889
|
+
"headRefName,mergedAt"
|
|
866
890
|
]
|
|
867
891
|
});
|
|
868
|
-
if (result.exitCode !== 0) return
|
|
869
|
-
|
|
892
|
+
if (result.exitCode !== 0) return buildUnknownBranchMap(targetBranches);
|
|
893
|
+
const mergedBranches = parseMergedBranches({
|
|
894
|
+
raw: result.stdout,
|
|
895
|
+
targetBranches: targetBranchSet
|
|
896
|
+
});
|
|
897
|
+
if (mergedBranches === null) return buildUnknownBranchMap(targetBranches);
|
|
898
|
+
return new Map(targetBranches.map((branch) => {
|
|
899
|
+
return [branch, mergedBranches.has(branch)];
|
|
900
|
+
}));
|
|
870
901
|
} catch (error) {
|
|
871
|
-
if (error.code === "ENOENT") return
|
|
872
|
-
return
|
|
902
|
+
if (error.code === "ENOENT") return buildUnknownBranchMap(targetBranches);
|
|
903
|
+
return buildUnknownBranchMap(targetBranches);
|
|
873
904
|
}
|
|
874
905
|
};
|
|
875
906
|
|
|
@@ -1018,7 +1049,7 @@ const resolveLockState = async ({ repoRoot, branch }) => {
|
|
|
1018
1049
|
};
|
|
1019
1050
|
}
|
|
1020
1051
|
};
|
|
1021
|
-
const resolveMergedState = async ({ repoRoot, branch, head, baseBranch,
|
|
1052
|
+
const resolveMergedState = async ({ repoRoot, branch, head, baseBranch, mergedByPrByBranch }) => {
|
|
1022
1053
|
if (branch === null) return {
|
|
1023
1054
|
byAncestry: null,
|
|
1024
1055
|
byPR: null,
|
|
@@ -1039,12 +1070,7 @@ const resolveMergedState = async ({ repoRoot, branch, head, baseBranch, enableGh
|
|
|
1039
1070
|
if (result.exitCode === 0) byAncestry = true;
|
|
1040
1071
|
else if (result.exitCode === 1) byAncestry = false;
|
|
1041
1072
|
}
|
|
1042
|
-
const byPR =
|
|
1043
|
-
repoRoot,
|
|
1044
|
-
branch,
|
|
1045
|
-
baseBranch,
|
|
1046
|
-
enabled: enableGh
|
|
1047
|
-
});
|
|
1073
|
+
const byPR = branch === baseBranch ? null : mergedByPrByBranch.get(branch) ?? null;
|
|
1048
1074
|
let byLifecycle = null;
|
|
1049
1075
|
if (baseBranch !== null) {
|
|
1050
1076
|
const lifecycle = await upsertWorktreeMergeLifecycle({
|
|
@@ -1112,7 +1138,7 @@ const resolveUpstreamState = async (worktreePath) => {
|
|
|
1112
1138
|
remote: upstreamRef.stdout.trim()
|
|
1113
1139
|
};
|
|
1114
1140
|
};
|
|
1115
|
-
const enrichWorktree = async ({ repoRoot, worktree, baseBranch,
|
|
1141
|
+
const enrichWorktree = async ({ repoRoot, worktree, baseBranch, mergedByPrByBranch }) => {
|
|
1116
1142
|
const [dirty, locked, merged, upstream] = await Promise.all([
|
|
1117
1143
|
resolveDirty(worktree.path),
|
|
1118
1144
|
resolveLockState({
|
|
@@ -1124,7 +1150,7 @@ const enrichWorktree = async ({ repoRoot, worktree, baseBranch, enableGh }) => {
|
|
|
1124
1150
|
branch: worktree.branch,
|
|
1125
1151
|
head: worktree.head,
|
|
1126
1152
|
baseBranch,
|
|
1127
|
-
|
|
1153
|
+
mergedByPrByBranch
|
|
1128
1154
|
}),
|
|
1129
1155
|
resolveUpstreamState(worktree.path)
|
|
1130
1156
|
]);
|
|
@@ -1138,12 +1164,18 @@ const enrichWorktree = async ({ repoRoot, worktree, baseBranch, enableGh }) => {
|
|
|
1138
1164
|
upstream
|
|
1139
1165
|
};
|
|
1140
1166
|
};
|
|
1141
|
-
const collectWorktreeSnapshot = async (repoRoot) => {
|
|
1167
|
+
const collectWorktreeSnapshot = async (repoRoot, { noGh = false } = {}) => {
|
|
1142
1168
|
const [baseBranch, worktrees, enableGh] = await Promise.all([
|
|
1143
1169
|
resolveBaseBranch$1(repoRoot),
|
|
1144
1170
|
listGitWorktrees(repoRoot),
|
|
1145
1171
|
resolveEnableGh(repoRoot)
|
|
1146
1172
|
]);
|
|
1173
|
+
const mergedByPrByBranch = await resolveMergedByPrBatch({
|
|
1174
|
+
repoRoot,
|
|
1175
|
+
baseBranch,
|
|
1176
|
+
branches: worktrees.map((worktree) => worktree.branch),
|
|
1177
|
+
enabled: enableGh && noGh !== true
|
|
1178
|
+
});
|
|
1147
1179
|
return {
|
|
1148
1180
|
repoRoot,
|
|
1149
1181
|
baseBranch,
|
|
@@ -1152,7 +1184,7 @@ const collectWorktreeSnapshot = async (repoRoot) => {
|
|
|
1152
1184
|
repoRoot,
|
|
1153
1185
|
worktree,
|
|
1154
1186
|
baseBranch,
|
|
1155
|
-
|
|
1187
|
+
mergedByPrByBranch
|
|
1156
1188
|
});
|
|
1157
1189
|
}))
|
|
1158
1190
|
};
|
|
@@ -1168,7 +1200,11 @@ const RESERVED_FZF_ARGS = new Set([
|
|
|
1168
1200
|
"height",
|
|
1169
1201
|
"border"
|
|
1170
1202
|
]);
|
|
1203
|
+
const ANSI_ESCAPE_SEQUENCE_PATTERN = String.raw`\u001B\[[0-?]*[ -/]*[@-~]`;
|
|
1204
|
+
const ANSI_ESCAPE_SEQUENCE_REGEX = new RegExp(ANSI_ESCAPE_SEQUENCE_PATTERN, "g");
|
|
1171
1205
|
const sanitizeCandidate = (value) => value.replace(/[\r\n]+/g, " ").trim();
|
|
1206
|
+
const stripAnsi = (value) => value.replace(ANSI_ESCAPE_SEQUENCE_REGEX, "");
|
|
1207
|
+
const stripTrailingNewlines = (value) => value.replace(/[\r\n]+$/g, "");
|
|
1172
1208
|
const buildFzfInput = (candidates) => {
|
|
1173
1209
|
return candidates.map((candidate) => sanitizeCandidate(candidate)).filter((candidate) => candidate.length > 0).join("\n");
|
|
1174
1210
|
};
|
|
@@ -1224,14 +1260,14 @@ const selectPathWithFzf = async ({ candidates, prompt = "worktree> ", fzfExtraAr
|
|
|
1224
1260
|
});
|
|
1225
1261
|
const input = buildFzfInput(candidates);
|
|
1226
1262
|
if (input.length === 0) throw new Error("All candidates are empty after sanitization");
|
|
1227
|
-
const candidateSet = new Set(input.split("\n"));
|
|
1263
|
+
const candidateSet = new Set(input.split("\n").map((candidate) => stripAnsi(candidate)));
|
|
1228
1264
|
try {
|
|
1229
|
-
const selectedPath = (await runFzf({
|
|
1265
|
+
const selectedPath = stripAnsi(stripTrailingNewlines((await runFzf({
|
|
1230
1266
|
args,
|
|
1231
1267
|
input,
|
|
1232
1268
|
cwd,
|
|
1233
1269
|
env
|
|
1234
|
-
})).stdout
|
|
1270
|
+
})).stdout));
|
|
1235
1271
|
if (selectedPath.length === 0) return { status: "cancelled" };
|
|
1236
1272
|
if (!candidateSet.has(selectedPath)) throw new Error("fzf returned a value that is not in the candidate list");
|
|
1237
1273
|
return {
|
|
@@ -2436,6 +2472,7 @@ const renderGeneralHelpText = ({ version }) => {
|
|
|
2436
2472
|
" --json Output machine-readable JSON.",
|
|
2437
2473
|
" --verbose Enable verbose logs.",
|
|
2438
2474
|
" --no-hooks Disable hooks for this run (requires --allow-unsafe).",
|
|
2475
|
+
" --no-gh Disable GitHub CLI based PR merge checks for this run.",
|
|
2439
2476
|
" --allow-unsafe Explicitly allow unsafe behavior in non-TTY mode.",
|
|
2440
2477
|
" --hook-timeout-ms <ms> Override hook timeout.",
|
|
2441
2478
|
" --lock-timeout-ms <ms> Override repository lock timeout.",
|
|
@@ -2536,6 +2573,11 @@ const createCli = (options = {}) => {
|
|
|
2536
2573
|
description: "Enable hooks (disable with --no-hooks)",
|
|
2537
2574
|
default: true
|
|
2538
2575
|
},
|
|
2576
|
+
gh: {
|
|
2577
|
+
type: "boolean",
|
|
2578
|
+
description: "Enable GitHub CLI based PR merge checks (disable with --no-gh)",
|
|
2579
|
+
default: true
|
|
2580
|
+
},
|
|
2539
2581
|
allowUnsafe: {
|
|
2540
2582
|
type: "boolean",
|
|
2541
2583
|
description: "Allow unsafe operations"
|
|
@@ -2764,6 +2806,7 @@ const createCli = (options = {}) => {
|
|
|
2764
2806
|
command,
|
|
2765
2807
|
json: jsonEnabled,
|
|
2766
2808
|
hooksEnabled: parsedArgs.hooks !== false && configuredHooksEnabled !== false,
|
|
2809
|
+
ghEnabled: parsedArgs.gh !== false,
|
|
2767
2810
|
strictPostHooks: parsedArgs.strictPostHooks === true,
|
|
2768
2811
|
hookTimeoutMs: readNumberFromEnvOrDefault({
|
|
2769
2812
|
rawValue: toNumberOption({
|
|
@@ -2786,6 +2829,9 @@ const createCli = (options = {}) => {
|
|
|
2786
2829
|
rawValue: configuredStaleTTL,
|
|
2787
2830
|
defaultValue: DEFAULT_STALE_LOCK_TTL_SECONDS
|
|
2788
2831
|
});
|
|
2832
|
+
const collectWorktreeSnapshot$1 = async (_ignoredRepoRoot) => {
|
|
2833
|
+
return collectWorktreeSnapshot(repoRoot, { noGh: runtime.ghEnabled !== true });
|
|
2834
|
+
};
|
|
2789
2835
|
const runWriteOperation = async (task) => {
|
|
2790
2836
|
if (WRITE_COMMANDS.has(command) !== true) return task();
|
|
2791
2837
|
if (command !== "init") await validateInitializedForWrite(repoRoot);
|
|
@@ -2844,7 +2890,7 @@ const createCli = (options = {}) => {
|
|
|
2844
2890
|
min: 0,
|
|
2845
2891
|
max: 0
|
|
2846
2892
|
});
|
|
2847
|
-
const snapshot = await collectWorktreeSnapshot(repoRoot);
|
|
2893
|
+
const snapshot = await collectWorktreeSnapshot$1(repoRoot);
|
|
2848
2894
|
if (runtime.json) {
|
|
2849
2895
|
stdout(JSON.stringify(buildJsonSuccess({
|
|
2850
2896
|
command,
|
|
@@ -2892,7 +2938,7 @@ const createCli = (options = {}) => {
|
|
|
2892
2938
|
min: 0,
|
|
2893
2939
|
max: 1
|
|
2894
2940
|
});
|
|
2895
|
-
const snapshot = await collectWorktreeSnapshot(repoRoot);
|
|
2941
|
+
const snapshot = await collectWorktreeSnapshot$1(repoRoot);
|
|
2896
2942
|
const targetBranch = commandArgs[0];
|
|
2897
2943
|
const targetWorktree = typeof targetBranch === "string" && targetBranch.length > 0 ? resolveTargetWorktreeByBranch({
|
|
2898
2944
|
branch: targetBranch,
|
|
@@ -2926,7 +2972,7 @@ const createCli = (options = {}) => {
|
|
|
2926
2972
|
const branch = commandArgs[0];
|
|
2927
2973
|
const target = resolveTargetWorktreeByBranch({
|
|
2928
2974
|
branch,
|
|
2929
|
-
worktrees: (await collectWorktreeSnapshot(repoRoot)).worktrees
|
|
2975
|
+
worktrees: (await collectWorktreeSnapshot$1(repoRoot)).worktrees
|
|
2930
2976
|
});
|
|
2931
2977
|
if (runtime.json) {
|
|
2932
2978
|
stdout(JSON.stringify(buildJsonSuccess({
|
|
@@ -2954,7 +3000,7 @@ const createCli = (options = {}) => {
|
|
|
2954
3000
|
const result = await runWriteOperation(async () => {
|
|
2955
3001
|
if (containsBranch({
|
|
2956
3002
|
branch,
|
|
2957
|
-
worktrees: (await collectWorktreeSnapshot(repoRoot)).worktrees
|
|
3003
|
+
worktrees: (await collectWorktreeSnapshot$1(repoRoot)).worktrees
|
|
2958
3004
|
})) throw createCliError("BRANCH_ALREADY_ATTACHED", {
|
|
2959
3005
|
message: `Branch is already attached to a worktree: ${branch}`,
|
|
2960
3006
|
details: { branch }
|
|
@@ -3028,7 +3074,7 @@ const createCli = (options = {}) => {
|
|
|
3028
3074
|
});
|
|
3029
3075
|
const branch = commandArgs[0];
|
|
3030
3076
|
const result = await runWriteOperation(async () => {
|
|
3031
|
-
const snapshot = await collectWorktreeSnapshot(repoRoot);
|
|
3077
|
+
const snapshot = await collectWorktreeSnapshot$1(repoRoot);
|
|
3032
3078
|
const existing = snapshot.worktrees.find((worktree) => worktree.branch === branch);
|
|
3033
3079
|
if (existing !== void 0) {
|
|
3034
3080
|
if (snapshot.baseBranch !== null) {
|
|
@@ -3134,7 +3180,7 @@ const createCli = (options = {}) => {
|
|
|
3134
3180
|
});
|
|
3135
3181
|
const newBranch = commandArgs[0];
|
|
3136
3182
|
const result = await runWriteOperation(async () => {
|
|
3137
|
-
const snapshot = await collectWorktreeSnapshot(repoRoot);
|
|
3183
|
+
const snapshot = await collectWorktreeSnapshot$1(repoRoot);
|
|
3138
3184
|
const current = resolveCurrentWorktree({
|
|
3139
3185
|
snapshot,
|
|
3140
3186
|
currentWorktreeRoot: repoContext.currentWorktreeRoot
|
|
@@ -3247,7 +3293,7 @@ const createCli = (options = {}) => {
|
|
|
3247
3293
|
});
|
|
3248
3294
|
const branchArg = commandArgs[0];
|
|
3249
3295
|
const result = await runWriteOperation(async () => {
|
|
3250
|
-
const snapshot = await collectWorktreeSnapshot(repoRoot);
|
|
3296
|
+
const snapshot = await collectWorktreeSnapshot$1(repoRoot);
|
|
3251
3297
|
const target = typeof branchArg === "string" && branchArg.length > 0 ? resolveTargetWorktreeByBranch({
|
|
3252
3298
|
branch: branchArg,
|
|
3253
3299
|
worktrees: snapshot.worktrees
|
|
@@ -3336,7 +3382,7 @@ const createCli = (options = {}) => {
|
|
|
3336
3382
|
if (parsedArgs.apply === true && parsedArgs.dryRun === true) throw createCliError("INVALID_ARGUMENT", { message: "Cannot use --apply and --dry-run together" });
|
|
3337
3383
|
const dryRun = parsedArgs.apply !== true;
|
|
3338
3384
|
const execute = async () => {
|
|
3339
|
-
const candidates = (await collectWorktreeSnapshot(repoRoot)).worktrees.filter((worktree) => worktree.branch !== null).filter((worktree) => worktree.path !== repoRoot).filter((worktree) => worktree.dirty === false).filter((worktree) => worktree.locked.value === false).filter((worktree) => worktree.merged.overall === true).map((worktree) => worktree.branch);
|
|
3385
|
+
const candidates = (await collectWorktreeSnapshot$1(repoRoot)).worktrees.filter((worktree) => worktree.branch !== null).filter((worktree) => worktree.path !== repoRoot).filter((worktree) => worktree.dirty === false).filter((worktree) => worktree.locked.value === false).filter((worktree) => worktree.merged.overall === true).map((worktree) => worktree.branch);
|
|
3340
3386
|
if (dryRun) return {
|
|
3341
3387
|
deleted: [],
|
|
3342
3388
|
candidates,
|
|
@@ -3363,7 +3409,7 @@ const createCli = (options = {}) => {
|
|
|
3363
3409
|
"remove",
|
|
3364
3410
|
resolveTargetWorktreeByBranch({
|
|
3365
3411
|
branch,
|
|
3366
|
-
worktrees: (await collectWorktreeSnapshot(repoRoot)).worktrees
|
|
3412
|
+
worktrees: (await collectWorktreeSnapshot$1(repoRoot)).worktrees
|
|
3367
3413
|
}).path
|
|
3368
3414
|
]
|
|
3369
3415
|
});
|
|
@@ -3472,7 +3518,7 @@ const createCli = (options = {}) => {
|
|
|
3472
3518
|
`${remote}/${branch}`
|
|
3473
3519
|
]
|
|
3474
3520
|
});
|
|
3475
|
-
const snapshot = await collectWorktreeSnapshot(repoRoot);
|
|
3521
|
+
const snapshot = await collectWorktreeSnapshot$1(repoRoot);
|
|
3476
3522
|
const lifecycleBaseBranch = snapshot.baseBranch;
|
|
3477
3523
|
const existing = snapshot.worktrees.find((worktree) => worktree.branch === branch);
|
|
3478
3524
|
if (existing !== void 0) {
|
|
@@ -3550,7 +3596,7 @@ const createCli = (options = {}) => {
|
|
|
3550
3596
|
const fromPath = typeof parsedArgs.from === "string" ? parsedArgs.from : void 0;
|
|
3551
3597
|
if (fromPath !== void 0 && parsedArgs.current === true) throw createCliError("INVALID_ARGUMENT", { message: "extract cannot use --current and --from together" });
|
|
3552
3598
|
const result = await runWriteOperation(async () => {
|
|
3553
|
-
const snapshot = await collectWorktreeSnapshot(repoRoot);
|
|
3599
|
+
const snapshot = await collectWorktreeSnapshot$1(repoRoot);
|
|
3554
3600
|
const resolvedSourcePath = ensurePathInsideRepo({
|
|
3555
3601
|
repoRoot,
|
|
3556
3602
|
path: fromPath !== void 0 ? resolvePathFromCwd({
|
|
@@ -3702,7 +3748,7 @@ const createCli = (options = {}) => {
|
|
|
3702
3748
|
const sourceWorktree = resolveManagedNonPrimaryWorktreeByBranch({
|
|
3703
3749
|
repoRoot,
|
|
3704
3750
|
branch,
|
|
3705
|
-
worktrees: (await collectWorktreeSnapshot(repoRoot)).worktrees,
|
|
3751
|
+
worktrees: (await collectWorktreeSnapshot$1(repoRoot)).worktrees,
|
|
3706
3752
|
optionName: "--from",
|
|
3707
3753
|
worktreeName: fromWorktreeName,
|
|
3708
3754
|
role: "source"
|
|
@@ -3836,7 +3882,7 @@ const createCli = (options = {}) => {
|
|
|
3836
3882
|
const targetWorktree = resolveManagedNonPrimaryWorktreeByBranch({
|
|
3837
3883
|
repoRoot,
|
|
3838
3884
|
branch,
|
|
3839
|
-
worktrees: (await collectWorktreeSnapshot(repoRoot)).worktrees,
|
|
3885
|
+
worktrees: (await collectWorktreeSnapshot$1(repoRoot)).worktrees,
|
|
3840
3886
|
optionName: "--to",
|
|
3841
3887
|
worktreeName: targetWorktreeName,
|
|
3842
3888
|
role: "target"
|
|
@@ -3952,7 +3998,7 @@ const createCli = (options = {}) => {
|
|
|
3952
3998
|
message: "use requires clean primary worktree",
|
|
3953
3999
|
details: { repoRoot }
|
|
3954
4000
|
});
|
|
3955
|
-
const branchCheckedOutInOtherWorktree = (await collectWorktreeSnapshot(repoRoot)).worktrees.find((worktree) => {
|
|
4001
|
+
const branchCheckedOutInOtherWorktree = (await collectWorktreeSnapshot$1(repoRoot)).worktrees.find((worktree) => {
|
|
3956
4002
|
return worktree.branch === branch && worktree.path !== repoRoot;
|
|
3957
4003
|
});
|
|
3958
4004
|
if (branchCheckedOutInOtherWorktree !== void 0 && allowShared !== true) throw createCliError("BRANCH_IN_USE", {
|
|
@@ -4035,7 +4081,7 @@ const createCli = (options = {}) => {
|
|
|
4035
4081
|
const branch = commandArgs[0];
|
|
4036
4082
|
const target = resolveTargetWorktreeByBranch({
|
|
4037
4083
|
branch,
|
|
4038
|
-
worktrees: (await collectWorktreeSnapshot(repoRoot)).worktrees
|
|
4084
|
+
worktrees: (await collectWorktreeSnapshot$1(repoRoot)).worktrees
|
|
4039
4085
|
});
|
|
4040
4086
|
const executable = afterDoubleDash[0];
|
|
4041
4087
|
if (typeof executable !== "string" || executable.length === 0) throw createCliError("INVALID_ARGUMENT", { message: "exec requires executable after --" });
|
|
@@ -4086,7 +4132,7 @@ const createCli = (options = {}) => {
|
|
|
4086
4132
|
});
|
|
4087
4133
|
const hookName = normalizeHookName(commandArgs[0]);
|
|
4088
4134
|
const current = resolveCurrentWorktree({
|
|
4089
|
-
snapshot: await collectWorktreeSnapshot(repoRoot),
|
|
4135
|
+
snapshot: await collectWorktreeSnapshot$1(repoRoot),
|
|
4090
4136
|
currentWorktreeRoot: repoContext.currentWorktreeRoot
|
|
4091
4137
|
});
|
|
4092
4138
|
await invokeHook({
|
|
@@ -4237,7 +4283,7 @@ const createCli = (options = {}) => {
|
|
|
4237
4283
|
const result = await runWriteOperation(async () => {
|
|
4238
4284
|
resolveTargetWorktreeByBranch({
|
|
4239
4285
|
branch,
|
|
4240
|
-
worktrees: (await collectWorktreeSnapshot(repoRoot)).worktrees
|
|
4286
|
+
worktrees: (await collectWorktreeSnapshot$1(repoRoot)).worktrees
|
|
4241
4287
|
});
|
|
4242
4288
|
const existing = await readWorktreeLock({
|
|
4243
4289
|
repoRoot,
|
|
@@ -4351,7 +4397,7 @@ const createCli = (options = {}) => {
|
|
|
4351
4397
|
min: 0,
|
|
4352
4398
|
max: 0
|
|
4353
4399
|
});
|
|
4354
|
-
const snapshot = await collectWorktreeSnapshot(repoRoot);
|
|
4400
|
+
const snapshot = await collectWorktreeSnapshot$1(repoRoot);
|
|
4355
4401
|
const theme = createCatppuccinTheme({ enabled: shouldUseAnsiColors({ interactive: runtime.isInteractive || process.stderr.isTTY === true }) });
|
|
4356
4402
|
const branchColumnWidth = snapshot.worktrees.reduce((maxWidth, worktree) => {
|
|
4357
4403
|
const label = buildCdBranchLabel({
|