@staff0rd/assist 0.873.1 → 0.874.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/commands/extension/extension/content.js +27 -27
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +300 -295
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.874.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -12703,6 +12703,14 @@ function isAllowedPrArgs(args) {
|
|
|
12703
12703
|
);
|
|
12704
12704
|
}
|
|
12705
12705
|
|
|
12706
|
+
// src/commands/sessions/web/fromGithub/findCloneByOrigin.ts
|
|
12707
|
+
import { existsSync as existsSync35, readdirSync as readdirSync5 } from "fs";
|
|
12708
|
+
import { join as join40 } from "path";
|
|
12709
|
+
function findCloneByOrigin(origin, baseDir) {
|
|
12710
|
+
if (!existsSync35(baseDir)) return void 0;
|
|
12711
|
+
return readdirSync5(baseDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => join40(baseDir, entry.name)).filter((dir) => existsSync35(join40(dir, ".git"))).sort().find((dir) => getCurrentOrigin(dir) === origin);
|
|
12712
|
+
}
|
|
12713
|
+
|
|
12706
12714
|
// src/commands/sessions/web/fromGithub/parseGithubOrigin.ts
|
|
12707
12715
|
function parseGithubOrigin(url) {
|
|
12708
12716
|
let parsed;
|
|
@@ -12728,11 +12736,8 @@ function resolveGithubClone(url, baseDir, redirects = {}) {
|
|
|
12728
12736
|
return { ok: false, status: 400, error: `Not a GitHub repo URL: ${url}` };
|
|
12729
12737
|
const repo = origin.replace("github.com/", "");
|
|
12730
12738
|
const target = redirects[repo] ?? repo;
|
|
12731
|
-
const
|
|
12732
|
-
|
|
12733
|
-
void 0,
|
|
12734
|
-
baseDir
|
|
12735
|
-
);
|
|
12739
|
+
const targetOrigin = `github.com/${target}`;
|
|
12740
|
+
const cwd = resolveRepoLocation(targetOrigin, void 0, baseDir).cwd ?? findCloneByOrigin(targetOrigin, baseDir);
|
|
12736
12741
|
if (!cwd)
|
|
12737
12742
|
return {
|
|
12738
12743
|
ok: false,
|
|
@@ -14075,18 +14080,18 @@ function handleServerRuns(req, res) {
|
|
|
14075
14080
|
import { execFile as execFile6 } from "child_process";
|
|
14076
14081
|
import { readFileSync as readFileSync23 } from "fs";
|
|
14077
14082
|
import { homedir as homedir15 } from "os";
|
|
14078
|
-
import { basename as basename12, join as
|
|
14083
|
+
import { basename as basename12, join as join42 } from "path";
|
|
14079
14084
|
import { promisify as promisify5 } from "util";
|
|
14080
14085
|
|
|
14081
14086
|
// src/commands/sessions/web/findSynthesisForBranch.ts
|
|
14082
|
-
import { existsSync as
|
|
14083
|
-
import { basename as basename11, dirname as dirname21, join as
|
|
14087
|
+
import { existsSync as existsSync36, readdirSync as readdirSync6, statSync as statSync5 } from "fs";
|
|
14088
|
+
import { basename as basename11, dirname as dirname21, join as join41 } from "path";
|
|
14084
14089
|
function findSynthesisForBranch(repoReviewsDir, branch2) {
|
|
14085
|
-
const branchKeyPath =
|
|
14090
|
+
const branchKeyPath = join41(repoReviewsDir, `${branch2}-`);
|
|
14086
14091
|
const parent = dirname21(branchKeyPath);
|
|
14087
14092
|
const branchPrefix = basename11(branchKeyPath);
|
|
14088
|
-
if (!
|
|
14089
|
-
const synthesisFiles =
|
|
14093
|
+
if (!existsSync36(parent)) return null;
|
|
14094
|
+
const synthesisFiles = readdirSync6(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join41(parent, name, "synthesis.md")).filter((path109) => existsSync36(path109)).map((path109) => ({ path: path109, mtime: statSync5(path109).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
|
|
14090
14095
|
return synthesisFiles[0]?.path ?? null;
|
|
14091
14096
|
}
|
|
14092
14097
|
|
|
@@ -14104,7 +14109,7 @@ async function resolveSynthesisPath(cwd) {
|
|
|
14104
14109
|
runGit2(cwd, ["rev-parse", "--show-toplevel"]),
|
|
14105
14110
|
runGit2(cwd, ["rev-parse", "--abbrev-ref", "HEAD"])
|
|
14106
14111
|
]);
|
|
14107
|
-
const repoReviewsDir =
|
|
14112
|
+
const repoReviewsDir = join42(
|
|
14108
14113
|
homedir15(),
|
|
14109
14114
|
".assist",
|
|
14110
14115
|
"reviews",
|
|
@@ -15476,7 +15481,7 @@ async function nextPickup(req, res) {
|
|
|
15476
15481
|
import path29 from "path";
|
|
15477
15482
|
|
|
15478
15483
|
// src/commands/rules/readScopedRules.ts
|
|
15479
|
-
import { existsSync as
|
|
15484
|
+
import { existsSync as existsSync38, readFileSync as readFileSync24 } from "fs";
|
|
15480
15485
|
import path28 from "path";
|
|
15481
15486
|
|
|
15482
15487
|
// src/commands/rules/rulesSectionRange.ts
|
|
@@ -15525,11 +15530,11 @@ function parseRulesSection(content) {
|
|
|
15525
15530
|
}
|
|
15526
15531
|
|
|
15527
15532
|
// src/commands/rules/scopeDirectory.ts
|
|
15528
|
-
import { existsSync as
|
|
15533
|
+
import { existsSync as existsSync37, statSync as statSync6 } from "fs";
|
|
15529
15534
|
import path27 from "path";
|
|
15530
15535
|
function scopeDirectory(target) {
|
|
15531
15536
|
const resolved = path27.resolve(target);
|
|
15532
|
-
return
|
|
15537
|
+
return existsSync37(resolved) && statSync6(resolved).isDirectory() ? resolved : path27.dirname(resolved);
|
|
15533
15538
|
}
|
|
15534
15539
|
|
|
15535
15540
|
// src/commands/rules/readScopedRules.ts
|
|
@@ -15540,7 +15545,7 @@ function scopedClaudeFiles(target) {
|
|
|
15540
15545
|
let current = startDir;
|
|
15541
15546
|
while (true) {
|
|
15542
15547
|
const candidate = path28.join(current, "CLAUDE.md");
|
|
15543
|
-
if (
|
|
15548
|
+
if (existsSync38(candidate)) files.push(candidate);
|
|
15544
15549
|
if (current === root2 || current === path28.dirname(current)) break;
|
|
15545
15550
|
current = path28.dirname(current);
|
|
15546
15551
|
}
|
|
@@ -16877,19 +16882,19 @@ async function revertDiffFile(req, res) {
|
|
|
16877
16882
|
|
|
16878
16883
|
// src/commands/run/runCommandToCompletion.ts
|
|
16879
16884
|
import { spawn as spawn4 } from "child_process";
|
|
16880
|
-
import { existsSync as
|
|
16885
|
+
import { existsSync as existsSync40 } from "fs";
|
|
16881
16886
|
|
|
16882
16887
|
// src/commands/run/resolveCommand.ts
|
|
16883
16888
|
import { execFileSync as execFileSync5 } from "child_process";
|
|
16884
|
-
import { existsSync as
|
|
16885
|
-
import { dirname as dirname22, join as
|
|
16889
|
+
import { existsSync as existsSync39 } from "fs";
|
|
16890
|
+
import { dirname as dirname22, join as join43, resolve as resolve14 } from "path";
|
|
16886
16891
|
function resolveCommand(command) {
|
|
16887
16892
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
16888
16893
|
try {
|
|
16889
16894
|
const gitPath = execFileSync5("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
16890
16895
|
const gitRoot = resolve14(dirname22(gitPath), "..");
|
|
16891
|
-
const gitBash =
|
|
16892
|
-
if (
|
|
16896
|
+
const gitBash = join43(gitRoot, "bin", "bash.exe");
|
|
16897
|
+
if (existsSync39(gitBash)) return gitBash;
|
|
16893
16898
|
} catch {
|
|
16894
16899
|
return command;
|
|
16895
16900
|
}
|
|
@@ -16899,7 +16904,7 @@ function resolveCommand(command) {
|
|
|
16899
16904
|
// src/commands/run/runCommandToCompletion.ts
|
|
16900
16905
|
function runCommandToCompletion(command, args, env, cwd, quiet) {
|
|
16901
16906
|
return new Promise((resolveResult) => {
|
|
16902
|
-
if (cwd && !
|
|
16907
|
+
if (cwd && !existsSync40(cwd)) {
|
|
16903
16908
|
resolveResult({
|
|
16904
16909
|
kind: "failed",
|
|
16905
16910
|
message: `Failed to execute command: cwd ${cwd} does not exist`
|
|
@@ -18066,11 +18071,11 @@ function changedPaths(from, cwd) {
|
|
|
18066
18071
|
}
|
|
18067
18072
|
|
|
18068
18073
|
// src/commands/watch/readBuiltVersion.ts
|
|
18069
|
-
import { join as
|
|
18074
|
+
import { join as join44 } from "path";
|
|
18070
18075
|
function readBuiltVersion(cwd) {
|
|
18071
18076
|
try {
|
|
18072
18077
|
const root2 = runGit3(["rev-parse", "--show-toplevel"], cwd);
|
|
18073
|
-
return readPackageJson(
|
|
18078
|
+
return readPackageJson(join44(root2, "package.json")).version ?? "unknown";
|
|
18074
18079
|
} catch {
|
|
18075
18080
|
return "unknown";
|
|
18076
18081
|
}
|
|
@@ -18123,7 +18128,7 @@ function stripAnsi(text18) {
|
|
|
18123
18128
|
// src/commands/sessions/daemon/worktree/watcherLogPath.ts
|
|
18124
18129
|
import { createHash } from "crypto";
|
|
18125
18130
|
import { homedir as homedir16 } from "os";
|
|
18126
|
-
import { basename as basename13, join as
|
|
18131
|
+
import { basename as basename13, join as join45 } from "path";
|
|
18127
18132
|
|
|
18128
18133
|
// src/commands/sessions/daemon/worktree/canonicalTreePath.ts
|
|
18129
18134
|
import { realpathSync as realpathSync2 } from "fs";
|
|
@@ -18140,8 +18145,8 @@ function canonicalTreePath(path109) {
|
|
|
18140
18145
|
function watcherLogPath(cwd) {
|
|
18141
18146
|
const clone = canonicalTreePath(cwd);
|
|
18142
18147
|
const key = createHash("sha1").update(clone).digest("hex").slice(0, 8);
|
|
18143
|
-
const dir = process.env.ASSIST_WATCHER_LOG_DIR ??
|
|
18144
|
-
return
|
|
18148
|
+
const dir = process.env.ASSIST_WATCHER_LOG_DIR ?? join45(homedir16(), ".assist", "watchers");
|
|
18149
|
+
return join45(dir, `${basename13(clone) || "root"}-${key}.log`);
|
|
18145
18150
|
}
|
|
18146
18151
|
|
|
18147
18152
|
// src/commands/sessions/web/updates/readUpdateHistory.ts
|
|
@@ -18256,7 +18261,7 @@ async function readRequestBuffer(req, limit) {
|
|
|
18256
18261
|
|
|
18257
18262
|
// src/commands/sessions/web/stageAttachment.ts
|
|
18258
18263
|
import { mkdir as mkdir4, mkdtemp, writeFile as writeFile2 } from "fs/promises";
|
|
18259
|
-
import { extname as extname2, join as
|
|
18264
|
+
import { extname as extname2, join as join46 } from "path";
|
|
18260
18265
|
|
|
18261
18266
|
// src/commands/sessions/web/ghAttachableExtensions.ts
|
|
18262
18267
|
var ghAttachableExtensions = /* @__PURE__ */ new Set([
|
|
@@ -18288,9 +18293,9 @@ function safeBaseName(name) {
|
|
|
18288
18293
|
async function stageAttachment(name, contentType, body) {
|
|
18289
18294
|
const ext = pickExtension(name, contentType);
|
|
18290
18295
|
await mkdir4(stagedAttachmentsDir, { recursive: true });
|
|
18291
|
-
const dir = await mkdtemp(
|
|
18296
|
+
const dir = await mkdtemp(join46(stagedAttachmentsDir, "upload-"));
|
|
18292
18297
|
const alt = safeBaseName(name);
|
|
18293
|
-
const filePath =
|
|
18298
|
+
const filePath = join46(dir, `${alt}.${ext}`);
|
|
18294
18299
|
await writeFile2(filePath, body);
|
|
18295
18300
|
return { dir, filePath, alt };
|
|
18296
18301
|
}
|
|
@@ -18339,16 +18344,16 @@ import { readFile as readFile3, stat as stat4, writeFile as writeFile3 } from "f
|
|
|
18339
18344
|
|
|
18340
18345
|
// src/commands/sessions/web/formatWithOxfmt.ts
|
|
18341
18346
|
import { execFile as execFile11 } from "child_process";
|
|
18342
|
-
import { existsSync as
|
|
18343
|
-
import { dirname as dirname24, join as
|
|
18347
|
+
import { existsSync as existsSync41 } from "fs";
|
|
18348
|
+
import { dirname as dirname24, join as join47 } from "path";
|
|
18344
18349
|
import { promisify as promisify11 } from "util";
|
|
18345
18350
|
var execFileAsync10 = promisify11(execFile11);
|
|
18346
18351
|
var TIMEOUT_MS = 15e3;
|
|
18347
18352
|
function findOxfmtScript(root2) {
|
|
18348
18353
|
let dir = root2;
|
|
18349
18354
|
for (; ; ) {
|
|
18350
|
-
const candidate =
|
|
18351
|
-
if (
|
|
18355
|
+
const candidate = join47(dir, "node_modules", "oxfmt", "bin", "oxfmt");
|
|
18356
|
+
if (existsSync41(candidate)) return candidate;
|
|
18352
18357
|
const parent = dirname24(dir);
|
|
18353
18358
|
if (parent === dir) return void 0;
|
|
18354
18359
|
dir = parent;
|
|
@@ -18420,10 +18425,10 @@ async function writeFileContent(req, res) {
|
|
|
18420
18425
|
// src/shared/createBundleHandler.ts
|
|
18421
18426
|
import { createHash as createHash2 } from "crypto";
|
|
18422
18427
|
import { readFileSync as readFileSync25, statSync as statSync7 } from "fs";
|
|
18423
|
-
import { dirname as dirname25, join as
|
|
18428
|
+
import { dirname as dirname25, join as join48 } from "path";
|
|
18424
18429
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
18425
18430
|
function createBundleHandler(importMetaUrl, bundlePath, contentType = "application/javascript") {
|
|
18426
|
-
const file =
|
|
18431
|
+
const file = join48(dirname25(fileURLToPath4(importMetaUrl)), bundlePath);
|
|
18427
18432
|
let cache6;
|
|
18428
18433
|
return (req, res) => {
|
|
18429
18434
|
const mtimeMs = statSync7(file).mtimeMs;
|
|
@@ -18849,9 +18854,9 @@ function originForCwd(cwd) {
|
|
|
18849
18854
|
}
|
|
18850
18855
|
|
|
18851
18856
|
// src/commands/sessions/daemon/repoDirExists.ts
|
|
18852
|
-
import { existsSync as
|
|
18857
|
+
import { existsSync as existsSync42 } from "fs";
|
|
18853
18858
|
function repoDirExists(cwd) {
|
|
18854
|
-
return
|
|
18859
|
+
return existsSync42(cwd);
|
|
18855
18860
|
}
|
|
18856
18861
|
|
|
18857
18862
|
// src/commands/sessions/daemon/worktree/listWorktreePaths.ts
|
|
@@ -20034,7 +20039,7 @@ function extractGraphqlQuery(args) {
|
|
|
20034
20039
|
}
|
|
20035
20040
|
|
|
20036
20041
|
// src/shared/loadCliReads.ts
|
|
20037
|
-
import { existsSync as
|
|
20042
|
+
import { existsSync as existsSync43, readFileSync as readFileSync28, writeFileSync as writeFileSync23 } from "fs";
|
|
20038
20043
|
import { dirname as dirname26, resolve as resolve16 } from "path";
|
|
20039
20044
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
20040
20045
|
var __filename3 = fileURLToPath5(import.meta.url);
|
|
@@ -20043,7 +20048,7 @@ function packageRoot() {
|
|
|
20043
20048
|
return __dirname4;
|
|
20044
20049
|
}
|
|
20045
20050
|
function readLines(path109) {
|
|
20046
|
-
if (!
|
|
20051
|
+
if (!existsSync43(path109)) return [];
|
|
20047
20052
|
return readFileSync28(path109, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
20048
20053
|
}
|
|
20049
20054
|
var cachedReads;
|
|
@@ -20090,14 +20095,14 @@ function findCliWrite(command) {
|
|
|
20090
20095
|
}
|
|
20091
20096
|
|
|
20092
20097
|
// src/shared/readSettingsPerms.ts
|
|
20093
|
-
import { existsSync as
|
|
20098
|
+
import { existsSync as existsSync44, readFileSync as readFileSync29 } from "fs";
|
|
20094
20099
|
import { homedir as homedir17 } from "os";
|
|
20095
|
-
import { join as
|
|
20100
|
+
import { join as join49 } from "path";
|
|
20096
20101
|
function readSettingsPerms(key) {
|
|
20097
20102
|
const paths = [
|
|
20098
|
-
|
|
20099
|
-
|
|
20100
|
-
|
|
20103
|
+
join49(homedir17(), ".claude", "settings.json"),
|
|
20104
|
+
join49(process.cwd(), ".claude", "settings.json"),
|
|
20105
|
+
join49(process.cwd(), ".claude", "settings.local.json")
|
|
20101
20106
|
];
|
|
20102
20107
|
const entries = [];
|
|
20103
20108
|
for (const p of paths) {
|
|
@@ -20106,7 +20111,7 @@ function readSettingsPerms(key) {
|
|
|
20106
20111
|
return entries;
|
|
20107
20112
|
}
|
|
20108
20113
|
function readPermissionArray(filePath, key) {
|
|
20109
|
-
if (!
|
|
20114
|
+
if (!existsSync44(filePath)) return [];
|
|
20110
20115
|
try {
|
|
20111
20116
|
const data = JSON.parse(readFileSync29(filePath, "utf8"));
|
|
20112
20117
|
const arr = data?.permissions?.[key];
|
|
@@ -20321,11 +20326,11 @@ function decideCommand(toolName, rawCommand) {
|
|
|
20321
20326
|
// src/commands/cliHook/logDeniedToolCall.ts
|
|
20322
20327
|
import { mkdirSync as mkdirSync13 } from "fs";
|
|
20323
20328
|
import { homedir as homedir18 } from "os";
|
|
20324
|
-
import { join as
|
|
20329
|
+
import { join as join50 } from "path";
|
|
20325
20330
|
import Database from "better-sqlite3";
|
|
20326
20331
|
var _db;
|
|
20327
20332
|
function getDbDir() {
|
|
20328
|
-
return
|
|
20333
|
+
return join50(homedir18(), ".assist");
|
|
20329
20334
|
}
|
|
20330
20335
|
function initSchema(db) {
|
|
20331
20336
|
db.exec(`
|
|
@@ -20344,7 +20349,7 @@ function openPromptsDb(dir) {
|
|
|
20344
20349
|
if (_db) return _db;
|
|
20345
20350
|
const dbDir = dir ?? getDbDir();
|
|
20346
20351
|
mkdirSync13(dbDir, { recursive: true });
|
|
20347
|
-
const db = new Database(
|
|
20352
|
+
const db = new Database(join50(dbDir, "assist.db"));
|
|
20348
20353
|
db.pragma("journal_mode = WAL");
|
|
20349
20354
|
initSchema(db);
|
|
20350
20355
|
_db = db;
|
|
@@ -20463,9 +20468,9 @@ ${reasons.join("\n")}`);
|
|
|
20463
20468
|
}
|
|
20464
20469
|
|
|
20465
20470
|
// src/commands/permitCliReads.ts
|
|
20466
|
-
import { existsSync as
|
|
20471
|
+
import { existsSync as existsSync45, mkdirSync as mkdirSync14, readFileSync as readFileSync30, writeFileSync as writeFileSync24 } from "fs";
|
|
20467
20472
|
import { homedir as homedir19 } from "os";
|
|
20468
|
-
import { join as
|
|
20473
|
+
import { join as join51 } from "path";
|
|
20469
20474
|
|
|
20470
20475
|
// src/commands/permitCliReads/assertCliExists.ts
|
|
20471
20476
|
function assertCliExists(cli) {
|
|
@@ -20728,15 +20733,15 @@ function updateSettings(cli, commands) {
|
|
|
20728
20733
|
// src/commands/permitCliReads.ts
|
|
20729
20734
|
function logPath(cli) {
|
|
20730
20735
|
const safeName = cli.replace(/\s+/g, "-");
|
|
20731
|
-
return
|
|
20736
|
+
return join51(homedir19(), ".assist", `cli-discover-${safeName}.log`);
|
|
20732
20737
|
}
|
|
20733
20738
|
function readCache(cli) {
|
|
20734
20739
|
const path109 = logPath(cli);
|
|
20735
|
-
if (!
|
|
20740
|
+
if (!existsSync45(path109)) return void 0;
|
|
20736
20741
|
return readFileSync30(path109, "utf8");
|
|
20737
20742
|
}
|
|
20738
20743
|
function writeCache(cli, output) {
|
|
20739
|
-
const dir =
|
|
20744
|
+
const dir = join51(homedir19(), ".assist");
|
|
20740
20745
|
mkdirSync14(dir, { recursive: true });
|
|
20741
20746
|
writeFileSync24(logPath(cli), output);
|
|
20742
20747
|
}
|
|
@@ -20867,7 +20872,7 @@ function registerCliHook(program2) {
|
|
|
20867
20872
|
}
|
|
20868
20873
|
|
|
20869
20874
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
20870
|
-
import { existsSync as
|
|
20875
|
+
import { existsSync as existsSync47, readFileSync as readFileSync32, unlinkSync as unlinkSync8, writeFileSync as writeFileSync25 } from "fs";
|
|
20871
20876
|
import chalk122 from "chalk";
|
|
20872
20877
|
|
|
20873
20878
|
// src/shared/isHashCommentFile.ts
|
|
@@ -20901,28 +20906,28 @@ function isHashCommentFile(filePath) {
|
|
|
20901
20906
|
|
|
20902
20907
|
// src/commands/codeComment/getRestrictedDir.ts
|
|
20903
20908
|
import { homedir as homedir20 } from "os";
|
|
20904
|
-
import { join as
|
|
20909
|
+
import { join as join52 } from "path";
|
|
20905
20910
|
function getRestrictedDir() {
|
|
20906
|
-
return
|
|
20911
|
+
return join52(homedir20(), ".assist", "restricted");
|
|
20907
20912
|
}
|
|
20908
20913
|
function getPinStatePath(pin2) {
|
|
20909
|
-
return
|
|
20914
|
+
return join52(getRestrictedDir(), `code-comment-${pin2}.json`);
|
|
20910
20915
|
}
|
|
20911
20916
|
|
|
20912
20917
|
// src/commands/codeComment/sweepRestrictedDir.ts
|
|
20913
|
-
import { readdirSync as
|
|
20914
|
-
import { join as
|
|
20918
|
+
import { readdirSync as readdirSync7, statSync as statSync8, unlinkSync as unlinkSync7 } from "fs";
|
|
20919
|
+
import { join as join53 } from "path";
|
|
20915
20920
|
var STALE_AFTER_MS = 30 * 60 * 1e3;
|
|
20916
20921
|
function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
20917
20922
|
let entries;
|
|
20918
20923
|
try {
|
|
20919
|
-
entries =
|
|
20924
|
+
entries = readdirSync7(dir);
|
|
20920
20925
|
} catch {
|
|
20921
20926
|
return;
|
|
20922
20927
|
}
|
|
20923
20928
|
const cutoff = Date.now() - STALE_AFTER_MS;
|
|
20924
20929
|
for (const entry of entries) {
|
|
20925
|
-
const path109 =
|
|
20930
|
+
const path109 = join53(dir, entry);
|
|
20926
20931
|
try {
|
|
20927
20932
|
if (statSync8(path109).mtimeMs < cutoff) unlinkSync7(path109);
|
|
20928
20933
|
} catch {
|
|
@@ -20932,10 +20937,10 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
20932
20937
|
}
|
|
20933
20938
|
|
|
20934
20939
|
// src/commands/codeComment/readPinState.ts
|
|
20935
|
-
import { existsSync as
|
|
20940
|
+
import { existsSync as existsSync46, readFileSync as readFileSync31 } from "fs";
|
|
20936
20941
|
function readPinState(pin2) {
|
|
20937
20942
|
const path109 = getPinStatePath(pin2);
|
|
20938
|
-
if (!
|
|
20943
|
+
if (!existsSync46(path109)) return void 0;
|
|
20939
20944
|
try {
|
|
20940
20945
|
const state = JSON.parse(readFileSync31(path109, "utf8"));
|
|
20941
20946
|
if (state.pin !== pin2) return void 0;
|
|
@@ -20954,7 +20959,7 @@ function codeCommentConfirm(pin2) {
|
|
|
20954
20959
|
process.exitCode = 1;
|
|
20955
20960
|
return;
|
|
20956
20961
|
}
|
|
20957
|
-
if (!
|
|
20962
|
+
if (!existsSync47(state.file)) {
|
|
20958
20963
|
console.error(chalk122.red(`Target file no longer exists: ${state.file}`));
|
|
20959
20964
|
process.exitCode = 1;
|
|
20960
20965
|
return;
|
|
@@ -22679,14 +22684,14 @@ import { cp } from "fs/promises";
|
|
|
22679
22684
|
import chalk142 from "chalk";
|
|
22680
22685
|
|
|
22681
22686
|
// src/commands/extension/extensionDir.ts
|
|
22682
|
-
import { existsSync as
|
|
22683
|
-
import { dirname as dirname27, join as
|
|
22687
|
+
import { existsSync as existsSync48 } from "fs";
|
|
22688
|
+
import { dirname as dirname27, join as join54 } from "path";
|
|
22684
22689
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
22685
22690
|
var moduleDir = dirname27(fileURLToPath6(import.meta.url));
|
|
22686
22691
|
function extensionDir() {
|
|
22687
|
-
const bundled =
|
|
22688
|
-
if (
|
|
22689
|
-
return
|
|
22692
|
+
const bundled = join54(moduleDir, "commands", "extension", "extension");
|
|
22693
|
+
if (existsSync48(bundled)) return bundled;
|
|
22694
|
+
return join54(moduleDir, "..", "..", "..", "extension");
|
|
22690
22695
|
}
|
|
22691
22696
|
|
|
22692
22697
|
// src/commands/extension/extension.ts
|
|
@@ -22712,7 +22717,7 @@ async function extension() {
|
|
|
22712
22717
|
|
|
22713
22718
|
// src/commands/extension/printExtensionUrl.ts
|
|
22714
22719
|
import { readFile as readFile4 } from "fs/promises";
|
|
22715
|
-
import { join as
|
|
22720
|
+
import { join as join55 } from "path";
|
|
22716
22721
|
import chalk143 from "chalk";
|
|
22717
22722
|
|
|
22718
22723
|
// src/commands/extension/latestUpdate.ts
|
|
@@ -22729,7 +22734,7 @@ function latestUpdateLink(manifest, updates2) {
|
|
|
22729
22734
|
// src/commands/extension/printExtensionUrl.ts
|
|
22730
22735
|
async function printExtensionUrl() {
|
|
22731
22736
|
const manifest = await readFile4(
|
|
22732
|
-
|
|
22737
|
+
join55(extensionDir(), "manifest.json"),
|
|
22733
22738
|
"utf8"
|
|
22734
22739
|
);
|
|
22735
22740
|
const { update_url } = JSON.parse(manifest).browser_specific_settings.gecko;
|
|
@@ -22746,28 +22751,28 @@ async function printExtensionUrl() {
|
|
|
22746
22751
|
// src/commands/extension/signExtension.ts
|
|
22747
22752
|
import { rm as rm2 } from "fs/promises";
|
|
22748
22753
|
import { homedir as homedir21, tmpdir as tmpdir3 } from "os";
|
|
22749
|
-
import { join as
|
|
22754
|
+
import { join as join61 } from "path";
|
|
22750
22755
|
import chalk145 from "chalk";
|
|
22751
22756
|
|
|
22752
22757
|
// src/commands/extension/copySignedXpi.ts
|
|
22753
22758
|
import { copyFile } from "fs/promises";
|
|
22754
|
-
import { join as
|
|
22759
|
+
import { join as join56 } from "path";
|
|
22755
22760
|
var SIGNED_XPI_NAME = "assist-extension.xpi";
|
|
22756
22761
|
async function copySignedXpi(xpi, dir) {
|
|
22757
|
-
const fixed2 =
|
|
22762
|
+
const fixed2 = join56(dir, SIGNED_XPI_NAME);
|
|
22758
22763
|
if (fixed2 === xpi) return fixed2;
|
|
22759
22764
|
await copyFile(xpi, fixed2);
|
|
22760
22765
|
return fixed2;
|
|
22761
22766
|
}
|
|
22762
22767
|
|
|
22763
22768
|
// src/commands/extension/findSignedXpi.ts
|
|
22764
|
-
import { existsSync as
|
|
22769
|
+
import { existsSync as existsSync49 } from "fs";
|
|
22765
22770
|
import { readdir } from "fs/promises";
|
|
22766
|
-
import { join as
|
|
22771
|
+
import { join as join57 } from "path";
|
|
22767
22772
|
async function findSignedXpi(dir) {
|
|
22768
|
-
if (!
|
|
22773
|
+
if (!existsSync49(dir)) return null;
|
|
22769
22774
|
const name = (await readdir(dir)).find((entry) => entry.endsWith(".xpi"));
|
|
22770
|
-
return name ?
|
|
22775
|
+
return name ? join57(dir, name) : null;
|
|
22771
22776
|
}
|
|
22772
22777
|
|
|
22773
22778
|
// src/commands/extension/signedAddonInstallPath.ts
|
|
@@ -22789,11 +22794,11 @@ async function signedAddonInstallPath(xpi) {
|
|
|
22789
22794
|
}
|
|
22790
22795
|
|
|
22791
22796
|
// src/commands/extension/signPreflightProblem.ts
|
|
22792
|
-
import { existsSync as
|
|
22793
|
-
import { join as
|
|
22797
|
+
import { existsSync as existsSync50 } from "fs";
|
|
22798
|
+
import { join as join58 } from "path";
|
|
22794
22799
|
var KEY_URL = "https://addons.mozilla.org/en-US/developers/addon/api/key/";
|
|
22795
22800
|
function signPreflightProblem(source) {
|
|
22796
|
-
if (!
|
|
22801
|
+
if (!existsSync50(join58(source, "content.js")))
|
|
22797
22802
|
return {
|
|
22798
22803
|
message: `no content.js in ${source}`,
|
|
22799
22804
|
hint: "run npm run build to bundle the content script"
|
|
@@ -22808,7 +22813,7 @@ function signPreflightProblem(source) {
|
|
|
22808
22813
|
|
|
22809
22814
|
// src/commands/extension/stageExtension.ts
|
|
22810
22815
|
import { cp as cp3, mkdir as mkdir5, readFile as readFile5, rm, writeFile as writeFile4 } from "fs/promises";
|
|
22811
|
-
import { basename as basename15, join as
|
|
22816
|
+
import { basename as basename15, join as join59 } from "path";
|
|
22812
22817
|
|
|
22813
22818
|
// src/commands/extension/stampManifestVersion.ts
|
|
22814
22819
|
function stampManifestVersion(manifest, version2) {
|
|
@@ -22825,7 +22830,7 @@ async function stageExtension(source, staging, version2) {
|
|
|
22825
22830
|
recursive: true,
|
|
22826
22831
|
filter: (path109) => basename15(path109) !== "updates.json"
|
|
22827
22832
|
});
|
|
22828
|
-
const manifest =
|
|
22833
|
+
const manifest = join59(staging, "manifest.json");
|
|
22829
22834
|
const stamped = stampManifestVersion(
|
|
22830
22835
|
await readFile5(manifest, "utf8"),
|
|
22831
22836
|
version2
|
|
@@ -22835,7 +22840,7 @@ async function stageExtension(source, staging, version2) {
|
|
|
22835
22840
|
|
|
22836
22841
|
// src/commands/extension/writeUpdateManifest.ts
|
|
22837
22842
|
import { readFile as readFile6, writeFile as writeFile5 } from "fs/promises";
|
|
22838
|
-
import { join as
|
|
22843
|
+
import { join as join60 } from "path";
|
|
22839
22844
|
|
|
22840
22845
|
// src/commands/extension/buildUpdateManifest.ts
|
|
22841
22846
|
var RELEASE_DOWNLOAD_URL = "https://github.com/staff0rd/assist/releases/download";
|
|
@@ -22860,17 +22865,17 @@ function buildUpdateManifest(manifest, version2) {
|
|
|
22860
22865
|
// src/commands/extension/writeUpdateManifest.ts
|
|
22861
22866
|
async function writeUpdateManifest(source, dir, version2) {
|
|
22862
22867
|
await writeFile5(
|
|
22863
|
-
|
|
22868
|
+
join60(dir, "updates.json"),
|
|
22864
22869
|
buildUpdateManifest(
|
|
22865
|
-
await readFile6(
|
|
22870
|
+
await readFile6(join60(source, "manifest.json"), "utf8"),
|
|
22866
22871
|
version2
|
|
22867
22872
|
)
|
|
22868
22873
|
);
|
|
22869
22874
|
}
|
|
22870
22875
|
|
|
22871
22876
|
// src/commands/extension/signExtension.ts
|
|
22872
|
-
var ARTIFACTS_DIR =
|
|
22873
|
-
var STAGING_DIR =
|
|
22877
|
+
var ARTIFACTS_DIR = join61(homedir21(), ".assist", "extension");
|
|
22878
|
+
var STAGING_DIR = join61(tmpdir3(), "assist-extension");
|
|
22874
22879
|
async function signExtension() {
|
|
22875
22880
|
const source = extensionDir();
|
|
22876
22881
|
const problem = signPreflightProblem(source);
|
|
@@ -23058,19 +23063,19 @@ import { unlinkSync as unlinkSync9, writeFileSync as writeFileSync27 } from "fs"
|
|
|
23058
23063
|
import chalk148 from "chalk";
|
|
23059
23064
|
|
|
23060
23065
|
// src/commands/dbMigration/getMigrationPinPath.ts
|
|
23061
|
-
import { join as
|
|
23066
|
+
import { join as join62 } from "path";
|
|
23062
23067
|
function getMigrationPinPath(pin2) {
|
|
23063
|
-
return
|
|
23068
|
+
return join62(getRestrictedDir(), `db-migration-pin-${pin2}.json`);
|
|
23064
23069
|
}
|
|
23065
23070
|
function getMigrationApprovalPath(migrationId) {
|
|
23066
|
-
return
|
|
23071
|
+
return join62(getRestrictedDir(), `db-migration-approval-${migrationId}.json`);
|
|
23067
23072
|
}
|
|
23068
23073
|
|
|
23069
23074
|
// src/commands/dbMigration/readMigrationPinState.ts
|
|
23070
|
-
import { existsSync as
|
|
23075
|
+
import { existsSync as existsSync51, readFileSync as readFileSync33 } from "fs";
|
|
23071
23076
|
function readMigrationPinState(pin2) {
|
|
23072
23077
|
const path109 = getMigrationPinPath(pin2);
|
|
23073
|
-
if (!
|
|
23078
|
+
if (!existsSync51(path109)) return void 0;
|
|
23074
23079
|
try {
|
|
23075
23080
|
const state = JSON.parse(readFileSync33(path109, "utf8"));
|
|
23076
23081
|
if (state.pin !== pin2) return void 0;
|
|
@@ -23159,7 +23164,7 @@ function registerDbMigration(parent) {
|
|
|
23159
23164
|
}
|
|
23160
23165
|
|
|
23161
23166
|
// src/commands/deploy/redirect.ts
|
|
23162
|
-
import { existsSync as
|
|
23167
|
+
import { existsSync as existsSync52, readFileSync as readFileSync34, writeFileSync as writeFileSync29 } from "fs";
|
|
23163
23168
|
import chalk150 from "chalk";
|
|
23164
23169
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
23165
23170
|
if (!window.location.pathname.endsWith('/')) {
|
|
@@ -23168,7 +23173,7 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
23168
23173
|
</script>`;
|
|
23169
23174
|
function redirect() {
|
|
23170
23175
|
const indexPath = "index.html";
|
|
23171
|
-
if (!
|
|
23176
|
+
if (!existsSync52(indexPath)) {
|
|
23172
23177
|
console.log(chalk150.yellow("No index.html found"));
|
|
23173
23178
|
return;
|
|
23174
23179
|
}
|
|
@@ -23201,10 +23206,10 @@ import { basename as basename17 } from "path";
|
|
|
23201
23206
|
|
|
23202
23207
|
// src/commands/devlog/loadBlogSkipDays.ts
|
|
23203
23208
|
import { homedir as homedir22 } from "os";
|
|
23204
|
-
import { join as
|
|
23205
|
-
var BLOG_REPO_ROOT =
|
|
23209
|
+
import { join as join63 } from "path";
|
|
23210
|
+
var BLOG_REPO_ROOT = join63(homedir22(), "git/blog");
|
|
23206
23211
|
function loadBlogSkipDays(repoName) {
|
|
23207
|
-
const config = loadRawYaml(
|
|
23212
|
+
const config = loadRawYaml(join63(BLOG_REPO_ROOT, "assist.yml"));
|
|
23208
23213
|
const devlog = config.devlog;
|
|
23209
23214
|
const skip3 = devlog?.skip;
|
|
23210
23215
|
return new Set(skip3?.[repoName]);
|
|
@@ -23215,15 +23220,15 @@ import { execSync as execSync31 } from "child_process";
|
|
|
23215
23220
|
import chalk151 from "chalk";
|
|
23216
23221
|
|
|
23217
23222
|
// src/shared/getRepoName.ts
|
|
23218
|
-
import { existsSync as
|
|
23219
|
-
import { basename as basename16, join as
|
|
23223
|
+
import { existsSync as existsSync53, readFileSync as readFileSync35 } from "fs";
|
|
23224
|
+
import { basename as basename16, join as join64 } from "path";
|
|
23220
23225
|
function getRepoName() {
|
|
23221
23226
|
const config = loadConfig();
|
|
23222
23227
|
if (config.devlog?.name) {
|
|
23223
23228
|
return config.devlog.name;
|
|
23224
23229
|
}
|
|
23225
|
-
const packageJsonPath =
|
|
23226
|
-
if (
|
|
23230
|
+
const packageJsonPath = join64(process.cwd(), "package.json");
|
|
23231
|
+
if (existsSync53(packageJsonPath)) {
|
|
23227
23232
|
try {
|
|
23228
23233
|
const content = readFileSync35(packageJsonPath, "utf8");
|
|
23229
23234
|
const pkg = JSON.parse(content);
|
|
@@ -23237,9 +23242,9 @@ function getRepoName() {
|
|
|
23237
23242
|
}
|
|
23238
23243
|
|
|
23239
23244
|
// src/commands/devlog/loadDevlogEntries.ts
|
|
23240
|
-
import { readdirSync as
|
|
23241
|
-
import { join as
|
|
23242
|
-
var DEVLOG_DIR =
|
|
23245
|
+
import { readdirSync as readdirSync8, readFileSync as readFileSync36 } from "fs";
|
|
23246
|
+
import { join as join65 } from "path";
|
|
23247
|
+
var DEVLOG_DIR = join65(BLOG_REPO_ROOT, "src/content/devlog");
|
|
23243
23248
|
function extractFrontmatter(content) {
|
|
23244
23249
|
const fm = content.match(/^---\n([\s\S]*?)\n---/);
|
|
23245
23250
|
return fm?.[1] ?? null;
|
|
@@ -23265,9 +23270,9 @@ function parseFrontmatter(content, filename) {
|
|
|
23265
23270
|
}
|
|
23266
23271
|
function readDevlogFiles(callback) {
|
|
23267
23272
|
try {
|
|
23268
|
-
const files =
|
|
23273
|
+
const files = readdirSync8(DEVLOG_DIR).filter((f) => f.endsWith(".md"));
|
|
23269
23274
|
for (const file of files) {
|
|
23270
|
-
const content = readFileSync36(
|
|
23275
|
+
const content = readFileSync36(join65(DEVLOG_DIR, file), "utf8");
|
|
23271
23276
|
const parsed = parseFrontmatter(content, file);
|
|
23272
23277
|
if (parsed) callback(parsed);
|
|
23273
23278
|
}
|
|
@@ -23655,11 +23660,11 @@ function repos(options2) {
|
|
|
23655
23660
|
|
|
23656
23661
|
// src/commands/devlog/skip.ts
|
|
23657
23662
|
import { writeFileSync as writeFileSync30 } from "fs";
|
|
23658
|
-
import { join as
|
|
23663
|
+
import { join as join66 } from "path";
|
|
23659
23664
|
import chalk156 from "chalk";
|
|
23660
23665
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
23661
23666
|
function getBlogConfigPath() {
|
|
23662
|
-
return
|
|
23667
|
+
return join66(BLOG_REPO_ROOT, "assist.yml");
|
|
23663
23668
|
}
|
|
23664
23669
|
function skip2(date) {
|
|
23665
23670
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
@@ -23720,20 +23725,20 @@ function registerDevlog(program2) {
|
|
|
23720
23725
|
}
|
|
23721
23726
|
|
|
23722
23727
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
23723
|
-
import { closeSync as closeSync4, openSync as openSync5, readdirSync as
|
|
23724
|
-
import { join as
|
|
23728
|
+
import { closeSync as closeSync4, openSync as openSync5, readdirSync as readdirSync9 } from "fs";
|
|
23729
|
+
import { join as join67 } from "path";
|
|
23725
23730
|
import chalk158 from "chalk";
|
|
23726
23731
|
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "packages"]);
|
|
23727
23732
|
function isLockedDll(debugDir) {
|
|
23728
23733
|
let files;
|
|
23729
23734
|
try {
|
|
23730
|
-
files =
|
|
23735
|
+
files = readdirSync9(debugDir, { recursive: true });
|
|
23731
23736
|
} catch {
|
|
23732
23737
|
return null;
|
|
23733
23738
|
}
|
|
23734
23739
|
for (const file of files) {
|
|
23735
23740
|
if (!file.toLowerCase().endsWith(".dll")) continue;
|
|
23736
|
-
const dllPath =
|
|
23741
|
+
const dllPath = join67(debugDir, file);
|
|
23737
23742
|
try {
|
|
23738
23743
|
const fd = openSync5(dllPath, "r+");
|
|
23739
23744
|
closeSync4(fd);
|
|
@@ -23746,18 +23751,18 @@ function isLockedDll(debugDir) {
|
|
|
23746
23751
|
function findFirstLockedDll(dir) {
|
|
23747
23752
|
let entries;
|
|
23748
23753
|
try {
|
|
23749
|
-
entries =
|
|
23754
|
+
entries = readdirSync9(dir);
|
|
23750
23755
|
} catch {
|
|
23751
23756
|
return null;
|
|
23752
23757
|
}
|
|
23753
23758
|
if (entries.includes("bin")) {
|
|
23754
|
-
const locked = isLockedDll(
|
|
23759
|
+
const locked = isLockedDll(join67(dir, "bin", "Debug"));
|
|
23755
23760
|
if (locked) return locked;
|
|
23756
23761
|
}
|
|
23757
23762
|
for (const entry of entries) {
|
|
23758
23763
|
if (SKIP_DIRS.has(entry) || entry === "bin" || entry.startsWith("."))
|
|
23759
23764
|
continue;
|
|
23760
|
-
const found = findFirstLockedDll(
|
|
23765
|
+
const found = findFirstLockedDll(join67(dir, entry));
|
|
23761
23766
|
if (found) return found;
|
|
23762
23767
|
}
|
|
23763
23768
|
return null;
|
|
@@ -23826,14 +23831,14 @@ function collectAllDeps(node) {
|
|
|
23826
23831
|
}
|
|
23827
23832
|
|
|
23828
23833
|
// src/commands/dotnet/findContainingSolutions.ts
|
|
23829
|
-
import { readdirSync as
|
|
23834
|
+
import { readdirSync as readdirSync10, readFileSync as readFileSync38, statSync as statSync9 } from "fs";
|
|
23830
23835
|
import path37 from "path";
|
|
23831
23836
|
function findSlnFiles(dir, maxDepth, depth = 0) {
|
|
23832
23837
|
if (depth > maxDepth) return [];
|
|
23833
23838
|
const results = [];
|
|
23834
23839
|
let entries;
|
|
23835
23840
|
try {
|
|
23836
|
-
entries =
|
|
23841
|
+
entries = readdirSync10(dir);
|
|
23837
23842
|
} catch {
|
|
23838
23843
|
return results;
|
|
23839
23844
|
}
|
|
@@ -23925,12 +23930,12 @@ function printJson(tree, totalCount, solutions) {
|
|
|
23925
23930
|
}
|
|
23926
23931
|
|
|
23927
23932
|
// src/commands/dotnet/resolveCsproj.ts
|
|
23928
|
-
import { existsSync as
|
|
23933
|
+
import { existsSync as existsSync54 } from "fs";
|
|
23929
23934
|
import path38 from "path";
|
|
23930
23935
|
import chalk160 from "chalk";
|
|
23931
23936
|
function resolveCsproj(csprojPath) {
|
|
23932
23937
|
const resolved = path38.resolve(csprojPath);
|
|
23933
|
-
if (!
|
|
23938
|
+
if (!existsSync54(resolved)) {
|
|
23934
23939
|
console.error(chalk160.red(`File not found: ${resolved}`));
|
|
23935
23940
|
process.exit(1);
|
|
23936
23941
|
}
|
|
@@ -24098,17 +24103,17 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
24098
24103
|
}
|
|
24099
24104
|
|
|
24100
24105
|
// src/commands/dotnet/resolveSolution.ts
|
|
24101
|
-
import { existsSync as
|
|
24106
|
+
import { existsSync as existsSync55 } from "fs";
|
|
24102
24107
|
import path39 from "path";
|
|
24103
24108
|
import chalk164 from "chalk";
|
|
24104
24109
|
|
|
24105
24110
|
// src/commands/dotnet/findSolution.ts
|
|
24106
|
-
import { readdirSync as
|
|
24107
|
-
import { dirname as dirname28, join as
|
|
24111
|
+
import { readdirSync as readdirSync11 } from "fs";
|
|
24112
|
+
import { dirname as dirname28, join as join68 } from "path";
|
|
24108
24113
|
import chalk163 from "chalk";
|
|
24109
24114
|
function findSlnInDir(dir) {
|
|
24110
24115
|
try {
|
|
24111
|
-
return
|
|
24116
|
+
return readdirSync11(dir).filter((f) => f.endsWith(".sln")).map((f) => join68(dir, f));
|
|
24112
24117
|
} catch {
|
|
24113
24118
|
return [];
|
|
24114
24119
|
}
|
|
@@ -24139,7 +24144,7 @@ function findSolution() {
|
|
|
24139
24144
|
function resolveSolution(sln) {
|
|
24140
24145
|
if (sln) {
|
|
24141
24146
|
const resolved = path39.resolve(sln);
|
|
24142
|
-
if (!
|
|
24147
|
+
if (!existsSync55(resolved)) {
|
|
24143
24148
|
console.error(chalk164.red(`Solution file not found: ${resolved}`));
|
|
24144
24149
|
process.exit(1);
|
|
24145
24150
|
}
|
|
@@ -24179,7 +24184,7 @@ function parseInspectReport(json) {
|
|
|
24179
24184
|
|
|
24180
24185
|
// src/commands/dotnet/runInspectCode.ts
|
|
24181
24186
|
import { execSync as execSync35 } from "child_process";
|
|
24182
|
-
import { existsSync as
|
|
24187
|
+
import { existsSync as existsSync56, readFileSync as readFileSync39, unlinkSync as unlinkSync10 } from "fs";
|
|
24183
24188
|
import { tmpdir as tmpdir4 } from "os";
|
|
24184
24189
|
import path40 from "path";
|
|
24185
24190
|
import chalk165 from "chalk";
|
|
@@ -24210,7 +24215,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
24210
24215
|
console.error(chalk165.red("jb inspectcode failed"));
|
|
24211
24216
|
process.exit(1);
|
|
24212
24217
|
}
|
|
24213
|
-
if (!
|
|
24218
|
+
if (!existsSync56(reportPath)) {
|
|
24214
24219
|
console.error(chalk165.red("Report file not generated"));
|
|
24215
24220
|
process.exit(1);
|
|
24216
24221
|
}
|
|
@@ -24979,11 +24984,11 @@ function decideCommentGuard(input, existingContent) {
|
|
|
24979
24984
|
}
|
|
24980
24985
|
|
|
24981
24986
|
// src/commands/dbMigration/consumeMigrationApproval.ts
|
|
24982
|
-
import { existsSync as
|
|
24987
|
+
import { existsSync as existsSync57, unlinkSync as unlinkSync11 } from "fs";
|
|
24983
24988
|
function consumeMigrationApproval(migrationId) {
|
|
24984
24989
|
sweepRestrictedDir();
|
|
24985
24990
|
const path109 = getMigrationApprovalPath(migrationId);
|
|
24986
|
-
if (!
|
|
24991
|
+
if (!existsSync57(path109)) return false;
|
|
24987
24992
|
try {
|
|
24988
24993
|
unlinkSync11(path109);
|
|
24989
24994
|
return true;
|
|
@@ -25103,7 +25108,7 @@ function aggregateCommitters(authorLists) {
|
|
|
25103
25108
|
import { spawnSync as spawnSync6 } from "child_process";
|
|
25104
25109
|
import { unlinkSync as unlinkSync12, writeFileSync as writeFileSync31 } from "fs";
|
|
25105
25110
|
import { tmpdir as tmpdir5 } from "os";
|
|
25106
|
-
import { join as
|
|
25111
|
+
import { join as join69 } from "path";
|
|
25107
25112
|
function buildArgs2(queryFile, vars) {
|
|
25108
25113
|
const args = ["api", "graphql", "-F", `query=@${queryFile}`];
|
|
25109
25114
|
for (const [key, value] of Object.entries(vars)) {
|
|
@@ -25113,7 +25118,7 @@ function buildArgs2(queryFile, vars) {
|
|
|
25113
25118
|
return args;
|
|
25114
25119
|
}
|
|
25115
25120
|
function runGhGraphql(mutation, vars) {
|
|
25116
|
-
const queryFile =
|
|
25121
|
+
const queryFile = join69(tmpdir5(), `gh-query-${Date.now()}.graphql`);
|
|
25117
25122
|
writeFileSync31(queryFile, mutation);
|
|
25118
25123
|
try {
|
|
25119
25124
|
const result = spawnSync6("gh", buildArgs2(queryFile, vars), {
|
|
@@ -26576,14 +26581,14 @@ function slugFromUrl(url) {
|
|
|
26576
26581
|
import { mkdirSync as mkdirSync17, writeFileSync as writeFileSync32 } from "fs";
|
|
26577
26582
|
|
|
26578
26583
|
// src/commands/github/issue/issueWorkingFile.ts
|
|
26579
|
-
import { join as
|
|
26584
|
+
import { join as join70 } from "path";
|
|
26580
26585
|
function issueWorkingFile(slug2, number) {
|
|
26581
26586
|
const [owner = "unknown", repo = "unknown"] = slug2.split("/");
|
|
26582
|
-
const dir =
|
|
26587
|
+
const dir = join70(getStoreDir(), "github-issues", owner, repo);
|
|
26583
26588
|
return {
|
|
26584
26589
|
dir,
|
|
26585
|
-
bodyPath:
|
|
26586
|
-
metaPath:
|
|
26590
|
+
bodyPath: join70(dir, `${number}.md`),
|
|
26591
|
+
metaPath: join70(dir, `${number}.json`)
|
|
26587
26592
|
};
|
|
26588
26593
|
}
|
|
26589
26594
|
|
|
@@ -26618,10 +26623,10 @@ function fetchIssueToWorkingFile(number, repo) {
|
|
|
26618
26623
|
}
|
|
26619
26624
|
|
|
26620
26625
|
// src/commands/github/issue/resumeIssueBody.ts
|
|
26621
|
-
import { existsSync as
|
|
26626
|
+
import { existsSync as existsSync58, readFileSync as readFileSync40 } from "fs";
|
|
26622
26627
|
function resumeIssueBody(slug2, number, updatedAt) {
|
|
26623
26628
|
const { bodyPath, metaPath } = issueWorkingFile(slug2, number);
|
|
26624
|
-
if (!
|
|
26629
|
+
if (!existsSync58(bodyPath) || !existsSync58(metaPath)) return void 0;
|
|
26625
26630
|
try {
|
|
26626
26631
|
const meta = JSON.parse(readFileSync40(metaPath, "utf8"));
|
|
26627
26632
|
if (meta.updatedAt !== updatedAt) return void 0;
|
|
@@ -27270,7 +27275,7 @@ function recentDaemonLogLines(includeRelayed = true) {
|
|
|
27270
27275
|
}
|
|
27271
27276
|
|
|
27272
27277
|
// src/commands/sessions/daemon/worktree/createWorktree.ts
|
|
27273
|
-
import { existsSync as
|
|
27278
|
+
import { existsSync as existsSync59 } from "fs";
|
|
27274
27279
|
import { basename as basename20, dirname as dirname30 } from "path";
|
|
27275
27280
|
|
|
27276
27281
|
// src/commands/watch/fetchQuietly.ts
|
|
@@ -27290,14 +27295,14 @@ function fetchQuietly(cwd, intervalMs) {
|
|
|
27290
27295
|
}
|
|
27291
27296
|
|
|
27292
27297
|
// src/commands/sessions/daemon/worktree/planAllocation.ts
|
|
27293
|
-
import { basename as basename19, join as
|
|
27298
|
+
import { basename as basename19, join as join71 } from "path";
|
|
27294
27299
|
function planAllocation(clone, boundTreeRoots2) {
|
|
27295
27300
|
return boundTreeRoots2.has(clone) ? "spill" : "primary";
|
|
27296
27301
|
}
|
|
27297
27302
|
function nextWorktreePath(clone, base, isTaken) {
|
|
27298
27303
|
const name = basename19(clone);
|
|
27299
27304
|
for (let n = 2; n < 1e3; n++) {
|
|
27300
|
-
const candidate =
|
|
27305
|
+
const candidate = join71(base, `${name}-${n}`);
|
|
27301
27306
|
if (!isTaken(candidate)) return candidate;
|
|
27302
27307
|
}
|
|
27303
27308
|
throw new Error(`no free worktree suffix for ${clone}`);
|
|
@@ -27320,7 +27325,7 @@ function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
|
|
|
27320
27325
|
const base = strategy.root ? expandTilde2(strategy.root) : dirname30(clone);
|
|
27321
27326
|
const registered = new Set(listWorktreePaths(clone));
|
|
27322
27327
|
const branches = new Set(listLocalBranches(clone));
|
|
27323
|
-
const isTaken = (candidate) => registered.has(candidate) ||
|
|
27328
|
+
const isTaken = (candidate) => registered.has(candidate) || existsSync59(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename20(candidate));
|
|
27324
27329
|
const path109 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
|
|
27325
27330
|
const fetchError = fetchQuietly(clone, 0);
|
|
27326
27331
|
if (fetchError)
|
|
@@ -27351,7 +27356,7 @@ function keptInTree(cwd, reason4) {
|
|
|
27351
27356
|
}
|
|
27352
27357
|
|
|
27353
27358
|
// src/commands/sessions/daemon/worktree/treeDurability.ts
|
|
27354
|
-
import { existsSync as
|
|
27359
|
+
import { existsSync as existsSync60 } from "fs";
|
|
27355
27360
|
var treeIsGone = { durable: true, gone: true };
|
|
27356
27361
|
function treeDurability(state) {
|
|
27357
27362
|
if (state.dirty) return { durable: false, reason: "uncommitted changes" };
|
|
@@ -27382,14 +27387,14 @@ function* durabilityProbes() {
|
|
|
27382
27387
|
});
|
|
27383
27388
|
}
|
|
27384
27389
|
async function checkDurability(cwd) {
|
|
27385
|
-
if (!
|
|
27390
|
+
if (!existsSync60(cwd)) return treeIsGone;
|
|
27386
27391
|
const probes = durabilityProbes();
|
|
27387
27392
|
let step3 = probes.next();
|
|
27388
27393
|
while (!step3.done) step3 = probes.next(await gitResult(cwd, step3.value));
|
|
27389
27394
|
return step3.value;
|
|
27390
27395
|
}
|
|
27391
27396
|
function checkDurabilitySync(cwd) {
|
|
27392
|
-
if (!
|
|
27397
|
+
if (!existsSync60(cwd)) return treeIsGone;
|
|
27393
27398
|
const probes = durabilityProbes();
|
|
27394
27399
|
let step3 = probes.next();
|
|
27395
27400
|
while (!step3.done) step3 = probes.next(gitSyncResult(cwd, step3.value));
|
|
@@ -27636,20 +27641,20 @@ function persistedTreeRoots() {
|
|
|
27636
27641
|
}
|
|
27637
27642
|
|
|
27638
27643
|
// src/commands/sessions/daemon/worktree/seedWorktree.ts
|
|
27639
|
-
import { copyFileSync, existsSync as
|
|
27640
|
-
import { dirname as dirname31, join as
|
|
27644
|
+
import { copyFileSync, existsSync as existsSync62, mkdirSync as mkdirSync18 } from "fs";
|
|
27645
|
+
import { dirname as dirname31, join as join73 } from "path";
|
|
27641
27646
|
|
|
27642
27647
|
// src/commands/sessions/daemon/worktree/runInstall.ts
|
|
27643
27648
|
import { resolve as resolve18 } from "path";
|
|
27644
27649
|
|
|
27645
27650
|
// src/commands/sessions/daemon/worktree/detectInstallCommand.ts
|
|
27646
|
-
import { existsSync as
|
|
27647
|
-
import { join as
|
|
27651
|
+
import { existsSync as existsSync61 } from "fs";
|
|
27652
|
+
import { join as join72 } from "path";
|
|
27648
27653
|
function detectInstallCommand(dir) {
|
|
27649
|
-
if (!
|
|
27650
|
-
if (
|
|
27651
|
-
if (
|
|
27652
|
-
if (
|
|
27654
|
+
if (!existsSync61(join72(dir, "package.json"))) return null;
|
|
27655
|
+
if (existsSync61(join72(dir, "pnpm-lock.yaml"))) return "pnpm install";
|
|
27656
|
+
if (existsSync61(join72(dir, "yarn.lock"))) return "yarn install";
|
|
27657
|
+
if (existsSync61(join72(dir, "bun.lockb"))) return "bun install";
|
|
27653
27658
|
return "npm install";
|
|
27654
27659
|
}
|
|
27655
27660
|
|
|
@@ -27814,9 +27819,9 @@ function seedWorktree(worktreePath, clone, onSeeded = () => {
|
|
|
27814
27819
|
}
|
|
27815
27820
|
function copyConfigFiles(worktreePath, clone, copy) {
|
|
27816
27821
|
for (const rel of copy) {
|
|
27817
|
-
const src =
|
|
27818
|
-
if (!
|
|
27819
|
-
const dest =
|
|
27822
|
+
const src = join73(clone, rel);
|
|
27823
|
+
if (!existsSync62(src)) continue;
|
|
27824
|
+
const dest = join73(worktreePath, rel);
|
|
27820
27825
|
try {
|
|
27821
27826
|
mkdirSync18(dirname31(dest), { recursive: true });
|
|
27822
27827
|
copyFileSync(src, dest);
|
|
@@ -28162,7 +28167,7 @@ function registerLitellm(program2) {
|
|
|
28162
28167
|
}
|
|
28163
28168
|
|
|
28164
28169
|
// src/commands/mermaidExport.ts
|
|
28165
|
-
import { mkdirSync as mkdirSync19, readdirSync as
|
|
28170
|
+
import { mkdirSync as mkdirSync19, readdirSync as readdirSync12 } from "fs";
|
|
28166
28171
|
import { resolve as resolve20 } from "path";
|
|
28167
28172
|
import chalk180 from "chalk";
|
|
28168
28173
|
|
|
@@ -28244,7 +28249,7 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
28244
28249
|
process.exit(1);
|
|
28245
28250
|
}
|
|
28246
28251
|
}
|
|
28247
|
-
const files = file ? [file] :
|
|
28252
|
+
const files = file ? [file] : readdirSync12(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
28248
28253
|
if (files.length === 0) {
|
|
28249
28254
|
console.log(chalk180.gray("No markdown files found in current directory."));
|
|
28250
28255
|
return;
|
|
@@ -28405,10 +28410,10 @@ function applyIgnore(texts, ignore3) {
|
|
|
28405
28410
|
}
|
|
28406
28411
|
|
|
28407
28412
|
// src/commands/miro/readIgnoreList.ts
|
|
28408
|
-
import { existsSync as
|
|
28413
|
+
import { existsSync as existsSync63, readFileSync as readFileSync42 } from "fs";
|
|
28409
28414
|
import { parse as parse2 } from "yaml";
|
|
28410
28415
|
function readIgnoreList(file) {
|
|
28411
|
-
if (!
|
|
28416
|
+
if (!existsSync63(file))
|
|
28412
28417
|
throw new MiroExtractError(
|
|
28413
28418
|
`No ignore file at ${file}. Write a YAML list of the box texts to drop, or omit --ignore.`
|
|
28414
28419
|
);
|
|
@@ -28890,15 +28895,15 @@ function createNetcapHandler(options2) {
|
|
|
28890
28895
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
28891
28896
|
import { cp as cp4, readFile as readFile7, writeFile as writeFile6 } from "fs/promises";
|
|
28892
28897
|
import { networkInterfaces } from "os";
|
|
28893
|
-
import { join as
|
|
28898
|
+
import { join as join75 } from "path";
|
|
28894
28899
|
import chalk183 from "chalk";
|
|
28895
28900
|
|
|
28896
28901
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
28897
|
-
import { dirname as dirname33, join as
|
|
28902
|
+
import { dirname as dirname33, join as join74 } from "path";
|
|
28898
28903
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
28899
28904
|
var moduleDir2 = dirname33(fileURLToPath7(import.meta.url));
|
|
28900
28905
|
function netcapExtensionDir() {
|
|
28901
|
-
return
|
|
28906
|
+
return join74(moduleDir2, "commands", "netcap", "netcap-extension");
|
|
28902
28907
|
}
|
|
28903
28908
|
|
|
28904
28909
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
@@ -28913,7 +28918,7 @@ function lanIPv4() {
|
|
|
28913
28918
|
return void 0;
|
|
28914
28919
|
}
|
|
28915
28920
|
async function configureBackground(dir, host, port, filter) {
|
|
28916
|
-
const file =
|
|
28921
|
+
const file = join75(dir, "background.js");
|
|
28917
28922
|
const source = await readFile7(file, "utf8");
|
|
28918
28923
|
await writeFile6(
|
|
28919
28924
|
file,
|
|
@@ -28953,20 +28958,20 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
28953
28958
|
}
|
|
28954
28959
|
|
|
28955
28960
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
28956
|
-
import { isAbsolute as isAbsolute5, join as
|
|
28961
|
+
import { isAbsolute as isAbsolute5, join as join77, resolve as resolve22 } from "path";
|
|
28957
28962
|
|
|
28958
28963
|
// src/commands/netcap/defaultCapturePath.ts
|
|
28959
28964
|
import { homedir as homedir23 } from "os";
|
|
28960
|
-
import { join as
|
|
28965
|
+
import { join as join76 } from "path";
|
|
28961
28966
|
function defaultCapturePath() {
|
|
28962
|
-
return
|
|
28967
|
+
return join76(homedir23(), ".assist", "netcap", "capture.jsonl");
|
|
28963
28968
|
}
|
|
28964
28969
|
|
|
28965
28970
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
28966
28971
|
function resolveNetcapOutPath(out) {
|
|
28967
28972
|
if (!out) return defaultCapturePath();
|
|
28968
28973
|
const dir = isAbsolute5(out) ? out : resolve22(process.cwd(), out);
|
|
28969
|
-
return
|
|
28974
|
+
return join77(dir, "capture.jsonl");
|
|
28970
28975
|
}
|
|
28971
28976
|
|
|
28972
28977
|
// src/commands/netcap/netcap.ts
|
|
@@ -29013,7 +29018,7 @@ netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"}
|
|
|
29013
29018
|
|
|
29014
29019
|
// src/commands/netcap/netcapExtract.ts
|
|
29015
29020
|
import { writeFileSync as writeFileSync35 } from "fs";
|
|
29016
|
-
import { join as
|
|
29021
|
+
import { join as join78 } from "path";
|
|
29017
29022
|
import chalk185 from "chalk";
|
|
29018
29023
|
|
|
29019
29024
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
@@ -29458,7 +29463,7 @@ function extractPostsFromCapture(captureFile) {
|
|
|
29458
29463
|
function netcapExtract(file) {
|
|
29459
29464
|
const captureFile = file ?? defaultCapturePath();
|
|
29460
29465
|
const posts = extractPostsFromCapture(captureFile);
|
|
29461
|
-
const outFile =
|
|
29466
|
+
const outFile = join78(captureFile, "..", "posts.json");
|
|
29462
29467
|
writeFileSync35(outFile, `${JSON.stringify(posts, null, 2)}
|
|
29463
29468
|
`);
|
|
29464
29469
|
console.log(
|
|
@@ -29821,14 +29826,14 @@ import { execSync as execSync40 } from "child_process";
|
|
|
29821
29826
|
import { execFileSync as execFileSync19 } from "child_process";
|
|
29822
29827
|
|
|
29823
29828
|
// src/commands/prs/loadCommentsCache.ts
|
|
29824
|
-
import { existsSync as
|
|
29829
|
+
import { existsSync as existsSync64, readFileSync as readFileSync45, unlinkSync as unlinkSync13 } from "fs";
|
|
29825
29830
|
import { parse as parse3 } from "yaml";
|
|
29826
29831
|
|
|
29827
29832
|
// src/commands/prs/commentsCachePath.ts
|
|
29828
29833
|
import { homedir as homedir24 } from "os";
|
|
29829
|
-
import { join as
|
|
29834
|
+
import { join as join79 } from "path";
|
|
29830
29835
|
function commentsCachePath(org, repo, prNumber) {
|
|
29831
|
-
return
|
|
29836
|
+
return join79(
|
|
29832
29837
|
homedir24(),
|
|
29833
29838
|
".assist",
|
|
29834
29839
|
"pr-comments",
|
|
@@ -29841,7 +29846,7 @@ function commentsCachePath(org, repo, prNumber) {
|
|
|
29841
29846
|
// src/commands/prs/loadCommentsCache.ts
|
|
29842
29847
|
function loadCommentsCache(org, repo, prNumber) {
|
|
29843
29848
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
29844
|
-
if (!
|
|
29849
|
+
if (!existsSync64(cachePath)) {
|
|
29845
29850
|
return null;
|
|
29846
29851
|
}
|
|
29847
29852
|
const content = readFileSync45(cachePath, "utf8");
|
|
@@ -29849,7 +29854,7 @@ function loadCommentsCache(org, repo, prNumber) {
|
|
|
29849
29854
|
}
|
|
29850
29855
|
function deleteCommentsCache(org, repo, prNumber) {
|
|
29851
29856
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
29852
|
-
if (
|
|
29857
|
+
if (existsSync64(cachePath)) {
|
|
29853
29858
|
unlinkSync13(cachePath);
|
|
29854
29859
|
console.log("No more unresolved line comments. Cache dropped.");
|
|
29855
29860
|
}
|
|
@@ -30037,19 +30042,19 @@ import { dirname as dirname35 } from "path";
|
|
|
30037
30042
|
import { stringify as stringify3 } from "yaml";
|
|
30038
30043
|
|
|
30039
30044
|
// src/commands/prs/removeStaleCommentsCaches.ts
|
|
30040
|
-
import { readdirSync as
|
|
30041
|
-
import { join as
|
|
30045
|
+
import { readdirSync as readdirSync13, unlinkSync as unlinkSync14 } from "fs";
|
|
30046
|
+
import { join as join80 } from "path";
|
|
30042
30047
|
var STALE_PATTERN = /^pr-\d+-comments\.yaml$/;
|
|
30043
30048
|
function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
30044
|
-
const dir =
|
|
30049
|
+
const dir = join80(cwd, ".assist");
|
|
30045
30050
|
let entries;
|
|
30046
30051
|
try {
|
|
30047
|
-
entries =
|
|
30052
|
+
entries = readdirSync13(dir);
|
|
30048
30053
|
} catch {
|
|
30049
30054
|
return;
|
|
30050
30055
|
}
|
|
30051
30056
|
for (const entry of entries.filter((e) => STALE_PATTERN.test(e))) {
|
|
30052
|
-
unlinkSync14(
|
|
30057
|
+
unlinkSync14(join80(dir, entry));
|
|
30053
30058
|
}
|
|
30054
30059
|
}
|
|
30055
30060
|
|
|
@@ -32757,9 +32762,9 @@ async function notify() {
|
|
|
32757
32762
|
|
|
32758
32763
|
// src/commands/screenshot.ts
|
|
32759
32764
|
import { execSync as execSync49 } from "child_process";
|
|
32760
|
-
import { existsSync as
|
|
32765
|
+
import { existsSync as existsSync65, mkdirSync as mkdirSync22, unlinkSync as unlinkSync15, writeFileSync as writeFileSync37 } from "fs";
|
|
32761
32766
|
import { tmpdir as tmpdir6 } from "os";
|
|
32762
|
-
import { join as
|
|
32767
|
+
import { join as join81, resolve as resolve24 } from "path";
|
|
32763
32768
|
import chalk210 from "chalk";
|
|
32764
32769
|
|
|
32765
32770
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
@@ -32889,14 +32894,14 @@ Write-Output $OutputPath
|
|
|
32889
32894
|
|
|
32890
32895
|
// src/commands/screenshot.ts
|
|
32891
32896
|
function buildOutputPath(outputDir, processName) {
|
|
32892
|
-
if (!
|
|
32897
|
+
if (!existsSync65(outputDir)) {
|
|
32893
32898
|
mkdirSync22(outputDir, { recursive: true });
|
|
32894
32899
|
}
|
|
32895
32900
|
const timestamp6 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
32896
32901
|
return resolve24(outputDir, `${processName}-${timestamp6}.png`);
|
|
32897
32902
|
}
|
|
32898
32903
|
function runPowerShellScript(processName, outputPath) {
|
|
32899
|
-
const scriptPath =
|
|
32904
|
+
const scriptPath = join81(tmpdir6(), `assist-screenshot-${Date.now()}.ps1`);
|
|
32900
32905
|
writeFileSync37(scriptPath, captureWindowPs1, "utf8");
|
|
32901
32906
|
try {
|
|
32902
32907
|
execSync49(
|
|
@@ -33011,9 +33016,9 @@ function buildLimitsSegment(rateLimits) {
|
|
|
33011
33016
|
|
|
33012
33017
|
// src/commands/readGitBranch.ts
|
|
33013
33018
|
import { readFileSync as readFileSync48, statSync as statSync11 } from "fs";
|
|
33014
|
-
import { isAbsolute as isAbsolute6, join as
|
|
33019
|
+
import { isAbsolute as isAbsolute6, join as join82, resolve as resolve25 } from "path";
|
|
33015
33020
|
function resolveGitDir(cwd) {
|
|
33016
|
-
const dotGit =
|
|
33021
|
+
const dotGit = join82(cwd, ".git");
|
|
33017
33022
|
let stat5;
|
|
33018
33023
|
try {
|
|
33019
33024
|
stat5 = statSync11(dotGit);
|
|
@@ -33043,7 +33048,7 @@ function readGitBranch(cwd) {
|
|
|
33043
33048
|
}
|
|
33044
33049
|
let head;
|
|
33045
33050
|
try {
|
|
33046
|
-
head = readFileSync48(
|
|
33051
|
+
head = readFileSync48(join82(gitDir, "HEAD"), "utf8");
|
|
33047
33052
|
} catch {
|
|
33048
33053
|
return null;
|
|
33049
33054
|
}
|
|
@@ -36291,15 +36296,15 @@ function fetchHighLevelPr(prNumber, repo) {
|
|
|
36291
36296
|
}
|
|
36292
36297
|
|
|
36293
36298
|
// src/commands/review/highLevel/loadHighLevelReview.ts
|
|
36294
|
-
import { existsSync as
|
|
36299
|
+
import { existsSync as existsSync66, readFileSync as readFileSync49 } from "fs";
|
|
36295
36300
|
|
|
36296
36301
|
// src/commands/review/highLevel/highLevelReviewPath.ts
|
|
36297
|
-
import { join as
|
|
36302
|
+
import { join as join83 } from "path";
|
|
36298
36303
|
function slug(value) {
|
|
36299
36304
|
return value.replace(/[^\w.-]+/g, "-");
|
|
36300
36305
|
}
|
|
36301
36306
|
function highLevelReviewPath(repo, headRef, headSha) {
|
|
36302
|
-
return
|
|
36307
|
+
return join83(
|
|
36303
36308
|
getStoreDir(),
|
|
36304
36309
|
"high-level-reviews",
|
|
36305
36310
|
slug(repo),
|
|
@@ -36310,7 +36315,7 @@ function highLevelReviewPath(repo, headRef, headSha) {
|
|
|
36310
36315
|
// src/commands/review/highLevel/loadHighLevelReview.ts
|
|
36311
36316
|
function loadHighLevelReview(repo, headRef, headSha) {
|
|
36312
36317
|
const path109 = highLevelReviewPath(repo, headRef, headSha);
|
|
36313
|
-
if (!
|
|
36318
|
+
if (!existsSync66(path109)) return void 0;
|
|
36314
36319
|
try {
|
|
36315
36320
|
return JSON.parse(readFileSync49(path109, "utf8"));
|
|
36316
36321
|
} catch {
|
|
@@ -37380,7 +37385,7 @@ import { format as format2 } from "util";
|
|
|
37380
37385
|
|
|
37381
37386
|
// src/commands/review/createReviewLogSink.ts
|
|
37382
37387
|
import { appendFileSync as appendFileSync3, mkdirSync as mkdirSync24 } from "fs";
|
|
37383
|
-
import { join as
|
|
37388
|
+
import { join as join84 } from "path";
|
|
37384
37389
|
var LOG_FILE = "review.log";
|
|
37385
37390
|
function createReviewLogSink() {
|
|
37386
37391
|
let logPath2;
|
|
@@ -37397,7 +37402,7 @@ function createReviewLogSink() {
|
|
|
37397
37402
|
},
|
|
37398
37403
|
attach(reviewDir) {
|
|
37399
37404
|
mkdirSync24(reviewDir, { recursive: true });
|
|
37400
|
-
logPath2 =
|
|
37405
|
+
logPath2 = join84(reviewDir, LOG_FILE);
|
|
37401
37406
|
const lines2 = [
|
|
37402
37407
|
"",
|
|
37403
37408
|
`=== ${(/* @__PURE__ */ new Date()).toISOString()} ===`,
|
|
@@ -38096,7 +38101,7 @@ async function runClaudeReviewer(spec) {
|
|
|
38096
38101
|
}
|
|
38097
38102
|
|
|
38098
38103
|
// src/commands/review/runCodexReviewer.ts
|
|
38099
|
-
import { existsSync as
|
|
38104
|
+
import { existsSync as existsSync67, unlinkSync as unlinkSync16 } from "fs";
|
|
38100
38105
|
|
|
38101
38106
|
// src/commands/review/parseCodexUsage.ts
|
|
38102
38107
|
function parseCodexUsage(usage) {
|
|
@@ -38185,7 +38190,7 @@ async function runCodexReviewer(spec) {
|
|
|
38185
38190
|
...override.args.length > 0 ? { env: override.env } : {},
|
|
38186
38191
|
onLine
|
|
38187
38192
|
});
|
|
38188
|
-
if (result.exitCode !== 0 &&
|
|
38193
|
+
if (result.exitCode !== 0 && existsSync67(spec.outputPath)) {
|
|
38189
38194
|
unlinkSync16(spec.outputPath);
|
|
38190
38195
|
}
|
|
38191
38196
|
const finalised = finaliseReviewerRun(
|
|
@@ -38276,7 +38281,7 @@ async function runReviewers(reviewDir, claudePath, codexPath, stdinPrompt, optio
|
|
|
38276
38281
|
}
|
|
38277
38282
|
|
|
38278
38283
|
// src/commands/review/synthesiseAfterReviewers.ts
|
|
38279
|
-
import { existsSync as
|
|
38284
|
+
import { existsSync as existsSync68, unlinkSync as unlinkSync17 } from "fs";
|
|
38280
38285
|
|
|
38281
38286
|
// src/commands/review/synthesise.ts
|
|
38282
38287
|
import { readFileSync as readFileSync51 } from "fs";
|
|
@@ -38383,7 +38388,7 @@ async function synthesise(paths, options2) {
|
|
|
38383
38388
|
// src/commands/review/synthesiseAfterReviewers.ts
|
|
38384
38389
|
async function synthesiseAfterReviewers(input) {
|
|
38385
38390
|
const { paths, failures } = input;
|
|
38386
|
-
if (input.anyFresh &&
|
|
38391
|
+
if (input.anyFresh && existsSync68(paths.synthesisPath)) {
|
|
38387
38392
|
unlinkSync17(paths.synthesisPath);
|
|
38388
38393
|
}
|
|
38389
38394
|
const synthesisResult = await synthesise(paths, {
|
|
@@ -38612,9 +38617,9 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
|
|
|
38612
38617
|
|
|
38613
38618
|
// src/commands/review/buildReviewPaths.ts
|
|
38614
38619
|
import { homedir as homedir25 } from "os";
|
|
38615
|
-
import { basename as basename25, join as
|
|
38620
|
+
import { basename as basename25, join as join85 } from "path";
|
|
38616
38621
|
function buildReviewPaths(repoRoot2, key) {
|
|
38617
|
-
const reviewDir =
|
|
38622
|
+
const reviewDir = join85(
|
|
38618
38623
|
homedir25(),
|
|
38619
38624
|
".assist",
|
|
38620
38625
|
"reviews",
|
|
@@ -38623,10 +38628,10 @@ function buildReviewPaths(repoRoot2, key) {
|
|
|
38623
38628
|
);
|
|
38624
38629
|
return {
|
|
38625
38630
|
reviewDir,
|
|
38626
|
-
requestPath:
|
|
38627
|
-
claudePath:
|
|
38628
|
-
codexPath:
|
|
38629
|
-
synthesisPath:
|
|
38631
|
+
requestPath: join85(reviewDir, "request.md"),
|
|
38632
|
+
claudePath: join85(reviewDir, "claude.md"),
|
|
38633
|
+
codexPath: join85(reviewDir, "codex.md"),
|
|
38634
|
+
synthesisPath: join85(reviewDir, "synthesis.md")
|
|
38630
38635
|
};
|
|
38631
38636
|
}
|
|
38632
38637
|
|
|
@@ -38664,10 +38669,10 @@ function fetchExistingComments() {
|
|
|
38664
38669
|
}
|
|
38665
38670
|
|
|
38666
38671
|
// src/commands/review/prepareReviewDir.ts
|
|
38667
|
-
import { existsSync as
|
|
38672
|
+
import { existsSync as existsSync69, mkdirSync as mkdirSync25, unlinkSync as unlinkSync18, writeFileSync as writeFileSync40 } from "fs";
|
|
38668
38673
|
function clearReviewFiles(paths) {
|
|
38669
38674
|
for (const path109 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
38670
|
-
if (
|
|
38675
|
+
if (existsSync69(path109)) unlinkSync18(path109);
|
|
38671
38676
|
}
|
|
38672
38677
|
}
|
|
38673
38678
|
function prepareReviewDir(paths, requestBody, force) {
|
|
@@ -39318,7 +39323,7 @@ function registerReview(program2) {
|
|
|
39318
39323
|
}
|
|
39319
39324
|
|
|
39320
39325
|
// src/commands/rules/addRule.ts
|
|
39321
|
-
import { existsSync as
|
|
39326
|
+
import { existsSync as existsSync72, readFileSync as readFileSync56, writeFileSync as writeFileSync42 } from "fs";
|
|
39322
39327
|
import path88 from "path";
|
|
39323
39328
|
import chalk244 from "chalk";
|
|
39324
39329
|
|
|
@@ -39346,12 +39351,12 @@ function insertRuleBullet(content, rule) {
|
|
|
39346
39351
|
import { readFileSync as readFileSync53 } from "fs";
|
|
39347
39352
|
|
|
39348
39353
|
// src/commands/rules/findClaudeFiles.ts
|
|
39349
|
-
import { readdirSync as
|
|
39354
|
+
import { readdirSync as readdirSync14 } from "fs";
|
|
39350
39355
|
import path84 from "path";
|
|
39351
39356
|
var SKIP_DIRECTORIES = /* @__PURE__ */ new Set(["node_modules", "dist", "build", "coverage"]);
|
|
39352
39357
|
function findClaudeFiles(dir) {
|
|
39353
39358
|
const results = [];
|
|
39354
|
-
for (const entry of
|
|
39359
|
+
for (const entry of readdirSync14(dir, { withFileTypes: true })) {
|
|
39355
39360
|
if (entry.isDirectory()) {
|
|
39356
39361
|
if (entry.name.startsWith(".") || SKIP_DIRECTORIES.has(entry.name))
|
|
39357
39362
|
continue;
|
|
@@ -39375,7 +39380,7 @@ function nextRuleCode(root2) {
|
|
|
39375
39380
|
}
|
|
39376
39381
|
|
|
39377
39382
|
// src/commands/rules/resolveRuleScope.ts
|
|
39378
|
-
import { existsSync as
|
|
39383
|
+
import { existsSync as existsSync70 } from "fs";
|
|
39379
39384
|
import path85 from "path";
|
|
39380
39385
|
function resolveRuleScope(target) {
|
|
39381
39386
|
const resolved = path85.resolve(target);
|
|
@@ -39385,7 +39390,7 @@ function resolveRuleScope(target) {
|
|
|
39385
39390
|
let current = startDir;
|
|
39386
39391
|
while (true) {
|
|
39387
39392
|
const candidate = path85.join(current, "CLAUDE.md");
|
|
39388
|
-
if (
|
|
39393
|
+
if (existsSync70(candidate)) return candidate;
|
|
39389
39394
|
if (current === root2 || current === path85.dirname(current)) break;
|
|
39390
39395
|
current = path85.dirname(current);
|
|
39391
39396
|
}
|
|
@@ -39393,7 +39398,7 @@ function resolveRuleScope(target) {
|
|
|
39393
39398
|
}
|
|
39394
39399
|
|
|
39395
39400
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
39396
|
-
import { existsSync as
|
|
39401
|
+
import { existsSync as existsSync71, readFileSync as readFileSync55, writeFileSync as writeFileSync41 } from "fs";
|
|
39397
39402
|
import path87 from "path";
|
|
39398
39403
|
|
|
39399
39404
|
// src/commands/rules/scopedRuleDirectories.ts
|
|
@@ -39443,7 +39448,7 @@ function upsertScopedRulesPointer(content, directories) {
|
|
|
39443
39448
|
function updateScopedRulesIndex(root2) {
|
|
39444
39449
|
const directories = scopedRuleDirectories(root2);
|
|
39445
39450
|
const rootFile = path87.join(root2, "CLAUDE.md");
|
|
39446
|
-
const before =
|
|
39451
|
+
const before = existsSync71(rootFile) ? readFileSync55(rootFile, "utf8") : "";
|
|
39447
39452
|
const after = upsertScopedRulesPointer(before, directories);
|
|
39448
39453
|
if (after !== before) writeFileSync41(rootFile, after);
|
|
39449
39454
|
return directories;
|
|
@@ -39451,7 +39456,7 @@ function updateScopedRulesIndex(root2) {
|
|
|
39451
39456
|
|
|
39452
39457
|
// src/commands/rules/addRule.ts
|
|
39453
39458
|
function read2(file) {
|
|
39454
|
-
return
|
|
39459
|
+
return existsSync72(file) ? readFileSync56(file, "utf8") : "";
|
|
39455
39460
|
}
|
|
39456
39461
|
function addRule(text18, options2) {
|
|
39457
39462
|
const rule = text18.trim();
|
|
@@ -40029,12 +40034,12 @@ async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
|
40029
40034
|
}
|
|
40030
40035
|
|
|
40031
40036
|
// src/commands/slack/slackWorkingFile.ts
|
|
40032
|
-
import { join as
|
|
40037
|
+
import { join as join86 } from "path";
|
|
40033
40038
|
function slackWorkingFile(channel, partIndex) {
|
|
40034
40039
|
const slug2 = channel.replace(/^[#@]/, "").toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "channel";
|
|
40035
|
-
const dir =
|
|
40040
|
+
const dir = join86(getStoreDir(), "slack");
|
|
40036
40041
|
const name = partIndex === void 0 ? slug2 : `${slug2}-${partIndex}`;
|
|
40037
|
-
return { dir, bodyPath:
|
|
40042
|
+
return { dir, bodyPath: join86(dir, `${name}.md`) };
|
|
40038
40043
|
}
|
|
40039
40044
|
|
|
40040
40045
|
// src/commands/slack/previewSlackThreadParts.ts
|
|
@@ -40852,7 +40857,7 @@ function registerSync(program2) {
|
|
|
40852
40857
|
}
|
|
40853
40858
|
|
|
40854
40859
|
// src/commands/transcript/clean.ts
|
|
40855
|
-
import { existsSync as
|
|
40860
|
+
import { existsSync as existsSync77 } from "fs";
|
|
40856
40861
|
|
|
40857
40862
|
// src/commands/transcript/convert/formatTimestamp.ts
|
|
40858
40863
|
function pad(value, width2) {
|
|
@@ -41130,7 +41135,7 @@ function clean(file, options2 = {}) {
|
|
|
41130
41135
|
);
|
|
41131
41136
|
process.exit(1);
|
|
41132
41137
|
}
|
|
41133
|
-
if (!
|
|
41138
|
+
if (!existsSync77(file)) {
|
|
41134
41139
|
console.error(`Error: VTT file not found: ${file}`);
|
|
41135
41140
|
process.exit(1);
|
|
41136
41141
|
}
|
|
@@ -41213,21 +41218,21 @@ async function configure() {
|
|
|
41213
41218
|
}
|
|
41214
41219
|
|
|
41215
41220
|
// src/commands/transcript/list.ts
|
|
41216
|
-
import { existsSync as
|
|
41217
|
-
import { join as
|
|
41221
|
+
import { existsSync as existsSync78, readdirSync as readdirSync21, statSync as statSync13 } from "fs";
|
|
41222
|
+
import { join as join98 } from "path";
|
|
41218
41223
|
function list3() {
|
|
41219
41224
|
const { vttDir } = getTranscriptConfig();
|
|
41220
|
-
if (!
|
|
41221
|
-
for (const entry of
|
|
41225
|
+
if (!existsSync78(vttDir)) return;
|
|
41226
|
+
for (const entry of readdirSync21(vttDir)) {
|
|
41222
41227
|
if (!entry.endsWith(".vtt")) continue;
|
|
41223
|
-
if (statSync13(
|
|
41228
|
+
if (statSync13(join98(vttDir, entry)).isDirectory()) continue;
|
|
41224
41229
|
console.log(entry);
|
|
41225
41230
|
}
|
|
41226
41231
|
}
|
|
41227
41232
|
|
|
41228
41233
|
// src/commands/transcript/move.ts
|
|
41229
|
-
import { existsSync as
|
|
41230
|
-
import { basename as basename29, join as
|
|
41234
|
+
import { existsSync as existsSync79, mkdirSync as mkdirSync33, renameSync as renameSync4, writeFileSync as writeFileSync49 } from "fs";
|
|
41235
|
+
import { basename as basename29, join as join99 } from "path";
|
|
41231
41236
|
|
|
41232
41237
|
// src/commands/transcript/convertVttToMarkdown.ts
|
|
41233
41238
|
function convertVttToMarkdown(inputPath) {
|
|
@@ -41237,9 +41242,9 @@ function convertVttToMarkdown(inputPath) {
|
|
|
41237
41242
|
// src/commands/transcript/move.ts
|
|
41238
41243
|
var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
41239
41244
|
function archiveRawVtt(vttDir, sourcePath, filename) {
|
|
41240
|
-
const processedDir =
|
|
41245
|
+
const processedDir = join99(vttDir, "processed");
|
|
41241
41246
|
mkdirSync33(processedDir, { recursive: true });
|
|
41242
|
-
renameSync4(sourcePath,
|
|
41247
|
+
renameSync4(sourcePath, join99(processedDir, filename));
|
|
41243
41248
|
}
|
|
41244
41249
|
function move(file, options2) {
|
|
41245
41250
|
const { date, client } = options2;
|
|
@@ -41249,25 +41254,25 @@ function move(file, options2) {
|
|
|
41249
41254
|
}
|
|
41250
41255
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
41251
41256
|
const filename = basename29(file);
|
|
41252
|
-
const sourcePath =
|
|
41253
|
-
if (!
|
|
41257
|
+
const sourcePath = join99(vttDir, filename);
|
|
41258
|
+
if (!existsSync79(sourcePath)) {
|
|
41254
41259
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
41255
41260
|
process.exit(1);
|
|
41256
41261
|
}
|
|
41257
41262
|
const base = basename29(filename, ".vtt").replace(/ Transcription$/, "");
|
|
41258
41263
|
const outputName = `${date} ${base}.md`;
|
|
41259
|
-
const formattedDir =
|
|
41264
|
+
const formattedDir = join99(transcriptsDir, client);
|
|
41260
41265
|
mkdirSync33(formattedDir, { recursive: true });
|
|
41261
|
-
const formattedPath =
|
|
41266
|
+
const formattedPath = join99(formattedDir, outputName);
|
|
41262
41267
|
writeFileSync49(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
|
|
41263
41268
|
archiveRawVtt(vttDir, sourcePath, filename);
|
|
41264
|
-
const summaryPath =
|
|
41269
|
+
const summaryPath = join99(summaryDir, client, outputName);
|
|
41265
41270
|
console.log(`Formatted transcript: ${formattedPath}`);
|
|
41266
41271
|
console.log(`Summary target: ${summaryPath}`);
|
|
41267
41272
|
}
|
|
41268
41273
|
|
|
41269
41274
|
// src/commands/transcript/merge.ts
|
|
41270
|
-
import { existsSync as
|
|
41275
|
+
import { existsSync as existsSync80, writeFileSync as writeFileSync50 } from "fs";
|
|
41271
41276
|
import { basename as basename30 } from "path";
|
|
41272
41277
|
|
|
41273
41278
|
// src/commands/transcript/failTranscript.ts
|
|
@@ -41411,7 +41416,7 @@ function widenAudience(passages) {
|
|
|
41411
41416
|
|
|
41412
41417
|
// src/commands/transcript/merge.ts
|
|
41413
41418
|
function readSource3(file) {
|
|
41414
|
-
if (!
|
|
41419
|
+
if (!existsSync80(file)) failTranscript(`VTT file not found: ${file}`);
|
|
41415
41420
|
const cues = readCleanedCues(file);
|
|
41416
41421
|
if (cues.length === 0) failTranscript(`no cues found in: ${file}`);
|
|
41417
41422
|
return { path: file, name: basename30(file), cues };
|
|
@@ -41878,7 +41883,7 @@ function configKeys2() {
|
|
|
41878
41883
|
}
|
|
41879
41884
|
|
|
41880
41885
|
// src/commands/verify/forbiddenStrings.ts
|
|
41881
|
-
import { existsSync as
|
|
41886
|
+
import { existsSync as existsSync81, readFileSync as readFileSync63 } from "fs";
|
|
41882
41887
|
|
|
41883
41888
|
// src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
|
|
41884
41889
|
import { minimatch as minimatch10 } from "minimatch";
|
|
@@ -41919,7 +41924,7 @@ function forbiddenStrings() {
|
|
|
41919
41924
|
const cache6 = /* @__PURE__ */ new Map();
|
|
41920
41925
|
const readJson = (file) => {
|
|
41921
41926
|
if (cache6.has(file)) return cache6.get(file);
|
|
41922
|
-
if (!
|
|
41927
|
+
if (!existsSync81(file)) {
|
|
41923
41928
|
console.log(`Forbidden-strings file not found: ${file}`);
|
|
41924
41929
|
process.exit(1);
|
|
41925
41930
|
}
|
|
@@ -42069,10 +42074,10 @@ function checkSequential(migrations3, files) {
|
|
|
42069
42074
|
}
|
|
42070
42075
|
|
|
42071
42076
|
// src/commands/verify/migrations/listMigrationFiles.ts
|
|
42072
|
-
import { readdirSync as
|
|
42077
|
+
import { readdirSync as readdirSync22 } from "fs";
|
|
42073
42078
|
var MIGRATION_FILE2 = /^migration\d+[A-Za-z0-9]*\.ts$/;
|
|
42074
42079
|
function listMigrationFiles(dir) {
|
|
42075
|
-
return
|
|
42080
|
+
return readdirSync22(dir).filter((file) => MIGRATION_FILE2.test(file));
|
|
42076
42081
|
}
|
|
42077
42082
|
|
|
42078
42083
|
// src/commands/verify/migrations/readBaselineMigrations.ts
|
|
@@ -42708,7 +42713,7 @@ function resolveParams(params, cliArgs) {
|
|
|
42708
42713
|
}
|
|
42709
42714
|
|
|
42710
42715
|
// src/commands/run/resolveRunCwd.ts
|
|
42711
|
-
import { existsSync as
|
|
42716
|
+
import { existsSync as existsSync82 } from "fs";
|
|
42712
42717
|
import { resolve as resolve28 } from "path";
|
|
42713
42718
|
var MissingRunCwdError = class extends Error {
|
|
42714
42719
|
constructor(runName, cwd) {
|
|
@@ -42721,7 +42726,7 @@ var MissingRunCwdError = class extends Error {
|
|
|
42721
42726
|
function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
|
|
42722
42727
|
if (!config.cwd) return void 0;
|
|
42723
42728
|
const cwd = resolve28(baseDir, config.cwd);
|
|
42724
|
-
if (!
|
|
42729
|
+
if (!existsSync82(cwd)) throw new MissingRunCwdError(config.name, cwd);
|
|
42725
42730
|
return cwd;
|
|
42726
42731
|
}
|
|
42727
42732
|
|
|
@@ -42841,10 +42846,10 @@ ${buildWatchReport(from)}`);
|
|
|
42841
42846
|
}
|
|
42842
42847
|
|
|
42843
42848
|
// src/commands/watch/consumeMarker.ts
|
|
42844
|
-
import { existsSync as
|
|
42849
|
+
import { existsSync as existsSync83, rmSync as rmSync9 } from "fs";
|
|
42845
42850
|
function consumeMarker(path109) {
|
|
42846
42851
|
try {
|
|
42847
|
-
if (!
|
|
42852
|
+
if (!existsSync83(path109)) return false;
|
|
42848
42853
|
rmSync9(path109);
|
|
42849
42854
|
return true;
|
|
42850
42855
|
} catch {
|
|
@@ -43178,17 +43183,17 @@ async function auth() {
|
|
|
43178
43183
|
|
|
43179
43184
|
// src/commands/roam/postRoamActivity.ts
|
|
43180
43185
|
import { execFileSync as execFileSync29 } from "child_process";
|
|
43181
|
-
import { readdirSync as
|
|
43182
|
-
import { join as
|
|
43186
|
+
import { readdirSync as readdirSync23, readFileSync as readFileSync65, statSync as statSync14 } from "fs";
|
|
43187
|
+
import { join as join100 } from "path";
|
|
43183
43188
|
function findPortFile(roamDir) {
|
|
43184
43189
|
let entries;
|
|
43185
43190
|
try {
|
|
43186
|
-
entries =
|
|
43191
|
+
entries = readdirSync23(roamDir);
|
|
43187
43192
|
} catch {
|
|
43188
43193
|
return void 0;
|
|
43189
43194
|
}
|
|
43190
43195
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
43191
|
-
const path109 =
|
|
43196
|
+
const path109 = join100(roamDir, name);
|
|
43192
43197
|
try {
|
|
43193
43198
|
return { path: path109, mtimeMs: statSync14(path109).mtimeMs };
|
|
43194
43199
|
} catch {
|
|
@@ -43205,7 +43210,7 @@ var PID_BY_APP = {
|
|
|
43205
43210
|
function postRoamActivity(app, event) {
|
|
43206
43211
|
const appData = process.env.APPDATA;
|
|
43207
43212
|
if (!appData) return;
|
|
43208
|
-
const portFile = findPortFile(
|
|
43213
|
+
const portFile = findPortFile(join100(appData, "Roam"));
|
|
43209
43214
|
if (!portFile) return;
|
|
43210
43215
|
let port;
|
|
43211
43216
|
try {
|
|
@@ -43391,7 +43396,7 @@ function link2() {
|
|
|
43391
43396
|
|
|
43392
43397
|
// src/commands/run/add.ts
|
|
43393
43398
|
import { mkdirSync as mkdirSync34, writeFileSync as writeFileSync52 } from "fs";
|
|
43394
|
-
import { join as
|
|
43399
|
+
import { join as join101 } from "path";
|
|
43395
43400
|
|
|
43396
43401
|
// src/commands/run/editRepoRunList.ts
|
|
43397
43402
|
async function editRepoRunList(repoName, cwd, edit2) {
|
|
@@ -43562,7 +43567,7 @@ function saveProjectRunConfig(entry) {
|
|
|
43562
43567
|
saveConfig(config);
|
|
43563
43568
|
}
|
|
43564
43569
|
function createCommandFile(name) {
|
|
43565
|
-
const dir =
|
|
43570
|
+
const dir = join101(".claude", "commands");
|
|
43566
43571
|
mkdirSync34(dir, { recursive: true });
|
|
43567
43572
|
const content = `---
|
|
43568
43573
|
description: Run ${name}
|
|
@@ -43570,7 +43575,7 @@ description: Run ${name}
|
|
|
43570
43575
|
|
|
43571
43576
|
Run \`assist run ${name} $ARGUMENTS 2>&1\`.
|
|
43572
43577
|
`;
|
|
43573
|
-
const filePath =
|
|
43578
|
+
const filePath = join101(dir, `${name}.md`);
|
|
43574
43579
|
writeFileSync52(filePath, content);
|
|
43575
43580
|
console.log(`Created command file: ${filePath}`);
|
|
43576
43581
|
}
|
|
@@ -43675,8 +43680,8 @@ function registerRunAdd(runCommand) {
|
|
|
43675
43680
|
}
|
|
43676
43681
|
|
|
43677
43682
|
// src/commands/run/remove.ts
|
|
43678
|
-
import { existsSync as
|
|
43679
|
-
import { join as
|
|
43683
|
+
import { existsSync as existsSync84, unlinkSync as unlinkSync19 } from "fs";
|
|
43684
|
+
import { join as join102 } from "path";
|
|
43680
43685
|
|
|
43681
43686
|
// src/commands/run/removeRepoRunConfig.ts
|
|
43682
43687
|
function isNamed(entry, name) {
|
|
@@ -43694,8 +43699,8 @@ function removeRepoRunConfig(name, repoName, cwd = process.cwd()) {
|
|
|
43694
43699
|
|
|
43695
43700
|
// src/commands/run/remove.ts
|
|
43696
43701
|
function deleteCommandFile(name) {
|
|
43697
|
-
const filePath =
|
|
43698
|
-
if (
|
|
43702
|
+
const filePath = join102(".claude", "commands", `${name}.md`);
|
|
43703
|
+
if (existsSync84(filePath)) {
|
|
43699
43704
|
unlinkSync19(filePath);
|
|
43700
43705
|
console.log(`Deleted command file: ${filePath}`);
|
|
43701
43706
|
}
|
|
@@ -44134,12 +44139,12 @@ function toSessionRunInfo({
|
|
|
44134
44139
|
}
|
|
44135
44140
|
|
|
44136
44141
|
// src/commands/sessions/daemon/worktree/joinRefusal.ts
|
|
44137
|
-
import { existsSync as
|
|
44142
|
+
import { existsSync as existsSync85 } from "fs";
|
|
44138
44143
|
function joinRefusal(session) {
|
|
44139
44144
|
if (session.commandType === "run") return "a server run has no agent stream";
|
|
44140
44145
|
if (session.closing === true) return "the session is closing";
|
|
44141
44146
|
if (!session.cwd) return "the session has no working directory";
|
|
44142
|
-
if (!
|
|
44147
|
+
if (!existsSync85(session.cwd))
|
|
44143
44148
|
return "the session's workspace no longer exists";
|
|
44144
44149
|
return void 0;
|
|
44145
44150
|
}
|
|
@@ -44605,11 +44610,11 @@ function sessionBase(id, status2) {
|
|
|
44605
44610
|
}
|
|
44606
44611
|
|
|
44607
44612
|
// src/commands/sessions/daemon/spawnPty.ts
|
|
44608
|
-
import { existsSync as
|
|
44613
|
+
import { existsSync as existsSync87 } from "fs";
|
|
44609
44614
|
import * as pty from "node-pty";
|
|
44610
44615
|
|
|
44611
44616
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
44612
|
-
import { chmodSync, existsSync as
|
|
44617
|
+
import { chmodSync, existsSync as existsSync86, statSync as statSync15 } from "fs";
|
|
44613
44618
|
import { createRequire as createRequire3 } from "module";
|
|
44614
44619
|
import path105 from "path";
|
|
44615
44620
|
var require4 = createRequire3(import.meta.url);
|
|
@@ -44624,7 +44629,7 @@ function ensureSpawnHelperExecutable() {
|
|
|
44624
44629
|
`${process.platform}-${process.arch}`,
|
|
44625
44630
|
"spawn-helper"
|
|
44626
44631
|
);
|
|
44627
|
-
if (!
|
|
44632
|
+
if (!existsSync86(helper)) return;
|
|
44628
44633
|
const mode = statSync15(helper).mode;
|
|
44629
44634
|
if ((mode & 73) === 0) chmodSync(helper, mode | 493);
|
|
44630
44635
|
}
|
|
@@ -44680,7 +44685,7 @@ function spawnPty(args, cwd, sessionId, extraEnv) {
|
|
|
44680
44685
|
});
|
|
44681
44686
|
}
|
|
44682
44687
|
function refuseMissingCwd(cwd, sessionId) {
|
|
44683
|
-
if (!cwd ||
|
|
44688
|
+
if (!cwd || existsSync87(cwd)) return;
|
|
44684
44689
|
daemonLog(
|
|
44685
44690
|
`${sessionId ? `session ${sessionId}` : "pty"} not spawned: working directory ${cwd} no longer exists`
|
|
44686
44691
|
);
|
|
@@ -44850,7 +44855,7 @@ function createRunSession(id, { runName, runArgs, cwd, meta }) {
|
|
|
44850
44855
|
}
|
|
44851
44856
|
|
|
44852
44857
|
// src/commands/sessions/daemon/autoUpdate/autoUpdateControl.ts
|
|
44853
|
-
import { existsSync as
|
|
44858
|
+
import { existsSync as existsSync88, rmSync as rmSync10, writeFileSync as writeFileSync54 } from "fs";
|
|
44854
44859
|
var paused;
|
|
44855
44860
|
var wake;
|
|
44856
44861
|
function persist2(value) {
|
|
@@ -44862,7 +44867,7 @@ function persist2(value) {
|
|
|
44862
44867
|
}
|
|
44863
44868
|
var autoUpdateControl = {
|
|
44864
44869
|
paused: () => {
|
|
44865
|
-
paused ??=
|
|
44870
|
+
paused ??= existsSync88(daemonPaths.autoUpdatePaused);
|
|
44866
44871
|
return paused;
|
|
44867
44872
|
},
|
|
44868
44873
|
setPaused: (value) => {
|
|
@@ -45305,17 +45310,17 @@ function setStatus2(session, newStatus) {
|
|
|
45305
45310
|
}
|
|
45306
45311
|
|
|
45307
45312
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
45308
|
-
import { existsSync as
|
|
45313
|
+
import { existsSync as existsSync90 } from "fs";
|
|
45309
45314
|
import { basename as basename32 } from "path";
|
|
45310
45315
|
|
|
45311
45316
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
45312
|
-
import { existsSync as
|
|
45313
|
-
import { join as
|
|
45317
|
+
import { existsSync as existsSync89 } from "fs";
|
|
45318
|
+
import { join as join105 } from "path";
|
|
45314
45319
|
|
|
45315
45320
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
45316
45321
|
import { statSync as statSync16 } from "fs";
|
|
45317
45322
|
import { rm as rm3 } from "fs/promises";
|
|
45318
|
-
import { join as
|
|
45323
|
+
import { join as join104 } from "path";
|
|
45319
45324
|
async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
45320
45325
|
if (holdsAGitDirectoryRatherThanALink(worktreePath)) {
|
|
45321
45326
|
const refusal = "it is a clone of its own, not a linked worktree";
|
|
@@ -45343,7 +45348,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
|
45343
45348
|
return { removed: true };
|
|
45344
45349
|
}
|
|
45345
45350
|
function holdsAGitDirectoryRatherThanALink(worktreePath) {
|
|
45346
|
-
return statSync16(
|
|
45351
|
+
return statSync16(join104(worktreePath, ".git"), {
|
|
45347
45352
|
throwIfNoEntry: false
|
|
45348
45353
|
})?.isDirectory() === true;
|
|
45349
45354
|
}
|
|
@@ -45379,7 +45384,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
45379
45384
|
);
|
|
45380
45385
|
}
|
|
45381
45386
|
function strandedReason(worktreePath, cause) {
|
|
45382
|
-
if (!
|
|
45387
|
+
if (!existsSync89(join105(worktreePath, ".git")))
|
|
45383
45388
|
return "its .git link is already gone";
|
|
45384
45389
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
45385
45390
|
return "git no longer recognises it as a working tree";
|
|
@@ -45431,7 +45436,7 @@ function reason3(error) {
|
|
|
45431
45436
|
|
|
45432
45437
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
45433
45438
|
async function reapWorktree(worktreePath, force = false) {
|
|
45434
|
-
if (!
|
|
45439
|
+
if (!existsSync90(worktreePath)) {
|
|
45435
45440
|
forgetWorktree(worktreePath);
|
|
45436
45441
|
daemonLog(
|
|
45437
45442
|
`worktree ${worktreePath} already gone; its record was forgotten`
|
|
@@ -45456,7 +45461,7 @@ async function reapWorktree(worktreePath, force = false) {
|
|
|
45456
45461
|
}
|
|
45457
45462
|
function owningClone(worktreePath) {
|
|
45458
45463
|
const recorded = worktreeAttributionIncludingReaped(worktreePath)?.clone;
|
|
45459
|
-
if (recorded &&
|
|
45464
|
+
if (recorded && existsSync90(recorded)) return recorded;
|
|
45460
45465
|
const detected = mainWorktree(worktreePath);
|
|
45461
45466
|
if (detected) return detected;
|
|
45462
45467
|
daemonLog(
|
|
@@ -45585,12 +45590,12 @@ function closeGateApplies(sessions, session) {
|
|
|
45585
45590
|
}
|
|
45586
45591
|
|
|
45587
45592
|
// src/commands/sessions/daemon/worktree/liveProcessesInTree.ts
|
|
45588
|
-
import { readdirSync as
|
|
45593
|
+
import { readdirSync as readdirSync24, readlinkSync } from "fs";
|
|
45589
45594
|
import { sep as sep4 } from "path";
|
|
45590
45595
|
function liveProcessesInTree(treePath, procRoot = "/proc") {
|
|
45591
45596
|
let entries;
|
|
45592
45597
|
try {
|
|
45593
|
-
entries =
|
|
45598
|
+
entries = readdirSync24(procRoot);
|
|
45594
45599
|
} catch {
|
|
45595
45600
|
return [];
|
|
45596
45601
|
}
|
|
@@ -45657,12 +45662,12 @@ async function closeBlockReason(sessionId, tree) {
|
|
|
45657
45662
|
}
|
|
45658
45663
|
|
|
45659
45664
|
// src/commands/sessions/daemon/worktree/watchGitState.ts
|
|
45660
|
-
import { existsSync as
|
|
45665
|
+
import { existsSync as existsSync91, watch } from "fs";
|
|
45661
45666
|
var DEBOUNCE_MS = 500;
|
|
45662
45667
|
var POLL_MS3 = 3e4;
|
|
45663
45668
|
function watchGitState(cwd, onChange) {
|
|
45664
45669
|
const common = gitCommonDir(cwd);
|
|
45665
|
-
if (!common || !
|
|
45670
|
+
if (!common || !existsSync91(common)) return void 0;
|
|
45666
45671
|
const watchers = [
|
|
45667
45672
|
watchGitDir(common, onChange),
|
|
45668
45673
|
pollGitState(cwd, onChange)
|
|
@@ -46310,10 +46315,10 @@ function emitSessionOutput(session, clients, data) {
|
|
|
46310
46315
|
}
|
|
46311
46316
|
|
|
46312
46317
|
// src/commands/sessions/daemon/exitReason.ts
|
|
46313
|
-
import { existsSync as
|
|
46318
|
+
import { existsSync as existsSync92 } from "fs";
|
|
46314
46319
|
import { resolve as resolve29 } from "path";
|
|
46315
46320
|
function exitDetail(session) {
|
|
46316
|
-
if (session.cwd && !
|
|
46321
|
+
if (session.cwd && !existsSync92(session.cwd))
|
|
46317
46322
|
return `working directory ${session.cwd} no longer exists`;
|
|
46318
46323
|
return missingRunConfigCwd(session);
|
|
46319
46324
|
}
|
|
@@ -46327,7 +46332,7 @@ function missingRunConfigCwd(session) {
|
|
|
46327
46332
|
const config = resolveRunConfig(session.runName, dir);
|
|
46328
46333
|
if (!config?.cwd) return void 0;
|
|
46329
46334
|
const configured = resolve29(runConfigBaseDirFrom(dir), config.cwd);
|
|
46330
|
-
if (
|
|
46335
|
+
if (existsSync92(configured)) return void 0;
|
|
46331
46336
|
return `run config "${config.name}": cwd ${configured} does not exist`;
|
|
46332
46337
|
}
|
|
46333
46338
|
|
|
@@ -46375,7 +46380,7 @@ function handleRefusedRun(session, exitCode, onStatusChange) {
|
|
|
46375
46380
|
}
|
|
46376
46381
|
|
|
46377
46382
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
46378
|
-
import { existsSync as
|
|
46383
|
+
import { existsSync as existsSync93, mkdirSync as mkdirSync36, watch as watch2 } from "fs";
|
|
46379
46384
|
import { dirname as dirname44 } from "path";
|
|
46380
46385
|
|
|
46381
46386
|
// src/commands/sessions/daemon/applyActivityToSession.ts
|
|
@@ -46461,7 +46466,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
46461
46466
|
if (timer) clearTimeout(timer);
|
|
46462
46467
|
timer = setTimeout(read3, DEBOUNCE_MS2);
|
|
46463
46468
|
});
|
|
46464
|
-
if (
|
|
46469
|
+
if (existsSync93(path109)) read3();
|
|
46465
46470
|
}
|
|
46466
46471
|
function refreshActivity(session) {
|
|
46467
46472
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -48500,7 +48505,7 @@ function rearmStoppedSessions(sessions, notify2) {
|
|
|
48500
48505
|
}
|
|
48501
48506
|
|
|
48502
48507
|
// src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
|
|
48503
|
-
import { existsSync as
|
|
48508
|
+
import { existsSync as existsSync96 } from "fs";
|
|
48504
48509
|
import { basename as basename34 } from "path";
|
|
48505
48510
|
|
|
48506
48511
|
// src/commands/sessions/daemon/worktree/accountedTrees.ts
|
|
@@ -48521,9 +48526,9 @@ function accountedTrees(sessions) {
|
|
|
48521
48526
|
}
|
|
48522
48527
|
|
|
48523
48528
|
// src/commands/sessions/daemon/worktree/reclaimVanishedWorktrees.ts
|
|
48524
|
-
import { existsSync as
|
|
48529
|
+
import { existsSync as existsSync95 } from "fs";
|
|
48525
48530
|
async function reclaimVanishedWorktrees(clone, paths) {
|
|
48526
|
-
if (!
|
|
48531
|
+
if (!existsSync95(clone)) {
|
|
48527
48532
|
for (const { path: path109 } of paths) forgetWorktree(path109);
|
|
48528
48533
|
daemonLog(
|
|
48529
48534
|
`clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
|
|
@@ -48689,7 +48694,7 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
|
48689
48694
|
);
|
|
48690
48695
|
continue;
|
|
48691
48696
|
}
|
|
48692
|
-
if (!
|
|
48697
|
+
if (!existsSync96(path109)) {
|
|
48693
48698
|
logVanishedTree(sessions, path109);
|
|
48694
48699
|
vanished.set(clone, [
|
|
48695
48700
|
...vanished.get(clone) ?? [],
|
|
@@ -49765,7 +49770,7 @@ function spawnAssistInTree(ctx, assistArgs, cwd, meta, context) {
|
|
|
49765
49770
|
}
|
|
49766
49771
|
|
|
49767
49772
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
49768
|
-
import { existsSync as
|
|
49773
|
+
import { existsSync as existsSync99 } from "fs";
|
|
49769
49774
|
|
|
49770
49775
|
// src/commands/sessions/daemon/resumeSession.ts
|
|
49771
49776
|
function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
@@ -49796,11 +49801,11 @@ function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
|
49796
49801
|
}
|
|
49797
49802
|
|
|
49798
49803
|
// src/commands/sessions/daemon/worktree/resumeInReplacementTree.ts
|
|
49799
|
-
import { existsSync as
|
|
49804
|
+
import { existsSync as existsSync98 } from "fs";
|
|
49800
49805
|
|
|
49801
49806
|
// src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
|
|
49802
|
-
import { copyFileSync as copyFileSync5, existsSync as
|
|
49803
|
-
import { join as
|
|
49807
|
+
import { copyFileSync as copyFileSync5, existsSync as existsSync97, mkdirSync as mkdirSync38 } from "fs";
|
|
49808
|
+
import { join as join107 } from "path";
|
|
49804
49809
|
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
49805
49810
|
const dir = projectDirForCwd(toCwd);
|
|
49806
49811
|
if (dir === projectDirForCwd(fromCwd)) {
|
|
@@ -49809,8 +49814,8 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
49809
49814
|
);
|
|
49810
49815
|
return;
|
|
49811
49816
|
}
|
|
49812
|
-
const dest =
|
|
49813
|
-
if (
|
|
49817
|
+
const dest = join107(dir, `${claudeSessionId}.jsonl`);
|
|
49818
|
+
if (existsSync97(dest)) {
|
|
49814
49819
|
daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
|
|
49815
49820
|
return;
|
|
49816
49821
|
}
|
|
@@ -49861,7 +49866,7 @@ function resumeInReplacementTree(ctx, claudeSessionId, missingCwd, name, harness
|
|
|
49861
49866
|
}
|
|
49862
49867
|
function cloneForReapedTree(missingCwd) {
|
|
49863
49868
|
const clone = worktreeAttributionIncludingReaped(missingCwd)?.clone;
|
|
49864
|
-
if (!clone || !
|
|
49869
|
+
if (!clone || !existsSync98(clone))
|
|
49865
49870
|
throw new Error(
|
|
49866
49871
|
`working directory no longer exists and no clone is recorded to re-allocate from: ${missingCwd}`
|
|
49867
49872
|
);
|
|
@@ -49870,7 +49875,7 @@ function cloneForReapedTree(missingCwd) {
|
|
|
49870
49875
|
|
|
49871
49876
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
49872
49877
|
function resumeInTree(ctx, sessionId, cwd, name, harness) {
|
|
49873
|
-
if (!
|
|
49878
|
+
if (!existsSync99(cwd))
|
|
49874
49879
|
return resumeInReplacementTree(ctx, sessionId, cwd, name, harness);
|
|
49875
49880
|
const id = ctx.spawnWith(
|
|
49876
49881
|
(sid) => resumeSession(sid, sessionId, cwd, name, void 0, harness)
|
|
@@ -50833,7 +50838,7 @@ var sessionSettingHandlers = {
|
|
|
50833
50838
|
|
|
50834
50839
|
// src/commands/sessions/daemon/worktree/prCheckoutHolder.ts
|
|
50835
50840
|
import { execFile as execFile14 } from "child_process";
|
|
50836
|
-
import { existsSync as
|
|
50841
|
+
import { existsSync as existsSync100 } from "fs";
|
|
50837
50842
|
function prHeadBranch2(number, cwd) {
|
|
50838
50843
|
return new Promise((resolve30) => {
|
|
50839
50844
|
execFile14(
|
|
@@ -50846,12 +50851,12 @@ function prHeadBranch2(number, cwd) {
|
|
|
50846
50851
|
}
|
|
50847
50852
|
async function prCheckoutHolder(assistArgs, cwd) {
|
|
50848
50853
|
const number = prCheckoutNumber(assistArgs);
|
|
50849
|
-
if (!number || !cwd || !
|
|
50854
|
+
if (!number || !cwd || !existsSync100(cwd)) return void 0;
|
|
50850
50855
|
const headRef = await prHeadBranch2(number, cwd);
|
|
50851
50856
|
if (!headRef) return void 0;
|
|
50852
50857
|
const listing = await gitOrNull(cwd, ["worktree", "list", "--porcelain"]);
|
|
50853
50858
|
const holder = listing ? worktreeWithBranch(listing, headRef) : null;
|
|
50854
|
-
if (!holder || !
|
|
50859
|
+
if (!holder || !existsSync100(holder)) return void 0;
|
|
50855
50860
|
daemonLog(
|
|
50856
50861
|
`pr #${number} assist ${assistArgs[0]} launched in its checkout ${holder}: head branch ${headRef} is already checked out there, so no worktree is allocated`
|
|
50857
50862
|
);
|