@staff0rd/assist 0.755.0 → 0.755.2
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 +7 -11
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +147 -131
- 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.755.
|
|
9
|
+
version: "0.755.2",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -10953,11 +10953,20 @@ function hostedGroup(origin, clone) {
|
|
|
10953
10953
|
|
|
10954
10954
|
// src/commands/sessions/nodes/tailscaleStatus.ts
|
|
10955
10955
|
import { execFile as execFile3 } from "child_process";
|
|
10956
|
+
import { existsSync as existsSync33 } from "fs";
|
|
10956
10957
|
import { promisify as promisify2 } from "util";
|
|
10957
10958
|
var execFileAsync2 = promisify2(execFile3);
|
|
10958
10959
|
var STATUS_TIMEOUT_MS = 1e4;
|
|
10960
|
+
var INSTALLED_CLI = {
|
|
10961
|
+
wsl: "/mnt/c/Program Files/Tailscale/tailscale.exe",
|
|
10962
|
+
windows: "C:\\Program Files\\Tailscale\\tailscale.exe",
|
|
10963
|
+
macos: "/Applications/Tailscale.app/Contents/MacOS/Tailscale"
|
|
10964
|
+
};
|
|
10959
10965
|
function tailscaleCli() {
|
|
10960
|
-
|
|
10966
|
+
const platform = detectPlatform();
|
|
10967
|
+
const installed = INSTALLED_CLI[platform];
|
|
10968
|
+
if (installed && existsSync33(installed)) return installed;
|
|
10969
|
+
return platform === "wsl" ? "tailscale.exe" : "tailscale";
|
|
10961
10970
|
}
|
|
10962
10971
|
async function tailscaleStatus() {
|
|
10963
10972
|
const { stdout } = await execFileAsync2(tailscaleCli(), ["status", "--json"], {
|
|
@@ -10983,7 +10992,7 @@ function tailnetSuffix(status2) {
|
|
|
10983
10992
|
}
|
|
10984
10993
|
|
|
10985
10994
|
// src/commands/sessions/nodes/planServe.ts
|
|
10986
|
-
function planServe(status2, serveConfig, port) {
|
|
10995
|
+
function planServe(status2, serveConfig, port, httpsPort = port) {
|
|
10987
10996
|
tailnetSuffix(status2);
|
|
10988
10997
|
const fqdn = status2.Self?.DNSName?.replace(/\.$/, "");
|
|
10989
10998
|
if (!fqdn)
|
|
@@ -10991,13 +11000,13 @@ function planServe(status2, serveConfig, port) {
|
|
|
10991
11000
|
`\`${tailscaleCli()} status --json\` reports no DNS name for this machine`
|
|
10992
11001
|
);
|
|
10993
11002
|
const target = `http://127.0.0.1:${port}`;
|
|
10994
|
-
const served = serveConfig.Web?.[`${fqdn}:${
|
|
11003
|
+
const served = serveConfig.Web?.[`${fqdn}:${httpsPort}`]?.Handlers?.["/"]?.Proxy;
|
|
10995
11004
|
return {
|
|
10996
11005
|
host: fqdn.split(".")[0],
|
|
10997
|
-
url: `https://${fqdn}:${
|
|
11006
|
+
url: `https://${fqdn}:${httpsPort}`,
|
|
10998
11007
|
target,
|
|
10999
11008
|
alreadyServing: served?.replace(/\/$/, "") === target,
|
|
11000
|
-
args: ["serve", "--bg", `--https=${
|
|
11009
|
+
args: ["serve", "--bg", `--https=${httpsPort}`, target]
|
|
11001
11010
|
};
|
|
11002
11011
|
}
|
|
11003
11012
|
|
|
@@ -11027,6 +11036,12 @@ async function runTailscale(args) {
|
|
|
11027
11036
|
return stdout;
|
|
11028
11037
|
}
|
|
11029
11038
|
|
|
11039
|
+
// src/commands/sessions/nodes/tailnetHttpsPort.ts
|
|
11040
|
+
var MIRRORED_WSL_OWNS_PORT_OFFSET = 1e3;
|
|
11041
|
+
function tailnetHttpsPort(port) {
|
|
11042
|
+
return detectPlatform() === "wsl" ? port + MIRRORED_WSL_OWNS_PORT_OFFSET : port;
|
|
11043
|
+
}
|
|
11044
|
+
|
|
11030
11045
|
// src/commands/sessions/nodes/ensureTailscaleServe.ts
|
|
11031
11046
|
var SERVE_WRITE_ATTEMPTS = 5;
|
|
11032
11047
|
var defaultDeps = {
|
|
@@ -11039,10 +11054,11 @@ var defaultDeps = {
|
|
|
11039
11054
|
serve: async (args) => {
|
|
11040
11055
|
await runTailscale(args);
|
|
11041
11056
|
},
|
|
11042
|
-
sleep: (ms) => new Promise((resolve26) => setTimeout(resolve26, ms))
|
|
11057
|
+
sleep: (ms) => new Promise((resolve26) => setTimeout(resolve26, ms)),
|
|
11058
|
+
httpsPort: tailnetHttpsPort
|
|
11043
11059
|
};
|
|
11044
11060
|
async function ensureTailscaleServe(port, deps2 = {}) {
|
|
11045
|
-
const { enabled, status: status2, serveStatus, serve, sleep: sleep2 } = {
|
|
11061
|
+
const { enabled, status: status2, serveStatus, serve, sleep: sleep2, httpsPort } = {
|
|
11046
11062
|
...defaultDeps,
|
|
11047
11063
|
...deps2
|
|
11048
11064
|
};
|
|
@@ -11050,7 +11066,7 @@ async function ensureTailscaleServe(port, deps2 = {}) {
|
|
|
11050
11066
|
const current = await runningStatus(status2);
|
|
11051
11067
|
if (typeof current === "string") return current;
|
|
11052
11068
|
for (let attempt = 1; ; attempt++) {
|
|
11053
|
-
const plan2 = planServe(current, await serveStatus(), port);
|
|
11069
|
+
const plan2 = planServe(current, await serveStatus(), port, httpsPort(port));
|
|
11054
11070
|
if (plan2.alreadyServing) return `${plan2.url} already serves ${plan2.target}`;
|
|
11055
11071
|
try {
|
|
11056
11072
|
await serve(plan2.args);
|
|
@@ -11276,12 +11292,12 @@ function createFallbackHandler(routes3, htmlHandler2, extra) {
|
|
|
11276
11292
|
}
|
|
11277
11293
|
|
|
11278
11294
|
// src/commands/backlog/resolveRepoLocation.ts
|
|
11279
|
-
import { existsSync as
|
|
11295
|
+
import { existsSync as existsSync34 } from "fs";
|
|
11280
11296
|
function resolveRepoLocation(origin, knownCwd, baseDir) {
|
|
11281
11297
|
if (knownCwd) return { cwd: knownCwd };
|
|
11282
11298
|
const target = cloneTargetDir(origin, baseDir);
|
|
11283
11299
|
if (!target) return {};
|
|
11284
|
-
if (
|
|
11300
|
+
if (existsSync34(target) && getCurrentOrigin(target) === origin)
|
|
11285
11301
|
return { cwd: target };
|
|
11286
11302
|
return { cloneTarget: target };
|
|
11287
11303
|
}
|
|
@@ -13297,14 +13313,14 @@ import { basename as basename11, join as join37 } from "path";
|
|
|
13297
13313
|
import { promisify as promisify5 } from "util";
|
|
13298
13314
|
|
|
13299
13315
|
// src/commands/sessions/web/findSynthesisForBranch.ts
|
|
13300
|
-
import { existsSync as
|
|
13316
|
+
import { existsSync as existsSync35, readdirSync as readdirSync4, statSync as statSync5 } from "fs";
|
|
13301
13317
|
import { basename as basename10, dirname as dirname22, join as join36 } from "path";
|
|
13302
13318
|
function findSynthesisForBranch(repoReviewsDir, branch2) {
|
|
13303
13319
|
const branchKeyPath = join36(repoReviewsDir, `${branch2}-`);
|
|
13304
13320
|
const parent = dirname22(branchKeyPath);
|
|
13305
13321
|
const branchPrefix = basename10(branchKeyPath);
|
|
13306
|
-
if (!
|
|
13307
|
-
const synthesisFiles = readdirSync4(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join36(parent, name, "synthesis.md")).filter((path106) =>
|
|
13322
|
+
if (!existsSync35(parent)) return null;
|
|
13323
|
+
const synthesisFiles = readdirSync4(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join36(parent, name, "synthesis.md")).filter((path106) => existsSync35(path106)).map((path106) => ({ path: path106, mtime: statSync5(path106).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
|
|
13308
13324
|
return synthesisFiles[0]?.path ?? null;
|
|
13309
13325
|
}
|
|
13310
13326
|
|
|
@@ -14557,7 +14573,7 @@ async function nextPickup(req, res) {
|
|
|
14557
14573
|
import path27 from "path";
|
|
14558
14574
|
|
|
14559
14575
|
// src/commands/rules/readScopedRules.ts
|
|
14560
|
-
import { existsSync as
|
|
14576
|
+
import { existsSync as existsSync37, readFileSync as readFileSync23 } from "fs";
|
|
14561
14577
|
import path26 from "path";
|
|
14562
14578
|
|
|
14563
14579
|
// src/commands/rules/rulesSectionRange.ts
|
|
@@ -14606,11 +14622,11 @@ function parseRulesSection(content) {
|
|
|
14606
14622
|
}
|
|
14607
14623
|
|
|
14608
14624
|
// src/commands/rules/scopeDirectory.ts
|
|
14609
|
-
import { existsSync as
|
|
14625
|
+
import { existsSync as existsSync36, statSync as statSync6 } from "fs";
|
|
14610
14626
|
import path25 from "path";
|
|
14611
14627
|
function scopeDirectory(target) {
|
|
14612
14628
|
const resolved = path25.resolve(target);
|
|
14613
|
-
return
|
|
14629
|
+
return existsSync36(resolved) && statSync6(resolved).isDirectory() ? resolved : path25.dirname(resolved);
|
|
14614
14630
|
}
|
|
14615
14631
|
|
|
14616
14632
|
// src/commands/rules/readScopedRules.ts
|
|
@@ -14621,7 +14637,7 @@ function scopedClaudeFiles(target) {
|
|
|
14621
14637
|
let current = startDir;
|
|
14622
14638
|
while (true) {
|
|
14623
14639
|
const candidate = path26.join(current, "CLAUDE.md");
|
|
14624
|
-
if (
|
|
14640
|
+
if (existsSync37(candidate)) files.push(candidate);
|
|
14625
14641
|
if (current === root2 || current === path26.dirname(current)) break;
|
|
14626
14642
|
current = path26.dirname(current);
|
|
14627
14643
|
}
|
|
@@ -15772,11 +15788,11 @@ async function revertDiffFile(req, res) {
|
|
|
15772
15788
|
|
|
15773
15789
|
// src/commands/run/runCommandToCompletion.ts
|
|
15774
15790
|
import { spawn as spawn4 } from "child_process";
|
|
15775
|
-
import { existsSync as
|
|
15791
|
+
import { existsSync as existsSync39 } from "fs";
|
|
15776
15792
|
|
|
15777
15793
|
// src/commands/run/resolveCommand.ts
|
|
15778
15794
|
import { execFileSync as execFileSync4 } from "child_process";
|
|
15779
|
-
import { existsSync as
|
|
15795
|
+
import { existsSync as existsSync38 } from "fs";
|
|
15780
15796
|
import { dirname as dirname23, join as join38, resolve as resolve12 } from "path";
|
|
15781
15797
|
function resolveCommand(command) {
|
|
15782
15798
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
@@ -15784,7 +15800,7 @@ function resolveCommand(command) {
|
|
|
15784
15800
|
const gitPath = execFileSync4("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
15785
15801
|
const gitRoot = resolve12(dirname23(gitPath), "..");
|
|
15786
15802
|
const gitBash = join38(gitRoot, "bin", "bash.exe");
|
|
15787
|
-
if (
|
|
15803
|
+
if (existsSync38(gitBash)) return gitBash;
|
|
15788
15804
|
} catch {
|
|
15789
15805
|
return command;
|
|
15790
15806
|
}
|
|
@@ -15794,7 +15810,7 @@ function resolveCommand(command) {
|
|
|
15794
15810
|
// src/commands/run/runCommandToCompletion.ts
|
|
15795
15811
|
function runCommandToCompletion(command, args, env, cwd, quiet) {
|
|
15796
15812
|
return new Promise((resolveResult) => {
|
|
15797
|
-
if (cwd && !
|
|
15813
|
+
if (cwd && !existsSync39(cwd)) {
|
|
15798
15814
|
resolveResult({
|
|
15799
15815
|
kind: "failed",
|
|
15800
15816
|
message: `Failed to execute command: cwd ${cwd} does not exist`
|
|
@@ -16677,7 +16693,7 @@ import { readFile as readFile3, stat as stat3, writeFile as writeFile3 } from "f
|
|
|
16677
16693
|
|
|
16678
16694
|
// src/commands/sessions/web/formatWithOxfmt.ts
|
|
16679
16695
|
import { execFile as execFile12 } from "child_process";
|
|
16680
|
-
import { existsSync as
|
|
16696
|
+
import { existsSync as existsSync40 } from "fs";
|
|
16681
16697
|
import { dirname as dirname24, join as join40 } from "path";
|
|
16682
16698
|
import { promisify as promisify12 } from "util";
|
|
16683
16699
|
var execFileAsync11 = promisify12(execFile12);
|
|
@@ -16686,7 +16702,7 @@ function findOxfmtScript(root2) {
|
|
|
16686
16702
|
let dir = root2;
|
|
16687
16703
|
for (; ; ) {
|
|
16688
16704
|
const candidate = join40(dir, "node_modules", "oxfmt", "bin", "oxfmt");
|
|
16689
|
-
if (
|
|
16705
|
+
if (existsSync40(candidate)) return candidate;
|
|
16690
16706
|
const parent = dirname24(dir);
|
|
16691
16707
|
if (parent === dir) return void 0;
|
|
16692
16708
|
dir = parent;
|
|
@@ -18154,7 +18170,7 @@ function extractGraphqlQuery(args) {
|
|
|
18154
18170
|
}
|
|
18155
18171
|
|
|
18156
18172
|
// src/shared/loadCliReads.ts
|
|
18157
|
-
import { existsSync as
|
|
18173
|
+
import { existsSync as existsSync41, readFileSync as readFileSync26, writeFileSync as writeFileSync22 } from "fs";
|
|
18158
18174
|
import { dirname as dirname25, resolve as resolve13 } from "path";
|
|
18159
18175
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
18160
18176
|
var __filename3 = fileURLToPath5(import.meta.url);
|
|
@@ -18163,7 +18179,7 @@ function packageRoot() {
|
|
|
18163
18179
|
return __dirname4;
|
|
18164
18180
|
}
|
|
18165
18181
|
function readLines(path106) {
|
|
18166
|
-
if (!
|
|
18182
|
+
if (!existsSync41(path106)) return [];
|
|
18167
18183
|
return readFileSync26(path106, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
18168
18184
|
}
|
|
18169
18185
|
var cachedReads;
|
|
@@ -18210,7 +18226,7 @@ function findCliWrite(command) {
|
|
|
18210
18226
|
}
|
|
18211
18227
|
|
|
18212
18228
|
// src/shared/readSettingsPerms.ts
|
|
18213
|
-
import { existsSync as
|
|
18229
|
+
import { existsSync as existsSync42, readFileSync as readFileSync27 } from "fs";
|
|
18214
18230
|
import { homedir as homedir15 } from "os";
|
|
18215
18231
|
import { join as join41 } from "path";
|
|
18216
18232
|
function readSettingsPerms(key) {
|
|
@@ -18226,7 +18242,7 @@ function readSettingsPerms(key) {
|
|
|
18226
18242
|
return entries;
|
|
18227
18243
|
}
|
|
18228
18244
|
function readPermissionArray(filePath, key) {
|
|
18229
|
-
if (!
|
|
18245
|
+
if (!existsSync42(filePath)) return [];
|
|
18230
18246
|
try {
|
|
18231
18247
|
const data = JSON.parse(readFileSync27(filePath, "utf8"));
|
|
18232
18248
|
const arr = data?.permissions?.[key];
|
|
@@ -18583,7 +18599,7 @@ ${reasons.join("\n")}`);
|
|
|
18583
18599
|
}
|
|
18584
18600
|
|
|
18585
18601
|
// src/commands/permitCliReads.ts
|
|
18586
|
-
import { existsSync as
|
|
18602
|
+
import { existsSync as existsSync43, mkdirSync as mkdirSync13, readFileSync as readFileSync28, writeFileSync as writeFileSync23 } from "fs";
|
|
18587
18603
|
import { homedir as homedir17 } from "os";
|
|
18588
18604
|
import { join as join43 } from "path";
|
|
18589
18605
|
|
|
@@ -18852,7 +18868,7 @@ function logPath(cli) {
|
|
|
18852
18868
|
}
|
|
18853
18869
|
function readCache(cli) {
|
|
18854
18870
|
const path106 = logPath(cli);
|
|
18855
|
-
if (!
|
|
18871
|
+
if (!existsSync43(path106)) return void 0;
|
|
18856
18872
|
return readFileSync28(path106, "utf8");
|
|
18857
18873
|
}
|
|
18858
18874
|
function writeCache(cli, output) {
|
|
@@ -18987,7 +19003,7 @@ function registerCliHook(program2) {
|
|
|
18987
19003
|
}
|
|
18988
19004
|
|
|
18989
19005
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
18990
|
-
import { existsSync as
|
|
19006
|
+
import { existsSync as existsSync45, readFileSync as readFileSync30, unlinkSync as unlinkSync8, writeFileSync as writeFileSync24 } from "fs";
|
|
18991
19007
|
import chalk119 from "chalk";
|
|
18992
19008
|
|
|
18993
19009
|
// src/shared/isHashCommentFile.ts
|
|
@@ -19052,10 +19068,10 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
19052
19068
|
}
|
|
19053
19069
|
|
|
19054
19070
|
// src/commands/codeComment/readPinState.ts
|
|
19055
|
-
import { existsSync as
|
|
19071
|
+
import { existsSync as existsSync44, readFileSync as readFileSync29 } from "fs";
|
|
19056
19072
|
function readPinState(pin2) {
|
|
19057
19073
|
const path106 = getPinStatePath(pin2);
|
|
19058
|
-
if (!
|
|
19074
|
+
if (!existsSync44(path106)) return void 0;
|
|
19059
19075
|
try {
|
|
19060
19076
|
const state = JSON.parse(readFileSync29(path106, "utf8"));
|
|
19061
19077
|
if (state.pin !== pin2) return void 0;
|
|
@@ -19074,7 +19090,7 @@ function codeCommentConfirm(pin2) {
|
|
|
19074
19090
|
process.exitCode = 1;
|
|
19075
19091
|
return;
|
|
19076
19092
|
}
|
|
19077
|
-
if (!
|
|
19093
|
+
if (!existsSync45(state.file)) {
|
|
19078
19094
|
console.error(chalk119.red(`Target file no longer exists: ${state.file}`));
|
|
19079
19095
|
process.exitCode = 1;
|
|
19080
19096
|
return;
|
|
@@ -20695,7 +20711,7 @@ import { cp } from "fs/promises";
|
|
|
20695
20711
|
import chalk137 from "chalk";
|
|
20696
20712
|
|
|
20697
20713
|
// src/commands/criteriaExtension/criteriaExtensionDir.ts
|
|
20698
|
-
import { existsSync as
|
|
20714
|
+
import { existsSync as existsSync46 } from "fs";
|
|
20699
20715
|
import { dirname as dirname26, join as join46 } from "path";
|
|
20700
20716
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
20701
20717
|
var moduleDir = dirname26(fileURLToPath6(import.meta.url));
|
|
@@ -20706,7 +20722,7 @@ function criteriaExtensionDir() {
|
|
|
20706
20722
|
"criteriaExtension",
|
|
20707
20723
|
"criteria-extension"
|
|
20708
20724
|
);
|
|
20709
|
-
if (
|
|
20725
|
+
if (existsSync46(bundled)) return bundled;
|
|
20710
20726
|
return join46(moduleDir, "..", "..", "..", "criteria-extension");
|
|
20711
20727
|
}
|
|
20712
20728
|
|
|
@@ -20751,11 +20767,11 @@ async function copySignedXpi(xpi, dir) {
|
|
|
20751
20767
|
}
|
|
20752
20768
|
|
|
20753
20769
|
// src/commands/criteriaExtension/findSignedXpi.ts
|
|
20754
|
-
import { existsSync as
|
|
20770
|
+
import { existsSync as existsSync47 } from "fs";
|
|
20755
20771
|
import { readdir } from "fs/promises";
|
|
20756
20772
|
import { join as join48 } from "path";
|
|
20757
20773
|
async function findSignedXpi(dir) {
|
|
20758
|
-
if (!
|
|
20774
|
+
if (!existsSync47(dir)) return null;
|
|
20759
20775
|
const name = (await readdir(dir)).find((entry) => entry.endsWith(".xpi"));
|
|
20760
20776
|
return name ? join48(dir, name) : null;
|
|
20761
20777
|
}
|
|
@@ -20779,11 +20795,11 @@ async function signedAddonInstallPath(xpi) {
|
|
|
20779
20795
|
}
|
|
20780
20796
|
|
|
20781
20797
|
// src/commands/criteriaExtension/signPreflightProblem.ts
|
|
20782
|
-
import { existsSync as
|
|
20798
|
+
import { existsSync as existsSync48 } from "fs";
|
|
20783
20799
|
import { join as join49 } from "path";
|
|
20784
20800
|
var KEY_URL = "https://addons.mozilla.org/en-US/developers/addon/api/key/";
|
|
20785
20801
|
function signPreflightProblem(source) {
|
|
20786
|
-
if (!
|
|
20802
|
+
if (!existsSync48(join49(source, "content.js")))
|
|
20787
20803
|
return {
|
|
20788
20804
|
message: `no content.js in ${source}`,
|
|
20789
20805
|
hint: "run npm run build to bundle the content script"
|
|
@@ -21053,10 +21069,10 @@ function getMigrationApprovalPath(migrationId) {
|
|
|
21053
21069
|
}
|
|
21054
21070
|
|
|
21055
21071
|
// src/commands/dbMigration/readMigrationPinState.ts
|
|
21056
|
-
import { existsSync as
|
|
21072
|
+
import { existsSync as existsSync49, readFileSync as readFileSync31 } from "fs";
|
|
21057
21073
|
function readMigrationPinState(pin2) {
|
|
21058
21074
|
const path106 = getMigrationPinPath(pin2);
|
|
21059
|
-
if (!
|
|
21075
|
+
if (!existsSync49(path106)) return void 0;
|
|
21060
21076
|
try {
|
|
21061
21077
|
const state = JSON.parse(readFileSync31(path106, "utf8"));
|
|
21062
21078
|
if (state.pin !== pin2) return void 0;
|
|
@@ -21145,7 +21161,7 @@ function registerDbMigration(parent) {
|
|
|
21145
21161
|
}
|
|
21146
21162
|
|
|
21147
21163
|
// src/commands/deploy/redirect.ts
|
|
21148
|
-
import { existsSync as
|
|
21164
|
+
import { existsSync as existsSync50, readFileSync as readFileSync32, writeFileSync as writeFileSync28 } from "fs";
|
|
21149
21165
|
import chalk144 from "chalk";
|
|
21150
21166
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
21151
21167
|
if (!window.location.pathname.endsWith('/')) {
|
|
@@ -21154,7 +21170,7 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
21154
21170
|
</script>`;
|
|
21155
21171
|
function redirect() {
|
|
21156
21172
|
const indexPath = "index.html";
|
|
21157
|
-
if (!
|
|
21173
|
+
if (!existsSync50(indexPath)) {
|
|
21158
21174
|
console.log(chalk144.yellow("No index.html found"));
|
|
21159
21175
|
return;
|
|
21160
21176
|
}
|
|
@@ -21201,7 +21217,7 @@ import { execSync as execSync31 } from "child_process";
|
|
|
21201
21217
|
import chalk145 from "chalk";
|
|
21202
21218
|
|
|
21203
21219
|
// src/shared/getRepoName.ts
|
|
21204
|
-
import { existsSync as
|
|
21220
|
+
import { existsSync as existsSync51, readFileSync as readFileSync33 } from "fs";
|
|
21205
21221
|
import { basename as basename14, join as join55 } from "path";
|
|
21206
21222
|
function getRepoName() {
|
|
21207
21223
|
const config = loadConfig();
|
|
@@ -21209,7 +21225,7 @@ function getRepoName() {
|
|
|
21209
21225
|
return config.devlog.name;
|
|
21210
21226
|
}
|
|
21211
21227
|
const packageJsonPath = join55(process.cwd(), "package.json");
|
|
21212
|
-
if (
|
|
21228
|
+
if (existsSync51(packageJsonPath)) {
|
|
21213
21229
|
try {
|
|
21214
21230
|
const content = readFileSync33(packageJsonPath, "utf8");
|
|
21215
21231
|
const pkg = JSON.parse(content);
|
|
@@ -21911,12 +21927,12 @@ function printJson(tree, totalCount, solutions) {
|
|
|
21911
21927
|
}
|
|
21912
21928
|
|
|
21913
21929
|
// src/commands/dotnet/resolveCsproj.ts
|
|
21914
|
-
import { existsSync as
|
|
21930
|
+
import { existsSync as existsSync52 } from "fs";
|
|
21915
21931
|
import path36 from "path";
|
|
21916
21932
|
import chalk154 from "chalk";
|
|
21917
21933
|
function resolveCsproj(csprojPath) {
|
|
21918
21934
|
const resolved = path36.resolve(csprojPath);
|
|
21919
|
-
if (!
|
|
21935
|
+
if (!existsSync52(resolved)) {
|
|
21920
21936
|
console.error(chalk154.red(`File not found: ${resolved}`));
|
|
21921
21937
|
process.exit(1);
|
|
21922
21938
|
}
|
|
@@ -22084,7 +22100,7 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
22084
22100
|
}
|
|
22085
22101
|
|
|
22086
22102
|
// src/commands/dotnet/resolveSolution.ts
|
|
22087
|
-
import { existsSync as
|
|
22103
|
+
import { existsSync as existsSync53 } from "fs";
|
|
22088
22104
|
import path37 from "path";
|
|
22089
22105
|
import chalk158 from "chalk";
|
|
22090
22106
|
|
|
@@ -22125,7 +22141,7 @@ function findSolution() {
|
|
|
22125
22141
|
function resolveSolution(sln) {
|
|
22126
22142
|
if (sln) {
|
|
22127
22143
|
const resolved = path37.resolve(sln);
|
|
22128
|
-
if (!
|
|
22144
|
+
if (!existsSync53(resolved)) {
|
|
22129
22145
|
console.error(chalk158.red(`Solution file not found: ${resolved}`));
|
|
22130
22146
|
process.exit(1);
|
|
22131
22147
|
}
|
|
@@ -22165,7 +22181,7 @@ function parseInspectReport(json) {
|
|
|
22165
22181
|
|
|
22166
22182
|
// src/commands/dotnet/runInspectCode.ts
|
|
22167
22183
|
import { execSync as execSync35 } from "child_process";
|
|
22168
|
-
import { existsSync as
|
|
22184
|
+
import { existsSync as existsSync54, readFileSync as readFileSync37, unlinkSync as unlinkSync10 } from "fs";
|
|
22169
22185
|
import { tmpdir as tmpdir5 } from "os";
|
|
22170
22186
|
import path38 from "path";
|
|
22171
22187
|
import chalk159 from "chalk";
|
|
@@ -22196,7 +22212,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
22196
22212
|
console.error(chalk159.red("jb inspectcode failed"));
|
|
22197
22213
|
process.exit(1);
|
|
22198
22214
|
}
|
|
22199
|
-
if (!
|
|
22215
|
+
if (!existsSync54(reportPath)) {
|
|
22200
22216
|
console.error(chalk159.red("Report file not generated"));
|
|
22201
22217
|
process.exit(1);
|
|
22202
22218
|
}
|
|
@@ -22965,11 +22981,11 @@ function decideCommentGuard(input, existingContent) {
|
|
|
22965
22981
|
}
|
|
22966
22982
|
|
|
22967
22983
|
// src/commands/dbMigration/consumeMigrationApproval.ts
|
|
22968
|
-
import { existsSync as
|
|
22984
|
+
import { existsSync as existsSync55, unlinkSync as unlinkSync11 } from "fs";
|
|
22969
22985
|
function consumeMigrationApproval(migrationId) {
|
|
22970
22986
|
sweepRestrictedDir();
|
|
22971
22987
|
const path106 = getMigrationApprovalPath(migrationId);
|
|
22972
|
-
if (!
|
|
22988
|
+
if (!existsSync55(path106)) return false;
|
|
22973
22989
|
try {
|
|
22974
22990
|
unlinkSync11(path106);
|
|
22975
22991
|
return true;
|
|
@@ -24376,7 +24392,7 @@ function fetchIssue2(number, repo) {
|
|
|
24376
24392
|
}
|
|
24377
24393
|
|
|
24378
24394
|
// src/commands/github/issue/resumeIssueBody.ts
|
|
24379
|
-
import { existsSync as
|
|
24395
|
+
import { existsSync as existsSync56, readFileSync as readFileSync38 } from "fs";
|
|
24380
24396
|
|
|
24381
24397
|
// src/commands/github/issue/issueWorkingFile.ts
|
|
24382
24398
|
import { join as join61 } from "path";
|
|
@@ -24393,7 +24409,7 @@ function issueWorkingFile(slug2, number) {
|
|
|
24393
24409
|
// src/commands/github/issue/resumeIssueBody.ts
|
|
24394
24410
|
function resumeIssueBody(slug2, number, updatedAt) {
|
|
24395
24411
|
const { bodyPath, metaPath } = issueWorkingFile(slug2, number);
|
|
24396
|
-
if (!
|
|
24412
|
+
if (!existsSync56(bodyPath) || !existsSync56(metaPath)) return void 0;
|
|
24397
24413
|
try {
|
|
24398
24414
|
const meta = JSON.parse(readFileSync38(metaPath, "utf8"));
|
|
24399
24415
|
if (meta.updatedAt !== updatedAt) return void 0;
|
|
@@ -25025,7 +25041,7 @@ function canonicalTreePath(path106) {
|
|
|
25025
25041
|
}
|
|
25026
25042
|
|
|
25027
25043
|
// src/commands/sessions/daemon/worktree/createWorktree.ts
|
|
25028
|
-
import { existsSync as
|
|
25044
|
+
import { existsSync as existsSync57 } from "fs";
|
|
25029
25045
|
import { basename as basename17, dirname as dirname28 } from "path";
|
|
25030
25046
|
|
|
25031
25047
|
// src/commands/sessions/daemon/worktree/planAllocation.ts
|
|
@@ -25072,7 +25088,7 @@ function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
|
|
|
25072
25088
|
const base = strategy.root ? expandTilde2(strategy.root) : dirname28(clone);
|
|
25073
25089
|
const registered = new Set(listWorktreePaths(clone));
|
|
25074
25090
|
const branches = new Set(listLocalBranches(clone));
|
|
25075
|
-
const isTaken = (candidate) => registered.has(candidate) ||
|
|
25091
|
+
const isTaken = (candidate) => registered.has(candidate) || existsSync57(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename17(candidate));
|
|
25076
25092
|
const path106 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
|
|
25077
25093
|
const start2 = worktreeStartPoint(clone, strategy.trunk);
|
|
25078
25094
|
gitSync(clone, [
|
|
@@ -25098,7 +25114,7 @@ function keptInTree(cwd, reason4) {
|
|
|
25098
25114
|
}
|
|
25099
25115
|
|
|
25100
25116
|
// src/commands/sessions/daemon/worktree/treeDurability.ts
|
|
25101
|
-
import { existsSync as
|
|
25117
|
+
import { existsSync as existsSync58 } from "fs";
|
|
25102
25118
|
var treeIsGone = { durable: true, gone: true };
|
|
25103
25119
|
function treeDurability(state) {
|
|
25104
25120
|
if (state.dirty) return { durable: false, reason: "uncommitted changes" };
|
|
@@ -25129,14 +25145,14 @@ function* durabilityProbes() {
|
|
|
25129
25145
|
});
|
|
25130
25146
|
}
|
|
25131
25147
|
async function checkDurability(cwd) {
|
|
25132
|
-
if (!
|
|
25148
|
+
if (!existsSync58(cwd)) return treeIsGone;
|
|
25133
25149
|
const probes = durabilityProbes();
|
|
25134
25150
|
let step3 = probes.next();
|
|
25135
25151
|
while (!step3.done) step3 = probes.next(await gitResult(cwd, step3.value));
|
|
25136
25152
|
return step3.value;
|
|
25137
25153
|
}
|
|
25138
25154
|
function checkDurabilitySync(cwd) {
|
|
25139
|
-
if (!
|
|
25155
|
+
if (!existsSync58(cwd)) return treeIsGone;
|
|
25140
25156
|
const probes = durabilityProbes();
|
|
25141
25157
|
let step3 = probes.next();
|
|
25142
25158
|
while (!step3.done) step3 = probes.next(gitSyncResult(cwd, step3.value));
|
|
@@ -25387,20 +25403,20 @@ function persistedTreeRoots() {
|
|
|
25387
25403
|
}
|
|
25388
25404
|
|
|
25389
25405
|
// src/commands/sessions/daemon/worktree/seedWorktree.ts
|
|
25390
|
-
import { copyFileSync, existsSync as
|
|
25406
|
+
import { copyFileSync, existsSync as existsSync60, mkdirSync as mkdirSync17 } from "fs";
|
|
25391
25407
|
import { dirname as dirname29, join as join64 } from "path";
|
|
25392
25408
|
|
|
25393
25409
|
// src/commands/sessions/daemon/worktree/runInstall.ts
|
|
25394
25410
|
import { resolve as resolve16 } from "path";
|
|
25395
25411
|
|
|
25396
25412
|
// src/commands/sessions/daemon/worktree/detectInstallCommand.ts
|
|
25397
|
-
import { existsSync as
|
|
25413
|
+
import { existsSync as existsSync59 } from "fs";
|
|
25398
25414
|
import { join as join63 } from "path";
|
|
25399
25415
|
function detectInstallCommand(dir) {
|
|
25400
|
-
if (!
|
|
25401
|
-
if (
|
|
25402
|
-
if (
|
|
25403
|
-
if (
|
|
25416
|
+
if (!existsSync59(join63(dir, "package.json"))) return null;
|
|
25417
|
+
if (existsSync59(join63(dir, "pnpm-lock.yaml"))) return "pnpm install";
|
|
25418
|
+
if (existsSync59(join63(dir, "yarn.lock"))) return "yarn install";
|
|
25419
|
+
if (existsSync59(join63(dir, "bun.lockb"))) return "bun install";
|
|
25404
25420
|
return "npm install";
|
|
25405
25421
|
}
|
|
25406
25422
|
|
|
@@ -25563,7 +25579,7 @@ function seedWorktree(worktreePath, clone, onSeeded = () => {
|
|
|
25563
25579
|
function copyConfigFiles(worktreePath, clone, copy) {
|
|
25564
25580
|
for (const rel of copy) {
|
|
25565
25581
|
const src = join64(clone, rel);
|
|
25566
|
-
if (!
|
|
25582
|
+
if (!existsSync60(src)) continue;
|
|
25567
25583
|
const dest = join64(worktreePath, rel);
|
|
25568
25584
|
try {
|
|
25569
25585
|
mkdirSync17(dirname29(dest), { recursive: true });
|
|
@@ -26111,10 +26127,10 @@ function applyIgnore(texts, ignore3) {
|
|
|
26111
26127
|
}
|
|
26112
26128
|
|
|
26113
26129
|
// src/commands/miro/readIgnoreList.ts
|
|
26114
|
-
import { existsSync as
|
|
26130
|
+
import { existsSync as existsSync61, readFileSync as readFileSync40 } from "fs";
|
|
26115
26131
|
import { parse as parse2 } from "yaml";
|
|
26116
26132
|
function readIgnoreList(file) {
|
|
26117
|
-
if (!
|
|
26133
|
+
if (!existsSync61(file))
|
|
26118
26134
|
throw new MiroExtractError(
|
|
26119
26135
|
`No ignore file at ${file}. Write a YAML list of the box texts to drop, or omit --ignore.`
|
|
26120
26136
|
);
|
|
@@ -27532,7 +27548,7 @@ import { tmpdir as tmpdir7 } from "os";
|
|
|
27532
27548
|
import { join as join71 } from "path";
|
|
27533
27549
|
|
|
27534
27550
|
// src/commands/prs/loadCommentsCache.ts
|
|
27535
|
-
import { existsSync as
|
|
27551
|
+
import { existsSync as existsSync62, readFileSync as readFileSync43, unlinkSync as unlinkSync13 } from "fs";
|
|
27536
27552
|
import { parse as parse3 } from "yaml";
|
|
27537
27553
|
|
|
27538
27554
|
// src/commands/prs/commentsCachePath.ts
|
|
@@ -27552,7 +27568,7 @@ function commentsCachePath(org, repo, prNumber) {
|
|
|
27552
27568
|
// src/commands/prs/loadCommentsCache.ts
|
|
27553
27569
|
function loadCommentsCache(org, repo, prNumber) {
|
|
27554
27570
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
27555
|
-
if (!
|
|
27571
|
+
if (!existsSync62(cachePath)) {
|
|
27556
27572
|
return null;
|
|
27557
27573
|
}
|
|
27558
27574
|
const content = readFileSync43(cachePath, "utf8");
|
|
@@ -27560,7 +27576,7 @@ function loadCommentsCache(org, repo, prNumber) {
|
|
|
27560
27576
|
}
|
|
27561
27577
|
function deleteCommentsCache(org, repo, prNumber) {
|
|
27562
27578
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
27563
|
-
if (
|
|
27579
|
+
if (existsSync62(cachePath)) {
|
|
27564
27580
|
unlinkSync13(cachePath);
|
|
27565
27581
|
console.log("No more unresolved line comments. Cache dropped.");
|
|
27566
27582
|
}
|
|
@@ -30382,7 +30398,7 @@ async function notify() {
|
|
|
30382
30398
|
|
|
30383
30399
|
// src/commands/screenshot.ts
|
|
30384
30400
|
import { execSync as execSync52 } from "child_process";
|
|
30385
|
-
import { existsSync as
|
|
30401
|
+
import { existsSync as existsSync63, mkdirSync as mkdirSync21, unlinkSync as unlinkSync17, writeFileSync as writeFileSync38 } from "fs";
|
|
30386
30402
|
import { tmpdir as tmpdir9 } from "os";
|
|
30387
30403
|
import { join as join74, resolve as resolve21 } from "path";
|
|
30388
30404
|
import chalk204 from "chalk";
|
|
@@ -30514,7 +30530,7 @@ Write-Output $OutputPath
|
|
|
30514
30530
|
|
|
30515
30531
|
// src/commands/screenshot.ts
|
|
30516
30532
|
function buildOutputPath(outputDir, processName) {
|
|
30517
|
-
if (!
|
|
30533
|
+
if (!existsSync63(outputDir)) {
|
|
30518
30534
|
mkdirSync21(outputDir, { recursive: true });
|
|
30519
30535
|
}
|
|
30520
30536
|
const timestamp5 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
@@ -33624,7 +33640,7 @@ function fetchHighLevelPr(prNumber, repo) {
|
|
|
33624
33640
|
}
|
|
33625
33641
|
|
|
33626
33642
|
// src/commands/review/highLevel/loadHighLevelReview.ts
|
|
33627
|
-
import { existsSync as
|
|
33643
|
+
import { existsSync as existsSync64, readFileSync as readFileSync47 } from "fs";
|
|
33628
33644
|
|
|
33629
33645
|
// src/commands/review/highLevel/highLevelReviewPath.ts
|
|
33630
33646
|
import { join as join76 } from "path";
|
|
@@ -33643,7 +33659,7 @@ function highLevelReviewPath(repo, headRef, headSha) {
|
|
|
33643
33659
|
// src/commands/review/highLevel/loadHighLevelReview.ts
|
|
33644
33660
|
function loadHighLevelReview(repo, headRef, headSha) {
|
|
33645
33661
|
const path106 = highLevelReviewPath(repo, headRef, headSha);
|
|
33646
|
-
if (!
|
|
33662
|
+
if (!existsSync64(path106)) return void 0;
|
|
33647
33663
|
try {
|
|
33648
33664
|
return JSON.parse(readFileSync47(path106, "utf8"));
|
|
33649
33665
|
} catch {
|
|
@@ -34950,7 +34966,7 @@ function printReviewerFailures(results) {
|
|
|
34950
34966
|
}
|
|
34951
34967
|
|
|
34952
34968
|
// src/commands/review/runAndSynthesise.ts
|
|
34953
|
-
import { existsSync as
|
|
34969
|
+
import { existsSync as existsSync66, unlinkSync as unlinkSync19 } from "fs";
|
|
34954
34970
|
|
|
34955
34971
|
// src/commands/review/buildReviewerStdin.ts
|
|
34956
34972
|
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.
|
|
@@ -35405,7 +35421,7 @@ function buildCodexModelArgs() {
|
|
|
35405
35421
|
}
|
|
35406
35422
|
|
|
35407
35423
|
// src/commands/review/runCodexReviewer.ts
|
|
35408
|
-
import { existsSync as
|
|
35424
|
+
import { existsSync as existsSync65, unlinkSync as unlinkSync18 } from "fs";
|
|
35409
35425
|
|
|
35410
35426
|
// src/commands/review/parseCodexEvent.ts
|
|
35411
35427
|
function isItemStarted(value) {
|
|
@@ -35460,7 +35476,7 @@ async function runCodexReviewer(spec) {
|
|
|
35460
35476
|
reportReviewerToolUse(spec.name, event, spinner, override.model);
|
|
35461
35477
|
}
|
|
35462
35478
|
});
|
|
35463
|
-
if (result.exitCode !== 0 &&
|
|
35479
|
+
if (result.exitCode !== 0 && existsSync65(spec.outputPath)) {
|
|
35464
35480
|
unlinkSync18(spec.outputPath);
|
|
35465
35481
|
}
|
|
35466
35482
|
return finaliseReviewerRun(
|
|
@@ -35646,7 +35662,7 @@ async function runAndSynthesise(args) {
|
|
|
35646
35662
|
console.error(reason4);
|
|
35647
35663
|
return { ok: false, failures };
|
|
35648
35664
|
}
|
|
35649
|
-
if (anyFresh &&
|
|
35665
|
+
if (anyFresh && existsSync66(paths.synthesisPath)) {
|
|
35650
35666
|
unlinkSync19(paths.synthesisPath);
|
|
35651
35667
|
}
|
|
35652
35668
|
const synthesisResult = await synthesise(paths, {
|
|
@@ -35870,10 +35886,10 @@ function fetchExistingComments() {
|
|
|
35870
35886
|
}
|
|
35871
35887
|
|
|
35872
35888
|
// src/commands/review/prepareReviewDir.ts
|
|
35873
|
-
import { existsSync as
|
|
35889
|
+
import { existsSync as existsSync67, mkdirSync as mkdirSync24, unlinkSync as unlinkSync20, writeFileSync as writeFileSync41 } from "fs";
|
|
35874
35890
|
function clearReviewFiles(paths) {
|
|
35875
35891
|
for (const path106 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
35876
|
-
if (
|
|
35892
|
+
if (existsSync67(path106)) unlinkSync20(path106);
|
|
35877
35893
|
}
|
|
35878
35894
|
}
|
|
35879
35895
|
function prepareReviewDir(paths, requestBody, force) {
|
|
@@ -36102,7 +36118,7 @@ function registerReview(program2) {
|
|
|
36102
36118
|
}
|
|
36103
36119
|
|
|
36104
36120
|
// src/commands/rules/addRule.ts
|
|
36105
|
-
import { existsSync as
|
|
36121
|
+
import { existsSync as existsSync70, readFileSync as readFileSync53, writeFileSync as writeFileSync43 } from "fs";
|
|
36106
36122
|
import path85 from "path";
|
|
36107
36123
|
import chalk236 from "chalk";
|
|
36108
36124
|
|
|
@@ -36159,7 +36175,7 @@ function nextRuleCode(root2) {
|
|
|
36159
36175
|
}
|
|
36160
36176
|
|
|
36161
36177
|
// src/commands/rules/resolveRuleScope.ts
|
|
36162
|
-
import { existsSync as
|
|
36178
|
+
import { existsSync as existsSync68 } from "fs";
|
|
36163
36179
|
import path82 from "path";
|
|
36164
36180
|
function resolveRuleScope(target) {
|
|
36165
36181
|
const resolved = path82.resolve(target);
|
|
@@ -36169,7 +36185,7 @@ function resolveRuleScope(target) {
|
|
|
36169
36185
|
let current = startDir;
|
|
36170
36186
|
while (true) {
|
|
36171
36187
|
const candidate = path82.join(current, "CLAUDE.md");
|
|
36172
|
-
if (
|
|
36188
|
+
if (existsSync68(candidate)) return candidate;
|
|
36173
36189
|
if (current === root2 || current === path82.dirname(current)) break;
|
|
36174
36190
|
current = path82.dirname(current);
|
|
36175
36191
|
}
|
|
@@ -36177,7 +36193,7 @@ function resolveRuleScope(target) {
|
|
|
36177
36193
|
}
|
|
36178
36194
|
|
|
36179
36195
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
36180
|
-
import { existsSync as
|
|
36196
|
+
import { existsSync as existsSync69, readFileSync as readFileSync52, writeFileSync as writeFileSync42 } from "fs";
|
|
36181
36197
|
import path84 from "path";
|
|
36182
36198
|
|
|
36183
36199
|
// src/commands/rules/scopedRuleDirectories.ts
|
|
@@ -36227,7 +36243,7 @@ function upsertScopedRulesPointer(content, directories) {
|
|
|
36227
36243
|
function updateScopedRulesIndex(root2) {
|
|
36228
36244
|
const directories = scopedRuleDirectories(root2);
|
|
36229
36245
|
const rootFile = path84.join(root2, "CLAUDE.md");
|
|
36230
|
-
const before =
|
|
36246
|
+
const before = existsSync69(rootFile) ? readFileSync52(rootFile, "utf8") : "";
|
|
36231
36247
|
const after = upsertScopedRulesPointer(before, directories);
|
|
36232
36248
|
if (after !== before) writeFileSync42(rootFile, after);
|
|
36233
36249
|
return directories;
|
|
@@ -36235,7 +36251,7 @@ function updateScopedRulesIndex(root2) {
|
|
|
36235
36251
|
|
|
36236
36252
|
// src/commands/rules/addRule.ts
|
|
36237
36253
|
function read2(file) {
|
|
36238
|
-
return
|
|
36254
|
+
return existsSync70(file) ? readFileSync53(file, "utf8") : "";
|
|
36239
36255
|
}
|
|
36240
36256
|
function addRule(text17, options2) {
|
|
36241
36257
|
const rule = text17.trim();
|
|
@@ -37636,7 +37652,7 @@ function registerSync(program2) {
|
|
|
37636
37652
|
}
|
|
37637
37653
|
|
|
37638
37654
|
// src/commands/transcript/clean.ts
|
|
37639
|
-
import { existsSync as
|
|
37655
|
+
import { existsSync as existsSync75 } from "fs";
|
|
37640
37656
|
|
|
37641
37657
|
// src/commands/transcript/convert/formatTimestamp.ts
|
|
37642
37658
|
function pad(value, width) {
|
|
@@ -37914,7 +37930,7 @@ function clean(file, options2 = {}) {
|
|
|
37914
37930
|
);
|
|
37915
37931
|
process.exit(1);
|
|
37916
37932
|
}
|
|
37917
|
-
if (!
|
|
37933
|
+
if (!existsSync75(file)) {
|
|
37918
37934
|
console.error(`Error: VTT file not found: ${file}`);
|
|
37919
37935
|
process.exit(1);
|
|
37920
37936
|
}
|
|
@@ -37997,11 +38013,11 @@ async function configure() {
|
|
|
37997
38013
|
}
|
|
37998
38014
|
|
|
37999
38015
|
// src/commands/transcript/list.ts
|
|
38000
|
-
import { existsSync as
|
|
38016
|
+
import { existsSync as existsSync76, readdirSync as readdirSync19, statSync as statSync11 } from "fs";
|
|
38001
38017
|
import { join as join91 } from "path";
|
|
38002
38018
|
function list3() {
|
|
38003
38019
|
const { vttDir } = getTranscriptConfig();
|
|
38004
|
-
if (!
|
|
38020
|
+
if (!existsSync76(vttDir)) return;
|
|
38005
38021
|
for (const entry of readdirSync19(vttDir)) {
|
|
38006
38022
|
if (!entry.endsWith(".vtt")) continue;
|
|
38007
38023
|
if (statSync11(join91(vttDir, entry)).isDirectory()) continue;
|
|
@@ -38010,7 +38026,7 @@ function list3() {
|
|
|
38010
38026
|
}
|
|
38011
38027
|
|
|
38012
38028
|
// src/commands/transcript/move.ts
|
|
38013
|
-
import { existsSync as
|
|
38029
|
+
import { existsSync as existsSync77, mkdirSync as mkdirSync32, renameSync as renameSync2, writeFileSync as writeFileSync50 } from "fs";
|
|
38014
38030
|
import { basename as basename24, join as join92 } from "path";
|
|
38015
38031
|
|
|
38016
38032
|
// src/commands/transcript/convertVttToMarkdown.ts
|
|
@@ -38034,7 +38050,7 @@ function move(file, options2) {
|
|
|
38034
38050
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
38035
38051
|
const filename = basename24(file);
|
|
38036
38052
|
const sourcePath = join92(vttDir, filename);
|
|
38037
|
-
if (!
|
|
38053
|
+
if (!existsSync77(sourcePath)) {
|
|
38038
38054
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
38039
38055
|
process.exit(1);
|
|
38040
38056
|
}
|
|
@@ -38051,7 +38067,7 @@ function move(file, options2) {
|
|
|
38051
38067
|
}
|
|
38052
38068
|
|
|
38053
38069
|
// src/commands/transcript/merge.ts
|
|
38054
|
-
import { existsSync as
|
|
38070
|
+
import { existsSync as existsSync78, writeFileSync as writeFileSync51 } from "fs";
|
|
38055
38071
|
import { basename as basename25 } from "path";
|
|
38056
38072
|
|
|
38057
38073
|
// src/commands/transcript/failTranscript.ts
|
|
@@ -38195,7 +38211,7 @@ function widenAudience(passages) {
|
|
|
38195
38211
|
|
|
38196
38212
|
// src/commands/transcript/merge.ts
|
|
38197
38213
|
function readSource3(file) {
|
|
38198
|
-
if (!
|
|
38214
|
+
if (!existsSync78(file)) failTranscript(`VTT file not found: ${file}`);
|
|
38199
38215
|
const cues = readCleanedCues(file);
|
|
38200
38216
|
if (cues.length === 0) failTranscript(`no cues found in: ${file}`);
|
|
38201
38217
|
return { path: file, name: basename25(file), cues };
|
|
@@ -38662,7 +38678,7 @@ function configKeys2() {
|
|
|
38662
38678
|
}
|
|
38663
38679
|
|
|
38664
38680
|
// src/commands/verify/forbiddenStrings.ts
|
|
38665
|
-
import { existsSync as
|
|
38681
|
+
import { existsSync as existsSync79, readFileSync as readFileSync60 } from "fs";
|
|
38666
38682
|
|
|
38667
38683
|
// src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
|
|
38668
38684
|
import { minimatch as minimatch9 } from "minimatch";
|
|
@@ -38703,7 +38719,7 @@ function forbiddenStrings() {
|
|
|
38703
38719
|
const cache6 = /* @__PURE__ */ new Map();
|
|
38704
38720
|
const readJson = (file) => {
|
|
38705
38721
|
if (cache6.has(file)) return cache6.get(file);
|
|
38706
|
-
if (!
|
|
38722
|
+
if (!existsSync79(file)) {
|
|
38707
38723
|
console.log(`Forbidden-strings file not found: ${file}`);
|
|
38708
38724
|
process.exit(1);
|
|
38709
38725
|
}
|
|
@@ -39462,7 +39478,7 @@ function resolveParams(params, cliArgs) {
|
|
|
39462
39478
|
}
|
|
39463
39479
|
|
|
39464
39480
|
// src/commands/run/resolveRunCwd.ts
|
|
39465
|
-
import { existsSync as
|
|
39481
|
+
import { existsSync as existsSync80 } from "fs";
|
|
39466
39482
|
import { resolve as resolve24 } from "path";
|
|
39467
39483
|
var MissingRunCwdError = class extends Error {
|
|
39468
39484
|
constructor(runName, cwd) {
|
|
@@ -39475,7 +39491,7 @@ var MissingRunCwdError = class extends Error {
|
|
|
39475
39491
|
function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
|
|
39476
39492
|
if (!config.cwd) return void 0;
|
|
39477
39493
|
const cwd = resolve24(baseDir, config.cwd);
|
|
39478
|
-
if (!
|
|
39494
|
+
if (!existsSync80(cwd)) throw new MissingRunCwdError(config.name, cwd);
|
|
39479
39495
|
return cwd;
|
|
39480
39496
|
}
|
|
39481
39497
|
|
|
@@ -40150,7 +40166,7 @@ function link2() {
|
|
|
40150
40166
|
}
|
|
40151
40167
|
|
|
40152
40168
|
// src/commands/run/remove.ts
|
|
40153
|
-
import { existsSync as
|
|
40169
|
+
import { existsSync as existsSync81, unlinkSync as unlinkSync21 } from "fs";
|
|
40154
40170
|
import { join as join96 } from "path";
|
|
40155
40171
|
function findRemoveIndex() {
|
|
40156
40172
|
const idx = process.argv.indexOf("remove");
|
|
@@ -40167,7 +40183,7 @@ function parseRemoveName() {
|
|
|
40167
40183
|
}
|
|
40168
40184
|
function deleteCommandFile(name) {
|
|
40169
40185
|
const filePath = join96(".claude", "commands", `${name}.md`);
|
|
40170
|
-
if (
|
|
40186
|
+
if (existsSync81(filePath)) {
|
|
40171
40187
|
unlinkSync21(filePath);
|
|
40172
40188
|
console.log(`Deleted command file: ${filePath}`);
|
|
40173
40189
|
}
|
|
@@ -40556,12 +40572,12 @@ function toSessionRunInfo({
|
|
|
40556
40572
|
}
|
|
40557
40573
|
|
|
40558
40574
|
// src/commands/sessions/daemon/worktree/joinRefusal.ts
|
|
40559
|
-
import { existsSync as
|
|
40575
|
+
import { existsSync as existsSync82 } from "fs";
|
|
40560
40576
|
function joinRefusal(session) {
|
|
40561
40577
|
if (session.commandType === "run") return "a server run has no agent stream";
|
|
40562
40578
|
if (session.closing === true) return "the session is closing";
|
|
40563
40579
|
if (!session.cwd) return "the session has no working directory";
|
|
40564
|
-
if (!
|
|
40580
|
+
if (!existsSync82(session.cwd))
|
|
40565
40581
|
return "the session's workspace no longer exists";
|
|
40566
40582
|
return void 0;
|
|
40567
40583
|
}
|
|
@@ -40761,11 +40777,11 @@ function sessionBase(id, status2) {
|
|
|
40761
40777
|
}
|
|
40762
40778
|
|
|
40763
40779
|
// src/commands/sessions/daemon/spawnPty.ts
|
|
40764
|
-
import { existsSync as
|
|
40780
|
+
import { existsSync as existsSync84 } from "fs";
|
|
40765
40781
|
import * as pty from "node-pty";
|
|
40766
40782
|
|
|
40767
40783
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
40768
|
-
import { chmodSync, existsSync as
|
|
40784
|
+
import { chmodSync, existsSync as existsSync83, statSync as statSync13 } from "fs";
|
|
40769
40785
|
import { createRequire as createRequire3 } from "module";
|
|
40770
40786
|
import path102 from "path";
|
|
40771
40787
|
var require4 = createRequire3(import.meta.url);
|
|
@@ -40780,7 +40796,7 @@ function ensureSpawnHelperExecutable() {
|
|
|
40780
40796
|
`${process.platform}-${process.arch}`,
|
|
40781
40797
|
"spawn-helper"
|
|
40782
40798
|
);
|
|
40783
|
-
if (!
|
|
40799
|
+
if (!existsSync83(helper)) return;
|
|
40784
40800
|
const mode = statSync13(helper).mode;
|
|
40785
40801
|
if ((mode & 73) === 0) chmodSync(helper, mode | 493);
|
|
40786
40802
|
}
|
|
@@ -40816,7 +40832,7 @@ function spawnPty(args, cwd, sessionId, extraEnv) {
|
|
|
40816
40832
|
});
|
|
40817
40833
|
}
|
|
40818
40834
|
function refuseMissingCwd(cwd, sessionId) {
|
|
40819
|
-
if (!cwd ||
|
|
40835
|
+
if (!cwd || existsSync84(cwd)) return;
|
|
40820
40836
|
daemonLog(
|
|
40821
40837
|
`${sessionId ? `session ${sessionId}` : "pty"} not spawned: working directory ${cwd} no longer exists`
|
|
40822
40838
|
);
|
|
@@ -41009,11 +41025,11 @@ function setStatus2(session, newStatus) {
|
|
|
41009
41025
|
}
|
|
41010
41026
|
|
|
41011
41027
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
41012
|
-
import { existsSync as
|
|
41028
|
+
import { existsSync as existsSync86 } from "fs";
|
|
41013
41029
|
import { basename as basename27 } from "path";
|
|
41014
41030
|
|
|
41015
41031
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
41016
|
-
import { existsSync as
|
|
41032
|
+
import { existsSync as existsSync85 } from "fs";
|
|
41017
41033
|
import { join as join99 } from "path";
|
|
41018
41034
|
|
|
41019
41035
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
@@ -41083,7 +41099,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
41083
41099
|
);
|
|
41084
41100
|
}
|
|
41085
41101
|
function strandedReason(worktreePath, cause) {
|
|
41086
|
-
if (!
|
|
41102
|
+
if (!existsSync85(join99(worktreePath, ".git")))
|
|
41087
41103
|
return "its .git link is already gone";
|
|
41088
41104
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
41089
41105
|
return "git no longer recognises it as a working tree";
|
|
@@ -41135,7 +41151,7 @@ function reason3(error) {
|
|
|
41135
41151
|
|
|
41136
41152
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
41137
41153
|
async function reapWorktree(worktreePath, force = false) {
|
|
41138
|
-
if (!
|
|
41154
|
+
if (!existsSync86(worktreePath)) {
|
|
41139
41155
|
forgetWorktree(worktreePath);
|
|
41140
41156
|
daemonLog(
|
|
41141
41157
|
`worktree ${worktreePath} already gone; its record was forgotten`
|
|
@@ -41160,7 +41176,7 @@ async function reapWorktree(worktreePath, force = false) {
|
|
|
41160
41176
|
}
|
|
41161
41177
|
function owningClone(worktreePath) {
|
|
41162
41178
|
const recorded = worktreeAttributionIncludingReaped(worktreePath)?.clone;
|
|
41163
|
-
if (recorded &&
|
|
41179
|
+
if (recorded && existsSync86(recorded)) return recorded;
|
|
41164
41180
|
const detected = mainWorktree(worktreePath);
|
|
41165
41181
|
if (detected) return detected;
|
|
41166
41182
|
daemonLog(
|
|
@@ -41374,12 +41390,12 @@ async function closeBlockReason(sessionId, tree) {
|
|
|
41374
41390
|
}
|
|
41375
41391
|
|
|
41376
41392
|
// src/commands/sessions/daemon/worktree/watchGitState.ts
|
|
41377
|
-
import { existsSync as
|
|
41393
|
+
import { existsSync as existsSync87, watch } from "fs";
|
|
41378
41394
|
var DEBOUNCE_MS = 500;
|
|
41379
41395
|
var POLL_MS = 3e4;
|
|
41380
41396
|
function watchGitState(cwd, onChange) {
|
|
41381
41397
|
const common = gitCommonDir(cwd);
|
|
41382
|
-
if (!common || !
|
|
41398
|
+
if (!common || !existsSync87(common)) return void 0;
|
|
41383
41399
|
const watchers = [
|
|
41384
41400
|
watchGitDir(common, onChange),
|
|
41385
41401
|
pollGitState(cwd, onChange)
|
|
@@ -41908,10 +41924,10 @@ function emitSessionOutput(session, clients, data) {
|
|
|
41908
41924
|
}
|
|
41909
41925
|
|
|
41910
41926
|
// src/commands/sessions/daemon/exitReason.ts
|
|
41911
|
-
import { existsSync as
|
|
41927
|
+
import { existsSync as existsSync88 } from "fs";
|
|
41912
41928
|
import { resolve as resolve25 } from "path";
|
|
41913
41929
|
function exitDetail(session) {
|
|
41914
|
-
if (session.cwd && !
|
|
41930
|
+
if (session.cwd && !existsSync88(session.cwd))
|
|
41915
41931
|
return `working directory ${session.cwd} no longer exists`;
|
|
41916
41932
|
return missingRunConfigCwd(session);
|
|
41917
41933
|
}
|
|
@@ -41925,7 +41941,7 @@ function missingRunConfigCwd(session) {
|
|
|
41925
41941
|
const config = resolveRunConfig(session.runName, dir);
|
|
41926
41942
|
if (!config?.cwd) return void 0;
|
|
41927
41943
|
const configured = resolve25(runConfigBaseDirFrom(dir), config.cwd);
|
|
41928
|
-
if (
|
|
41944
|
+
if (existsSync88(configured)) return void 0;
|
|
41929
41945
|
return `run config "${config.name}": cwd ${configured} does not exist`;
|
|
41930
41946
|
}
|
|
41931
41947
|
|
|
@@ -41973,7 +41989,7 @@ function handleRefusedRun(session, exitCode, onStatusChange) {
|
|
|
41973
41989
|
}
|
|
41974
41990
|
|
|
41975
41991
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
41976
|
-
import { existsSync as
|
|
41992
|
+
import { existsSync as existsSync89, mkdirSync as mkdirSync34, watch as watch2 } from "fs";
|
|
41977
41993
|
import { dirname as dirname41 } from "path";
|
|
41978
41994
|
|
|
41979
41995
|
// src/commands/sessions/daemon/applyActivityToSession.ts
|
|
@@ -42059,7 +42075,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
42059
42075
|
if (timer) clearTimeout(timer);
|
|
42060
42076
|
timer = setTimeout(read3, DEBOUNCE_MS2);
|
|
42061
42077
|
});
|
|
42062
|
-
if (
|
|
42078
|
+
if (existsSync89(path106)) read3();
|
|
42063
42079
|
}
|
|
42064
42080
|
function refreshActivity(session) {
|
|
42065
42081
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -43880,7 +43896,7 @@ function rearmStoppedSessions(sessions, notify2) {
|
|
|
43880
43896
|
}
|
|
43881
43897
|
|
|
43882
43898
|
// src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
|
|
43883
|
-
import { existsSync as
|
|
43899
|
+
import { existsSync as existsSync92 } from "fs";
|
|
43884
43900
|
import { basename as basename29 } from "path";
|
|
43885
43901
|
|
|
43886
43902
|
// src/commands/sessions/daemon/worktree/accountedTrees.ts
|
|
@@ -43935,9 +43951,9 @@ function bindResumedWorktree(session, cwd, notify2) {
|
|
|
43935
43951
|
}
|
|
43936
43952
|
|
|
43937
43953
|
// src/commands/sessions/daemon/worktree/reclaimVanishedWorktrees.ts
|
|
43938
|
-
import { existsSync as
|
|
43954
|
+
import { existsSync as existsSync91 } from "fs";
|
|
43939
43955
|
async function reclaimVanishedWorktrees(clone, paths) {
|
|
43940
|
-
if (!
|
|
43956
|
+
if (!existsSync91(clone)) {
|
|
43941
43957
|
for (const { path: path106 } of paths) forgetWorktree(path106);
|
|
43942
43958
|
daemonLog(
|
|
43943
43959
|
`clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
|
|
@@ -44103,7 +44119,7 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
|
44103
44119
|
);
|
|
44104
44120
|
continue;
|
|
44105
44121
|
}
|
|
44106
|
-
if (!
|
|
44122
|
+
if (!existsSync92(path106)) {
|
|
44107
44123
|
logVanishedTree(sessions, path106);
|
|
44108
44124
|
vanished.set(clone, [
|
|
44109
44125
|
...vanished.get(clone) ?? [],
|
|
@@ -45689,7 +45705,7 @@ function setAutoAdvance(sessions, id, enabled) {
|
|
|
45689
45705
|
}
|
|
45690
45706
|
|
|
45691
45707
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
45692
|
-
import { existsSync as
|
|
45708
|
+
import { existsSync as existsSync95 } from "fs";
|
|
45693
45709
|
|
|
45694
45710
|
// src/commands/sessions/daemon/resumeSession.ts
|
|
45695
45711
|
function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
@@ -45720,10 +45736,10 @@ function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
|
45720
45736
|
}
|
|
45721
45737
|
|
|
45722
45738
|
// src/commands/sessions/daemon/worktree/resumeInReplacementTree.ts
|
|
45723
|
-
import { existsSync as
|
|
45739
|
+
import { existsSync as existsSync94 } from "fs";
|
|
45724
45740
|
|
|
45725
45741
|
// src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
|
|
45726
|
-
import { copyFileSync as copyFileSync5, existsSync as
|
|
45742
|
+
import { copyFileSync as copyFileSync5, existsSync as existsSync93, mkdirSync as mkdirSync36 } from "fs";
|
|
45727
45743
|
import { join as join101 } from "path";
|
|
45728
45744
|
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
45729
45745
|
const dir = projectDirForCwd(toCwd);
|
|
@@ -45734,7 +45750,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
45734
45750
|
return;
|
|
45735
45751
|
}
|
|
45736
45752
|
const dest = join101(dir, `${claudeSessionId}.jsonl`);
|
|
45737
|
-
if (
|
|
45753
|
+
if (existsSync93(dest)) {
|
|
45738
45754
|
daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
|
|
45739
45755
|
return;
|
|
45740
45756
|
}
|
|
@@ -45785,7 +45801,7 @@ function resumeInReplacementTree(ctx, claudeSessionId, missingCwd, name, harness
|
|
|
45785
45801
|
}
|
|
45786
45802
|
function cloneForReapedTree(missingCwd) {
|
|
45787
45803
|
const clone = worktreeAttributionIncludingReaped(missingCwd)?.clone;
|
|
45788
|
-
if (!clone || !
|
|
45804
|
+
if (!clone || !existsSync94(clone))
|
|
45789
45805
|
throw new Error(
|
|
45790
45806
|
`working directory no longer exists and no clone is recorded to re-allocate from: ${missingCwd}`
|
|
45791
45807
|
);
|
|
@@ -45794,7 +45810,7 @@ function cloneForReapedTree(missingCwd) {
|
|
|
45794
45810
|
|
|
45795
45811
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
45796
45812
|
function resumeInTree(ctx, sessionId, cwd, name, harness) {
|
|
45797
|
-
if (!
|
|
45813
|
+
if (!existsSync95(cwd))
|
|
45798
45814
|
return resumeInReplacementTree(ctx, sessionId, cwd, name, harness);
|
|
45799
45815
|
const id = ctx.spawnWith(
|
|
45800
45816
|
(sid) => resumeSession(sid, sessionId, cwd, name, void 0, harness)
|