@staff0rd/assist 0.766.3 → 0.767.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/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +225 -202
- 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.767.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -10547,6 +10547,35 @@ function isGitRepo(dir) {
|
|
|
10547
10547
|
}
|
|
10548
10548
|
}
|
|
10549
10549
|
|
|
10550
|
+
// src/shared/sweepStagedAttachments.ts
|
|
10551
|
+
import { readdirSync as readdirSync4, rmSync as rmSync3, statSync as statSync3 } from "fs";
|
|
10552
|
+
import { join as join35 } from "path";
|
|
10553
|
+
|
|
10554
|
+
// src/shared/stagedAttachmentsDir.ts
|
|
10555
|
+
import { homedir as homedir13 } from "os";
|
|
10556
|
+
import { join as join34 } from "path";
|
|
10557
|
+
var stagedAttachmentsDir = join34(homedir13(), ".assist", "attachments");
|
|
10558
|
+
|
|
10559
|
+
// src/shared/sweepStagedAttachments.ts
|
|
10560
|
+
var PANE_PERSIST_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
10561
|
+
function sweepStagedAttachments(dir = stagedAttachmentsDir, now = Date.now()) {
|
|
10562
|
+
let entries;
|
|
10563
|
+
try {
|
|
10564
|
+
entries = readdirSync4(dir);
|
|
10565
|
+
} catch {
|
|
10566
|
+
return;
|
|
10567
|
+
}
|
|
10568
|
+
for (const name of entries) {
|
|
10569
|
+
if (!name.startsWith("upload-")) continue;
|
|
10570
|
+
const path106 = join35(dir, name);
|
|
10571
|
+
try {
|
|
10572
|
+
if (now - statSync3(path106).mtimeMs > PANE_PERSIST_TTL_MS)
|
|
10573
|
+
rmSync3(path106, { recursive: true, force: true });
|
|
10574
|
+
} catch {
|
|
10575
|
+
}
|
|
10576
|
+
}
|
|
10577
|
+
}
|
|
10578
|
+
|
|
10550
10579
|
// src/shared/web.ts
|
|
10551
10580
|
import {
|
|
10552
10581
|
createServer
|
|
@@ -10694,7 +10723,7 @@ import {
|
|
|
10694
10723
|
closeSync as closeSync2,
|
|
10695
10724
|
mkdirSync as mkdirSync10,
|
|
10696
10725
|
openSync as openSync3,
|
|
10697
|
-
statSync as
|
|
10726
|
+
statSync as statSync4,
|
|
10698
10727
|
unlinkSync as unlinkSync6,
|
|
10699
10728
|
writeSync
|
|
10700
10729
|
} from "fs";
|
|
@@ -10743,7 +10772,7 @@ function tryCreateLock() {
|
|
|
10743
10772
|
}
|
|
10744
10773
|
function isLockStale() {
|
|
10745
10774
|
try {
|
|
10746
|
-
return Date.now() -
|
|
10775
|
+
return Date.now() - statSync4(daemonPaths.spawnLock).mtimeMs > STALE_LOCK_MS;
|
|
10747
10776
|
} catch {
|
|
10748
10777
|
return true;
|
|
10749
10778
|
}
|
|
@@ -10883,13 +10912,13 @@ function gitCommonDir(cwd) {
|
|
|
10883
10912
|
|
|
10884
10913
|
// src/shared/loadJson.ts
|
|
10885
10914
|
import { existsSync as existsSync32, mkdirSync as mkdirSync11, readFileSync as readFileSync20, writeFileSync as writeFileSync21 } from "fs";
|
|
10886
|
-
import { homedir as
|
|
10887
|
-
import { join as
|
|
10915
|
+
import { homedir as homedir14 } from "os";
|
|
10916
|
+
import { join as join36 } from "path";
|
|
10888
10917
|
function getStoreDir() {
|
|
10889
|
-
return process.env.ASSIST_STORE_DIR ||
|
|
10918
|
+
return process.env.ASSIST_STORE_DIR || join36(homedir14(), ".assist");
|
|
10890
10919
|
}
|
|
10891
10920
|
function getStorePath(filename) {
|
|
10892
|
-
return
|
|
10921
|
+
return join36(getStoreDir(), filename);
|
|
10893
10922
|
}
|
|
10894
10923
|
function loadJson(filename) {
|
|
10895
10924
|
const path106 = getStorePath(filename);
|
|
@@ -11258,14 +11287,14 @@ function attachSessionSocket(server, ctx) {
|
|
|
11258
11287
|
|
|
11259
11288
|
// src/shared/createBundleHandler.ts
|
|
11260
11289
|
import { createHash } from "crypto";
|
|
11261
|
-
import { readFileSync as readFileSync21, statSync as
|
|
11262
|
-
import { dirname as dirname21, join as
|
|
11290
|
+
import { readFileSync as readFileSync21, statSync as statSync5 } from "fs";
|
|
11291
|
+
import { dirname as dirname21, join as join37 } from "path";
|
|
11263
11292
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
11264
11293
|
function createBundleHandler(importMetaUrl, bundlePath, contentType = "application/javascript") {
|
|
11265
|
-
const file =
|
|
11294
|
+
const file = join37(dirname21(fileURLToPath4(importMetaUrl)), bundlePath);
|
|
11266
11295
|
let cache6;
|
|
11267
11296
|
return (req, res) => {
|
|
11268
|
-
const mtimeMs =
|
|
11297
|
+
const mtimeMs = statSync5(file).mtimeMs;
|
|
11269
11298
|
if (cache6?.mtimeMs !== mtimeMs) {
|
|
11270
11299
|
const body = readFileSync21(file, "utf8");
|
|
11271
11300
|
const etag = `"${createHash("sha256").update(body).digest("hex").slice(0, 16)}"`;
|
|
@@ -13323,19 +13352,19 @@ function handleServerRuns(req, res) {
|
|
|
13323
13352
|
// src/commands/sessions/web/getReviewSynthesis.ts
|
|
13324
13353
|
import { execFile as execFile6 } from "child_process";
|
|
13325
13354
|
import { readFileSync as readFileSync22 } from "fs";
|
|
13326
|
-
import { homedir as
|
|
13327
|
-
import { basename as basename11, join as
|
|
13355
|
+
import { homedir as homedir15 } from "os";
|
|
13356
|
+
import { basename as basename11, join as join39 } from "path";
|
|
13328
13357
|
import { promisify as promisify5 } from "util";
|
|
13329
13358
|
|
|
13330
13359
|
// src/commands/sessions/web/findSynthesisForBranch.ts
|
|
13331
|
-
import { existsSync as existsSync35, readdirSync as
|
|
13332
|
-
import { basename as basename10, dirname as dirname22, join as
|
|
13360
|
+
import { existsSync as existsSync35, readdirSync as readdirSync5, statSync as statSync6 } from "fs";
|
|
13361
|
+
import { basename as basename10, dirname as dirname22, join as join38 } from "path";
|
|
13333
13362
|
function findSynthesisForBranch(repoReviewsDir, branch2) {
|
|
13334
|
-
const branchKeyPath =
|
|
13363
|
+
const branchKeyPath = join38(repoReviewsDir, `${branch2}-`);
|
|
13335
13364
|
const parent = dirname22(branchKeyPath);
|
|
13336
13365
|
const branchPrefix = basename10(branchKeyPath);
|
|
13337
13366
|
if (!existsSync35(parent)) return null;
|
|
13338
|
-
const synthesisFiles =
|
|
13367
|
+
const synthesisFiles = readdirSync5(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join38(parent, name, "synthesis.md")).filter((path106) => existsSync35(path106)).map((path106) => ({ path: path106, mtime: statSync6(path106).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
|
|
13339
13368
|
return synthesisFiles[0]?.path ?? null;
|
|
13340
13369
|
}
|
|
13341
13370
|
|
|
@@ -13353,8 +13382,8 @@ async function resolveSynthesisPath(cwd) {
|
|
|
13353
13382
|
runGit2(cwd, ["rev-parse", "--show-toplevel"]),
|
|
13354
13383
|
runGit2(cwd, ["rev-parse", "--abbrev-ref", "HEAD"])
|
|
13355
13384
|
]);
|
|
13356
|
-
const repoReviewsDir =
|
|
13357
|
-
|
|
13385
|
+
const repoReviewsDir = join39(
|
|
13386
|
+
homedir15(),
|
|
13358
13387
|
".assist",
|
|
13359
13388
|
"reviews",
|
|
13360
13389
|
basename11(repoRoot2)
|
|
@@ -14637,11 +14666,11 @@ function parseRulesSection(content) {
|
|
|
14637
14666
|
}
|
|
14638
14667
|
|
|
14639
14668
|
// src/commands/rules/scopeDirectory.ts
|
|
14640
|
-
import { existsSync as existsSync36, statSync as
|
|
14669
|
+
import { existsSync as existsSync36, statSync as statSync7 } from "fs";
|
|
14641
14670
|
import path25 from "path";
|
|
14642
14671
|
function scopeDirectory(target) {
|
|
14643
14672
|
const resolved = path25.resolve(target);
|
|
14644
|
-
return existsSync36(resolved) &&
|
|
14673
|
+
return existsSync36(resolved) && statSync7(resolved).isDirectory() ? resolved : path25.dirname(resolved);
|
|
14645
14674
|
}
|
|
14646
14675
|
|
|
14647
14676
|
// src/commands/rules/readScopedRules.ts
|
|
@@ -15167,13 +15196,6 @@ import { stat as stat3 } from "fs/promises";
|
|
|
15167
15196
|
|
|
15168
15197
|
// src/shared/isStagedAttachmentPath.ts
|
|
15169
15198
|
import { isAbsolute as isAbsolute3, relative as relative3, resolve as resolve12, sep } from "path";
|
|
15170
|
-
|
|
15171
|
-
// src/shared/stagedAttachmentsDir.ts
|
|
15172
|
-
import { homedir as homedir15 } from "os";
|
|
15173
|
-
import { join as join38 } from "path";
|
|
15174
|
-
var stagedAttachmentsDir = join38(homedir15(), ".assist", "attachments");
|
|
15175
|
-
|
|
15176
|
-
// src/shared/isStagedAttachmentPath.ts
|
|
15177
15199
|
function isStagedAttachmentPath(path106) {
|
|
15178
15200
|
const rel = relative3(stagedAttachmentsDir, resolve12(path106));
|
|
15179
15201
|
return rel !== "" && rel !== ".." && !rel.startsWith(`..${sep}`) && !isAbsolute3(rel);
|
|
@@ -15832,13 +15854,13 @@ import { existsSync as existsSync39 } from "fs";
|
|
|
15832
15854
|
// src/commands/run/resolveCommand.ts
|
|
15833
15855
|
import { execFileSync as execFileSync4 } from "child_process";
|
|
15834
15856
|
import { existsSync as existsSync38 } from "fs";
|
|
15835
|
-
import { dirname as dirname23, join as
|
|
15857
|
+
import { dirname as dirname23, join as join40, resolve as resolve13 } from "path";
|
|
15836
15858
|
function resolveCommand(command) {
|
|
15837
15859
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
15838
15860
|
try {
|
|
15839
15861
|
const gitPath = execFileSync4("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
15840
15862
|
const gitRoot = resolve13(dirname23(gitPath), "..");
|
|
15841
|
-
const gitBash =
|
|
15863
|
+
const gitBash = join40(gitRoot, "bin", "bash.exe");
|
|
15842
15864
|
if (existsSync38(gitBash)) return gitBash;
|
|
15843
15865
|
} catch {
|
|
15844
15866
|
return command;
|
|
@@ -16942,7 +16964,7 @@ async function readRequestBuffer(req, limit) {
|
|
|
16942
16964
|
|
|
16943
16965
|
// src/commands/sessions/web/stageAttachment.ts
|
|
16944
16966
|
import { mkdir as mkdir4, mkdtemp, writeFile as writeFile2 } from "fs/promises";
|
|
16945
|
-
import { extname as extname2, join as
|
|
16967
|
+
import { extname as extname2, join as join41 } from "path";
|
|
16946
16968
|
function extensionFromMime(contentType) {
|
|
16947
16969
|
const mime = contentType.split(";")[0].trim().toLowerCase();
|
|
16948
16970
|
const known = attachmentMimeTypes[mime];
|
|
@@ -16961,9 +16983,9 @@ function safeBaseName(name) {
|
|
|
16961
16983
|
}
|
|
16962
16984
|
async function stageAttachment(name, contentType, body) {
|
|
16963
16985
|
await mkdir4(stagedAttachmentsDir, { recursive: true });
|
|
16964
|
-
const dir = await mkdtemp(
|
|
16986
|
+
const dir = await mkdtemp(join41(stagedAttachmentsDir, "upload-"));
|
|
16965
16987
|
const alt = safeBaseName(name);
|
|
16966
|
-
const filePath =
|
|
16988
|
+
const filePath = join41(dir, `${alt}.${pickExtension(name, contentType)}`);
|
|
16967
16989
|
await writeFile2(filePath, body);
|
|
16968
16990
|
return { dir, filePath, alt };
|
|
16969
16991
|
}
|
|
@@ -17013,14 +17035,14 @@ import { readFile as readFile3, stat as stat4, writeFile as writeFile3 } from "f
|
|
|
17013
17035
|
// src/commands/sessions/web/formatWithOxfmt.ts
|
|
17014
17036
|
import { execFile as execFile10 } from "child_process";
|
|
17015
17037
|
import { existsSync as existsSync40 } from "fs";
|
|
17016
|
-
import { dirname as dirname24, join as
|
|
17038
|
+
import { dirname as dirname24, join as join42 } from "path";
|
|
17017
17039
|
import { promisify as promisify10 } from "util";
|
|
17018
17040
|
var execFileAsync9 = promisify10(execFile10);
|
|
17019
17041
|
var TIMEOUT_MS = 15e3;
|
|
17020
17042
|
function findOxfmtScript(root2) {
|
|
17021
17043
|
let dir = root2;
|
|
17022
17044
|
for (; ; ) {
|
|
17023
|
-
const candidate =
|
|
17045
|
+
const candidate = join42(dir, "node_modules", "oxfmt", "bin", "oxfmt");
|
|
17024
17046
|
if (existsSync40(candidate)) return candidate;
|
|
17025
17047
|
const parent = dirname24(dir);
|
|
17026
17048
|
if (parent === dir) return void 0;
|
|
@@ -17472,6 +17494,7 @@ async function web(options2) {
|
|
|
17472
17494
|
};
|
|
17473
17495
|
attachSessionSocket(server, ctx);
|
|
17474
17496
|
installRestartMenu();
|
|
17497
|
+
sweepStagedAttachments();
|
|
17475
17498
|
streamDaemonLogs();
|
|
17476
17499
|
void ensureDaemonRunning("web server start").catch((error) => {
|
|
17477
17500
|
console.error(
|
|
@@ -18548,12 +18571,12 @@ function findCliWrite(command) {
|
|
|
18548
18571
|
// src/shared/readSettingsPerms.ts
|
|
18549
18572
|
import { existsSync as existsSync42, readFileSync as readFileSync27 } from "fs";
|
|
18550
18573
|
import { homedir as homedir16 } from "os";
|
|
18551
|
-
import { join as
|
|
18574
|
+
import { join as join43 } from "path";
|
|
18552
18575
|
function readSettingsPerms(key) {
|
|
18553
18576
|
const paths = [
|
|
18554
|
-
|
|
18555
|
-
|
|
18556
|
-
|
|
18577
|
+
join43(homedir16(), ".claude", "settings.json"),
|
|
18578
|
+
join43(process.cwd(), ".claude", "settings.json"),
|
|
18579
|
+
join43(process.cwd(), ".claude", "settings.local.json")
|
|
18557
18580
|
];
|
|
18558
18581
|
const entries = [];
|
|
18559
18582
|
for (const p of paths) {
|
|
@@ -18777,11 +18800,11 @@ function decideCommand(toolName, rawCommand) {
|
|
|
18777
18800
|
// src/commands/cliHook/logDeniedToolCall.ts
|
|
18778
18801
|
import { mkdirSync as mkdirSync12 } from "fs";
|
|
18779
18802
|
import { homedir as homedir17 } from "os";
|
|
18780
|
-
import { join as
|
|
18803
|
+
import { join as join44 } from "path";
|
|
18781
18804
|
import Database from "better-sqlite3";
|
|
18782
18805
|
var _db;
|
|
18783
18806
|
function getDbDir() {
|
|
18784
|
-
return
|
|
18807
|
+
return join44(homedir17(), ".assist");
|
|
18785
18808
|
}
|
|
18786
18809
|
function initSchema(db) {
|
|
18787
18810
|
db.exec(`
|
|
@@ -18800,7 +18823,7 @@ function openPromptsDb(dir) {
|
|
|
18800
18823
|
if (_db) return _db;
|
|
18801
18824
|
const dbDir = dir ?? getDbDir();
|
|
18802
18825
|
mkdirSync12(dbDir, { recursive: true });
|
|
18803
|
-
const db = new Database(
|
|
18826
|
+
const db = new Database(join44(dbDir, "assist.db"));
|
|
18804
18827
|
db.pragma("journal_mode = WAL");
|
|
18805
18828
|
initSchema(db);
|
|
18806
18829
|
_db = db;
|
|
@@ -18921,7 +18944,7 @@ ${reasons.join("\n")}`);
|
|
|
18921
18944
|
// src/commands/permitCliReads.ts
|
|
18922
18945
|
import { existsSync as existsSync43, mkdirSync as mkdirSync13, readFileSync as readFileSync28, writeFileSync as writeFileSync23 } from "fs";
|
|
18923
18946
|
import { homedir as homedir18 } from "os";
|
|
18924
|
-
import { join as
|
|
18947
|
+
import { join as join45 } from "path";
|
|
18925
18948
|
|
|
18926
18949
|
// src/commands/permitCliReads/assertCliExists.ts
|
|
18927
18950
|
function assertCliExists(cli) {
|
|
@@ -19184,7 +19207,7 @@ function updateSettings(cli, commands) {
|
|
|
19184
19207
|
// src/commands/permitCliReads.ts
|
|
19185
19208
|
function logPath(cli) {
|
|
19186
19209
|
const safeName = cli.replace(/\s+/g, "-");
|
|
19187
|
-
return
|
|
19210
|
+
return join45(homedir18(), ".assist", `cli-discover-${safeName}.log`);
|
|
19188
19211
|
}
|
|
19189
19212
|
function readCache(cli) {
|
|
19190
19213
|
const path106 = logPath(cli);
|
|
@@ -19192,7 +19215,7 @@ function readCache(cli) {
|
|
|
19192
19215
|
return readFileSync28(path106, "utf8");
|
|
19193
19216
|
}
|
|
19194
19217
|
function writeCache(cli, output) {
|
|
19195
|
-
const dir =
|
|
19218
|
+
const dir = join45(homedir18(), ".assist");
|
|
19196
19219
|
mkdirSync13(dir, { recursive: true });
|
|
19197
19220
|
writeFileSync23(logPath(cli), output);
|
|
19198
19221
|
}
|
|
@@ -19357,30 +19380,30 @@ function isHashCommentFile(filePath) {
|
|
|
19357
19380
|
|
|
19358
19381
|
// src/commands/codeComment/getRestrictedDir.ts
|
|
19359
19382
|
import { homedir as homedir19 } from "os";
|
|
19360
|
-
import { join as
|
|
19383
|
+
import { join as join46 } from "path";
|
|
19361
19384
|
function getRestrictedDir() {
|
|
19362
|
-
return
|
|
19385
|
+
return join46(homedir19(), ".assist", "restricted");
|
|
19363
19386
|
}
|
|
19364
19387
|
function getPinStatePath(pin2) {
|
|
19365
|
-
return
|
|
19388
|
+
return join46(getRestrictedDir(), `code-comment-${pin2}.json`);
|
|
19366
19389
|
}
|
|
19367
19390
|
|
|
19368
19391
|
// src/commands/codeComment/sweepRestrictedDir.ts
|
|
19369
|
-
import { readdirSync as
|
|
19370
|
-
import { join as
|
|
19392
|
+
import { readdirSync as readdirSync6, statSync as statSync8, unlinkSync as unlinkSync7 } from "fs";
|
|
19393
|
+
import { join as join47 } from "path";
|
|
19371
19394
|
var STALE_AFTER_MS = 30 * 60 * 1e3;
|
|
19372
19395
|
function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
19373
19396
|
let entries;
|
|
19374
19397
|
try {
|
|
19375
|
-
entries =
|
|
19398
|
+
entries = readdirSync6(dir);
|
|
19376
19399
|
} catch {
|
|
19377
19400
|
return;
|
|
19378
19401
|
}
|
|
19379
19402
|
const cutoff = Date.now() - STALE_AFTER_MS;
|
|
19380
19403
|
for (const entry of entries) {
|
|
19381
|
-
const path106 =
|
|
19404
|
+
const path106 = join47(dir, entry);
|
|
19382
19405
|
try {
|
|
19383
|
-
if (
|
|
19406
|
+
if (statSync8(path106).mtimeMs < cutoff) unlinkSync7(path106);
|
|
19384
19407
|
} catch {
|
|
19385
19408
|
continue;
|
|
19386
19409
|
}
|
|
@@ -21032,18 +21055,18 @@ import chalk137 from "chalk";
|
|
|
21032
21055
|
|
|
21033
21056
|
// src/commands/criteriaExtension/criteriaExtensionDir.ts
|
|
21034
21057
|
import { existsSync as existsSync46 } from "fs";
|
|
21035
|
-
import { dirname as dirname26, join as
|
|
21058
|
+
import { dirname as dirname26, join as join48 } from "path";
|
|
21036
21059
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
21037
21060
|
var moduleDir = dirname26(fileURLToPath6(import.meta.url));
|
|
21038
21061
|
function criteriaExtensionDir() {
|
|
21039
|
-
const bundled =
|
|
21062
|
+
const bundled = join48(
|
|
21040
21063
|
moduleDir,
|
|
21041
21064
|
"commands",
|
|
21042
21065
|
"criteriaExtension",
|
|
21043
21066
|
"criteria-extension"
|
|
21044
21067
|
);
|
|
21045
21068
|
if (existsSync46(bundled)) return bundled;
|
|
21046
|
-
return
|
|
21069
|
+
return join48(moduleDir, "..", "..", "..", "criteria-extension");
|
|
21047
21070
|
}
|
|
21048
21071
|
|
|
21049
21072
|
// src/commands/criteriaExtension/criteriaExtension.ts
|
|
@@ -21072,15 +21095,15 @@ async function criteriaExtension() {
|
|
|
21072
21095
|
// src/commands/criteriaExtension/signCriteriaExtension.ts
|
|
21073
21096
|
import { rm as rm2 } from "fs/promises";
|
|
21074
21097
|
import { homedir as homedir20, tmpdir as tmpdir3 } from "os";
|
|
21075
|
-
import { join as
|
|
21098
|
+
import { join as join54 } from "path";
|
|
21076
21099
|
import chalk139 from "chalk";
|
|
21077
21100
|
|
|
21078
21101
|
// src/commands/criteriaExtension/copySignedXpi.ts
|
|
21079
21102
|
import { copyFile } from "fs/promises";
|
|
21080
|
-
import { join as
|
|
21103
|
+
import { join as join49 } from "path";
|
|
21081
21104
|
var SIGNED_XPI_NAME = "criteria-extension.xpi";
|
|
21082
21105
|
async function copySignedXpi(xpi, dir) {
|
|
21083
|
-
const fixed2 =
|
|
21106
|
+
const fixed2 = join49(dir, SIGNED_XPI_NAME);
|
|
21084
21107
|
if (fixed2 === xpi) return fixed2;
|
|
21085
21108
|
await copyFile(xpi, fixed2);
|
|
21086
21109
|
return fixed2;
|
|
@@ -21089,11 +21112,11 @@ async function copySignedXpi(xpi, dir) {
|
|
|
21089
21112
|
// src/commands/criteriaExtension/findSignedXpi.ts
|
|
21090
21113
|
import { existsSync as existsSync47 } from "fs";
|
|
21091
21114
|
import { readdir } from "fs/promises";
|
|
21092
|
-
import { join as
|
|
21115
|
+
import { join as join50 } from "path";
|
|
21093
21116
|
async function findSignedXpi(dir) {
|
|
21094
21117
|
if (!existsSync47(dir)) return null;
|
|
21095
21118
|
const name = (await readdir(dir)).find((entry) => entry.endsWith(".xpi"));
|
|
21096
|
-
return name ?
|
|
21119
|
+
return name ? join50(dir, name) : null;
|
|
21097
21120
|
}
|
|
21098
21121
|
|
|
21099
21122
|
// src/commands/criteriaExtension/signedAddonInstallPath.ts
|
|
@@ -21116,10 +21139,10 @@ async function signedAddonInstallPath(xpi) {
|
|
|
21116
21139
|
|
|
21117
21140
|
// src/commands/criteriaExtension/signPreflightProblem.ts
|
|
21118
21141
|
import { existsSync as existsSync48 } from "fs";
|
|
21119
|
-
import { join as
|
|
21142
|
+
import { join as join51 } from "path";
|
|
21120
21143
|
var KEY_URL = "https://addons.mozilla.org/en-US/developers/addon/api/key/";
|
|
21121
21144
|
function signPreflightProblem(source) {
|
|
21122
|
-
if (!existsSync48(
|
|
21145
|
+
if (!existsSync48(join51(source, "content.js")))
|
|
21123
21146
|
return {
|
|
21124
21147
|
message: `no content.js in ${source}`,
|
|
21125
21148
|
hint: "run npm run build to bundle the content script"
|
|
@@ -21134,7 +21157,7 @@ function signPreflightProblem(source) {
|
|
|
21134
21157
|
|
|
21135
21158
|
// src/commands/criteriaExtension/stageCriteriaExtension.ts
|
|
21136
21159
|
import { cp as cp3, mkdir as mkdir5, readFile as readFile4, rm, writeFile as writeFile4 } from "fs/promises";
|
|
21137
|
-
import { basename as basename13, join as
|
|
21160
|
+
import { basename as basename13, join as join52 } from "path";
|
|
21138
21161
|
|
|
21139
21162
|
// src/commands/criteriaExtension/stampManifestVersion.ts
|
|
21140
21163
|
function stampManifestVersion(manifest, version2) {
|
|
@@ -21151,7 +21174,7 @@ async function stageCriteriaExtension(source, staging, version2) {
|
|
|
21151
21174
|
recursive: true,
|
|
21152
21175
|
filter: (path106) => basename13(path106) !== "updates.json"
|
|
21153
21176
|
});
|
|
21154
|
-
const manifest =
|
|
21177
|
+
const manifest = join52(staging, "manifest.json");
|
|
21155
21178
|
const stamped = stampManifestVersion(
|
|
21156
21179
|
await readFile4(manifest, "utf8"),
|
|
21157
21180
|
version2
|
|
@@ -21161,7 +21184,7 @@ async function stageCriteriaExtension(source, staging, version2) {
|
|
|
21161
21184
|
|
|
21162
21185
|
// src/commands/criteriaExtension/writeUpdateManifest.ts
|
|
21163
21186
|
import { readFile as readFile5, writeFile as writeFile5 } from "fs/promises";
|
|
21164
|
-
import { join as
|
|
21187
|
+
import { join as join53 } from "path";
|
|
21165
21188
|
|
|
21166
21189
|
// src/commands/criteriaExtension/buildUpdateManifest.ts
|
|
21167
21190
|
var RELEASE_DOWNLOAD_URL = "https://github.com/staff0rd/assist/releases/download";
|
|
@@ -21186,17 +21209,17 @@ function buildUpdateManifest(manifest, version2) {
|
|
|
21186
21209
|
// src/commands/criteriaExtension/writeUpdateManifest.ts
|
|
21187
21210
|
async function writeUpdateManifest(source, dir, version2) {
|
|
21188
21211
|
await writeFile5(
|
|
21189
|
-
|
|
21212
|
+
join53(dir, "updates.json"),
|
|
21190
21213
|
buildUpdateManifest(
|
|
21191
|
-
await readFile5(
|
|
21214
|
+
await readFile5(join53(source, "manifest.json"), "utf8"),
|
|
21192
21215
|
version2
|
|
21193
21216
|
)
|
|
21194
21217
|
);
|
|
21195
21218
|
}
|
|
21196
21219
|
|
|
21197
21220
|
// src/commands/criteriaExtension/signCriteriaExtension.ts
|
|
21198
|
-
var ARTIFACTS_DIR =
|
|
21199
|
-
var STAGING_DIR =
|
|
21221
|
+
var ARTIFACTS_DIR = join54(homedir20(), ".assist", "criteria-extension");
|
|
21222
|
+
var STAGING_DIR = join54(tmpdir3(), "assist-criteria-extension");
|
|
21200
21223
|
async function signCriteriaExtension() {
|
|
21201
21224
|
const source = criteriaExtensionDir();
|
|
21202
21225
|
const problem = signPreflightProblem(source);
|
|
@@ -21380,12 +21403,12 @@ import { unlinkSync as unlinkSync9, writeFileSync as writeFileSync26 } from "fs"
|
|
|
21380
21403
|
import chalk142 from "chalk";
|
|
21381
21404
|
|
|
21382
21405
|
// src/commands/dbMigration/getMigrationPinPath.ts
|
|
21383
|
-
import { join as
|
|
21406
|
+
import { join as join55 } from "path";
|
|
21384
21407
|
function getMigrationPinPath(pin2) {
|
|
21385
|
-
return
|
|
21408
|
+
return join55(getRestrictedDir(), `db-migration-pin-${pin2}.json`);
|
|
21386
21409
|
}
|
|
21387
21410
|
function getMigrationApprovalPath(migrationId) {
|
|
21388
|
-
return
|
|
21411
|
+
return join55(getRestrictedDir(), `db-migration-approval-${migrationId}.json`);
|
|
21389
21412
|
}
|
|
21390
21413
|
|
|
21391
21414
|
// src/commands/dbMigration/readMigrationPinState.ts
|
|
@@ -21523,10 +21546,10 @@ import { basename as basename15 } from "path";
|
|
|
21523
21546
|
|
|
21524
21547
|
// src/commands/devlog/loadBlogSkipDays.ts
|
|
21525
21548
|
import { homedir as homedir21 } from "os";
|
|
21526
|
-
import { join as
|
|
21527
|
-
var BLOG_REPO_ROOT =
|
|
21549
|
+
import { join as join56 } from "path";
|
|
21550
|
+
var BLOG_REPO_ROOT = join56(homedir21(), "git/blog");
|
|
21528
21551
|
function loadBlogSkipDays(repoName) {
|
|
21529
|
-
const config = loadRawYaml(
|
|
21552
|
+
const config = loadRawYaml(join56(BLOG_REPO_ROOT, "assist.yml"));
|
|
21530
21553
|
const devlog = config.devlog;
|
|
21531
21554
|
const skip2 = devlog?.skip;
|
|
21532
21555
|
return new Set(skip2?.[repoName]);
|
|
@@ -21538,13 +21561,13 @@ import chalk145 from "chalk";
|
|
|
21538
21561
|
|
|
21539
21562
|
// src/shared/getRepoName.ts
|
|
21540
21563
|
import { existsSync as existsSync51, readFileSync as readFileSync33 } from "fs";
|
|
21541
|
-
import { basename as basename14, join as
|
|
21564
|
+
import { basename as basename14, join as join57 } from "path";
|
|
21542
21565
|
function getRepoName() {
|
|
21543
21566
|
const config = loadConfig();
|
|
21544
21567
|
if (config.devlog?.name) {
|
|
21545
21568
|
return config.devlog.name;
|
|
21546
21569
|
}
|
|
21547
|
-
const packageJsonPath =
|
|
21570
|
+
const packageJsonPath = join57(process.cwd(), "package.json");
|
|
21548
21571
|
if (existsSync51(packageJsonPath)) {
|
|
21549
21572
|
try {
|
|
21550
21573
|
const content = readFileSync33(packageJsonPath, "utf8");
|
|
@@ -21559,9 +21582,9 @@ function getRepoName() {
|
|
|
21559
21582
|
}
|
|
21560
21583
|
|
|
21561
21584
|
// src/commands/devlog/loadDevlogEntries.ts
|
|
21562
|
-
import { readdirSync as
|
|
21563
|
-
import { join as
|
|
21564
|
-
var DEVLOG_DIR =
|
|
21585
|
+
import { readdirSync as readdirSync7, readFileSync as readFileSync34 } from "fs";
|
|
21586
|
+
import { join as join58 } from "path";
|
|
21587
|
+
var DEVLOG_DIR = join58(BLOG_REPO_ROOT, "src/content/devlog");
|
|
21565
21588
|
function extractFrontmatter(content) {
|
|
21566
21589
|
const fm = content.match(/^---\n([\s\S]*?)\n---/);
|
|
21567
21590
|
return fm?.[1] ?? null;
|
|
@@ -21587,9 +21610,9 @@ function parseFrontmatter(content, filename) {
|
|
|
21587
21610
|
}
|
|
21588
21611
|
function readDevlogFiles(callback) {
|
|
21589
21612
|
try {
|
|
21590
|
-
const files =
|
|
21613
|
+
const files = readdirSync7(DEVLOG_DIR).filter((f) => f.endsWith(".md"));
|
|
21591
21614
|
for (const file of files) {
|
|
21592
|
-
const content = readFileSync34(
|
|
21615
|
+
const content = readFileSync34(join58(DEVLOG_DIR, file), "utf8");
|
|
21593
21616
|
const parsed = parseFrontmatter(content, file);
|
|
21594
21617
|
if (parsed) callback(parsed);
|
|
21595
21618
|
}
|
|
@@ -21977,11 +22000,11 @@ function repos(options2) {
|
|
|
21977
22000
|
|
|
21978
22001
|
// src/commands/devlog/skip.ts
|
|
21979
22002
|
import { writeFileSync as writeFileSync29 } from "fs";
|
|
21980
|
-
import { join as
|
|
22003
|
+
import { join as join59 } from "path";
|
|
21981
22004
|
import chalk150 from "chalk";
|
|
21982
22005
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
21983
22006
|
function getBlogConfigPath() {
|
|
21984
|
-
return
|
|
22007
|
+
return join59(BLOG_REPO_ROOT, "assist.yml");
|
|
21985
22008
|
}
|
|
21986
22009
|
function skip(date) {
|
|
21987
22010
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
@@ -22042,20 +22065,20 @@ function registerDevlog(program2) {
|
|
|
22042
22065
|
}
|
|
22043
22066
|
|
|
22044
22067
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
22045
|
-
import { closeSync as closeSync4, openSync as openSync5, readdirSync as
|
|
22046
|
-
import { join as
|
|
22068
|
+
import { closeSync as closeSync4, openSync as openSync5, readdirSync as readdirSync8 } from "fs";
|
|
22069
|
+
import { join as join60 } from "path";
|
|
22047
22070
|
import chalk152 from "chalk";
|
|
22048
22071
|
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "packages"]);
|
|
22049
22072
|
function isLockedDll(debugDir) {
|
|
22050
22073
|
let files;
|
|
22051
22074
|
try {
|
|
22052
|
-
files =
|
|
22075
|
+
files = readdirSync8(debugDir, { recursive: true });
|
|
22053
22076
|
} catch {
|
|
22054
22077
|
return null;
|
|
22055
22078
|
}
|
|
22056
22079
|
for (const file of files) {
|
|
22057
22080
|
if (!file.toLowerCase().endsWith(".dll")) continue;
|
|
22058
|
-
const dllPath =
|
|
22081
|
+
const dllPath = join60(debugDir, file);
|
|
22059
22082
|
try {
|
|
22060
22083
|
const fd = openSync5(dllPath, "r+");
|
|
22061
22084
|
closeSync4(fd);
|
|
@@ -22068,18 +22091,18 @@ function isLockedDll(debugDir) {
|
|
|
22068
22091
|
function findFirstLockedDll(dir) {
|
|
22069
22092
|
let entries;
|
|
22070
22093
|
try {
|
|
22071
|
-
entries =
|
|
22094
|
+
entries = readdirSync8(dir);
|
|
22072
22095
|
} catch {
|
|
22073
22096
|
return null;
|
|
22074
22097
|
}
|
|
22075
22098
|
if (entries.includes("bin")) {
|
|
22076
|
-
const locked = isLockedDll(
|
|
22099
|
+
const locked = isLockedDll(join60(dir, "bin", "Debug"));
|
|
22077
22100
|
if (locked) return locked;
|
|
22078
22101
|
}
|
|
22079
22102
|
for (const entry of entries) {
|
|
22080
22103
|
if (SKIP_DIRS.has(entry) || entry === "bin" || entry.startsWith("."))
|
|
22081
22104
|
continue;
|
|
22082
|
-
const found = findFirstLockedDll(
|
|
22105
|
+
const found = findFirstLockedDll(join60(dir, entry));
|
|
22083
22106
|
if (found) return found;
|
|
22084
22107
|
}
|
|
22085
22108
|
return null;
|
|
@@ -22148,14 +22171,14 @@ function collectAllDeps(node) {
|
|
|
22148
22171
|
}
|
|
22149
22172
|
|
|
22150
22173
|
// src/commands/dotnet/findContainingSolutions.ts
|
|
22151
|
-
import { readdirSync as
|
|
22174
|
+
import { readdirSync as readdirSync9, readFileSync as readFileSync36, statSync as statSync9 } from "fs";
|
|
22152
22175
|
import path35 from "path";
|
|
22153
22176
|
function findSlnFiles(dir, maxDepth, depth = 0) {
|
|
22154
22177
|
if (depth > maxDepth) return [];
|
|
22155
22178
|
const results = [];
|
|
22156
22179
|
let entries;
|
|
22157
22180
|
try {
|
|
22158
|
-
entries =
|
|
22181
|
+
entries = readdirSync9(dir);
|
|
22159
22182
|
} catch {
|
|
22160
22183
|
return results;
|
|
22161
22184
|
}
|
|
@@ -22164,7 +22187,7 @@ function findSlnFiles(dir, maxDepth, depth = 0) {
|
|
|
22164
22187
|
continue;
|
|
22165
22188
|
const full = path35.join(dir, entry);
|
|
22166
22189
|
try {
|
|
22167
|
-
const stat5 =
|
|
22190
|
+
const stat5 = statSync9(full);
|
|
22168
22191
|
if (stat5.isFile() && entry.endsWith(".sln")) {
|
|
22169
22192
|
results.push(full);
|
|
22170
22193
|
} else if (stat5.isDirectory()) {
|
|
@@ -22425,12 +22448,12 @@ import path37 from "path";
|
|
|
22425
22448
|
import chalk158 from "chalk";
|
|
22426
22449
|
|
|
22427
22450
|
// src/commands/dotnet/findSolution.ts
|
|
22428
|
-
import { readdirSync as
|
|
22429
|
-
import { dirname as dirname27, join as
|
|
22451
|
+
import { readdirSync as readdirSync10 } from "fs";
|
|
22452
|
+
import { dirname as dirname27, join as join61 } from "path";
|
|
22430
22453
|
import chalk157 from "chalk";
|
|
22431
22454
|
function findSlnInDir(dir) {
|
|
22432
22455
|
try {
|
|
22433
|
-
return
|
|
22456
|
+
return readdirSync10(dir).filter((f) => f.endsWith(".sln")).map((f) => join61(dir, f));
|
|
22434
22457
|
} catch {
|
|
22435
22458
|
return [];
|
|
22436
22459
|
}
|
|
@@ -23425,7 +23448,7 @@ function aggregateCommitters(authorLists) {
|
|
|
23425
23448
|
import { spawnSync as spawnSync6 } from "child_process";
|
|
23426
23449
|
import { unlinkSync as unlinkSync12, writeFileSync as writeFileSync30 } from "fs";
|
|
23427
23450
|
import { tmpdir as tmpdir5 } from "os";
|
|
23428
|
-
import { join as
|
|
23451
|
+
import { join as join62 } from "path";
|
|
23429
23452
|
function buildArgs2(queryFile, vars) {
|
|
23430
23453
|
const args = ["api", "graphql", "-F", `query=@${queryFile}`];
|
|
23431
23454
|
for (const [key, value] of Object.entries(vars)) {
|
|
@@ -23435,7 +23458,7 @@ function buildArgs2(queryFile, vars) {
|
|
|
23435
23458
|
return args;
|
|
23436
23459
|
}
|
|
23437
23460
|
function runGhGraphql(mutation, vars) {
|
|
23438
|
-
const queryFile =
|
|
23461
|
+
const queryFile = join62(tmpdir5(), `gh-query-${Date.now()}.graphql`);
|
|
23439
23462
|
writeFileSync30(queryFile, mutation);
|
|
23440
23463
|
try {
|
|
23441
23464
|
const result = spawnSync6("gh", buildArgs2(queryFile, vars), {
|
|
@@ -24619,13 +24642,13 @@ import { execFileSync as execFileSync9 } from "child_process";
|
|
|
24619
24642
|
import { basename as basename16 } from "path";
|
|
24620
24643
|
|
|
24621
24644
|
// src/shared/removeStagedAttachments.ts
|
|
24622
|
-
import { rmSync as
|
|
24645
|
+
import { rmSync as rmSync4 } from "fs";
|
|
24623
24646
|
import { dirname as dirname28 } from "path";
|
|
24624
24647
|
function removeStagedAttachments(attachments) {
|
|
24625
24648
|
for (const { path: path106 } of attachments) {
|
|
24626
24649
|
const dir = dirname28(path106);
|
|
24627
24650
|
if (!isStagedAttachmentPath(dir)) continue;
|
|
24628
|
-
|
|
24651
|
+
rmSync4(dir, { recursive: true, force: true });
|
|
24629
24652
|
}
|
|
24630
24653
|
}
|
|
24631
24654
|
|
|
@@ -24783,14 +24806,14 @@ function fetchIssue2(number, repo) {
|
|
|
24783
24806
|
import { existsSync as existsSync56, readFileSync as readFileSync38 } from "fs";
|
|
24784
24807
|
|
|
24785
24808
|
// src/commands/github/issue/issueWorkingFile.ts
|
|
24786
|
-
import { join as
|
|
24809
|
+
import { join as join63 } from "path";
|
|
24787
24810
|
function issueWorkingFile(slug2, number) {
|
|
24788
24811
|
const [owner = "unknown", repo = "unknown"] = slug2.split("/");
|
|
24789
|
-
const dir =
|
|
24812
|
+
const dir = join63(getStoreDir(), "github-issues", owner, repo);
|
|
24790
24813
|
return {
|
|
24791
24814
|
dir,
|
|
24792
|
-
bodyPath:
|
|
24793
|
-
metaPath:
|
|
24815
|
+
bodyPath: join63(dir, `${number}.md`),
|
|
24816
|
+
metaPath: join63(dir, `${number}.json`)
|
|
24794
24817
|
};
|
|
24795
24818
|
}
|
|
24796
24819
|
|
|
@@ -25433,14 +25456,14 @@ import { existsSync as existsSync57 } from "fs";
|
|
|
25433
25456
|
import { basename as basename18, dirname as dirname29 } from "path";
|
|
25434
25457
|
|
|
25435
25458
|
// src/commands/sessions/daemon/worktree/planAllocation.ts
|
|
25436
|
-
import { basename as basename17, join as
|
|
25459
|
+
import { basename as basename17, join as join64 } from "path";
|
|
25437
25460
|
function planAllocation(clone, boundTreeRoots2) {
|
|
25438
25461
|
return boundTreeRoots2.has(clone) ? "spill" : "primary";
|
|
25439
25462
|
}
|
|
25440
25463
|
function nextWorktreePath(clone, base, isTaken) {
|
|
25441
25464
|
const name = basename17(clone);
|
|
25442
25465
|
for (let n = 2; n < 1e3; n++) {
|
|
25443
|
-
const candidate =
|
|
25466
|
+
const candidate = join64(base, `${name}-${n}`);
|
|
25444
25467
|
if (!isTaken(candidate)) return candidate;
|
|
25445
25468
|
}
|
|
25446
25469
|
throw new Error(`no free worktree suffix for ${clone}`);
|
|
@@ -25794,19 +25817,19 @@ function persistedTreeRoots() {
|
|
|
25794
25817
|
|
|
25795
25818
|
// src/commands/sessions/daemon/worktree/seedWorktree.ts
|
|
25796
25819
|
import { copyFileSync, existsSync as existsSync60, mkdirSync as mkdirSync17 } from "fs";
|
|
25797
|
-
import { dirname as dirname30, join as
|
|
25820
|
+
import { dirname as dirname30, join as join66 } from "path";
|
|
25798
25821
|
|
|
25799
25822
|
// src/commands/sessions/daemon/worktree/runInstall.ts
|
|
25800
25823
|
import { resolve as resolve17 } from "path";
|
|
25801
25824
|
|
|
25802
25825
|
// src/commands/sessions/daemon/worktree/detectInstallCommand.ts
|
|
25803
25826
|
import { existsSync as existsSync59 } from "fs";
|
|
25804
|
-
import { join as
|
|
25827
|
+
import { join as join65 } from "path";
|
|
25805
25828
|
function detectInstallCommand(dir) {
|
|
25806
|
-
if (!existsSync59(
|
|
25807
|
-
if (existsSync59(
|
|
25808
|
-
if (existsSync59(
|
|
25809
|
-
if (existsSync59(
|
|
25829
|
+
if (!existsSync59(join65(dir, "package.json"))) return null;
|
|
25830
|
+
if (existsSync59(join65(dir, "pnpm-lock.yaml"))) return "pnpm install";
|
|
25831
|
+
if (existsSync59(join65(dir, "yarn.lock"))) return "yarn install";
|
|
25832
|
+
if (existsSync59(join65(dir, "bun.lockb"))) return "bun install";
|
|
25810
25833
|
return "npm install";
|
|
25811
25834
|
}
|
|
25812
25835
|
|
|
@@ -25968,9 +25991,9 @@ function seedWorktree(worktreePath, clone, onSeeded = () => {
|
|
|
25968
25991
|
}
|
|
25969
25992
|
function copyConfigFiles(worktreePath, clone, copy) {
|
|
25970
25993
|
for (const rel of copy) {
|
|
25971
|
-
const src =
|
|
25994
|
+
const src = join66(clone, rel);
|
|
25972
25995
|
if (!existsSync60(src)) continue;
|
|
25973
|
-
const dest =
|
|
25996
|
+
const dest = join66(worktreePath, rel);
|
|
25974
25997
|
try {
|
|
25975
25998
|
mkdirSync17(dirname30(dest), { recursive: true });
|
|
25976
25999
|
copyFileSync(src, dest);
|
|
@@ -26274,7 +26297,7 @@ function registerLitellm(program2) {
|
|
|
26274
26297
|
}
|
|
26275
26298
|
|
|
26276
26299
|
// src/commands/mermaidExport.ts
|
|
26277
|
-
import { mkdirSync as mkdirSync18, readdirSync as
|
|
26300
|
+
import { mkdirSync as mkdirSync18, readdirSync as readdirSync11 } from "fs";
|
|
26278
26301
|
import { resolve as resolve19 } from "path";
|
|
26279
26302
|
import chalk174 from "chalk";
|
|
26280
26303
|
|
|
@@ -26356,7 +26379,7 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
26356
26379
|
process.exit(1);
|
|
26357
26380
|
}
|
|
26358
26381
|
}
|
|
26359
|
-
const files = file ? [file] :
|
|
26382
|
+
const files = file ? [file] : readdirSync11(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
26360
26383
|
if (files.length === 0) {
|
|
26361
26384
|
console.log(chalk174.gray("No markdown files found in current directory."));
|
|
26362
26385
|
return;
|
|
@@ -27004,15 +27027,15 @@ function createNetcapHandler(options2) {
|
|
|
27004
27027
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
27005
27028
|
import { cp as cp4, readFile as readFile6, writeFile as writeFile6 } from "fs/promises";
|
|
27006
27029
|
import { networkInterfaces } from "os";
|
|
27007
|
-
import { join as
|
|
27030
|
+
import { join as join68 } from "path";
|
|
27008
27031
|
import chalk177 from "chalk";
|
|
27009
27032
|
|
|
27010
27033
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
27011
|
-
import { dirname as dirname32, join as
|
|
27034
|
+
import { dirname as dirname32, join as join67 } from "path";
|
|
27012
27035
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
27013
27036
|
var moduleDir2 = dirname32(fileURLToPath7(import.meta.url));
|
|
27014
27037
|
function netcapExtensionDir() {
|
|
27015
|
-
return
|
|
27038
|
+
return join67(moduleDir2, "commands", "netcap", "netcap-extension");
|
|
27016
27039
|
}
|
|
27017
27040
|
|
|
27018
27041
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
@@ -27027,7 +27050,7 @@ function lanIPv4() {
|
|
|
27027
27050
|
return void 0;
|
|
27028
27051
|
}
|
|
27029
27052
|
async function configureBackground(dir, host, port, filter) {
|
|
27030
|
-
const file =
|
|
27053
|
+
const file = join68(dir, "background.js");
|
|
27031
27054
|
const source = await readFile6(file, "utf8");
|
|
27032
27055
|
await writeFile6(
|
|
27033
27056
|
file,
|
|
@@ -27067,20 +27090,20 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
27067
27090
|
}
|
|
27068
27091
|
|
|
27069
27092
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
27070
|
-
import { isAbsolute as isAbsolute5, join as
|
|
27093
|
+
import { isAbsolute as isAbsolute5, join as join70, resolve as resolve21 } from "path";
|
|
27071
27094
|
|
|
27072
27095
|
// src/commands/netcap/defaultCapturePath.ts
|
|
27073
27096
|
import { homedir as homedir22 } from "os";
|
|
27074
|
-
import { join as
|
|
27097
|
+
import { join as join69 } from "path";
|
|
27075
27098
|
function defaultCapturePath() {
|
|
27076
|
-
return
|
|
27099
|
+
return join69(homedir22(), ".assist", "netcap", "capture.jsonl");
|
|
27077
27100
|
}
|
|
27078
27101
|
|
|
27079
27102
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
27080
27103
|
function resolveNetcapOutPath(out) {
|
|
27081
27104
|
if (!out) return defaultCapturePath();
|
|
27082
27105
|
const dir = isAbsolute5(out) ? out : resolve21(process.cwd(), out);
|
|
27083
|
-
return
|
|
27106
|
+
return join70(dir, "capture.jsonl");
|
|
27084
27107
|
}
|
|
27085
27108
|
|
|
27086
27109
|
// src/commands/netcap/netcap.ts
|
|
@@ -27127,7 +27150,7 @@ netcap stopped \u2014 captured ${count8} ${count8 === 1 ? "entry" : "entries"} t
|
|
|
27127
27150
|
|
|
27128
27151
|
// src/commands/netcap/netcapExtract.ts
|
|
27129
27152
|
import { writeFileSync as writeFileSync34 } from "fs";
|
|
27130
|
-
import { join as
|
|
27153
|
+
import { join as join71 } from "path";
|
|
27131
27154
|
import chalk179 from "chalk";
|
|
27132
27155
|
|
|
27133
27156
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
@@ -27572,7 +27595,7 @@ function extractPostsFromCapture(captureFile) {
|
|
|
27572
27595
|
function netcapExtract(file) {
|
|
27573
27596
|
const captureFile = file ?? defaultCapturePath();
|
|
27574
27597
|
const posts = extractPostsFromCapture(captureFile);
|
|
27575
|
-
const outFile =
|
|
27598
|
+
const outFile = join71(captureFile, "..", "posts.json");
|
|
27576
27599
|
writeFileSync34(outFile, `${JSON.stringify(posts, null, 2)}
|
|
27577
27600
|
`);
|
|
27578
27601
|
console.log(
|
|
@@ -27935,7 +27958,7 @@ import { execSync as execSync41 } from "child_process";
|
|
|
27935
27958
|
import { execSync as execSync40 } from "child_process";
|
|
27936
27959
|
import { unlinkSync as unlinkSync14, writeFileSync as writeFileSync35 } from "fs";
|
|
27937
27960
|
import { tmpdir as tmpdir6 } from "os";
|
|
27938
|
-
import { join as
|
|
27961
|
+
import { join as join73 } from "path";
|
|
27939
27962
|
|
|
27940
27963
|
// src/commands/prs/loadCommentsCache.ts
|
|
27941
27964
|
import { existsSync as existsSync62, readFileSync as readFileSync43, unlinkSync as unlinkSync13 } from "fs";
|
|
@@ -27943,9 +27966,9 @@ import { parse as parse3 } from "yaml";
|
|
|
27943
27966
|
|
|
27944
27967
|
// src/commands/prs/commentsCachePath.ts
|
|
27945
27968
|
import { homedir as homedir23 } from "os";
|
|
27946
|
-
import { join as
|
|
27969
|
+
import { join as join72 } from "path";
|
|
27947
27970
|
function commentsCachePath(org, repo, prNumber) {
|
|
27948
|
-
return
|
|
27971
|
+
return join72(
|
|
27949
27972
|
homedir23(),
|
|
27950
27973
|
".assist",
|
|
27951
27974
|
"pr-comments",
|
|
@@ -27994,7 +28017,7 @@ function replyToComment(org, repo, prNumber, commentId, message3) {
|
|
|
27994
28017
|
// src/commands/prs/resolveCommentWithReply.ts
|
|
27995
28018
|
function resolveThread(threadId) {
|
|
27996
28019
|
const mutation = `mutation($threadId: ID!) { resolveReviewThread(input: {threadId: $threadId}) { thread { isResolved } } }`;
|
|
27997
|
-
const queryFile =
|
|
28020
|
+
const queryFile = join73(tmpdir6(), `gh-mutation-${Date.now()}.graphql`);
|
|
27998
28021
|
writeFileSync35(queryFile, mutation);
|
|
27999
28022
|
try {
|
|
28000
28023
|
execSync40(
|
|
@@ -28079,10 +28102,10 @@ function fixed(commentId, sha) {
|
|
|
28079
28102
|
import { execSync as execSync42 } from "child_process";
|
|
28080
28103
|
import { unlinkSync as unlinkSync15, writeFileSync as writeFileSync36 } from "fs";
|
|
28081
28104
|
import { tmpdir as tmpdir7 } from "os";
|
|
28082
|
-
import { join as
|
|
28105
|
+
import { join as join74 } from "path";
|
|
28083
28106
|
var THREAD_QUERY = `query($owner: String!, $repo: String!, $prNumber: Int!) { repository(owner: $owner, name: $repo) { pullRequest(number: $prNumber) { reviewThreads(first: 100) { nodes { id isResolved comments(first: 100) { nodes { databaseId } } } } } } }`;
|
|
28084
28107
|
function fetchThreadIds(org, repo, prNumber) {
|
|
28085
|
-
const queryFile =
|
|
28108
|
+
const queryFile = join74(tmpdir7(), `gh-query-${Date.now()}.graphql`);
|
|
28086
28109
|
writeFileSync36(queryFile, THREAD_QUERY);
|
|
28087
28110
|
try {
|
|
28088
28111
|
const result = execSync42(
|
|
@@ -28156,19 +28179,19 @@ import { dirname as dirname34 } from "path";
|
|
|
28156
28179
|
import { stringify as stringify3 } from "yaml";
|
|
28157
28180
|
|
|
28158
28181
|
// src/commands/prs/removeStaleCommentsCaches.ts
|
|
28159
|
-
import { readdirSync as
|
|
28160
|
-
import { join as
|
|
28182
|
+
import { readdirSync as readdirSync12, unlinkSync as unlinkSync16 } from "fs";
|
|
28183
|
+
import { join as join75 } from "path";
|
|
28161
28184
|
var STALE_PATTERN = /^pr-\d+-comments\.yaml$/;
|
|
28162
28185
|
function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
28163
|
-
const dir =
|
|
28186
|
+
const dir = join75(cwd, ".assist");
|
|
28164
28187
|
let entries;
|
|
28165
28188
|
try {
|
|
28166
|
-
entries =
|
|
28189
|
+
entries = readdirSync12(dir);
|
|
28167
28190
|
} catch {
|
|
28168
28191
|
return;
|
|
28169
28192
|
}
|
|
28170
28193
|
for (const entry of entries.filter((e) => STALE_PATTERN.test(e))) {
|
|
28171
|
-
unlinkSync16(
|
|
28194
|
+
unlinkSync16(join75(dir, entry));
|
|
28172
28195
|
}
|
|
28173
28196
|
}
|
|
28174
28197
|
|
|
@@ -30807,7 +30830,7 @@ async function notify() {
|
|
|
30807
30830
|
import { execSync as execSync52 } from "child_process";
|
|
30808
30831
|
import { existsSync as existsSync63, mkdirSync as mkdirSync21, unlinkSync as unlinkSync17, writeFileSync as writeFileSync38 } from "fs";
|
|
30809
30832
|
import { tmpdir as tmpdir8 } from "os";
|
|
30810
|
-
import { join as
|
|
30833
|
+
import { join as join76, resolve as resolve22 } from "path";
|
|
30811
30834
|
import chalk204 from "chalk";
|
|
30812
30835
|
|
|
30813
30836
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
@@ -30944,7 +30967,7 @@ function buildOutputPath(outputDir, processName) {
|
|
|
30944
30967
|
return resolve22(outputDir, `${processName}-${timestamp5}.png`);
|
|
30945
30968
|
}
|
|
30946
30969
|
function runPowerShellScript(processName, outputPath) {
|
|
30947
|
-
const scriptPath =
|
|
30970
|
+
const scriptPath = join76(tmpdir8(), `assist-screenshot-${Date.now()}.ps1`);
|
|
30948
30971
|
writeFileSync38(scriptPath, captureWindowPs1, "utf8");
|
|
30949
30972
|
try {
|
|
30950
30973
|
execSync52(
|
|
@@ -31058,13 +31081,13 @@ function buildLimitsSegment(rateLimits) {
|
|
|
31058
31081
|
}
|
|
31059
31082
|
|
|
31060
31083
|
// src/commands/readGitBranch.ts
|
|
31061
|
-
import { readFileSync as readFileSync46, statSync as
|
|
31062
|
-
import { isAbsolute as isAbsolute6, join as
|
|
31084
|
+
import { readFileSync as readFileSync46, statSync as statSync10 } from "fs";
|
|
31085
|
+
import { isAbsolute as isAbsolute6, join as join77, resolve as resolve23 } from "path";
|
|
31063
31086
|
function resolveGitDir(cwd) {
|
|
31064
|
-
const dotGit =
|
|
31087
|
+
const dotGit = join77(cwd, ".git");
|
|
31065
31088
|
let stat5;
|
|
31066
31089
|
try {
|
|
31067
|
-
stat5 =
|
|
31090
|
+
stat5 = statSync10(dotGit);
|
|
31068
31091
|
} catch {
|
|
31069
31092
|
return null;
|
|
31070
31093
|
}
|
|
@@ -31091,7 +31114,7 @@ function readGitBranch(cwd) {
|
|
|
31091
31114
|
}
|
|
31092
31115
|
let head;
|
|
31093
31116
|
try {
|
|
31094
|
-
head = readFileSync46(
|
|
31117
|
+
head = readFileSync46(join77(gitDir, "HEAD"), "utf8");
|
|
31095
31118
|
} catch {
|
|
31096
31119
|
return null;
|
|
31097
31120
|
}
|
|
@@ -34050,12 +34073,12 @@ function fetchHighLevelPr(prNumber, repo) {
|
|
|
34050
34073
|
import { existsSync as existsSync64, readFileSync as readFileSync47 } from "fs";
|
|
34051
34074
|
|
|
34052
34075
|
// src/commands/review/highLevel/highLevelReviewPath.ts
|
|
34053
|
-
import { join as
|
|
34076
|
+
import { join as join78 } from "path";
|
|
34054
34077
|
function slug(value) {
|
|
34055
34078
|
return value.replace(/[^\w.-]+/g, "-");
|
|
34056
34079
|
}
|
|
34057
34080
|
function highLevelReviewPath(repo, headRef, headSha) {
|
|
34058
|
-
return
|
|
34081
|
+
return join78(
|
|
34059
34082
|
getStoreDir(),
|
|
34060
34083
|
"high-level-reviews",
|
|
34061
34084
|
slug(repo),
|
|
@@ -35079,11 +35102,11 @@ async function handlePostSynthesis(synthesisPath, prInfo, options2) {
|
|
|
35079
35102
|
}
|
|
35080
35103
|
|
|
35081
35104
|
// src/commands/review/cachedReviewerResult.ts
|
|
35082
|
-
import { statSync as
|
|
35105
|
+
import { statSync as statSync11 } from "fs";
|
|
35083
35106
|
function cachedReviewerResult(name, outputPath) {
|
|
35084
35107
|
let size;
|
|
35085
35108
|
try {
|
|
35086
|
-
size =
|
|
35109
|
+
size = statSync11(outputPath).size;
|
|
35087
35110
|
} catch {
|
|
35088
35111
|
return null;
|
|
35089
35112
|
}
|
|
@@ -35131,7 +35154,7 @@ import { format } from "util";
|
|
|
35131
35154
|
|
|
35132
35155
|
// src/commands/review/createReviewLogSink.ts
|
|
35133
35156
|
import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync23 } from "fs";
|
|
35134
|
-
import { join as
|
|
35157
|
+
import { join as join79 } from "path";
|
|
35135
35158
|
|
|
35136
35159
|
// src/shared/stripAnsi.ts
|
|
35137
35160
|
var ANSI = new RegExp(
|
|
@@ -35159,7 +35182,7 @@ function createReviewLogSink() {
|
|
|
35159
35182
|
},
|
|
35160
35183
|
attach(reviewDir) {
|
|
35161
35184
|
mkdirSync23(reviewDir, { recursive: true });
|
|
35162
|
-
logPath2 =
|
|
35185
|
+
logPath2 = join79(reviewDir, LOG_FILE);
|
|
35163
35186
|
const lines2 = [
|
|
35164
35187
|
"",
|
|
35165
35188
|
`=== ${(/* @__PURE__ */ new Date()).toISOString()} ===`,
|
|
@@ -36241,9 +36264,9 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
|
|
|
36241
36264
|
|
|
36242
36265
|
// src/commands/review/buildReviewPaths.ts
|
|
36243
36266
|
import { homedir as homedir24 } from "os";
|
|
36244
|
-
import { basename as basename21, join as
|
|
36267
|
+
import { basename as basename21, join as join80 } from "path";
|
|
36245
36268
|
function buildReviewPaths(repoRoot2, key) {
|
|
36246
|
-
const reviewDir =
|
|
36269
|
+
const reviewDir = join80(
|
|
36247
36270
|
homedir24(),
|
|
36248
36271
|
".assist",
|
|
36249
36272
|
"reviews",
|
|
@@ -36252,10 +36275,10 @@ function buildReviewPaths(repoRoot2, key) {
|
|
|
36252
36275
|
);
|
|
36253
36276
|
return {
|
|
36254
36277
|
reviewDir,
|
|
36255
|
-
requestPath:
|
|
36256
|
-
claudePath:
|
|
36257
|
-
codexPath:
|
|
36258
|
-
synthesisPath:
|
|
36278
|
+
requestPath: join80(reviewDir, "request.md"),
|
|
36279
|
+
claudePath: join80(reviewDir, "claude.md"),
|
|
36280
|
+
codexPath: join80(reviewDir, "codex.md"),
|
|
36281
|
+
synthesisPath: join80(reviewDir, "synthesis.md")
|
|
36259
36282
|
};
|
|
36260
36283
|
}
|
|
36261
36284
|
|
|
@@ -36553,12 +36576,12 @@ function insertRuleBullet(content, rule) {
|
|
|
36553
36576
|
import { readFileSync as readFileSync50 } from "fs";
|
|
36554
36577
|
|
|
36555
36578
|
// src/commands/rules/findClaudeFiles.ts
|
|
36556
|
-
import { readdirSync as
|
|
36579
|
+
import { readdirSync as readdirSync13 } from "fs";
|
|
36557
36580
|
import path81 from "path";
|
|
36558
36581
|
var SKIP_DIRECTORIES = /* @__PURE__ */ new Set(["node_modules", "dist", "build", "coverage"]);
|
|
36559
36582
|
function findClaudeFiles(dir) {
|
|
36560
36583
|
const results = [];
|
|
36561
|
-
for (const entry of
|
|
36584
|
+
for (const entry of readdirSync13(dir, { withFileTypes: true })) {
|
|
36562
36585
|
if (entry.isDirectory()) {
|
|
36563
36586
|
if (entry.name.startsWith(".") || SKIP_DIRECTORIES.has(entry.name))
|
|
36564
36587
|
continue;
|
|
@@ -37236,12 +37259,12 @@ async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
|
37236
37259
|
}
|
|
37237
37260
|
|
|
37238
37261
|
// src/commands/slack/slackWorkingFile.ts
|
|
37239
|
-
import { join as
|
|
37262
|
+
import { join as join81 } from "path";
|
|
37240
37263
|
function slackWorkingFile(channel, partIndex) {
|
|
37241
37264
|
const slug2 = channel.replace(/^[#@]/, "").toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "channel";
|
|
37242
|
-
const dir =
|
|
37265
|
+
const dir = join81(getStoreDir(), "slack");
|
|
37243
37266
|
const name = partIndex === void 0 ? slug2 : `${slug2}-${partIndex}`;
|
|
37244
|
-
return { dir, bodyPath:
|
|
37267
|
+
return { dir, bodyPath: join81(dir, `${name}.md`) };
|
|
37245
37268
|
}
|
|
37246
37269
|
|
|
37247
37270
|
// src/commands/slack/previewSlackThreadParts.ts
|
|
@@ -38420,21 +38443,21 @@ async function configure() {
|
|
|
38420
38443
|
}
|
|
38421
38444
|
|
|
38422
38445
|
// src/commands/transcript/list.ts
|
|
38423
|
-
import { existsSync as existsSync76, readdirSync as
|
|
38424
|
-
import { join as
|
|
38446
|
+
import { existsSync as existsSync76, readdirSync as readdirSync20, statSync as statSync12 } from "fs";
|
|
38447
|
+
import { join as join93 } from "path";
|
|
38425
38448
|
function list3() {
|
|
38426
38449
|
const { vttDir } = getTranscriptConfig();
|
|
38427
38450
|
if (!existsSync76(vttDir)) return;
|
|
38428
|
-
for (const entry of
|
|
38451
|
+
for (const entry of readdirSync20(vttDir)) {
|
|
38429
38452
|
if (!entry.endsWith(".vtt")) continue;
|
|
38430
|
-
if (
|
|
38453
|
+
if (statSync12(join93(vttDir, entry)).isDirectory()) continue;
|
|
38431
38454
|
console.log(entry);
|
|
38432
38455
|
}
|
|
38433
38456
|
}
|
|
38434
38457
|
|
|
38435
38458
|
// src/commands/transcript/move.ts
|
|
38436
38459
|
import { existsSync as existsSync77, mkdirSync as mkdirSync32, renameSync as renameSync2, writeFileSync as writeFileSync50 } from "fs";
|
|
38437
|
-
import { basename as basename25, join as
|
|
38460
|
+
import { basename as basename25, join as join94 } from "path";
|
|
38438
38461
|
|
|
38439
38462
|
// src/commands/transcript/convertVttToMarkdown.ts
|
|
38440
38463
|
function convertVttToMarkdown(inputPath) {
|
|
@@ -38444,9 +38467,9 @@ function convertVttToMarkdown(inputPath) {
|
|
|
38444
38467
|
// src/commands/transcript/move.ts
|
|
38445
38468
|
var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
38446
38469
|
function archiveRawVtt(vttDir, sourcePath, filename) {
|
|
38447
|
-
const processedDir =
|
|
38470
|
+
const processedDir = join94(vttDir, "processed");
|
|
38448
38471
|
mkdirSync32(processedDir, { recursive: true });
|
|
38449
|
-
renameSync2(sourcePath,
|
|
38472
|
+
renameSync2(sourcePath, join94(processedDir, filename));
|
|
38450
38473
|
}
|
|
38451
38474
|
function move(file, options2) {
|
|
38452
38475
|
const { date, client } = options2;
|
|
@@ -38456,19 +38479,19 @@ function move(file, options2) {
|
|
|
38456
38479
|
}
|
|
38457
38480
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
38458
38481
|
const filename = basename25(file);
|
|
38459
|
-
const sourcePath =
|
|
38482
|
+
const sourcePath = join94(vttDir, filename);
|
|
38460
38483
|
if (!existsSync77(sourcePath)) {
|
|
38461
38484
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
38462
38485
|
process.exit(1);
|
|
38463
38486
|
}
|
|
38464
38487
|
const base = basename25(filename, ".vtt").replace(/ Transcription$/, "");
|
|
38465
38488
|
const outputName = `${date} ${base}.md`;
|
|
38466
|
-
const formattedDir =
|
|
38489
|
+
const formattedDir = join94(transcriptsDir, client);
|
|
38467
38490
|
mkdirSync32(formattedDir, { recursive: true });
|
|
38468
|
-
const formattedPath =
|
|
38491
|
+
const formattedPath = join94(formattedDir, outputName);
|
|
38469
38492
|
writeFileSync50(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
|
|
38470
38493
|
archiveRawVtt(vttDir, sourcePath, filename);
|
|
38471
|
-
const summaryPath =
|
|
38494
|
+
const summaryPath = join94(summaryDir, client, outputName);
|
|
38472
38495
|
console.log(`Formatted transcript: ${formattedPath}`);
|
|
38473
38496
|
console.log(`Summary target: ${summaryPath}`);
|
|
38474
38497
|
}
|
|
@@ -39274,10 +39297,10 @@ function checkSequential(migrations3, files) {
|
|
|
39274
39297
|
}
|
|
39275
39298
|
|
|
39276
39299
|
// src/commands/verify/migrations/listMigrationFiles.ts
|
|
39277
|
-
import { readdirSync as
|
|
39300
|
+
import { readdirSync as readdirSync21 } from "fs";
|
|
39278
39301
|
var MIGRATION_FILE2 = /^migration\d+[A-Za-z0-9]*\.ts$/;
|
|
39279
39302
|
function listMigrationFiles(dir) {
|
|
39280
|
-
return
|
|
39303
|
+
return readdirSync21(dir).filter((file) => MIGRATION_FILE2.test(file));
|
|
39281
39304
|
}
|
|
39282
39305
|
|
|
39283
39306
|
// src/commands/verify/migrations/readBaselineMigrations.ts
|
|
@@ -39629,11 +39652,11 @@ function changedPaths(from, cwd) {
|
|
|
39629
39652
|
}
|
|
39630
39653
|
|
|
39631
39654
|
// src/commands/watch/readBuiltVersion.ts
|
|
39632
|
-
import { join as
|
|
39655
|
+
import { join as join95 } from "path";
|
|
39633
39656
|
function readBuiltVersion(cwd) {
|
|
39634
39657
|
try {
|
|
39635
39658
|
const root2 = runGit3(["rev-parse", "--show-toplevel"], cwd);
|
|
39636
|
-
return readPackageJson(
|
|
39659
|
+
return readPackageJson(join95(root2, "package.json")).version ?? "unknown";
|
|
39637
39660
|
} catch {
|
|
39638
39661
|
return "unknown";
|
|
39639
39662
|
}
|
|
@@ -40101,12 +40124,12 @@ ${buildWatchReport(from)}`);
|
|
|
40101
40124
|
}
|
|
40102
40125
|
|
|
40103
40126
|
// src/commands/watch/consumeSimulatedDivergence.ts
|
|
40104
|
-
import { existsSync as existsSync81, rmSync as
|
|
40127
|
+
import { existsSync as existsSync81, rmSync as rmSync8 } from "fs";
|
|
40105
40128
|
function consumeSimulatedDivergence(cwd) {
|
|
40106
40129
|
try {
|
|
40107
40130
|
const path106 = simulatedDivergencePath(cwd);
|
|
40108
40131
|
if (!existsSync81(path106)) return false;
|
|
40109
|
-
|
|
40132
|
+
rmSync8(path106);
|
|
40110
40133
|
return true;
|
|
40111
40134
|
} catch {
|
|
40112
40135
|
return false;
|
|
@@ -40415,19 +40438,19 @@ async function auth() {
|
|
|
40415
40438
|
|
|
40416
40439
|
// src/commands/roam/postRoamActivity.ts
|
|
40417
40440
|
import { execFileSync as execFileSync22 } from "child_process";
|
|
40418
|
-
import { readdirSync as
|
|
40419
|
-
import { join as
|
|
40441
|
+
import { readdirSync as readdirSync22, readFileSync as readFileSync62, statSync as statSync13 } from "fs";
|
|
40442
|
+
import { join as join96 } from "path";
|
|
40420
40443
|
function findPortFile(roamDir) {
|
|
40421
40444
|
let entries;
|
|
40422
40445
|
try {
|
|
40423
|
-
entries =
|
|
40446
|
+
entries = readdirSync22(roamDir);
|
|
40424
40447
|
} catch {
|
|
40425
40448
|
return void 0;
|
|
40426
40449
|
}
|
|
40427
40450
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
40428
|
-
const path106 =
|
|
40451
|
+
const path106 = join96(roamDir, name);
|
|
40429
40452
|
try {
|
|
40430
|
-
return { path: path106, mtimeMs:
|
|
40453
|
+
return { path: path106, mtimeMs: statSync13(path106).mtimeMs };
|
|
40431
40454
|
} catch {
|
|
40432
40455
|
return void 0;
|
|
40433
40456
|
}
|
|
@@ -40442,7 +40465,7 @@ var PID_BY_APP = {
|
|
|
40442
40465
|
function postRoamActivity(app, event) {
|
|
40443
40466
|
const appData = process.env.APPDATA;
|
|
40444
40467
|
if (!appData) return;
|
|
40445
|
-
const portFile = findPortFile(
|
|
40468
|
+
const portFile = findPortFile(join96(appData, "Roam"));
|
|
40446
40469
|
if (!portFile) return;
|
|
40447
40470
|
let port;
|
|
40448
40471
|
try {
|
|
@@ -40578,7 +40601,7 @@ async function run3(name, args) {
|
|
|
40578
40601
|
|
|
40579
40602
|
// src/commands/run/add.ts
|
|
40580
40603
|
import { mkdirSync as mkdirSync33, writeFileSync as writeFileSync53 } from "fs";
|
|
40581
|
-
import { join as
|
|
40604
|
+
import { join as join97 } from "path";
|
|
40582
40605
|
|
|
40583
40606
|
// src/commands/run/extractOption.ts
|
|
40584
40607
|
function extractOption(args, flag) {
|
|
@@ -40639,7 +40662,7 @@ function saveNewRunConfig(name, command, args, cwd) {
|
|
|
40639
40662
|
saveConfig(config);
|
|
40640
40663
|
}
|
|
40641
40664
|
function createCommandFile(name) {
|
|
40642
|
-
const dir =
|
|
40665
|
+
const dir = join97(".claude", "commands");
|
|
40643
40666
|
mkdirSync33(dir, { recursive: true });
|
|
40644
40667
|
const content = `---
|
|
40645
40668
|
description: Run ${name}
|
|
@@ -40647,7 +40670,7 @@ description: Run ${name}
|
|
|
40647
40670
|
|
|
40648
40671
|
Run \`assist run ${name} $ARGUMENTS 2>&1\`.
|
|
40649
40672
|
`;
|
|
40650
|
-
const filePath =
|
|
40673
|
+
const filePath = join97(dir, `${name}.md`);
|
|
40651
40674
|
writeFileSync53(filePath, content);
|
|
40652
40675
|
console.log(`Created command file: ${filePath}`);
|
|
40653
40676
|
}
|
|
@@ -40704,7 +40727,7 @@ function link2() {
|
|
|
40704
40727
|
|
|
40705
40728
|
// src/commands/run/remove.ts
|
|
40706
40729
|
import { existsSync as existsSync82, unlinkSync as unlinkSync21 } from "fs";
|
|
40707
|
-
import { join as
|
|
40730
|
+
import { join as join98 } from "path";
|
|
40708
40731
|
function findRemoveIndex() {
|
|
40709
40732
|
const idx = process.argv.indexOf("remove");
|
|
40710
40733
|
if (idx === -1 || idx + 1 >= process.argv.length) return -1;
|
|
@@ -40719,7 +40742,7 @@ function parseRemoveName() {
|
|
|
40719
40742
|
return process.argv[idx + 1];
|
|
40720
40743
|
}
|
|
40721
40744
|
function deleteCommandFile(name) {
|
|
40722
|
-
const filePath =
|
|
40745
|
+
const filePath = join98(".claude", "commands", `${name}.md`);
|
|
40723
40746
|
if (existsSync82(filePath)) {
|
|
40724
40747
|
unlinkSync21(filePath);
|
|
40725
40748
|
console.log(`Deleted command file: ${filePath}`);
|
|
@@ -41485,7 +41508,7 @@ import { existsSync as existsSync85 } from "fs";
|
|
|
41485
41508
|
import * as pty from "node-pty";
|
|
41486
41509
|
|
|
41487
41510
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
41488
|
-
import { chmodSync, existsSync as existsSync84, statSync as
|
|
41511
|
+
import { chmodSync, existsSync as existsSync84, statSync as statSync14 } from "fs";
|
|
41489
41512
|
import { createRequire as createRequire3 } from "module";
|
|
41490
41513
|
import path102 from "path";
|
|
41491
41514
|
var require4 = createRequire3(import.meta.url);
|
|
@@ -41501,7 +41524,7 @@ function ensureSpawnHelperExecutable() {
|
|
|
41501
41524
|
"spawn-helper"
|
|
41502
41525
|
);
|
|
41503
41526
|
if (!existsSync84(helper)) return;
|
|
41504
|
-
const mode =
|
|
41527
|
+
const mode = statSync14(helper).mode;
|
|
41505
41528
|
if ((mode & 73) === 0) chmodSync(helper, mode | 493);
|
|
41506
41529
|
}
|
|
41507
41530
|
|
|
@@ -41734,12 +41757,12 @@ import { basename as basename28 } from "path";
|
|
|
41734
41757
|
|
|
41735
41758
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
41736
41759
|
import { existsSync as existsSync86 } from "fs";
|
|
41737
|
-
import { join as
|
|
41760
|
+
import { join as join101 } from "path";
|
|
41738
41761
|
|
|
41739
41762
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
41740
|
-
import { statSync as
|
|
41763
|
+
import { statSync as statSync15 } from "fs";
|
|
41741
41764
|
import { rm as rm3 } from "fs/promises";
|
|
41742
|
-
import { join as
|
|
41765
|
+
import { join as join100 } from "path";
|
|
41743
41766
|
async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
41744
41767
|
if (holdsAGitDirectoryRatherThanALink(worktreePath)) {
|
|
41745
41768
|
const refusal = "it is a clone of its own, not a linked worktree";
|
|
@@ -41767,7 +41790,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
|
41767
41790
|
return { removed: true };
|
|
41768
41791
|
}
|
|
41769
41792
|
function holdsAGitDirectoryRatherThanALink(worktreePath) {
|
|
41770
|
-
return
|
|
41793
|
+
return statSync15(join100(worktreePath, ".git"), {
|
|
41771
41794
|
throwIfNoEntry: false
|
|
41772
41795
|
})?.isDirectory() === true;
|
|
41773
41796
|
}
|
|
@@ -41803,7 +41826,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
41803
41826
|
);
|
|
41804
41827
|
}
|
|
41805
41828
|
function strandedReason(worktreePath, cause) {
|
|
41806
|
-
if (!existsSync86(
|
|
41829
|
+
if (!existsSync86(join101(worktreePath, ".git")))
|
|
41807
41830
|
return "its .git link is already gone";
|
|
41808
41831
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
41809
41832
|
return "git no longer recognises it as a working tree";
|
|
@@ -42046,12 +42069,12 @@ function closeGateApplies(sessions, session) {
|
|
|
42046
42069
|
}
|
|
42047
42070
|
|
|
42048
42071
|
// src/commands/sessions/daemon/worktree/liveProcessesInTree.ts
|
|
42049
|
-
import { readdirSync as
|
|
42072
|
+
import { readdirSync as readdirSync23, readlinkSync } from "fs";
|
|
42050
42073
|
import { sep as sep4 } from "path";
|
|
42051
42074
|
function liveProcessesInTree(treePath, procRoot = "/proc") {
|
|
42052
42075
|
let entries;
|
|
42053
42076
|
try {
|
|
42054
|
-
entries =
|
|
42077
|
+
entries = readdirSync23(procRoot);
|
|
42055
42078
|
} catch {
|
|
42056
42079
|
return [];
|
|
42057
42080
|
}
|
|
@@ -46427,7 +46450,7 @@ import { existsSync as existsSync95 } from "fs";
|
|
|
46427
46450
|
|
|
46428
46451
|
// src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
|
|
46429
46452
|
import { copyFileSync as copyFileSync5, existsSync as existsSync94, mkdirSync as mkdirSync36 } from "fs";
|
|
46430
|
-
import { join as
|
|
46453
|
+
import { join as join103 } from "path";
|
|
46431
46454
|
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
46432
46455
|
const dir = projectDirForCwd(toCwd);
|
|
46433
46456
|
if (dir === projectDirForCwd(fromCwd)) {
|
|
@@ -46436,7 +46459,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
46436
46459
|
);
|
|
46437
46460
|
return;
|
|
46438
46461
|
}
|
|
46439
|
-
const dest =
|
|
46462
|
+
const dest = join103(dir, `${claudeSessionId}.jsonl`);
|
|
46440
46463
|
if (existsSync94(dest)) {
|
|
46441
46464
|
daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
|
|
46442
46465
|
return;
|