@staff0rd/assist 0.573.2 → 0.574.0
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 +2 -1
- package/claude/commands/github.md +37 -6
- package/dist/commands/sessions/web/bundle.js +2 -2
- package/dist/index.js +537 -378
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.574.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -147,8 +147,45 @@ import { existsSync as existsSync3 } from "fs";
|
|
|
147
147
|
import { homedir } from "os";
|
|
148
148
|
import { dirname as dirname2, join as join2 } from "path";
|
|
149
149
|
|
|
150
|
-
// src/commands/backlog/
|
|
150
|
+
// src/commands/backlog/remoteUrl.ts
|
|
151
151
|
import { execFileSync } from "child_process";
|
|
152
|
+
function runGit(cwd, args) {
|
|
153
|
+
const windows = /^[A-Za-z]:[\\/]/.test(cwd);
|
|
154
|
+
const file = windows ? "git.exe" : "git";
|
|
155
|
+
const argv = windows ? ["-C", cwd, ...args] : args;
|
|
156
|
+
try {
|
|
157
|
+
const out = execFileSync(file, argv, {
|
|
158
|
+
encoding: "utf8",
|
|
159
|
+
windowsHide: true,
|
|
160
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
161
|
+
...windows ? {} : { cwd }
|
|
162
|
+
}).trim();
|
|
163
|
+
return { ok: true, out };
|
|
164
|
+
} catch {
|
|
165
|
+
return { ok: false, out: "" };
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
function tryGit(cwd, args) {
|
|
169
|
+
return runGit(cwd, args).out || null;
|
|
170
|
+
}
|
|
171
|
+
function remoteUrl(cwd) {
|
|
172
|
+
const origin = runGit(cwd, ["remote", "get-url", "origin"]);
|
|
173
|
+
if (origin.out) return { url: origin.out, ok: true };
|
|
174
|
+
const remotes = runGit(cwd, ["remote"]);
|
|
175
|
+
if (!remotes.ok) return { url: null, ok: false };
|
|
176
|
+
let failed2 = false;
|
|
177
|
+
for (const remote of remotes.out.split("\n").map((r) => r.trim()).filter(Boolean)) {
|
|
178
|
+
const url = runGit(cwd, ["remote", "get-url", remote]);
|
|
179
|
+
if (url.out) return { url: url.out, ok: true };
|
|
180
|
+
if (!url.ok) failed2 = true;
|
|
181
|
+
}
|
|
182
|
+
return { url: null, ok: !failed2 };
|
|
183
|
+
}
|
|
184
|
+
function getRemoteOriginUrl(cwd) {
|
|
185
|
+
return remoteUrl(cwd).url;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// src/commands/backlog/getCurrentOrigin.ts
|
|
152
189
|
function stripLeadingSlashes(path80) {
|
|
153
190
|
return path80.replace(/^\/+/, "");
|
|
154
191
|
}
|
|
@@ -168,39 +205,14 @@ function normalizeOrigin(raw) {
|
|
|
168
205
|
}
|
|
169
206
|
return trimmed.toLowerCase();
|
|
170
207
|
}
|
|
171
|
-
function
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
const out = execFileSync(file, argv, {
|
|
177
|
-
encoding: "utf8",
|
|
178
|
-
windowsHide: true,
|
|
179
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
180
|
-
...windows ? {} : { cwd }
|
|
181
|
-
}).trim();
|
|
182
|
-
return out || null;
|
|
183
|
-
} catch {
|
|
184
|
-
return null;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
function firstRemoteUrl(cwd) {
|
|
188
|
-
const remotes = tryGit(cwd, ["remote"]);
|
|
189
|
-
if (!remotes) return null;
|
|
190
|
-
for (const remote of remotes.split("\n").map((r) => r.trim()).filter(Boolean)) {
|
|
191
|
-
const url = tryGit(cwd, ["remote", "get-url", remote]);
|
|
192
|
-
if (url) return url;
|
|
193
|
-
}
|
|
194
|
-
return null;
|
|
195
|
-
}
|
|
196
|
-
function getRemoteOriginUrl(cwd) {
|
|
197
|
-
return tryGit(cwd, ["remote", "get-url", "origin"]) ?? firstRemoteUrl(cwd);
|
|
208
|
+
function resolveCurrentOrigin(cwd) {
|
|
209
|
+
const remote = remoteUrl(cwd);
|
|
210
|
+
if (remote.url) return { origin: normalizeOrigin(remote.url), stable: true };
|
|
211
|
+
const root = tryGit(cwd, ["rev-parse", "--show-toplevel"]);
|
|
212
|
+
return { origin: `local:${root ?? cwd}`, stable: remote.ok };
|
|
198
213
|
}
|
|
199
214
|
function getCurrentOrigin(cwd) {
|
|
200
|
-
|
|
201
|
-
if (url) return normalizeOrigin(url);
|
|
202
|
-
const root = tryGit(cwd, ["rev-parse", "--show-toplevel"]);
|
|
203
|
-
return `local:${root ?? cwd}`;
|
|
215
|
+
return resolveCurrentOrigin(cwd).origin;
|
|
204
216
|
}
|
|
205
217
|
|
|
206
218
|
// src/shared/linkedWorktree.ts
|
|
@@ -9900,13 +9912,38 @@ function shouldProxyToWindows(cwd) {
|
|
|
9900
9912
|
|
|
9901
9913
|
// src/commands/sessions/daemon/originForCwd.ts
|
|
9902
9914
|
var cache = /* @__PURE__ */ new Map();
|
|
9903
|
-
function
|
|
9915
|
+
function originResolutionForCwd(cwd) {
|
|
9904
9916
|
if (!cwd) return void 0;
|
|
9905
9917
|
const cached = cache.get(cwd);
|
|
9906
|
-
if (cached !== void 0) return cached;
|
|
9907
|
-
const
|
|
9908
|
-
cache.set(cwd, origin);
|
|
9909
|
-
return
|
|
9918
|
+
if (cached !== void 0) return { origin: cached, stable: true };
|
|
9919
|
+
const resolved = resolveCurrentOrigin(cwd);
|
|
9920
|
+
if (resolved.stable) cache.set(cwd, resolved.origin);
|
|
9921
|
+
return resolved;
|
|
9922
|
+
}
|
|
9923
|
+
function originForCwd(cwd) {
|
|
9924
|
+
return originResolutionForCwd(cwd)?.origin;
|
|
9925
|
+
}
|
|
9926
|
+
|
|
9927
|
+
// src/commands/sessions/daemon/repoDirExists.ts
|
|
9928
|
+
import { existsSync as existsSync28 } from "fs";
|
|
9929
|
+
|
|
9930
|
+
// src/commands/sessions/web/windowsCwdToWslPath.ts
|
|
9931
|
+
function windowsCwdToWslPath(cwd) {
|
|
9932
|
+
const match = /^([A-Za-z]):[\\/](.*)$/.exec(cwd);
|
|
9933
|
+
if (!match) return cwd;
|
|
9934
|
+
const drive = match[1].toLowerCase();
|
|
9935
|
+
const rest = match[2].replace(/\\/g, "/");
|
|
9936
|
+
return `/mnt/${drive}/${rest}`;
|
|
9937
|
+
}
|
|
9938
|
+
|
|
9939
|
+
// src/commands/sessions/web/toGitCwd.ts
|
|
9940
|
+
function toGitCwd(cwd) {
|
|
9941
|
+
return detectPlatform() === "wsl" ? windowsCwdToWslPath(cwd) : cwd;
|
|
9942
|
+
}
|
|
9943
|
+
|
|
9944
|
+
// src/commands/sessions/daemon/repoDirExists.ts
|
|
9945
|
+
function repoDirExists(cwd) {
|
|
9946
|
+
return existsSync28(toGitCwd(cwd));
|
|
9910
9947
|
}
|
|
9911
9948
|
|
|
9912
9949
|
// src/commands/sessions/daemon/worktree/git.ts
|
|
@@ -10003,7 +10040,7 @@ function gitCommonDir(cwd) {
|
|
|
10003
10040
|
}
|
|
10004
10041
|
|
|
10005
10042
|
// src/shared/loadJson.ts
|
|
10006
|
-
import { existsSync as
|
|
10043
|
+
import { existsSync as existsSync29, mkdirSync as mkdirSync11, readFileSync as readFileSync19, writeFileSync as writeFileSync20 } from "fs";
|
|
10007
10044
|
import { homedir as homedir12 } from "os";
|
|
10008
10045
|
import { join as join26 } from "path";
|
|
10009
10046
|
function getStoreDir() {
|
|
@@ -10014,7 +10051,7 @@ function getStorePath(filename) {
|
|
|
10014
10051
|
}
|
|
10015
10052
|
function loadJson(filename) {
|
|
10016
10053
|
const path80 = getStorePath(filename);
|
|
10017
|
-
if (
|
|
10054
|
+
if (existsSync29(path80)) {
|
|
10018
10055
|
try {
|
|
10019
10056
|
return JSON.parse(readFileSync19(path80, "utf8"));
|
|
10020
10057
|
} catch {
|
|
@@ -10025,7 +10062,7 @@ function loadJson(filename) {
|
|
|
10025
10062
|
}
|
|
10026
10063
|
function saveJson(filename, data) {
|
|
10027
10064
|
const dir = getStoreDir();
|
|
10028
|
-
if (!
|
|
10065
|
+
if (!existsSync29(dir)) {
|
|
10029
10066
|
mkdirSync11(dir, { recursive: true });
|
|
10030
10067
|
}
|
|
10031
10068
|
writeFileSync20(getStorePath(filename), JSON.stringify(data, null, 2));
|
|
@@ -10059,26 +10096,29 @@ var cache2 = /* @__PURE__ */ new Map();
|
|
|
10059
10096
|
function repoGroupForCwd(cwd) {
|
|
10060
10097
|
if (!cwd) return void 0;
|
|
10061
10098
|
if (cache2.has(cwd)) return cache2.get(cwd);
|
|
10062
|
-
const group = resolveRepoGroup(cwd);
|
|
10063
|
-
cache2.set(cwd, group);
|
|
10099
|
+
const { group, stable } = resolveRepoGroup(cwd);
|
|
10100
|
+
if (stable) cache2.set(cwd, group);
|
|
10064
10101
|
return group;
|
|
10065
10102
|
}
|
|
10066
10103
|
function resolveRepoGroup(cwd) {
|
|
10067
|
-
const live = groupFromLiveTree(cwd);
|
|
10068
|
-
if (live) return live;
|
|
10069
|
-
const reaped = worktreeAttributionIncludingReaped(cwd);
|
|
10070
|
-
if (!reaped) return void 0;
|
|
10071
|
-
const origin = currentOriginOfClone(reaped.clone) ?? reaped.origin;
|
|
10072
|
-
return hostedGroup(cwd, origin, reaped.clone);
|
|
10073
|
-
}
|
|
10074
|
-
function groupFromLiveTree(cwd) {
|
|
10075
10104
|
const clone = mainWorktree(cwd);
|
|
10076
|
-
const origin = clone ?
|
|
10077
|
-
|
|
10105
|
+
const origin = clone ? originResolutionForCwd(clone) : void 0;
|
|
10106
|
+
if (clone && origin)
|
|
10107
|
+
return {
|
|
10108
|
+
group: hostedGroup(cwd, origin.origin, clone),
|
|
10109
|
+
stable: origin.stable
|
|
10110
|
+
};
|
|
10111
|
+
const reaped = worktreeAttributionIncludingReaped(cwd);
|
|
10112
|
+
if (!reaped) return { group: void 0, stable: repoDirExists(cwd) };
|
|
10113
|
+
const current = currentOriginOfClone(reaped.clone);
|
|
10114
|
+
return {
|
|
10115
|
+
group: hostedGroup(cwd, current?.origin ?? reaped.origin, reaped.clone),
|
|
10116
|
+
stable: current?.stable === true
|
|
10117
|
+
};
|
|
10078
10118
|
}
|
|
10079
10119
|
function currentOriginOfClone(clone) {
|
|
10080
10120
|
const main = mainWorktree(clone);
|
|
10081
|
-
return main ?
|
|
10121
|
+
return main ? originResolutionForCwd(main) : void 0;
|
|
10082
10122
|
}
|
|
10083
10123
|
function hostedGroup(cwd, origin, clone) {
|
|
10084
10124
|
return { origin: isWindowsCwd(cwd) ? `windows:${origin}` : origin, clone };
|
|
@@ -10224,7 +10264,7 @@ async function loadItemSummaries(orm, origin) {
|
|
|
10224
10264
|
}
|
|
10225
10265
|
|
|
10226
10266
|
// src/commands/backlog/resolveRepoLocation.ts
|
|
10227
|
-
import { existsSync as
|
|
10267
|
+
import { existsSync as existsSync30 } from "fs";
|
|
10228
10268
|
|
|
10229
10269
|
// src/commands/backlog/cloneTargetDir.ts
|
|
10230
10270
|
import { join as join28, resolve as resolve9 } from "path";
|
|
@@ -10240,7 +10280,7 @@ function resolveRepoLocation(origin, knownCwd, baseDir) {
|
|
|
10240
10280
|
if (knownCwd) return { cwd: knownCwd };
|
|
10241
10281
|
const target = cloneTargetDir(origin, baseDir);
|
|
10242
10282
|
if (!target) return {};
|
|
10243
|
-
if (
|
|
10283
|
+
if (existsSync30(target) && getCurrentOrigin(target) === origin)
|
|
10244
10284
|
return { cwd: target };
|
|
10245
10285
|
return { cloneTarget: target };
|
|
10246
10286
|
}
|
|
@@ -10607,20 +10647,6 @@ async function execGit(cwd, args, opts = {}) {
|
|
|
10607
10647
|
}
|
|
10608
10648
|
}
|
|
10609
10649
|
|
|
10610
|
-
// src/commands/sessions/web/windowsCwdToWslPath.ts
|
|
10611
|
-
function windowsCwdToWslPath(cwd) {
|
|
10612
|
-
const match = /^([A-Za-z]):[\\/](.*)$/.exec(cwd);
|
|
10613
|
-
if (!match) return cwd;
|
|
10614
|
-
const drive = match[1].toLowerCase();
|
|
10615
|
-
const rest = match[2].replace(/\\/g, "/");
|
|
10616
|
-
return `/mnt/${drive}/${rest}`;
|
|
10617
|
-
}
|
|
10618
|
-
|
|
10619
|
-
// src/commands/sessions/web/toGitCwd.ts
|
|
10620
|
-
function toGitCwd(cwd) {
|
|
10621
|
-
return detectPlatform() === "wsl" ? windowsCwdToWslPath(cwd) : cwd;
|
|
10622
|
-
}
|
|
10623
|
-
|
|
10624
10650
|
// src/commands/sessions/web/defaultBranchRef.ts
|
|
10625
10651
|
var ORIGIN_HEAD_REF = "refs/remotes/origin/HEAD";
|
|
10626
10652
|
var ORIGIN_REF_PREFIX = "refs/remotes/origin/";
|
|
@@ -11019,7 +11045,7 @@ async function getBackups(_req, res) {
|
|
|
11019
11045
|
}
|
|
11020
11046
|
|
|
11021
11047
|
// src/shared/globalConfigTargetFor.ts
|
|
11022
|
-
import { existsSync as
|
|
11048
|
+
import { existsSync as existsSync31 } from "fs";
|
|
11023
11049
|
import { posix as posix2 } from "path";
|
|
11024
11050
|
|
|
11025
11051
|
// src/shared/windowsHomeFromWsl.ts
|
|
@@ -11040,7 +11066,7 @@ function globalConfigTargetFor(cwd) {
|
|
|
11040
11066
|
ok: false,
|
|
11041
11067
|
error: `${cwd} runs on the Windows host, whose ~/.assist.yml cannot be located because sessions.windowsProjectsRoot is unset. Set it with: assist config set sessions.windowsProjectsRoot /mnt/c/Users/<you>/.claude/projects`
|
|
11042
11068
|
};
|
|
11043
|
-
if (!
|
|
11069
|
+
if (!existsSync31(winHome))
|
|
11044
11070
|
return {
|
|
11045
11071
|
ok: false,
|
|
11046
11072
|
error: `${cwd} runs on the Windows host, whose home ${winHome} is not reachable from here. Check that the Windows drive is mounted and sessions.windowsProjectsRoot points at it.`
|
|
@@ -11390,20 +11416,20 @@ import { basename as basename9, join as join30 } from "path";
|
|
|
11390
11416
|
import { promisify as promisify3 } from "util";
|
|
11391
11417
|
|
|
11392
11418
|
// src/commands/sessions/web/findSynthesisForBranch.ts
|
|
11393
|
-
import { existsSync as
|
|
11419
|
+
import { existsSync as existsSync32, readdirSync as readdirSync2, statSync as statSync4 } from "fs";
|
|
11394
11420
|
import { basename as basename8, dirname as dirname21, join as join29 } from "path";
|
|
11395
11421
|
function findSynthesisForBranch(repoReviewsDir, branch2) {
|
|
11396
11422
|
const branchKeyPath = join29(repoReviewsDir, `${branch2}-`);
|
|
11397
11423
|
const parent = dirname21(branchKeyPath);
|
|
11398
11424
|
const branchPrefix = basename8(branchKeyPath);
|
|
11399
|
-
if (!
|
|
11400
|
-
const synthesisFiles = readdirSync2(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join29(parent, name, "synthesis.md")).filter((path80) =>
|
|
11425
|
+
if (!existsSync32(parent)) return null;
|
|
11426
|
+
const synthesisFiles = readdirSync2(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join29(parent, name, "synthesis.md")).filter((path80) => existsSync32(path80)).map((path80) => ({ path: path80, mtime: statSync4(path80).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
|
|
11401
11427
|
return synthesisFiles[0]?.path ?? null;
|
|
11402
11428
|
}
|
|
11403
11429
|
|
|
11404
11430
|
// src/commands/sessions/web/getReviewSynthesis.ts
|
|
11405
11431
|
var execFileAsync3 = promisify3(execFile4);
|
|
11406
|
-
function
|
|
11432
|
+
function runGit2(cwd, args) {
|
|
11407
11433
|
return execFileAsync3("git", args, {
|
|
11408
11434
|
encoding: "utf8",
|
|
11409
11435
|
windowsHide: true,
|
|
@@ -11412,8 +11438,8 @@ function runGit(cwd, args) {
|
|
|
11412
11438
|
}
|
|
11413
11439
|
async function resolveSynthesisPath(cwd) {
|
|
11414
11440
|
const [repoRoot2, branch2] = await Promise.all([
|
|
11415
|
-
|
|
11416
|
-
|
|
11441
|
+
runGit2(cwd, ["rev-parse", "--show-toplevel"]),
|
|
11442
|
+
runGit2(cwd, ["rev-parse", "--abbrev-ref", "HEAD"])
|
|
11417
11443
|
]);
|
|
11418
11444
|
const repoReviewsDir = join30(
|
|
11419
11445
|
homedir13(),
|
|
@@ -12972,7 +12998,7 @@ import { readFile as readFile2, stat as stat3, writeFile as writeFile3 } from "f
|
|
|
12972
12998
|
|
|
12973
12999
|
// src/commands/sessions/web/formatWithOxfmt.ts
|
|
12974
13000
|
import { execFile as execFile8 } from "child_process";
|
|
12975
|
-
import { existsSync as
|
|
13001
|
+
import { existsSync as existsSync33 } from "fs";
|
|
12976
13002
|
import { dirname as dirname22, join as join32 } from "path";
|
|
12977
13003
|
import { promisify as promisify8 } from "util";
|
|
12978
13004
|
var execFileAsync7 = promisify8(execFile8);
|
|
@@ -12981,7 +13007,7 @@ function findOxfmtScript(root) {
|
|
|
12981
13007
|
let dir = root;
|
|
12982
13008
|
for (; ; ) {
|
|
12983
13009
|
const candidate = join32(dir, "node_modules", "oxfmt", "bin", "oxfmt");
|
|
12984
|
-
if (
|
|
13010
|
+
if (existsSync33(candidate)) return candidate;
|
|
12985
13011
|
const parent = dirname22(dir);
|
|
12986
13012
|
if (parent === dir) return void 0;
|
|
12987
13013
|
dir = parent;
|
|
@@ -13854,7 +13880,7 @@ function registerAssociateJiraCommand(cmd) {
|
|
|
13854
13880
|
|
|
13855
13881
|
// src/commands/backlog/cloneRepo.ts
|
|
13856
13882
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
13857
|
-
import { existsSync as
|
|
13883
|
+
import { existsSync as existsSync35 } from "fs";
|
|
13858
13884
|
import { mkdir as mkdir3 } from "fs/promises";
|
|
13859
13885
|
import chalk70 from "chalk";
|
|
13860
13886
|
|
|
@@ -13890,7 +13916,7 @@ async function cloneRepo(originRaw) {
|
|
|
13890
13916
|
if (!target) {
|
|
13891
13917
|
return fail2(`Could not derive a repository name from "${origin}".`);
|
|
13892
13918
|
}
|
|
13893
|
-
if (
|
|
13919
|
+
if (existsSync35(target)) {
|
|
13894
13920
|
return fail2(`Clone target already exists: ${target}`);
|
|
13895
13921
|
}
|
|
13896
13922
|
await mkdir3(baseDir, { recursive: true });
|
|
@@ -16869,7 +16895,7 @@ function extractGraphqlQuery(args) {
|
|
|
16869
16895
|
}
|
|
16870
16896
|
|
|
16871
16897
|
// src/shared/loadCliReads.ts
|
|
16872
|
-
import { existsSync as
|
|
16898
|
+
import { existsSync as existsSync36, readFileSync as readFileSync25, writeFileSync as writeFileSync22 } from "fs";
|
|
16873
16899
|
import { dirname as dirname23, resolve as resolve12 } from "path";
|
|
16874
16900
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
16875
16901
|
var __filename3 = fileURLToPath5(import.meta.url);
|
|
@@ -16878,7 +16904,7 @@ function packageRoot() {
|
|
|
16878
16904
|
return __dirname4;
|
|
16879
16905
|
}
|
|
16880
16906
|
function readLines(path80) {
|
|
16881
|
-
if (!
|
|
16907
|
+
if (!existsSync36(path80)) return [];
|
|
16882
16908
|
return readFileSync25(path80, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
16883
16909
|
}
|
|
16884
16910
|
var cachedReads;
|
|
@@ -16925,7 +16951,7 @@ function findCliWrite(command) {
|
|
|
16925
16951
|
}
|
|
16926
16952
|
|
|
16927
16953
|
// src/shared/readSettingsPerms.ts
|
|
16928
|
-
import { existsSync as
|
|
16954
|
+
import { existsSync as existsSync37, readFileSync as readFileSync26 } from "fs";
|
|
16929
16955
|
import { homedir as homedir15 } from "os";
|
|
16930
16956
|
import { join as join37 } from "path";
|
|
16931
16957
|
function readSettingsPerms(key) {
|
|
@@ -16941,7 +16967,7 @@ function readSettingsPerms(key) {
|
|
|
16941
16967
|
return entries;
|
|
16942
16968
|
}
|
|
16943
16969
|
function readPermissionArray(filePath, key) {
|
|
16944
|
-
if (!
|
|
16970
|
+
if (!existsSync37(filePath)) return [];
|
|
16945
16971
|
try {
|
|
16946
16972
|
const data = JSON.parse(readFileSync26(filePath, "utf8"));
|
|
16947
16973
|
const arr = data?.permissions?.[key];
|
|
@@ -17286,7 +17312,7 @@ ${reasons.join("\n")}`);
|
|
|
17286
17312
|
}
|
|
17287
17313
|
|
|
17288
17314
|
// src/commands/permitCliReads/index.ts
|
|
17289
|
-
import { existsSync as
|
|
17315
|
+
import { existsSync as existsSync38, mkdirSync as mkdirSync13, readFileSync as readFileSync27, writeFileSync as writeFileSync23 } from "fs";
|
|
17290
17316
|
import { homedir as homedir17 } from "os";
|
|
17291
17317
|
import { join as join39 } from "path";
|
|
17292
17318
|
|
|
@@ -17555,7 +17581,7 @@ function logPath(cli) {
|
|
|
17555
17581
|
}
|
|
17556
17582
|
function readCache(cli) {
|
|
17557
17583
|
const path80 = logPath(cli);
|
|
17558
|
-
if (!
|
|
17584
|
+
if (!existsSync38(path80)) return void 0;
|
|
17559
17585
|
return readFileSync27(path80, "utf8");
|
|
17560
17586
|
}
|
|
17561
17587
|
function writeCache(cli, output) {
|
|
@@ -17690,7 +17716,7 @@ function registerCliHook(program2) {
|
|
|
17690
17716
|
}
|
|
17691
17717
|
|
|
17692
17718
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
17693
|
-
import { existsSync as
|
|
17719
|
+
import { existsSync as existsSync40, readFileSync as readFileSync29, unlinkSync as unlinkSync8, writeFileSync as writeFileSync24 } from "fs";
|
|
17694
17720
|
import chalk122 from "chalk";
|
|
17695
17721
|
|
|
17696
17722
|
// src/commands/codeComment/getRestrictedDir.ts
|
|
@@ -17726,10 +17752,10 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
17726
17752
|
}
|
|
17727
17753
|
|
|
17728
17754
|
// src/commands/codeComment/readPinState.ts
|
|
17729
|
-
import { existsSync as
|
|
17755
|
+
import { existsSync as existsSync39, readFileSync as readFileSync28 } from "fs";
|
|
17730
17756
|
function readPinState(pin) {
|
|
17731
17757
|
const path80 = getPinStatePath(pin);
|
|
17732
|
-
if (!
|
|
17758
|
+
if (!existsSync39(path80)) return void 0;
|
|
17733
17759
|
try {
|
|
17734
17760
|
const state = JSON.parse(readFileSync28(path80, "utf8"));
|
|
17735
17761
|
if (state.pin !== pin) return void 0;
|
|
@@ -17748,7 +17774,7 @@ function codeCommentConfirm(pin) {
|
|
|
17748
17774
|
process.exitCode = 1;
|
|
17749
17775
|
return;
|
|
17750
17776
|
}
|
|
17751
|
-
if (!
|
|
17777
|
+
if (!existsSync40(state.file)) {
|
|
17752
17778
|
console.error(chalk122.red(`Target file no longer exists: ${state.file}`));
|
|
17753
17779
|
process.exitCode = 1;
|
|
17754
17780
|
return;
|
|
@@ -18915,10 +18941,10 @@ function getMigrationApprovalPath(migrationId) {
|
|
|
18915
18941
|
}
|
|
18916
18942
|
|
|
18917
18943
|
// src/commands/dbMigration/readMigrationPinState.ts
|
|
18918
|
-
import { existsSync as
|
|
18944
|
+
import { existsSync as existsSync41, readFileSync as readFileSync30 } from "fs";
|
|
18919
18945
|
function readMigrationPinState(pin) {
|
|
18920
18946
|
const path80 = getMigrationPinPath(pin);
|
|
18921
|
-
if (!
|
|
18947
|
+
if (!existsSync41(path80)) return void 0;
|
|
18922
18948
|
try {
|
|
18923
18949
|
const state = JSON.parse(readFileSync30(path80, "utf8"));
|
|
18924
18950
|
if (state.pin !== pin) return void 0;
|
|
@@ -19007,7 +19033,7 @@ function registerDbMigration(parent) {
|
|
|
19007
19033
|
}
|
|
19008
19034
|
|
|
19009
19035
|
// src/commands/deploy/redirect.ts
|
|
19010
|
-
import { existsSync as
|
|
19036
|
+
import { existsSync as existsSync42, readFileSync as readFileSync31, writeFileSync as writeFileSync28 } from "fs";
|
|
19011
19037
|
import chalk142 from "chalk";
|
|
19012
19038
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
19013
19039
|
if (!window.location.pathname.endsWith('/')) {
|
|
@@ -19016,7 +19042,7 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
19016
19042
|
</script>`;
|
|
19017
19043
|
function redirect() {
|
|
19018
19044
|
const indexPath = "index.html";
|
|
19019
|
-
if (!
|
|
19045
|
+
if (!existsSync42(indexPath)) {
|
|
19020
19046
|
console.log(chalk142.yellow("No index.html found"));
|
|
19021
19047
|
return;
|
|
19022
19048
|
}
|
|
@@ -19063,7 +19089,7 @@ import { execSync as execSync36 } from "child_process";
|
|
|
19063
19089
|
import chalk143 from "chalk";
|
|
19064
19090
|
|
|
19065
19091
|
// src/shared/getRepoName.ts
|
|
19066
|
-
import { existsSync as
|
|
19092
|
+
import { existsSync as existsSync43, readFileSync as readFileSync32 } from "fs";
|
|
19067
19093
|
import { basename as basename12, join as join44 } from "path";
|
|
19068
19094
|
function getRepoName() {
|
|
19069
19095
|
const config = loadConfig();
|
|
@@ -19071,7 +19097,7 @@ function getRepoName() {
|
|
|
19071
19097
|
return config.devlog.name;
|
|
19072
19098
|
}
|
|
19073
19099
|
const packageJsonPath = join44(process.cwd(), "package.json");
|
|
19074
|
-
if (
|
|
19100
|
+
if (existsSync43(packageJsonPath)) {
|
|
19075
19101
|
try {
|
|
19076
19102
|
const content = readFileSync32(packageJsonPath, "utf8");
|
|
19077
19103
|
const pkg = JSON.parse(content);
|
|
@@ -19773,12 +19799,12 @@ function printJson(tree, totalCount, solutions) {
|
|
|
19773
19799
|
}
|
|
19774
19800
|
|
|
19775
19801
|
// src/commands/dotnet/resolveCsproj.ts
|
|
19776
|
-
import { existsSync as
|
|
19802
|
+
import { existsSync as existsSync44 } from "fs";
|
|
19777
19803
|
import path39 from "path";
|
|
19778
19804
|
import chalk152 from "chalk";
|
|
19779
19805
|
function resolveCsproj(csprojPath) {
|
|
19780
19806
|
const resolved = path39.resolve(csprojPath);
|
|
19781
|
-
if (!
|
|
19807
|
+
if (!existsSync44(resolved)) {
|
|
19782
19808
|
console.error(chalk152.red(`File not found: ${resolved}`));
|
|
19783
19809
|
process.exit(1);
|
|
19784
19810
|
}
|
|
@@ -19946,7 +19972,7 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
19946
19972
|
}
|
|
19947
19973
|
|
|
19948
19974
|
// src/commands/dotnet/resolveSolution.ts
|
|
19949
|
-
import { existsSync as
|
|
19975
|
+
import { existsSync as existsSync45 } from "fs";
|
|
19950
19976
|
import path40 from "path";
|
|
19951
19977
|
import chalk156 from "chalk";
|
|
19952
19978
|
|
|
@@ -19987,7 +20013,7 @@ function findSolution() {
|
|
|
19987
20013
|
function resolveSolution(sln) {
|
|
19988
20014
|
if (sln) {
|
|
19989
20015
|
const resolved = path40.resolve(sln);
|
|
19990
|
-
if (!
|
|
20016
|
+
if (!existsSync45(resolved)) {
|
|
19991
20017
|
console.error(chalk156.red(`Solution file not found: ${resolved}`));
|
|
19992
20018
|
process.exit(1);
|
|
19993
20019
|
}
|
|
@@ -20027,7 +20053,7 @@ function parseInspectReport(json) {
|
|
|
20027
20053
|
|
|
20028
20054
|
// src/commands/dotnet/runInspectCode.ts
|
|
20029
20055
|
import { execSync as execSync40 } from "child_process";
|
|
20030
|
-
import { existsSync as
|
|
20056
|
+
import { existsSync as existsSync46, readFileSync as readFileSync36, unlinkSync as unlinkSync10 } from "fs";
|
|
20031
20057
|
import { tmpdir as tmpdir4 } from "os";
|
|
20032
20058
|
import path41 from "path";
|
|
20033
20059
|
import chalk157 from "chalk";
|
|
@@ -20058,7 +20084,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
20058
20084
|
console.error(chalk157.red("jb inspectcode failed"));
|
|
20059
20085
|
process.exit(1);
|
|
20060
20086
|
}
|
|
20061
|
-
if (!
|
|
20087
|
+
if (!existsSync46(reportPath)) {
|
|
20062
20088
|
console.error(chalk157.red("Report file not generated"));
|
|
20063
20089
|
process.exit(1);
|
|
20064
20090
|
}
|
|
@@ -20347,11 +20373,11 @@ function decideCommentGuard(input, existingContent) {
|
|
|
20347
20373
|
}
|
|
20348
20374
|
|
|
20349
20375
|
// src/commands/dbMigration/consumeMigrationApproval.ts
|
|
20350
|
-
import { existsSync as
|
|
20376
|
+
import { existsSync as existsSync47, unlinkSync as unlinkSync11 } from "fs";
|
|
20351
20377
|
function consumeMigrationApproval(migrationId) {
|
|
20352
20378
|
sweepRestrictedDir();
|
|
20353
20379
|
const path80 = getMigrationApprovalPath(migrationId);
|
|
20354
|
-
if (!
|
|
20380
|
+
if (!existsSync47(path80)) return false;
|
|
20355
20381
|
try {
|
|
20356
20382
|
unlinkSync11(path80);
|
|
20357
20383
|
return true;
|
|
@@ -20771,6 +20797,136 @@ async function createIssue(options2) {
|
|
|
20771
20797
|
}
|
|
20772
20798
|
}
|
|
20773
20799
|
|
|
20800
|
+
// src/commands/github/issue/fetchIssue.ts
|
|
20801
|
+
import { execFileSync as execFileSync8 } from "child_process";
|
|
20802
|
+
function fetchIssue2(number, repo) {
|
|
20803
|
+
const args = [
|
|
20804
|
+
"issue",
|
|
20805
|
+
"view",
|
|
20806
|
+
String(number),
|
|
20807
|
+
"--json",
|
|
20808
|
+
"title,body,updatedAt,url"
|
|
20809
|
+
];
|
|
20810
|
+
if (repo) args.push("--repo", repo);
|
|
20811
|
+
let raw;
|
|
20812
|
+
try {
|
|
20813
|
+
raw = execFileSync8("gh", args, { encoding: "utf8" });
|
|
20814
|
+
} catch {
|
|
20815
|
+
console.error(`Could not fetch issue #${number} with gh issue view`);
|
|
20816
|
+
process.exit(1);
|
|
20817
|
+
}
|
|
20818
|
+
try {
|
|
20819
|
+
return JSON.parse(raw);
|
|
20820
|
+
} catch {
|
|
20821
|
+
console.error(`Could not parse the gh issue view output for #${number}`);
|
|
20822
|
+
process.exit(1);
|
|
20823
|
+
}
|
|
20824
|
+
}
|
|
20825
|
+
|
|
20826
|
+
// src/commands/github/issue/pushIssueBody.ts
|
|
20827
|
+
import { execFileSync as execFileSync9 } from "child_process";
|
|
20828
|
+
function pushIssueBody(number, repo, bodyPath) {
|
|
20829
|
+
const args = ["issue", "edit", String(number), "--body-file", bodyPath];
|
|
20830
|
+
if (repo) args.push("--repo", repo);
|
|
20831
|
+
try {
|
|
20832
|
+
execFileSync9("gh", args, { stdio: "inherit" });
|
|
20833
|
+
} catch {
|
|
20834
|
+
process.exit(1);
|
|
20835
|
+
}
|
|
20836
|
+
}
|
|
20837
|
+
|
|
20838
|
+
// src/commands/github/issue/reviewProposedIssueEdit.ts
|
|
20839
|
+
import { randomUUID as randomUUID9 } from "crypto";
|
|
20840
|
+
async function reviewProposedIssueEdit(title, body) {
|
|
20841
|
+
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
20842
|
+
if (process.env.ASSIST_SESSION !== "1" || !sessionId) return false;
|
|
20843
|
+
await awaitPreviewApproval("GitHub issue edit preview", {
|
|
20844
|
+
sessionId,
|
|
20845
|
+
requestId: randomUUID9(),
|
|
20846
|
+
title,
|
|
20847
|
+
body,
|
|
20848
|
+
prNumber: null,
|
|
20849
|
+
kind: "github-issue-edit"
|
|
20850
|
+
});
|
|
20851
|
+
return true;
|
|
20852
|
+
}
|
|
20853
|
+
|
|
20854
|
+
// src/commands/github/issue/writeIssueWorkingFile.ts
|
|
20855
|
+
import { mkdirSync as mkdirSync16, writeFileSync as writeFileSync31 } from "fs";
|
|
20856
|
+
|
|
20857
|
+
// src/commands/github/issue/issueWorkingFile.ts
|
|
20858
|
+
import { join as join50 } from "path";
|
|
20859
|
+
function issueWorkingFile(slug, number) {
|
|
20860
|
+
const [owner = "unknown", repo = "unknown"] = slug.split("/");
|
|
20861
|
+
const dir = join50(getStoreDir(), "github-issues", owner, repo);
|
|
20862
|
+
return {
|
|
20863
|
+
dir,
|
|
20864
|
+
bodyPath: join50(dir, `${number}.md`),
|
|
20865
|
+
metaPath: join50(dir, `${number}.json`)
|
|
20866
|
+
};
|
|
20867
|
+
}
|
|
20868
|
+
|
|
20869
|
+
// src/commands/github/issue/writeIssueWorkingFile.ts
|
|
20870
|
+
function writeIssueWorkingFile(slug, number, target, updatedAt, body) {
|
|
20871
|
+
const { dir, bodyPath, metaPath } = issueWorkingFile(slug, number);
|
|
20872
|
+
mkdirSync16(dir, { recursive: true });
|
|
20873
|
+
writeFileSync31(bodyPath, body);
|
|
20874
|
+
writeFileSync31(
|
|
20875
|
+
metaPath,
|
|
20876
|
+
`${JSON.stringify({ target, updatedAt }, null, 2)}
|
|
20877
|
+
`
|
|
20878
|
+
);
|
|
20879
|
+
return bodyPath;
|
|
20880
|
+
}
|
|
20881
|
+
|
|
20882
|
+
// src/commands/github/issue/editIssue.ts
|
|
20883
|
+
var USAGE3 = "Usage: assist github issue edit <number> [-R <owner>/<repo>]";
|
|
20884
|
+
function slugFromUrl(url) {
|
|
20885
|
+
const match = /github\.com\/([^/]+\/[^/]+)\//.exec(url ?? "");
|
|
20886
|
+
return match ? match[1] : "unknown/unknown";
|
|
20887
|
+
}
|
|
20888
|
+
function abandon(reason4, bodyPath) {
|
|
20889
|
+
console.error(
|
|
20890
|
+
`${reason4}. Nothing was pushed; the markdown is at ${bodyPath}`
|
|
20891
|
+
);
|
|
20892
|
+
process.exit(1);
|
|
20893
|
+
}
|
|
20894
|
+
async function editIssue(numberArg, options2) {
|
|
20895
|
+
const number = Number.parseInt(numberArg, 10);
|
|
20896
|
+
if (!Number.isInteger(number) || number <= 0) {
|
|
20897
|
+
console.error(USAGE3);
|
|
20898
|
+
process.exit(1);
|
|
20899
|
+
}
|
|
20900
|
+
const issue = fetchIssue2(number, options2.repo);
|
|
20901
|
+
const slug = options2.repo ?? slugFromUrl(issue.url);
|
|
20902
|
+
const target = `${slug}#${number}`;
|
|
20903
|
+
validateProposedContent(
|
|
20904
|
+
{ subject: "Issue", context: "GitHub issues" },
|
|
20905
|
+
issue.title,
|
|
20906
|
+
issue.body
|
|
20907
|
+
);
|
|
20908
|
+
const bodyPath = writeIssueWorkingFile(
|
|
20909
|
+
slug,
|
|
20910
|
+
number,
|
|
20911
|
+
target,
|
|
20912
|
+
issue.updatedAt,
|
|
20913
|
+
issue.body
|
|
20914
|
+
);
|
|
20915
|
+
const reviewed = await reviewProposedIssueEdit(
|
|
20916
|
+
`Edit ${target}: ${issue.title}`,
|
|
20917
|
+
issue.body
|
|
20918
|
+
);
|
|
20919
|
+
if (!reviewed)
|
|
20920
|
+
abandon(
|
|
20921
|
+
`${target} can only be edited through the assist web preview pane`,
|
|
20922
|
+
bodyPath
|
|
20923
|
+
);
|
|
20924
|
+
if (fetchIssue2(number, options2.repo).updatedAt !== issue.updatedAt)
|
|
20925
|
+
abandon(`${target} was updated on GitHub after it was fetched`, bodyPath);
|
|
20926
|
+
pushIssueBody(number, options2.repo, bodyPath);
|
|
20927
|
+
console.log(`Issue body updated on ${target}`);
|
|
20928
|
+
}
|
|
20929
|
+
|
|
20774
20930
|
// src/commands/prs/readBodyArgument.ts
|
|
20775
20931
|
async function readBodyArgument(value) {
|
|
20776
20932
|
if (value !== "-") return value;
|
|
@@ -20792,6 +20948,13 @@ function registerGithubIssue(githubCommand) {
|
|
|
20792
20948
|
"after",
|
|
20793
20949
|
"\nThere is no What/Why/How template: an issue reports a problem, and the target repo's own issue template is unknowable from here. Write the body as the repo's maintainers would expect.\nIn an assist web session the title and body are previewed for approve/reject first (with inline comments); nothing is created until it is approved."
|
|
20794
20950
|
).action(createIssue);
|
|
20951
|
+
issueCommand.command("edit <number>").description("Edit an existing GitHub issue's body in the preview pane").option(
|
|
20952
|
+
"-R, --repo <owner/repo>",
|
|
20953
|
+
"Target repository (defaults to the current repo)"
|
|
20954
|
+
).addHelpText(
|
|
20955
|
+
"after",
|
|
20956
|
+
"\nFetches the issue's current body and opens it in the assist web preview pane, where it can be reworked before it is pushed back. Approving pushes the pane's markdown to the issue; nothing is pushed if the issue moved on GitHub after it was fetched, or outside a web session.\nOnly the body is touched \u2014 the title, labels, assignees and state are left alone."
|
|
20957
|
+
).action(editIssue);
|
|
20795
20958
|
issueCommand.command("comment <number>").description("Comment on a GitHub issue (body of - reads it from stdin)").option("--body <body>", "Comment body (- reads it from stdin)").option(
|
|
20796
20959
|
"-R, --repo <owner/repo>",
|
|
20797
20960
|
"Target repository (defaults to the current repo)"
|
|
@@ -20832,24 +20995,24 @@ async function countPendingHandovers(orm, origin) {
|
|
|
20832
20995
|
|
|
20833
20996
|
// src/commands/handover/migrateDiskHandovers.ts
|
|
20834
20997
|
import {
|
|
20835
|
-
existsSync as
|
|
20998
|
+
existsSync as existsSync48,
|
|
20836
20999
|
readdirSync as readdirSync10,
|
|
20837
21000
|
readFileSync as readFileSync37,
|
|
20838
21001
|
rmSync as rmSync3,
|
|
20839
21002
|
statSync as statSync8
|
|
20840
21003
|
} from "fs";
|
|
20841
|
-
import { basename as basename14, join as
|
|
21004
|
+
import { basename as basename14, join as join53 } from "path";
|
|
20842
21005
|
|
|
20843
21006
|
// src/commands/handover/getHandoverPath.ts
|
|
20844
|
-
import { join as
|
|
21007
|
+
import { join as join51 } from "path";
|
|
20845
21008
|
function getHandoverPath(cwd = process.cwd()) {
|
|
20846
|
-
return
|
|
21009
|
+
return join51(cwd, ".assist", "HANDOVER.md");
|
|
20847
21010
|
}
|
|
20848
21011
|
|
|
20849
21012
|
// src/commands/handover/getHandoversDir.ts
|
|
20850
|
-
import { join as
|
|
21013
|
+
import { join as join52 } from "path";
|
|
20851
21014
|
function getHandoversDir(cwd = process.cwd()) {
|
|
20852
|
-
return
|
|
21015
|
+
return join52(cwd, ".assist", "handovers");
|
|
20853
21016
|
}
|
|
20854
21017
|
|
|
20855
21018
|
// src/commands/handover/parseArchiveTimestamp.ts
|
|
@@ -20887,10 +21050,10 @@ function summariseHandoverContent(content) {
|
|
|
20887
21050
|
|
|
20888
21051
|
// src/commands/handover/migrateDiskHandovers.ts
|
|
20889
21052
|
function collectMarkdown(dir) {
|
|
20890
|
-
if (!
|
|
21053
|
+
if (!existsSync48(dir)) return [];
|
|
20891
21054
|
const out = [];
|
|
20892
21055
|
for (const entry of readdirSync10(dir, { withFileTypes: true })) {
|
|
20893
|
-
const full =
|
|
21056
|
+
const full = join53(dir, entry.name);
|
|
20894
21057
|
if (entry.isDirectory()) out.push(...collectMarkdown(full));
|
|
20895
21058
|
else if (entry.isFile() && entry.name.endsWith(".md")) out.push(full);
|
|
20896
21059
|
}
|
|
@@ -20914,7 +21077,7 @@ async function migrateDiskHandovers(orm, origin, cwd = process.cwd()) {
|
|
|
20914
21077
|
migrated++;
|
|
20915
21078
|
}
|
|
20916
21079
|
const handoverPath = getHandoverPath(cwd);
|
|
20917
|
-
if (
|
|
21080
|
+
if (existsSync48(handoverPath)) {
|
|
20918
21081
|
await migrateFile(orm, origin, handoverPath, statSync8(handoverPath).mtime);
|
|
20919
21082
|
migrated++;
|
|
20920
21083
|
}
|
|
@@ -21230,10 +21393,10 @@ function registerRefineLaunch(program2, resumeFlag) {
|
|
|
21230
21393
|
}
|
|
21231
21394
|
|
|
21232
21395
|
// src/commands/reviewPrComments.ts
|
|
21233
|
-
import { randomUUID as
|
|
21396
|
+
import { randomUUID as randomUUID10 } from "crypto";
|
|
21234
21397
|
|
|
21235
21398
|
// src/commands/review/checkoutPr.ts
|
|
21236
|
-
import { execFileSync as
|
|
21399
|
+
import { execFileSync as execFileSync11 } from "child_process";
|
|
21237
21400
|
import chalk164 from "chalk";
|
|
21238
21401
|
|
|
21239
21402
|
// src/commands/sessions/daemon/daemonLog.ts
|
|
@@ -21271,18 +21434,18 @@ function canonicalTreePath(path80) {
|
|
|
21271
21434
|
}
|
|
21272
21435
|
|
|
21273
21436
|
// src/commands/sessions/daemon/worktree/createWorktree.ts
|
|
21274
|
-
import { existsSync as
|
|
21437
|
+
import { existsSync as existsSync49 } from "fs";
|
|
21275
21438
|
import { basename as basename16, dirname as dirname25 } from "path";
|
|
21276
21439
|
|
|
21277
21440
|
// src/commands/sessions/daemon/worktree/planAllocation.ts
|
|
21278
|
-
import { basename as basename15, join as
|
|
21441
|
+
import { basename as basename15, join as join54 } from "path";
|
|
21279
21442
|
function planAllocation(clone, boundTreeRoots2) {
|
|
21280
21443
|
return boundTreeRoots2.has(clone) ? "spill" : "primary";
|
|
21281
21444
|
}
|
|
21282
21445
|
function nextWorktreePath(clone, base, isTaken) {
|
|
21283
21446
|
const name = basename15(clone);
|
|
21284
21447
|
for (let n = 2; n < 1e3; n++) {
|
|
21285
|
-
const candidate =
|
|
21448
|
+
const candidate = join54(base, `${name}-${n}`);
|
|
21286
21449
|
if (!isTaken(candidate)) return candidate;
|
|
21287
21450
|
}
|
|
21288
21451
|
throw new Error(`no free worktree suffix for ${clone}`);
|
|
@@ -21318,7 +21481,7 @@ function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
|
|
|
21318
21481
|
const base = strategy.root ? expandTilde2(strategy.root) : dirname25(clone);
|
|
21319
21482
|
const registered = new Set(listWorktreePaths(clone));
|
|
21320
21483
|
const branches = new Set(listLocalBranches(clone));
|
|
21321
|
-
const isTaken = (candidate) => registered.has(candidate) ||
|
|
21484
|
+
const isTaken = (candidate) => registered.has(candidate) || existsSync49(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename16(candidate));
|
|
21322
21485
|
const path80 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
|
|
21323
21486
|
const start3 = worktreeStartPoint(clone, strategy.trunk);
|
|
21324
21487
|
gitSync(clone, [
|
|
@@ -21344,7 +21507,7 @@ function keptInTree(cwd, reason4) {
|
|
|
21344
21507
|
}
|
|
21345
21508
|
|
|
21346
21509
|
// src/commands/sessions/daemon/worktree/treeDurability.ts
|
|
21347
|
-
import { existsSync as
|
|
21510
|
+
import { existsSync as existsSync50 } from "fs";
|
|
21348
21511
|
var treeIsGone = { durable: true, gone: true };
|
|
21349
21512
|
function treeDurability(state) {
|
|
21350
21513
|
if (state.dirty) return { durable: false, reason: "uncommitted changes" };
|
|
@@ -21375,14 +21538,14 @@ function* durabilityProbes() {
|
|
|
21375
21538
|
});
|
|
21376
21539
|
}
|
|
21377
21540
|
async function checkDurability(cwd) {
|
|
21378
|
-
if (!
|
|
21541
|
+
if (!existsSync50(cwd)) return treeIsGone;
|
|
21379
21542
|
const probes = durabilityProbes();
|
|
21380
21543
|
let step2 = probes.next();
|
|
21381
21544
|
while (!step2.done) step2 = probes.next(await gitResult(cwd, step2.value));
|
|
21382
21545
|
return step2.value;
|
|
21383
21546
|
}
|
|
21384
21547
|
function checkDurabilitySync(cwd) {
|
|
21385
|
-
if (!
|
|
21548
|
+
if (!existsSync50(cwd)) return treeIsGone;
|
|
21386
21549
|
const probes = durabilityProbes();
|
|
21387
21550
|
let step2 = probes.next();
|
|
21388
21551
|
while (!step2.done) step2 = probes.next(gitSyncResult(cwd, step2.value));
|
|
@@ -21625,20 +21788,20 @@ function persistedTreeRoots() {
|
|
|
21625
21788
|
}
|
|
21626
21789
|
|
|
21627
21790
|
// src/commands/sessions/daemon/worktree/seedWorktree.ts
|
|
21628
|
-
import { copyFileSync, existsSync as
|
|
21629
|
-
import { dirname as dirname26, join as
|
|
21791
|
+
import { copyFileSync, existsSync as existsSync52, mkdirSync as mkdirSync17 } from "fs";
|
|
21792
|
+
import { dirname as dirname26, join as join56 } from "path";
|
|
21630
21793
|
|
|
21631
21794
|
// src/commands/sessions/daemon/worktree/runInstall.ts
|
|
21632
21795
|
import { spawn as spawn5 } from "child_process";
|
|
21633
21796
|
|
|
21634
21797
|
// src/commands/sessions/daemon/worktree/resolveInstallCommand.ts
|
|
21635
|
-
import { existsSync as
|
|
21636
|
-
import { join as
|
|
21798
|
+
import { existsSync as existsSync51 } from "fs";
|
|
21799
|
+
import { join as join55 } from "path";
|
|
21637
21800
|
function detectInstallCommand(repoRoot2) {
|
|
21638
|
-
if (!
|
|
21639
|
-
if (
|
|
21640
|
-
if (
|
|
21641
|
-
if (
|
|
21801
|
+
if (!existsSync51(join55(repoRoot2, "package.json"))) return null;
|
|
21802
|
+
if (existsSync51(join55(repoRoot2, "pnpm-lock.yaml"))) return "pnpm install";
|
|
21803
|
+
if (existsSync51(join55(repoRoot2, "yarn.lock"))) return "yarn install";
|
|
21804
|
+
if (existsSync51(join55(repoRoot2, "bun.lockb"))) return "bun install";
|
|
21642
21805
|
return "npm install";
|
|
21643
21806
|
}
|
|
21644
21807
|
function resolveInstallCommand(repoRoot2, install) {
|
|
@@ -21750,11 +21913,11 @@ function seedWorktree(worktreePath, clone, onSeeded = () => {
|
|
|
21750
21913
|
}
|
|
21751
21914
|
function copyConfigFiles(worktreePath, clone, copy) {
|
|
21752
21915
|
for (const rel of copy) {
|
|
21753
|
-
const src =
|
|
21754
|
-
if (!
|
|
21755
|
-
const dest =
|
|
21916
|
+
const src = join56(clone, rel);
|
|
21917
|
+
if (!existsSync52(src)) continue;
|
|
21918
|
+
const dest = join56(worktreePath, rel);
|
|
21756
21919
|
try {
|
|
21757
|
-
|
|
21920
|
+
mkdirSync17(dirname26(dest), { recursive: true });
|
|
21758
21921
|
copyFileSync(src, dest);
|
|
21759
21922
|
daemonLog(`worktree ${worktreePath} seeded ${rel}`);
|
|
21760
21923
|
} catch (error) {
|
|
@@ -21793,10 +21956,10 @@ async function moveToPrCheckoutTree() {
|
|
|
21793
21956
|
}
|
|
21794
21957
|
|
|
21795
21958
|
// src/commands/review/prHeadBranch.ts
|
|
21796
|
-
import { execFileSync as
|
|
21959
|
+
import { execFileSync as execFileSync10 } from "child_process";
|
|
21797
21960
|
function prHeadBranch(number) {
|
|
21798
21961
|
try {
|
|
21799
|
-
const out =
|
|
21962
|
+
const out = execFileSync10(
|
|
21800
21963
|
"gh",
|
|
21801
21964
|
["pr", "view", number, "--json", "headRefName", "-q", ".headRefName"],
|
|
21802
21965
|
{ encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }
|
|
@@ -21844,7 +22007,7 @@ async function checkoutPr(number) {
|
|
|
21844
22007
|
if (headRef && moveToExistingCheckout(number, headRef)) return;
|
|
21845
22008
|
await moveToPrCheckoutTree();
|
|
21846
22009
|
try {
|
|
21847
|
-
|
|
22010
|
+
execFileSync11("gh", ["pr", "checkout", number], { stdio: "inherit" });
|
|
21848
22011
|
} catch {
|
|
21849
22012
|
console.error(chalk164.red(`gh pr checkout ${number} failed; aborting.`));
|
|
21850
22013
|
process.exit(1);
|
|
@@ -21866,7 +22029,7 @@ async function reviewPrComments(number, options2 = {}) {
|
|
|
21866
22029
|
const resumeSessionId = options2.resumeSessionId;
|
|
21867
22030
|
validateAnnounce(number, announce);
|
|
21868
22031
|
if (number && !resumeSessionId) await checkoutPr(number);
|
|
21869
|
-
const claudeSessionId = resumeSessionId ??
|
|
22032
|
+
const claudeSessionId = resumeSessionId ?? randomUUID10();
|
|
21870
22033
|
emitActivity({
|
|
21871
22034
|
kind: "command",
|
|
21872
22035
|
name: "review-pr-comments",
|
|
@@ -21884,14 +22047,14 @@ async function reviewPrComments(number, options2 = {}) {
|
|
|
21884
22047
|
}
|
|
21885
22048
|
|
|
21886
22049
|
// src/commands/fixConflict.ts
|
|
21887
|
-
import { randomUUID as
|
|
22050
|
+
import { randomUUID as randomUUID11 } from "crypto";
|
|
21888
22051
|
function buildPrompt3(rebase) {
|
|
21889
22052
|
return rebase ? "/fix-conflict --rebase" : "/fix-conflict";
|
|
21890
22053
|
}
|
|
21891
22054
|
async function fixConflict(number, options2 = {}) {
|
|
21892
22055
|
const { resumeSessionId } = options2;
|
|
21893
22056
|
if (number && !resumeSessionId) await checkoutPr(number);
|
|
21894
|
-
const claudeSessionId = resumeSessionId ??
|
|
22057
|
+
const claudeSessionId = resumeSessionId ?? randomUUID11();
|
|
21895
22058
|
emitActivity({
|
|
21896
22059
|
kind: "command",
|
|
21897
22060
|
name: "fix-conflict",
|
|
@@ -21981,12 +22144,12 @@ function registerList(program2) {
|
|
|
21981
22144
|
}
|
|
21982
22145
|
|
|
21983
22146
|
// src/commands/mermaid/index.ts
|
|
21984
|
-
import { mkdirSync as
|
|
22147
|
+
import { mkdirSync as mkdirSync18, readdirSync as readdirSync11 } from "fs";
|
|
21985
22148
|
import { resolve as resolve16 } from "path";
|
|
21986
22149
|
import chalk167 from "chalk";
|
|
21987
22150
|
|
|
21988
22151
|
// src/commands/mermaid/exportFile.ts
|
|
21989
|
-
import { readFileSync as readFileSync38, writeFileSync as
|
|
22152
|
+
import { readFileSync as readFileSync38, writeFileSync as writeFileSync32 } from "fs";
|
|
21990
22153
|
import { basename as basename17, extname as extname2, resolve as resolve15 } from "path";
|
|
21991
22154
|
import chalk166 from "chalk";
|
|
21992
22155
|
|
|
@@ -22037,7 +22200,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
22037
22200
|
if (onlyIndex !== void 0 && idx !== onlyIndex) continue;
|
|
22038
22201
|
const outPath = resolve15(outDir, `${stem}-${idx}.svg`);
|
|
22039
22202
|
const svg = await renderBlock(krokiUrl, source);
|
|
22040
|
-
|
|
22203
|
+
writeFileSync32(outPath, svg, "utf8");
|
|
22041
22204
|
console.log(chalk166.green(` \u2192 ${outPath}`));
|
|
22042
22205
|
}
|
|
22043
22206
|
}
|
|
@@ -22050,7 +22213,7 @@ function extractMermaidBlocks(markdown) {
|
|
|
22050
22213
|
async function mermaidExport(file, options2 = {}) {
|
|
22051
22214
|
const { mermaid } = loadConfig();
|
|
22052
22215
|
const outDir = resolve16(process.cwd(), options2.out ?? ".");
|
|
22053
|
-
|
|
22216
|
+
mkdirSync18(outDir, { recursive: true });
|
|
22054
22217
|
if (options2.index !== void 0) {
|
|
22055
22218
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
22056
22219
|
console.error(
|
|
@@ -22170,15 +22333,15 @@ function createNetcapHandler(options2) {
|
|
|
22170
22333
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
22171
22334
|
import { cp, readFile as readFile4, writeFile as writeFile4 } from "fs/promises";
|
|
22172
22335
|
import { networkInterfaces } from "os";
|
|
22173
|
-
import { join as
|
|
22336
|
+
import { join as join58 } from "path";
|
|
22174
22337
|
import chalk168 from "chalk";
|
|
22175
22338
|
|
|
22176
22339
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
22177
|
-
import { dirname as dirname27, join as
|
|
22340
|
+
import { dirname as dirname27, join as join57 } from "path";
|
|
22178
22341
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
22179
22342
|
var moduleDir = dirname27(fileURLToPath6(import.meta.url));
|
|
22180
22343
|
function netcapExtensionDir() {
|
|
22181
|
-
return
|
|
22344
|
+
return join57(moduleDir, "commands", "netcap", "netcap-extension");
|
|
22182
22345
|
}
|
|
22183
22346
|
|
|
22184
22347
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
@@ -22193,7 +22356,7 @@ function lanIPv4() {
|
|
|
22193
22356
|
return void 0;
|
|
22194
22357
|
}
|
|
22195
22358
|
async function configureBackground(dir, host, port, filter) {
|
|
22196
|
-
const file =
|
|
22359
|
+
const file = join58(dir, "background.js");
|
|
22197
22360
|
const source = await readFile4(file, "utf8");
|
|
22198
22361
|
await writeFile4(
|
|
22199
22362
|
file,
|
|
@@ -22233,20 +22396,20 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
22233
22396
|
}
|
|
22234
22397
|
|
|
22235
22398
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
22236
|
-
import { isAbsolute as isAbsolute3, join as
|
|
22399
|
+
import { isAbsolute as isAbsolute3, join as join60, resolve as resolve17 } from "path";
|
|
22237
22400
|
|
|
22238
22401
|
// src/commands/netcap/defaultCapturePath.ts
|
|
22239
22402
|
import { homedir as homedir20 } from "os";
|
|
22240
|
-
import { join as
|
|
22403
|
+
import { join as join59 } from "path";
|
|
22241
22404
|
function defaultCapturePath() {
|
|
22242
|
-
return
|
|
22405
|
+
return join59(homedir20(), ".assist", "netcap", "capture.jsonl");
|
|
22243
22406
|
}
|
|
22244
22407
|
|
|
22245
22408
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
22246
22409
|
function resolveNetcapOutPath(out) {
|
|
22247
22410
|
if (!out) return defaultCapturePath();
|
|
22248
22411
|
const dir = isAbsolute3(out) ? out : resolve17(process.cwd(), out);
|
|
22249
|
-
return
|
|
22412
|
+
return join60(dir, "capture.jsonl");
|
|
22250
22413
|
}
|
|
22251
22414
|
|
|
22252
22415
|
// src/commands/netcap/netcap.ts
|
|
@@ -22292,8 +22455,8 @@ netcap stopped \u2014 captured ${count8} ${count8 === 1 ? "entry" : "entries"} t
|
|
|
22292
22455
|
}
|
|
22293
22456
|
|
|
22294
22457
|
// src/commands/netcap/netcapExtract.ts
|
|
22295
|
-
import { writeFileSync as
|
|
22296
|
-
import { join as
|
|
22458
|
+
import { writeFileSync as writeFileSync33 } from "fs";
|
|
22459
|
+
import { join as join61 } from "path";
|
|
22297
22460
|
import chalk170 from "chalk";
|
|
22298
22461
|
|
|
22299
22462
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
@@ -22738,8 +22901,8 @@ function extractPostsFromCapture(captureFile) {
|
|
|
22738
22901
|
function netcapExtract(file) {
|
|
22739
22902
|
const captureFile = file ?? defaultCapturePath();
|
|
22740
22903
|
const posts = extractPostsFromCapture(captureFile);
|
|
22741
|
-
const outFile =
|
|
22742
|
-
|
|
22904
|
+
const outFile = join61(captureFile, "..", "posts.json");
|
|
22905
|
+
writeFileSync33(outFile, `${JSON.stringify(posts, null, 2)}
|
|
22743
22906
|
`);
|
|
22744
22907
|
console.log(
|
|
22745
22908
|
chalk170.green(`extracted ${posts.length} posts`),
|
|
@@ -22913,13 +23076,13 @@ function postReviewComment(vars) {
|
|
|
22913
23076
|
}
|
|
22914
23077
|
|
|
22915
23078
|
// src/commands/prs/reviewProposedPrComment.ts
|
|
22916
|
-
import { randomUUID as
|
|
23079
|
+
import { randomUUID as randomUUID12 } from "crypto";
|
|
22917
23080
|
async function reviewProposedPrComment(title, body, prNumber) {
|
|
22918
23081
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
22919
23082
|
if (process.env.ASSIST_SESSION !== "1" || !sessionId) return;
|
|
22920
23083
|
await awaitPreviewApproval("PR comment preview", {
|
|
22921
23084
|
sessionId,
|
|
22922
|
-
requestId:
|
|
23085
|
+
requestId: randomUUID12(),
|
|
22923
23086
|
title,
|
|
22924
23087
|
body,
|
|
22925
23088
|
prNumber,
|
|
@@ -23045,7 +23208,7 @@ async function comment2(path80, line, body, startLine) {
|
|
|
23045
23208
|
}
|
|
23046
23209
|
|
|
23047
23210
|
// src/commands/prs/edit.ts
|
|
23048
|
-
import { randomUUID as
|
|
23211
|
+
import { randomUUID as randomUUID13 } from "crypto";
|
|
23049
23212
|
|
|
23050
23213
|
// src/commands/prs/appendScreenshots.ts
|
|
23051
23214
|
function appendScreenshots(body, screenshots) {
|
|
@@ -23058,13 +23221,13 @@ ${screenshots.join("\n\n")}`;
|
|
|
23058
23221
|
}
|
|
23059
23222
|
|
|
23060
23223
|
// src/commands/prs/applyEdit.ts
|
|
23061
|
-
import { execFileSync as
|
|
23224
|
+
import { execFileSync as execFileSync12 } from "child_process";
|
|
23062
23225
|
function applyEdit(number, title, body) {
|
|
23063
23226
|
const args = ["pr", "edit", String(number)];
|
|
23064
23227
|
if (title) args.push("--title", title);
|
|
23065
23228
|
args.push("--body", body);
|
|
23066
23229
|
try {
|
|
23067
|
-
|
|
23230
|
+
execFileSync12("gh", args, { stdio: "inherit" });
|
|
23068
23231
|
} catch {
|
|
23069
23232
|
process.exit(1);
|
|
23070
23233
|
}
|
|
@@ -23242,7 +23405,7 @@ async function edit(options2) {
|
|
|
23242
23405
|
if (process.env.ASSIST_SESSION === "1" && sessionId) {
|
|
23243
23406
|
const decision = await awaitPreviewApproval("PR preview", {
|
|
23244
23407
|
sessionId,
|
|
23245
|
-
requestId:
|
|
23408
|
+
requestId: randomUUID13(),
|
|
23246
23409
|
title: options2.title ?? title,
|
|
23247
23410
|
body: newBody,
|
|
23248
23411
|
prNumber: number
|
|
@@ -23262,19 +23425,19 @@ import { execSync as execSync45 } from "child_process";
|
|
|
23262
23425
|
|
|
23263
23426
|
// src/commands/prs/resolveCommentWithReply.ts
|
|
23264
23427
|
import { execSync as execSync44 } from "child_process";
|
|
23265
|
-
import { unlinkSync as unlinkSync14, writeFileSync as
|
|
23428
|
+
import { unlinkSync as unlinkSync14, writeFileSync as writeFileSync34 } from "fs";
|
|
23266
23429
|
import { tmpdir as tmpdir6 } from "os";
|
|
23267
|
-
import { join as
|
|
23430
|
+
import { join as join63 } from "path";
|
|
23268
23431
|
|
|
23269
23432
|
// src/commands/prs/loadCommentsCache.ts
|
|
23270
|
-
import { existsSync as
|
|
23433
|
+
import { existsSync as existsSync53, readFileSync as readFileSync40, unlinkSync as unlinkSync13 } from "fs";
|
|
23271
23434
|
import { parse as parse2 } from "yaml";
|
|
23272
23435
|
|
|
23273
23436
|
// src/commands/prs/commentsCachePath.ts
|
|
23274
23437
|
import { homedir as homedir21 } from "os";
|
|
23275
|
-
import { join as
|
|
23438
|
+
import { join as join62 } from "path";
|
|
23276
23439
|
function commentsCachePath(org, repo, prNumber) {
|
|
23277
|
-
return
|
|
23440
|
+
return join62(
|
|
23278
23441
|
homedir21(),
|
|
23279
23442
|
".assist",
|
|
23280
23443
|
"pr-comments",
|
|
@@ -23287,7 +23450,7 @@ function commentsCachePath(org, repo, prNumber) {
|
|
|
23287
23450
|
// src/commands/prs/loadCommentsCache.ts
|
|
23288
23451
|
function loadCommentsCache(org, repo, prNumber) {
|
|
23289
23452
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
23290
|
-
if (!
|
|
23453
|
+
if (!existsSync53(cachePath)) {
|
|
23291
23454
|
return null;
|
|
23292
23455
|
}
|
|
23293
23456
|
const content = readFileSync40(cachePath, "utf8");
|
|
@@ -23295,7 +23458,7 @@ function loadCommentsCache(org, repo, prNumber) {
|
|
|
23295
23458
|
}
|
|
23296
23459
|
function deleteCommentsCache(org, repo, prNumber) {
|
|
23297
23460
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
23298
|
-
if (
|
|
23461
|
+
if (existsSync53(cachePath)) {
|
|
23299
23462
|
unlinkSync13(cachePath);
|
|
23300
23463
|
console.log("No more unresolved line comments. Cache dropped.");
|
|
23301
23464
|
}
|
|
@@ -23323,8 +23486,8 @@ function replyToComment(org, repo, prNumber, commentId, message3) {
|
|
|
23323
23486
|
// src/commands/prs/resolveCommentWithReply.ts
|
|
23324
23487
|
function resolveThread(threadId) {
|
|
23325
23488
|
const mutation = `mutation($threadId: ID!) { resolveReviewThread(input: {threadId: $threadId}) { thread { isResolved } } }`;
|
|
23326
|
-
const queryFile =
|
|
23327
|
-
|
|
23489
|
+
const queryFile = join63(tmpdir6(), `gh-mutation-${Date.now()}.graphql`);
|
|
23490
|
+
writeFileSync34(queryFile, mutation);
|
|
23328
23491
|
try {
|
|
23329
23492
|
execSync44(
|
|
23330
23493
|
`gh api graphql -F query=@${queryFile} -f threadId="${threadId}"`,
|
|
@@ -23406,13 +23569,13 @@ function fixed(commentId, sha) {
|
|
|
23406
23569
|
|
|
23407
23570
|
// src/commands/prs/fetchThreadIds.ts
|
|
23408
23571
|
import { execSync as execSync46 } from "child_process";
|
|
23409
|
-
import { unlinkSync as unlinkSync15, writeFileSync as
|
|
23572
|
+
import { unlinkSync as unlinkSync15, writeFileSync as writeFileSync35 } from "fs";
|
|
23410
23573
|
import { tmpdir as tmpdir7 } from "os";
|
|
23411
|
-
import { join as
|
|
23574
|
+
import { join as join64 } from "path";
|
|
23412
23575
|
var THREAD_QUERY = `query($owner: String!, $repo: String!, $prNumber: Int!) { repository(owner: $owner, name: $repo) { pullRequest(number: $prNumber) { reviewThreads(first: 100) { nodes { id isResolved comments(first: 100) { nodes { databaseId } } } } } } }`;
|
|
23413
23576
|
function fetchThreadIds(org, repo, prNumber) {
|
|
23414
|
-
const queryFile =
|
|
23415
|
-
|
|
23577
|
+
const queryFile = join64(tmpdir7(), `gh-query-${Date.now()}.graphql`);
|
|
23578
|
+
writeFileSync35(queryFile, THREAD_QUERY);
|
|
23416
23579
|
try {
|
|
23417
23580
|
const result = execSync46(
|
|
23418
23581
|
`gh api graphql -F query=@${queryFile} -F owner="${org}" -F repo="${repo}" -F prNumber=${prNumber}`,
|
|
@@ -23480,16 +23643,16 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
23480
23643
|
}
|
|
23481
23644
|
|
|
23482
23645
|
// src/commands/prs/listComments/updateCommentsCache.ts
|
|
23483
|
-
import { mkdirSync as
|
|
23646
|
+
import { mkdirSync as mkdirSync19, writeFileSync as writeFileSync36 } from "fs";
|
|
23484
23647
|
import { dirname as dirname29 } from "path";
|
|
23485
23648
|
import { stringify } from "yaml";
|
|
23486
23649
|
|
|
23487
23650
|
// src/commands/prs/removeStaleCommentsCaches.ts
|
|
23488
23651
|
import { readdirSync as readdirSync12, unlinkSync as unlinkSync16 } from "fs";
|
|
23489
|
-
import { join as
|
|
23652
|
+
import { join as join65 } from "path";
|
|
23490
23653
|
var STALE_PATTERN = /^pr-\d+-comments\.yaml$/;
|
|
23491
23654
|
function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
23492
|
-
const dir =
|
|
23655
|
+
const dir = join65(cwd, ".assist");
|
|
23493
23656
|
let entries;
|
|
23494
23657
|
try {
|
|
23495
23658
|
entries = readdirSync12(dir);
|
|
@@ -23497,20 +23660,20 @@ function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
|
23497
23660
|
return;
|
|
23498
23661
|
}
|
|
23499
23662
|
for (const entry of entries.filter((e) => STALE_PATTERN.test(e))) {
|
|
23500
|
-
unlinkSync16(
|
|
23663
|
+
unlinkSync16(join65(dir, entry));
|
|
23501
23664
|
}
|
|
23502
23665
|
}
|
|
23503
23666
|
|
|
23504
23667
|
// src/commands/prs/listComments/updateCommentsCache.ts
|
|
23505
23668
|
function writeCommentsCache(org, repo, prNumber, comments3) {
|
|
23506
23669
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
23507
|
-
|
|
23670
|
+
mkdirSync19(dirname29(cachePath), { recursive: true });
|
|
23508
23671
|
const cacheData = {
|
|
23509
23672
|
prNumber,
|
|
23510
23673
|
fetchedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
23511
23674
|
comments: comments3
|
|
23512
23675
|
};
|
|
23513
|
-
|
|
23676
|
+
writeFileSync36(cachePath, stringify(cacheData));
|
|
23514
23677
|
}
|
|
23515
23678
|
function updateCommentsCache(org, repo, prNumber, comments3) {
|
|
23516
23679
|
removeStaleCommentsCaches();
|
|
@@ -23860,7 +24023,7 @@ function buildValidatedBody(options2, usage) {
|
|
|
23860
24023
|
}
|
|
23861
24024
|
|
|
23862
24025
|
// src/commands/prs/placePr.ts
|
|
23863
|
-
import { execFileSync as
|
|
24026
|
+
import { execFileSync as execFileSync13 } from "child_process";
|
|
23864
24027
|
|
|
23865
24028
|
// src/commands/prs/buildCreateArgs.ts
|
|
23866
24029
|
function buildEditArgs(number, title, body) {
|
|
@@ -23927,7 +24090,7 @@ async function recordPrActivity() {
|
|
|
23927
24090
|
// src/commands/prs/placePr.ts
|
|
23928
24091
|
function hasUpstream2() {
|
|
23929
24092
|
try {
|
|
23930
|
-
|
|
24093
|
+
execFileSync13(
|
|
23931
24094
|
"git",
|
|
23932
24095
|
["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}"],
|
|
23933
24096
|
{ stdio: "pipe" }
|
|
@@ -23939,13 +24102,13 @@ function hasUpstream2() {
|
|
|
23939
24102
|
}
|
|
23940
24103
|
function ensureBranchPushed() {
|
|
23941
24104
|
const args = hasUpstream2() ? ["push"] : ["push", "--set-upstream", "origin", "HEAD"];
|
|
23942
|
-
|
|
24105
|
+
execFileSync13("git", args, { stdio: "inherit" });
|
|
23943
24106
|
}
|
|
23944
24107
|
async function placePr(prNumber, title, body, options2) {
|
|
23945
24108
|
const args = prNumber !== null ? buildEditArgs(prNumber, title, body) : buildCreateArgs(title, body, options2);
|
|
23946
24109
|
try {
|
|
23947
24110
|
if (prNumber === null && !options2.head) ensureBranchPushed();
|
|
23948
|
-
|
|
24111
|
+
execFileSync13("gh", args, { stdio: "inherit" });
|
|
23949
24112
|
} catch {
|
|
23950
24113
|
process.exit(1);
|
|
23951
24114
|
}
|
|
@@ -23953,7 +24116,7 @@ async function placePr(prNumber, title, body, options2) {
|
|
|
23953
24116
|
}
|
|
23954
24117
|
|
|
23955
24118
|
// src/commands/prs/previewAndPlace.ts
|
|
23956
|
-
import { randomUUID as
|
|
24119
|
+
import { randomUUID as randomUUID14 } from "crypto";
|
|
23957
24120
|
|
|
23958
24121
|
// src/commands/sessions/shared/requestSession.ts
|
|
23959
24122
|
function parseIncoming(line, type) {
|
|
@@ -24088,7 +24251,7 @@ function warn(reason4) {
|
|
|
24088
24251
|
async function previewAndPlace(args) {
|
|
24089
24252
|
const decision = await awaitPreviewApproval("PR preview", {
|
|
24090
24253
|
sessionId: args.sessionId,
|
|
24091
|
-
requestId:
|
|
24254
|
+
requestId: randomUUID14(),
|
|
24092
24255
|
title: args.title,
|
|
24093
24256
|
body: args.body,
|
|
24094
24257
|
prNumber: args.prNumber,
|
|
@@ -24108,9 +24271,9 @@ function resolveDraftState(options2, command) {
|
|
|
24108
24271
|
}
|
|
24109
24272
|
|
|
24110
24273
|
// src/commands/prs/raise.ts
|
|
24111
|
-
var
|
|
24274
|
+
var USAGE4 = "Usage: assist prs raise --title <title> --what <what> --why <why> [--how <how>] [--resolves <key>] [--force]";
|
|
24112
24275
|
async function raise(options2, command) {
|
|
24113
|
-
const { title, body } = buildValidatedBody(options2,
|
|
24276
|
+
const { title, body } = buildValidatedBody(options2, USAGE4);
|
|
24114
24277
|
const resolved = { ...options2, draft: resolveDraftState(options2, command) };
|
|
24115
24278
|
const existing = findCurrentPrNumber();
|
|
24116
24279
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
@@ -26560,10 +26723,10 @@ function registerRefactor(program2) {
|
|
|
26560
26723
|
}
|
|
26561
26724
|
|
|
26562
26725
|
// src/commands/review/checkoutOnlySession.ts
|
|
26563
|
-
import { randomUUID as
|
|
26726
|
+
import { randomUUID as randomUUID15 } from "crypto";
|
|
26564
26727
|
async function checkoutOnlySession(number) {
|
|
26565
26728
|
await checkoutPr(number);
|
|
26566
|
-
const claudeSessionId =
|
|
26729
|
+
const claudeSessionId = randomUUID15();
|
|
26567
26730
|
emitActivity({ kind: "command", name: "review", claudeSessionId });
|
|
26568
26731
|
const { done: done2 } = spawnClaude("", {
|
|
26569
26732
|
permissionMode: "acceptEdits",
|
|
@@ -26686,9 +26849,9 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
|
|
|
26686
26849
|
|
|
26687
26850
|
// src/commands/review/buildReviewPaths.ts
|
|
26688
26851
|
import { homedir as homedir22 } from "os";
|
|
26689
|
-
import { basename as basename18, join as
|
|
26852
|
+
import { basename as basename18, join as join66 } from "path";
|
|
26690
26853
|
function buildReviewPaths(repoRoot2, key) {
|
|
26691
|
-
const reviewDir =
|
|
26854
|
+
const reviewDir = join66(
|
|
26692
26855
|
homedir22(),
|
|
26693
26856
|
".assist",
|
|
26694
26857
|
"reviews",
|
|
@@ -26697,10 +26860,10 @@ function buildReviewPaths(repoRoot2, key) {
|
|
|
26697
26860
|
);
|
|
26698
26861
|
return {
|
|
26699
26862
|
reviewDir,
|
|
26700
|
-
requestPath:
|
|
26701
|
-
claudePath:
|
|
26702
|
-
codexPath:
|
|
26703
|
-
synthesisPath:
|
|
26863
|
+
requestPath: join66(reviewDir, "request.md"),
|
|
26864
|
+
claudePath: join66(reviewDir, "claude.md"),
|
|
26865
|
+
codexPath: join66(reviewDir, "codex.md"),
|
|
26866
|
+
synthesisPath: join66(reviewDir, "synthesis.md")
|
|
26704
26867
|
};
|
|
26705
26868
|
}
|
|
26706
26869
|
|
|
@@ -27426,16 +27589,16 @@ async function handlePostSynthesis(synthesisPath, prInfo, options2) {
|
|
|
27426
27589
|
}
|
|
27427
27590
|
|
|
27428
27591
|
// src/commands/review/prepareReviewDir.ts
|
|
27429
|
-
import { existsSync as
|
|
27592
|
+
import { existsSync as existsSync54, mkdirSync as mkdirSync20, unlinkSync as unlinkSync17, writeFileSync as writeFileSync37 } from "fs";
|
|
27430
27593
|
function clearReviewFiles(paths) {
|
|
27431
27594
|
for (const path80 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
27432
|
-
if (
|
|
27595
|
+
if (existsSync54(path80)) unlinkSync17(path80);
|
|
27433
27596
|
}
|
|
27434
27597
|
}
|
|
27435
27598
|
function prepareReviewDir(paths, requestBody, force) {
|
|
27436
|
-
|
|
27599
|
+
mkdirSync20(paths.reviewDir, { recursive: true });
|
|
27437
27600
|
if (force) clearReviewFiles(paths);
|
|
27438
|
-
|
|
27601
|
+
writeFileSync37(paths.requestPath, requestBody);
|
|
27439
27602
|
}
|
|
27440
27603
|
|
|
27441
27604
|
// src/commands/review/cachedReviewerResult.ts
|
|
@@ -27656,7 +27819,7 @@ function printReviewerFailures(results) {
|
|
|
27656
27819
|
}
|
|
27657
27820
|
|
|
27658
27821
|
// src/commands/review/runAndSynthesise.ts
|
|
27659
|
-
import { existsSync as
|
|
27822
|
+
import { existsSync as existsSync56, unlinkSync as unlinkSync19 } from "fs";
|
|
27660
27823
|
|
|
27661
27824
|
// src/commands/review/buildReviewerStdin.ts
|
|
27662
27825
|
var REVIEW_PROMPT = `You are acting as a reviewer for a proposed code change made by another engineer. The full review request \u2014 branch, base, changed files, and unified diff \u2014 is in the request file whose absolute path is given below.
|
|
@@ -27731,7 +27894,7 @@ The review request is at: ${requestPath}
|
|
|
27731
27894
|
}
|
|
27732
27895
|
|
|
27733
27896
|
// src/commands/review/runClaudeReviewer.ts
|
|
27734
|
-
import { writeFileSync as
|
|
27897
|
+
import { writeFileSync as writeFileSync38 } from "fs";
|
|
27735
27898
|
|
|
27736
27899
|
// src/commands/review/finaliseReviewerSpinner.ts
|
|
27737
27900
|
var SUMMARY_MAX_LEN = 80;
|
|
@@ -28067,7 +28230,7 @@ async function runClaudeReviewer(spec) {
|
|
|
28067
28230
|
}
|
|
28068
28231
|
});
|
|
28069
28232
|
if (result.exitCode === 0 && finalText)
|
|
28070
|
-
|
|
28233
|
+
writeFileSync38(spec.outputPath, finalText);
|
|
28071
28234
|
return finaliseReviewerRun({ ...spec, command }, spinner, result);
|
|
28072
28235
|
}
|
|
28073
28236
|
|
|
@@ -28085,7 +28248,7 @@ function resolveClaude(args) {
|
|
|
28085
28248
|
}
|
|
28086
28249
|
|
|
28087
28250
|
// src/commands/review/runCodexReviewer.ts
|
|
28088
|
-
import { existsSync as
|
|
28251
|
+
import { existsSync as existsSync55, unlinkSync as unlinkSync18 } from "fs";
|
|
28089
28252
|
|
|
28090
28253
|
// src/commands/review/parseCodexEvent.ts
|
|
28091
28254
|
function isItemStarted(value) {
|
|
@@ -28137,7 +28300,7 @@ async function runCodexReviewer(spec) {
|
|
|
28137
28300
|
reportReviewerToolUse(spec.name, event, spinner);
|
|
28138
28301
|
}
|
|
28139
28302
|
});
|
|
28140
|
-
if (result.exitCode !== 0 &&
|
|
28303
|
+
if (result.exitCode !== 0 && existsSync55(spec.outputPath)) {
|
|
28141
28304
|
unlinkSync18(spec.outputPath);
|
|
28142
28305
|
}
|
|
28143
28306
|
return finaliseReviewerRun({ ...spec, command }, spinner, result);
|
|
@@ -28292,7 +28455,7 @@ async function runAndSynthesise(args) {
|
|
|
28292
28455
|
console.error("Both reviewers failed; skipping synthesis.");
|
|
28293
28456
|
return { ok: false, failures };
|
|
28294
28457
|
}
|
|
28295
|
-
if (anyFresh &&
|
|
28458
|
+
if (anyFresh && existsSync56(paths.synthesisPath)) {
|
|
28296
28459
|
unlinkSync19(paths.synthesisPath);
|
|
28297
28460
|
}
|
|
28298
28461
|
const synthesisResult = await synthesise(paths, { multi });
|
|
@@ -29591,27 +29754,27 @@ async function configure() {
|
|
|
29591
29754
|
}
|
|
29592
29755
|
|
|
29593
29756
|
// src/commands/transcript/list.ts
|
|
29594
|
-
import { existsSync as
|
|
29595
|
-
import { join as
|
|
29757
|
+
import { existsSync as existsSync61, readdirSync as readdirSync19, statSync as statSync10 } from "fs";
|
|
29758
|
+
import { join as join77 } from "path";
|
|
29596
29759
|
function list4() {
|
|
29597
29760
|
const { vttDir } = getTranscriptConfig();
|
|
29598
|
-
if (!
|
|
29761
|
+
if (!existsSync61(vttDir)) return;
|
|
29599
29762
|
for (const entry of readdirSync19(vttDir)) {
|
|
29600
29763
|
if (!entry.endsWith(".vtt")) continue;
|
|
29601
|
-
if (statSync10(
|
|
29764
|
+
if (statSync10(join77(vttDir, entry)).isDirectory()) continue;
|
|
29602
29765
|
console.log(entry);
|
|
29603
29766
|
}
|
|
29604
29767
|
}
|
|
29605
29768
|
|
|
29606
29769
|
// src/commands/transcript/move.ts
|
|
29607
29770
|
import {
|
|
29608
|
-
existsSync as
|
|
29609
|
-
mkdirSync as
|
|
29771
|
+
existsSync as existsSync62,
|
|
29772
|
+
mkdirSync as mkdirSync26,
|
|
29610
29773
|
readFileSync as readFileSync47,
|
|
29611
29774
|
renameSync as renameSync2,
|
|
29612
|
-
writeFileSync as
|
|
29775
|
+
writeFileSync as writeFileSync42
|
|
29613
29776
|
} from "fs";
|
|
29614
|
-
import { basename as basename21, join as
|
|
29777
|
+
import { basename as basename21, join as join78 } from "path";
|
|
29615
29778
|
|
|
29616
29779
|
// src/commands/transcript/cleanText.ts
|
|
29617
29780
|
function cleanText(text18) {
|
|
@@ -29824,9 +29987,9 @@ function convertVttToMarkdown(inputPath) {
|
|
|
29824
29987
|
return formatChatLog(messages);
|
|
29825
29988
|
}
|
|
29826
29989
|
function archiveRawVtt(vttDir, sourcePath, filename) {
|
|
29827
|
-
const processedDir =
|
|
29828
|
-
|
|
29829
|
-
renameSync2(sourcePath,
|
|
29990
|
+
const processedDir = join78(vttDir, "processed");
|
|
29991
|
+
mkdirSync26(processedDir, { recursive: true });
|
|
29992
|
+
renameSync2(sourcePath, join78(processedDir, filename));
|
|
29830
29993
|
}
|
|
29831
29994
|
function move(file, options2) {
|
|
29832
29995
|
const { date, client } = options2;
|
|
@@ -29836,19 +29999,19 @@ function move(file, options2) {
|
|
|
29836
29999
|
}
|
|
29837
30000
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
29838
30001
|
const filename = basename21(file);
|
|
29839
|
-
const sourcePath =
|
|
29840
|
-
if (!
|
|
30002
|
+
const sourcePath = join78(vttDir, filename);
|
|
30003
|
+
if (!existsSync62(sourcePath)) {
|
|
29841
30004
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
29842
30005
|
process.exit(1);
|
|
29843
30006
|
}
|
|
29844
30007
|
const base = basename21(filename, ".vtt").replace(/ Transcription$/, "");
|
|
29845
30008
|
const outputName = `${date} ${base}.md`;
|
|
29846
|
-
const formattedDir =
|
|
29847
|
-
|
|
29848
|
-
const formattedPath =
|
|
29849
|
-
|
|
30009
|
+
const formattedDir = join78(transcriptsDir, client);
|
|
30010
|
+
mkdirSync26(formattedDir, { recursive: true });
|
|
30011
|
+
const formattedPath = join78(formattedDir, outputName);
|
|
30012
|
+
writeFileSync42(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
|
|
29850
30013
|
archiveRawVtt(vttDir, sourcePath, filename);
|
|
29851
|
-
const summaryPath =
|
|
30014
|
+
const summaryPath = join78(summaryDir, client, outputName);
|
|
29852
30015
|
console.log(`Formatted transcript: ${formattedPath}`);
|
|
29853
30016
|
console.log(`Summary target: ${summaryPath}`);
|
|
29854
30017
|
}
|
|
@@ -29930,45 +30093,45 @@ function registerVerify(program2) {
|
|
|
29930
30093
|
|
|
29931
30094
|
// src/commands/voice/devices.ts
|
|
29932
30095
|
import { spawnSync as spawnSync7 } from "child_process";
|
|
29933
|
-
import { join as
|
|
30096
|
+
import { join as join80 } from "path";
|
|
29934
30097
|
|
|
29935
30098
|
// src/commands/voice/shared.ts
|
|
29936
30099
|
import { homedir as homedir24 } from "os";
|
|
29937
|
-
import { dirname as dirname34, join as
|
|
30100
|
+
import { dirname as dirname34, join as join79 } from "path";
|
|
29938
30101
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
29939
30102
|
var __dirname6 = dirname34(fileURLToPath8(import.meta.url));
|
|
29940
|
-
var VOICE_DIR =
|
|
30103
|
+
var VOICE_DIR = join79(homedir24(), ".assist", "voice");
|
|
29941
30104
|
var voicePaths = {
|
|
29942
30105
|
dir: VOICE_DIR,
|
|
29943
|
-
pid:
|
|
29944
|
-
log:
|
|
29945
|
-
venv:
|
|
29946
|
-
lock:
|
|
30106
|
+
pid: join79(VOICE_DIR, "voice.pid"),
|
|
30107
|
+
log: join79(VOICE_DIR, "voice.log"),
|
|
30108
|
+
venv: join79(VOICE_DIR, ".venv"),
|
|
30109
|
+
lock: join79(VOICE_DIR, "voice.lock")
|
|
29947
30110
|
};
|
|
29948
30111
|
function getPythonDir() {
|
|
29949
|
-
return
|
|
30112
|
+
return join79(__dirname6, "commands", "voice", "python");
|
|
29950
30113
|
}
|
|
29951
30114
|
function getVenvPython() {
|
|
29952
|
-
return process.platform === "win32" ?
|
|
30115
|
+
return process.platform === "win32" ? join79(voicePaths.venv, "Scripts", "python.exe") : join79(voicePaths.venv, "bin", "python");
|
|
29953
30116
|
}
|
|
29954
30117
|
function getLockDir() {
|
|
29955
30118
|
const config = loadConfig();
|
|
29956
30119
|
return config.voice?.lockDir ?? VOICE_DIR;
|
|
29957
30120
|
}
|
|
29958
30121
|
function getLockFile() {
|
|
29959
|
-
return
|
|
30122
|
+
return join79(getLockDir(), "voice.lock");
|
|
29960
30123
|
}
|
|
29961
30124
|
|
|
29962
30125
|
// src/commands/voice/devices.ts
|
|
29963
30126
|
function devices() {
|
|
29964
|
-
const script =
|
|
30127
|
+
const script = join80(getPythonDir(), "list_devices.py");
|
|
29965
30128
|
spawnSync7(getVenvPython(), [script], { stdio: "inherit" });
|
|
29966
30129
|
}
|
|
29967
30130
|
|
|
29968
30131
|
// src/commands/voice/logs.ts
|
|
29969
|
-
import { existsSync as
|
|
30132
|
+
import { existsSync as existsSync63, readFileSync as readFileSync48 } from "fs";
|
|
29970
30133
|
function logs(options2) {
|
|
29971
|
-
if (!
|
|
30134
|
+
if (!existsSync63(voicePaths.log)) {
|
|
29972
30135
|
console.log("No voice log file found");
|
|
29973
30136
|
return;
|
|
29974
30137
|
}
|
|
@@ -29995,13 +30158,13 @@ function logs(options2) {
|
|
|
29995
30158
|
|
|
29996
30159
|
// src/commands/voice/setup.ts
|
|
29997
30160
|
import { spawnSync as spawnSync8 } from "child_process";
|
|
29998
|
-
import { mkdirSync as
|
|
29999
|
-
import { join as
|
|
30161
|
+
import { mkdirSync as mkdirSync28 } from "fs";
|
|
30162
|
+
import { join as join82 } from "path";
|
|
30000
30163
|
|
|
30001
30164
|
// src/commands/voice/checkLockFile.ts
|
|
30002
30165
|
import { execSync as execSync58 } from "child_process";
|
|
30003
|
-
import { existsSync as
|
|
30004
|
-
import { join as
|
|
30166
|
+
import { existsSync as existsSync64, mkdirSync as mkdirSync27, readFileSync as readFileSync49, writeFileSync as writeFileSync43 } from "fs";
|
|
30167
|
+
import { join as join81 } from "path";
|
|
30005
30168
|
function isProcessAlive2(pid) {
|
|
30006
30169
|
try {
|
|
30007
30170
|
process.kill(pid, 0);
|
|
@@ -30012,7 +30175,7 @@ function isProcessAlive2(pid) {
|
|
|
30012
30175
|
}
|
|
30013
30176
|
function checkLockFile() {
|
|
30014
30177
|
const lockFile = getLockFile();
|
|
30015
|
-
if (!
|
|
30178
|
+
if (!existsSync64(lockFile)) return;
|
|
30016
30179
|
try {
|
|
30017
30180
|
const lock2 = JSON.parse(readFileSync49(lockFile, "utf8"));
|
|
30018
30181
|
if (lock2.pid && isProcessAlive2(lock2.pid)) {
|
|
@@ -30025,7 +30188,7 @@ function checkLockFile() {
|
|
|
30025
30188
|
}
|
|
30026
30189
|
}
|
|
30027
30190
|
function bootstrapVenv() {
|
|
30028
|
-
if (
|
|
30191
|
+
if (existsSync64(getVenvPython())) return;
|
|
30029
30192
|
console.log("Setting up Python environment...");
|
|
30030
30193
|
const pythonDir = getPythonDir();
|
|
30031
30194
|
execSync58(
|
|
@@ -30038,8 +30201,8 @@ function bootstrapVenv() {
|
|
|
30038
30201
|
}
|
|
30039
30202
|
function writeLockFile(pid) {
|
|
30040
30203
|
const lockFile = getLockFile();
|
|
30041
|
-
|
|
30042
|
-
|
|
30204
|
+
mkdirSync27(join81(lockFile, ".."), { recursive: true });
|
|
30205
|
+
writeFileSync43(
|
|
30043
30206
|
lockFile,
|
|
30044
30207
|
JSON.stringify({
|
|
30045
30208
|
pid,
|
|
@@ -30051,10 +30214,10 @@ function writeLockFile(pid) {
|
|
|
30051
30214
|
|
|
30052
30215
|
// src/commands/voice/setup.ts
|
|
30053
30216
|
function setup() {
|
|
30054
|
-
|
|
30217
|
+
mkdirSync28(voicePaths.dir, { recursive: true });
|
|
30055
30218
|
bootstrapVenv();
|
|
30056
30219
|
console.log("\nDownloading models...\n");
|
|
30057
|
-
const script =
|
|
30220
|
+
const script = join82(getPythonDir(), "setup_models.py");
|
|
30058
30221
|
const result = spawnSync8(getVenvPython(), [script], {
|
|
30059
30222
|
stdio: "inherit",
|
|
30060
30223
|
env: { ...process.env, VOICE_LOG_FILE: voicePaths.log }
|
|
@@ -30067,8 +30230,8 @@ function setup() {
|
|
|
30067
30230
|
|
|
30068
30231
|
// src/commands/voice/start.ts
|
|
30069
30232
|
import { spawn as spawn8 } from "child_process";
|
|
30070
|
-
import { mkdirSync as
|
|
30071
|
-
import { join as
|
|
30233
|
+
import { mkdirSync as mkdirSync29, writeFileSync as writeFileSync44 } from "fs";
|
|
30234
|
+
import { join as join83 } from "path";
|
|
30072
30235
|
|
|
30073
30236
|
// src/commands/voice/buildDaemonEnv.ts
|
|
30074
30237
|
function buildDaemonEnv(options2) {
|
|
@@ -30096,17 +30259,17 @@ function spawnBackground(python, script, env) {
|
|
|
30096
30259
|
console.error("Failed to start voice daemon");
|
|
30097
30260
|
process.exit(1);
|
|
30098
30261
|
}
|
|
30099
|
-
|
|
30262
|
+
writeFileSync44(voicePaths.pid, String(pid));
|
|
30100
30263
|
writeLockFile(pid);
|
|
30101
30264
|
console.log(`Voice daemon started (PID ${pid})`);
|
|
30102
30265
|
}
|
|
30103
30266
|
function start2(options2) {
|
|
30104
|
-
|
|
30267
|
+
mkdirSync29(voicePaths.dir, { recursive: true });
|
|
30105
30268
|
checkLockFile();
|
|
30106
30269
|
bootstrapVenv();
|
|
30107
30270
|
const debug = options2.debug || options2.foreground || process.platform === "win32";
|
|
30108
30271
|
const env = buildDaemonEnv({ debug });
|
|
30109
|
-
const script =
|
|
30272
|
+
const script = join83(getPythonDir(), "voice_daemon.py");
|
|
30110
30273
|
const python = getVenvPython();
|
|
30111
30274
|
if (options2.foreground) {
|
|
30112
30275
|
spawnForeground(python, script, env);
|
|
@@ -30116,7 +30279,7 @@ function start2(options2) {
|
|
|
30116
30279
|
}
|
|
30117
30280
|
|
|
30118
30281
|
// src/commands/voice/status.ts
|
|
30119
|
-
import { existsSync as
|
|
30282
|
+
import { existsSync as existsSync65, readFileSync as readFileSync50 } from "fs";
|
|
30120
30283
|
function isProcessAlive3(pid) {
|
|
30121
30284
|
try {
|
|
30122
30285
|
process.kill(pid, 0);
|
|
@@ -30126,12 +30289,12 @@ function isProcessAlive3(pid) {
|
|
|
30126
30289
|
}
|
|
30127
30290
|
}
|
|
30128
30291
|
function readRecentLogs(count8) {
|
|
30129
|
-
if (!
|
|
30292
|
+
if (!existsSync65(voicePaths.log)) return [];
|
|
30130
30293
|
const lines2 = readFileSync50(voicePaths.log, "utf8").trim().split("\n");
|
|
30131
30294
|
return lines2.slice(-count8);
|
|
30132
30295
|
}
|
|
30133
30296
|
function status2() {
|
|
30134
|
-
if (!
|
|
30297
|
+
if (!existsSync65(voicePaths.pid)) {
|
|
30135
30298
|
console.log("Voice daemon: not running (no PID file)");
|
|
30136
30299
|
return;
|
|
30137
30300
|
}
|
|
@@ -30154,9 +30317,9 @@ function status2() {
|
|
|
30154
30317
|
}
|
|
30155
30318
|
|
|
30156
30319
|
// src/commands/voice/stop.ts
|
|
30157
|
-
import { existsSync as
|
|
30320
|
+
import { existsSync as existsSync66, readFileSync as readFileSync51, unlinkSync as unlinkSync20 } from "fs";
|
|
30158
30321
|
function stop2() {
|
|
30159
|
-
if (!
|
|
30322
|
+
if (!existsSync66(voicePaths.pid)) {
|
|
30160
30323
|
console.log("Voice daemon is not running (no PID file)");
|
|
30161
30324
|
return;
|
|
30162
30325
|
}
|
|
@@ -30173,7 +30336,7 @@ function stop2() {
|
|
|
30173
30336
|
}
|
|
30174
30337
|
try {
|
|
30175
30338
|
const lockFile = getLockFile();
|
|
30176
|
-
if (
|
|
30339
|
+
if (existsSync66(lockFile)) unlinkSync20(lockFile);
|
|
30177
30340
|
} catch {
|
|
30178
30341
|
}
|
|
30179
30342
|
console.log("Voice daemon stopped");
|
|
@@ -30192,12 +30355,12 @@ function registerVoice(program2) {
|
|
|
30192
30355
|
}
|
|
30193
30356
|
|
|
30194
30357
|
// src/commands/watch/readBuiltVersion.ts
|
|
30195
|
-
import { join as
|
|
30358
|
+
import { join as join84 } from "path";
|
|
30196
30359
|
|
|
30197
30360
|
// src/commands/watch/resolveUpstream.ts
|
|
30198
|
-
import { execFileSync as
|
|
30199
|
-
function
|
|
30200
|
-
return
|
|
30361
|
+
import { execFileSync as execFileSync14 } from "child_process";
|
|
30362
|
+
function runGit3(args, cwd) {
|
|
30363
|
+
return execFileSync14("git", args, {
|
|
30201
30364
|
encoding: "utf8",
|
|
30202
30365
|
stdio: ["pipe", "pipe", "pipe"],
|
|
30203
30366
|
cwd
|
|
@@ -30205,7 +30368,7 @@ function runGit2(args, cwd) {
|
|
|
30205
30368
|
}
|
|
30206
30369
|
function resolveUpstream(cwd) {
|
|
30207
30370
|
try {
|
|
30208
|
-
|
|
30371
|
+
runGit3(["rev-parse", "--is-inside-work-tree"], cwd);
|
|
30209
30372
|
} catch {
|
|
30210
30373
|
throw new Error(
|
|
30211
30374
|
"not a git repository \u2014 run assist watch wait from inside a repo"
|
|
@@ -30213,7 +30376,7 @@ function resolveUpstream(cwd) {
|
|
|
30213
30376
|
}
|
|
30214
30377
|
let branch2;
|
|
30215
30378
|
try {
|
|
30216
|
-
branch2 =
|
|
30379
|
+
branch2 = runGit3(["symbolic-ref", "--quiet", "--short", "HEAD"], cwd);
|
|
30217
30380
|
} catch {
|
|
30218
30381
|
throw new Error(
|
|
30219
30382
|
"HEAD is detached \u2014 check out a branch before waiting on its upstream"
|
|
@@ -30222,7 +30385,7 @@ function resolveUpstream(cwd) {
|
|
|
30222
30385
|
try {
|
|
30223
30386
|
return {
|
|
30224
30387
|
branch: branch2,
|
|
30225
|
-
upstream:
|
|
30388
|
+
upstream: runGit3(
|
|
30226
30389
|
["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}"],
|
|
30227
30390
|
cwd
|
|
30228
30391
|
)
|
|
@@ -30237,8 +30400,8 @@ function resolveUpstream(cwd) {
|
|
|
30237
30400
|
// src/commands/watch/readBuiltVersion.ts
|
|
30238
30401
|
function readBuiltVersion(cwd) {
|
|
30239
30402
|
try {
|
|
30240
|
-
const root =
|
|
30241
|
-
return readPackageJson(
|
|
30403
|
+
const root = runGit3(["rev-parse", "--show-toplevel"], cwd);
|
|
30404
|
+
return readPackageJson(join84(root, "package.json")).version ?? "unknown";
|
|
30242
30405
|
} catch {
|
|
30243
30406
|
return "unknown";
|
|
30244
30407
|
}
|
|
@@ -30246,7 +30409,7 @@ function readBuiltVersion(cwd) {
|
|
|
30246
30409
|
|
|
30247
30410
|
// src/commands/watch/readRecentCommits.ts
|
|
30248
30411
|
function readRecentCommits(count8 = 10, cwd) {
|
|
30249
|
-
const output =
|
|
30412
|
+
const output = runGit3(
|
|
30250
30413
|
["log", `-${count8}`, "--pretty=format:%H%x09%h%x09%ar%x09%s"],
|
|
30251
30414
|
cwd
|
|
30252
30415
|
);
|
|
@@ -30309,9 +30472,9 @@ function buildWatchReport(from, cwd) {
|
|
|
30309
30472
|
return renderWatchReport({
|
|
30310
30473
|
version: readBuiltVersion(cwd),
|
|
30311
30474
|
commits: readRecentCommits(10, cwd),
|
|
30312
|
-
newShas: range ? lines(
|
|
30475
|
+
newShas: range ? lines(runGit3(["rev-list", range], cwd)) : [],
|
|
30313
30476
|
restarts: restartAdvice(
|
|
30314
|
-
range ? lines(
|
|
30477
|
+
range ? lines(runGit3(["diff", "--name-only", range], cwd)) : []
|
|
30315
30478
|
)
|
|
30316
30479
|
});
|
|
30317
30480
|
}
|
|
@@ -30409,14 +30572,14 @@ function parseWatchDurations(interval, timeout) {
|
|
|
30409
30572
|
var STASH_MESSAGE = "assist watch";
|
|
30410
30573
|
function attemptGit(args, cwd) {
|
|
30411
30574
|
try {
|
|
30412
|
-
|
|
30575
|
+
runGit3(args, cwd);
|
|
30413
30576
|
return { ok: true };
|
|
30414
30577
|
} catch (error) {
|
|
30415
30578
|
return { ok: false, reason: gitFailureReason(error) };
|
|
30416
30579
|
}
|
|
30417
30580
|
}
|
|
30418
30581
|
function fastForwarded(cwd) {
|
|
30419
|
-
return { kind: "fast-forwarded", sha:
|
|
30582
|
+
return { kind: "fast-forwarded", sha: runGit3(["rev-parse", "@"], cwd) };
|
|
30420
30583
|
}
|
|
30421
30584
|
function operationInProgress(cwd) {
|
|
30422
30585
|
return ["MERGE_HEAD", "REBASE_HEAD"].some(
|
|
@@ -30425,7 +30588,7 @@ function operationInProgress(cwd) {
|
|
|
30425
30588
|
}
|
|
30426
30589
|
function headMatchesUpstream(cwd) {
|
|
30427
30590
|
try {
|
|
30428
|
-
return
|
|
30591
|
+
return runGit3(["rev-parse", "@"], cwd) === runGit3(["rev-parse", "@{u}"], cwd);
|
|
30429
30592
|
} catch {
|
|
30430
30593
|
return false;
|
|
30431
30594
|
}
|
|
@@ -30436,7 +30599,7 @@ function behindUpstream(cwd) {
|
|
|
30436
30599
|
function stashDirtyTree(cwd) {
|
|
30437
30600
|
let dirty;
|
|
30438
30601
|
try {
|
|
30439
|
-
dirty =
|
|
30602
|
+
dirty = runGit3(["status", "--porcelain"], cwd) !== "";
|
|
30440
30603
|
} catch (error) {
|
|
30441
30604
|
return { ok: false, reason: gitFailureReason(error) };
|
|
30442
30605
|
}
|
|
@@ -30536,7 +30699,7 @@ function resolveParams(params, cliArgs) {
|
|
|
30536
30699
|
}
|
|
30537
30700
|
|
|
30538
30701
|
// src/commands/run/resolveRunCwd.ts
|
|
30539
|
-
import { existsSync as
|
|
30702
|
+
import { existsSync as existsSync67 } from "fs";
|
|
30540
30703
|
import { resolve as resolve18 } from "path";
|
|
30541
30704
|
var MissingRunCwdError = class extends Error {
|
|
30542
30705
|
constructor(runName, cwd) {
|
|
@@ -30549,25 +30712,25 @@ var MissingRunCwdError = class extends Error {
|
|
|
30549
30712
|
function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
|
|
30550
30713
|
if (!config.cwd) return void 0;
|
|
30551
30714
|
const cwd = resolve18(baseDir, config.cwd);
|
|
30552
|
-
if (!
|
|
30715
|
+
if (!existsSync67(cwd)) throw new MissingRunCwdError(config.name, cwd);
|
|
30553
30716
|
return cwd;
|
|
30554
30717
|
}
|
|
30555
30718
|
|
|
30556
30719
|
// src/commands/run/runCommandToCompletion.ts
|
|
30557
30720
|
import { spawn as spawn9 } from "child_process";
|
|
30558
|
-
import { existsSync as
|
|
30721
|
+
import { existsSync as existsSync69 } from "fs";
|
|
30559
30722
|
|
|
30560
30723
|
// src/commands/run/resolveCommand.ts
|
|
30561
|
-
import { execFileSync as
|
|
30562
|
-
import { existsSync as
|
|
30563
|
-
import { dirname as dirname35, join as
|
|
30724
|
+
import { execFileSync as execFileSync15 } from "child_process";
|
|
30725
|
+
import { existsSync as existsSync68 } from "fs";
|
|
30726
|
+
import { dirname as dirname35, join as join85, resolve as resolve19 } from "path";
|
|
30564
30727
|
function resolveCommand2(command) {
|
|
30565
30728
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
30566
30729
|
try {
|
|
30567
|
-
const gitPath =
|
|
30730
|
+
const gitPath = execFileSync15("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
30568
30731
|
const gitRoot = resolve19(dirname35(gitPath), "..");
|
|
30569
|
-
const gitBash =
|
|
30570
|
-
if (
|
|
30732
|
+
const gitBash = join85(gitRoot, "bin", "bash.exe");
|
|
30733
|
+
if (existsSync68(gitBash)) return gitBash;
|
|
30571
30734
|
} catch {
|
|
30572
30735
|
return command;
|
|
30573
30736
|
}
|
|
@@ -30577,7 +30740,7 @@ function resolveCommand2(command) {
|
|
|
30577
30740
|
// src/commands/run/runCommandToCompletion.ts
|
|
30578
30741
|
function runCommandToCompletion(command, args, env, cwd, quiet) {
|
|
30579
30742
|
return new Promise((resolveResult) => {
|
|
30580
|
-
if (cwd && !
|
|
30743
|
+
if (cwd && !existsSync69(cwd)) {
|
|
30581
30744
|
resolveResult({
|
|
30582
30745
|
kind: "failed",
|
|
30583
30746
|
message: `Failed to execute command: cwd ${cwd} does not exist`
|
|
@@ -30661,11 +30824,11 @@ async function reportBuildOrExit(entry) {
|
|
|
30661
30824
|
}
|
|
30662
30825
|
|
|
30663
30826
|
// src/commands/watch/fetchQuietly.ts
|
|
30664
|
-
import { execFileSync as
|
|
30827
|
+
import { execFileSync as execFileSync16 } from "child_process";
|
|
30665
30828
|
var MIN_FETCH_TIMEOUT_MS = 6e4;
|
|
30666
30829
|
function fetchQuietly(cwd, intervalMs) {
|
|
30667
30830
|
try {
|
|
30668
|
-
|
|
30831
|
+
execFileSync16("git", ["fetch", "--quiet"], {
|
|
30669
30832
|
stdio: ["pipe", "pipe", "pipe"],
|
|
30670
30833
|
cwd,
|
|
30671
30834
|
timeout: Math.max(intervalMs, MIN_FETCH_TIMEOUT_MS)
|
|
@@ -30684,9 +30847,9 @@ function detectMovement(from, to, count8) {
|
|
|
30684
30847
|
// src/commands/watch/readMovement.ts
|
|
30685
30848
|
function readMovement(cwd) {
|
|
30686
30849
|
try {
|
|
30687
|
-
const from =
|
|
30688
|
-
const to =
|
|
30689
|
-
const count8 = Number(
|
|
30850
|
+
const from = runGit3(["rev-parse", "@"], cwd);
|
|
30851
|
+
const to = runGit3(["rev-parse", "@{u}"], cwd);
|
|
30852
|
+
const count8 = Number(runGit3(["rev-list", "--count", "@..@{u}"], cwd));
|
|
30690
30853
|
return detectMovement(from, to, count8);
|
|
30691
30854
|
} catch {
|
|
30692
30855
|
return void 0;
|
|
@@ -30965,9 +31128,9 @@ async function auth() {
|
|
|
30965
31128
|
}
|
|
30966
31129
|
|
|
30967
31130
|
// src/commands/roam/postRoamActivity.ts
|
|
30968
|
-
import { execFileSync as
|
|
31131
|
+
import { execFileSync as execFileSync17 } from "child_process";
|
|
30969
31132
|
import { readdirSync as readdirSync20, readFileSync as readFileSync52, statSync as statSync11 } from "fs";
|
|
30970
|
-
import { join as
|
|
31133
|
+
import { join as join86 } from "path";
|
|
30971
31134
|
function findPortFile(roamDir) {
|
|
30972
31135
|
let entries;
|
|
30973
31136
|
try {
|
|
@@ -30976,7 +31139,7 @@ function findPortFile(roamDir) {
|
|
|
30976
31139
|
return void 0;
|
|
30977
31140
|
}
|
|
30978
31141
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
30979
|
-
const path80 =
|
|
31142
|
+
const path80 = join86(roamDir, name);
|
|
30980
31143
|
try {
|
|
30981
31144
|
return { path: path80, mtimeMs: statSync11(path80).mtimeMs };
|
|
30982
31145
|
} catch {
|
|
@@ -30988,7 +31151,7 @@ function findPortFile(roamDir) {
|
|
|
30988
31151
|
function postRoamActivity(app, event) {
|
|
30989
31152
|
const appData = process.env.APPDATA;
|
|
30990
31153
|
if (!appData) return;
|
|
30991
|
-
const portFile = findPortFile(
|
|
31154
|
+
const portFile = findPortFile(join86(appData, "Roam"));
|
|
30992
31155
|
if (!portFile) return;
|
|
30993
31156
|
let port;
|
|
30994
31157
|
try {
|
|
@@ -30998,7 +31161,7 @@ function postRoamActivity(app, event) {
|
|
|
30998
31161
|
}
|
|
30999
31162
|
const url = `http://127.0.0.1:${port}/api/v1/activity/${app}/${event}?pid=${app === "codex" ? 99998 : 99999}`;
|
|
31000
31163
|
try {
|
|
31001
|
-
|
|
31164
|
+
execFileSync17("curl", ["-sf", "--max-time", "0.2", "-X", "POST", url], {
|
|
31002
31165
|
stdio: "ignore"
|
|
31003
31166
|
});
|
|
31004
31167
|
} catch {
|
|
@@ -31120,8 +31283,8 @@ async function run3(name, args) {
|
|
|
31120
31283
|
}
|
|
31121
31284
|
|
|
31122
31285
|
// src/commands/run/add.ts
|
|
31123
|
-
import { mkdirSync as
|
|
31124
|
-
import { join as
|
|
31286
|
+
import { mkdirSync as mkdirSync30, writeFileSync as writeFileSync45 } from "fs";
|
|
31287
|
+
import { join as join87 } from "path";
|
|
31125
31288
|
|
|
31126
31289
|
// src/commands/run/extractOption.ts
|
|
31127
31290
|
function extractOption(args, flag) {
|
|
@@ -31182,16 +31345,16 @@ function saveNewRunConfig(name, command, args, cwd) {
|
|
|
31182
31345
|
saveConfig(config);
|
|
31183
31346
|
}
|
|
31184
31347
|
function createCommandFile(name) {
|
|
31185
|
-
const dir =
|
|
31186
|
-
|
|
31348
|
+
const dir = join87(".claude", "commands");
|
|
31349
|
+
mkdirSync30(dir, { recursive: true });
|
|
31187
31350
|
const content = `---
|
|
31188
31351
|
description: Run ${name}
|
|
31189
31352
|
---
|
|
31190
31353
|
|
|
31191
31354
|
Run \`assist run ${name} $ARGUMENTS 2>&1\`.
|
|
31192
31355
|
`;
|
|
31193
|
-
const filePath =
|
|
31194
|
-
|
|
31356
|
+
const filePath = join87(dir, `${name}.md`);
|
|
31357
|
+
writeFileSync45(filePath, content);
|
|
31195
31358
|
console.log(`Created command file: ${filePath}`);
|
|
31196
31359
|
}
|
|
31197
31360
|
function add3() {
|
|
@@ -31246,8 +31409,8 @@ function link2() {
|
|
|
31246
31409
|
}
|
|
31247
31410
|
|
|
31248
31411
|
// src/commands/run/remove.ts
|
|
31249
|
-
import { existsSync as
|
|
31250
|
-
import { join as
|
|
31412
|
+
import { existsSync as existsSync70, unlinkSync as unlinkSync21 } from "fs";
|
|
31413
|
+
import { join as join88 } from "path";
|
|
31251
31414
|
function findRemoveIndex() {
|
|
31252
31415
|
const idx = process.argv.indexOf("remove");
|
|
31253
31416
|
if (idx === -1 || idx + 1 >= process.argv.length) return -1;
|
|
@@ -31262,8 +31425,8 @@ function parseRemoveName() {
|
|
|
31262
31425
|
return process.argv[idx + 1];
|
|
31263
31426
|
}
|
|
31264
31427
|
function deleteCommandFile(name) {
|
|
31265
|
-
const filePath =
|
|
31266
|
-
if (
|
|
31428
|
+
const filePath = join88(".claude", "commands", `${name}.md`);
|
|
31429
|
+
if (existsSync70(filePath)) {
|
|
31267
31430
|
unlinkSync21(filePath);
|
|
31268
31431
|
console.log(`Deleted command file: ${filePath}`);
|
|
31269
31432
|
}
|
|
@@ -31308,9 +31471,9 @@ function registerRun(program2) {
|
|
|
31308
31471
|
|
|
31309
31472
|
// src/commands/screenshot/index.ts
|
|
31310
31473
|
import { execSync as execSync60 } from "child_process";
|
|
31311
|
-
import { existsSync as
|
|
31474
|
+
import { existsSync as existsSync71, mkdirSync as mkdirSync31, unlinkSync as unlinkSync22, writeFileSync as writeFileSync46 } from "fs";
|
|
31312
31475
|
import { tmpdir as tmpdir8 } from "os";
|
|
31313
|
-
import { join as
|
|
31476
|
+
import { join as join89, resolve as resolve20 } from "path";
|
|
31314
31477
|
import chalk216 from "chalk";
|
|
31315
31478
|
|
|
31316
31479
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
@@ -31440,15 +31603,15 @@ Write-Output $OutputPath
|
|
|
31440
31603
|
|
|
31441
31604
|
// src/commands/screenshot/index.ts
|
|
31442
31605
|
function buildOutputPath(outputDir, processName) {
|
|
31443
|
-
if (!
|
|
31444
|
-
|
|
31606
|
+
if (!existsSync71(outputDir)) {
|
|
31607
|
+
mkdirSync31(outputDir, { recursive: true });
|
|
31445
31608
|
}
|
|
31446
31609
|
const timestamp6 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
31447
31610
|
return resolve20(outputDir, `${processName}-${timestamp6}.png`);
|
|
31448
31611
|
}
|
|
31449
31612
|
function runPowerShellScript(processName, outputPath) {
|
|
31450
|
-
const scriptPath =
|
|
31451
|
-
|
|
31613
|
+
const scriptPath = join89(tmpdir8(), `assist-screenshot-${Date.now()}.ps1`);
|
|
31614
|
+
writeFileSync46(scriptPath, captureWindowPs1, "utf8");
|
|
31452
31615
|
try {
|
|
31453
31616
|
execSync60(
|
|
31454
31617
|
`powershell -NoProfile -ExecutionPolicy Bypass -File "${scriptPath}" -ProcessName "${processName}" -OutputPath "${outputPath}"`,
|
|
@@ -31474,11 +31637,11 @@ function screenshot(processName) {
|
|
|
31474
31637
|
}
|
|
31475
31638
|
|
|
31476
31639
|
// src/commands/sessions/daemon/listDaemonPids.ts
|
|
31477
|
-
import { execFileSync as
|
|
31640
|
+
import { execFileSync as execFileSync18 } from "child_process";
|
|
31478
31641
|
function listDaemonPids() {
|
|
31479
31642
|
if (process.platform === "win32") return [];
|
|
31480
31643
|
try {
|
|
31481
|
-
const out =
|
|
31644
|
+
const out = execFileSync18("ps", ["-eo", "pid=,args="], {
|
|
31482
31645
|
encoding: "utf8"
|
|
31483
31646
|
});
|
|
31484
31647
|
return out.split("\n").filter((line) => line.includes("assist") && / daemon run\b/.test(line)).map((line) => Number.parseInt(line.trim(), 10)).filter((pid) => Number.isInteger(pid));
|
|
@@ -31681,7 +31844,7 @@ function requestDrain(socket, lines2) {
|
|
|
31681
31844
|
}
|
|
31682
31845
|
|
|
31683
31846
|
// src/commands/sessions/daemon/runDaemon.ts
|
|
31684
|
-
import { mkdirSync as
|
|
31847
|
+
import { mkdirSync as mkdirSync35 } from "fs";
|
|
31685
31848
|
|
|
31686
31849
|
// src/commands/sessions/daemon/createAutoExit.ts
|
|
31687
31850
|
var DEFAULT_GRACE_MS = 6e4;
|
|
@@ -31785,12 +31948,12 @@ function toSessionRunInfo({
|
|
|
31785
31948
|
}
|
|
31786
31949
|
|
|
31787
31950
|
// src/commands/sessions/daemon/worktree/joinRefusal.ts
|
|
31788
|
-
import { existsSync as
|
|
31951
|
+
import { existsSync as existsSync72 } from "fs";
|
|
31789
31952
|
function joinRefusal(session) {
|
|
31790
31953
|
if (session.commandType === "run") return "a server run has no agent stream";
|
|
31791
31954
|
if (session.closing === true) return "the session is closing";
|
|
31792
31955
|
if (!session.cwd) return "the session has no working directory";
|
|
31793
|
-
if (!
|
|
31956
|
+
if (!existsSync72(session.cwd))
|
|
31794
31957
|
return "the session's workspace no longer exists";
|
|
31795
31958
|
return void 0;
|
|
31796
31959
|
}
|
|
@@ -31935,7 +32098,7 @@ var ClientHub = class extends Set {
|
|
|
31935
32098
|
};
|
|
31936
32099
|
|
|
31937
32100
|
// src/commands/sessions/daemon/createSession.ts
|
|
31938
|
-
import { randomUUID as
|
|
32101
|
+
import { randomUUID as randomUUID16 } from "crypto";
|
|
31939
32102
|
|
|
31940
32103
|
// src/commands/sessions/daemon/sessionBase.ts
|
|
31941
32104
|
function sessionBase(id, status3) {
|
|
@@ -31954,11 +32117,11 @@ function sessionBase(id, status3) {
|
|
|
31954
32117
|
}
|
|
31955
32118
|
|
|
31956
32119
|
// src/commands/sessions/daemon/spawnPty.ts
|
|
31957
|
-
import { existsSync as
|
|
32120
|
+
import { existsSync as existsSync74 } from "fs";
|
|
31958
32121
|
import * as pty from "node-pty";
|
|
31959
32122
|
|
|
31960
32123
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
31961
|
-
import { chmodSync, existsSync as
|
|
32124
|
+
import { chmodSync, existsSync as existsSync73, statSync as statSync12 } from "fs";
|
|
31962
32125
|
import { createRequire as createRequire3 } from "module";
|
|
31963
32126
|
import path75 from "path";
|
|
31964
32127
|
var require4 = createRequire3(import.meta.url);
|
|
@@ -31973,7 +32136,7 @@ function ensureSpawnHelperExecutable() {
|
|
|
31973
32136
|
`${process.platform}-${process.arch}`,
|
|
31974
32137
|
"spawn-helper"
|
|
31975
32138
|
);
|
|
31976
|
-
if (!
|
|
32139
|
+
if (!existsSync73(helper)) return;
|
|
31977
32140
|
const mode = statSync12(helper).mode;
|
|
31978
32141
|
if ((mode & 73) === 0) chmodSync(helper, mode | 493);
|
|
31979
32142
|
}
|
|
@@ -32009,7 +32172,7 @@ function spawnPty(args, cwd, sessionId, extraEnv) {
|
|
|
32009
32172
|
});
|
|
32010
32173
|
}
|
|
32011
32174
|
function refuseMissingCwd(cwd, sessionId) {
|
|
32012
|
-
if (!cwd ||
|
|
32175
|
+
if (!cwd || existsSync74(cwd)) return;
|
|
32013
32176
|
daemonLog(
|
|
32014
32177
|
`${sessionId ? `session ${sessionId}` : "pty"} not spawned: working directory ${cwd} no longer exists`
|
|
32015
32178
|
);
|
|
@@ -32131,7 +32294,7 @@ function spawnRun(opts) {
|
|
|
32131
32294
|
function createSession(id, { prompt, cwd, design, auto, harness, holdPty } = {}) {
|
|
32132
32295
|
if (harness && harness !== "claude")
|
|
32133
32296
|
return createHarnessSession(id, harness, prompt, cwd, holdPty);
|
|
32134
|
-
const claudeSessionId =
|
|
32297
|
+
const claudeSessionId = randomUUID16();
|
|
32135
32298
|
return {
|
|
32136
32299
|
...sessionBase(id, prompt ? "running" : "waiting"),
|
|
32137
32300
|
name: `Session ${id}`,
|
|
@@ -32191,17 +32354,17 @@ function setStatus2(session, newStatus) {
|
|
|
32191
32354
|
}
|
|
32192
32355
|
|
|
32193
32356
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
32194
|
-
import { existsSync as
|
|
32357
|
+
import { existsSync as existsSync76 } from "fs";
|
|
32195
32358
|
import { basename as basename22 } from "path";
|
|
32196
32359
|
|
|
32197
32360
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
32198
|
-
import { existsSync as
|
|
32199
|
-
import { join as
|
|
32361
|
+
import { existsSync as existsSync75 } from "fs";
|
|
32362
|
+
import { join as join92 } from "path";
|
|
32200
32363
|
|
|
32201
32364
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
32202
32365
|
import { statSync as statSync13 } from "fs";
|
|
32203
32366
|
import { rm as rm2 } from "fs/promises";
|
|
32204
|
-
import { join as
|
|
32367
|
+
import { join as join91 } from "path";
|
|
32205
32368
|
async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
32206
32369
|
if (holdsAGitDirectoryRatherThanALink(worktreePath)) {
|
|
32207
32370
|
const refusal = "it is a clone of its own, not a linked worktree";
|
|
@@ -32229,7 +32392,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
|
32229
32392
|
return { removed: true };
|
|
32230
32393
|
}
|
|
32231
32394
|
function holdsAGitDirectoryRatherThanALink(worktreePath) {
|
|
32232
|
-
return statSync13(
|
|
32395
|
+
return statSync13(join91(worktreePath, ".git"), {
|
|
32233
32396
|
throwIfNoEntry: false
|
|
32234
32397
|
})?.isDirectory() === true;
|
|
32235
32398
|
}
|
|
@@ -32265,7 +32428,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
32265
32428
|
);
|
|
32266
32429
|
}
|
|
32267
32430
|
function strandedReason(worktreePath, cause) {
|
|
32268
|
-
if (!
|
|
32431
|
+
if (!existsSync75(join92(worktreePath, ".git")))
|
|
32269
32432
|
return "its .git link is already gone";
|
|
32270
32433
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
32271
32434
|
return "git no longer recognises it as a working tree";
|
|
@@ -32317,7 +32480,7 @@ function reason3(error) {
|
|
|
32317
32480
|
|
|
32318
32481
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
32319
32482
|
async function reapWorktree(worktreePath, force = false) {
|
|
32320
|
-
if (!
|
|
32483
|
+
if (!existsSync76(worktreePath)) {
|
|
32321
32484
|
forgetWorktree(worktreePath);
|
|
32322
32485
|
daemonLog(
|
|
32323
32486
|
`worktree ${worktreePath} already gone; its record was forgotten`
|
|
@@ -32342,7 +32505,7 @@ async function reapWorktree(worktreePath, force = false) {
|
|
|
32342
32505
|
}
|
|
32343
32506
|
function owningClone(worktreePath) {
|
|
32344
32507
|
const recorded = worktreeAttributionIncludingReaped(worktreePath)?.clone;
|
|
32345
|
-
if (recorded &&
|
|
32508
|
+
if (recorded && existsSync76(recorded)) return recorded;
|
|
32346
32509
|
const detected = mainWorktree(worktreePath);
|
|
32347
32510
|
if (detected) return detected;
|
|
32348
32511
|
daemonLog(
|
|
@@ -32473,12 +32636,12 @@ function closeGateApplies(sessions, session) {
|
|
|
32473
32636
|
}
|
|
32474
32637
|
|
|
32475
32638
|
// src/commands/sessions/daemon/worktree/watchGitState.ts
|
|
32476
|
-
import { existsSync as
|
|
32639
|
+
import { existsSync as existsSync77, watch } from "fs";
|
|
32477
32640
|
var DEBOUNCE_MS = 500;
|
|
32478
32641
|
var POLL_MS = 3e4;
|
|
32479
32642
|
function watchGitState(cwd, onChange) {
|
|
32480
32643
|
const common = gitCommonDir(cwd);
|
|
32481
|
-
if (!common || !
|
|
32644
|
+
if (!common || !existsSync77(common)) return void 0;
|
|
32482
32645
|
const watchers = [
|
|
32483
32646
|
watchGitDir(common, onChange),
|
|
32484
32647
|
pollGitState(cwd, onChange)
|
|
@@ -32728,7 +32891,8 @@ var PREVIEW_KINDS = [
|
|
|
32728
32891
|
"backlog-comment",
|
|
32729
32892
|
"pr-comment",
|
|
32730
32893
|
"github-issue",
|
|
32731
|
-
"github-issue-comment"
|
|
32894
|
+
"github-issue-comment",
|
|
32895
|
+
"github-issue-edit"
|
|
32732
32896
|
];
|
|
32733
32897
|
function isPreviewKind(value) {
|
|
32734
32898
|
return PREVIEW_KINDS.includes(value);
|
|
@@ -32739,6 +32903,7 @@ function previewTargetLabel(kind, itemType, prNumber, draft) {
|
|
|
32739
32903
|
if (kind === "backlog-comment") return "backlog comment";
|
|
32740
32904
|
if (kind === "pr-comment") return "pr comment";
|
|
32741
32905
|
if (kind === "github-issue-comment") return "github issue comment";
|
|
32906
|
+
if (kind === "github-issue-edit") return "github issue edit";
|
|
32742
32907
|
if (kind === "github-issue") return "github issue";
|
|
32743
32908
|
if (kind === "backlog-item") return `backlog ${itemType}`;
|
|
32744
32909
|
if (prNumber !== null) return `edit #${prNumber}`;
|
|
@@ -32950,10 +33115,10 @@ function emitSessionOutput(session, clients, data) {
|
|
|
32950
33115
|
}
|
|
32951
33116
|
|
|
32952
33117
|
// src/commands/sessions/daemon/exitReason.ts
|
|
32953
|
-
import { existsSync as
|
|
33118
|
+
import { existsSync as existsSync78 } from "fs";
|
|
32954
33119
|
import { resolve as resolve21 } from "path";
|
|
32955
33120
|
function exitDetail(session) {
|
|
32956
|
-
if (session.cwd && !
|
|
33121
|
+
if (session.cwd && !existsSync78(session.cwd))
|
|
32957
33122
|
return `working directory ${session.cwd} no longer exists`;
|
|
32958
33123
|
return missingRunConfigCwd(session);
|
|
32959
33124
|
}
|
|
@@ -32967,7 +33132,7 @@ function missingRunConfigCwd(session) {
|
|
|
32967
33132
|
const config = resolveRunConfig(session.runName, dir);
|
|
32968
33133
|
if (!config?.cwd) return void 0;
|
|
32969
33134
|
const configured = resolve21(runConfigBaseDirFrom(dir), config.cwd);
|
|
32970
|
-
if (
|
|
33135
|
+
if (existsSync78(configured)) return void 0;
|
|
32971
33136
|
return `run config "${config.name}": cwd ${configured} does not exist`;
|
|
32972
33137
|
}
|
|
32973
33138
|
|
|
@@ -33008,7 +33173,7 @@ function handleFailedResume(session, exitCode, onStatusChange) {
|
|
|
33008
33173
|
}
|
|
33009
33174
|
|
|
33010
33175
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
33011
|
-
import { existsSync as
|
|
33176
|
+
import { existsSync as existsSync79, mkdirSync as mkdirSync32, watch as watch2 } from "fs";
|
|
33012
33177
|
import { dirname as dirname37 } from "path";
|
|
33013
33178
|
|
|
33014
33179
|
// src/commands/sessions/daemon/applyActivityToSession.ts
|
|
@@ -33073,7 +33238,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
33073
33238
|
const path80 = activityPath(session.id);
|
|
33074
33239
|
const dir = dirname37(path80);
|
|
33075
33240
|
try {
|
|
33076
|
-
|
|
33241
|
+
mkdirSync32(dir, { recursive: true });
|
|
33077
33242
|
} catch {
|
|
33078
33243
|
return;
|
|
33079
33244
|
}
|
|
@@ -33094,7 +33259,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
33094
33259
|
if (timer) clearTimeout(timer);
|
|
33095
33260
|
timer = setTimeout(read2, DEBOUNCE_MS2);
|
|
33096
33261
|
});
|
|
33097
|
-
if (
|
|
33262
|
+
if (existsSync79(path80)) read2();
|
|
33098
33263
|
}
|
|
33099
33264
|
function refreshActivity(session) {
|
|
33100
33265
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -33276,10 +33441,10 @@ function headContainsSessionId(filePath, claudeSessionId) {
|
|
|
33276
33441
|
}
|
|
33277
33442
|
|
|
33278
33443
|
// src/commands/sessions/daemon/ensureProjectDirExists.ts
|
|
33279
|
-
import { mkdirSync as
|
|
33444
|
+
import { mkdirSync as mkdirSync33 } from "fs";
|
|
33280
33445
|
function ensureProjectDirExists(dir, sessionId) {
|
|
33281
33446
|
try {
|
|
33282
|
-
|
|
33447
|
+
mkdirSync33(dir, { recursive: true });
|
|
33283
33448
|
return true;
|
|
33284
33449
|
} catch (error) {
|
|
33285
33450
|
daemonLog(
|
|
@@ -34199,7 +34364,7 @@ function codexRespawnPlan(session) {
|
|
|
34199
34364
|
}
|
|
34200
34365
|
|
|
34201
34366
|
// src/commands/sessions/daemon/interactiveRespawnPlan.ts
|
|
34202
|
-
import { randomUUID as
|
|
34367
|
+
import { randomUUID as randomUUID17 } from "crypto";
|
|
34203
34368
|
function interactiveRespawnPlan(session, resumes) {
|
|
34204
34369
|
const { claudeSessionId, cwd, initialPrompt, design, auto } = session;
|
|
34205
34370
|
if (!resumes) return null;
|
|
@@ -34219,7 +34384,7 @@ function interactiveRespawnPlan(session, resumes) {
|
|
|
34219
34384
|
return null;
|
|
34220
34385
|
}
|
|
34221
34386
|
function freshClaudePlan(session, prompt, cwd) {
|
|
34222
|
-
const claudeSessionId =
|
|
34387
|
+
const claudeSessionId = randomUUID17();
|
|
34223
34388
|
return {
|
|
34224
34389
|
spawn: () => {
|
|
34225
34390
|
session.claudeSessionId = claudeSessionId;
|
|
@@ -34716,7 +34881,7 @@ function rearmStoppedSessions(sessions, notify2) {
|
|
|
34716
34881
|
}
|
|
34717
34882
|
|
|
34718
34883
|
// src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
|
|
34719
|
-
import { existsSync as
|
|
34884
|
+
import { existsSync as existsSync82 } from "fs";
|
|
34720
34885
|
import { basename as basename24 } from "path";
|
|
34721
34886
|
|
|
34722
34887
|
// src/commands/sessions/daemon/worktree/accountedTrees.ts
|
|
@@ -34771,9 +34936,9 @@ function bindResumedWorktree(session, cwd, notify2) {
|
|
|
34771
34936
|
}
|
|
34772
34937
|
|
|
34773
34938
|
// src/commands/sessions/daemon/worktree/reclaimVanishedWorktrees.ts
|
|
34774
|
-
import { existsSync as
|
|
34939
|
+
import { existsSync as existsSync81 } from "fs";
|
|
34775
34940
|
async function reclaimVanishedWorktrees(clone, paths) {
|
|
34776
|
-
if (!
|
|
34941
|
+
if (!existsSync81(clone)) {
|
|
34777
34942
|
for (const { path: path80 } of paths) forgetWorktree(path80);
|
|
34778
34943
|
daemonLog(
|
|
34779
34944
|
`clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
|
|
@@ -34939,7 +35104,7 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
|
34939
35104
|
);
|
|
34940
35105
|
continue;
|
|
34941
35106
|
}
|
|
34942
|
-
if (!
|
|
35107
|
+
if (!existsSync82(path80)) {
|
|
34943
35108
|
logVanishedTree(sessions, path80);
|
|
34944
35109
|
vanished.set(clone, [
|
|
34945
35110
|
...vanished.get(clone) ?? [],
|
|
@@ -35104,10 +35269,10 @@ function startReusedRunPty(session, assistArgs, itemId2, hold, clients, onStatus
|
|
|
35104
35269
|
}
|
|
35105
35270
|
|
|
35106
35271
|
// src/commands/sessions/daemon/createWatcherSession.ts
|
|
35107
|
-
import { randomUUID as
|
|
35272
|
+
import { randomUUID as randomUUID18 } from "crypto";
|
|
35108
35273
|
var WATCH_PROMPT = "/watch";
|
|
35109
35274
|
function createWatcherSession(id, cwd) {
|
|
35110
|
-
const claudeSessionId =
|
|
35275
|
+
const claudeSessionId = randomUUID18();
|
|
35111
35276
|
return {
|
|
35112
35277
|
...sessionBase(id, "running"),
|
|
35113
35278
|
name: `Session ${id}`,
|
|
@@ -35556,13 +35721,13 @@ async function defaultConnect() {
|
|
|
35556
35721
|
}
|
|
35557
35722
|
|
|
35558
35723
|
// src/commands/sessions/daemon/hasPersistedWindowsSessions.ts
|
|
35559
|
-
import { existsSync as
|
|
35724
|
+
import { existsSync as existsSync83, readFileSync as readFileSync55 } from "fs";
|
|
35560
35725
|
import { posix as posix3 } from "path";
|
|
35561
35726
|
function hasPersistedWindowsSessions() {
|
|
35562
35727
|
const sessionsFile = windowsSessionsFileFromWsl();
|
|
35563
35728
|
if (!sessionsFile) return false;
|
|
35564
35729
|
try {
|
|
35565
|
-
if (!
|
|
35730
|
+
if (!existsSync83(sessionsFile)) return false;
|
|
35566
35731
|
const data = JSON.parse(readFileSync55(sessionsFile, "utf8"));
|
|
35567
35732
|
return Array.isArray(data) && data.length > 0;
|
|
35568
35733
|
} catch (error) {
|
|
@@ -36297,7 +36462,7 @@ function setAutoAdvance(sessions, id, enabled) {
|
|
|
36297
36462
|
}
|
|
36298
36463
|
|
|
36299
36464
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
36300
|
-
import { existsSync as
|
|
36465
|
+
import { existsSync as existsSync86 } from "fs";
|
|
36301
36466
|
|
|
36302
36467
|
// src/commands/sessions/daemon/resumeSession.ts
|
|
36303
36468
|
function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
@@ -36328,11 +36493,11 @@ function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
|
36328
36493
|
}
|
|
36329
36494
|
|
|
36330
36495
|
// src/commands/sessions/daemon/worktree/resumeInReplacementTree.ts
|
|
36331
|
-
import { existsSync as
|
|
36496
|
+
import { existsSync as existsSync85 } from "fs";
|
|
36332
36497
|
|
|
36333
36498
|
// src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
|
|
36334
|
-
import { copyFileSync as copyFileSync7, existsSync as
|
|
36335
|
-
import { join as
|
|
36499
|
+
import { copyFileSync as copyFileSync7, existsSync as existsSync84, mkdirSync as mkdirSync34 } from "fs";
|
|
36500
|
+
import { join as join94 } from "path";
|
|
36336
36501
|
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
36337
36502
|
const dir = projectDirForCwd(toCwd);
|
|
36338
36503
|
if (dir === projectDirForCwd(fromCwd)) {
|
|
@@ -36341,8 +36506,8 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
36341
36506
|
);
|
|
36342
36507
|
return;
|
|
36343
36508
|
}
|
|
36344
|
-
const dest =
|
|
36345
|
-
if (
|
|
36509
|
+
const dest = join94(dir, `${claudeSessionId}.jsonl`);
|
|
36510
|
+
if (existsSync84(dest)) {
|
|
36346
36511
|
daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
|
|
36347
36512
|
return;
|
|
36348
36513
|
}
|
|
@@ -36354,7 +36519,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
36354
36519
|
return;
|
|
36355
36520
|
}
|
|
36356
36521
|
try {
|
|
36357
|
-
|
|
36522
|
+
mkdirSync34(dir, { recursive: true });
|
|
36358
36523
|
copyFileSync7(source, dest);
|
|
36359
36524
|
daemonLog(
|
|
36360
36525
|
`transcript ${source} copied to ${dest} so ${toCwd} can resume it`
|
|
@@ -36393,7 +36558,7 @@ function resumeInReplacementTree(ctx, claudeSessionId, missingCwd, name, harness
|
|
|
36393
36558
|
}
|
|
36394
36559
|
function cloneForReapedTree(missingCwd) {
|
|
36395
36560
|
const clone = worktreeAttributionIncludingReaped(missingCwd)?.clone;
|
|
36396
|
-
if (!clone || !
|
|
36561
|
+
if (!clone || !existsSync85(clone))
|
|
36397
36562
|
throw new Error(
|
|
36398
36563
|
`working directory no longer exists and no clone is recorded to re-allocate from: ${missingCwd}`
|
|
36399
36564
|
);
|
|
@@ -36402,7 +36567,7 @@ function cloneForReapedTree(missingCwd) {
|
|
|
36402
36567
|
|
|
36403
36568
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
36404
36569
|
function resumeInTree(ctx, sessionId, cwd, name, harness) {
|
|
36405
|
-
if (!
|
|
36570
|
+
if (!existsSync86(cwd))
|
|
36406
36571
|
return resumeInReplacementTree(ctx, sessionId, cwd, name, harness);
|
|
36407
36572
|
const id = ctx.spawnWith(
|
|
36408
36573
|
(sid) => resumeSession(sid, sessionId, cwd, name, void 0, harness)
|
|
@@ -36771,12 +36936,6 @@ function safeParse2(line) {
|
|
|
36771
36936
|
}
|
|
36772
36937
|
}
|
|
36773
36938
|
|
|
36774
|
-
// src/commands/sessions/daemon/repoDirExists.ts
|
|
36775
|
-
import { existsSync as existsSync86 } from "fs";
|
|
36776
|
-
function repoDirExists(cwd) {
|
|
36777
|
-
return existsSync86(toGitCwd(cwd));
|
|
36778
|
-
}
|
|
36779
|
-
|
|
36780
36939
|
// src/commands/sessions/daemon/withRepoGroups.ts
|
|
36781
36940
|
function withRepoGroups(sessions) {
|
|
36782
36941
|
const existence = /* @__PURE__ */ new Map();
|
|
@@ -36984,7 +37143,7 @@ function handleConnection(socket, manager) {
|
|
|
36984
37143
|
}
|
|
36985
37144
|
|
|
36986
37145
|
// src/commands/sessions/daemon/onListening.ts
|
|
36987
|
-
import { unlinkSync as unlinkSync23, writeFileSync as
|
|
37146
|
+
import { unlinkSync as unlinkSync23, writeFileSync as writeFileSync47 } from "fs";
|
|
36988
37147
|
|
|
36989
37148
|
// src/commands/sessions/daemon/startPidFileWatchdog.ts
|
|
36990
37149
|
import { readFileSync as readFileSync56 } from "fs";
|
|
@@ -37006,7 +37165,7 @@ function ownsPidFile() {
|
|
|
37006
37165
|
|
|
37007
37166
|
// src/commands/sessions/daemon/onListening.ts
|
|
37008
37167
|
function onListening(manager, checkAutoExit) {
|
|
37009
|
-
|
|
37168
|
+
writeFileSync47(daemonPaths.pid, String(process.pid));
|
|
37010
37169
|
startPidFileWatchdog(() => {
|
|
37011
37170
|
daemonLog("lost daemon.pid ownership; shutting down sessions and exiting");
|
|
37012
37171
|
void manager.flushActiveMs().finally(() => {
|
|
@@ -37047,7 +37206,7 @@ function cleanupOwnedFiles() {
|
|
|
37047
37206
|
import * as net3 from "net";
|
|
37048
37207
|
|
|
37049
37208
|
// src/commands/sessions/daemon/findPortHolderPid.ts
|
|
37050
|
-
import { execFileSync as
|
|
37209
|
+
import { execFileSync as execFileSync19 } from "child_process";
|
|
37051
37210
|
var PROBE_TIMEOUT_MS = 3e3;
|
|
37052
37211
|
function findPortHolderPid(port) {
|
|
37053
37212
|
try {
|
|
@@ -37057,7 +37216,7 @@ function findPortHolderPid(port) {
|
|
|
37057
37216
|
}
|
|
37058
37217
|
}
|
|
37059
37218
|
function probe(command, args) {
|
|
37060
|
-
return
|
|
37219
|
+
return execFileSync19(command, args, {
|
|
37061
37220
|
encoding: "utf8",
|
|
37062
37221
|
timeout: PROBE_TIMEOUT_MS,
|
|
37063
37222
|
stdio: ["ignore", "pipe", "ignore"]
|
|
@@ -37193,7 +37352,7 @@ async function recoverFromAddrInUse(server, manager, checkAutoExit) {
|
|
|
37193
37352
|
|
|
37194
37353
|
// src/commands/sessions/daemon/runDaemon.ts
|
|
37195
37354
|
async function runDaemon() {
|
|
37196
|
-
|
|
37355
|
+
mkdirSync35(daemonPaths.dir, { recursive: true });
|
|
37197
37356
|
daemonLog(
|
|
37198
37357
|
`starting (reason: ${process.env.ASSIST_DAEMON_SPAWN_REASON ?? "manual"})`
|
|
37199
37358
|
);
|
|
@@ -37264,7 +37423,7 @@ function summaryPathFor(jsonlPath2) {
|
|
|
37264
37423
|
}
|
|
37265
37424
|
|
|
37266
37425
|
// src/commands/sessions/summarise/summariseSession.ts
|
|
37267
|
-
import { execFileSync as
|
|
37426
|
+
import { execFileSync as execFileSync20 } from "child_process";
|
|
37268
37427
|
function summariseSession(jsonlPath2) {
|
|
37269
37428
|
const firstMessage = extractFirstUserMessage(jsonlPath2);
|
|
37270
37429
|
const backlogIds = scanSessionBacklogRefs(jsonlPath2);
|
|
@@ -37273,7 +37432,7 @@ function summariseSession(jsonlPath2) {
|
|
|
37273
37432
|
}
|
|
37274
37433
|
const prompt = buildPrompt6(firstMessage, backlogIds);
|
|
37275
37434
|
try {
|
|
37276
|
-
const output =
|
|
37435
|
+
const output = execFileSync20("claude", ["-p", "--model", "haiku", prompt], {
|
|
37277
37436
|
encoding: "utf8",
|
|
37278
37437
|
timeout: 3e4,
|
|
37279
37438
|
stdio: ["ignore", "pipe", "ignore"]
|
|
@@ -37454,9 +37613,9 @@ function buildLimitsSegment(rateLimits) {
|
|
|
37454
37613
|
|
|
37455
37614
|
// src/commands/readGitBranch.ts
|
|
37456
37615
|
import { readFileSync as readFileSync58, statSync as statSync15 } from "fs";
|
|
37457
|
-
import { isAbsolute as isAbsolute4, join as
|
|
37616
|
+
import { isAbsolute as isAbsolute4, join as join95, resolve as resolve22 } from "path";
|
|
37458
37617
|
function resolveGitDir(cwd) {
|
|
37459
|
-
const dotGit =
|
|
37618
|
+
const dotGit = join95(cwd, ".git");
|
|
37460
37619
|
let stat4;
|
|
37461
37620
|
try {
|
|
37462
37621
|
stat4 = statSync15(dotGit);
|
|
@@ -37486,7 +37645,7 @@ function readGitBranch(cwd) {
|
|
|
37486
37645
|
}
|
|
37487
37646
|
let head;
|
|
37488
37647
|
try {
|
|
37489
|
-
head = readFileSync58(
|
|
37648
|
+
head = readFileSync58(join95(gitDir, "HEAD"), "utf8");
|
|
37490
37649
|
} catch {
|
|
37491
37650
|
return null;
|
|
37492
37651
|
}
|