@staff0rd/assist 0.755.0 → 0.755.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 +7 -11
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +133 -124
- 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.1",
|
|
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"], {
|
|
@@ -11276,12 +11285,12 @@ function createFallbackHandler(routes3, htmlHandler2, extra) {
|
|
|
11276
11285
|
}
|
|
11277
11286
|
|
|
11278
11287
|
// src/commands/backlog/resolveRepoLocation.ts
|
|
11279
|
-
import { existsSync as
|
|
11288
|
+
import { existsSync as existsSync34 } from "fs";
|
|
11280
11289
|
function resolveRepoLocation(origin, knownCwd, baseDir) {
|
|
11281
11290
|
if (knownCwd) return { cwd: knownCwd };
|
|
11282
11291
|
const target = cloneTargetDir(origin, baseDir);
|
|
11283
11292
|
if (!target) return {};
|
|
11284
|
-
if (
|
|
11293
|
+
if (existsSync34(target) && getCurrentOrigin(target) === origin)
|
|
11285
11294
|
return { cwd: target };
|
|
11286
11295
|
return { cloneTarget: target };
|
|
11287
11296
|
}
|
|
@@ -13297,14 +13306,14 @@ import { basename as basename11, join as join37 } from "path";
|
|
|
13297
13306
|
import { promisify as promisify5 } from "util";
|
|
13298
13307
|
|
|
13299
13308
|
// src/commands/sessions/web/findSynthesisForBranch.ts
|
|
13300
|
-
import { existsSync as
|
|
13309
|
+
import { existsSync as existsSync35, readdirSync as readdirSync4, statSync as statSync5 } from "fs";
|
|
13301
13310
|
import { basename as basename10, dirname as dirname22, join as join36 } from "path";
|
|
13302
13311
|
function findSynthesisForBranch(repoReviewsDir, branch2) {
|
|
13303
13312
|
const branchKeyPath = join36(repoReviewsDir, `${branch2}-`);
|
|
13304
13313
|
const parent = dirname22(branchKeyPath);
|
|
13305
13314
|
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) =>
|
|
13315
|
+
if (!existsSync35(parent)) return null;
|
|
13316
|
+
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
13317
|
return synthesisFiles[0]?.path ?? null;
|
|
13309
13318
|
}
|
|
13310
13319
|
|
|
@@ -14557,7 +14566,7 @@ async function nextPickup(req, res) {
|
|
|
14557
14566
|
import path27 from "path";
|
|
14558
14567
|
|
|
14559
14568
|
// src/commands/rules/readScopedRules.ts
|
|
14560
|
-
import { existsSync as
|
|
14569
|
+
import { existsSync as existsSync37, readFileSync as readFileSync23 } from "fs";
|
|
14561
14570
|
import path26 from "path";
|
|
14562
14571
|
|
|
14563
14572
|
// src/commands/rules/rulesSectionRange.ts
|
|
@@ -14606,11 +14615,11 @@ function parseRulesSection(content) {
|
|
|
14606
14615
|
}
|
|
14607
14616
|
|
|
14608
14617
|
// src/commands/rules/scopeDirectory.ts
|
|
14609
|
-
import { existsSync as
|
|
14618
|
+
import { existsSync as existsSync36, statSync as statSync6 } from "fs";
|
|
14610
14619
|
import path25 from "path";
|
|
14611
14620
|
function scopeDirectory(target) {
|
|
14612
14621
|
const resolved = path25.resolve(target);
|
|
14613
|
-
return
|
|
14622
|
+
return existsSync36(resolved) && statSync6(resolved).isDirectory() ? resolved : path25.dirname(resolved);
|
|
14614
14623
|
}
|
|
14615
14624
|
|
|
14616
14625
|
// src/commands/rules/readScopedRules.ts
|
|
@@ -14621,7 +14630,7 @@ function scopedClaudeFiles(target) {
|
|
|
14621
14630
|
let current = startDir;
|
|
14622
14631
|
while (true) {
|
|
14623
14632
|
const candidate = path26.join(current, "CLAUDE.md");
|
|
14624
|
-
if (
|
|
14633
|
+
if (existsSync37(candidate)) files.push(candidate);
|
|
14625
14634
|
if (current === root2 || current === path26.dirname(current)) break;
|
|
14626
14635
|
current = path26.dirname(current);
|
|
14627
14636
|
}
|
|
@@ -15772,11 +15781,11 @@ async function revertDiffFile(req, res) {
|
|
|
15772
15781
|
|
|
15773
15782
|
// src/commands/run/runCommandToCompletion.ts
|
|
15774
15783
|
import { spawn as spawn4 } from "child_process";
|
|
15775
|
-
import { existsSync as
|
|
15784
|
+
import { existsSync as existsSync39 } from "fs";
|
|
15776
15785
|
|
|
15777
15786
|
// src/commands/run/resolveCommand.ts
|
|
15778
15787
|
import { execFileSync as execFileSync4 } from "child_process";
|
|
15779
|
-
import { existsSync as
|
|
15788
|
+
import { existsSync as existsSync38 } from "fs";
|
|
15780
15789
|
import { dirname as dirname23, join as join38, resolve as resolve12 } from "path";
|
|
15781
15790
|
function resolveCommand(command) {
|
|
15782
15791
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
@@ -15784,7 +15793,7 @@ function resolveCommand(command) {
|
|
|
15784
15793
|
const gitPath = execFileSync4("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
15785
15794
|
const gitRoot = resolve12(dirname23(gitPath), "..");
|
|
15786
15795
|
const gitBash = join38(gitRoot, "bin", "bash.exe");
|
|
15787
|
-
if (
|
|
15796
|
+
if (existsSync38(gitBash)) return gitBash;
|
|
15788
15797
|
} catch {
|
|
15789
15798
|
return command;
|
|
15790
15799
|
}
|
|
@@ -15794,7 +15803,7 @@ function resolveCommand(command) {
|
|
|
15794
15803
|
// src/commands/run/runCommandToCompletion.ts
|
|
15795
15804
|
function runCommandToCompletion(command, args, env, cwd, quiet) {
|
|
15796
15805
|
return new Promise((resolveResult) => {
|
|
15797
|
-
if (cwd && !
|
|
15806
|
+
if (cwd && !existsSync39(cwd)) {
|
|
15798
15807
|
resolveResult({
|
|
15799
15808
|
kind: "failed",
|
|
15800
15809
|
message: `Failed to execute command: cwd ${cwd} does not exist`
|
|
@@ -16677,7 +16686,7 @@ import { readFile as readFile3, stat as stat3, writeFile as writeFile3 } from "f
|
|
|
16677
16686
|
|
|
16678
16687
|
// src/commands/sessions/web/formatWithOxfmt.ts
|
|
16679
16688
|
import { execFile as execFile12 } from "child_process";
|
|
16680
|
-
import { existsSync as
|
|
16689
|
+
import { existsSync as existsSync40 } from "fs";
|
|
16681
16690
|
import { dirname as dirname24, join as join40 } from "path";
|
|
16682
16691
|
import { promisify as promisify12 } from "util";
|
|
16683
16692
|
var execFileAsync11 = promisify12(execFile12);
|
|
@@ -16686,7 +16695,7 @@ function findOxfmtScript(root2) {
|
|
|
16686
16695
|
let dir = root2;
|
|
16687
16696
|
for (; ; ) {
|
|
16688
16697
|
const candidate = join40(dir, "node_modules", "oxfmt", "bin", "oxfmt");
|
|
16689
|
-
if (
|
|
16698
|
+
if (existsSync40(candidate)) return candidate;
|
|
16690
16699
|
const parent = dirname24(dir);
|
|
16691
16700
|
if (parent === dir) return void 0;
|
|
16692
16701
|
dir = parent;
|
|
@@ -18154,7 +18163,7 @@ function extractGraphqlQuery(args) {
|
|
|
18154
18163
|
}
|
|
18155
18164
|
|
|
18156
18165
|
// src/shared/loadCliReads.ts
|
|
18157
|
-
import { existsSync as
|
|
18166
|
+
import { existsSync as existsSync41, readFileSync as readFileSync26, writeFileSync as writeFileSync22 } from "fs";
|
|
18158
18167
|
import { dirname as dirname25, resolve as resolve13 } from "path";
|
|
18159
18168
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
18160
18169
|
var __filename3 = fileURLToPath5(import.meta.url);
|
|
@@ -18163,7 +18172,7 @@ function packageRoot() {
|
|
|
18163
18172
|
return __dirname4;
|
|
18164
18173
|
}
|
|
18165
18174
|
function readLines(path106) {
|
|
18166
|
-
if (!
|
|
18175
|
+
if (!existsSync41(path106)) return [];
|
|
18167
18176
|
return readFileSync26(path106, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
18168
18177
|
}
|
|
18169
18178
|
var cachedReads;
|
|
@@ -18210,7 +18219,7 @@ function findCliWrite(command) {
|
|
|
18210
18219
|
}
|
|
18211
18220
|
|
|
18212
18221
|
// src/shared/readSettingsPerms.ts
|
|
18213
|
-
import { existsSync as
|
|
18222
|
+
import { existsSync as existsSync42, readFileSync as readFileSync27 } from "fs";
|
|
18214
18223
|
import { homedir as homedir15 } from "os";
|
|
18215
18224
|
import { join as join41 } from "path";
|
|
18216
18225
|
function readSettingsPerms(key) {
|
|
@@ -18226,7 +18235,7 @@ function readSettingsPerms(key) {
|
|
|
18226
18235
|
return entries;
|
|
18227
18236
|
}
|
|
18228
18237
|
function readPermissionArray(filePath, key) {
|
|
18229
|
-
if (!
|
|
18238
|
+
if (!existsSync42(filePath)) return [];
|
|
18230
18239
|
try {
|
|
18231
18240
|
const data = JSON.parse(readFileSync27(filePath, "utf8"));
|
|
18232
18241
|
const arr = data?.permissions?.[key];
|
|
@@ -18583,7 +18592,7 @@ ${reasons.join("\n")}`);
|
|
|
18583
18592
|
}
|
|
18584
18593
|
|
|
18585
18594
|
// src/commands/permitCliReads.ts
|
|
18586
|
-
import { existsSync as
|
|
18595
|
+
import { existsSync as existsSync43, mkdirSync as mkdirSync13, readFileSync as readFileSync28, writeFileSync as writeFileSync23 } from "fs";
|
|
18587
18596
|
import { homedir as homedir17 } from "os";
|
|
18588
18597
|
import { join as join43 } from "path";
|
|
18589
18598
|
|
|
@@ -18852,7 +18861,7 @@ function logPath(cli) {
|
|
|
18852
18861
|
}
|
|
18853
18862
|
function readCache(cli) {
|
|
18854
18863
|
const path106 = logPath(cli);
|
|
18855
|
-
if (!
|
|
18864
|
+
if (!existsSync43(path106)) return void 0;
|
|
18856
18865
|
return readFileSync28(path106, "utf8");
|
|
18857
18866
|
}
|
|
18858
18867
|
function writeCache(cli, output) {
|
|
@@ -18987,7 +18996,7 @@ function registerCliHook(program2) {
|
|
|
18987
18996
|
}
|
|
18988
18997
|
|
|
18989
18998
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
18990
|
-
import { existsSync as
|
|
18999
|
+
import { existsSync as existsSync45, readFileSync as readFileSync30, unlinkSync as unlinkSync8, writeFileSync as writeFileSync24 } from "fs";
|
|
18991
19000
|
import chalk119 from "chalk";
|
|
18992
19001
|
|
|
18993
19002
|
// src/shared/isHashCommentFile.ts
|
|
@@ -19052,10 +19061,10 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
19052
19061
|
}
|
|
19053
19062
|
|
|
19054
19063
|
// src/commands/codeComment/readPinState.ts
|
|
19055
|
-
import { existsSync as
|
|
19064
|
+
import { existsSync as existsSync44, readFileSync as readFileSync29 } from "fs";
|
|
19056
19065
|
function readPinState(pin2) {
|
|
19057
19066
|
const path106 = getPinStatePath(pin2);
|
|
19058
|
-
if (!
|
|
19067
|
+
if (!existsSync44(path106)) return void 0;
|
|
19059
19068
|
try {
|
|
19060
19069
|
const state = JSON.parse(readFileSync29(path106, "utf8"));
|
|
19061
19070
|
if (state.pin !== pin2) return void 0;
|
|
@@ -19074,7 +19083,7 @@ function codeCommentConfirm(pin2) {
|
|
|
19074
19083
|
process.exitCode = 1;
|
|
19075
19084
|
return;
|
|
19076
19085
|
}
|
|
19077
|
-
if (!
|
|
19086
|
+
if (!existsSync45(state.file)) {
|
|
19078
19087
|
console.error(chalk119.red(`Target file no longer exists: ${state.file}`));
|
|
19079
19088
|
process.exitCode = 1;
|
|
19080
19089
|
return;
|
|
@@ -20695,7 +20704,7 @@ import { cp } from "fs/promises";
|
|
|
20695
20704
|
import chalk137 from "chalk";
|
|
20696
20705
|
|
|
20697
20706
|
// src/commands/criteriaExtension/criteriaExtensionDir.ts
|
|
20698
|
-
import { existsSync as
|
|
20707
|
+
import { existsSync as existsSync46 } from "fs";
|
|
20699
20708
|
import { dirname as dirname26, join as join46 } from "path";
|
|
20700
20709
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
20701
20710
|
var moduleDir = dirname26(fileURLToPath6(import.meta.url));
|
|
@@ -20706,7 +20715,7 @@ function criteriaExtensionDir() {
|
|
|
20706
20715
|
"criteriaExtension",
|
|
20707
20716
|
"criteria-extension"
|
|
20708
20717
|
);
|
|
20709
|
-
if (
|
|
20718
|
+
if (existsSync46(bundled)) return bundled;
|
|
20710
20719
|
return join46(moduleDir, "..", "..", "..", "criteria-extension");
|
|
20711
20720
|
}
|
|
20712
20721
|
|
|
@@ -20751,11 +20760,11 @@ async function copySignedXpi(xpi, dir) {
|
|
|
20751
20760
|
}
|
|
20752
20761
|
|
|
20753
20762
|
// src/commands/criteriaExtension/findSignedXpi.ts
|
|
20754
|
-
import { existsSync as
|
|
20763
|
+
import { existsSync as existsSync47 } from "fs";
|
|
20755
20764
|
import { readdir } from "fs/promises";
|
|
20756
20765
|
import { join as join48 } from "path";
|
|
20757
20766
|
async function findSignedXpi(dir) {
|
|
20758
|
-
if (!
|
|
20767
|
+
if (!existsSync47(dir)) return null;
|
|
20759
20768
|
const name = (await readdir(dir)).find((entry) => entry.endsWith(".xpi"));
|
|
20760
20769
|
return name ? join48(dir, name) : null;
|
|
20761
20770
|
}
|
|
@@ -20779,11 +20788,11 @@ async function signedAddonInstallPath(xpi) {
|
|
|
20779
20788
|
}
|
|
20780
20789
|
|
|
20781
20790
|
// src/commands/criteriaExtension/signPreflightProblem.ts
|
|
20782
|
-
import { existsSync as
|
|
20791
|
+
import { existsSync as existsSync48 } from "fs";
|
|
20783
20792
|
import { join as join49 } from "path";
|
|
20784
20793
|
var KEY_URL = "https://addons.mozilla.org/en-US/developers/addon/api/key/";
|
|
20785
20794
|
function signPreflightProblem(source) {
|
|
20786
|
-
if (!
|
|
20795
|
+
if (!existsSync48(join49(source, "content.js")))
|
|
20787
20796
|
return {
|
|
20788
20797
|
message: `no content.js in ${source}`,
|
|
20789
20798
|
hint: "run npm run build to bundle the content script"
|
|
@@ -21053,10 +21062,10 @@ function getMigrationApprovalPath(migrationId) {
|
|
|
21053
21062
|
}
|
|
21054
21063
|
|
|
21055
21064
|
// src/commands/dbMigration/readMigrationPinState.ts
|
|
21056
|
-
import { existsSync as
|
|
21065
|
+
import { existsSync as existsSync49, readFileSync as readFileSync31 } from "fs";
|
|
21057
21066
|
function readMigrationPinState(pin2) {
|
|
21058
21067
|
const path106 = getMigrationPinPath(pin2);
|
|
21059
|
-
if (!
|
|
21068
|
+
if (!existsSync49(path106)) return void 0;
|
|
21060
21069
|
try {
|
|
21061
21070
|
const state = JSON.parse(readFileSync31(path106, "utf8"));
|
|
21062
21071
|
if (state.pin !== pin2) return void 0;
|
|
@@ -21145,7 +21154,7 @@ function registerDbMigration(parent) {
|
|
|
21145
21154
|
}
|
|
21146
21155
|
|
|
21147
21156
|
// src/commands/deploy/redirect.ts
|
|
21148
|
-
import { existsSync as
|
|
21157
|
+
import { existsSync as existsSync50, readFileSync as readFileSync32, writeFileSync as writeFileSync28 } from "fs";
|
|
21149
21158
|
import chalk144 from "chalk";
|
|
21150
21159
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
21151
21160
|
if (!window.location.pathname.endsWith('/')) {
|
|
@@ -21154,7 +21163,7 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
21154
21163
|
</script>`;
|
|
21155
21164
|
function redirect() {
|
|
21156
21165
|
const indexPath = "index.html";
|
|
21157
|
-
if (!
|
|
21166
|
+
if (!existsSync50(indexPath)) {
|
|
21158
21167
|
console.log(chalk144.yellow("No index.html found"));
|
|
21159
21168
|
return;
|
|
21160
21169
|
}
|
|
@@ -21201,7 +21210,7 @@ import { execSync as execSync31 } from "child_process";
|
|
|
21201
21210
|
import chalk145 from "chalk";
|
|
21202
21211
|
|
|
21203
21212
|
// src/shared/getRepoName.ts
|
|
21204
|
-
import { existsSync as
|
|
21213
|
+
import { existsSync as existsSync51, readFileSync as readFileSync33 } from "fs";
|
|
21205
21214
|
import { basename as basename14, join as join55 } from "path";
|
|
21206
21215
|
function getRepoName() {
|
|
21207
21216
|
const config = loadConfig();
|
|
@@ -21209,7 +21218,7 @@ function getRepoName() {
|
|
|
21209
21218
|
return config.devlog.name;
|
|
21210
21219
|
}
|
|
21211
21220
|
const packageJsonPath = join55(process.cwd(), "package.json");
|
|
21212
|
-
if (
|
|
21221
|
+
if (existsSync51(packageJsonPath)) {
|
|
21213
21222
|
try {
|
|
21214
21223
|
const content = readFileSync33(packageJsonPath, "utf8");
|
|
21215
21224
|
const pkg = JSON.parse(content);
|
|
@@ -21911,12 +21920,12 @@ function printJson(tree, totalCount, solutions) {
|
|
|
21911
21920
|
}
|
|
21912
21921
|
|
|
21913
21922
|
// src/commands/dotnet/resolveCsproj.ts
|
|
21914
|
-
import { existsSync as
|
|
21923
|
+
import { existsSync as existsSync52 } from "fs";
|
|
21915
21924
|
import path36 from "path";
|
|
21916
21925
|
import chalk154 from "chalk";
|
|
21917
21926
|
function resolveCsproj(csprojPath) {
|
|
21918
21927
|
const resolved = path36.resolve(csprojPath);
|
|
21919
|
-
if (!
|
|
21928
|
+
if (!existsSync52(resolved)) {
|
|
21920
21929
|
console.error(chalk154.red(`File not found: ${resolved}`));
|
|
21921
21930
|
process.exit(1);
|
|
21922
21931
|
}
|
|
@@ -22084,7 +22093,7 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
22084
22093
|
}
|
|
22085
22094
|
|
|
22086
22095
|
// src/commands/dotnet/resolveSolution.ts
|
|
22087
|
-
import { existsSync as
|
|
22096
|
+
import { existsSync as existsSync53 } from "fs";
|
|
22088
22097
|
import path37 from "path";
|
|
22089
22098
|
import chalk158 from "chalk";
|
|
22090
22099
|
|
|
@@ -22125,7 +22134,7 @@ function findSolution() {
|
|
|
22125
22134
|
function resolveSolution(sln) {
|
|
22126
22135
|
if (sln) {
|
|
22127
22136
|
const resolved = path37.resolve(sln);
|
|
22128
|
-
if (!
|
|
22137
|
+
if (!existsSync53(resolved)) {
|
|
22129
22138
|
console.error(chalk158.red(`Solution file not found: ${resolved}`));
|
|
22130
22139
|
process.exit(1);
|
|
22131
22140
|
}
|
|
@@ -22165,7 +22174,7 @@ function parseInspectReport(json) {
|
|
|
22165
22174
|
|
|
22166
22175
|
// src/commands/dotnet/runInspectCode.ts
|
|
22167
22176
|
import { execSync as execSync35 } from "child_process";
|
|
22168
|
-
import { existsSync as
|
|
22177
|
+
import { existsSync as existsSync54, readFileSync as readFileSync37, unlinkSync as unlinkSync10 } from "fs";
|
|
22169
22178
|
import { tmpdir as tmpdir5 } from "os";
|
|
22170
22179
|
import path38 from "path";
|
|
22171
22180
|
import chalk159 from "chalk";
|
|
@@ -22196,7 +22205,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
22196
22205
|
console.error(chalk159.red("jb inspectcode failed"));
|
|
22197
22206
|
process.exit(1);
|
|
22198
22207
|
}
|
|
22199
|
-
if (!
|
|
22208
|
+
if (!existsSync54(reportPath)) {
|
|
22200
22209
|
console.error(chalk159.red("Report file not generated"));
|
|
22201
22210
|
process.exit(1);
|
|
22202
22211
|
}
|
|
@@ -22965,11 +22974,11 @@ function decideCommentGuard(input, existingContent) {
|
|
|
22965
22974
|
}
|
|
22966
22975
|
|
|
22967
22976
|
// src/commands/dbMigration/consumeMigrationApproval.ts
|
|
22968
|
-
import { existsSync as
|
|
22977
|
+
import { existsSync as existsSync55, unlinkSync as unlinkSync11 } from "fs";
|
|
22969
22978
|
function consumeMigrationApproval(migrationId) {
|
|
22970
22979
|
sweepRestrictedDir();
|
|
22971
22980
|
const path106 = getMigrationApprovalPath(migrationId);
|
|
22972
|
-
if (!
|
|
22981
|
+
if (!existsSync55(path106)) return false;
|
|
22973
22982
|
try {
|
|
22974
22983
|
unlinkSync11(path106);
|
|
22975
22984
|
return true;
|
|
@@ -24376,7 +24385,7 @@ function fetchIssue2(number, repo) {
|
|
|
24376
24385
|
}
|
|
24377
24386
|
|
|
24378
24387
|
// src/commands/github/issue/resumeIssueBody.ts
|
|
24379
|
-
import { existsSync as
|
|
24388
|
+
import { existsSync as existsSync56, readFileSync as readFileSync38 } from "fs";
|
|
24380
24389
|
|
|
24381
24390
|
// src/commands/github/issue/issueWorkingFile.ts
|
|
24382
24391
|
import { join as join61 } from "path";
|
|
@@ -24393,7 +24402,7 @@ function issueWorkingFile(slug2, number) {
|
|
|
24393
24402
|
// src/commands/github/issue/resumeIssueBody.ts
|
|
24394
24403
|
function resumeIssueBody(slug2, number, updatedAt) {
|
|
24395
24404
|
const { bodyPath, metaPath } = issueWorkingFile(slug2, number);
|
|
24396
|
-
if (!
|
|
24405
|
+
if (!existsSync56(bodyPath) || !existsSync56(metaPath)) return void 0;
|
|
24397
24406
|
try {
|
|
24398
24407
|
const meta = JSON.parse(readFileSync38(metaPath, "utf8"));
|
|
24399
24408
|
if (meta.updatedAt !== updatedAt) return void 0;
|
|
@@ -25025,7 +25034,7 @@ function canonicalTreePath(path106) {
|
|
|
25025
25034
|
}
|
|
25026
25035
|
|
|
25027
25036
|
// src/commands/sessions/daemon/worktree/createWorktree.ts
|
|
25028
|
-
import { existsSync as
|
|
25037
|
+
import { existsSync as existsSync57 } from "fs";
|
|
25029
25038
|
import { basename as basename17, dirname as dirname28 } from "path";
|
|
25030
25039
|
|
|
25031
25040
|
// src/commands/sessions/daemon/worktree/planAllocation.ts
|
|
@@ -25072,7 +25081,7 @@ function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
|
|
|
25072
25081
|
const base = strategy.root ? expandTilde2(strategy.root) : dirname28(clone);
|
|
25073
25082
|
const registered = new Set(listWorktreePaths(clone));
|
|
25074
25083
|
const branches = new Set(listLocalBranches(clone));
|
|
25075
|
-
const isTaken = (candidate) => registered.has(candidate) ||
|
|
25084
|
+
const isTaken = (candidate) => registered.has(candidate) || existsSync57(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename17(candidate));
|
|
25076
25085
|
const path106 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
|
|
25077
25086
|
const start2 = worktreeStartPoint(clone, strategy.trunk);
|
|
25078
25087
|
gitSync(clone, [
|
|
@@ -25098,7 +25107,7 @@ function keptInTree(cwd, reason4) {
|
|
|
25098
25107
|
}
|
|
25099
25108
|
|
|
25100
25109
|
// src/commands/sessions/daemon/worktree/treeDurability.ts
|
|
25101
|
-
import { existsSync as
|
|
25110
|
+
import { existsSync as existsSync58 } from "fs";
|
|
25102
25111
|
var treeIsGone = { durable: true, gone: true };
|
|
25103
25112
|
function treeDurability(state) {
|
|
25104
25113
|
if (state.dirty) return { durable: false, reason: "uncommitted changes" };
|
|
@@ -25129,14 +25138,14 @@ function* durabilityProbes() {
|
|
|
25129
25138
|
});
|
|
25130
25139
|
}
|
|
25131
25140
|
async function checkDurability(cwd) {
|
|
25132
|
-
if (!
|
|
25141
|
+
if (!existsSync58(cwd)) return treeIsGone;
|
|
25133
25142
|
const probes = durabilityProbes();
|
|
25134
25143
|
let step3 = probes.next();
|
|
25135
25144
|
while (!step3.done) step3 = probes.next(await gitResult(cwd, step3.value));
|
|
25136
25145
|
return step3.value;
|
|
25137
25146
|
}
|
|
25138
25147
|
function checkDurabilitySync(cwd) {
|
|
25139
|
-
if (!
|
|
25148
|
+
if (!existsSync58(cwd)) return treeIsGone;
|
|
25140
25149
|
const probes = durabilityProbes();
|
|
25141
25150
|
let step3 = probes.next();
|
|
25142
25151
|
while (!step3.done) step3 = probes.next(gitSyncResult(cwd, step3.value));
|
|
@@ -25387,20 +25396,20 @@ function persistedTreeRoots() {
|
|
|
25387
25396
|
}
|
|
25388
25397
|
|
|
25389
25398
|
// src/commands/sessions/daemon/worktree/seedWorktree.ts
|
|
25390
|
-
import { copyFileSync, existsSync as
|
|
25399
|
+
import { copyFileSync, existsSync as existsSync60, mkdirSync as mkdirSync17 } from "fs";
|
|
25391
25400
|
import { dirname as dirname29, join as join64 } from "path";
|
|
25392
25401
|
|
|
25393
25402
|
// src/commands/sessions/daemon/worktree/runInstall.ts
|
|
25394
25403
|
import { resolve as resolve16 } from "path";
|
|
25395
25404
|
|
|
25396
25405
|
// src/commands/sessions/daemon/worktree/detectInstallCommand.ts
|
|
25397
|
-
import { existsSync as
|
|
25406
|
+
import { existsSync as existsSync59 } from "fs";
|
|
25398
25407
|
import { join as join63 } from "path";
|
|
25399
25408
|
function detectInstallCommand(dir) {
|
|
25400
|
-
if (!
|
|
25401
|
-
if (
|
|
25402
|
-
if (
|
|
25403
|
-
if (
|
|
25409
|
+
if (!existsSync59(join63(dir, "package.json"))) return null;
|
|
25410
|
+
if (existsSync59(join63(dir, "pnpm-lock.yaml"))) return "pnpm install";
|
|
25411
|
+
if (existsSync59(join63(dir, "yarn.lock"))) return "yarn install";
|
|
25412
|
+
if (existsSync59(join63(dir, "bun.lockb"))) return "bun install";
|
|
25404
25413
|
return "npm install";
|
|
25405
25414
|
}
|
|
25406
25415
|
|
|
@@ -25563,7 +25572,7 @@ function seedWorktree(worktreePath, clone, onSeeded = () => {
|
|
|
25563
25572
|
function copyConfigFiles(worktreePath, clone, copy) {
|
|
25564
25573
|
for (const rel of copy) {
|
|
25565
25574
|
const src = join64(clone, rel);
|
|
25566
|
-
if (!
|
|
25575
|
+
if (!existsSync60(src)) continue;
|
|
25567
25576
|
const dest = join64(worktreePath, rel);
|
|
25568
25577
|
try {
|
|
25569
25578
|
mkdirSync17(dirname29(dest), { recursive: true });
|
|
@@ -26111,10 +26120,10 @@ function applyIgnore(texts, ignore3) {
|
|
|
26111
26120
|
}
|
|
26112
26121
|
|
|
26113
26122
|
// src/commands/miro/readIgnoreList.ts
|
|
26114
|
-
import { existsSync as
|
|
26123
|
+
import { existsSync as existsSync61, readFileSync as readFileSync40 } from "fs";
|
|
26115
26124
|
import { parse as parse2 } from "yaml";
|
|
26116
26125
|
function readIgnoreList(file) {
|
|
26117
|
-
if (!
|
|
26126
|
+
if (!existsSync61(file))
|
|
26118
26127
|
throw new MiroExtractError(
|
|
26119
26128
|
`No ignore file at ${file}. Write a YAML list of the box texts to drop, or omit --ignore.`
|
|
26120
26129
|
);
|
|
@@ -27532,7 +27541,7 @@ import { tmpdir as tmpdir7 } from "os";
|
|
|
27532
27541
|
import { join as join71 } from "path";
|
|
27533
27542
|
|
|
27534
27543
|
// src/commands/prs/loadCommentsCache.ts
|
|
27535
|
-
import { existsSync as
|
|
27544
|
+
import { existsSync as existsSync62, readFileSync as readFileSync43, unlinkSync as unlinkSync13 } from "fs";
|
|
27536
27545
|
import { parse as parse3 } from "yaml";
|
|
27537
27546
|
|
|
27538
27547
|
// src/commands/prs/commentsCachePath.ts
|
|
@@ -27552,7 +27561,7 @@ function commentsCachePath(org, repo, prNumber) {
|
|
|
27552
27561
|
// src/commands/prs/loadCommentsCache.ts
|
|
27553
27562
|
function loadCommentsCache(org, repo, prNumber) {
|
|
27554
27563
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
27555
|
-
if (!
|
|
27564
|
+
if (!existsSync62(cachePath)) {
|
|
27556
27565
|
return null;
|
|
27557
27566
|
}
|
|
27558
27567
|
const content = readFileSync43(cachePath, "utf8");
|
|
@@ -27560,7 +27569,7 @@ function loadCommentsCache(org, repo, prNumber) {
|
|
|
27560
27569
|
}
|
|
27561
27570
|
function deleteCommentsCache(org, repo, prNumber) {
|
|
27562
27571
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
27563
|
-
if (
|
|
27572
|
+
if (existsSync62(cachePath)) {
|
|
27564
27573
|
unlinkSync13(cachePath);
|
|
27565
27574
|
console.log("No more unresolved line comments. Cache dropped.");
|
|
27566
27575
|
}
|
|
@@ -30382,7 +30391,7 @@ async function notify() {
|
|
|
30382
30391
|
|
|
30383
30392
|
// src/commands/screenshot.ts
|
|
30384
30393
|
import { execSync as execSync52 } from "child_process";
|
|
30385
|
-
import { existsSync as
|
|
30394
|
+
import { existsSync as existsSync63, mkdirSync as mkdirSync21, unlinkSync as unlinkSync17, writeFileSync as writeFileSync38 } from "fs";
|
|
30386
30395
|
import { tmpdir as tmpdir9 } from "os";
|
|
30387
30396
|
import { join as join74, resolve as resolve21 } from "path";
|
|
30388
30397
|
import chalk204 from "chalk";
|
|
@@ -30514,7 +30523,7 @@ Write-Output $OutputPath
|
|
|
30514
30523
|
|
|
30515
30524
|
// src/commands/screenshot.ts
|
|
30516
30525
|
function buildOutputPath(outputDir, processName) {
|
|
30517
|
-
if (!
|
|
30526
|
+
if (!existsSync63(outputDir)) {
|
|
30518
30527
|
mkdirSync21(outputDir, { recursive: true });
|
|
30519
30528
|
}
|
|
30520
30529
|
const timestamp5 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
@@ -33624,7 +33633,7 @@ function fetchHighLevelPr(prNumber, repo) {
|
|
|
33624
33633
|
}
|
|
33625
33634
|
|
|
33626
33635
|
// src/commands/review/highLevel/loadHighLevelReview.ts
|
|
33627
|
-
import { existsSync as
|
|
33636
|
+
import { existsSync as existsSync64, readFileSync as readFileSync47 } from "fs";
|
|
33628
33637
|
|
|
33629
33638
|
// src/commands/review/highLevel/highLevelReviewPath.ts
|
|
33630
33639
|
import { join as join76 } from "path";
|
|
@@ -33643,7 +33652,7 @@ function highLevelReviewPath(repo, headRef, headSha) {
|
|
|
33643
33652
|
// src/commands/review/highLevel/loadHighLevelReview.ts
|
|
33644
33653
|
function loadHighLevelReview(repo, headRef, headSha) {
|
|
33645
33654
|
const path106 = highLevelReviewPath(repo, headRef, headSha);
|
|
33646
|
-
if (!
|
|
33655
|
+
if (!existsSync64(path106)) return void 0;
|
|
33647
33656
|
try {
|
|
33648
33657
|
return JSON.parse(readFileSync47(path106, "utf8"));
|
|
33649
33658
|
} catch {
|
|
@@ -34950,7 +34959,7 @@ function printReviewerFailures(results) {
|
|
|
34950
34959
|
}
|
|
34951
34960
|
|
|
34952
34961
|
// src/commands/review/runAndSynthesise.ts
|
|
34953
|
-
import { existsSync as
|
|
34962
|
+
import { existsSync as existsSync66, unlinkSync as unlinkSync19 } from "fs";
|
|
34954
34963
|
|
|
34955
34964
|
// src/commands/review/buildReviewerStdin.ts
|
|
34956
34965
|
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 +35414,7 @@ function buildCodexModelArgs() {
|
|
|
35405
35414
|
}
|
|
35406
35415
|
|
|
35407
35416
|
// src/commands/review/runCodexReviewer.ts
|
|
35408
|
-
import { existsSync as
|
|
35417
|
+
import { existsSync as existsSync65, unlinkSync as unlinkSync18 } from "fs";
|
|
35409
35418
|
|
|
35410
35419
|
// src/commands/review/parseCodexEvent.ts
|
|
35411
35420
|
function isItemStarted(value) {
|
|
@@ -35460,7 +35469,7 @@ async function runCodexReviewer(spec) {
|
|
|
35460
35469
|
reportReviewerToolUse(spec.name, event, spinner, override.model);
|
|
35461
35470
|
}
|
|
35462
35471
|
});
|
|
35463
|
-
if (result.exitCode !== 0 &&
|
|
35472
|
+
if (result.exitCode !== 0 && existsSync65(spec.outputPath)) {
|
|
35464
35473
|
unlinkSync18(spec.outputPath);
|
|
35465
35474
|
}
|
|
35466
35475
|
return finaliseReviewerRun(
|
|
@@ -35646,7 +35655,7 @@ async function runAndSynthesise(args) {
|
|
|
35646
35655
|
console.error(reason4);
|
|
35647
35656
|
return { ok: false, failures };
|
|
35648
35657
|
}
|
|
35649
|
-
if (anyFresh &&
|
|
35658
|
+
if (anyFresh && existsSync66(paths.synthesisPath)) {
|
|
35650
35659
|
unlinkSync19(paths.synthesisPath);
|
|
35651
35660
|
}
|
|
35652
35661
|
const synthesisResult = await synthesise(paths, {
|
|
@@ -35870,10 +35879,10 @@ function fetchExistingComments() {
|
|
|
35870
35879
|
}
|
|
35871
35880
|
|
|
35872
35881
|
// src/commands/review/prepareReviewDir.ts
|
|
35873
|
-
import { existsSync as
|
|
35882
|
+
import { existsSync as existsSync67, mkdirSync as mkdirSync24, unlinkSync as unlinkSync20, writeFileSync as writeFileSync41 } from "fs";
|
|
35874
35883
|
function clearReviewFiles(paths) {
|
|
35875
35884
|
for (const path106 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
35876
|
-
if (
|
|
35885
|
+
if (existsSync67(path106)) unlinkSync20(path106);
|
|
35877
35886
|
}
|
|
35878
35887
|
}
|
|
35879
35888
|
function prepareReviewDir(paths, requestBody, force) {
|
|
@@ -36102,7 +36111,7 @@ function registerReview(program2) {
|
|
|
36102
36111
|
}
|
|
36103
36112
|
|
|
36104
36113
|
// src/commands/rules/addRule.ts
|
|
36105
|
-
import { existsSync as
|
|
36114
|
+
import { existsSync as existsSync70, readFileSync as readFileSync53, writeFileSync as writeFileSync43 } from "fs";
|
|
36106
36115
|
import path85 from "path";
|
|
36107
36116
|
import chalk236 from "chalk";
|
|
36108
36117
|
|
|
@@ -36159,7 +36168,7 @@ function nextRuleCode(root2) {
|
|
|
36159
36168
|
}
|
|
36160
36169
|
|
|
36161
36170
|
// src/commands/rules/resolveRuleScope.ts
|
|
36162
|
-
import { existsSync as
|
|
36171
|
+
import { existsSync as existsSync68 } from "fs";
|
|
36163
36172
|
import path82 from "path";
|
|
36164
36173
|
function resolveRuleScope(target) {
|
|
36165
36174
|
const resolved = path82.resolve(target);
|
|
@@ -36169,7 +36178,7 @@ function resolveRuleScope(target) {
|
|
|
36169
36178
|
let current = startDir;
|
|
36170
36179
|
while (true) {
|
|
36171
36180
|
const candidate = path82.join(current, "CLAUDE.md");
|
|
36172
|
-
if (
|
|
36181
|
+
if (existsSync68(candidate)) return candidate;
|
|
36173
36182
|
if (current === root2 || current === path82.dirname(current)) break;
|
|
36174
36183
|
current = path82.dirname(current);
|
|
36175
36184
|
}
|
|
@@ -36177,7 +36186,7 @@ function resolveRuleScope(target) {
|
|
|
36177
36186
|
}
|
|
36178
36187
|
|
|
36179
36188
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
36180
|
-
import { existsSync as
|
|
36189
|
+
import { existsSync as existsSync69, readFileSync as readFileSync52, writeFileSync as writeFileSync42 } from "fs";
|
|
36181
36190
|
import path84 from "path";
|
|
36182
36191
|
|
|
36183
36192
|
// src/commands/rules/scopedRuleDirectories.ts
|
|
@@ -36227,7 +36236,7 @@ function upsertScopedRulesPointer(content, directories) {
|
|
|
36227
36236
|
function updateScopedRulesIndex(root2) {
|
|
36228
36237
|
const directories = scopedRuleDirectories(root2);
|
|
36229
36238
|
const rootFile = path84.join(root2, "CLAUDE.md");
|
|
36230
|
-
const before =
|
|
36239
|
+
const before = existsSync69(rootFile) ? readFileSync52(rootFile, "utf8") : "";
|
|
36231
36240
|
const after = upsertScopedRulesPointer(before, directories);
|
|
36232
36241
|
if (after !== before) writeFileSync42(rootFile, after);
|
|
36233
36242
|
return directories;
|
|
@@ -36235,7 +36244,7 @@ function updateScopedRulesIndex(root2) {
|
|
|
36235
36244
|
|
|
36236
36245
|
// src/commands/rules/addRule.ts
|
|
36237
36246
|
function read2(file) {
|
|
36238
|
-
return
|
|
36247
|
+
return existsSync70(file) ? readFileSync53(file, "utf8") : "";
|
|
36239
36248
|
}
|
|
36240
36249
|
function addRule(text17, options2) {
|
|
36241
36250
|
const rule = text17.trim();
|
|
@@ -37636,7 +37645,7 @@ function registerSync(program2) {
|
|
|
37636
37645
|
}
|
|
37637
37646
|
|
|
37638
37647
|
// src/commands/transcript/clean.ts
|
|
37639
|
-
import { existsSync as
|
|
37648
|
+
import { existsSync as existsSync75 } from "fs";
|
|
37640
37649
|
|
|
37641
37650
|
// src/commands/transcript/convert/formatTimestamp.ts
|
|
37642
37651
|
function pad(value, width) {
|
|
@@ -37914,7 +37923,7 @@ function clean(file, options2 = {}) {
|
|
|
37914
37923
|
);
|
|
37915
37924
|
process.exit(1);
|
|
37916
37925
|
}
|
|
37917
|
-
if (!
|
|
37926
|
+
if (!existsSync75(file)) {
|
|
37918
37927
|
console.error(`Error: VTT file not found: ${file}`);
|
|
37919
37928
|
process.exit(1);
|
|
37920
37929
|
}
|
|
@@ -37997,11 +38006,11 @@ async function configure() {
|
|
|
37997
38006
|
}
|
|
37998
38007
|
|
|
37999
38008
|
// src/commands/transcript/list.ts
|
|
38000
|
-
import { existsSync as
|
|
38009
|
+
import { existsSync as existsSync76, readdirSync as readdirSync19, statSync as statSync11 } from "fs";
|
|
38001
38010
|
import { join as join91 } from "path";
|
|
38002
38011
|
function list3() {
|
|
38003
38012
|
const { vttDir } = getTranscriptConfig();
|
|
38004
|
-
if (!
|
|
38013
|
+
if (!existsSync76(vttDir)) return;
|
|
38005
38014
|
for (const entry of readdirSync19(vttDir)) {
|
|
38006
38015
|
if (!entry.endsWith(".vtt")) continue;
|
|
38007
38016
|
if (statSync11(join91(vttDir, entry)).isDirectory()) continue;
|
|
@@ -38010,7 +38019,7 @@ function list3() {
|
|
|
38010
38019
|
}
|
|
38011
38020
|
|
|
38012
38021
|
// src/commands/transcript/move.ts
|
|
38013
|
-
import { existsSync as
|
|
38022
|
+
import { existsSync as existsSync77, mkdirSync as mkdirSync32, renameSync as renameSync2, writeFileSync as writeFileSync50 } from "fs";
|
|
38014
38023
|
import { basename as basename24, join as join92 } from "path";
|
|
38015
38024
|
|
|
38016
38025
|
// src/commands/transcript/convertVttToMarkdown.ts
|
|
@@ -38034,7 +38043,7 @@ function move(file, options2) {
|
|
|
38034
38043
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
38035
38044
|
const filename = basename24(file);
|
|
38036
38045
|
const sourcePath = join92(vttDir, filename);
|
|
38037
|
-
if (!
|
|
38046
|
+
if (!existsSync77(sourcePath)) {
|
|
38038
38047
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
38039
38048
|
process.exit(1);
|
|
38040
38049
|
}
|
|
@@ -38051,7 +38060,7 @@ function move(file, options2) {
|
|
|
38051
38060
|
}
|
|
38052
38061
|
|
|
38053
38062
|
// src/commands/transcript/merge.ts
|
|
38054
|
-
import { existsSync as
|
|
38063
|
+
import { existsSync as existsSync78, writeFileSync as writeFileSync51 } from "fs";
|
|
38055
38064
|
import { basename as basename25 } from "path";
|
|
38056
38065
|
|
|
38057
38066
|
// src/commands/transcript/failTranscript.ts
|
|
@@ -38195,7 +38204,7 @@ function widenAudience(passages) {
|
|
|
38195
38204
|
|
|
38196
38205
|
// src/commands/transcript/merge.ts
|
|
38197
38206
|
function readSource3(file) {
|
|
38198
|
-
if (!
|
|
38207
|
+
if (!existsSync78(file)) failTranscript(`VTT file not found: ${file}`);
|
|
38199
38208
|
const cues = readCleanedCues(file);
|
|
38200
38209
|
if (cues.length === 0) failTranscript(`no cues found in: ${file}`);
|
|
38201
38210
|
return { path: file, name: basename25(file), cues };
|
|
@@ -38662,7 +38671,7 @@ function configKeys2() {
|
|
|
38662
38671
|
}
|
|
38663
38672
|
|
|
38664
38673
|
// src/commands/verify/forbiddenStrings.ts
|
|
38665
|
-
import { existsSync as
|
|
38674
|
+
import { existsSync as existsSync79, readFileSync as readFileSync60 } from "fs";
|
|
38666
38675
|
|
|
38667
38676
|
// src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
|
|
38668
38677
|
import { minimatch as minimatch9 } from "minimatch";
|
|
@@ -38703,7 +38712,7 @@ function forbiddenStrings() {
|
|
|
38703
38712
|
const cache6 = /* @__PURE__ */ new Map();
|
|
38704
38713
|
const readJson = (file) => {
|
|
38705
38714
|
if (cache6.has(file)) return cache6.get(file);
|
|
38706
|
-
if (!
|
|
38715
|
+
if (!existsSync79(file)) {
|
|
38707
38716
|
console.log(`Forbidden-strings file not found: ${file}`);
|
|
38708
38717
|
process.exit(1);
|
|
38709
38718
|
}
|
|
@@ -39462,7 +39471,7 @@ function resolveParams(params, cliArgs) {
|
|
|
39462
39471
|
}
|
|
39463
39472
|
|
|
39464
39473
|
// src/commands/run/resolveRunCwd.ts
|
|
39465
|
-
import { existsSync as
|
|
39474
|
+
import { existsSync as existsSync80 } from "fs";
|
|
39466
39475
|
import { resolve as resolve24 } from "path";
|
|
39467
39476
|
var MissingRunCwdError = class extends Error {
|
|
39468
39477
|
constructor(runName, cwd) {
|
|
@@ -39475,7 +39484,7 @@ var MissingRunCwdError = class extends Error {
|
|
|
39475
39484
|
function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
|
|
39476
39485
|
if (!config.cwd) return void 0;
|
|
39477
39486
|
const cwd = resolve24(baseDir, config.cwd);
|
|
39478
|
-
if (!
|
|
39487
|
+
if (!existsSync80(cwd)) throw new MissingRunCwdError(config.name, cwd);
|
|
39479
39488
|
return cwd;
|
|
39480
39489
|
}
|
|
39481
39490
|
|
|
@@ -40150,7 +40159,7 @@ function link2() {
|
|
|
40150
40159
|
}
|
|
40151
40160
|
|
|
40152
40161
|
// src/commands/run/remove.ts
|
|
40153
|
-
import { existsSync as
|
|
40162
|
+
import { existsSync as existsSync81, unlinkSync as unlinkSync21 } from "fs";
|
|
40154
40163
|
import { join as join96 } from "path";
|
|
40155
40164
|
function findRemoveIndex() {
|
|
40156
40165
|
const idx = process.argv.indexOf("remove");
|
|
@@ -40167,7 +40176,7 @@ function parseRemoveName() {
|
|
|
40167
40176
|
}
|
|
40168
40177
|
function deleteCommandFile(name) {
|
|
40169
40178
|
const filePath = join96(".claude", "commands", `${name}.md`);
|
|
40170
|
-
if (
|
|
40179
|
+
if (existsSync81(filePath)) {
|
|
40171
40180
|
unlinkSync21(filePath);
|
|
40172
40181
|
console.log(`Deleted command file: ${filePath}`);
|
|
40173
40182
|
}
|
|
@@ -40556,12 +40565,12 @@ function toSessionRunInfo({
|
|
|
40556
40565
|
}
|
|
40557
40566
|
|
|
40558
40567
|
// src/commands/sessions/daemon/worktree/joinRefusal.ts
|
|
40559
|
-
import { existsSync as
|
|
40568
|
+
import { existsSync as existsSync82 } from "fs";
|
|
40560
40569
|
function joinRefusal(session) {
|
|
40561
40570
|
if (session.commandType === "run") return "a server run has no agent stream";
|
|
40562
40571
|
if (session.closing === true) return "the session is closing";
|
|
40563
40572
|
if (!session.cwd) return "the session has no working directory";
|
|
40564
|
-
if (!
|
|
40573
|
+
if (!existsSync82(session.cwd))
|
|
40565
40574
|
return "the session's workspace no longer exists";
|
|
40566
40575
|
return void 0;
|
|
40567
40576
|
}
|
|
@@ -40761,11 +40770,11 @@ function sessionBase(id, status2) {
|
|
|
40761
40770
|
}
|
|
40762
40771
|
|
|
40763
40772
|
// src/commands/sessions/daemon/spawnPty.ts
|
|
40764
|
-
import { existsSync as
|
|
40773
|
+
import { existsSync as existsSync84 } from "fs";
|
|
40765
40774
|
import * as pty from "node-pty";
|
|
40766
40775
|
|
|
40767
40776
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
40768
|
-
import { chmodSync, existsSync as
|
|
40777
|
+
import { chmodSync, existsSync as existsSync83, statSync as statSync13 } from "fs";
|
|
40769
40778
|
import { createRequire as createRequire3 } from "module";
|
|
40770
40779
|
import path102 from "path";
|
|
40771
40780
|
var require4 = createRequire3(import.meta.url);
|
|
@@ -40780,7 +40789,7 @@ function ensureSpawnHelperExecutable() {
|
|
|
40780
40789
|
`${process.platform}-${process.arch}`,
|
|
40781
40790
|
"spawn-helper"
|
|
40782
40791
|
);
|
|
40783
|
-
if (!
|
|
40792
|
+
if (!existsSync83(helper)) return;
|
|
40784
40793
|
const mode = statSync13(helper).mode;
|
|
40785
40794
|
if ((mode & 73) === 0) chmodSync(helper, mode | 493);
|
|
40786
40795
|
}
|
|
@@ -40816,7 +40825,7 @@ function spawnPty(args, cwd, sessionId, extraEnv) {
|
|
|
40816
40825
|
});
|
|
40817
40826
|
}
|
|
40818
40827
|
function refuseMissingCwd(cwd, sessionId) {
|
|
40819
|
-
if (!cwd ||
|
|
40828
|
+
if (!cwd || existsSync84(cwd)) return;
|
|
40820
40829
|
daemonLog(
|
|
40821
40830
|
`${sessionId ? `session ${sessionId}` : "pty"} not spawned: working directory ${cwd} no longer exists`
|
|
40822
40831
|
);
|
|
@@ -41009,11 +41018,11 @@ function setStatus2(session, newStatus) {
|
|
|
41009
41018
|
}
|
|
41010
41019
|
|
|
41011
41020
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
41012
|
-
import { existsSync as
|
|
41021
|
+
import { existsSync as existsSync86 } from "fs";
|
|
41013
41022
|
import { basename as basename27 } from "path";
|
|
41014
41023
|
|
|
41015
41024
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
41016
|
-
import { existsSync as
|
|
41025
|
+
import { existsSync as existsSync85 } from "fs";
|
|
41017
41026
|
import { join as join99 } from "path";
|
|
41018
41027
|
|
|
41019
41028
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
@@ -41083,7 +41092,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
41083
41092
|
);
|
|
41084
41093
|
}
|
|
41085
41094
|
function strandedReason(worktreePath, cause) {
|
|
41086
|
-
if (!
|
|
41095
|
+
if (!existsSync85(join99(worktreePath, ".git")))
|
|
41087
41096
|
return "its .git link is already gone";
|
|
41088
41097
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
41089
41098
|
return "git no longer recognises it as a working tree";
|
|
@@ -41135,7 +41144,7 @@ function reason3(error) {
|
|
|
41135
41144
|
|
|
41136
41145
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
41137
41146
|
async function reapWorktree(worktreePath, force = false) {
|
|
41138
|
-
if (!
|
|
41147
|
+
if (!existsSync86(worktreePath)) {
|
|
41139
41148
|
forgetWorktree(worktreePath);
|
|
41140
41149
|
daemonLog(
|
|
41141
41150
|
`worktree ${worktreePath} already gone; its record was forgotten`
|
|
@@ -41160,7 +41169,7 @@ async function reapWorktree(worktreePath, force = false) {
|
|
|
41160
41169
|
}
|
|
41161
41170
|
function owningClone(worktreePath) {
|
|
41162
41171
|
const recorded = worktreeAttributionIncludingReaped(worktreePath)?.clone;
|
|
41163
|
-
if (recorded &&
|
|
41172
|
+
if (recorded && existsSync86(recorded)) return recorded;
|
|
41164
41173
|
const detected = mainWorktree(worktreePath);
|
|
41165
41174
|
if (detected) return detected;
|
|
41166
41175
|
daemonLog(
|
|
@@ -41374,12 +41383,12 @@ async function closeBlockReason(sessionId, tree) {
|
|
|
41374
41383
|
}
|
|
41375
41384
|
|
|
41376
41385
|
// src/commands/sessions/daemon/worktree/watchGitState.ts
|
|
41377
|
-
import { existsSync as
|
|
41386
|
+
import { existsSync as existsSync87, watch } from "fs";
|
|
41378
41387
|
var DEBOUNCE_MS = 500;
|
|
41379
41388
|
var POLL_MS = 3e4;
|
|
41380
41389
|
function watchGitState(cwd, onChange) {
|
|
41381
41390
|
const common = gitCommonDir(cwd);
|
|
41382
|
-
if (!common || !
|
|
41391
|
+
if (!common || !existsSync87(common)) return void 0;
|
|
41383
41392
|
const watchers = [
|
|
41384
41393
|
watchGitDir(common, onChange),
|
|
41385
41394
|
pollGitState(cwd, onChange)
|
|
@@ -41908,10 +41917,10 @@ function emitSessionOutput(session, clients, data) {
|
|
|
41908
41917
|
}
|
|
41909
41918
|
|
|
41910
41919
|
// src/commands/sessions/daemon/exitReason.ts
|
|
41911
|
-
import { existsSync as
|
|
41920
|
+
import { existsSync as existsSync88 } from "fs";
|
|
41912
41921
|
import { resolve as resolve25 } from "path";
|
|
41913
41922
|
function exitDetail(session) {
|
|
41914
|
-
if (session.cwd && !
|
|
41923
|
+
if (session.cwd && !existsSync88(session.cwd))
|
|
41915
41924
|
return `working directory ${session.cwd} no longer exists`;
|
|
41916
41925
|
return missingRunConfigCwd(session);
|
|
41917
41926
|
}
|
|
@@ -41925,7 +41934,7 @@ function missingRunConfigCwd(session) {
|
|
|
41925
41934
|
const config = resolveRunConfig(session.runName, dir);
|
|
41926
41935
|
if (!config?.cwd) return void 0;
|
|
41927
41936
|
const configured = resolve25(runConfigBaseDirFrom(dir), config.cwd);
|
|
41928
|
-
if (
|
|
41937
|
+
if (existsSync88(configured)) return void 0;
|
|
41929
41938
|
return `run config "${config.name}": cwd ${configured} does not exist`;
|
|
41930
41939
|
}
|
|
41931
41940
|
|
|
@@ -41973,7 +41982,7 @@ function handleRefusedRun(session, exitCode, onStatusChange) {
|
|
|
41973
41982
|
}
|
|
41974
41983
|
|
|
41975
41984
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
41976
|
-
import { existsSync as
|
|
41985
|
+
import { existsSync as existsSync89, mkdirSync as mkdirSync34, watch as watch2 } from "fs";
|
|
41977
41986
|
import { dirname as dirname41 } from "path";
|
|
41978
41987
|
|
|
41979
41988
|
// src/commands/sessions/daemon/applyActivityToSession.ts
|
|
@@ -42059,7 +42068,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
42059
42068
|
if (timer) clearTimeout(timer);
|
|
42060
42069
|
timer = setTimeout(read3, DEBOUNCE_MS2);
|
|
42061
42070
|
});
|
|
42062
|
-
if (
|
|
42071
|
+
if (existsSync89(path106)) read3();
|
|
42063
42072
|
}
|
|
42064
42073
|
function refreshActivity(session) {
|
|
42065
42074
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -43880,7 +43889,7 @@ function rearmStoppedSessions(sessions, notify2) {
|
|
|
43880
43889
|
}
|
|
43881
43890
|
|
|
43882
43891
|
// src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
|
|
43883
|
-
import { existsSync as
|
|
43892
|
+
import { existsSync as existsSync92 } from "fs";
|
|
43884
43893
|
import { basename as basename29 } from "path";
|
|
43885
43894
|
|
|
43886
43895
|
// src/commands/sessions/daemon/worktree/accountedTrees.ts
|
|
@@ -43935,9 +43944,9 @@ function bindResumedWorktree(session, cwd, notify2) {
|
|
|
43935
43944
|
}
|
|
43936
43945
|
|
|
43937
43946
|
// src/commands/sessions/daemon/worktree/reclaimVanishedWorktrees.ts
|
|
43938
|
-
import { existsSync as
|
|
43947
|
+
import { existsSync as existsSync91 } from "fs";
|
|
43939
43948
|
async function reclaimVanishedWorktrees(clone, paths) {
|
|
43940
|
-
if (!
|
|
43949
|
+
if (!existsSync91(clone)) {
|
|
43941
43950
|
for (const { path: path106 } of paths) forgetWorktree(path106);
|
|
43942
43951
|
daemonLog(
|
|
43943
43952
|
`clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
|
|
@@ -44103,7 +44112,7 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
|
44103
44112
|
);
|
|
44104
44113
|
continue;
|
|
44105
44114
|
}
|
|
44106
|
-
if (!
|
|
44115
|
+
if (!existsSync92(path106)) {
|
|
44107
44116
|
logVanishedTree(sessions, path106);
|
|
44108
44117
|
vanished.set(clone, [
|
|
44109
44118
|
...vanished.get(clone) ?? [],
|
|
@@ -45689,7 +45698,7 @@ function setAutoAdvance(sessions, id, enabled) {
|
|
|
45689
45698
|
}
|
|
45690
45699
|
|
|
45691
45700
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
45692
|
-
import { existsSync as
|
|
45701
|
+
import { existsSync as existsSync95 } from "fs";
|
|
45693
45702
|
|
|
45694
45703
|
// src/commands/sessions/daemon/resumeSession.ts
|
|
45695
45704
|
function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
@@ -45720,10 +45729,10 @@ function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
|
45720
45729
|
}
|
|
45721
45730
|
|
|
45722
45731
|
// src/commands/sessions/daemon/worktree/resumeInReplacementTree.ts
|
|
45723
|
-
import { existsSync as
|
|
45732
|
+
import { existsSync as existsSync94 } from "fs";
|
|
45724
45733
|
|
|
45725
45734
|
// src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
|
|
45726
|
-
import { copyFileSync as copyFileSync5, existsSync as
|
|
45735
|
+
import { copyFileSync as copyFileSync5, existsSync as existsSync93, mkdirSync as mkdirSync36 } from "fs";
|
|
45727
45736
|
import { join as join101 } from "path";
|
|
45728
45737
|
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
45729
45738
|
const dir = projectDirForCwd(toCwd);
|
|
@@ -45734,7 +45743,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
45734
45743
|
return;
|
|
45735
45744
|
}
|
|
45736
45745
|
const dest = join101(dir, `${claudeSessionId}.jsonl`);
|
|
45737
|
-
if (
|
|
45746
|
+
if (existsSync93(dest)) {
|
|
45738
45747
|
daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
|
|
45739
45748
|
return;
|
|
45740
45749
|
}
|
|
@@ -45785,7 +45794,7 @@ function resumeInReplacementTree(ctx, claudeSessionId, missingCwd, name, harness
|
|
|
45785
45794
|
}
|
|
45786
45795
|
function cloneForReapedTree(missingCwd) {
|
|
45787
45796
|
const clone = worktreeAttributionIncludingReaped(missingCwd)?.clone;
|
|
45788
|
-
if (!clone || !
|
|
45797
|
+
if (!clone || !existsSync94(clone))
|
|
45789
45798
|
throw new Error(
|
|
45790
45799
|
`working directory no longer exists and no clone is recorded to re-allocate from: ${missingCwd}`
|
|
45791
45800
|
);
|
|
@@ -45794,7 +45803,7 @@ function cloneForReapedTree(missingCwd) {
|
|
|
45794
45803
|
|
|
45795
45804
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
45796
45805
|
function resumeInTree(ctx, sessionId, cwd, name, harness) {
|
|
45797
|
-
if (!
|
|
45806
|
+
if (!existsSync95(cwd))
|
|
45798
45807
|
return resumeInReplacementTree(ctx, sessionId, cwd, name, harness);
|
|
45799
45808
|
const id = ctx.spawnWith(
|
|
45800
45809
|
(sid) => resumeSession(sid, sessionId, cwd, name, void 0, harness)
|