@staff0rd/assist 0.766.2 → 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 +229 -203
- 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;
|
|
@@ -15884,7 +15906,10 @@ function runCommandToCompletion(command, args, env, cwd, quiet) {
|
|
|
15884
15906
|
|
|
15885
15907
|
// src/commands/sessions/web/selfUpdate.ts
|
|
15886
15908
|
async function runAssistUpdate() {
|
|
15887
|
-
const result = await runCommandToCompletion(
|
|
15909
|
+
const result = await runCommandToCompletion(process.execPath, [
|
|
15910
|
+
process.argv[1],
|
|
15911
|
+
"update"
|
|
15912
|
+
]);
|
|
15888
15913
|
if (result.kind === "failed") throw new Error(result.message);
|
|
15889
15914
|
if (result.exitCode !== 0)
|
|
15890
15915
|
throw new Error(`assist update exited with code ${result.exitCode}`);
|
|
@@ -16939,7 +16964,7 @@ async function readRequestBuffer(req, limit) {
|
|
|
16939
16964
|
|
|
16940
16965
|
// src/commands/sessions/web/stageAttachment.ts
|
|
16941
16966
|
import { mkdir as mkdir4, mkdtemp, writeFile as writeFile2 } from "fs/promises";
|
|
16942
|
-
import { extname as extname2, join as
|
|
16967
|
+
import { extname as extname2, join as join41 } from "path";
|
|
16943
16968
|
function extensionFromMime(contentType) {
|
|
16944
16969
|
const mime = contentType.split(";")[0].trim().toLowerCase();
|
|
16945
16970
|
const known = attachmentMimeTypes[mime];
|
|
@@ -16958,9 +16983,9 @@ function safeBaseName(name) {
|
|
|
16958
16983
|
}
|
|
16959
16984
|
async function stageAttachment(name, contentType, body) {
|
|
16960
16985
|
await mkdir4(stagedAttachmentsDir, { recursive: true });
|
|
16961
|
-
const dir = await mkdtemp(
|
|
16986
|
+
const dir = await mkdtemp(join41(stagedAttachmentsDir, "upload-"));
|
|
16962
16987
|
const alt = safeBaseName(name);
|
|
16963
|
-
const filePath =
|
|
16988
|
+
const filePath = join41(dir, `${alt}.${pickExtension(name, contentType)}`);
|
|
16964
16989
|
await writeFile2(filePath, body);
|
|
16965
16990
|
return { dir, filePath, alt };
|
|
16966
16991
|
}
|
|
@@ -17010,14 +17035,14 @@ import { readFile as readFile3, stat as stat4, writeFile as writeFile3 } from "f
|
|
|
17010
17035
|
// src/commands/sessions/web/formatWithOxfmt.ts
|
|
17011
17036
|
import { execFile as execFile10 } from "child_process";
|
|
17012
17037
|
import { existsSync as existsSync40 } from "fs";
|
|
17013
|
-
import { dirname as dirname24, join as
|
|
17038
|
+
import { dirname as dirname24, join as join42 } from "path";
|
|
17014
17039
|
import { promisify as promisify10 } from "util";
|
|
17015
17040
|
var execFileAsync9 = promisify10(execFile10);
|
|
17016
17041
|
var TIMEOUT_MS = 15e3;
|
|
17017
17042
|
function findOxfmtScript(root2) {
|
|
17018
17043
|
let dir = root2;
|
|
17019
17044
|
for (; ; ) {
|
|
17020
|
-
const candidate =
|
|
17045
|
+
const candidate = join42(dir, "node_modules", "oxfmt", "bin", "oxfmt");
|
|
17021
17046
|
if (existsSync40(candidate)) return candidate;
|
|
17022
17047
|
const parent = dirname24(dir);
|
|
17023
17048
|
if (parent === dir) return void 0;
|
|
@@ -17469,6 +17494,7 @@ async function web(options2) {
|
|
|
17469
17494
|
};
|
|
17470
17495
|
attachSessionSocket(server, ctx);
|
|
17471
17496
|
installRestartMenu();
|
|
17497
|
+
sweepStagedAttachments();
|
|
17472
17498
|
streamDaemonLogs();
|
|
17473
17499
|
void ensureDaemonRunning("web server start").catch((error) => {
|
|
17474
17500
|
console.error(
|
|
@@ -18545,12 +18571,12 @@ function findCliWrite(command) {
|
|
|
18545
18571
|
// src/shared/readSettingsPerms.ts
|
|
18546
18572
|
import { existsSync as existsSync42, readFileSync as readFileSync27 } from "fs";
|
|
18547
18573
|
import { homedir as homedir16 } from "os";
|
|
18548
|
-
import { join as
|
|
18574
|
+
import { join as join43 } from "path";
|
|
18549
18575
|
function readSettingsPerms(key) {
|
|
18550
18576
|
const paths = [
|
|
18551
|
-
|
|
18552
|
-
|
|
18553
|
-
|
|
18577
|
+
join43(homedir16(), ".claude", "settings.json"),
|
|
18578
|
+
join43(process.cwd(), ".claude", "settings.json"),
|
|
18579
|
+
join43(process.cwd(), ".claude", "settings.local.json")
|
|
18554
18580
|
];
|
|
18555
18581
|
const entries = [];
|
|
18556
18582
|
for (const p of paths) {
|
|
@@ -18774,11 +18800,11 @@ function decideCommand(toolName, rawCommand) {
|
|
|
18774
18800
|
// src/commands/cliHook/logDeniedToolCall.ts
|
|
18775
18801
|
import { mkdirSync as mkdirSync12 } from "fs";
|
|
18776
18802
|
import { homedir as homedir17 } from "os";
|
|
18777
|
-
import { join as
|
|
18803
|
+
import { join as join44 } from "path";
|
|
18778
18804
|
import Database from "better-sqlite3";
|
|
18779
18805
|
var _db;
|
|
18780
18806
|
function getDbDir() {
|
|
18781
|
-
return
|
|
18807
|
+
return join44(homedir17(), ".assist");
|
|
18782
18808
|
}
|
|
18783
18809
|
function initSchema(db) {
|
|
18784
18810
|
db.exec(`
|
|
@@ -18797,7 +18823,7 @@ function openPromptsDb(dir) {
|
|
|
18797
18823
|
if (_db) return _db;
|
|
18798
18824
|
const dbDir = dir ?? getDbDir();
|
|
18799
18825
|
mkdirSync12(dbDir, { recursive: true });
|
|
18800
|
-
const db = new Database(
|
|
18826
|
+
const db = new Database(join44(dbDir, "assist.db"));
|
|
18801
18827
|
db.pragma("journal_mode = WAL");
|
|
18802
18828
|
initSchema(db);
|
|
18803
18829
|
_db = db;
|
|
@@ -18918,7 +18944,7 @@ ${reasons.join("\n")}`);
|
|
|
18918
18944
|
// src/commands/permitCliReads.ts
|
|
18919
18945
|
import { existsSync as existsSync43, mkdirSync as mkdirSync13, readFileSync as readFileSync28, writeFileSync as writeFileSync23 } from "fs";
|
|
18920
18946
|
import { homedir as homedir18 } from "os";
|
|
18921
|
-
import { join as
|
|
18947
|
+
import { join as join45 } from "path";
|
|
18922
18948
|
|
|
18923
18949
|
// src/commands/permitCliReads/assertCliExists.ts
|
|
18924
18950
|
function assertCliExists(cli) {
|
|
@@ -19181,7 +19207,7 @@ function updateSettings(cli, commands) {
|
|
|
19181
19207
|
// src/commands/permitCliReads.ts
|
|
19182
19208
|
function logPath(cli) {
|
|
19183
19209
|
const safeName = cli.replace(/\s+/g, "-");
|
|
19184
|
-
return
|
|
19210
|
+
return join45(homedir18(), ".assist", `cli-discover-${safeName}.log`);
|
|
19185
19211
|
}
|
|
19186
19212
|
function readCache(cli) {
|
|
19187
19213
|
const path106 = logPath(cli);
|
|
@@ -19189,7 +19215,7 @@ function readCache(cli) {
|
|
|
19189
19215
|
return readFileSync28(path106, "utf8");
|
|
19190
19216
|
}
|
|
19191
19217
|
function writeCache(cli, output) {
|
|
19192
|
-
const dir =
|
|
19218
|
+
const dir = join45(homedir18(), ".assist");
|
|
19193
19219
|
mkdirSync13(dir, { recursive: true });
|
|
19194
19220
|
writeFileSync23(logPath(cli), output);
|
|
19195
19221
|
}
|
|
@@ -19354,30 +19380,30 @@ function isHashCommentFile(filePath) {
|
|
|
19354
19380
|
|
|
19355
19381
|
// src/commands/codeComment/getRestrictedDir.ts
|
|
19356
19382
|
import { homedir as homedir19 } from "os";
|
|
19357
|
-
import { join as
|
|
19383
|
+
import { join as join46 } from "path";
|
|
19358
19384
|
function getRestrictedDir() {
|
|
19359
|
-
return
|
|
19385
|
+
return join46(homedir19(), ".assist", "restricted");
|
|
19360
19386
|
}
|
|
19361
19387
|
function getPinStatePath(pin2) {
|
|
19362
|
-
return
|
|
19388
|
+
return join46(getRestrictedDir(), `code-comment-${pin2}.json`);
|
|
19363
19389
|
}
|
|
19364
19390
|
|
|
19365
19391
|
// src/commands/codeComment/sweepRestrictedDir.ts
|
|
19366
|
-
import { readdirSync as
|
|
19367
|
-
import { join as
|
|
19392
|
+
import { readdirSync as readdirSync6, statSync as statSync8, unlinkSync as unlinkSync7 } from "fs";
|
|
19393
|
+
import { join as join47 } from "path";
|
|
19368
19394
|
var STALE_AFTER_MS = 30 * 60 * 1e3;
|
|
19369
19395
|
function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
19370
19396
|
let entries;
|
|
19371
19397
|
try {
|
|
19372
|
-
entries =
|
|
19398
|
+
entries = readdirSync6(dir);
|
|
19373
19399
|
} catch {
|
|
19374
19400
|
return;
|
|
19375
19401
|
}
|
|
19376
19402
|
const cutoff = Date.now() - STALE_AFTER_MS;
|
|
19377
19403
|
for (const entry of entries) {
|
|
19378
|
-
const path106 =
|
|
19404
|
+
const path106 = join47(dir, entry);
|
|
19379
19405
|
try {
|
|
19380
|
-
if (
|
|
19406
|
+
if (statSync8(path106).mtimeMs < cutoff) unlinkSync7(path106);
|
|
19381
19407
|
} catch {
|
|
19382
19408
|
continue;
|
|
19383
19409
|
}
|
|
@@ -21029,18 +21055,18 @@ import chalk137 from "chalk";
|
|
|
21029
21055
|
|
|
21030
21056
|
// src/commands/criteriaExtension/criteriaExtensionDir.ts
|
|
21031
21057
|
import { existsSync as existsSync46 } from "fs";
|
|
21032
|
-
import { dirname as dirname26, join as
|
|
21058
|
+
import { dirname as dirname26, join as join48 } from "path";
|
|
21033
21059
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
21034
21060
|
var moduleDir = dirname26(fileURLToPath6(import.meta.url));
|
|
21035
21061
|
function criteriaExtensionDir() {
|
|
21036
|
-
const bundled =
|
|
21062
|
+
const bundled = join48(
|
|
21037
21063
|
moduleDir,
|
|
21038
21064
|
"commands",
|
|
21039
21065
|
"criteriaExtension",
|
|
21040
21066
|
"criteria-extension"
|
|
21041
21067
|
);
|
|
21042
21068
|
if (existsSync46(bundled)) return bundled;
|
|
21043
|
-
return
|
|
21069
|
+
return join48(moduleDir, "..", "..", "..", "criteria-extension");
|
|
21044
21070
|
}
|
|
21045
21071
|
|
|
21046
21072
|
// src/commands/criteriaExtension/criteriaExtension.ts
|
|
@@ -21069,15 +21095,15 @@ async function criteriaExtension() {
|
|
|
21069
21095
|
// src/commands/criteriaExtension/signCriteriaExtension.ts
|
|
21070
21096
|
import { rm as rm2 } from "fs/promises";
|
|
21071
21097
|
import { homedir as homedir20, tmpdir as tmpdir3 } from "os";
|
|
21072
|
-
import { join as
|
|
21098
|
+
import { join as join54 } from "path";
|
|
21073
21099
|
import chalk139 from "chalk";
|
|
21074
21100
|
|
|
21075
21101
|
// src/commands/criteriaExtension/copySignedXpi.ts
|
|
21076
21102
|
import { copyFile } from "fs/promises";
|
|
21077
|
-
import { join as
|
|
21103
|
+
import { join as join49 } from "path";
|
|
21078
21104
|
var SIGNED_XPI_NAME = "criteria-extension.xpi";
|
|
21079
21105
|
async function copySignedXpi(xpi, dir) {
|
|
21080
|
-
const fixed2 =
|
|
21106
|
+
const fixed2 = join49(dir, SIGNED_XPI_NAME);
|
|
21081
21107
|
if (fixed2 === xpi) return fixed2;
|
|
21082
21108
|
await copyFile(xpi, fixed2);
|
|
21083
21109
|
return fixed2;
|
|
@@ -21086,11 +21112,11 @@ async function copySignedXpi(xpi, dir) {
|
|
|
21086
21112
|
// src/commands/criteriaExtension/findSignedXpi.ts
|
|
21087
21113
|
import { existsSync as existsSync47 } from "fs";
|
|
21088
21114
|
import { readdir } from "fs/promises";
|
|
21089
|
-
import { join as
|
|
21115
|
+
import { join as join50 } from "path";
|
|
21090
21116
|
async function findSignedXpi(dir) {
|
|
21091
21117
|
if (!existsSync47(dir)) return null;
|
|
21092
21118
|
const name = (await readdir(dir)).find((entry) => entry.endsWith(".xpi"));
|
|
21093
|
-
return name ?
|
|
21119
|
+
return name ? join50(dir, name) : null;
|
|
21094
21120
|
}
|
|
21095
21121
|
|
|
21096
21122
|
// src/commands/criteriaExtension/signedAddonInstallPath.ts
|
|
@@ -21113,10 +21139,10 @@ async function signedAddonInstallPath(xpi) {
|
|
|
21113
21139
|
|
|
21114
21140
|
// src/commands/criteriaExtension/signPreflightProblem.ts
|
|
21115
21141
|
import { existsSync as existsSync48 } from "fs";
|
|
21116
|
-
import { join as
|
|
21142
|
+
import { join as join51 } from "path";
|
|
21117
21143
|
var KEY_URL = "https://addons.mozilla.org/en-US/developers/addon/api/key/";
|
|
21118
21144
|
function signPreflightProblem(source) {
|
|
21119
|
-
if (!existsSync48(
|
|
21145
|
+
if (!existsSync48(join51(source, "content.js")))
|
|
21120
21146
|
return {
|
|
21121
21147
|
message: `no content.js in ${source}`,
|
|
21122
21148
|
hint: "run npm run build to bundle the content script"
|
|
@@ -21131,7 +21157,7 @@ function signPreflightProblem(source) {
|
|
|
21131
21157
|
|
|
21132
21158
|
// src/commands/criteriaExtension/stageCriteriaExtension.ts
|
|
21133
21159
|
import { cp as cp3, mkdir as mkdir5, readFile as readFile4, rm, writeFile as writeFile4 } from "fs/promises";
|
|
21134
|
-
import { basename as basename13, join as
|
|
21160
|
+
import { basename as basename13, join as join52 } from "path";
|
|
21135
21161
|
|
|
21136
21162
|
// src/commands/criteriaExtension/stampManifestVersion.ts
|
|
21137
21163
|
function stampManifestVersion(manifest, version2) {
|
|
@@ -21148,7 +21174,7 @@ async function stageCriteriaExtension(source, staging, version2) {
|
|
|
21148
21174
|
recursive: true,
|
|
21149
21175
|
filter: (path106) => basename13(path106) !== "updates.json"
|
|
21150
21176
|
});
|
|
21151
|
-
const manifest =
|
|
21177
|
+
const manifest = join52(staging, "manifest.json");
|
|
21152
21178
|
const stamped = stampManifestVersion(
|
|
21153
21179
|
await readFile4(manifest, "utf8"),
|
|
21154
21180
|
version2
|
|
@@ -21158,7 +21184,7 @@ async function stageCriteriaExtension(source, staging, version2) {
|
|
|
21158
21184
|
|
|
21159
21185
|
// src/commands/criteriaExtension/writeUpdateManifest.ts
|
|
21160
21186
|
import { readFile as readFile5, writeFile as writeFile5 } from "fs/promises";
|
|
21161
|
-
import { join as
|
|
21187
|
+
import { join as join53 } from "path";
|
|
21162
21188
|
|
|
21163
21189
|
// src/commands/criteriaExtension/buildUpdateManifest.ts
|
|
21164
21190
|
var RELEASE_DOWNLOAD_URL = "https://github.com/staff0rd/assist/releases/download";
|
|
@@ -21183,17 +21209,17 @@ function buildUpdateManifest(manifest, version2) {
|
|
|
21183
21209
|
// src/commands/criteriaExtension/writeUpdateManifest.ts
|
|
21184
21210
|
async function writeUpdateManifest(source, dir, version2) {
|
|
21185
21211
|
await writeFile5(
|
|
21186
|
-
|
|
21212
|
+
join53(dir, "updates.json"),
|
|
21187
21213
|
buildUpdateManifest(
|
|
21188
|
-
await readFile5(
|
|
21214
|
+
await readFile5(join53(source, "manifest.json"), "utf8"),
|
|
21189
21215
|
version2
|
|
21190
21216
|
)
|
|
21191
21217
|
);
|
|
21192
21218
|
}
|
|
21193
21219
|
|
|
21194
21220
|
// src/commands/criteriaExtension/signCriteriaExtension.ts
|
|
21195
|
-
var ARTIFACTS_DIR =
|
|
21196
|
-
var STAGING_DIR =
|
|
21221
|
+
var ARTIFACTS_DIR = join54(homedir20(), ".assist", "criteria-extension");
|
|
21222
|
+
var STAGING_DIR = join54(tmpdir3(), "assist-criteria-extension");
|
|
21197
21223
|
async function signCriteriaExtension() {
|
|
21198
21224
|
const source = criteriaExtensionDir();
|
|
21199
21225
|
const problem = signPreflightProblem(source);
|
|
@@ -21377,12 +21403,12 @@ import { unlinkSync as unlinkSync9, writeFileSync as writeFileSync26 } from "fs"
|
|
|
21377
21403
|
import chalk142 from "chalk";
|
|
21378
21404
|
|
|
21379
21405
|
// src/commands/dbMigration/getMigrationPinPath.ts
|
|
21380
|
-
import { join as
|
|
21406
|
+
import { join as join55 } from "path";
|
|
21381
21407
|
function getMigrationPinPath(pin2) {
|
|
21382
|
-
return
|
|
21408
|
+
return join55(getRestrictedDir(), `db-migration-pin-${pin2}.json`);
|
|
21383
21409
|
}
|
|
21384
21410
|
function getMigrationApprovalPath(migrationId) {
|
|
21385
|
-
return
|
|
21411
|
+
return join55(getRestrictedDir(), `db-migration-approval-${migrationId}.json`);
|
|
21386
21412
|
}
|
|
21387
21413
|
|
|
21388
21414
|
// src/commands/dbMigration/readMigrationPinState.ts
|
|
@@ -21520,10 +21546,10 @@ import { basename as basename15 } from "path";
|
|
|
21520
21546
|
|
|
21521
21547
|
// src/commands/devlog/loadBlogSkipDays.ts
|
|
21522
21548
|
import { homedir as homedir21 } from "os";
|
|
21523
|
-
import { join as
|
|
21524
|
-
var BLOG_REPO_ROOT =
|
|
21549
|
+
import { join as join56 } from "path";
|
|
21550
|
+
var BLOG_REPO_ROOT = join56(homedir21(), "git/blog");
|
|
21525
21551
|
function loadBlogSkipDays(repoName) {
|
|
21526
|
-
const config = loadRawYaml(
|
|
21552
|
+
const config = loadRawYaml(join56(BLOG_REPO_ROOT, "assist.yml"));
|
|
21527
21553
|
const devlog = config.devlog;
|
|
21528
21554
|
const skip2 = devlog?.skip;
|
|
21529
21555
|
return new Set(skip2?.[repoName]);
|
|
@@ -21535,13 +21561,13 @@ import chalk145 from "chalk";
|
|
|
21535
21561
|
|
|
21536
21562
|
// src/shared/getRepoName.ts
|
|
21537
21563
|
import { existsSync as existsSync51, readFileSync as readFileSync33 } from "fs";
|
|
21538
|
-
import { basename as basename14, join as
|
|
21564
|
+
import { basename as basename14, join as join57 } from "path";
|
|
21539
21565
|
function getRepoName() {
|
|
21540
21566
|
const config = loadConfig();
|
|
21541
21567
|
if (config.devlog?.name) {
|
|
21542
21568
|
return config.devlog.name;
|
|
21543
21569
|
}
|
|
21544
|
-
const packageJsonPath =
|
|
21570
|
+
const packageJsonPath = join57(process.cwd(), "package.json");
|
|
21545
21571
|
if (existsSync51(packageJsonPath)) {
|
|
21546
21572
|
try {
|
|
21547
21573
|
const content = readFileSync33(packageJsonPath, "utf8");
|
|
@@ -21556,9 +21582,9 @@ function getRepoName() {
|
|
|
21556
21582
|
}
|
|
21557
21583
|
|
|
21558
21584
|
// src/commands/devlog/loadDevlogEntries.ts
|
|
21559
|
-
import { readdirSync as
|
|
21560
|
-
import { join as
|
|
21561
|
-
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");
|
|
21562
21588
|
function extractFrontmatter(content) {
|
|
21563
21589
|
const fm = content.match(/^---\n([\s\S]*?)\n---/);
|
|
21564
21590
|
return fm?.[1] ?? null;
|
|
@@ -21584,9 +21610,9 @@ function parseFrontmatter(content, filename) {
|
|
|
21584
21610
|
}
|
|
21585
21611
|
function readDevlogFiles(callback) {
|
|
21586
21612
|
try {
|
|
21587
|
-
const files =
|
|
21613
|
+
const files = readdirSync7(DEVLOG_DIR).filter((f) => f.endsWith(".md"));
|
|
21588
21614
|
for (const file of files) {
|
|
21589
|
-
const content = readFileSync34(
|
|
21615
|
+
const content = readFileSync34(join58(DEVLOG_DIR, file), "utf8");
|
|
21590
21616
|
const parsed = parseFrontmatter(content, file);
|
|
21591
21617
|
if (parsed) callback(parsed);
|
|
21592
21618
|
}
|
|
@@ -21974,11 +22000,11 @@ function repos(options2) {
|
|
|
21974
22000
|
|
|
21975
22001
|
// src/commands/devlog/skip.ts
|
|
21976
22002
|
import { writeFileSync as writeFileSync29 } from "fs";
|
|
21977
|
-
import { join as
|
|
22003
|
+
import { join as join59 } from "path";
|
|
21978
22004
|
import chalk150 from "chalk";
|
|
21979
22005
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
21980
22006
|
function getBlogConfigPath() {
|
|
21981
|
-
return
|
|
22007
|
+
return join59(BLOG_REPO_ROOT, "assist.yml");
|
|
21982
22008
|
}
|
|
21983
22009
|
function skip(date) {
|
|
21984
22010
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
@@ -22039,20 +22065,20 @@ function registerDevlog(program2) {
|
|
|
22039
22065
|
}
|
|
22040
22066
|
|
|
22041
22067
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
22042
|
-
import { closeSync as closeSync4, openSync as openSync5, readdirSync as
|
|
22043
|
-
import { join as
|
|
22068
|
+
import { closeSync as closeSync4, openSync as openSync5, readdirSync as readdirSync8 } from "fs";
|
|
22069
|
+
import { join as join60 } from "path";
|
|
22044
22070
|
import chalk152 from "chalk";
|
|
22045
22071
|
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "packages"]);
|
|
22046
22072
|
function isLockedDll(debugDir) {
|
|
22047
22073
|
let files;
|
|
22048
22074
|
try {
|
|
22049
|
-
files =
|
|
22075
|
+
files = readdirSync8(debugDir, { recursive: true });
|
|
22050
22076
|
} catch {
|
|
22051
22077
|
return null;
|
|
22052
22078
|
}
|
|
22053
22079
|
for (const file of files) {
|
|
22054
22080
|
if (!file.toLowerCase().endsWith(".dll")) continue;
|
|
22055
|
-
const dllPath =
|
|
22081
|
+
const dllPath = join60(debugDir, file);
|
|
22056
22082
|
try {
|
|
22057
22083
|
const fd = openSync5(dllPath, "r+");
|
|
22058
22084
|
closeSync4(fd);
|
|
@@ -22065,18 +22091,18 @@ function isLockedDll(debugDir) {
|
|
|
22065
22091
|
function findFirstLockedDll(dir) {
|
|
22066
22092
|
let entries;
|
|
22067
22093
|
try {
|
|
22068
|
-
entries =
|
|
22094
|
+
entries = readdirSync8(dir);
|
|
22069
22095
|
} catch {
|
|
22070
22096
|
return null;
|
|
22071
22097
|
}
|
|
22072
22098
|
if (entries.includes("bin")) {
|
|
22073
|
-
const locked = isLockedDll(
|
|
22099
|
+
const locked = isLockedDll(join60(dir, "bin", "Debug"));
|
|
22074
22100
|
if (locked) return locked;
|
|
22075
22101
|
}
|
|
22076
22102
|
for (const entry of entries) {
|
|
22077
22103
|
if (SKIP_DIRS.has(entry) || entry === "bin" || entry.startsWith("."))
|
|
22078
22104
|
continue;
|
|
22079
|
-
const found = findFirstLockedDll(
|
|
22105
|
+
const found = findFirstLockedDll(join60(dir, entry));
|
|
22080
22106
|
if (found) return found;
|
|
22081
22107
|
}
|
|
22082
22108
|
return null;
|
|
@@ -22145,14 +22171,14 @@ function collectAllDeps(node) {
|
|
|
22145
22171
|
}
|
|
22146
22172
|
|
|
22147
22173
|
// src/commands/dotnet/findContainingSolutions.ts
|
|
22148
|
-
import { readdirSync as
|
|
22174
|
+
import { readdirSync as readdirSync9, readFileSync as readFileSync36, statSync as statSync9 } from "fs";
|
|
22149
22175
|
import path35 from "path";
|
|
22150
22176
|
function findSlnFiles(dir, maxDepth, depth = 0) {
|
|
22151
22177
|
if (depth > maxDepth) return [];
|
|
22152
22178
|
const results = [];
|
|
22153
22179
|
let entries;
|
|
22154
22180
|
try {
|
|
22155
|
-
entries =
|
|
22181
|
+
entries = readdirSync9(dir);
|
|
22156
22182
|
} catch {
|
|
22157
22183
|
return results;
|
|
22158
22184
|
}
|
|
@@ -22161,7 +22187,7 @@ function findSlnFiles(dir, maxDepth, depth = 0) {
|
|
|
22161
22187
|
continue;
|
|
22162
22188
|
const full = path35.join(dir, entry);
|
|
22163
22189
|
try {
|
|
22164
|
-
const stat5 =
|
|
22190
|
+
const stat5 = statSync9(full);
|
|
22165
22191
|
if (stat5.isFile() && entry.endsWith(".sln")) {
|
|
22166
22192
|
results.push(full);
|
|
22167
22193
|
} else if (stat5.isDirectory()) {
|
|
@@ -22422,12 +22448,12 @@ import path37 from "path";
|
|
|
22422
22448
|
import chalk158 from "chalk";
|
|
22423
22449
|
|
|
22424
22450
|
// src/commands/dotnet/findSolution.ts
|
|
22425
|
-
import { readdirSync as
|
|
22426
|
-
import { dirname as dirname27, join as
|
|
22451
|
+
import { readdirSync as readdirSync10 } from "fs";
|
|
22452
|
+
import { dirname as dirname27, join as join61 } from "path";
|
|
22427
22453
|
import chalk157 from "chalk";
|
|
22428
22454
|
function findSlnInDir(dir) {
|
|
22429
22455
|
try {
|
|
22430
|
-
return
|
|
22456
|
+
return readdirSync10(dir).filter((f) => f.endsWith(".sln")).map((f) => join61(dir, f));
|
|
22431
22457
|
} catch {
|
|
22432
22458
|
return [];
|
|
22433
22459
|
}
|
|
@@ -23422,7 +23448,7 @@ function aggregateCommitters(authorLists) {
|
|
|
23422
23448
|
import { spawnSync as spawnSync6 } from "child_process";
|
|
23423
23449
|
import { unlinkSync as unlinkSync12, writeFileSync as writeFileSync30 } from "fs";
|
|
23424
23450
|
import { tmpdir as tmpdir5 } from "os";
|
|
23425
|
-
import { join as
|
|
23451
|
+
import { join as join62 } from "path";
|
|
23426
23452
|
function buildArgs2(queryFile, vars) {
|
|
23427
23453
|
const args = ["api", "graphql", "-F", `query=@${queryFile}`];
|
|
23428
23454
|
for (const [key, value] of Object.entries(vars)) {
|
|
@@ -23432,7 +23458,7 @@ function buildArgs2(queryFile, vars) {
|
|
|
23432
23458
|
return args;
|
|
23433
23459
|
}
|
|
23434
23460
|
function runGhGraphql(mutation, vars) {
|
|
23435
|
-
const queryFile =
|
|
23461
|
+
const queryFile = join62(tmpdir5(), `gh-query-${Date.now()}.graphql`);
|
|
23436
23462
|
writeFileSync30(queryFile, mutation);
|
|
23437
23463
|
try {
|
|
23438
23464
|
const result = spawnSync6("gh", buildArgs2(queryFile, vars), {
|
|
@@ -24616,13 +24642,13 @@ import { execFileSync as execFileSync9 } from "child_process";
|
|
|
24616
24642
|
import { basename as basename16 } from "path";
|
|
24617
24643
|
|
|
24618
24644
|
// src/shared/removeStagedAttachments.ts
|
|
24619
|
-
import { rmSync as
|
|
24645
|
+
import { rmSync as rmSync4 } from "fs";
|
|
24620
24646
|
import { dirname as dirname28 } from "path";
|
|
24621
24647
|
function removeStagedAttachments(attachments) {
|
|
24622
24648
|
for (const { path: path106 } of attachments) {
|
|
24623
24649
|
const dir = dirname28(path106);
|
|
24624
24650
|
if (!isStagedAttachmentPath(dir)) continue;
|
|
24625
|
-
|
|
24651
|
+
rmSync4(dir, { recursive: true, force: true });
|
|
24626
24652
|
}
|
|
24627
24653
|
}
|
|
24628
24654
|
|
|
@@ -24780,14 +24806,14 @@ function fetchIssue2(number, repo) {
|
|
|
24780
24806
|
import { existsSync as existsSync56, readFileSync as readFileSync38 } from "fs";
|
|
24781
24807
|
|
|
24782
24808
|
// src/commands/github/issue/issueWorkingFile.ts
|
|
24783
|
-
import { join as
|
|
24809
|
+
import { join as join63 } from "path";
|
|
24784
24810
|
function issueWorkingFile(slug2, number) {
|
|
24785
24811
|
const [owner = "unknown", repo = "unknown"] = slug2.split("/");
|
|
24786
|
-
const dir =
|
|
24812
|
+
const dir = join63(getStoreDir(), "github-issues", owner, repo);
|
|
24787
24813
|
return {
|
|
24788
24814
|
dir,
|
|
24789
|
-
bodyPath:
|
|
24790
|
-
metaPath:
|
|
24815
|
+
bodyPath: join63(dir, `${number}.md`),
|
|
24816
|
+
metaPath: join63(dir, `${number}.json`)
|
|
24791
24817
|
};
|
|
24792
24818
|
}
|
|
24793
24819
|
|
|
@@ -25430,14 +25456,14 @@ import { existsSync as existsSync57 } from "fs";
|
|
|
25430
25456
|
import { basename as basename18, dirname as dirname29 } from "path";
|
|
25431
25457
|
|
|
25432
25458
|
// src/commands/sessions/daemon/worktree/planAllocation.ts
|
|
25433
|
-
import { basename as basename17, join as
|
|
25459
|
+
import { basename as basename17, join as join64 } from "path";
|
|
25434
25460
|
function planAllocation(clone, boundTreeRoots2) {
|
|
25435
25461
|
return boundTreeRoots2.has(clone) ? "spill" : "primary";
|
|
25436
25462
|
}
|
|
25437
25463
|
function nextWorktreePath(clone, base, isTaken) {
|
|
25438
25464
|
const name = basename17(clone);
|
|
25439
25465
|
for (let n = 2; n < 1e3; n++) {
|
|
25440
|
-
const candidate =
|
|
25466
|
+
const candidate = join64(base, `${name}-${n}`);
|
|
25441
25467
|
if (!isTaken(candidate)) return candidate;
|
|
25442
25468
|
}
|
|
25443
25469
|
throw new Error(`no free worktree suffix for ${clone}`);
|
|
@@ -25791,19 +25817,19 @@ function persistedTreeRoots() {
|
|
|
25791
25817
|
|
|
25792
25818
|
// src/commands/sessions/daemon/worktree/seedWorktree.ts
|
|
25793
25819
|
import { copyFileSync, existsSync as existsSync60, mkdirSync as mkdirSync17 } from "fs";
|
|
25794
|
-
import { dirname as dirname30, join as
|
|
25820
|
+
import { dirname as dirname30, join as join66 } from "path";
|
|
25795
25821
|
|
|
25796
25822
|
// src/commands/sessions/daemon/worktree/runInstall.ts
|
|
25797
25823
|
import { resolve as resolve17 } from "path";
|
|
25798
25824
|
|
|
25799
25825
|
// src/commands/sessions/daemon/worktree/detectInstallCommand.ts
|
|
25800
25826
|
import { existsSync as existsSync59 } from "fs";
|
|
25801
|
-
import { join as
|
|
25827
|
+
import { join as join65 } from "path";
|
|
25802
25828
|
function detectInstallCommand(dir) {
|
|
25803
|
-
if (!existsSync59(
|
|
25804
|
-
if (existsSync59(
|
|
25805
|
-
if (existsSync59(
|
|
25806
|
-
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";
|
|
25807
25833
|
return "npm install";
|
|
25808
25834
|
}
|
|
25809
25835
|
|
|
@@ -25965,9 +25991,9 @@ function seedWorktree(worktreePath, clone, onSeeded = () => {
|
|
|
25965
25991
|
}
|
|
25966
25992
|
function copyConfigFiles(worktreePath, clone, copy) {
|
|
25967
25993
|
for (const rel of copy) {
|
|
25968
|
-
const src =
|
|
25994
|
+
const src = join66(clone, rel);
|
|
25969
25995
|
if (!existsSync60(src)) continue;
|
|
25970
|
-
const dest =
|
|
25996
|
+
const dest = join66(worktreePath, rel);
|
|
25971
25997
|
try {
|
|
25972
25998
|
mkdirSync17(dirname30(dest), { recursive: true });
|
|
25973
25999
|
copyFileSync(src, dest);
|
|
@@ -26271,7 +26297,7 @@ function registerLitellm(program2) {
|
|
|
26271
26297
|
}
|
|
26272
26298
|
|
|
26273
26299
|
// src/commands/mermaidExport.ts
|
|
26274
|
-
import { mkdirSync as mkdirSync18, readdirSync as
|
|
26300
|
+
import { mkdirSync as mkdirSync18, readdirSync as readdirSync11 } from "fs";
|
|
26275
26301
|
import { resolve as resolve19 } from "path";
|
|
26276
26302
|
import chalk174 from "chalk";
|
|
26277
26303
|
|
|
@@ -26353,7 +26379,7 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
26353
26379
|
process.exit(1);
|
|
26354
26380
|
}
|
|
26355
26381
|
}
|
|
26356
|
-
const files = file ? [file] :
|
|
26382
|
+
const files = file ? [file] : readdirSync11(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
26357
26383
|
if (files.length === 0) {
|
|
26358
26384
|
console.log(chalk174.gray("No markdown files found in current directory."));
|
|
26359
26385
|
return;
|
|
@@ -27001,15 +27027,15 @@ function createNetcapHandler(options2) {
|
|
|
27001
27027
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
27002
27028
|
import { cp as cp4, readFile as readFile6, writeFile as writeFile6 } from "fs/promises";
|
|
27003
27029
|
import { networkInterfaces } from "os";
|
|
27004
|
-
import { join as
|
|
27030
|
+
import { join as join68 } from "path";
|
|
27005
27031
|
import chalk177 from "chalk";
|
|
27006
27032
|
|
|
27007
27033
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
27008
|
-
import { dirname as dirname32, join as
|
|
27034
|
+
import { dirname as dirname32, join as join67 } from "path";
|
|
27009
27035
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
27010
27036
|
var moduleDir2 = dirname32(fileURLToPath7(import.meta.url));
|
|
27011
27037
|
function netcapExtensionDir() {
|
|
27012
|
-
return
|
|
27038
|
+
return join67(moduleDir2, "commands", "netcap", "netcap-extension");
|
|
27013
27039
|
}
|
|
27014
27040
|
|
|
27015
27041
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
@@ -27024,7 +27050,7 @@ function lanIPv4() {
|
|
|
27024
27050
|
return void 0;
|
|
27025
27051
|
}
|
|
27026
27052
|
async function configureBackground(dir, host, port, filter) {
|
|
27027
|
-
const file =
|
|
27053
|
+
const file = join68(dir, "background.js");
|
|
27028
27054
|
const source = await readFile6(file, "utf8");
|
|
27029
27055
|
await writeFile6(
|
|
27030
27056
|
file,
|
|
@@ -27064,20 +27090,20 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
27064
27090
|
}
|
|
27065
27091
|
|
|
27066
27092
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
27067
|
-
import { isAbsolute as isAbsolute5, join as
|
|
27093
|
+
import { isAbsolute as isAbsolute5, join as join70, resolve as resolve21 } from "path";
|
|
27068
27094
|
|
|
27069
27095
|
// src/commands/netcap/defaultCapturePath.ts
|
|
27070
27096
|
import { homedir as homedir22 } from "os";
|
|
27071
|
-
import { join as
|
|
27097
|
+
import { join as join69 } from "path";
|
|
27072
27098
|
function defaultCapturePath() {
|
|
27073
|
-
return
|
|
27099
|
+
return join69(homedir22(), ".assist", "netcap", "capture.jsonl");
|
|
27074
27100
|
}
|
|
27075
27101
|
|
|
27076
27102
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
27077
27103
|
function resolveNetcapOutPath(out) {
|
|
27078
27104
|
if (!out) return defaultCapturePath();
|
|
27079
27105
|
const dir = isAbsolute5(out) ? out : resolve21(process.cwd(), out);
|
|
27080
|
-
return
|
|
27106
|
+
return join70(dir, "capture.jsonl");
|
|
27081
27107
|
}
|
|
27082
27108
|
|
|
27083
27109
|
// src/commands/netcap/netcap.ts
|
|
@@ -27124,7 +27150,7 @@ netcap stopped \u2014 captured ${count8} ${count8 === 1 ? "entry" : "entries"} t
|
|
|
27124
27150
|
|
|
27125
27151
|
// src/commands/netcap/netcapExtract.ts
|
|
27126
27152
|
import { writeFileSync as writeFileSync34 } from "fs";
|
|
27127
|
-
import { join as
|
|
27153
|
+
import { join as join71 } from "path";
|
|
27128
27154
|
import chalk179 from "chalk";
|
|
27129
27155
|
|
|
27130
27156
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
@@ -27569,7 +27595,7 @@ function extractPostsFromCapture(captureFile) {
|
|
|
27569
27595
|
function netcapExtract(file) {
|
|
27570
27596
|
const captureFile = file ?? defaultCapturePath();
|
|
27571
27597
|
const posts = extractPostsFromCapture(captureFile);
|
|
27572
|
-
const outFile =
|
|
27598
|
+
const outFile = join71(captureFile, "..", "posts.json");
|
|
27573
27599
|
writeFileSync34(outFile, `${JSON.stringify(posts, null, 2)}
|
|
27574
27600
|
`);
|
|
27575
27601
|
console.log(
|
|
@@ -27932,7 +27958,7 @@ import { execSync as execSync41 } from "child_process";
|
|
|
27932
27958
|
import { execSync as execSync40 } from "child_process";
|
|
27933
27959
|
import { unlinkSync as unlinkSync14, writeFileSync as writeFileSync35 } from "fs";
|
|
27934
27960
|
import { tmpdir as tmpdir6 } from "os";
|
|
27935
|
-
import { join as
|
|
27961
|
+
import { join as join73 } from "path";
|
|
27936
27962
|
|
|
27937
27963
|
// src/commands/prs/loadCommentsCache.ts
|
|
27938
27964
|
import { existsSync as existsSync62, readFileSync as readFileSync43, unlinkSync as unlinkSync13 } from "fs";
|
|
@@ -27940,9 +27966,9 @@ import { parse as parse3 } from "yaml";
|
|
|
27940
27966
|
|
|
27941
27967
|
// src/commands/prs/commentsCachePath.ts
|
|
27942
27968
|
import { homedir as homedir23 } from "os";
|
|
27943
|
-
import { join as
|
|
27969
|
+
import { join as join72 } from "path";
|
|
27944
27970
|
function commentsCachePath(org, repo, prNumber) {
|
|
27945
|
-
return
|
|
27971
|
+
return join72(
|
|
27946
27972
|
homedir23(),
|
|
27947
27973
|
".assist",
|
|
27948
27974
|
"pr-comments",
|
|
@@ -27991,7 +28017,7 @@ function replyToComment(org, repo, prNumber, commentId, message3) {
|
|
|
27991
28017
|
// src/commands/prs/resolveCommentWithReply.ts
|
|
27992
28018
|
function resolveThread(threadId) {
|
|
27993
28019
|
const mutation = `mutation($threadId: ID!) { resolveReviewThread(input: {threadId: $threadId}) { thread { isResolved } } }`;
|
|
27994
|
-
const queryFile =
|
|
28020
|
+
const queryFile = join73(tmpdir6(), `gh-mutation-${Date.now()}.graphql`);
|
|
27995
28021
|
writeFileSync35(queryFile, mutation);
|
|
27996
28022
|
try {
|
|
27997
28023
|
execSync40(
|
|
@@ -28076,10 +28102,10 @@ function fixed(commentId, sha) {
|
|
|
28076
28102
|
import { execSync as execSync42 } from "child_process";
|
|
28077
28103
|
import { unlinkSync as unlinkSync15, writeFileSync as writeFileSync36 } from "fs";
|
|
28078
28104
|
import { tmpdir as tmpdir7 } from "os";
|
|
28079
|
-
import { join as
|
|
28105
|
+
import { join as join74 } from "path";
|
|
28080
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 } } } } } } }`;
|
|
28081
28107
|
function fetchThreadIds(org, repo, prNumber) {
|
|
28082
|
-
const queryFile =
|
|
28108
|
+
const queryFile = join74(tmpdir7(), `gh-query-${Date.now()}.graphql`);
|
|
28083
28109
|
writeFileSync36(queryFile, THREAD_QUERY);
|
|
28084
28110
|
try {
|
|
28085
28111
|
const result = execSync42(
|
|
@@ -28153,19 +28179,19 @@ import { dirname as dirname34 } from "path";
|
|
|
28153
28179
|
import { stringify as stringify3 } from "yaml";
|
|
28154
28180
|
|
|
28155
28181
|
// src/commands/prs/removeStaleCommentsCaches.ts
|
|
28156
|
-
import { readdirSync as
|
|
28157
|
-
import { join as
|
|
28182
|
+
import { readdirSync as readdirSync12, unlinkSync as unlinkSync16 } from "fs";
|
|
28183
|
+
import { join as join75 } from "path";
|
|
28158
28184
|
var STALE_PATTERN = /^pr-\d+-comments\.yaml$/;
|
|
28159
28185
|
function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
28160
|
-
const dir =
|
|
28186
|
+
const dir = join75(cwd, ".assist");
|
|
28161
28187
|
let entries;
|
|
28162
28188
|
try {
|
|
28163
|
-
entries =
|
|
28189
|
+
entries = readdirSync12(dir);
|
|
28164
28190
|
} catch {
|
|
28165
28191
|
return;
|
|
28166
28192
|
}
|
|
28167
28193
|
for (const entry of entries.filter((e) => STALE_PATTERN.test(e))) {
|
|
28168
|
-
unlinkSync16(
|
|
28194
|
+
unlinkSync16(join75(dir, entry));
|
|
28169
28195
|
}
|
|
28170
28196
|
}
|
|
28171
28197
|
|
|
@@ -30804,7 +30830,7 @@ async function notify() {
|
|
|
30804
30830
|
import { execSync as execSync52 } from "child_process";
|
|
30805
30831
|
import { existsSync as existsSync63, mkdirSync as mkdirSync21, unlinkSync as unlinkSync17, writeFileSync as writeFileSync38 } from "fs";
|
|
30806
30832
|
import { tmpdir as tmpdir8 } from "os";
|
|
30807
|
-
import { join as
|
|
30833
|
+
import { join as join76, resolve as resolve22 } from "path";
|
|
30808
30834
|
import chalk204 from "chalk";
|
|
30809
30835
|
|
|
30810
30836
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
@@ -30941,7 +30967,7 @@ function buildOutputPath(outputDir, processName) {
|
|
|
30941
30967
|
return resolve22(outputDir, `${processName}-${timestamp5}.png`);
|
|
30942
30968
|
}
|
|
30943
30969
|
function runPowerShellScript(processName, outputPath) {
|
|
30944
|
-
const scriptPath =
|
|
30970
|
+
const scriptPath = join76(tmpdir8(), `assist-screenshot-${Date.now()}.ps1`);
|
|
30945
30971
|
writeFileSync38(scriptPath, captureWindowPs1, "utf8");
|
|
30946
30972
|
try {
|
|
30947
30973
|
execSync52(
|
|
@@ -31055,13 +31081,13 @@ function buildLimitsSegment(rateLimits) {
|
|
|
31055
31081
|
}
|
|
31056
31082
|
|
|
31057
31083
|
// src/commands/readGitBranch.ts
|
|
31058
|
-
import { readFileSync as readFileSync46, statSync as
|
|
31059
|
-
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";
|
|
31060
31086
|
function resolveGitDir(cwd) {
|
|
31061
|
-
const dotGit =
|
|
31087
|
+
const dotGit = join77(cwd, ".git");
|
|
31062
31088
|
let stat5;
|
|
31063
31089
|
try {
|
|
31064
|
-
stat5 =
|
|
31090
|
+
stat5 = statSync10(dotGit);
|
|
31065
31091
|
} catch {
|
|
31066
31092
|
return null;
|
|
31067
31093
|
}
|
|
@@ -31088,7 +31114,7 @@ function readGitBranch(cwd) {
|
|
|
31088
31114
|
}
|
|
31089
31115
|
let head;
|
|
31090
31116
|
try {
|
|
31091
|
-
head = readFileSync46(
|
|
31117
|
+
head = readFileSync46(join77(gitDir, "HEAD"), "utf8");
|
|
31092
31118
|
} catch {
|
|
31093
31119
|
return null;
|
|
31094
31120
|
}
|
|
@@ -34047,12 +34073,12 @@ function fetchHighLevelPr(prNumber, repo) {
|
|
|
34047
34073
|
import { existsSync as existsSync64, readFileSync as readFileSync47 } from "fs";
|
|
34048
34074
|
|
|
34049
34075
|
// src/commands/review/highLevel/highLevelReviewPath.ts
|
|
34050
|
-
import { join as
|
|
34076
|
+
import { join as join78 } from "path";
|
|
34051
34077
|
function slug(value) {
|
|
34052
34078
|
return value.replace(/[^\w.-]+/g, "-");
|
|
34053
34079
|
}
|
|
34054
34080
|
function highLevelReviewPath(repo, headRef, headSha) {
|
|
34055
|
-
return
|
|
34081
|
+
return join78(
|
|
34056
34082
|
getStoreDir(),
|
|
34057
34083
|
"high-level-reviews",
|
|
34058
34084
|
slug(repo),
|
|
@@ -35076,11 +35102,11 @@ async function handlePostSynthesis(synthesisPath, prInfo, options2) {
|
|
|
35076
35102
|
}
|
|
35077
35103
|
|
|
35078
35104
|
// src/commands/review/cachedReviewerResult.ts
|
|
35079
|
-
import { statSync as
|
|
35105
|
+
import { statSync as statSync11 } from "fs";
|
|
35080
35106
|
function cachedReviewerResult(name, outputPath) {
|
|
35081
35107
|
let size;
|
|
35082
35108
|
try {
|
|
35083
|
-
size =
|
|
35109
|
+
size = statSync11(outputPath).size;
|
|
35084
35110
|
} catch {
|
|
35085
35111
|
return null;
|
|
35086
35112
|
}
|
|
@@ -35128,7 +35154,7 @@ import { format } from "util";
|
|
|
35128
35154
|
|
|
35129
35155
|
// src/commands/review/createReviewLogSink.ts
|
|
35130
35156
|
import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync23 } from "fs";
|
|
35131
|
-
import { join as
|
|
35157
|
+
import { join as join79 } from "path";
|
|
35132
35158
|
|
|
35133
35159
|
// src/shared/stripAnsi.ts
|
|
35134
35160
|
var ANSI = new RegExp(
|
|
@@ -35156,7 +35182,7 @@ function createReviewLogSink() {
|
|
|
35156
35182
|
},
|
|
35157
35183
|
attach(reviewDir) {
|
|
35158
35184
|
mkdirSync23(reviewDir, { recursive: true });
|
|
35159
|
-
logPath2 =
|
|
35185
|
+
logPath2 = join79(reviewDir, LOG_FILE);
|
|
35160
35186
|
const lines2 = [
|
|
35161
35187
|
"",
|
|
35162
35188
|
`=== ${(/* @__PURE__ */ new Date()).toISOString()} ===`,
|
|
@@ -36238,9 +36264,9 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
|
|
|
36238
36264
|
|
|
36239
36265
|
// src/commands/review/buildReviewPaths.ts
|
|
36240
36266
|
import { homedir as homedir24 } from "os";
|
|
36241
|
-
import { basename as basename21, join as
|
|
36267
|
+
import { basename as basename21, join as join80 } from "path";
|
|
36242
36268
|
function buildReviewPaths(repoRoot2, key) {
|
|
36243
|
-
const reviewDir =
|
|
36269
|
+
const reviewDir = join80(
|
|
36244
36270
|
homedir24(),
|
|
36245
36271
|
".assist",
|
|
36246
36272
|
"reviews",
|
|
@@ -36249,10 +36275,10 @@ function buildReviewPaths(repoRoot2, key) {
|
|
|
36249
36275
|
);
|
|
36250
36276
|
return {
|
|
36251
36277
|
reviewDir,
|
|
36252
|
-
requestPath:
|
|
36253
|
-
claudePath:
|
|
36254
|
-
codexPath:
|
|
36255
|
-
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")
|
|
36256
36282
|
};
|
|
36257
36283
|
}
|
|
36258
36284
|
|
|
@@ -36550,12 +36576,12 @@ function insertRuleBullet(content, rule) {
|
|
|
36550
36576
|
import { readFileSync as readFileSync50 } from "fs";
|
|
36551
36577
|
|
|
36552
36578
|
// src/commands/rules/findClaudeFiles.ts
|
|
36553
|
-
import { readdirSync as
|
|
36579
|
+
import { readdirSync as readdirSync13 } from "fs";
|
|
36554
36580
|
import path81 from "path";
|
|
36555
36581
|
var SKIP_DIRECTORIES = /* @__PURE__ */ new Set(["node_modules", "dist", "build", "coverage"]);
|
|
36556
36582
|
function findClaudeFiles(dir) {
|
|
36557
36583
|
const results = [];
|
|
36558
|
-
for (const entry of
|
|
36584
|
+
for (const entry of readdirSync13(dir, { withFileTypes: true })) {
|
|
36559
36585
|
if (entry.isDirectory()) {
|
|
36560
36586
|
if (entry.name.startsWith(".") || SKIP_DIRECTORIES.has(entry.name))
|
|
36561
36587
|
continue;
|
|
@@ -37233,12 +37259,12 @@ async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
|
37233
37259
|
}
|
|
37234
37260
|
|
|
37235
37261
|
// src/commands/slack/slackWorkingFile.ts
|
|
37236
|
-
import { join as
|
|
37262
|
+
import { join as join81 } from "path";
|
|
37237
37263
|
function slackWorkingFile(channel, partIndex) {
|
|
37238
37264
|
const slug2 = channel.replace(/^[#@]/, "").toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "channel";
|
|
37239
|
-
const dir =
|
|
37265
|
+
const dir = join81(getStoreDir(), "slack");
|
|
37240
37266
|
const name = partIndex === void 0 ? slug2 : `${slug2}-${partIndex}`;
|
|
37241
|
-
return { dir, bodyPath:
|
|
37267
|
+
return { dir, bodyPath: join81(dir, `${name}.md`) };
|
|
37242
37268
|
}
|
|
37243
37269
|
|
|
37244
37270
|
// src/commands/slack/previewSlackThreadParts.ts
|
|
@@ -38417,21 +38443,21 @@ async function configure() {
|
|
|
38417
38443
|
}
|
|
38418
38444
|
|
|
38419
38445
|
// src/commands/transcript/list.ts
|
|
38420
|
-
import { existsSync as existsSync76, readdirSync as
|
|
38421
|
-
import { join as
|
|
38446
|
+
import { existsSync as existsSync76, readdirSync as readdirSync20, statSync as statSync12 } from "fs";
|
|
38447
|
+
import { join as join93 } from "path";
|
|
38422
38448
|
function list3() {
|
|
38423
38449
|
const { vttDir } = getTranscriptConfig();
|
|
38424
38450
|
if (!existsSync76(vttDir)) return;
|
|
38425
|
-
for (const entry of
|
|
38451
|
+
for (const entry of readdirSync20(vttDir)) {
|
|
38426
38452
|
if (!entry.endsWith(".vtt")) continue;
|
|
38427
|
-
if (
|
|
38453
|
+
if (statSync12(join93(vttDir, entry)).isDirectory()) continue;
|
|
38428
38454
|
console.log(entry);
|
|
38429
38455
|
}
|
|
38430
38456
|
}
|
|
38431
38457
|
|
|
38432
38458
|
// src/commands/transcript/move.ts
|
|
38433
38459
|
import { existsSync as existsSync77, mkdirSync as mkdirSync32, renameSync as renameSync2, writeFileSync as writeFileSync50 } from "fs";
|
|
38434
|
-
import { basename as basename25, join as
|
|
38460
|
+
import { basename as basename25, join as join94 } from "path";
|
|
38435
38461
|
|
|
38436
38462
|
// src/commands/transcript/convertVttToMarkdown.ts
|
|
38437
38463
|
function convertVttToMarkdown(inputPath) {
|
|
@@ -38441,9 +38467,9 @@ function convertVttToMarkdown(inputPath) {
|
|
|
38441
38467
|
// src/commands/transcript/move.ts
|
|
38442
38468
|
var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
38443
38469
|
function archiveRawVtt(vttDir, sourcePath, filename) {
|
|
38444
|
-
const processedDir =
|
|
38470
|
+
const processedDir = join94(vttDir, "processed");
|
|
38445
38471
|
mkdirSync32(processedDir, { recursive: true });
|
|
38446
|
-
renameSync2(sourcePath,
|
|
38472
|
+
renameSync2(sourcePath, join94(processedDir, filename));
|
|
38447
38473
|
}
|
|
38448
38474
|
function move(file, options2) {
|
|
38449
38475
|
const { date, client } = options2;
|
|
@@ -38453,19 +38479,19 @@ function move(file, options2) {
|
|
|
38453
38479
|
}
|
|
38454
38480
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
38455
38481
|
const filename = basename25(file);
|
|
38456
|
-
const sourcePath =
|
|
38482
|
+
const sourcePath = join94(vttDir, filename);
|
|
38457
38483
|
if (!existsSync77(sourcePath)) {
|
|
38458
38484
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
38459
38485
|
process.exit(1);
|
|
38460
38486
|
}
|
|
38461
38487
|
const base = basename25(filename, ".vtt").replace(/ Transcription$/, "");
|
|
38462
38488
|
const outputName = `${date} ${base}.md`;
|
|
38463
|
-
const formattedDir =
|
|
38489
|
+
const formattedDir = join94(transcriptsDir, client);
|
|
38464
38490
|
mkdirSync32(formattedDir, { recursive: true });
|
|
38465
|
-
const formattedPath =
|
|
38491
|
+
const formattedPath = join94(formattedDir, outputName);
|
|
38466
38492
|
writeFileSync50(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
|
|
38467
38493
|
archiveRawVtt(vttDir, sourcePath, filename);
|
|
38468
|
-
const summaryPath =
|
|
38494
|
+
const summaryPath = join94(summaryDir, client, outputName);
|
|
38469
38495
|
console.log(`Formatted transcript: ${formattedPath}`);
|
|
38470
38496
|
console.log(`Summary target: ${summaryPath}`);
|
|
38471
38497
|
}
|
|
@@ -39271,10 +39297,10 @@ function checkSequential(migrations3, files) {
|
|
|
39271
39297
|
}
|
|
39272
39298
|
|
|
39273
39299
|
// src/commands/verify/migrations/listMigrationFiles.ts
|
|
39274
|
-
import { readdirSync as
|
|
39300
|
+
import { readdirSync as readdirSync21 } from "fs";
|
|
39275
39301
|
var MIGRATION_FILE2 = /^migration\d+[A-Za-z0-9]*\.ts$/;
|
|
39276
39302
|
function listMigrationFiles(dir) {
|
|
39277
|
-
return
|
|
39303
|
+
return readdirSync21(dir).filter((file) => MIGRATION_FILE2.test(file));
|
|
39278
39304
|
}
|
|
39279
39305
|
|
|
39280
39306
|
// src/commands/verify/migrations/readBaselineMigrations.ts
|
|
@@ -39626,11 +39652,11 @@ function changedPaths(from, cwd) {
|
|
|
39626
39652
|
}
|
|
39627
39653
|
|
|
39628
39654
|
// src/commands/watch/readBuiltVersion.ts
|
|
39629
|
-
import { join as
|
|
39655
|
+
import { join as join95 } from "path";
|
|
39630
39656
|
function readBuiltVersion(cwd) {
|
|
39631
39657
|
try {
|
|
39632
39658
|
const root2 = runGit3(["rev-parse", "--show-toplevel"], cwd);
|
|
39633
|
-
return readPackageJson(
|
|
39659
|
+
return readPackageJson(join95(root2, "package.json")).version ?? "unknown";
|
|
39634
39660
|
} catch {
|
|
39635
39661
|
return "unknown";
|
|
39636
39662
|
}
|
|
@@ -40098,12 +40124,12 @@ ${buildWatchReport(from)}`);
|
|
|
40098
40124
|
}
|
|
40099
40125
|
|
|
40100
40126
|
// src/commands/watch/consumeSimulatedDivergence.ts
|
|
40101
|
-
import { existsSync as existsSync81, rmSync as
|
|
40127
|
+
import { existsSync as existsSync81, rmSync as rmSync8 } from "fs";
|
|
40102
40128
|
function consumeSimulatedDivergence(cwd) {
|
|
40103
40129
|
try {
|
|
40104
40130
|
const path106 = simulatedDivergencePath(cwd);
|
|
40105
40131
|
if (!existsSync81(path106)) return false;
|
|
40106
|
-
|
|
40132
|
+
rmSync8(path106);
|
|
40107
40133
|
return true;
|
|
40108
40134
|
} catch {
|
|
40109
40135
|
return false;
|
|
@@ -40412,19 +40438,19 @@ async function auth() {
|
|
|
40412
40438
|
|
|
40413
40439
|
// src/commands/roam/postRoamActivity.ts
|
|
40414
40440
|
import { execFileSync as execFileSync22 } from "child_process";
|
|
40415
|
-
import { readdirSync as
|
|
40416
|
-
import { join as
|
|
40441
|
+
import { readdirSync as readdirSync22, readFileSync as readFileSync62, statSync as statSync13 } from "fs";
|
|
40442
|
+
import { join as join96 } from "path";
|
|
40417
40443
|
function findPortFile(roamDir) {
|
|
40418
40444
|
let entries;
|
|
40419
40445
|
try {
|
|
40420
|
-
entries =
|
|
40446
|
+
entries = readdirSync22(roamDir);
|
|
40421
40447
|
} catch {
|
|
40422
40448
|
return void 0;
|
|
40423
40449
|
}
|
|
40424
40450
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
40425
|
-
const path106 =
|
|
40451
|
+
const path106 = join96(roamDir, name);
|
|
40426
40452
|
try {
|
|
40427
|
-
return { path: path106, mtimeMs:
|
|
40453
|
+
return { path: path106, mtimeMs: statSync13(path106).mtimeMs };
|
|
40428
40454
|
} catch {
|
|
40429
40455
|
return void 0;
|
|
40430
40456
|
}
|
|
@@ -40439,7 +40465,7 @@ var PID_BY_APP = {
|
|
|
40439
40465
|
function postRoamActivity(app, event) {
|
|
40440
40466
|
const appData = process.env.APPDATA;
|
|
40441
40467
|
if (!appData) return;
|
|
40442
|
-
const portFile = findPortFile(
|
|
40468
|
+
const portFile = findPortFile(join96(appData, "Roam"));
|
|
40443
40469
|
if (!portFile) return;
|
|
40444
40470
|
let port;
|
|
40445
40471
|
try {
|
|
@@ -40575,7 +40601,7 @@ async function run3(name, args) {
|
|
|
40575
40601
|
|
|
40576
40602
|
// src/commands/run/add.ts
|
|
40577
40603
|
import { mkdirSync as mkdirSync33, writeFileSync as writeFileSync53 } from "fs";
|
|
40578
|
-
import { join as
|
|
40604
|
+
import { join as join97 } from "path";
|
|
40579
40605
|
|
|
40580
40606
|
// src/commands/run/extractOption.ts
|
|
40581
40607
|
function extractOption(args, flag) {
|
|
@@ -40636,7 +40662,7 @@ function saveNewRunConfig(name, command, args, cwd) {
|
|
|
40636
40662
|
saveConfig(config);
|
|
40637
40663
|
}
|
|
40638
40664
|
function createCommandFile(name) {
|
|
40639
|
-
const dir =
|
|
40665
|
+
const dir = join97(".claude", "commands");
|
|
40640
40666
|
mkdirSync33(dir, { recursive: true });
|
|
40641
40667
|
const content = `---
|
|
40642
40668
|
description: Run ${name}
|
|
@@ -40644,7 +40670,7 @@ description: Run ${name}
|
|
|
40644
40670
|
|
|
40645
40671
|
Run \`assist run ${name} $ARGUMENTS 2>&1\`.
|
|
40646
40672
|
`;
|
|
40647
|
-
const filePath =
|
|
40673
|
+
const filePath = join97(dir, `${name}.md`);
|
|
40648
40674
|
writeFileSync53(filePath, content);
|
|
40649
40675
|
console.log(`Created command file: ${filePath}`);
|
|
40650
40676
|
}
|
|
@@ -40701,7 +40727,7 @@ function link2() {
|
|
|
40701
40727
|
|
|
40702
40728
|
// src/commands/run/remove.ts
|
|
40703
40729
|
import { existsSync as existsSync82, unlinkSync as unlinkSync21 } from "fs";
|
|
40704
|
-
import { join as
|
|
40730
|
+
import { join as join98 } from "path";
|
|
40705
40731
|
function findRemoveIndex() {
|
|
40706
40732
|
const idx = process.argv.indexOf("remove");
|
|
40707
40733
|
if (idx === -1 || idx + 1 >= process.argv.length) return -1;
|
|
@@ -40716,7 +40742,7 @@ function parseRemoveName() {
|
|
|
40716
40742
|
return process.argv[idx + 1];
|
|
40717
40743
|
}
|
|
40718
40744
|
function deleteCommandFile(name) {
|
|
40719
|
-
const filePath =
|
|
40745
|
+
const filePath = join98(".claude", "commands", `${name}.md`);
|
|
40720
40746
|
if (existsSync82(filePath)) {
|
|
40721
40747
|
unlinkSync21(filePath);
|
|
40722
40748
|
console.log(`Deleted command file: ${filePath}`);
|
|
@@ -41482,7 +41508,7 @@ import { existsSync as existsSync85 } from "fs";
|
|
|
41482
41508
|
import * as pty from "node-pty";
|
|
41483
41509
|
|
|
41484
41510
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
41485
|
-
import { chmodSync, existsSync as existsSync84, statSync as
|
|
41511
|
+
import { chmodSync, existsSync as existsSync84, statSync as statSync14 } from "fs";
|
|
41486
41512
|
import { createRequire as createRequire3 } from "module";
|
|
41487
41513
|
import path102 from "path";
|
|
41488
41514
|
var require4 = createRequire3(import.meta.url);
|
|
@@ -41498,7 +41524,7 @@ function ensureSpawnHelperExecutable() {
|
|
|
41498
41524
|
"spawn-helper"
|
|
41499
41525
|
);
|
|
41500
41526
|
if (!existsSync84(helper)) return;
|
|
41501
|
-
const mode =
|
|
41527
|
+
const mode = statSync14(helper).mode;
|
|
41502
41528
|
if ((mode & 73) === 0) chmodSync(helper, mode | 493);
|
|
41503
41529
|
}
|
|
41504
41530
|
|
|
@@ -41731,12 +41757,12 @@ import { basename as basename28 } from "path";
|
|
|
41731
41757
|
|
|
41732
41758
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
41733
41759
|
import { existsSync as existsSync86 } from "fs";
|
|
41734
|
-
import { join as
|
|
41760
|
+
import { join as join101 } from "path";
|
|
41735
41761
|
|
|
41736
41762
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
41737
|
-
import { statSync as
|
|
41763
|
+
import { statSync as statSync15 } from "fs";
|
|
41738
41764
|
import { rm as rm3 } from "fs/promises";
|
|
41739
|
-
import { join as
|
|
41765
|
+
import { join as join100 } from "path";
|
|
41740
41766
|
async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
41741
41767
|
if (holdsAGitDirectoryRatherThanALink(worktreePath)) {
|
|
41742
41768
|
const refusal = "it is a clone of its own, not a linked worktree";
|
|
@@ -41764,7 +41790,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
|
41764
41790
|
return { removed: true };
|
|
41765
41791
|
}
|
|
41766
41792
|
function holdsAGitDirectoryRatherThanALink(worktreePath) {
|
|
41767
|
-
return
|
|
41793
|
+
return statSync15(join100(worktreePath, ".git"), {
|
|
41768
41794
|
throwIfNoEntry: false
|
|
41769
41795
|
})?.isDirectory() === true;
|
|
41770
41796
|
}
|
|
@@ -41800,7 +41826,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
41800
41826
|
);
|
|
41801
41827
|
}
|
|
41802
41828
|
function strandedReason(worktreePath, cause) {
|
|
41803
|
-
if (!existsSync86(
|
|
41829
|
+
if (!existsSync86(join101(worktreePath, ".git")))
|
|
41804
41830
|
return "its .git link is already gone";
|
|
41805
41831
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
41806
41832
|
return "git no longer recognises it as a working tree";
|
|
@@ -42043,12 +42069,12 @@ function closeGateApplies(sessions, session) {
|
|
|
42043
42069
|
}
|
|
42044
42070
|
|
|
42045
42071
|
// src/commands/sessions/daemon/worktree/liveProcessesInTree.ts
|
|
42046
|
-
import { readdirSync as
|
|
42072
|
+
import { readdirSync as readdirSync23, readlinkSync } from "fs";
|
|
42047
42073
|
import { sep as sep4 } from "path";
|
|
42048
42074
|
function liveProcessesInTree(treePath, procRoot = "/proc") {
|
|
42049
42075
|
let entries;
|
|
42050
42076
|
try {
|
|
42051
|
-
entries =
|
|
42077
|
+
entries = readdirSync23(procRoot);
|
|
42052
42078
|
} catch {
|
|
42053
42079
|
return [];
|
|
42054
42080
|
}
|
|
@@ -46424,7 +46450,7 @@ import { existsSync as existsSync95 } from "fs";
|
|
|
46424
46450
|
|
|
46425
46451
|
// src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
|
|
46426
46452
|
import { copyFileSync as copyFileSync5, existsSync as existsSync94, mkdirSync as mkdirSync36 } from "fs";
|
|
46427
|
-
import { join as
|
|
46453
|
+
import { join as join103 } from "path";
|
|
46428
46454
|
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
46429
46455
|
const dir = projectDirForCwd(toCwd);
|
|
46430
46456
|
if (dir === projectDirForCwd(fromCwd)) {
|
|
@@ -46433,7 +46459,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
46433
46459
|
);
|
|
46434
46460
|
return;
|
|
46435
46461
|
}
|
|
46436
|
-
const dest =
|
|
46462
|
+
const dest = join103(dir, `${claudeSessionId}.jsonl`);
|
|
46437
46463
|
if (existsSync94(dest)) {
|
|
46438
46464
|
daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
|
|
46439
46465
|
return;
|