@staff0rd/assist 0.573.2 → 0.574.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/claude/commands/github.md +23 -6
- package/dist/commands/sessions/web/bundle.js +2 -2
- package/dist/index.js +549 -380
- 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.1",
|
|
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,146 @@ async function createIssue(options2) {
|
|
|
20771
20797
|
}
|
|
20772
20798
|
}
|
|
20773
20799
|
|
|
20800
|
+
// src/commands/sessions/shared/inWebSession.ts
|
|
20801
|
+
function inWebSession() {
|
|
20802
|
+
return process.env.ASSIST_SESSION === "1" && !!process.env.ASSIST_SESSION_ID;
|
|
20803
|
+
}
|
|
20804
|
+
|
|
20805
|
+
// src/commands/github/issue/fetchIssue.ts
|
|
20806
|
+
import { execFileSync as execFileSync8 } from "child_process";
|
|
20807
|
+
function fetchIssue2(number, repo) {
|
|
20808
|
+
const args = [
|
|
20809
|
+
"issue",
|
|
20810
|
+
"view",
|
|
20811
|
+
String(number),
|
|
20812
|
+
"--json",
|
|
20813
|
+
"title,body,updatedAt,url"
|
|
20814
|
+
];
|
|
20815
|
+
if (repo) args.push("--repo", repo);
|
|
20816
|
+
let raw;
|
|
20817
|
+
try {
|
|
20818
|
+
raw = execFileSync8("gh", args, { encoding: "utf8" });
|
|
20819
|
+
} catch {
|
|
20820
|
+
console.error(`Could not fetch issue #${number} with gh issue view`);
|
|
20821
|
+
process.exit(1);
|
|
20822
|
+
}
|
|
20823
|
+
try {
|
|
20824
|
+
return JSON.parse(raw);
|
|
20825
|
+
} catch {
|
|
20826
|
+
console.error(`Could not parse the gh issue view output for #${number}`);
|
|
20827
|
+
process.exit(1);
|
|
20828
|
+
}
|
|
20829
|
+
}
|
|
20830
|
+
|
|
20831
|
+
// src/commands/github/issue/pushIssueBody.ts
|
|
20832
|
+
import { execFileSync as execFileSync9 } from "child_process";
|
|
20833
|
+
function pushIssueBody(number, repo, bodyPath) {
|
|
20834
|
+
const args = ["issue", "edit", String(number), "--body-file", bodyPath];
|
|
20835
|
+
if (repo) args.push("--repo", repo);
|
|
20836
|
+
try {
|
|
20837
|
+
execFileSync9("gh", args, { stdio: "inherit" });
|
|
20838
|
+
} catch {
|
|
20839
|
+
process.exit(1);
|
|
20840
|
+
}
|
|
20841
|
+
}
|
|
20842
|
+
|
|
20843
|
+
// src/commands/github/issue/reviewProposedIssueEdit.ts
|
|
20844
|
+
import { randomUUID as randomUUID9 } from "crypto";
|
|
20845
|
+
async function reviewProposedIssueEdit(title, body) {
|
|
20846
|
+
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
20847
|
+
if (process.env.ASSIST_SESSION !== "1" || !sessionId) return;
|
|
20848
|
+
await awaitPreviewApproval("GitHub issue edit preview", {
|
|
20849
|
+
sessionId,
|
|
20850
|
+
requestId: randomUUID9(),
|
|
20851
|
+
title,
|
|
20852
|
+
body,
|
|
20853
|
+
prNumber: null,
|
|
20854
|
+
kind: "github-issue-edit"
|
|
20855
|
+
});
|
|
20856
|
+
}
|
|
20857
|
+
|
|
20858
|
+
// src/commands/github/issue/viewIssue.ts
|
|
20859
|
+
import { execFileSync as execFileSync10 } from "child_process";
|
|
20860
|
+
function viewIssue(number, repo) {
|
|
20861
|
+
const args = ["issue", "view", String(number)];
|
|
20862
|
+
if (repo) args.push("--repo", repo);
|
|
20863
|
+
try {
|
|
20864
|
+
execFileSync10("gh", args, { stdio: "inherit" });
|
|
20865
|
+
} catch {
|
|
20866
|
+
process.exit(1);
|
|
20867
|
+
}
|
|
20868
|
+
}
|
|
20869
|
+
|
|
20870
|
+
// src/commands/github/issue/writeIssueWorkingFile.ts
|
|
20871
|
+
import { mkdirSync as mkdirSync16, writeFileSync as writeFileSync31 } from "fs";
|
|
20872
|
+
|
|
20873
|
+
// src/commands/github/issue/issueWorkingFile.ts
|
|
20874
|
+
import { join as join50 } from "path";
|
|
20875
|
+
function issueWorkingFile(slug, number) {
|
|
20876
|
+
const [owner = "unknown", repo = "unknown"] = slug.split("/");
|
|
20877
|
+
const dir = join50(getStoreDir(), "github-issues", owner, repo);
|
|
20878
|
+
return {
|
|
20879
|
+
dir,
|
|
20880
|
+
bodyPath: join50(dir, `${number}.md`),
|
|
20881
|
+
metaPath: join50(dir, `${number}.json`)
|
|
20882
|
+
};
|
|
20883
|
+
}
|
|
20884
|
+
|
|
20885
|
+
// src/commands/github/issue/writeIssueWorkingFile.ts
|
|
20886
|
+
function writeIssueWorkingFile(slug, number, target, updatedAt, body) {
|
|
20887
|
+
const { dir, bodyPath, metaPath } = issueWorkingFile(slug, number);
|
|
20888
|
+
mkdirSync16(dir, { recursive: true });
|
|
20889
|
+
writeFileSync31(bodyPath, body);
|
|
20890
|
+
writeFileSync31(
|
|
20891
|
+
metaPath,
|
|
20892
|
+
`${JSON.stringify({ target, updatedAt }, null, 2)}
|
|
20893
|
+
`
|
|
20894
|
+
);
|
|
20895
|
+
return bodyPath;
|
|
20896
|
+
}
|
|
20897
|
+
|
|
20898
|
+
// src/commands/github/issue/editIssue.ts
|
|
20899
|
+
var USAGE3 = "Usage: assist github issue edit <number> [-R <owner>/<repo>]";
|
|
20900
|
+
function slugFromUrl(url) {
|
|
20901
|
+
const match = /github\.com\/([^/]+\/[^/]+)\//.exec(url ?? "");
|
|
20902
|
+
return match ? match[1] : "unknown/unknown";
|
|
20903
|
+
}
|
|
20904
|
+
async function editIssue(numberArg, options2) {
|
|
20905
|
+
const number = Number.parseInt(numberArg, 10);
|
|
20906
|
+
if (!Number.isInteger(number) || number <= 0) {
|
|
20907
|
+
console.error(USAGE3);
|
|
20908
|
+
process.exit(1);
|
|
20909
|
+
}
|
|
20910
|
+
if (!inWebSession()) {
|
|
20911
|
+
viewIssue(number, options2.repo);
|
|
20912
|
+
return;
|
|
20913
|
+
}
|
|
20914
|
+
const issue = fetchIssue2(number, options2.repo);
|
|
20915
|
+
const slug = options2.repo ?? slugFromUrl(issue.url);
|
|
20916
|
+
const target = `${slug}#${number}`;
|
|
20917
|
+
validateProposedContent(
|
|
20918
|
+
{ subject: "Issue", context: "GitHub issues" },
|
|
20919
|
+
issue.title,
|
|
20920
|
+
issue.body
|
|
20921
|
+
);
|
|
20922
|
+
const bodyPath = writeIssueWorkingFile(
|
|
20923
|
+
slug,
|
|
20924
|
+
number,
|
|
20925
|
+
target,
|
|
20926
|
+
issue.updatedAt,
|
|
20927
|
+
issue.body
|
|
20928
|
+
);
|
|
20929
|
+
await reviewProposedIssueEdit(`Edit ${target}: ${issue.title}`, issue.body);
|
|
20930
|
+
if (fetchIssue2(number, options2.repo).updatedAt !== issue.updatedAt) {
|
|
20931
|
+
console.error(
|
|
20932
|
+
`${target} was updated on GitHub after it was fetched. Nothing was pushed; the markdown is at ${bodyPath}`
|
|
20933
|
+
);
|
|
20934
|
+
process.exit(1);
|
|
20935
|
+
}
|
|
20936
|
+
pushIssueBody(number, options2.repo, bodyPath);
|
|
20937
|
+
console.log(`Issue body updated on ${target}`);
|
|
20938
|
+
}
|
|
20939
|
+
|
|
20774
20940
|
// src/commands/prs/readBodyArgument.ts
|
|
20775
20941
|
async function readBodyArgument(value) {
|
|
20776
20942
|
if (value !== "-") return value;
|
|
@@ -20792,6 +20958,13 @@ function registerGithubIssue(githubCommand) {
|
|
|
20792
20958
|
"after",
|
|
20793
20959
|
"\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
20960
|
).action(createIssue);
|
|
20961
|
+
issueCommand.command("edit <number>").description("Edit an existing GitHub issue's body in the preview pane").option(
|
|
20962
|
+
"-R, --repo <owner/repo>",
|
|
20963
|
+
"Target repository (defaults to the current repo)"
|
|
20964
|
+
).addHelpText(
|
|
20965
|
+
"after",
|
|
20966
|
+
"\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."
|
|
20967
|
+
).action(editIssue);
|
|
20795
20968
|
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
20969
|
"-R, --repo <owner/repo>",
|
|
20797
20970
|
"Target repository (defaults to the current repo)"
|
|
@@ -20832,24 +21005,24 @@ async function countPendingHandovers(orm, origin) {
|
|
|
20832
21005
|
|
|
20833
21006
|
// src/commands/handover/migrateDiskHandovers.ts
|
|
20834
21007
|
import {
|
|
20835
|
-
existsSync as
|
|
21008
|
+
existsSync as existsSync48,
|
|
20836
21009
|
readdirSync as readdirSync10,
|
|
20837
21010
|
readFileSync as readFileSync37,
|
|
20838
21011
|
rmSync as rmSync3,
|
|
20839
21012
|
statSync as statSync8
|
|
20840
21013
|
} from "fs";
|
|
20841
|
-
import { basename as basename14, join as
|
|
21014
|
+
import { basename as basename14, join as join53 } from "path";
|
|
20842
21015
|
|
|
20843
21016
|
// src/commands/handover/getHandoverPath.ts
|
|
20844
|
-
import { join as
|
|
21017
|
+
import { join as join51 } from "path";
|
|
20845
21018
|
function getHandoverPath(cwd = process.cwd()) {
|
|
20846
|
-
return
|
|
21019
|
+
return join51(cwd, ".assist", "HANDOVER.md");
|
|
20847
21020
|
}
|
|
20848
21021
|
|
|
20849
21022
|
// src/commands/handover/getHandoversDir.ts
|
|
20850
|
-
import { join as
|
|
21023
|
+
import { join as join52 } from "path";
|
|
20851
21024
|
function getHandoversDir(cwd = process.cwd()) {
|
|
20852
|
-
return
|
|
21025
|
+
return join52(cwd, ".assist", "handovers");
|
|
20853
21026
|
}
|
|
20854
21027
|
|
|
20855
21028
|
// src/commands/handover/parseArchiveTimestamp.ts
|
|
@@ -20887,10 +21060,10 @@ function summariseHandoverContent(content) {
|
|
|
20887
21060
|
|
|
20888
21061
|
// src/commands/handover/migrateDiskHandovers.ts
|
|
20889
21062
|
function collectMarkdown(dir) {
|
|
20890
|
-
if (!
|
|
21063
|
+
if (!existsSync48(dir)) return [];
|
|
20891
21064
|
const out = [];
|
|
20892
21065
|
for (const entry of readdirSync10(dir, { withFileTypes: true })) {
|
|
20893
|
-
const full =
|
|
21066
|
+
const full = join53(dir, entry.name);
|
|
20894
21067
|
if (entry.isDirectory()) out.push(...collectMarkdown(full));
|
|
20895
21068
|
else if (entry.isFile() && entry.name.endsWith(".md")) out.push(full);
|
|
20896
21069
|
}
|
|
@@ -20914,7 +21087,7 @@ async function migrateDiskHandovers(orm, origin, cwd = process.cwd()) {
|
|
|
20914
21087
|
migrated++;
|
|
20915
21088
|
}
|
|
20916
21089
|
const handoverPath = getHandoverPath(cwd);
|
|
20917
|
-
if (
|
|
21090
|
+
if (existsSync48(handoverPath)) {
|
|
20918
21091
|
await migrateFile(orm, origin, handoverPath, statSync8(handoverPath).mtime);
|
|
20919
21092
|
migrated++;
|
|
20920
21093
|
}
|
|
@@ -21179,7 +21352,7 @@ async function jiraAuth() {
|
|
|
21179
21352
|
|
|
21180
21353
|
// src/commands/jira/viewIssue.ts
|
|
21181
21354
|
import chalk163 from "chalk";
|
|
21182
|
-
function
|
|
21355
|
+
function viewIssue2(issueKey) {
|
|
21183
21356
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
21184
21357
|
const fields = parsed?.fields;
|
|
21185
21358
|
const summary = fields?.summary;
|
|
@@ -21209,7 +21382,7 @@ function registerJira(program2) {
|
|
|
21209
21382
|
const jiraCommand = program2.command("jira").description("Jira utilities");
|
|
21210
21383
|
jiraCommand.command("auth").description("Authenticate with Jira via API token").action(() => jiraAuth());
|
|
21211
21384
|
jiraCommand.command("ac <issue-key>").description("Print acceptance criteria for a Jira issue").action((issueKey) => acceptanceCriteria(issueKey));
|
|
21212
|
-
jiraCommand.command("view <issue-key>").description("Print the title and description of a Jira issue").action((issueKey) =>
|
|
21385
|
+
jiraCommand.command("view <issue-key>").description("Print the title and description of a Jira issue").action((issueKey) => viewIssue2(issueKey));
|
|
21213
21386
|
configHelp(jiraCommand, jiraConfigHelp);
|
|
21214
21387
|
}
|
|
21215
21388
|
|
|
@@ -21230,10 +21403,10 @@ function registerRefineLaunch(program2, resumeFlag) {
|
|
|
21230
21403
|
}
|
|
21231
21404
|
|
|
21232
21405
|
// src/commands/reviewPrComments.ts
|
|
21233
|
-
import { randomUUID as
|
|
21406
|
+
import { randomUUID as randomUUID10 } from "crypto";
|
|
21234
21407
|
|
|
21235
21408
|
// src/commands/review/checkoutPr.ts
|
|
21236
|
-
import { execFileSync as
|
|
21409
|
+
import { execFileSync as execFileSync12 } from "child_process";
|
|
21237
21410
|
import chalk164 from "chalk";
|
|
21238
21411
|
|
|
21239
21412
|
// src/commands/sessions/daemon/daemonLog.ts
|
|
@@ -21271,18 +21444,18 @@ function canonicalTreePath(path80) {
|
|
|
21271
21444
|
}
|
|
21272
21445
|
|
|
21273
21446
|
// src/commands/sessions/daemon/worktree/createWorktree.ts
|
|
21274
|
-
import { existsSync as
|
|
21447
|
+
import { existsSync as existsSync49 } from "fs";
|
|
21275
21448
|
import { basename as basename16, dirname as dirname25 } from "path";
|
|
21276
21449
|
|
|
21277
21450
|
// src/commands/sessions/daemon/worktree/planAllocation.ts
|
|
21278
|
-
import { basename as basename15, join as
|
|
21451
|
+
import { basename as basename15, join as join54 } from "path";
|
|
21279
21452
|
function planAllocation(clone, boundTreeRoots2) {
|
|
21280
21453
|
return boundTreeRoots2.has(clone) ? "spill" : "primary";
|
|
21281
21454
|
}
|
|
21282
21455
|
function nextWorktreePath(clone, base, isTaken) {
|
|
21283
21456
|
const name = basename15(clone);
|
|
21284
21457
|
for (let n = 2; n < 1e3; n++) {
|
|
21285
|
-
const candidate =
|
|
21458
|
+
const candidate = join54(base, `${name}-${n}`);
|
|
21286
21459
|
if (!isTaken(candidate)) return candidate;
|
|
21287
21460
|
}
|
|
21288
21461
|
throw new Error(`no free worktree suffix for ${clone}`);
|
|
@@ -21318,7 +21491,7 @@ function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
|
|
|
21318
21491
|
const base = strategy.root ? expandTilde2(strategy.root) : dirname25(clone);
|
|
21319
21492
|
const registered = new Set(listWorktreePaths(clone));
|
|
21320
21493
|
const branches = new Set(listLocalBranches(clone));
|
|
21321
|
-
const isTaken = (candidate) => registered.has(candidate) ||
|
|
21494
|
+
const isTaken = (candidate) => registered.has(candidate) || existsSync49(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename16(candidate));
|
|
21322
21495
|
const path80 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
|
|
21323
21496
|
const start3 = worktreeStartPoint(clone, strategy.trunk);
|
|
21324
21497
|
gitSync(clone, [
|
|
@@ -21344,7 +21517,7 @@ function keptInTree(cwd, reason4) {
|
|
|
21344
21517
|
}
|
|
21345
21518
|
|
|
21346
21519
|
// src/commands/sessions/daemon/worktree/treeDurability.ts
|
|
21347
|
-
import { existsSync as
|
|
21520
|
+
import { existsSync as existsSync50 } from "fs";
|
|
21348
21521
|
var treeIsGone = { durable: true, gone: true };
|
|
21349
21522
|
function treeDurability(state) {
|
|
21350
21523
|
if (state.dirty) return { durable: false, reason: "uncommitted changes" };
|
|
@@ -21375,14 +21548,14 @@ function* durabilityProbes() {
|
|
|
21375
21548
|
});
|
|
21376
21549
|
}
|
|
21377
21550
|
async function checkDurability(cwd) {
|
|
21378
|
-
if (!
|
|
21551
|
+
if (!existsSync50(cwd)) return treeIsGone;
|
|
21379
21552
|
const probes = durabilityProbes();
|
|
21380
21553
|
let step2 = probes.next();
|
|
21381
21554
|
while (!step2.done) step2 = probes.next(await gitResult(cwd, step2.value));
|
|
21382
21555
|
return step2.value;
|
|
21383
21556
|
}
|
|
21384
21557
|
function checkDurabilitySync(cwd) {
|
|
21385
|
-
if (!
|
|
21558
|
+
if (!existsSync50(cwd)) return treeIsGone;
|
|
21386
21559
|
const probes = durabilityProbes();
|
|
21387
21560
|
let step2 = probes.next();
|
|
21388
21561
|
while (!step2.done) step2 = probes.next(gitSyncResult(cwd, step2.value));
|
|
@@ -21625,20 +21798,20 @@ function persistedTreeRoots() {
|
|
|
21625
21798
|
}
|
|
21626
21799
|
|
|
21627
21800
|
// src/commands/sessions/daemon/worktree/seedWorktree.ts
|
|
21628
|
-
import { copyFileSync, existsSync as
|
|
21629
|
-
import { dirname as dirname26, join as
|
|
21801
|
+
import { copyFileSync, existsSync as existsSync52, mkdirSync as mkdirSync17 } from "fs";
|
|
21802
|
+
import { dirname as dirname26, join as join56 } from "path";
|
|
21630
21803
|
|
|
21631
21804
|
// src/commands/sessions/daemon/worktree/runInstall.ts
|
|
21632
21805
|
import { spawn as spawn5 } from "child_process";
|
|
21633
21806
|
|
|
21634
21807
|
// src/commands/sessions/daemon/worktree/resolveInstallCommand.ts
|
|
21635
|
-
import { existsSync as
|
|
21636
|
-
import { join as
|
|
21808
|
+
import { existsSync as existsSync51 } from "fs";
|
|
21809
|
+
import { join as join55 } from "path";
|
|
21637
21810
|
function detectInstallCommand(repoRoot2) {
|
|
21638
|
-
if (!
|
|
21639
|
-
if (
|
|
21640
|
-
if (
|
|
21641
|
-
if (
|
|
21811
|
+
if (!existsSync51(join55(repoRoot2, "package.json"))) return null;
|
|
21812
|
+
if (existsSync51(join55(repoRoot2, "pnpm-lock.yaml"))) return "pnpm install";
|
|
21813
|
+
if (existsSync51(join55(repoRoot2, "yarn.lock"))) return "yarn install";
|
|
21814
|
+
if (existsSync51(join55(repoRoot2, "bun.lockb"))) return "bun install";
|
|
21642
21815
|
return "npm install";
|
|
21643
21816
|
}
|
|
21644
21817
|
function resolveInstallCommand(repoRoot2, install) {
|
|
@@ -21750,11 +21923,11 @@ function seedWorktree(worktreePath, clone, onSeeded = () => {
|
|
|
21750
21923
|
}
|
|
21751
21924
|
function copyConfigFiles(worktreePath, clone, copy) {
|
|
21752
21925
|
for (const rel of copy) {
|
|
21753
|
-
const src =
|
|
21754
|
-
if (!
|
|
21755
|
-
const dest =
|
|
21926
|
+
const src = join56(clone, rel);
|
|
21927
|
+
if (!existsSync52(src)) continue;
|
|
21928
|
+
const dest = join56(worktreePath, rel);
|
|
21756
21929
|
try {
|
|
21757
|
-
|
|
21930
|
+
mkdirSync17(dirname26(dest), { recursive: true });
|
|
21758
21931
|
copyFileSync(src, dest);
|
|
21759
21932
|
daemonLog(`worktree ${worktreePath} seeded ${rel}`);
|
|
21760
21933
|
} catch (error) {
|
|
@@ -21793,10 +21966,10 @@ async function moveToPrCheckoutTree() {
|
|
|
21793
21966
|
}
|
|
21794
21967
|
|
|
21795
21968
|
// src/commands/review/prHeadBranch.ts
|
|
21796
|
-
import { execFileSync as
|
|
21969
|
+
import { execFileSync as execFileSync11 } from "child_process";
|
|
21797
21970
|
function prHeadBranch(number) {
|
|
21798
21971
|
try {
|
|
21799
|
-
const out =
|
|
21972
|
+
const out = execFileSync11(
|
|
21800
21973
|
"gh",
|
|
21801
21974
|
["pr", "view", number, "--json", "headRefName", "-q", ".headRefName"],
|
|
21802
21975
|
{ encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }
|
|
@@ -21844,7 +22017,7 @@ async function checkoutPr(number) {
|
|
|
21844
22017
|
if (headRef && moveToExistingCheckout(number, headRef)) return;
|
|
21845
22018
|
await moveToPrCheckoutTree();
|
|
21846
22019
|
try {
|
|
21847
|
-
|
|
22020
|
+
execFileSync12("gh", ["pr", "checkout", number], { stdio: "inherit" });
|
|
21848
22021
|
} catch {
|
|
21849
22022
|
console.error(chalk164.red(`gh pr checkout ${number} failed; aborting.`));
|
|
21850
22023
|
process.exit(1);
|
|
@@ -21866,7 +22039,7 @@ async function reviewPrComments(number, options2 = {}) {
|
|
|
21866
22039
|
const resumeSessionId = options2.resumeSessionId;
|
|
21867
22040
|
validateAnnounce(number, announce);
|
|
21868
22041
|
if (number && !resumeSessionId) await checkoutPr(number);
|
|
21869
|
-
const claudeSessionId = resumeSessionId ??
|
|
22042
|
+
const claudeSessionId = resumeSessionId ?? randomUUID10();
|
|
21870
22043
|
emitActivity({
|
|
21871
22044
|
kind: "command",
|
|
21872
22045
|
name: "review-pr-comments",
|
|
@@ -21884,14 +22057,14 @@ async function reviewPrComments(number, options2 = {}) {
|
|
|
21884
22057
|
}
|
|
21885
22058
|
|
|
21886
22059
|
// src/commands/fixConflict.ts
|
|
21887
|
-
import { randomUUID as
|
|
22060
|
+
import { randomUUID as randomUUID11 } from "crypto";
|
|
21888
22061
|
function buildPrompt3(rebase) {
|
|
21889
22062
|
return rebase ? "/fix-conflict --rebase" : "/fix-conflict";
|
|
21890
22063
|
}
|
|
21891
22064
|
async function fixConflict(number, options2 = {}) {
|
|
21892
22065
|
const { resumeSessionId } = options2;
|
|
21893
22066
|
if (number && !resumeSessionId) await checkoutPr(number);
|
|
21894
|
-
const claudeSessionId = resumeSessionId ??
|
|
22067
|
+
const claudeSessionId = resumeSessionId ?? randomUUID11();
|
|
21895
22068
|
emitActivity({
|
|
21896
22069
|
kind: "command",
|
|
21897
22070
|
name: "fix-conflict",
|
|
@@ -21981,12 +22154,12 @@ function registerList(program2) {
|
|
|
21981
22154
|
}
|
|
21982
22155
|
|
|
21983
22156
|
// src/commands/mermaid/index.ts
|
|
21984
|
-
import { mkdirSync as
|
|
22157
|
+
import { mkdirSync as mkdirSync18, readdirSync as readdirSync11 } from "fs";
|
|
21985
22158
|
import { resolve as resolve16 } from "path";
|
|
21986
22159
|
import chalk167 from "chalk";
|
|
21987
22160
|
|
|
21988
22161
|
// src/commands/mermaid/exportFile.ts
|
|
21989
|
-
import { readFileSync as readFileSync38, writeFileSync as
|
|
22162
|
+
import { readFileSync as readFileSync38, writeFileSync as writeFileSync32 } from "fs";
|
|
21990
22163
|
import { basename as basename17, extname as extname2, resolve as resolve15 } from "path";
|
|
21991
22164
|
import chalk166 from "chalk";
|
|
21992
22165
|
|
|
@@ -22037,7 +22210,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
22037
22210
|
if (onlyIndex !== void 0 && idx !== onlyIndex) continue;
|
|
22038
22211
|
const outPath = resolve15(outDir, `${stem}-${idx}.svg`);
|
|
22039
22212
|
const svg = await renderBlock(krokiUrl, source);
|
|
22040
|
-
|
|
22213
|
+
writeFileSync32(outPath, svg, "utf8");
|
|
22041
22214
|
console.log(chalk166.green(` \u2192 ${outPath}`));
|
|
22042
22215
|
}
|
|
22043
22216
|
}
|
|
@@ -22050,7 +22223,7 @@ function extractMermaidBlocks(markdown) {
|
|
|
22050
22223
|
async function mermaidExport(file, options2 = {}) {
|
|
22051
22224
|
const { mermaid } = loadConfig();
|
|
22052
22225
|
const outDir = resolve16(process.cwd(), options2.out ?? ".");
|
|
22053
|
-
|
|
22226
|
+
mkdirSync18(outDir, { recursive: true });
|
|
22054
22227
|
if (options2.index !== void 0) {
|
|
22055
22228
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
22056
22229
|
console.error(
|
|
@@ -22170,15 +22343,15 @@ function createNetcapHandler(options2) {
|
|
|
22170
22343
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
22171
22344
|
import { cp, readFile as readFile4, writeFile as writeFile4 } from "fs/promises";
|
|
22172
22345
|
import { networkInterfaces } from "os";
|
|
22173
|
-
import { join as
|
|
22346
|
+
import { join as join58 } from "path";
|
|
22174
22347
|
import chalk168 from "chalk";
|
|
22175
22348
|
|
|
22176
22349
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
22177
|
-
import { dirname as dirname27, join as
|
|
22350
|
+
import { dirname as dirname27, join as join57 } from "path";
|
|
22178
22351
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
22179
22352
|
var moduleDir = dirname27(fileURLToPath6(import.meta.url));
|
|
22180
22353
|
function netcapExtensionDir() {
|
|
22181
|
-
return
|
|
22354
|
+
return join57(moduleDir, "commands", "netcap", "netcap-extension");
|
|
22182
22355
|
}
|
|
22183
22356
|
|
|
22184
22357
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
@@ -22193,7 +22366,7 @@ function lanIPv4() {
|
|
|
22193
22366
|
return void 0;
|
|
22194
22367
|
}
|
|
22195
22368
|
async function configureBackground(dir, host, port, filter) {
|
|
22196
|
-
const file =
|
|
22369
|
+
const file = join58(dir, "background.js");
|
|
22197
22370
|
const source = await readFile4(file, "utf8");
|
|
22198
22371
|
await writeFile4(
|
|
22199
22372
|
file,
|
|
@@ -22233,20 +22406,20 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
22233
22406
|
}
|
|
22234
22407
|
|
|
22235
22408
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
22236
|
-
import { isAbsolute as isAbsolute3, join as
|
|
22409
|
+
import { isAbsolute as isAbsolute3, join as join60, resolve as resolve17 } from "path";
|
|
22237
22410
|
|
|
22238
22411
|
// src/commands/netcap/defaultCapturePath.ts
|
|
22239
22412
|
import { homedir as homedir20 } from "os";
|
|
22240
|
-
import { join as
|
|
22413
|
+
import { join as join59 } from "path";
|
|
22241
22414
|
function defaultCapturePath() {
|
|
22242
|
-
return
|
|
22415
|
+
return join59(homedir20(), ".assist", "netcap", "capture.jsonl");
|
|
22243
22416
|
}
|
|
22244
22417
|
|
|
22245
22418
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
22246
22419
|
function resolveNetcapOutPath(out) {
|
|
22247
22420
|
if (!out) return defaultCapturePath();
|
|
22248
22421
|
const dir = isAbsolute3(out) ? out : resolve17(process.cwd(), out);
|
|
22249
|
-
return
|
|
22422
|
+
return join60(dir, "capture.jsonl");
|
|
22250
22423
|
}
|
|
22251
22424
|
|
|
22252
22425
|
// src/commands/netcap/netcap.ts
|
|
@@ -22292,8 +22465,8 @@ netcap stopped \u2014 captured ${count8} ${count8 === 1 ? "entry" : "entries"} t
|
|
|
22292
22465
|
}
|
|
22293
22466
|
|
|
22294
22467
|
// src/commands/netcap/netcapExtract.ts
|
|
22295
|
-
import { writeFileSync as
|
|
22296
|
-
import { join as
|
|
22468
|
+
import { writeFileSync as writeFileSync33 } from "fs";
|
|
22469
|
+
import { join as join61 } from "path";
|
|
22297
22470
|
import chalk170 from "chalk";
|
|
22298
22471
|
|
|
22299
22472
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
@@ -22738,8 +22911,8 @@ function extractPostsFromCapture(captureFile) {
|
|
|
22738
22911
|
function netcapExtract(file) {
|
|
22739
22912
|
const captureFile = file ?? defaultCapturePath();
|
|
22740
22913
|
const posts = extractPostsFromCapture(captureFile);
|
|
22741
|
-
const outFile =
|
|
22742
|
-
|
|
22914
|
+
const outFile = join61(captureFile, "..", "posts.json");
|
|
22915
|
+
writeFileSync33(outFile, `${JSON.stringify(posts, null, 2)}
|
|
22743
22916
|
`);
|
|
22744
22917
|
console.log(
|
|
22745
22918
|
chalk170.green(`extracted ${posts.length} posts`),
|
|
@@ -22913,13 +23086,13 @@ function postReviewComment(vars) {
|
|
|
22913
23086
|
}
|
|
22914
23087
|
|
|
22915
23088
|
// src/commands/prs/reviewProposedPrComment.ts
|
|
22916
|
-
import { randomUUID as
|
|
23089
|
+
import { randomUUID as randomUUID12 } from "crypto";
|
|
22917
23090
|
async function reviewProposedPrComment(title, body, prNumber) {
|
|
22918
23091
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
22919
23092
|
if (process.env.ASSIST_SESSION !== "1" || !sessionId) return;
|
|
22920
23093
|
await awaitPreviewApproval("PR comment preview", {
|
|
22921
23094
|
sessionId,
|
|
22922
|
-
requestId:
|
|
23095
|
+
requestId: randomUUID12(),
|
|
22923
23096
|
title,
|
|
22924
23097
|
body,
|
|
22925
23098
|
prNumber,
|
|
@@ -23045,7 +23218,7 @@ async function comment2(path80, line, body, startLine) {
|
|
|
23045
23218
|
}
|
|
23046
23219
|
|
|
23047
23220
|
// src/commands/prs/edit.ts
|
|
23048
|
-
import { randomUUID as
|
|
23221
|
+
import { randomUUID as randomUUID13 } from "crypto";
|
|
23049
23222
|
|
|
23050
23223
|
// src/commands/prs/appendScreenshots.ts
|
|
23051
23224
|
function appendScreenshots(body, screenshots) {
|
|
@@ -23058,13 +23231,13 @@ ${screenshots.join("\n\n")}`;
|
|
|
23058
23231
|
}
|
|
23059
23232
|
|
|
23060
23233
|
// src/commands/prs/applyEdit.ts
|
|
23061
|
-
import { execFileSync as
|
|
23234
|
+
import { execFileSync as execFileSync13 } from "child_process";
|
|
23062
23235
|
function applyEdit(number, title, body) {
|
|
23063
23236
|
const args = ["pr", "edit", String(number)];
|
|
23064
23237
|
if (title) args.push("--title", title);
|
|
23065
23238
|
args.push("--body", body);
|
|
23066
23239
|
try {
|
|
23067
|
-
|
|
23240
|
+
execFileSync13("gh", args, { stdio: "inherit" });
|
|
23068
23241
|
} catch {
|
|
23069
23242
|
process.exit(1);
|
|
23070
23243
|
}
|
|
@@ -23242,7 +23415,7 @@ async function edit(options2) {
|
|
|
23242
23415
|
if (process.env.ASSIST_SESSION === "1" && sessionId) {
|
|
23243
23416
|
const decision = await awaitPreviewApproval("PR preview", {
|
|
23244
23417
|
sessionId,
|
|
23245
|
-
requestId:
|
|
23418
|
+
requestId: randomUUID13(),
|
|
23246
23419
|
title: options2.title ?? title,
|
|
23247
23420
|
body: newBody,
|
|
23248
23421
|
prNumber: number
|
|
@@ -23262,19 +23435,19 @@ import { execSync as execSync45 } from "child_process";
|
|
|
23262
23435
|
|
|
23263
23436
|
// src/commands/prs/resolveCommentWithReply.ts
|
|
23264
23437
|
import { execSync as execSync44 } from "child_process";
|
|
23265
|
-
import { unlinkSync as unlinkSync14, writeFileSync as
|
|
23438
|
+
import { unlinkSync as unlinkSync14, writeFileSync as writeFileSync34 } from "fs";
|
|
23266
23439
|
import { tmpdir as tmpdir6 } from "os";
|
|
23267
|
-
import { join as
|
|
23440
|
+
import { join as join63 } from "path";
|
|
23268
23441
|
|
|
23269
23442
|
// src/commands/prs/loadCommentsCache.ts
|
|
23270
|
-
import { existsSync as
|
|
23443
|
+
import { existsSync as existsSync53, readFileSync as readFileSync40, unlinkSync as unlinkSync13 } from "fs";
|
|
23271
23444
|
import { parse as parse2 } from "yaml";
|
|
23272
23445
|
|
|
23273
23446
|
// src/commands/prs/commentsCachePath.ts
|
|
23274
23447
|
import { homedir as homedir21 } from "os";
|
|
23275
|
-
import { join as
|
|
23448
|
+
import { join as join62 } from "path";
|
|
23276
23449
|
function commentsCachePath(org, repo, prNumber) {
|
|
23277
|
-
return
|
|
23450
|
+
return join62(
|
|
23278
23451
|
homedir21(),
|
|
23279
23452
|
".assist",
|
|
23280
23453
|
"pr-comments",
|
|
@@ -23287,7 +23460,7 @@ function commentsCachePath(org, repo, prNumber) {
|
|
|
23287
23460
|
// src/commands/prs/loadCommentsCache.ts
|
|
23288
23461
|
function loadCommentsCache(org, repo, prNumber) {
|
|
23289
23462
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
23290
|
-
if (!
|
|
23463
|
+
if (!existsSync53(cachePath)) {
|
|
23291
23464
|
return null;
|
|
23292
23465
|
}
|
|
23293
23466
|
const content = readFileSync40(cachePath, "utf8");
|
|
@@ -23295,7 +23468,7 @@ function loadCommentsCache(org, repo, prNumber) {
|
|
|
23295
23468
|
}
|
|
23296
23469
|
function deleteCommentsCache(org, repo, prNumber) {
|
|
23297
23470
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
23298
|
-
if (
|
|
23471
|
+
if (existsSync53(cachePath)) {
|
|
23299
23472
|
unlinkSync13(cachePath);
|
|
23300
23473
|
console.log("No more unresolved line comments. Cache dropped.");
|
|
23301
23474
|
}
|
|
@@ -23323,8 +23496,8 @@ function replyToComment(org, repo, prNumber, commentId, message3) {
|
|
|
23323
23496
|
// src/commands/prs/resolveCommentWithReply.ts
|
|
23324
23497
|
function resolveThread(threadId) {
|
|
23325
23498
|
const mutation = `mutation($threadId: ID!) { resolveReviewThread(input: {threadId: $threadId}) { thread { isResolved } } }`;
|
|
23326
|
-
const queryFile =
|
|
23327
|
-
|
|
23499
|
+
const queryFile = join63(tmpdir6(), `gh-mutation-${Date.now()}.graphql`);
|
|
23500
|
+
writeFileSync34(queryFile, mutation);
|
|
23328
23501
|
try {
|
|
23329
23502
|
execSync44(
|
|
23330
23503
|
`gh api graphql -F query=@${queryFile} -f threadId="${threadId}"`,
|
|
@@ -23406,13 +23579,13 @@ function fixed(commentId, sha) {
|
|
|
23406
23579
|
|
|
23407
23580
|
// src/commands/prs/fetchThreadIds.ts
|
|
23408
23581
|
import { execSync as execSync46 } from "child_process";
|
|
23409
|
-
import { unlinkSync as unlinkSync15, writeFileSync as
|
|
23582
|
+
import { unlinkSync as unlinkSync15, writeFileSync as writeFileSync35 } from "fs";
|
|
23410
23583
|
import { tmpdir as tmpdir7 } from "os";
|
|
23411
|
-
import { join as
|
|
23584
|
+
import { join as join64 } from "path";
|
|
23412
23585
|
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
23586
|
function fetchThreadIds(org, repo, prNumber) {
|
|
23414
|
-
const queryFile =
|
|
23415
|
-
|
|
23587
|
+
const queryFile = join64(tmpdir7(), `gh-query-${Date.now()}.graphql`);
|
|
23588
|
+
writeFileSync35(queryFile, THREAD_QUERY);
|
|
23416
23589
|
try {
|
|
23417
23590
|
const result = execSync46(
|
|
23418
23591
|
`gh api graphql -F query=@${queryFile} -F owner="${org}" -F repo="${repo}" -F prNumber=${prNumber}`,
|
|
@@ -23480,16 +23653,16 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
23480
23653
|
}
|
|
23481
23654
|
|
|
23482
23655
|
// src/commands/prs/listComments/updateCommentsCache.ts
|
|
23483
|
-
import { mkdirSync as
|
|
23656
|
+
import { mkdirSync as mkdirSync19, writeFileSync as writeFileSync36 } from "fs";
|
|
23484
23657
|
import { dirname as dirname29 } from "path";
|
|
23485
23658
|
import { stringify } from "yaml";
|
|
23486
23659
|
|
|
23487
23660
|
// src/commands/prs/removeStaleCommentsCaches.ts
|
|
23488
23661
|
import { readdirSync as readdirSync12, unlinkSync as unlinkSync16 } from "fs";
|
|
23489
|
-
import { join as
|
|
23662
|
+
import { join as join65 } from "path";
|
|
23490
23663
|
var STALE_PATTERN = /^pr-\d+-comments\.yaml$/;
|
|
23491
23664
|
function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
23492
|
-
const dir =
|
|
23665
|
+
const dir = join65(cwd, ".assist");
|
|
23493
23666
|
let entries;
|
|
23494
23667
|
try {
|
|
23495
23668
|
entries = readdirSync12(dir);
|
|
@@ -23497,20 +23670,20 @@ function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
|
23497
23670
|
return;
|
|
23498
23671
|
}
|
|
23499
23672
|
for (const entry of entries.filter((e) => STALE_PATTERN.test(e))) {
|
|
23500
|
-
unlinkSync16(
|
|
23673
|
+
unlinkSync16(join65(dir, entry));
|
|
23501
23674
|
}
|
|
23502
23675
|
}
|
|
23503
23676
|
|
|
23504
23677
|
// src/commands/prs/listComments/updateCommentsCache.ts
|
|
23505
23678
|
function writeCommentsCache(org, repo, prNumber, comments3) {
|
|
23506
23679
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
23507
|
-
|
|
23680
|
+
mkdirSync19(dirname29(cachePath), { recursive: true });
|
|
23508
23681
|
const cacheData = {
|
|
23509
23682
|
prNumber,
|
|
23510
23683
|
fetchedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
23511
23684
|
comments: comments3
|
|
23512
23685
|
};
|
|
23513
|
-
|
|
23686
|
+
writeFileSync36(cachePath, stringify(cacheData));
|
|
23514
23687
|
}
|
|
23515
23688
|
function updateCommentsCache(org, repo, prNumber, comments3) {
|
|
23516
23689
|
removeStaleCommentsCaches();
|
|
@@ -23860,7 +24033,7 @@ function buildValidatedBody(options2, usage) {
|
|
|
23860
24033
|
}
|
|
23861
24034
|
|
|
23862
24035
|
// src/commands/prs/placePr.ts
|
|
23863
|
-
import { execFileSync as
|
|
24036
|
+
import { execFileSync as execFileSync14 } from "child_process";
|
|
23864
24037
|
|
|
23865
24038
|
// src/commands/prs/buildCreateArgs.ts
|
|
23866
24039
|
function buildEditArgs(number, title, body) {
|
|
@@ -23927,7 +24100,7 @@ async function recordPrActivity() {
|
|
|
23927
24100
|
// src/commands/prs/placePr.ts
|
|
23928
24101
|
function hasUpstream2() {
|
|
23929
24102
|
try {
|
|
23930
|
-
|
|
24103
|
+
execFileSync14(
|
|
23931
24104
|
"git",
|
|
23932
24105
|
["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}"],
|
|
23933
24106
|
{ stdio: "pipe" }
|
|
@@ -23939,13 +24112,13 @@ function hasUpstream2() {
|
|
|
23939
24112
|
}
|
|
23940
24113
|
function ensureBranchPushed() {
|
|
23941
24114
|
const args = hasUpstream2() ? ["push"] : ["push", "--set-upstream", "origin", "HEAD"];
|
|
23942
|
-
|
|
24115
|
+
execFileSync14("git", args, { stdio: "inherit" });
|
|
23943
24116
|
}
|
|
23944
24117
|
async function placePr(prNumber, title, body, options2) {
|
|
23945
24118
|
const args = prNumber !== null ? buildEditArgs(prNumber, title, body) : buildCreateArgs(title, body, options2);
|
|
23946
24119
|
try {
|
|
23947
24120
|
if (prNumber === null && !options2.head) ensureBranchPushed();
|
|
23948
|
-
|
|
24121
|
+
execFileSync14("gh", args, { stdio: "inherit" });
|
|
23949
24122
|
} catch {
|
|
23950
24123
|
process.exit(1);
|
|
23951
24124
|
}
|
|
@@ -23953,7 +24126,7 @@ async function placePr(prNumber, title, body, options2) {
|
|
|
23953
24126
|
}
|
|
23954
24127
|
|
|
23955
24128
|
// src/commands/prs/previewAndPlace.ts
|
|
23956
|
-
import { randomUUID as
|
|
24129
|
+
import { randomUUID as randomUUID14 } from "crypto";
|
|
23957
24130
|
|
|
23958
24131
|
// src/commands/sessions/shared/requestSession.ts
|
|
23959
24132
|
function parseIncoming(line, type) {
|
|
@@ -24088,7 +24261,7 @@ function warn(reason4) {
|
|
|
24088
24261
|
async function previewAndPlace(args) {
|
|
24089
24262
|
const decision = await awaitPreviewApproval("PR preview", {
|
|
24090
24263
|
sessionId: args.sessionId,
|
|
24091
|
-
requestId:
|
|
24264
|
+
requestId: randomUUID14(),
|
|
24092
24265
|
title: args.title,
|
|
24093
24266
|
body: args.body,
|
|
24094
24267
|
prNumber: args.prNumber,
|
|
@@ -24108,9 +24281,9 @@ function resolveDraftState(options2, command) {
|
|
|
24108
24281
|
}
|
|
24109
24282
|
|
|
24110
24283
|
// src/commands/prs/raise.ts
|
|
24111
|
-
var
|
|
24284
|
+
var USAGE4 = "Usage: assist prs raise --title <title> --what <what> --why <why> [--how <how>] [--resolves <key>] [--force]";
|
|
24112
24285
|
async function raise(options2, command) {
|
|
24113
|
-
const { title, body } = buildValidatedBody(options2,
|
|
24286
|
+
const { title, body } = buildValidatedBody(options2, USAGE4);
|
|
24114
24287
|
const resolved = { ...options2, draft: resolveDraftState(options2, command) };
|
|
24115
24288
|
const existing = findCurrentPrNumber();
|
|
24116
24289
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
@@ -26560,10 +26733,10 @@ function registerRefactor(program2) {
|
|
|
26560
26733
|
}
|
|
26561
26734
|
|
|
26562
26735
|
// src/commands/review/checkoutOnlySession.ts
|
|
26563
|
-
import { randomUUID as
|
|
26736
|
+
import { randomUUID as randomUUID15 } from "crypto";
|
|
26564
26737
|
async function checkoutOnlySession(number) {
|
|
26565
26738
|
await checkoutPr(number);
|
|
26566
|
-
const claudeSessionId =
|
|
26739
|
+
const claudeSessionId = randomUUID15();
|
|
26567
26740
|
emitActivity({ kind: "command", name: "review", claudeSessionId });
|
|
26568
26741
|
const { done: done2 } = spawnClaude("", {
|
|
26569
26742
|
permissionMode: "acceptEdits",
|
|
@@ -26686,9 +26859,9 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
|
|
|
26686
26859
|
|
|
26687
26860
|
// src/commands/review/buildReviewPaths.ts
|
|
26688
26861
|
import { homedir as homedir22 } from "os";
|
|
26689
|
-
import { basename as basename18, join as
|
|
26862
|
+
import { basename as basename18, join as join66 } from "path";
|
|
26690
26863
|
function buildReviewPaths(repoRoot2, key) {
|
|
26691
|
-
const reviewDir =
|
|
26864
|
+
const reviewDir = join66(
|
|
26692
26865
|
homedir22(),
|
|
26693
26866
|
".assist",
|
|
26694
26867
|
"reviews",
|
|
@@ -26697,10 +26870,10 @@ function buildReviewPaths(repoRoot2, key) {
|
|
|
26697
26870
|
);
|
|
26698
26871
|
return {
|
|
26699
26872
|
reviewDir,
|
|
26700
|
-
requestPath:
|
|
26701
|
-
claudePath:
|
|
26702
|
-
codexPath:
|
|
26703
|
-
synthesisPath:
|
|
26873
|
+
requestPath: join66(reviewDir, "request.md"),
|
|
26874
|
+
claudePath: join66(reviewDir, "claude.md"),
|
|
26875
|
+
codexPath: join66(reviewDir, "codex.md"),
|
|
26876
|
+
synthesisPath: join66(reviewDir, "synthesis.md")
|
|
26704
26877
|
};
|
|
26705
26878
|
}
|
|
26706
26879
|
|
|
@@ -27426,16 +27599,16 @@ async function handlePostSynthesis(synthesisPath, prInfo, options2) {
|
|
|
27426
27599
|
}
|
|
27427
27600
|
|
|
27428
27601
|
// src/commands/review/prepareReviewDir.ts
|
|
27429
|
-
import { existsSync as
|
|
27602
|
+
import { existsSync as existsSync54, mkdirSync as mkdirSync20, unlinkSync as unlinkSync17, writeFileSync as writeFileSync37 } from "fs";
|
|
27430
27603
|
function clearReviewFiles(paths) {
|
|
27431
27604
|
for (const path80 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
27432
|
-
if (
|
|
27605
|
+
if (existsSync54(path80)) unlinkSync17(path80);
|
|
27433
27606
|
}
|
|
27434
27607
|
}
|
|
27435
27608
|
function prepareReviewDir(paths, requestBody, force) {
|
|
27436
|
-
|
|
27609
|
+
mkdirSync20(paths.reviewDir, { recursive: true });
|
|
27437
27610
|
if (force) clearReviewFiles(paths);
|
|
27438
|
-
|
|
27611
|
+
writeFileSync37(paths.requestPath, requestBody);
|
|
27439
27612
|
}
|
|
27440
27613
|
|
|
27441
27614
|
// src/commands/review/cachedReviewerResult.ts
|
|
@@ -27656,7 +27829,7 @@ function printReviewerFailures(results) {
|
|
|
27656
27829
|
}
|
|
27657
27830
|
|
|
27658
27831
|
// src/commands/review/runAndSynthesise.ts
|
|
27659
|
-
import { existsSync as
|
|
27832
|
+
import { existsSync as existsSync56, unlinkSync as unlinkSync19 } from "fs";
|
|
27660
27833
|
|
|
27661
27834
|
// src/commands/review/buildReviewerStdin.ts
|
|
27662
27835
|
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 +27904,7 @@ The review request is at: ${requestPath}
|
|
|
27731
27904
|
}
|
|
27732
27905
|
|
|
27733
27906
|
// src/commands/review/runClaudeReviewer.ts
|
|
27734
|
-
import { writeFileSync as
|
|
27907
|
+
import { writeFileSync as writeFileSync38 } from "fs";
|
|
27735
27908
|
|
|
27736
27909
|
// src/commands/review/finaliseReviewerSpinner.ts
|
|
27737
27910
|
var SUMMARY_MAX_LEN = 80;
|
|
@@ -28067,7 +28240,7 @@ async function runClaudeReviewer(spec) {
|
|
|
28067
28240
|
}
|
|
28068
28241
|
});
|
|
28069
28242
|
if (result.exitCode === 0 && finalText)
|
|
28070
|
-
|
|
28243
|
+
writeFileSync38(spec.outputPath, finalText);
|
|
28071
28244
|
return finaliseReviewerRun({ ...spec, command }, spinner, result);
|
|
28072
28245
|
}
|
|
28073
28246
|
|
|
@@ -28085,7 +28258,7 @@ function resolveClaude(args) {
|
|
|
28085
28258
|
}
|
|
28086
28259
|
|
|
28087
28260
|
// src/commands/review/runCodexReviewer.ts
|
|
28088
|
-
import { existsSync as
|
|
28261
|
+
import { existsSync as existsSync55, unlinkSync as unlinkSync18 } from "fs";
|
|
28089
28262
|
|
|
28090
28263
|
// src/commands/review/parseCodexEvent.ts
|
|
28091
28264
|
function isItemStarted(value) {
|
|
@@ -28137,7 +28310,7 @@ async function runCodexReviewer(spec) {
|
|
|
28137
28310
|
reportReviewerToolUse(spec.name, event, spinner);
|
|
28138
28311
|
}
|
|
28139
28312
|
});
|
|
28140
|
-
if (result.exitCode !== 0 &&
|
|
28313
|
+
if (result.exitCode !== 0 && existsSync55(spec.outputPath)) {
|
|
28141
28314
|
unlinkSync18(spec.outputPath);
|
|
28142
28315
|
}
|
|
28143
28316
|
return finaliseReviewerRun({ ...spec, command }, spinner, result);
|
|
@@ -28292,7 +28465,7 @@ async function runAndSynthesise(args) {
|
|
|
28292
28465
|
console.error("Both reviewers failed; skipping synthesis.");
|
|
28293
28466
|
return { ok: false, failures };
|
|
28294
28467
|
}
|
|
28295
|
-
if (anyFresh &&
|
|
28468
|
+
if (anyFresh && existsSync56(paths.synthesisPath)) {
|
|
28296
28469
|
unlinkSync19(paths.synthesisPath);
|
|
28297
28470
|
}
|
|
28298
28471
|
const synthesisResult = await synthesise(paths, { multi });
|
|
@@ -29591,27 +29764,27 @@ async function configure() {
|
|
|
29591
29764
|
}
|
|
29592
29765
|
|
|
29593
29766
|
// src/commands/transcript/list.ts
|
|
29594
|
-
import { existsSync as
|
|
29595
|
-
import { join as
|
|
29767
|
+
import { existsSync as existsSync61, readdirSync as readdirSync19, statSync as statSync10 } from "fs";
|
|
29768
|
+
import { join as join77 } from "path";
|
|
29596
29769
|
function list4() {
|
|
29597
29770
|
const { vttDir } = getTranscriptConfig();
|
|
29598
|
-
if (!
|
|
29771
|
+
if (!existsSync61(vttDir)) return;
|
|
29599
29772
|
for (const entry of readdirSync19(vttDir)) {
|
|
29600
29773
|
if (!entry.endsWith(".vtt")) continue;
|
|
29601
|
-
if (statSync10(
|
|
29774
|
+
if (statSync10(join77(vttDir, entry)).isDirectory()) continue;
|
|
29602
29775
|
console.log(entry);
|
|
29603
29776
|
}
|
|
29604
29777
|
}
|
|
29605
29778
|
|
|
29606
29779
|
// src/commands/transcript/move.ts
|
|
29607
29780
|
import {
|
|
29608
|
-
existsSync as
|
|
29609
|
-
mkdirSync as
|
|
29781
|
+
existsSync as existsSync62,
|
|
29782
|
+
mkdirSync as mkdirSync26,
|
|
29610
29783
|
readFileSync as readFileSync47,
|
|
29611
29784
|
renameSync as renameSync2,
|
|
29612
|
-
writeFileSync as
|
|
29785
|
+
writeFileSync as writeFileSync42
|
|
29613
29786
|
} from "fs";
|
|
29614
|
-
import { basename as basename21, join as
|
|
29787
|
+
import { basename as basename21, join as join78 } from "path";
|
|
29615
29788
|
|
|
29616
29789
|
// src/commands/transcript/cleanText.ts
|
|
29617
29790
|
function cleanText(text18) {
|
|
@@ -29824,9 +29997,9 @@ function convertVttToMarkdown(inputPath) {
|
|
|
29824
29997
|
return formatChatLog(messages);
|
|
29825
29998
|
}
|
|
29826
29999
|
function archiveRawVtt(vttDir, sourcePath, filename) {
|
|
29827
|
-
const processedDir =
|
|
29828
|
-
|
|
29829
|
-
renameSync2(sourcePath,
|
|
30000
|
+
const processedDir = join78(vttDir, "processed");
|
|
30001
|
+
mkdirSync26(processedDir, { recursive: true });
|
|
30002
|
+
renameSync2(sourcePath, join78(processedDir, filename));
|
|
29830
30003
|
}
|
|
29831
30004
|
function move(file, options2) {
|
|
29832
30005
|
const { date, client } = options2;
|
|
@@ -29836,19 +30009,19 @@ function move(file, options2) {
|
|
|
29836
30009
|
}
|
|
29837
30010
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
29838
30011
|
const filename = basename21(file);
|
|
29839
|
-
const sourcePath =
|
|
29840
|
-
if (!
|
|
30012
|
+
const sourcePath = join78(vttDir, filename);
|
|
30013
|
+
if (!existsSync62(sourcePath)) {
|
|
29841
30014
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
29842
30015
|
process.exit(1);
|
|
29843
30016
|
}
|
|
29844
30017
|
const base = basename21(filename, ".vtt").replace(/ Transcription$/, "");
|
|
29845
30018
|
const outputName = `${date} ${base}.md`;
|
|
29846
|
-
const formattedDir =
|
|
29847
|
-
|
|
29848
|
-
const formattedPath =
|
|
29849
|
-
|
|
30019
|
+
const formattedDir = join78(transcriptsDir, client);
|
|
30020
|
+
mkdirSync26(formattedDir, { recursive: true });
|
|
30021
|
+
const formattedPath = join78(formattedDir, outputName);
|
|
30022
|
+
writeFileSync42(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
|
|
29850
30023
|
archiveRawVtt(vttDir, sourcePath, filename);
|
|
29851
|
-
const summaryPath =
|
|
30024
|
+
const summaryPath = join78(summaryDir, client, outputName);
|
|
29852
30025
|
console.log(`Formatted transcript: ${formattedPath}`);
|
|
29853
30026
|
console.log(`Summary target: ${summaryPath}`);
|
|
29854
30027
|
}
|
|
@@ -29930,45 +30103,45 @@ function registerVerify(program2) {
|
|
|
29930
30103
|
|
|
29931
30104
|
// src/commands/voice/devices.ts
|
|
29932
30105
|
import { spawnSync as spawnSync7 } from "child_process";
|
|
29933
|
-
import { join as
|
|
30106
|
+
import { join as join80 } from "path";
|
|
29934
30107
|
|
|
29935
30108
|
// src/commands/voice/shared.ts
|
|
29936
30109
|
import { homedir as homedir24 } from "os";
|
|
29937
|
-
import { dirname as dirname34, join as
|
|
30110
|
+
import { dirname as dirname34, join as join79 } from "path";
|
|
29938
30111
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
29939
30112
|
var __dirname6 = dirname34(fileURLToPath8(import.meta.url));
|
|
29940
|
-
var VOICE_DIR =
|
|
30113
|
+
var VOICE_DIR = join79(homedir24(), ".assist", "voice");
|
|
29941
30114
|
var voicePaths = {
|
|
29942
30115
|
dir: VOICE_DIR,
|
|
29943
|
-
pid:
|
|
29944
|
-
log:
|
|
29945
|
-
venv:
|
|
29946
|
-
lock:
|
|
30116
|
+
pid: join79(VOICE_DIR, "voice.pid"),
|
|
30117
|
+
log: join79(VOICE_DIR, "voice.log"),
|
|
30118
|
+
venv: join79(VOICE_DIR, ".venv"),
|
|
30119
|
+
lock: join79(VOICE_DIR, "voice.lock")
|
|
29947
30120
|
};
|
|
29948
30121
|
function getPythonDir() {
|
|
29949
|
-
return
|
|
30122
|
+
return join79(__dirname6, "commands", "voice", "python");
|
|
29950
30123
|
}
|
|
29951
30124
|
function getVenvPython() {
|
|
29952
|
-
return process.platform === "win32" ?
|
|
30125
|
+
return process.platform === "win32" ? join79(voicePaths.venv, "Scripts", "python.exe") : join79(voicePaths.venv, "bin", "python");
|
|
29953
30126
|
}
|
|
29954
30127
|
function getLockDir() {
|
|
29955
30128
|
const config = loadConfig();
|
|
29956
30129
|
return config.voice?.lockDir ?? VOICE_DIR;
|
|
29957
30130
|
}
|
|
29958
30131
|
function getLockFile() {
|
|
29959
|
-
return
|
|
30132
|
+
return join79(getLockDir(), "voice.lock");
|
|
29960
30133
|
}
|
|
29961
30134
|
|
|
29962
30135
|
// src/commands/voice/devices.ts
|
|
29963
30136
|
function devices() {
|
|
29964
|
-
const script =
|
|
30137
|
+
const script = join80(getPythonDir(), "list_devices.py");
|
|
29965
30138
|
spawnSync7(getVenvPython(), [script], { stdio: "inherit" });
|
|
29966
30139
|
}
|
|
29967
30140
|
|
|
29968
30141
|
// src/commands/voice/logs.ts
|
|
29969
|
-
import { existsSync as
|
|
30142
|
+
import { existsSync as existsSync63, readFileSync as readFileSync48 } from "fs";
|
|
29970
30143
|
function logs(options2) {
|
|
29971
|
-
if (!
|
|
30144
|
+
if (!existsSync63(voicePaths.log)) {
|
|
29972
30145
|
console.log("No voice log file found");
|
|
29973
30146
|
return;
|
|
29974
30147
|
}
|
|
@@ -29995,13 +30168,13 @@ function logs(options2) {
|
|
|
29995
30168
|
|
|
29996
30169
|
// src/commands/voice/setup.ts
|
|
29997
30170
|
import { spawnSync as spawnSync8 } from "child_process";
|
|
29998
|
-
import { mkdirSync as
|
|
29999
|
-
import { join as
|
|
30171
|
+
import { mkdirSync as mkdirSync28 } from "fs";
|
|
30172
|
+
import { join as join82 } from "path";
|
|
30000
30173
|
|
|
30001
30174
|
// src/commands/voice/checkLockFile.ts
|
|
30002
30175
|
import { execSync as execSync58 } from "child_process";
|
|
30003
|
-
import { existsSync as
|
|
30004
|
-
import { join as
|
|
30176
|
+
import { existsSync as existsSync64, mkdirSync as mkdirSync27, readFileSync as readFileSync49, writeFileSync as writeFileSync43 } from "fs";
|
|
30177
|
+
import { join as join81 } from "path";
|
|
30005
30178
|
function isProcessAlive2(pid) {
|
|
30006
30179
|
try {
|
|
30007
30180
|
process.kill(pid, 0);
|
|
@@ -30012,7 +30185,7 @@ function isProcessAlive2(pid) {
|
|
|
30012
30185
|
}
|
|
30013
30186
|
function checkLockFile() {
|
|
30014
30187
|
const lockFile = getLockFile();
|
|
30015
|
-
if (!
|
|
30188
|
+
if (!existsSync64(lockFile)) return;
|
|
30016
30189
|
try {
|
|
30017
30190
|
const lock2 = JSON.parse(readFileSync49(lockFile, "utf8"));
|
|
30018
30191
|
if (lock2.pid && isProcessAlive2(lock2.pid)) {
|
|
@@ -30025,7 +30198,7 @@ function checkLockFile() {
|
|
|
30025
30198
|
}
|
|
30026
30199
|
}
|
|
30027
30200
|
function bootstrapVenv() {
|
|
30028
|
-
if (
|
|
30201
|
+
if (existsSync64(getVenvPython())) return;
|
|
30029
30202
|
console.log("Setting up Python environment...");
|
|
30030
30203
|
const pythonDir = getPythonDir();
|
|
30031
30204
|
execSync58(
|
|
@@ -30038,8 +30211,8 @@ function bootstrapVenv() {
|
|
|
30038
30211
|
}
|
|
30039
30212
|
function writeLockFile(pid) {
|
|
30040
30213
|
const lockFile = getLockFile();
|
|
30041
|
-
|
|
30042
|
-
|
|
30214
|
+
mkdirSync27(join81(lockFile, ".."), { recursive: true });
|
|
30215
|
+
writeFileSync43(
|
|
30043
30216
|
lockFile,
|
|
30044
30217
|
JSON.stringify({
|
|
30045
30218
|
pid,
|
|
@@ -30051,10 +30224,10 @@ function writeLockFile(pid) {
|
|
|
30051
30224
|
|
|
30052
30225
|
// src/commands/voice/setup.ts
|
|
30053
30226
|
function setup() {
|
|
30054
|
-
|
|
30227
|
+
mkdirSync28(voicePaths.dir, { recursive: true });
|
|
30055
30228
|
bootstrapVenv();
|
|
30056
30229
|
console.log("\nDownloading models...\n");
|
|
30057
|
-
const script =
|
|
30230
|
+
const script = join82(getPythonDir(), "setup_models.py");
|
|
30058
30231
|
const result = spawnSync8(getVenvPython(), [script], {
|
|
30059
30232
|
stdio: "inherit",
|
|
30060
30233
|
env: { ...process.env, VOICE_LOG_FILE: voicePaths.log }
|
|
@@ -30067,8 +30240,8 @@ function setup() {
|
|
|
30067
30240
|
|
|
30068
30241
|
// src/commands/voice/start.ts
|
|
30069
30242
|
import { spawn as spawn8 } from "child_process";
|
|
30070
|
-
import { mkdirSync as
|
|
30071
|
-
import { join as
|
|
30243
|
+
import { mkdirSync as mkdirSync29, writeFileSync as writeFileSync44 } from "fs";
|
|
30244
|
+
import { join as join83 } from "path";
|
|
30072
30245
|
|
|
30073
30246
|
// src/commands/voice/buildDaemonEnv.ts
|
|
30074
30247
|
function buildDaemonEnv(options2) {
|
|
@@ -30096,17 +30269,17 @@ function spawnBackground(python, script, env) {
|
|
|
30096
30269
|
console.error("Failed to start voice daemon");
|
|
30097
30270
|
process.exit(1);
|
|
30098
30271
|
}
|
|
30099
|
-
|
|
30272
|
+
writeFileSync44(voicePaths.pid, String(pid));
|
|
30100
30273
|
writeLockFile(pid);
|
|
30101
30274
|
console.log(`Voice daemon started (PID ${pid})`);
|
|
30102
30275
|
}
|
|
30103
30276
|
function start2(options2) {
|
|
30104
|
-
|
|
30277
|
+
mkdirSync29(voicePaths.dir, { recursive: true });
|
|
30105
30278
|
checkLockFile();
|
|
30106
30279
|
bootstrapVenv();
|
|
30107
30280
|
const debug = options2.debug || options2.foreground || process.platform === "win32";
|
|
30108
30281
|
const env = buildDaemonEnv({ debug });
|
|
30109
|
-
const script =
|
|
30282
|
+
const script = join83(getPythonDir(), "voice_daemon.py");
|
|
30110
30283
|
const python = getVenvPython();
|
|
30111
30284
|
if (options2.foreground) {
|
|
30112
30285
|
spawnForeground(python, script, env);
|
|
@@ -30116,7 +30289,7 @@ function start2(options2) {
|
|
|
30116
30289
|
}
|
|
30117
30290
|
|
|
30118
30291
|
// src/commands/voice/status.ts
|
|
30119
|
-
import { existsSync as
|
|
30292
|
+
import { existsSync as existsSync65, readFileSync as readFileSync50 } from "fs";
|
|
30120
30293
|
function isProcessAlive3(pid) {
|
|
30121
30294
|
try {
|
|
30122
30295
|
process.kill(pid, 0);
|
|
@@ -30126,12 +30299,12 @@ function isProcessAlive3(pid) {
|
|
|
30126
30299
|
}
|
|
30127
30300
|
}
|
|
30128
30301
|
function readRecentLogs(count8) {
|
|
30129
|
-
if (!
|
|
30302
|
+
if (!existsSync65(voicePaths.log)) return [];
|
|
30130
30303
|
const lines2 = readFileSync50(voicePaths.log, "utf8").trim().split("\n");
|
|
30131
30304
|
return lines2.slice(-count8);
|
|
30132
30305
|
}
|
|
30133
30306
|
function status2() {
|
|
30134
|
-
if (!
|
|
30307
|
+
if (!existsSync65(voicePaths.pid)) {
|
|
30135
30308
|
console.log("Voice daemon: not running (no PID file)");
|
|
30136
30309
|
return;
|
|
30137
30310
|
}
|
|
@@ -30154,9 +30327,9 @@ function status2() {
|
|
|
30154
30327
|
}
|
|
30155
30328
|
|
|
30156
30329
|
// src/commands/voice/stop.ts
|
|
30157
|
-
import { existsSync as
|
|
30330
|
+
import { existsSync as existsSync66, readFileSync as readFileSync51, unlinkSync as unlinkSync20 } from "fs";
|
|
30158
30331
|
function stop2() {
|
|
30159
|
-
if (!
|
|
30332
|
+
if (!existsSync66(voicePaths.pid)) {
|
|
30160
30333
|
console.log("Voice daemon is not running (no PID file)");
|
|
30161
30334
|
return;
|
|
30162
30335
|
}
|
|
@@ -30173,7 +30346,7 @@ function stop2() {
|
|
|
30173
30346
|
}
|
|
30174
30347
|
try {
|
|
30175
30348
|
const lockFile = getLockFile();
|
|
30176
|
-
if (
|
|
30349
|
+
if (existsSync66(lockFile)) unlinkSync20(lockFile);
|
|
30177
30350
|
} catch {
|
|
30178
30351
|
}
|
|
30179
30352
|
console.log("Voice daemon stopped");
|
|
@@ -30192,12 +30365,12 @@ function registerVoice(program2) {
|
|
|
30192
30365
|
}
|
|
30193
30366
|
|
|
30194
30367
|
// src/commands/watch/readBuiltVersion.ts
|
|
30195
|
-
import { join as
|
|
30368
|
+
import { join as join84 } from "path";
|
|
30196
30369
|
|
|
30197
30370
|
// src/commands/watch/resolveUpstream.ts
|
|
30198
|
-
import { execFileSync as
|
|
30199
|
-
function
|
|
30200
|
-
return
|
|
30371
|
+
import { execFileSync as execFileSync15 } from "child_process";
|
|
30372
|
+
function runGit3(args, cwd) {
|
|
30373
|
+
return execFileSync15("git", args, {
|
|
30201
30374
|
encoding: "utf8",
|
|
30202
30375
|
stdio: ["pipe", "pipe", "pipe"],
|
|
30203
30376
|
cwd
|
|
@@ -30205,7 +30378,7 @@ function runGit2(args, cwd) {
|
|
|
30205
30378
|
}
|
|
30206
30379
|
function resolveUpstream(cwd) {
|
|
30207
30380
|
try {
|
|
30208
|
-
|
|
30381
|
+
runGit3(["rev-parse", "--is-inside-work-tree"], cwd);
|
|
30209
30382
|
} catch {
|
|
30210
30383
|
throw new Error(
|
|
30211
30384
|
"not a git repository \u2014 run assist watch wait from inside a repo"
|
|
@@ -30213,7 +30386,7 @@ function resolveUpstream(cwd) {
|
|
|
30213
30386
|
}
|
|
30214
30387
|
let branch2;
|
|
30215
30388
|
try {
|
|
30216
|
-
branch2 =
|
|
30389
|
+
branch2 = runGit3(["symbolic-ref", "--quiet", "--short", "HEAD"], cwd);
|
|
30217
30390
|
} catch {
|
|
30218
30391
|
throw new Error(
|
|
30219
30392
|
"HEAD is detached \u2014 check out a branch before waiting on its upstream"
|
|
@@ -30222,7 +30395,7 @@ function resolveUpstream(cwd) {
|
|
|
30222
30395
|
try {
|
|
30223
30396
|
return {
|
|
30224
30397
|
branch: branch2,
|
|
30225
|
-
upstream:
|
|
30398
|
+
upstream: runGit3(
|
|
30226
30399
|
["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}"],
|
|
30227
30400
|
cwd
|
|
30228
30401
|
)
|
|
@@ -30237,8 +30410,8 @@ function resolveUpstream(cwd) {
|
|
|
30237
30410
|
// src/commands/watch/readBuiltVersion.ts
|
|
30238
30411
|
function readBuiltVersion(cwd) {
|
|
30239
30412
|
try {
|
|
30240
|
-
const root =
|
|
30241
|
-
return readPackageJson(
|
|
30413
|
+
const root = runGit3(["rev-parse", "--show-toplevel"], cwd);
|
|
30414
|
+
return readPackageJson(join84(root, "package.json")).version ?? "unknown";
|
|
30242
30415
|
} catch {
|
|
30243
30416
|
return "unknown";
|
|
30244
30417
|
}
|
|
@@ -30246,7 +30419,7 @@ function readBuiltVersion(cwd) {
|
|
|
30246
30419
|
|
|
30247
30420
|
// src/commands/watch/readRecentCommits.ts
|
|
30248
30421
|
function readRecentCommits(count8 = 10, cwd) {
|
|
30249
|
-
const output =
|
|
30422
|
+
const output = runGit3(
|
|
30250
30423
|
["log", `-${count8}`, "--pretty=format:%H%x09%h%x09%ar%x09%s"],
|
|
30251
30424
|
cwd
|
|
30252
30425
|
);
|
|
@@ -30309,9 +30482,9 @@ function buildWatchReport(from, cwd) {
|
|
|
30309
30482
|
return renderWatchReport({
|
|
30310
30483
|
version: readBuiltVersion(cwd),
|
|
30311
30484
|
commits: readRecentCommits(10, cwd),
|
|
30312
|
-
newShas: range ? lines(
|
|
30485
|
+
newShas: range ? lines(runGit3(["rev-list", range], cwd)) : [],
|
|
30313
30486
|
restarts: restartAdvice(
|
|
30314
|
-
range ? lines(
|
|
30487
|
+
range ? lines(runGit3(["diff", "--name-only", range], cwd)) : []
|
|
30315
30488
|
)
|
|
30316
30489
|
});
|
|
30317
30490
|
}
|
|
@@ -30409,14 +30582,14 @@ function parseWatchDurations(interval, timeout) {
|
|
|
30409
30582
|
var STASH_MESSAGE = "assist watch";
|
|
30410
30583
|
function attemptGit(args, cwd) {
|
|
30411
30584
|
try {
|
|
30412
|
-
|
|
30585
|
+
runGit3(args, cwd);
|
|
30413
30586
|
return { ok: true };
|
|
30414
30587
|
} catch (error) {
|
|
30415
30588
|
return { ok: false, reason: gitFailureReason(error) };
|
|
30416
30589
|
}
|
|
30417
30590
|
}
|
|
30418
30591
|
function fastForwarded(cwd) {
|
|
30419
|
-
return { kind: "fast-forwarded", sha:
|
|
30592
|
+
return { kind: "fast-forwarded", sha: runGit3(["rev-parse", "@"], cwd) };
|
|
30420
30593
|
}
|
|
30421
30594
|
function operationInProgress(cwd) {
|
|
30422
30595
|
return ["MERGE_HEAD", "REBASE_HEAD"].some(
|
|
@@ -30425,7 +30598,7 @@ function operationInProgress(cwd) {
|
|
|
30425
30598
|
}
|
|
30426
30599
|
function headMatchesUpstream(cwd) {
|
|
30427
30600
|
try {
|
|
30428
|
-
return
|
|
30601
|
+
return runGit3(["rev-parse", "@"], cwd) === runGit3(["rev-parse", "@{u}"], cwd);
|
|
30429
30602
|
} catch {
|
|
30430
30603
|
return false;
|
|
30431
30604
|
}
|
|
@@ -30436,7 +30609,7 @@ function behindUpstream(cwd) {
|
|
|
30436
30609
|
function stashDirtyTree(cwd) {
|
|
30437
30610
|
let dirty;
|
|
30438
30611
|
try {
|
|
30439
|
-
dirty =
|
|
30612
|
+
dirty = runGit3(["status", "--porcelain"], cwd) !== "";
|
|
30440
30613
|
} catch (error) {
|
|
30441
30614
|
return { ok: false, reason: gitFailureReason(error) };
|
|
30442
30615
|
}
|
|
@@ -30536,7 +30709,7 @@ function resolveParams(params, cliArgs) {
|
|
|
30536
30709
|
}
|
|
30537
30710
|
|
|
30538
30711
|
// src/commands/run/resolveRunCwd.ts
|
|
30539
|
-
import { existsSync as
|
|
30712
|
+
import { existsSync as existsSync67 } from "fs";
|
|
30540
30713
|
import { resolve as resolve18 } from "path";
|
|
30541
30714
|
var MissingRunCwdError = class extends Error {
|
|
30542
30715
|
constructor(runName, cwd) {
|
|
@@ -30549,25 +30722,25 @@ var MissingRunCwdError = class extends Error {
|
|
|
30549
30722
|
function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
|
|
30550
30723
|
if (!config.cwd) return void 0;
|
|
30551
30724
|
const cwd = resolve18(baseDir, config.cwd);
|
|
30552
|
-
if (!
|
|
30725
|
+
if (!existsSync67(cwd)) throw new MissingRunCwdError(config.name, cwd);
|
|
30553
30726
|
return cwd;
|
|
30554
30727
|
}
|
|
30555
30728
|
|
|
30556
30729
|
// src/commands/run/runCommandToCompletion.ts
|
|
30557
30730
|
import { spawn as spawn9 } from "child_process";
|
|
30558
|
-
import { existsSync as
|
|
30731
|
+
import { existsSync as existsSync69 } from "fs";
|
|
30559
30732
|
|
|
30560
30733
|
// src/commands/run/resolveCommand.ts
|
|
30561
|
-
import { execFileSync as
|
|
30562
|
-
import { existsSync as
|
|
30563
|
-
import { dirname as dirname35, join as
|
|
30734
|
+
import { execFileSync as execFileSync16 } from "child_process";
|
|
30735
|
+
import { existsSync as existsSync68 } from "fs";
|
|
30736
|
+
import { dirname as dirname35, join as join85, resolve as resolve19 } from "path";
|
|
30564
30737
|
function resolveCommand2(command) {
|
|
30565
30738
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
30566
30739
|
try {
|
|
30567
|
-
const gitPath =
|
|
30740
|
+
const gitPath = execFileSync16("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
30568
30741
|
const gitRoot = resolve19(dirname35(gitPath), "..");
|
|
30569
|
-
const gitBash =
|
|
30570
|
-
if (
|
|
30742
|
+
const gitBash = join85(gitRoot, "bin", "bash.exe");
|
|
30743
|
+
if (existsSync68(gitBash)) return gitBash;
|
|
30571
30744
|
} catch {
|
|
30572
30745
|
return command;
|
|
30573
30746
|
}
|
|
@@ -30577,7 +30750,7 @@ function resolveCommand2(command) {
|
|
|
30577
30750
|
// src/commands/run/runCommandToCompletion.ts
|
|
30578
30751
|
function runCommandToCompletion(command, args, env, cwd, quiet) {
|
|
30579
30752
|
return new Promise((resolveResult) => {
|
|
30580
|
-
if (cwd && !
|
|
30753
|
+
if (cwd && !existsSync69(cwd)) {
|
|
30581
30754
|
resolveResult({
|
|
30582
30755
|
kind: "failed",
|
|
30583
30756
|
message: `Failed to execute command: cwd ${cwd} does not exist`
|
|
@@ -30661,11 +30834,11 @@ async function reportBuildOrExit(entry) {
|
|
|
30661
30834
|
}
|
|
30662
30835
|
|
|
30663
30836
|
// src/commands/watch/fetchQuietly.ts
|
|
30664
|
-
import { execFileSync as
|
|
30837
|
+
import { execFileSync as execFileSync17 } from "child_process";
|
|
30665
30838
|
var MIN_FETCH_TIMEOUT_MS = 6e4;
|
|
30666
30839
|
function fetchQuietly(cwd, intervalMs) {
|
|
30667
30840
|
try {
|
|
30668
|
-
|
|
30841
|
+
execFileSync17("git", ["fetch", "--quiet"], {
|
|
30669
30842
|
stdio: ["pipe", "pipe", "pipe"],
|
|
30670
30843
|
cwd,
|
|
30671
30844
|
timeout: Math.max(intervalMs, MIN_FETCH_TIMEOUT_MS)
|
|
@@ -30684,9 +30857,9 @@ function detectMovement(from, to, count8) {
|
|
|
30684
30857
|
// src/commands/watch/readMovement.ts
|
|
30685
30858
|
function readMovement(cwd) {
|
|
30686
30859
|
try {
|
|
30687
|
-
const from =
|
|
30688
|
-
const to =
|
|
30689
|
-
const count8 = Number(
|
|
30860
|
+
const from = runGit3(["rev-parse", "@"], cwd);
|
|
30861
|
+
const to = runGit3(["rev-parse", "@{u}"], cwd);
|
|
30862
|
+
const count8 = Number(runGit3(["rev-list", "--count", "@..@{u}"], cwd));
|
|
30690
30863
|
return detectMovement(from, to, count8);
|
|
30691
30864
|
} catch {
|
|
30692
30865
|
return void 0;
|
|
@@ -30965,9 +31138,9 @@ async function auth() {
|
|
|
30965
31138
|
}
|
|
30966
31139
|
|
|
30967
31140
|
// src/commands/roam/postRoamActivity.ts
|
|
30968
|
-
import { execFileSync as
|
|
31141
|
+
import { execFileSync as execFileSync18 } from "child_process";
|
|
30969
31142
|
import { readdirSync as readdirSync20, readFileSync as readFileSync52, statSync as statSync11 } from "fs";
|
|
30970
|
-
import { join as
|
|
31143
|
+
import { join as join86 } from "path";
|
|
30971
31144
|
function findPortFile(roamDir) {
|
|
30972
31145
|
let entries;
|
|
30973
31146
|
try {
|
|
@@ -30976,7 +31149,7 @@ function findPortFile(roamDir) {
|
|
|
30976
31149
|
return void 0;
|
|
30977
31150
|
}
|
|
30978
31151
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
30979
|
-
const path80 =
|
|
31152
|
+
const path80 = join86(roamDir, name);
|
|
30980
31153
|
try {
|
|
30981
31154
|
return { path: path80, mtimeMs: statSync11(path80).mtimeMs };
|
|
30982
31155
|
} catch {
|
|
@@ -30988,7 +31161,7 @@ function findPortFile(roamDir) {
|
|
|
30988
31161
|
function postRoamActivity(app, event) {
|
|
30989
31162
|
const appData = process.env.APPDATA;
|
|
30990
31163
|
if (!appData) return;
|
|
30991
|
-
const portFile = findPortFile(
|
|
31164
|
+
const portFile = findPortFile(join86(appData, "Roam"));
|
|
30992
31165
|
if (!portFile) return;
|
|
30993
31166
|
let port;
|
|
30994
31167
|
try {
|
|
@@ -30998,7 +31171,7 @@ function postRoamActivity(app, event) {
|
|
|
30998
31171
|
}
|
|
30999
31172
|
const url = `http://127.0.0.1:${port}/api/v1/activity/${app}/${event}?pid=${app === "codex" ? 99998 : 99999}`;
|
|
31000
31173
|
try {
|
|
31001
|
-
|
|
31174
|
+
execFileSync18("curl", ["-sf", "--max-time", "0.2", "-X", "POST", url], {
|
|
31002
31175
|
stdio: "ignore"
|
|
31003
31176
|
});
|
|
31004
31177
|
} catch {
|
|
@@ -31120,8 +31293,8 @@ async function run3(name, args) {
|
|
|
31120
31293
|
}
|
|
31121
31294
|
|
|
31122
31295
|
// src/commands/run/add.ts
|
|
31123
|
-
import { mkdirSync as
|
|
31124
|
-
import { join as
|
|
31296
|
+
import { mkdirSync as mkdirSync30, writeFileSync as writeFileSync45 } from "fs";
|
|
31297
|
+
import { join as join87 } from "path";
|
|
31125
31298
|
|
|
31126
31299
|
// src/commands/run/extractOption.ts
|
|
31127
31300
|
function extractOption(args, flag) {
|
|
@@ -31182,16 +31355,16 @@ function saveNewRunConfig(name, command, args, cwd) {
|
|
|
31182
31355
|
saveConfig(config);
|
|
31183
31356
|
}
|
|
31184
31357
|
function createCommandFile(name) {
|
|
31185
|
-
const dir =
|
|
31186
|
-
|
|
31358
|
+
const dir = join87(".claude", "commands");
|
|
31359
|
+
mkdirSync30(dir, { recursive: true });
|
|
31187
31360
|
const content = `---
|
|
31188
31361
|
description: Run ${name}
|
|
31189
31362
|
---
|
|
31190
31363
|
|
|
31191
31364
|
Run \`assist run ${name} $ARGUMENTS 2>&1\`.
|
|
31192
31365
|
`;
|
|
31193
|
-
const filePath =
|
|
31194
|
-
|
|
31366
|
+
const filePath = join87(dir, `${name}.md`);
|
|
31367
|
+
writeFileSync45(filePath, content);
|
|
31195
31368
|
console.log(`Created command file: ${filePath}`);
|
|
31196
31369
|
}
|
|
31197
31370
|
function add3() {
|
|
@@ -31246,8 +31419,8 @@ function link2() {
|
|
|
31246
31419
|
}
|
|
31247
31420
|
|
|
31248
31421
|
// src/commands/run/remove.ts
|
|
31249
|
-
import { existsSync as
|
|
31250
|
-
import { join as
|
|
31422
|
+
import { existsSync as existsSync70, unlinkSync as unlinkSync21 } from "fs";
|
|
31423
|
+
import { join as join88 } from "path";
|
|
31251
31424
|
function findRemoveIndex() {
|
|
31252
31425
|
const idx = process.argv.indexOf("remove");
|
|
31253
31426
|
if (idx === -1 || idx + 1 >= process.argv.length) return -1;
|
|
@@ -31262,8 +31435,8 @@ function parseRemoveName() {
|
|
|
31262
31435
|
return process.argv[idx + 1];
|
|
31263
31436
|
}
|
|
31264
31437
|
function deleteCommandFile(name) {
|
|
31265
|
-
const filePath =
|
|
31266
|
-
if (
|
|
31438
|
+
const filePath = join88(".claude", "commands", `${name}.md`);
|
|
31439
|
+
if (existsSync70(filePath)) {
|
|
31267
31440
|
unlinkSync21(filePath);
|
|
31268
31441
|
console.log(`Deleted command file: ${filePath}`);
|
|
31269
31442
|
}
|
|
@@ -31308,9 +31481,9 @@ function registerRun(program2) {
|
|
|
31308
31481
|
|
|
31309
31482
|
// src/commands/screenshot/index.ts
|
|
31310
31483
|
import { execSync as execSync60 } from "child_process";
|
|
31311
|
-
import { existsSync as
|
|
31484
|
+
import { existsSync as existsSync71, mkdirSync as mkdirSync31, unlinkSync as unlinkSync22, writeFileSync as writeFileSync46 } from "fs";
|
|
31312
31485
|
import { tmpdir as tmpdir8 } from "os";
|
|
31313
|
-
import { join as
|
|
31486
|
+
import { join as join89, resolve as resolve20 } from "path";
|
|
31314
31487
|
import chalk216 from "chalk";
|
|
31315
31488
|
|
|
31316
31489
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
@@ -31440,15 +31613,15 @@ Write-Output $OutputPath
|
|
|
31440
31613
|
|
|
31441
31614
|
// src/commands/screenshot/index.ts
|
|
31442
31615
|
function buildOutputPath(outputDir, processName) {
|
|
31443
|
-
if (!
|
|
31444
|
-
|
|
31616
|
+
if (!existsSync71(outputDir)) {
|
|
31617
|
+
mkdirSync31(outputDir, { recursive: true });
|
|
31445
31618
|
}
|
|
31446
31619
|
const timestamp6 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
31447
31620
|
return resolve20(outputDir, `${processName}-${timestamp6}.png`);
|
|
31448
31621
|
}
|
|
31449
31622
|
function runPowerShellScript(processName, outputPath) {
|
|
31450
|
-
const scriptPath =
|
|
31451
|
-
|
|
31623
|
+
const scriptPath = join89(tmpdir8(), `assist-screenshot-${Date.now()}.ps1`);
|
|
31624
|
+
writeFileSync46(scriptPath, captureWindowPs1, "utf8");
|
|
31452
31625
|
try {
|
|
31453
31626
|
execSync60(
|
|
31454
31627
|
`powershell -NoProfile -ExecutionPolicy Bypass -File "${scriptPath}" -ProcessName "${processName}" -OutputPath "${outputPath}"`,
|
|
@@ -31474,11 +31647,11 @@ function screenshot(processName) {
|
|
|
31474
31647
|
}
|
|
31475
31648
|
|
|
31476
31649
|
// src/commands/sessions/daemon/listDaemonPids.ts
|
|
31477
|
-
import { execFileSync as
|
|
31650
|
+
import { execFileSync as execFileSync19 } from "child_process";
|
|
31478
31651
|
function listDaemonPids() {
|
|
31479
31652
|
if (process.platform === "win32") return [];
|
|
31480
31653
|
try {
|
|
31481
|
-
const out =
|
|
31654
|
+
const out = execFileSync19("ps", ["-eo", "pid=,args="], {
|
|
31482
31655
|
encoding: "utf8"
|
|
31483
31656
|
});
|
|
31484
31657
|
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 +31854,7 @@ function requestDrain(socket, lines2) {
|
|
|
31681
31854
|
}
|
|
31682
31855
|
|
|
31683
31856
|
// src/commands/sessions/daemon/runDaemon.ts
|
|
31684
|
-
import { mkdirSync as
|
|
31857
|
+
import { mkdirSync as mkdirSync35 } from "fs";
|
|
31685
31858
|
|
|
31686
31859
|
// src/commands/sessions/daemon/createAutoExit.ts
|
|
31687
31860
|
var DEFAULT_GRACE_MS = 6e4;
|
|
@@ -31785,12 +31958,12 @@ function toSessionRunInfo({
|
|
|
31785
31958
|
}
|
|
31786
31959
|
|
|
31787
31960
|
// src/commands/sessions/daemon/worktree/joinRefusal.ts
|
|
31788
|
-
import { existsSync as
|
|
31961
|
+
import { existsSync as existsSync72 } from "fs";
|
|
31789
31962
|
function joinRefusal(session) {
|
|
31790
31963
|
if (session.commandType === "run") return "a server run has no agent stream";
|
|
31791
31964
|
if (session.closing === true) return "the session is closing";
|
|
31792
31965
|
if (!session.cwd) return "the session has no working directory";
|
|
31793
|
-
if (!
|
|
31966
|
+
if (!existsSync72(session.cwd))
|
|
31794
31967
|
return "the session's workspace no longer exists";
|
|
31795
31968
|
return void 0;
|
|
31796
31969
|
}
|
|
@@ -31935,7 +32108,7 @@ var ClientHub = class extends Set {
|
|
|
31935
32108
|
};
|
|
31936
32109
|
|
|
31937
32110
|
// src/commands/sessions/daemon/createSession.ts
|
|
31938
|
-
import { randomUUID as
|
|
32111
|
+
import { randomUUID as randomUUID16 } from "crypto";
|
|
31939
32112
|
|
|
31940
32113
|
// src/commands/sessions/daemon/sessionBase.ts
|
|
31941
32114
|
function sessionBase(id, status3) {
|
|
@@ -31954,11 +32127,11 @@ function sessionBase(id, status3) {
|
|
|
31954
32127
|
}
|
|
31955
32128
|
|
|
31956
32129
|
// src/commands/sessions/daemon/spawnPty.ts
|
|
31957
|
-
import { existsSync as
|
|
32130
|
+
import { existsSync as existsSync74 } from "fs";
|
|
31958
32131
|
import * as pty from "node-pty";
|
|
31959
32132
|
|
|
31960
32133
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
31961
|
-
import { chmodSync, existsSync as
|
|
32134
|
+
import { chmodSync, existsSync as existsSync73, statSync as statSync12 } from "fs";
|
|
31962
32135
|
import { createRequire as createRequire3 } from "module";
|
|
31963
32136
|
import path75 from "path";
|
|
31964
32137
|
var require4 = createRequire3(import.meta.url);
|
|
@@ -31973,7 +32146,7 @@ function ensureSpawnHelperExecutable() {
|
|
|
31973
32146
|
`${process.platform}-${process.arch}`,
|
|
31974
32147
|
"spawn-helper"
|
|
31975
32148
|
);
|
|
31976
|
-
if (!
|
|
32149
|
+
if (!existsSync73(helper)) return;
|
|
31977
32150
|
const mode = statSync12(helper).mode;
|
|
31978
32151
|
if ((mode & 73) === 0) chmodSync(helper, mode | 493);
|
|
31979
32152
|
}
|
|
@@ -32009,7 +32182,7 @@ function spawnPty(args, cwd, sessionId, extraEnv) {
|
|
|
32009
32182
|
});
|
|
32010
32183
|
}
|
|
32011
32184
|
function refuseMissingCwd(cwd, sessionId) {
|
|
32012
|
-
if (!cwd ||
|
|
32185
|
+
if (!cwd || existsSync74(cwd)) return;
|
|
32013
32186
|
daemonLog(
|
|
32014
32187
|
`${sessionId ? `session ${sessionId}` : "pty"} not spawned: working directory ${cwd} no longer exists`
|
|
32015
32188
|
);
|
|
@@ -32131,7 +32304,7 @@ function spawnRun(opts) {
|
|
|
32131
32304
|
function createSession(id, { prompt, cwd, design, auto, harness, holdPty } = {}) {
|
|
32132
32305
|
if (harness && harness !== "claude")
|
|
32133
32306
|
return createHarnessSession(id, harness, prompt, cwd, holdPty);
|
|
32134
|
-
const claudeSessionId =
|
|
32307
|
+
const claudeSessionId = randomUUID16();
|
|
32135
32308
|
return {
|
|
32136
32309
|
...sessionBase(id, prompt ? "running" : "waiting"),
|
|
32137
32310
|
name: `Session ${id}`,
|
|
@@ -32191,17 +32364,17 @@ function setStatus2(session, newStatus) {
|
|
|
32191
32364
|
}
|
|
32192
32365
|
|
|
32193
32366
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
32194
|
-
import { existsSync as
|
|
32367
|
+
import { existsSync as existsSync76 } from "fs";
|
|
32195
32368
|
import { basename as basename22 } from "path";
|
|
32196
32369
|
|
|
32197
32370
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
32198
|
-
import { existsSync as
|
|
32199
|
-
import { join as
|
|
32371
|
+
import { existsSync as existsSync75 } from "fs";
|
|
32372
|
+
import { join as join92 } from "path";
|
|
32200
32373
|
|
|
32201
32374
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
32202
32375
|
import { statSync as statSync13 } from "fs";
|
|
32203
32376
|
import { rm as rm2 } from "fs/promises";
|
|
32204
|
-
import { join as
|
|
32377
|
+
import { join as join91 } from "path";
|
|
32205
32378
|
async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
32206
32379
|
if (holdsAGitDirectoryRatherThanALink(worktreePath)) {
|
|
32207
32380
|
const refusal = "it is a clone of its own, not a linked worktree";
|
|
@@ -32229,7 +32402,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
|
32229
32402
|
return { removed: true };
|
|
32230
32403
|
}
|
|
32231
32404
|
function holdsAGitDirectoryRatherThanALink(worktreePath) {
|
|
32232
|
-
return statSync13(
|
|
32405
|
+
return statSync13(join91(worktreePath, ".git"), {
|
|
32233
32406
|
throwIfNoEntry: false
|
|
32234
32407
|
})?.isDirectory() === true;
|
|
32235
32408
|
}
|
|
@@ -32265,7 +32438,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
32265
32438
|
);
|
|
32266
32439
|
}
|
|
32267
32440
|
function strandedReason(worktreePath, cause) {
|
|
32268
|
-
if (!
|
|
32441
|
+
if (!existsSync75(join92(worktreePath, ".git")))
|
|
32269
32442
|
return "its .git link is already gone";
|
|
32270
32443
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
32271
32444
|
return "git no longer recognises it as a working tree";
|
|
@@ -32317,7 +32490,7 @@ function reason3(error) {
|
|
|
32317
32490
|
|
|
32318
32491
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
32319
32492
|
async function reapWorktree(worktreePath, force = false) {
|
|
32320
|
-
if (!
|
|
32493
|
+
if (!existsSync76(worktreePath)) {
|
|
32321
32494
|
forgetWorktree(worktreePath);
|
|
32322
32495
|
daemonLog(
|
|
32323
32496
|
`worktree ${worktreePath} already gone; its record was forgotten`
|
|
@@ -32342,7 +32515,7 @@ async function reapWorktree(worktreePath, force = false) {
|
|
|
32342
32515
|
}
|
|
32343
32516
|
function owningClone(worktreePath) {
|
|
32344
32517
|
const recorded = worktreeAttributionIncludingReaped(worktreePath)?.clone;
|
|
32345
|
-
if (recorded &&
|
|
32518
|
+
if (recorded && existsSync76(recorded)) return recorded;
|
|
32346
32519
|
const detected = mainWorktree(worktreePath);
|
|
32347
32520
|
if (detected) return detected;
|
|
32348
32521
|
daemonLog(
|
|
@@ -32473,12 +32646,12 @@ function closeGateApplies(sessions, session) {
|
|
|
32473
32646
|
}
|
|
32474
32647
|
|
|
32475
32648
|
// src/commands/sessions/daemon/worktree/watchGitState.ts
|
|
32476
|
-
import { existsSync as
|
|
32649
|
+
import { existsSync as existsSync77, watch } from "fs";
|
|
32477
32650
|
var DEBOUNCE_MS = 500;
|
|
32478
32651
|
var POLL_MS = 3e4;
|
|
32479
32652
|
function watchGitState(cwd, onChange) {
|
|
32480
32653
|
const common = gitCommonDir(cwd);
|
|
32481
|
-
if (!common || !
|
|
32654
|
+
if (!common || !existsSync77(common)) return void 0;
|
|
32482
32655
|
const watchers = [
|
|
32483
32656
|
watchGitDir(common, onChange),
|
|
32484
32657
|
pollGitState(cwd, onChange)
|
|
@@ -32728,7 +32901,8 @@ var PREVIEW_KINDS = [
|
|
|
32728
32901
|
"backlog-comment",
|
|
32729
32902
|
"pr-comment",
|
|
32730
32903
|
"github-issue",
|
|
32731
|
-
"github-issue-comment"
|
|
32904
|
+
"github-issue-comment",
|
|
32905
|
+
"github-issue-edit"
|
|
32732
32906
|
];
|
|
32733
32907
|
function isPreviewKind(value) {
|
|
32734
32908
|
return PREVIEW_KINDS.includes(value);
|
|
@@ -32739,6 +32913,7 @@ function previewTargetLabel(kind, itemType, prNumber, draft) {
|
|
|
32739
32913
|
if (kind === "backlog-comment") return "backlog comment";
|
|
32740
32914
|
if (kind === "pr-comment") return "pr comment";
|
|
32741
32915
|
if (kind === "github-issue-comment") return "github issue comment";
|
|
32916
|
+
if (kind === "github-issue-edit") return "github issue edit";
|
|
32742
32917
|
if (kind === "github-issue") return "github issue";
|
|
32743
32918
|
if (kind === "backlog-item") return `backlog ${itemType}`;
|
|
32744
32919
|
if (prNumber !== null) return `edit #${prNumber}`;
|
|
@@ -32950,10 +33125,10 @@ function emitSessionOutput(session, clients, data) {
|
|
|
32950
33125
|
}
|
|
32951
33126
|
|
|
32952
33127
|
// src/commands/sessions/daemon/exitReason.ts
|
|
32953
|
-
import { existsSync as
|
|
33128
|
+
import { existsSync as existsSync78 } from "fs";
|
|
32954
33129
|
import { resolve as resolve21 } from "path";
|
|
32955
33130
|
function exitDetail(session) {
|
|
32956
|
-
if (session.cwd && !
|
|
33131
|
+
if (session.cwd && !existsSync78(session.cwd))
|
|
32957
33132
|
return `working directory ${session.cwd} no longer exists`;
|
|
32958
33133
|
return missingRunConfigCwd(session);
|
|
32959
33134
|
}
|
|
@@ -32967,7 +33142,7 @@ function missingRunConfigCwd(session) {
|
|
|
32967
33142
|
const config = resolveRunConfig(session.runName, dir);
|
|
32968
33143
|
if (!config?.cwd) return void 0;
|
|
32969
33144
|
const configured = resolve21(runConfigBaseDirFrom(dir), config.cwd);
|
|
32970
|
-
if (
|
|
33145
|
+
if (existsSync78(configured)) return void 0;
|
|
32971
33146
|
return `run config "${config.name}": cwd ${configured} does not exist`;
|
|
32972
33147
|
}
|
|
32973
33148
|
|
|
@@ -33008,7 +33183,7 @@ function handleFailedResume(session, exitCode, onStatusChange) {
|
|
|
33008
33183
|
}
|
|
33009
33184
|
|
|
33010
33185
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
33011
|
-
import { existsSync as
|
|
33186
|
+
import { existsSync as existsSync79, mkdirSync as mkdirSync32, watch as watch2 } from "fs";
|
|
33012
33187
|
import { dirname as dirname37 } from "path";
|
|
33013
33188
|
|
|
33014
33189
|
// src/commands/sessions/daemon/applyActivityToSession.ts
|
|
@@ -33073,7 +33248,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
33073
33248
|
const path80 = activityPath(session.id);
|
|
33074
33249
|
const dir = dirname37(path80);
|
|
33075
33250
|
try {
|
|
33076
|
-
|
|
33251
|
+
mkdirSync32(dir, { recursive: true });
|
|
33077
33252
|
} catch {
|
|
33078
33253
|
return;
|
|
33079
33254
|
}
|
|
@@ -33094,7 +33269,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
33094
33269
|
if (timer) clearTimeout(timer);
|
|
33095
33270
|
timer = setTimeout(read2, DEBOUNCE_MS2);
|
|
33096
33271
|
});
|
|
33097
|
-
if (
|
|
33272
|
+
if (existsSync79(path80)) read2();
|
|
33098
33273
|
}
|
|
33099
33274
|
function refreshActivity(session) {
|
|
33100
33275
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -33276,10 +33451,10 @@ function headContainsSessionId(filePath, claudeSessionId) {
|
|
|
33276
33451
|
}
|
|
33277
33452
|
|
|
33278
33453
|
// src/commands/sessions/daemon/ensureProjectDirExists.ts
|
|
33279
|
-
import { mkdirSync as
|
|
33454
|
+
import { mkdirSync as mkdirSync33 } from "fs";
|
|
33280
33455
|
function ensureProjectDirExists(dir, sessionId) {
|
|
33281
33456
|
try {
|
|
33282
|
-
|
|
33457
|
+
mkdirSync33(dir, { recursive: true });
|
|
33283
33458
|
return true;
|
|
33284
33459
|
} catch (error) {
|
|
33285
33460
|
daemonLog(
|
|
@@ -34199,7 +34374,7 @@ function codexRespawnPlan(session) {
|
|
|
34199
34374
|
}
|
|
34200
34375
|
|
|
34201
34376
|
// src/commands/sessions/daemon/interactiveRespawnPlan.ts
|
|
34202
|
-
import { randomUUID as
|
|
34377
|
+
import { randomUUID as randomUUID17 } from "crypto";
|
|
34203
34378
|
function interactiveRespawnPlan(session, resumes) {
|
|
34204
34379
|
const { claudeSessionId, cwd, initialPrompt, design, auto } = session;
|
|
34205
34380
|
if (!resumes) return null;
|
|
@@ -34219,7 +34394,7 @@ function interactiveRespawnPlan(session, resumes) {
|
|
|
34219
34394
|
return null;
|
|
34220
34395
|
}
|
|
34221
34396
|
function freshClaudePlan(session, prompt, cwd) {
|
|
34222
|
-
const claudeSessionId =
|
|
34397
|
+
const claudeSessionId = randomUUID17();
|
|
34223
34398
|
return {
|
|
34224
34399
|
spawn: () => {
|
|
34225
34400
|
session.claudeSessionId = claudeSessionId;
|
|
@@ -34716,7 +34891,7 @@ function rearmStoppedSessions(sessions, notify2) {
|
|
|
34716
34891
|
}
|
|
34717
34892
|
|
|
34718
34893
|
// src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
|
|
34719
|
-
import { existsSync as
|
|
34894
|
+
import { existsSync as existsSync82 } from "fs";
|
|
34720
34895
|
import { basename as basename24 } from "path";
|
|
34721
34896
|
|
|
34722
34897
|
// src/commands/sessions/daemon/worktree/accountedTrees.ts
|
|
@@ -34771,9 +34946,9 @@ function bindResumedWorktree(session, cwd, notify2) {
|
|
|
34771
34946
|
}
|
|
34772
34947
|
|
|
34773
34948
|
// src/commands/sessions/daemon/worktree/reclaimVanishedWorktrees.ts
|
|
34774
|
-
import { existsSync as
|
|
34949
|
+
import { existsSync as existsSync81 } from "fs";
|
|
34775
34950
|
async function reclaimVanishedWorktrees(clone, paths) {
|
|
34776
|
-
if (!
|
|
34951
|
+
if (!existsSync81(clone)) {
|
|
34777
34952
|
for (const { path: path80 } of paths) forgetWorktree(path80);
|
|
34778
34953
|
daemonLog(
|
|
34779
34954
|
`clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
|
|
@@ -34939,7 +35114,7 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
|
34939
35114
|
);
|
|
34940
35115
|
continue;
|
|
34941
35116
|
}
|
|
34942
|
-
if (!
|
|
35117
|
+
if (!existsSync82(path80)) {
|
|
34943
35118
|
logVanishedTree(sessions, path80);
|
|
34944
35119
|
vanished.set(clone, [
|
|
34945
35120
|
...vanished.get(clone) ?? [],
|
|
@@ -35104,10 +35279,10 @@ function startReusedRunPty(session, assistArgs, itemId2, hold, clients, onStatus
|
|
|
35104
35279
|
}
|
|
35105
35280
|
|
|
35106
35281
|
// src/commands/sessions/daemon/createWatcherSession.ts
|
|
35107
|
-
import { randomUUID as
|
|
35282
|
+
import { randomUUID as randomUUID18 } from "crypto";
|
|
35108
35283
|
var WATCH_PROMPT = "/watch";
|
|
35109
35284
|
function createWatcherSession(id, cwd) {
|
|
35110
|
-
const claudeSessionId =
|
|
35285
|
+
const claudeSessionId = randomUUID18();
|
|
35111
35286
|
return {
|
|
35112
35287
|
...sessionBase(id, "running"),
|
|
35113
35288
|
name: `Session ${id}`,
|
|
@@ -35556,13 +35731,13 @@ async function defaultConnect() {
|
|
|
35556
35731
|
}
|
|
35557
35732
|
|
|
35558
35733
|
// src/commands/sessions/daemon/hasPersistedWindowsSessions.ts
|
|
35559
|
-
import { existsSync as
|
|
35734
|
+
import { existsSync as existsSync83, readFileSync as readFileSync55 } from "fs";
|
|
35560
35735
|
import { posix as posix3 } from "path";
|
|
35561
35736
|
function hasPersistedWindowsSessions() {
|
|
35562
35737
|
const sessionsFile = windowsSessionsFileFromWsl();
|
|
35563
35738
|
if (!sessionsFile) return false;
|
|
35564
35739
|
try {
|
|
35565
|
-
if (!
|
|
35740
|
+
if (!existsSync83(sessionsFile)) return false;
|
|
35566
35741
|
const data = JSON.parse(readFileSync55(sessionsFile, "utf8"));
|
|
35567
35742
|
return Array.isArray(data) && data.length > 0;
|
|
35568
35743
|
} catch (error) {
|
|
@@ -36297,7 +36472,7 @@ function setAutoAdvance(sessions, id, enabled) {
|
|
|
36297
36472
|
}
|
|
36298
36473
|
|
|
36299
36474
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
36300
|
-
import { existsSync as
|
|
36475
|
+
import { existsSync as existsSync86 } from "fs";
|
|
36301
36476
|
|
|
36302
36477
|
// src/commands/sessions/daemon/resumeSession.ts
|
|
36303
36478
|
function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
@@ -36328,11 +36503,11 @@ function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
|
36328
36503
|
}
|
|
36329
36504
|
|
|
36330
36505
|
// src/commands/sessions/daemon/worktree/resumeInReplacementTree.ts
|
|
36331
|
-
import { existsSync as
|
|
36506
|
+
import { existsSync as existsSync85 } from "fs";
|
|
36332
36507
|
|
|
36333
36508
|
// src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
|
|
36334
|
-
import { copyFileSync as copyFileSync7, existsSync as
|
|
36335
|
-
import { join as
|
|
36509
|
+
import { copyFileSync as copyFileSync7, existsSync as existsSync84, mkdirSync as mkdirSync34 } from "fs";
|
|
36510
|
+
import { join as join94 } from "path";
|
|
36336
36511
|
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
36337
36512
|
const dir = projectDirForCwd(toCwd);
|
|
36338
36513
|
if (dir === projectDirForCwd(fromCwd)) {
|
|
@@ -36341,8 +36516,8 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
36341
36516
|
);
|
|
36342
36517
|
return;
|
|
36343
36518
|
}
|
|
36344
|
-
const dest =
|
|
36345
|
-
if (
|
|
36519
|
+
const dest = join94(dir, `${claudeSessionId}.jsonl`);
|
|
36520
|
+
if (existsSync84(dest)) {
|
|
36346
36521
|
daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
|
|
36347
36522
|
return;
|
|
36348
36523
|
}
|
|
@@ -36354,7 +36529,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
36354
36529
|
return;
|
|
36355
36530
|
}
|
|
36356
36531
|
try {
|
|
36357
|
-
|
|
36532
|
+
mkdirSync34(dir, { recursive: true });
|
|
36358
36533
|
copyFileSync7(source, dest);
|
|
36359
36534
|
daemonLog(
|
|
36360
36535
|
`transcript ${source} copied to ${dest} so ${toCwd} can resume it`
|
|
@@ -36393,7 +36568,7 @@ function resumeInReplacementTree(ctx, claudeSessionId, missingCwd, name, harness
|
|
|
36393
36568
|
}
|
|
36394
36569
|
function cloneForReapedTree(missingCwd) {
|
|
36395
36570
|
const clone = worktreeAttributionIncludingReaped(missingCwd)?.clone;
|
|
36396
|
-
if (!clone || !
|
|
36571
|
+
if (!clone || !existsSync85(clone))
|
|
36397
36572
|
throw new Error(
|
|
36398
36573
|
`working directory no longer exists and no clone is recorded to re-allocate from: ${missingCwd}`
|
|
36399
36574
|
);
|
|
@@ -36402,7 +36577,7 @@ function cloneForReapedTree(missingCwd) {
|
|
|
36402
36577
|
|
|
36403
36578
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
36404
36579
|
function resumeInTree(ctx, sessionId, cwd, name, harness) {
|
|
36405
|
-
if (!
|
|
36580
|
+
if (!existsSync86(cwd))
|
|
36406
36581
|
return resumeInReplacementTree(ctx, sessionId, cwd, name, harness);
|
|
36407
36582
|
const id = ctx.spawnWith(
|
|
36408
36583
|
(sid) => resumeSession(sid, sessionId, cwd, name, void 0, harness)
|
|
@@ -36771,12 +36946,6 @@ function safeParse2(line) {
|
|
|
36771
36946
|
}
|
|
36772
36947
|
}
|
|
36773
36948
|
|
|
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
36949
|
// src/commands/sessions/daemon/withRepoGroups.ts
|
|
36781
36950
|
function withRepoGroups(sessions) {
|
|
36782
36951
|
const existence = /* @__PURE__ */ new Map();
|
|
@@ -36984,7 +37153,7 @@ function handleConnection(socket, manager) {
|
|
|
36984
37153
|
}
|
|
36985
37154
|
|
|
36986
37155
|
// src/commands/sessions/daemon/onListening.ts
|
|
36987
|
-
import { unlinkSync as unlinkSync23, writeFileSync as
|
|
37156
|
+
import { unlinkSync as unlinkSync23, writeFileSync as writeFileSync47 } from "fs";
|
|
36988
37157
|
|
|
36989
37158
|
// src/commands/sessions/daemon/startPidFileWatchdog.ts
|
|
36990
37159
|
import { readFileSync as readFileSync56 } from "fs";
|
|
@@ -37006,7 +37175,7 @@ function ownsPidFile() {
|
|
|
37006
37175
|
|
|
37007
37176
|
// src/commands/sessions/daemon/onListening.ts
|
|
37008
37177
|
function onListening(manager, checkAutoExit) {
|
|
37009
|
-
|
|
37178
|
+
writeFileSync47(daemonPaths.pid, String(process.pid));
|
|
37010
37179
|
startPidFileWatchdog(() => {
|
|
37011
37180
|
daemonLog("lost daemon.pid ownership; shutting down sessions and exiting");
|
|
37012
37181
|
void manager.flushActiveMs().finally(() => {
|
|
@@ -37047,7 +37216,7 @@ function cleanupOwnedFiles() {
|
|
|
37047
37216
|
import * as net3 from "net";
|
|
37048
37217
|
|
|
37049
37218
|
// src/commands/sessions/daemon/findPortHolderPid.ts
|
|
37050
|
-
import { execFileSync as
|
|
37219
|
+
import { execFileSync as execFileSync20 } from "child_process";
|
|
37051
37220
|
var PROBE_TIMEOUT_MS = 3e3;
|
|
37052
37221
|
function findPortHolderPid(port) {
|
|
37053
37222
|
try {
|
|
@@ -37057,7 +37226,7 @@ function findPortHolderPid(port) {
|
|
|
37057
37226
|
}
|
|
37058
37227
|
}
|
|
37059
37228
|
function probe(command, args) {
|
|
37060
|
-
return
|
|
37229
|
+
return execFileSync20(command, args, {
|
|
37061
37230
|
encoding: "utf8",
|
|
37062
37231
|
timeout: PROBE_TIMEOUT_MS,
|
|
37063
37232
|
stdio: ["ignore", "pipe", "ignore"]
|
|
@@ -37193,7 +37362,7 @@ async function recoverFromAddrInUse(server, manager, checkAutoExit) {
|
|
|
37193
37362
|
|
|
37194
37363
|
// src/commands/sessions/daemon/runDaemon.ts
|
|
37195
37364
|
async function runDaemon() {
|
|
37196
|
-
|
|
37365
|
+
mkdirSync35(daemonPaths.dir, { recursive: true });
|
|
37197
37366
|
daemonLog(
|
|
37198
37367
|
`starting (reason: ${process.env.ASSIST_DAEMON_SPAWN_REASON ?? "manual"})`
|
|
37199
37368
|
);
|
|
@@ -37264,7 +37433,7 @@ function summaryPathFor(jsonlPath2) {
|
|
|
37264
37433
|
}
|
|
37265
37434
|
|
|
37266
37435
|
// src/commands/sessions/summarise/summariseSession.ts
|
|
37267
|
-
import { execFileSync as
|
|
37436
|
+
import { execFileSync as execFileSync21 } from "child_process";
|
|
37268
37437
|
function summariseSession(jsonlPath2) {
|
|
37269
37438
|
const firstMessage = extractFirstUserMessage(jsonlPath2);
|
|
37270
37439
|
const backlogIds = scanSessionBacklogRefs(jsonlPath2);
|
|
@@ -37273,7 +37442,7 @@ function summariseSession(jsonlPath2) {
|
|
|
37273
37442
|
}
|
|
37274
37443
|
const prompt = buildPrompt6(firstMessage, backlogIds);
|
|
37275
37444
|
try {
|
|
37276
|
-
const output =
|
|
37445
|
+
const output = execFileSync21("claude", ["-p", "--model", "haiku", prompt], {
|
|
37277
37446
|
encoding: "utf8",
|
|
37278
37447
|
timeout: 3e4,
|
|
37279
37448
|
stdio: ["ignore", "pipe", "ignore"]
|
|
@@ -37454,9 +37623,9 @@ function buildLimitsSegment(rateLimits) {
|
|
|
37454
37623
|
|
|
37455
37624
|
// src/commands/readGitBranch.ts
|
|
37456
37625
|
import { readFileSync as readFileSync58, statSync as statSync15 } from "fs";
|
|
37457
|
-
import { isAbsolute as isAbsolute4, join as
|
|
37626
|
+
import { isAbsolute as isAbsolute4, join as join95, resolve as resolve22 } from "path";
|
|
37458
37627
|
function resolveGitDir(cwd) {
|
|
37459
|
-
const dotGit =
|
|
37628
|
+
const dotGit = join95(cwd, ".git");
|
|
37460
37629
|
let stat4;
|
|
37461
37630
|
try {
|
|
37462
37631
|
stat4 = statSync15(dotGit);
|
|
@@ -37486,7 +37655,7 @@ function readGitBranch(cwd) {
|
|
|
37486
37655
|
}
|
|
37487
37656
|
let head;
|
|
37488
37657
|
try {
|
|
37489
|
-
head = readFileSync58(
|
|
37658
|
+
head = readFileSync58(join95(gitDir, "HEAD"), "utf8");
|
|
37490
37659
|
} catch {
|
|
37491
37660
|
return null;
|
|
37492
37661
|
}
|