@staff0rd/assist 0.1209.7 → 0.1209.9
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/.build-files +35 -36
- package/dist/built-version +1 -1
- package/dist/{chunk-OJB7NJRI.js → chunk-4VJXZMG4.js} +1 -1
- package/dist/chunk-5PHEZZZO.js +186 -0
- package/dist/{chunk-MUHZ22VQ.js → chunk-7VTFCHIT.js} +1 -1
- package/dist/{chunk-2DMKXYGN.js → chunk-CGTWGF4R.js} +1 -1
- package/dist/{chunk-B5MQGARY.js → chunk-DOIDAWFX.js} +5 -5
- package/dist/{chunk-76IN2RPB.js → chunk-GCVGBOX5.js} +7 -25
- package/dist/{chunk-HHHJ6PEO.js → chunk-KU2IELJH.js} +179 -25
- package/dist/{chunk-3T5UPJSQ.js → chunk-KU2IRR7U.js} +1 -1
- package/dist/{chunk-2JSJQPC3.js → chunk-LCEKIRDI.js} +2 -2
- package/dist/{chunk-GXXGMQTW.js → chunk-NEC6OVBH.js} +3 -3
- package/dist/{chunk-3MZSXH2X.js → chunk-OSNDBX3R.js} +1 -1
- package/dist/{chunk-LO6MUDSE.js → chunk-PTOLRRVQ.js} +1 -1
- package/dist/{chunk-N4HYQKDE.js → chunk-SFB4YFAJ.js} +1 -1
- package/dist/{chunk-QAJUCN3A.js → chunk-UOYZCIWZ.js} +20 -1
- package/dist/{chunk-BCXWSOB3.js → chunk-WGQXKODT.js} +1 -1
- package/dist/{chunk-FYYZG4GY.js → chunk-YR3NOIK4.js} +20 -4
- package/dist/{chunk-ZWLBKWOG.js → chunk-ZZPDMUIS.js} +1 -1
- package/dist/commands/sessions/web/bundle.js +440 -440
- package/dist/{doctorNodes-75P5VYFP.js → doctorNodes-ILYR6LIB.js} +3 -3
- package/dist/{fixConflict-X4D2GILF.js → fixConflict-SHPVWNCI.js} +6 -7
- package/dist/index.js +23 -23
- package/dist/{launchMode-THX4GZUV.js → launchMode-E6C56QJ5.js} +6 -7
- package/dist/{next-TXZCR5SM.js → next-RU4CE65F.js} +5 -6
- package/dist/{pullIfConfigured-OZ5OPCR2.js → pullIfConfigured-2IBMXTYT.js} +2 -3
- package/dist/{refine-WFX7XY5B.js → refine-PM727EVL.js} +7 -8
- package/dist/{restartNode-7NLISQB4.js → restartNode-UQER2YEA.js} +5 -5
- package/dist/{review-PZWEAYOB.js → review-6QWY2FON.js} +87 -128
- package/dist/{reviewPrComments-VT3QPSKM.js → reviewPrComments-BOOP6SKN.js} +6 -7
- package/dist/{run-4SMOXOIS.js → run-T4LRCNGP.js} +2 -2
- package/dist/{run-TCKC6JKH.js → run-XKK6RIXT.js} +4 -5
- package/dist/{runDaemon-VNI7RMPE.js → runDaemon-HJT23FAG.js} +11 -13
- package/dist/{runRefine-J647JFTB.js → runRefine-U5VSEHLT.js} +7 -8
- package/dist/{signExtension-ZPQBWJPM.js → signExtension-R6ALW56Z.js} +1 -1
- package/dist/{updateNode-KEPO26SS.js → updateNode-WDASOL4N.js} +5 -5
- package/dist/{web-W33FHI2A.js → web-CADUUMQL.js} +10 -9
- package/dist/{web-5XUS5CKZ.js → web-VPM5E2E6.js} +10 -9
- package/package.json +1 -1
- package/dist/chunk-B3JSQA5D.js +0 -25
- package/dist/chunk-ZABRGL2F.js +0 -45
- package/dist/{chunk-KYJAT623.js → chunk-VIKP2CPB.js} +3 -3
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "./chunk-JM57BCD6.js";
|
|
11
11
|
import {
|
|
12
12
|
firstBrokenHop
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-WGQXKODT.js";
|
|
14
14
|
import {
|
|
15
15
|
describePeerError,
|
|
16
16
|
fetchPeerJson
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
resolveLinkTarget,
|
|
40
40
|
usageWindowKey,
|
|
41
41
|
watcherLogPath
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-ZZPDMUIS.js";
|
|
43
43
|
import {
|
|
44
44
|
TRACE_HEADER,
|
|
45
45
|
newTraceId
|
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
import {
|
|
48
48
|
ASSIST_VERSION,
|
|
49
49
|
PROTOCOL_VERSION
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-PTOLRRVQ.js";
|
|
51
51
|
import {
|
|
52
52
|
findLinkSpec
|
|
53
53
|
} from "./chunk-HPBO553P.js";
|
|
@@ -89,8 +89,10 @@ import {
|
|
|
89
89
|
configEntryLayers,
|
|
90
90
|
ghFailure,
|
|
91
91
|
isRedactedSecret,
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
loadHighLevelProgress,
|
|
93
|
+
redactConfigSecrets,
|
|
94
|
+
saveHighLevelProgress
|
|
95
|
+
} from "./chunk-5PHEZZZO.js";
|
|
94
96
|
import {
|
|
95
97
|
stripAnsi
|
|
96
98
|
} from "./chunk-YJ72SXVD.js";
|
|
@@ -134,6 +136,10 @@ import {
|
|
|
134
136
|
import {
|
|
135
137
|
listInboxMessages
|
|
136
138
|
} from "./chunk-WCLES4VX.js";
|
|
139
|
+
import {
|
|
140
|
+
mainWorktree,
|
|
141
|
+
worktreeStartPoint
|
|
142
|
+
} from "./chunk-YR3NOIK4.js";
|
|
137
143
|
import {
|
|
138
144
|
decodeUrlPart,
|
|
139
145
|
parseAzureDevopsRemote
|
|
@@ -251,6 +257,12 @@ import {
|
|
|
251
257
|
phaseUsageTotals,
|
|
252
258
|
planPhaseCounts
|
|
253
259
|
} from "./chunk-ZWIWBQO2.js";
|
|
260
|
+
import {
|
|
261
|
+
gitOrNull
|
|
262
|
+
} from "./chunk-UOYZCIWZ.js";
|
|
263
|
+
import {
|
|
264
|
+
worktreeConfigFor
|
|
265
|
+
} from "./chunk-QWYSWWN5.js";
|
|
254
266
|
import {
|
|
255
267
|
requestAssistSession
|
|
256
268
|
} from "./chunk-F4XCHVD7.js";
|
|
@@ -5193,6 +5205,16 @@ import path6 from "path";
|
|
|
5193
5205
|
// src/commands/sessions/web/slashCommands/readSlashCommands.ts
|
|
5194
5206
|
import fs from "fs";
|
|
5195
5207
|
import path5 from "path";
|
|
5208
|
+
|
|
5209
|
+
// src/commands/sessions/web/slashCommands/mergeSlashCommands.ts
|
|
5210
|
+
function mergeSlashCommands(commands, skills, scope) {
|
|
5211
|
+
const byName = /* @__PURE__ */ new Map();
|
|
5212
|
+
for (const command of [...commands, ...skills])
|
|
5213
|
+
byName.set(command.name, { ...command, scope });
|
|
5214
|
+
return [...byName.values()].sort((a, b) => a.name.localeCompare(b.name));
|
|
5215
|
+
}
|
|
5216
|
+
|
|
5217
|
+
// src/commands/sessions/web/slashCommands/readSlashCommands.ts
|
|
5196
5218
|
function readEntries(dir) {
|
|
5197
5219
|
try {
|
|
5198
5220
|
return fs.readdirSync(dir, { withFileTypes: true });
|
|
@@ -5220,32 +5242,86 @@ function readCommands(dir) {
|
|
|
5220
5242
|
}));
|
|
5221
5243
|
}
|
|
5222
5244
|
function readSlashCommands(home, scope) {
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
byName.set(command.name, { ...command, scope });
|
|
5229
|
-
return [...byName.values()].sort((a, b) => a.name.localeCompare(b.name));
|
|
5245
|
+
return mergeSlashCommands(
|
|
5246
|
+
readCommands(path5.join(home, "commands")),
|
|
5247
|
+
readSkills(path5.join(home, "skills")),
|
|
5248
|
+
scope
|
|
5249
|
+
);
|
|
5230
5250
|
}
|
|
5231
5251
|
|
|
5232
5252
|
// src/commands/sessions/web/slashCommands/listSlashCommands.ts
|
|
5233
|
-
function listSlashCommands(claudeHome, cwd) {
|
|
5253
|
+
function listSlashCommands(claudeHome, cwd, projectCommands) {
|
|
5234
5254
|
const user = readSlashCommands(claudeHome, "user");
|
|
5235
5255
|
const userNames = new Set(user.map((command) => command.name));
|
|
5236
|
-
const project = readSlashCommands(path6.join(cwd, ".claude"), "project");
|
|
5256
|
+
const project = projectCommands ?? readSlashCommands(path6.join(cwd, ".claude"), "project");
|
|
5237
5257
|
return [
|
|
5238
5258
|
...user,
|
|
5239
5259
|
...project.filter((command) => !userNames.has(command.name))
|
|
5240
5260
|
];
|
|
5241
5261
|
}
|
|
5242
5262
|
|
|
5263
|
+
// src/commands/sessions/web/slashCommands/readSlashCommandsAtRef.ts
|
|
5264
|
+
var COMMAND = /^\.claude\/commands\/([^/]+)\.md$/;
|
|
5265
|
+
var SKILL = /^\.claude\/skills\/([^/]+)\/SKILL\.md$/;
|
|
5266
|
+
async function describeAt(repo, ref, file) {
|
|
5267
|
+
const content = await gitOrNull(repo, ["show", `${ref}:${file}`]);
|
|
5268
|
+
return content ? splitFrontmatter(content).description : void 0;
|
|
5269
|
+
}
|
|
5270
|
+
async function entriesMatching(repo, ref, files, pattern) {
|
|
5271
|
+
const matched = files.flatMap((file) => {
|
|
5272
|
+
const name = pattern.exec(file)?.[1];
|
|
5273
|
+
return name ? [{ name, file }] : [];
|
|
5274
|
+
});
|
|
5275
|
+
return Promise.all(
|
|
5276
|
+
matched.map(async ({ name, file }) => ({
|
|
5277
|
+
name,
|
|
5278
|
+
description: await describeAt(repo, ref, file)
|
|
5279
|
+
}))
|
|
5280
|
+
);
|
|
5281
|
+
}
|
|
5282
|
+
async function readSlashCommandsAtRef(repo, ref, scope) {
|
|
5283
|
+
if (!await gitOrNull(repo, ["rev-parse", "--verify", "--quiet", ref]))
|
|
5284
|
+
return null;
|
|
5285
|
+
const listing = await gitOrNull(repo, [
|
|
5286
|
+
"ls-tree",
|
|
5287
|
+
"-r",
|
|
5288
|
+
"--full-tree",
|
|
5289
|
+
"--name-only",
|
|
5290
|
+
ref,
|
|
5291
|
+
"--",
|
|
5292
|
+
".claude/commands",
|
|
5293
|
+
".claude/skills"
|
|
5294
|
+
]);
|
|
5295
|
+
const files = listing ? listing.split("\n") : [];
|
|
5296
|
+
return mergeSlashCommands(
|
|
5297
|
+
await entriesMatching(repo, ref, files, COMMAND),
|
|
5298
|
+
await entriesMatching(repo, ref, files, SKILL),
|
|
5299
|
+
scope
|
|
5300
|
+
);
|
|
5301
|
+
}
|
|
5302
|
+
|
|
5303
|
+
// src/commands/sessions/web/slashCommands/startPointProjectCommands.ts
|
|
5304
|
+
async function startPointProjectCommands(cwd) {
|
|
5305
|
+
const repoRoot2 = findRepoRoot(cwd) ?? cwd;
|
|
5306
|
+
const cfg = worktreeConfigFor(repoRoot2);
|
|
5307
|
+
if (!cfg.enabled) return null;
|
|
5308
|
+
const clone = mainWorktree(repoRoot2) ?? repoRoot2;
|
|
5309
|
+
const { ref } = await worktreeStartPoint(clone, cfg.trunk);
|
|
5310
|
+
if (ref === "HEAD") return null;
|
|
5311
|
+
return readSlashCommandsAtRef(clone, ref, "project");
|
|
5312
|
+
}
|
|
5313
|
+
|
|
5243
5314
|
// src/commands/sessions/web/slashCommands/slashCommands.ts
|
|
5244
|
-
function
|
|
5315
|
+
function wantsStartPoint(req) {
|
|
5316
|
+
const url = new URL(req.url ?? "/", "http://localhost");
|
|
5317
|
+
return url.searchParams.get("startPoint") === "1";
|
|
5318
|
+
}
|
|
5319
|
+
async function slashCommands(req, res) {
|
|
5245
5320
|
const cwd = getCwdParam(req, res);
|
|
5246
5321
|
if (!cwd) return;
|
|
5322
|
+
const project = wantsStartPoint(req) ? await startPointProjectCommands(cwd) : null;
|
|
5247
5323
|
respondJson(res, 200, {
|
|
5248
|
-
commands: listSlashCommands(harnesses.claude.homeDir, cwd)
|
|
5324
|
+
commands: listSlashCommands(harnesses.claude.homeDir, cwd, project)
|
|
5249
5325
|
});
|
|
5250
5326
|
}
|
|
5251
5327
|
|
|
@@ -5730,23 +5806,99 @@ async function prStatus(req, res) {
|
|
|
5730
5806
|
respondJson(res, 200, { pr });
|
|
5731
5807
|
}
|
|
5732
5808
|
|
|
5733
|
-
// src/commands/
|
|
5809
|
+
// src/commands/review/highLevel/progressStore/highLevelProgressApiPath.ts
|
|
5810
|
+
var highLevelProgressApiPath = "/api/high-level-progress";
|
|
5811
|
+
|
|
5812
|
+
// src/commands/sessions/web/highLevelProgress/highLevelProgressHeadSchema.ts
|
|
5734
5813
|
import { z as z6 } from "zod";
|
|
5735
|
-
var
|
|
5736
|
-
|
|
5737
|
-
prNumber: z6.number().int().positive()
|
|
5814
|
+
var highLevelProgressHeadSchema = z6.object({
|
|
5815
|
+
repo: z6.string().regex(/^[\w.-]+\/[\w.-]+$/),
|
|
5816
|
+
prNumber: z6.coerce.number().int().positive(),
|
|
5817
|
+
headSha: z6.string().regex(/^[0-9a-f]{7,40}$/i)
|
|
5738
5818
|
});
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
|
|
5819
|
+
|
|
5820
|
+
// src/commands/sessions/web/highLevelProgress/getHighLevelProgress.ts
|
|
5821
|
+
function getHighLevelProgress(req, res) {
|
|
5822
|
+
const params = new URL(req.url ?? "/", "http://localhost").searchParams;
|
|
5823
|
+
const head = highLevelProgressHeadSchema.safeParse(
|
|
5824
|
+
Object.fromEntries(params)
|
|
5825
|
+
);
|
|
5826
|
+
if (!head.success) {
|
|
5827
|
+
respondJson(res, 400, { error: "Invalid repo, prNumber or headSha" });
|
|
5828
|
+
return;
|
|
5829
|
+
}
|
|
5830
|
+
const { repo, prNumber, headSha } = head.data;
|
|
5831
|
+
respondJson(res, 200, {
|
|
5832
|
+
progress: loadHighLevelProgress(repo, prNumber, headSha) ?? null
|
|
5833
|
+
});
|
|
5834
|
+
}
|
|
5835
|
+
|
|
5836
|
+
// src/commands/sessions/web/highLevelProgress/postHighLevelProgress.ts
|
|
5837
|
+
import { z as z7 } from "zod";
|
|
5838
|
+
|
|
5839
|
+
// src/commands/sessions/web/parseJsonBody.ts
|
|
5840
|
+
async function parseJsonBody(req, schema) {
|
|
5841
|
+
const parsed = schema.safeParse(
|
|
5742
5842
|
await readJsonBody(req).catch(() => void 0)
|
|
5743
5843
|
);
|
|
5744
|
-
|
|
5844
|
+
return parsed.success ? parsed.data : void 0;
|
|
5845
|
+
}
|
|
5846
|
+
|
|
5847
|
+
// src/commands/sessions/web/highLevelProgress/postHighLevelProgress.ts
|
|
5848
|
+
var side = z7.enum(["LEFT", "RIGHT"]).optional();
|
|
5849
|
+
var bodySchema = highLevelProgressHeadSchema.extend({
|
|
5850
|
+
requestId: z7.string().min(1).optional(),
|
|
5851
|
+
items: z7.array(
|
|
5852
|
+
z7.object({
|
|
5853
|
+
id: z7.string(),
|
|
5854
|
+
ticked: z7.boolean().optional(),
|
|
5855
|
+
comment: z7.string().optional(),
|
|
5856
|
+
slice: z7.number().int().optional()
|
|
5857
|
+
})
|
|
5858
|
+
),
|
|
5859
|
+
reviewComments: z7.array(
|
|
5860
|
+
z7.object({
|
|
5861
|
+
path: z7.string(),
|
|
5862
|
+
startLine: z7.number().int(),
|
|
5863
|
+
endLine: z7.number().int(),
|
|
5864
|
+
quote: z7.string(),
|
|
5865
|
+
note: z7.string(),
|
|
5866
|
+
startSide: side,
|
|
5867
|
+
side,
|
|
5868
|
+
headSha: z7.string().optional()
|
|
5869
|
+
})
|
|
5870
|
+
)
|
|
5871
|
+
});
|
|
5872
|
+
async function postHighLevelProgress(req, res) {
|
|
5873
|
+
const body = await parseJsonBody(req, bodySchema);
|
|
5874
|
+
if (!body) {
|
|
5875
|
+
respondJson(res, 400, { error: "Invalid high-level progress" });
|
|
5876
|
+
return;
|
|
5877
|
+
}
|
|
5878
|
+
const { repo, prNumber, headSha, requestId, ...progress } = body;
|
|
5879
|
+
if (saveHighLevelProgress(
|
|
5880
|
+
{ repo, prNumber, headSha, ...requestId ? { requestId } : {} },
|
|
5881
|
+
progress
|
|
5882
|
+
))
|
|
5883
|
+
respondJson(res, 200, { ok: true });
|
|
5884
|
+
else respondJson(res, 409, { error: "This review already has a verdict" });
|
|
5885
|
+
}
|
|
5886
|
+
|
|
5887
|
+
// src/commands/sessions/web/reopenHighLevelReview.ts
|
|
5888
|
+
import { z as z8 } from "zod";
|
|
5889
|
+
var bodySchema2 = z8.object({
|
|
5890
|
+
sessionId: z8.string().min(1),
|
|
5891
|
+
prNumber: z8.number().int().positive()
|
|
5892
|
+
});
|
|
5893
|
+
var REOPEN_TIMEOUT_MS = 18e4;
|
|
5894
|
+
async function reopenHighLevelReview(req, res) {
|
|
5895
|
+
const body = await parseJsonBody(req, bodySchema2);
|
|
5896
|
+
if (!body) {
|
|
5745
5897
|
respondJson(res, 400, { error: "Invalid reopen request" });
|
|
5746
5898
|
return;
|
|
5747
5899
|
}
|
|
5748
5900
|
const reply = await requestDaemonReply(
|
|
5749
|
-
{ type: "reopen-high-level-review", ...
|
|
5901
|
+
{ type: "reopen-high-level-review", ...body },
|
|
5750
5902
|
"reopen-high-level-review-result",
|
|
5751
5903
|
REOPEN_TIMEOUT_MS
|
|
5752
5904
|
);
|
|
@@ -7504,6 +7656,8 @@ var routes2 = {
|
|
|
7504
7656
|
"OPTIONS /api/sessions/review-from-github": sessionFromGithubPreflight,
|
|
7505
7657
|
"POST /api/sessions/docs-feedback": docsFeedback,
|
|
7506
7658
|
"POST /api/sessions/reopen-high-level-review": reopenHighLevelReview,
|
|
7659
|
+
[`GET ${highLevelProgressApiPath}`]: getHighLevelProgress,
|
|
7660
|
+
[`POST ${highLevelProgressApiPath}`]: postHighLevelProgress,
|
|
7507
7661
|
"OPTIONS /api/sessions/docs-feedback": sessionFromGithubPreflight,
|
|
7508
7662
|
"POST /api/link-status": linkStatus,
|
|
7509
7663
|
"OPTIONS /api/link-status": sessionFromGithubPreflight,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
next
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LCEKIRDI.js";
|
|
4
4
|
import {
|
|
5
5
|
pullIfConfigured
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-7VTFCHIT.js";
|
|
7
7
|
import {
|
|
8
8
|
run
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-VIKP2CPB.js";
|
|
10
10
|
import {
|
|
11
11
|
launchBlocker
|
|
12
12
|
} from "./chunk-LQMU4BUO.js";
|
|
@@ -67,10 +67,29 @@ function gitSyncOrNull(cwd, args) {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
// src/commands/sessions/daemon/worktree/cloneHead.ts
|
|
71
|
+
function cloneHead(clone) {
|
|
72
|
+
return gitOrNull(clone, ["symbolic-ref", "--short", "HEAD"]);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// src/commands/sessions/daemon/worktree/remoteDefaultBranch.ts
|
|
76
|
+
async function remoteDefaultBranch(clone) {
|
|
77
|
+
const head = await gitOrNull(clone, [
|
|
78
|
+
"symbolic-ref",
|
|
79
|
+
"--short",
|
|
80
|
+
"refs/remotes/origin/HEAD"
|
|
81
|
+
]);
|
|
82
|
+
if (!head) return await cloneHead(clone) ?? "main";
|
|
83
|
+
const slash = head.indexOf("/");
|
|
84
|
+
return slash === -1 ? head : head.slice(slash + 1);
|
|
85
|
+
}
|
|
86
|
+
|
|
70
87
|
export {
|
|
71
88
|
git,
|
|
72
89
|
gitOrNull,
|
|
73
90
|
gitResult,
|
|
74
91
|
gitSyncResult,
|
|
75
|
-
gitSyncOrNull
|
|
92
|
+
gitSyncOrNull,
|
|
93
|
+
cloneHead,
|
|
94
|
+
remoteDefaultBranch
|
|
76
95
|
};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
cloneHead,
|
|
3
|
+
gitOrNull,
|
|
4
|
+
gitSyncOrNull,
|
|
5
|
+
remoteDefaultBranch
|
|
6
|
+
} from "./chunk-UOYZCIWZ.js";
|
|
4
7
|
|
|
5
8
|
// src/commands/sessions/daemon/worktree/listWorktreePaths.ts
|
|
6
9
|
function listWorktreePaths(cwd) {
|
|
@@ -27,6 +30,18 @@ function gitCommonDir(cwd) {
|
|
|
27
30
|
]);
|
|
28
31
|
}
|
|
29
32
|
|
|
33
|
+
// src/commands/sessions/daemon/worktree/worktreeStartPoint.ts
|
|
34
|
+
async function worktreeStartPoint(clone, trunk) {
|
|
35
|
+
const branch = trunk ? await cloneTrunkBranch(clone) : await remoteDefaultBranch(clone);
|
|
36
|
+
const ref = `origin/${branch}`;
|
|
37
|
+
if (await gitOrNull(clone, ["rev-parse", "--verify", "--quiet", ref]))
|
|
38
|
+
return { ref, track: trunk };
|
|
39
|
+
return { ref: "HEAD", track: false };
|
|
40
|
+
}
|
|
41
|
+
async function cloneTrunkBranch(clone) {
|
|
42
|
+
return await cloneHead(clone) ?? remoteDefaultBranch(clone);
|
|
43
|
+
}
|
|
44
|
+
|
|
30
45
|
// src/commands/sessions/daemon/worktree/canonicalTreePath.ts
|
|
31
46
|
import { realpathSync } from "fs";
|
|
32
47
|
import { resolve } from "path";
|
|
@@ -39,9 +54,10 @@ function canonicalTreePath(path) {
|
|
|
39
54
|
}
|
|
40
55
|
|
|
41
56
|
export {
|
|
42
|
-
canonicalTreePath,
|
|
43
57
|
listWorktreePaths,
|
|
44
58
|
mainWorktree,
|
|
45
59
|
listLocalBranches,
|
|
46
|
-
gitCommonDir
|
|
60
|
+
gitCommonDir,
|
|
61
|
+
worktreeStartPoint,
|
|
62
|
+
canonicalTreePath
|
|
47
63
|
};
|