@staff0rd/assist 0.517.0 → 0.518.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 +403 -403
- package/dist/index.js +366 -292
- 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.518.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -10274,32 +10274,46 @@ async function diffScopes(req, res) {
|
|
|
10274
10274
|
|
|
10275
10275
|
// src/commands/sessions/web/fileContent.ts
|
|
10276
10276
|
import { readFile, stat as stat2 } from "fs/promises";
|
|
10277
|
+
|
|
10278
|
+
// src/commands/sessions/web/resolveWithinCwd.ts
|
|
10277
10279
|
import { isAbsolute as isAbsolute2, relative as relative2, resolve as resolve10 } from "path";
|
|
10278
|
-
|
|
10280
|
+
function repoRoot(cwd) {
|
|
10281
|
+
return resolve10(toGitCwd(cwd));
|
|
10282
|
+
}
|
|
10279
10283
|
function resolveWithinCwd(cwd, path71) {
|
|
10280
|
-
const root =
|
|
10284
|
+
const root = repoRoot(cwd);
|
|
10281
10285
|
const target = resolve10(root, path71);
|
|
10282
10286
|
const rel = relative2(root, target);
|
|
10283
10287
|
if (rel === "" || rel.startsWith("..") || isAbsolute2(rel)) return null;
|
|
10284
10288
|
return target;
|
|
10285
10289
|
}
|
|
10286
|
-
|
|
10290
|
+
|
|
10291
|
+
// src/commands/sessions/web/getFileTarget.ts
|
|
10292
|
+
function getFileTarget(req, res) {
|
|
10287
10293
|
const cwd = getCwdParam(req, res);
|
|
10288
|
-
if (!cwd) return;
|
|
10294
|
+
if (!cwd) return null;
|
|
10289
10295
|
const path71 = new URL(req.url ?? "/", "http://localhost").searchParams.get(
|
|
10290
10296
|
"path"
|
|
10291
10297
|
);
|
|
10292
10298
|
if (!path71) {
|
|
10293
10299
|
respondJson(res, 400, { error: "Missing path" });
|
|
10294
|
-
return;
|
|
10300
|
+
return null;
|
|
10295
10301
|
}
|
|
10296
10302
|
const target = resolveWithinCwd(cwd, path71);
|
|
10297
10303
|
if (!target) {
|
|
10298
10304
|
respondJson(res, 400, { error: "Path outside cwd" });
|
|
10299
|
-
return;
|
|
10305
|
+
return null;
|
|
10300
10306
|
}
|
|
10307
|
+
return { cwd, target };
|
|
10308
|
+
}
|
|
10309
|
+
|
|
10310
|
+
// src/commands/sessions/web/fileContent.ts
|
|
10311
|
+
var MAX_FILE_BYTES = 2 * 1024 * 1024;
|
|
10312
|
+
async function fileContent(req, res) {
|
|
10313
|
+
const resolved = getFileTarget(req, res);
|
|
10314
|
+
if (!resolved) return;
|
|
10301
10315
|
try {
|
|
10302
|
-
const info = await stat2(target);
|
|
10316
|
+
const info = await stat2(resolved.target);
|
|
10303
10317
|
if (!info.isFile()) {
|
|
10304
10318
|
respondJson(res, 404, { error: "File not found" });
|
|
10305
10319
|
return;
|
|
@@ -10308,7 +10322,7 @@ async function fileContent(req, res) {
|
|
|
10308
10322
|
respondJson(res, 413, { error: "File too large" });
|
|
10309
10323
|
return;
|
|
10310
10324
|
}
|
|
10311
|
-
respondJson(res, 200, { content: await readFile(target, "utf8") });
|
|
10325
|
+
respondJson(res, 200, { content: await readFile(resolved.target, "utf8") });
|
|
10312
10326
|
} catch {
|
|
10313
10327
|
respondJson(res, 404, { error: "File not found" });
|
|
10314
10328
|
}
|
|
@@ -10647,7 +10661,7 @@ function runGit(cwd, args) {
|
|
|
10647
10661
|
}).then((r) => r.stdout.trim());
|
|
10648
10662
|
}
|
|
10649
10663
|
async function resolveSynthesisPath(cwd) {
|
|
10650
|
-
const [
|
|
10664
|
+
const [repoRoot2, branch2] = await Promise.all([
|
|
10651
10665
|
runGit(cwd, ["rev-parse", "--show-toplevel"]),
|
|
10652
10666
|
runGit(cwd, ["rev-parse", "--abbrev-ref", "HEAD"])
|
|
10653
10667
|
]);
|
|
@@ -10655,7 +10669,7 @@ async function resolveSynthesisPath(cwd) {
|
|
|
10655
10669
|
homedir13(),
|
|
10656
10670
|
".assist",
|
|
10657
10671
|
"reviews",
|
|
10658
|
-
basename8(
|
|
10672
|
+
basename8(repoRoot2)
|
|
10659
10673
|
);
|
|
10660
10674
|
return findSynthesisForBranch(repoReviewsDir, branch2);
|
|
10661
10675
|
}
|
|
@@ -12063,6 +12077,65 @@ async function uploadPrImage(req, res) {
|
|
|
12063
12077
|
}
|
|
12064
12078
|
}
|
|
12065
12079
|
|
|
12080
|
+
// src/commands/sessions/web/writeFileContent.ts
|
|
12081
|
+
import { readFile as readFile2, writeFile as writeFile3 } from "fs/promises";
|
|
12082
|
+
|
|
12083
|
+
// src/commands/sessions/web/formatWithOxfmt.ts
|
|
12084
|
+
import { execFile as execFile8 } from "child_process";
|
|
12085
|
+
import { existsSync as existsSync30 } from "fs";
|
|
12086
|
+
import { dirname as dirname22, join as join30 } from "path";
|
|
12087
|
+
import { promisify as promisify8 } from "util";
|
|
12088
|
+
var execFileAsync7 = promisify8(execFile8);
|
|
12089
|
+
var TIMEOUT_MS = 15e3;
|
|
12090
|
+
function findOxfmtScript(root) {
|
|
12091
|
+
let dir = root;
|
|
12092
|
+
for (; ; ) {
|
|
12093
|
+
const candidate = join30(dir, "node_modules", "oxfmt", "bin", "oxfmt");
|
|
12094
|
+
if (existsSync30(candidate)) return candidate;
|
|
12095
|
+
const parent = dirname22(dir);
|
|
12096
|
+
if (parent === dir) return void 0;
|
|
12097
|
+
dir = parent;
|
|
12098
|
+
}
|
|
12099
|
+
}
|
|
12100
|
+
async function formatWithOxfmt(target, root) {
|
|
12101
|
+
const script = findOxfmtScript(root);
|
|
12102
|
+
if (!script) return;
|
|
12103
|
+
await execFileAsync7(process.execPath, [script, target], {
|
|
12104
|
+
cwd: root,
|
|
12105
|
+
windowsHide: true,
|
|
12106
|
+
timeout: TIMEOUT_MS
|
|
12107
|
+
}).catch(() => {
|
|
12108
|
+
});
|
|
12109
|
+
}
|
|
12110
|
+
|
|
12111
|
+
// src/commands/sessions/web/writeFileContent.ts
|
|
12112
|
+
async function writeFileContent(req, res) {
|
|
12113
|
+
const resolved = getFileTarget(req, res);
|
|
12114
|
+
if (!resolved) return;
|
|
12115
|
+
let body;
|
|
12116
|
+
try {
|
|
12117
|
+
body = await readJsonBody(req);
|
|
12118
|
+
} catch {
|
|
12119
|
+
respondJson(res, 400, { error: "Invalid JSON body" });
|
|
12120
|
+
return;
|
|
12121
|
+
}
|
|
12122
|
+
if (typeof body.content !== "string") {
|
|
12123
|
+
respondJson(res, 400, { error: "Missing content" });
|
|
12124
|
+
return;
|
|
12125
|
+
}
|
|
12126
|
+
try {
|
|
12127
|
+
await writeFile3(resolved.target, body.content, "utf8");
|
|
12128
|
+
await formatWithOxfmt(resolved.target, repoRoot(resolved.cwd));
|
|
12129
|
+
respondJson(res, 200, {
|
|
12130
|
+
content: await readFile2(resolved.target, "utf8")
|
|
12131
|
+
});
|
|
12132
|
+
} catch (error) {
|
|
12133
|
+
respondJson(res, 500, {
|
|
12134
|
+
error: error instanceof Error ? error.message : "Failed to write file"
|
|
12135
|
+
});
|
|
12136
|
+
}
|
|
12137
|
+
}
|
|
12138
|
+
|
|
12066
12139
|
// src/commands/sessions/web/createCssHandler.ts
|
|
12067
12140
|
import { createHash as createHash2 } from "crypto";
|
|
12068
12141
|
import { readFileSync as readFileSync22 } from "fs";
|
|
@@ -12125,6 +12198,7 @@ var routes2 = {
|
|
|
12125
12198
|
"GET /api/diff": diff2,
|
|
12126
12199
|
"GET /api/diff-scopes": diffScopes,
|
|
12127
12200
|
"GET /api/file": fileContent,
|
|
12201
|
+
"POST /api/file": writeFileContent,
|
|
12128
12202
|
"GET /api/files": listFiles,
|
|
12129
12203
|
"GET /api/jira-site": jiraSite,
|
|
12130
12204
|
"GET /api/harness": harnessCapabilities,
|
|
@@ -12755,7 +12829,7 @@ function registerAssociateJiraCommand(cmd) {
|
|
|
12755
12829
|
|
|
12756
12830
|
// src/commands/backlog/cloneRepo.ts
|
|
12757
12831
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
12758
|
-
import { existsSync as
|
|
12832
|
+
import { existsSync as existsSync31 } from "fs";
|
|
12759
12833
|
import { mkdir as mkdir3 } from "fs/promises";
|
|
12760
12834
|
import chalk69 from "chalk";
|
|
12761
12835
|
|
|
@@ -12791,7 +12865,7 @@ async function cloneRepo(originRaw) {
|
|
|
12791
12865
|
if (!target) {
|
|
12792
12866
|
return fail2(`Could not derive a repository name from "${origin}".`);
|
|
12793
12867
|
}
|
|
12794
|
-
if (
|
|
12868
|
+
if (existsSync31(target)) {
|
|
12795
12869
|
return fail2(`Clone target already exists: ${target}`);
|
|
12796
12870
|
}
|
|
12797
12871
|
await mkdir3(baseDir, { recursive: true });
|
|
@@ -12902,7 +12976,7 @@ function registerExportCommand(cmd) {
|
|
|
12902
12976
|
}
|
|
12903
12977
|
|
|
12904
12978
|
// src/commands/backlog/import/index.ts
|
|
12905
|
-
import { readFile as
|
|
12979
|
+
import { readFile as readFile3 } from "fs/promises";
|
|
12906
12980
|
import chalk74 from "chalk";
|
|
12907
12981
|
|
|
12908
12982
|
// src/commands/backlog/dump/countCopyRows.ts
|
|
@@ -13079,7 +13153,7 @@ async function restore(client, parsed) {
|
|
|
13079
13153
|
|
|
13080
13154
|
// src/commands/backlog/import/index.ts
|
|
13081
13155
|
async function importBacklog(file, options2 = {}) {
|
|
13082
|
-
const raw = file ? await
|
|
13156
|
+
const raw = file ? await readFile3(file) : await readStdinBuffer();
|
|
13083
13157
|
const parsed = parseDump(raw);
|
|
13084
13158
|
validateDump(parsed);
|
|
13085
13159
|
const { tables } = parsed.header;
|
|
@@ -13216,7 +13290,7 @@ function ensureRemoteOrigin() {
|
|
|
13216
13290
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
13217
13291
|
import { mkdtempSync, readFileSync as readFileSync23, unlinkSync as unlinkSync6, writeFileSync as writeFileSync21 } from "fs";
|
|
13218
13292
|
import { tmpdir as tmpdir2 } from "os";
|
|
13219
|
-
import { join as
|
|
13293
|
+
import { join as join31 } from "path";
|
|
13220
13294
|
import enquirer6 from "enquirer";
|
|
13221
13295
|
async function promptType() {
|
|
13222
13296
|
const { type } = await enquirer6.prompt({
|
|
@@ -13256,8 +13330,8 @@ async function promptDescription() {
|
|
|
13256
13330
|
}
|
|
13257
13331
|
function openEditor() {
|
|
13258
13332
|
const editor = process.env.EDITOR || process.env.VISUAL || "vi";
|
|
13259
|
-
const dir = mkdtempSync(
|
|
13260
|
-
const filePath =
|
|
13333
|
+
const dir = mkdtempSync(join31(tmpdir2(), "assist-"));
|
|
13334
|
+
const filePath = join31(dir, "description.md");
|
|
13261
13335
|
writeFileSync21(filePath, "");
|
|
13262
13336
|
const result = spawnSync3(editor, [filePath], { stdio: "inherit" });
|
|
13263
13337
|
if (result.status !== 0) {
|
|
@@ -15731,16 +15805,16 @@ function extractGraphqlQuery(args) {
|
|
|
15731
15805
|
}
|
|
15732
15806
|
|
|
15733
15807
|
// src/shared/loadCliReads.ts
|
|
15734
|
-
import { existsSync as
|
|
15735
|
-
import { dirname as
|
|
15808
|
+
import { existsSync as existsSync32, readFileSync as readFileSync25, writeFileSync as writeFileSync22 } from "fs";
|
|
15809
|
+
import { dirname as dirname23, resolve as resolve12 } from "path";
|
|
15736
15810
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
15737
15811
|
var __filename3 = fileURLToPath5(import.meta.url);
|
|
15738
|
-
var __dirname4 =
|
|
15812
|
+
var __dirname4 = dirname23(__filename3);
|
|
15739
15813
|
function packageRoot() {
|
|
15740
15814
|
return __dirname4;
|
|
15741
15815
|
}
|
|
15742
15816
|
function readLines(path71) {
|
|
15743
|
-
if (!
|
|
15817
|
+
if (!existsSync32(path71)) return [];
|
|
15744
15818
|
return readFileSync25(path71, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
15745
15819
|
}
|
|
15746
15820
|
var cachedReads;
|
|
@@ -15787,14 +15861,14 @@ function findCliWrite(command) {
|
|
|
15787
15861
|
}
|
|
15788
15862
|
|
|
15789
15863
|
// src/shared/readSettingsPerms.ts
|
|
15790
|
-
import { existsSync as
|
|
15864
|
+
import { existsSync as existsSync33, readFileSync as readFileSync26 } from "fs";
|
|
15791
15865
|
import { homedir as homedir14 } from "os";
|
|
15792
|
-
import { join as
|
|
15866
|
+
import { join as join32 } from "path";
|
|
15793
15867
|
function readSettingsPerms(key) {
|
|
15794
15868
|
const paths = [
|
|
15795
|
-
|
|
15796
|
-
|
|
15797
|
-
|
|
15869
|
+
join32(homedir14(), ".claude", "settings.json"),
|
|
15870
|
+
join32(process.cwd(), ".claude", "settings.json"),
|
|
15871
|
+
join32(process.cwd(), ".claude", "settings.local.json")
|
|
15798
15872
|
];
|
|
15799
15873
|
const entries = [];
|
|
15800
15874
|
for (const p of paths) {
|
|
@@ -15803,7 +15877,7 @@ function readSettingsPerms(key) {
|
|
|
15803
15877
|
return entries;
|
|
15804
15878
|
}
|
|
15805
15879
|
function readPermissionArray(filePath, key) {
|
|
15806
|
-
if (!
|
|
15880
|
+
if (!existsSync33(filePath)) return [];
|
|
15807
15881
|
try {
|
|
15808
15882
|
const data = JSON.parse(readFileSync26(filePath, "utf8"));
|
|
15809
15883
|
const arr = data?.permissions?.[key];
|
|
@@ -16003,11 +16077,11 @@ function decideCommand(toolName, rawCommand) {
|
|
|
16003
16077
|
// src/commands/cliHook/logDeniedToolCall.ts
|
|
16004
16078
|
import { mkdirSync as mkdirSync12 } from "fs";
|
|
16005
16079
|
import { homedir as homedir15 } from "os";
|
|
16006
|
-
import { join as
|
|
16080
|
+
import { join as join33 } from "path";
|
|
16007
16081
|
import Database from "better-sqlite3";
|
|
16008
16082
|
var _db;
|
|
16009
16083
|
function getDbDir() {
|
|
16010
|
-
return
|
|
16084
|
+
return join33(homedir15(), ".assist");
|
|
16011
16085
|
}
|
|
16012
16086
|
function initSchema(db) {
|
|
16013
16087
|
db.exec(`
|
|
@@ -16026,7 +16100,7 @@ function openPromptsDb(dir) {
|
|
|
16026
16100
|
if (_db) return _db;
|
|
16027
16101
|
const dbDir = dir ?? getDbDir();
|
|
16028
16102
|
mkdirSync12(dbDir, { recursive: true });
|
|
16029
|
-
const db = new Database(
|
|
16103
|
+
const db = new Database(join33(dbDir, "assist.db"));
|
|
16030
16104
|
db.pragma("journal_mode = WAL");
|
|
16031
16105
|
initSchema(db);
|
|
16032
16106
|
_db = db;
|
|
@@ -16122,9 +16196,9 @@ ${reasons.join("\n")}`);
|
|
|
16122
16196
|
}
|
|
16123
16197
|
|
|
16124
16198
|
// src/commands/permitCliReads/index.ts
|
|
16125
|
-
import { existsSync as
|
|
16199
|
+
import { existsSync as existsSync34, mkdirSync as mkdirSync13, readFileSync as readFileSync27, writeFileSync as writeFileSync23 } from "fs";
|
|
16126
16200
|
import { homedir as homedir16 } from "os";
|
|
16127
|
-
import { join as
|
|
16201
|
+
import { join as join34 } from "path";
|
|
16128
16202
|
|
|
16129
16203
|
// src/commands/permitCliReads/assertCliExists.ts
|
|
16130
16204
|
function assertCliExists(cli) {
|
|
@@ -16387,15 +16461,15 @@ function updateSettings(cli, commands) {
|
|
|
16387
16461
|
// src/commands/permitCliReads/index.ts
|
|
16388
16462
|
function logPath(cli) {
|
|
16389
16463
|
const safeName = cli.replace(/\s+/g, "-");
|
|
16390
|
-
return
|
|
16464
|
+
return join34(homedir16(), ".assist", `cli-discover-${safeName}.log`);
|
|
16391
16465
|
}
|
|
16392
16466
|
function readCache(cli) {
|
|
16393
16467
|
const path71 = logPath(cli);
|
|
16394
|
-
if (!
|
|
16468
|
+
if (!existsSync34(path71)) return void 0;
|
|
16395
16469
|
return readFileSync27(path71, "utf8");
|
|
16396
16470
|
}
|
|
16397
16471
|
function writeCache(cli, output) {
|
|
16398
|
-
const dir =
|
|
16472
|
+
const dir = join34(homedir16(), ".assist");
|
|
16399
16473
|
mkdirSync13(dir, { recursive: true });
|
|
16400
16474
|
writeFileSync23(logPath(cli), output);
|
|
16401
16475
|
}
|
|
@@ -16526,22 +16600,22 @@ function registerCliHook(program2) {
|
|
|
16526
16600
|
}
|
|
16527
16601
|
|
|
16528
16602
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
16529
|
-
import { existsSync as
|
|
16603
|
+
import { existsSync as existsSync36, readFileSync as readFileSync29, unlinkSync as unlinkSync8, writeFileSync as writeFileSync24 } from "fs";
|
|
16530
16604
|
import chalk121 from "chalk";
|
|
16531
16605
|
|
|
16532
16606
|
// src/commands/codeComment/getRestrictedDir.ts
|
|
16533
16607
|
import { homedir as homedir17 } from "os";
|
|
16534
|
-
import { join as
|
|
16608
|
+
import { join as join35 } from "path";
|
|
16535
16609
|
function getRestrictedDir() {
|
|
16536
|
-
return
|
|
16610
|
+
return join35(homedir17(), ".assist", "restricted");
|
|
16537
16611
|
}
|
|
16538
16612
|
function getPinStatePath(pin) {
|
|
16539
|
-
return
|
|
16613
|
+
return join35(getRestrictedDir(), `code-comment-${pin}.json`);
|
|
16540
16614
|
}
|
|
16541
16615
|
|
|
16542
16616
|
// src/commands/codeComment/sweepRestrictedDir.ts
|
|
16543
16617
|
import { readdirSync as readdirSync3, statSync as statSync5, unlinkSync as unlinkSync7 } from "fs";
|
|
16544
|
-
import { join as
|
|
16618
|
+
import { join as join36 } from "path";
|
|
16545
16619
|
var STALE_AFTER_MS = 30 * 60 * 1e3;
|
|
16546
16620
|
function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
16547
16621
|
let entries;
|
|
@@ -16552,7 +16626,7 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
16552
16626
|
}
|
|
16553
16627
|
const cutoff = Date.now() - STALE_AFTER_MS;
|
|
16554
16628
|
for (const entry of entries) {
|
|
16555
|
-
const path71 =
|
|
16629
|
+
const path71 = join36(dir, entry);
|
|
16556
16630
|
try {
|
|
16557
16631
|
if (statSync5(path71).mtimeMs < cutoff) unlinkSync7(path71);
|
|
16558
16632
|
} catch {
|
|
@@ -16562,10 +16636,10 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
16562
16636
|
}
|
|
16563
16637
|
|
|
16564
16638
|
// src/commands/codeComment/readPinState.ts
|
|
16565
|
-
import { existsSync as
|
|
16639
|
+
import { existsSync as existsSync35, readFileSync as readFileSync28 } from "fs";
|
|
16566
16640
|
function readPinState(pin) {
|
|
16567
16641
|
const path71 = getPinStatePath(pin);
|
|
16568
|
-
if (!
|
|
16642
|
+
if (!existsSync35(path71)) return void 0;
|
|
16569
16643
|
try {
|
|
16570
16644
|
const state = JSON.parse(readFileSync28(path71, "utf8"));
|
|
16571
16645
|
if (state.pin !== pin) return void 0;
|
|
@@ -16584,7 +16658,7 @@ function codeCommentConfirm(pin) {
|
|
|
16584
16658
|
process.exitCode = 1;
|
|
16585
16659
|
return;
|
|
16586
16660
|
}
|
|
16587
|
-
if (!
|
|
16661
|
+
if (!existsSync36(state.file)) {
|
|
16588
16662
|
console.error(chalk121.red(`Target file no longer exists: ${state.file}`));
|
|
16589
16663
|
process.exitCode = 1;
|
|
16590
16664
|
return;
|
|
@@ -17641,19 +17715,19 @@ import { unlinkSync as unlinkSync9, writeFileSync as writeFileSync26 } from "fs"
|
|
|
17641
17715
|
import chalk137 from "chalk";
|
|
17642
17716
|
|
|
17643
17717
|
// src/commands/dbMigration/getMigrationPinPath.ts
|
|
17644
|
-
import { join as
|
|
17718
|
+
import { join as join37 } from "path";
|
|
17645
17719
|
function getMigrationPinPath(pin) {
|
|
17646
|
-
return
|
|
17720
|
+
return join37(getRestrictedDir(), `db-migration-pin-${pin}.json`);
|
|
17647
17721
|
}
|
|
17648
17722
|
function getMigrationApprovalPath(migrationId) {
|
|
17649
|
-
return
|
|
17723
|
+
return join37(getRestrictedDir(), `db-migration-approval-${migrationId}.json`);
|
|
17650
17724
|
}
|
|
17651
17725
|
|
|
17652
17726
|
// src/commands/dbMigration/readMigrationPinState.ts
|
|
17653
|
-
import { existsSync as
|
|
17727
|
+
import { existsSync as existsSync37, readFileSync as readFileSync30 } from "fs";
|
|
17654
17728
|
function readMigrationPinState(pin) {
|
|
17655
17729
|
const path71 = getMigrationPinPath(pin);
|
|
17656
|
-
if (!
|
|
17730
|
+
if (!existsSync37(path71)) return void 0;
|
|
17657
17731
|
try {
|
|
17658
17732
|
const state = JSON.parse(readFileSync30(path71, "utf8"));
|
|
17659
17733
|
if (state.pin !== pin) return void 0;
|
|
@@ -17742,7 +17816,7 @@ function registerDbMigration(parent) {
|
|
|
17742
17816
|
}
|
|
17743
17817
|
|
|
17744
17818
|
// src/commands/deploy/redirect.ts
|
|
17745
|
-
import { existsSync as
|
|
17819
|
+
import { existsSync as existsSync38, readFileSync as readFileSync31, writeFileSync as writeFileSync28 } from "fs";
|
|
17746
17820
|
import chalk139 from "chalk";
|
|
17747
17821
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
17748
17822
|
if (!window.location.pathname.endsWith('/')) {
|
|
@@ -17751,7 +17825,7 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
17751
17825
|
</script>`;
|
|
17752
17826
|
function redirect() {
|
|
17753
17827
|
const indexPath = "index.html";
|
|
17754
|
-
if (!
|
|
17828
|
+
if (!existsSync38(indexPath)) {
|
|
17755
17829
|
console.log(chalk139.yellow("No index.html found"));
|
|
17756
17830
|
return;
|
|
17757
17831
|
}
|
|
@@ -17784,10 +17858,10 @@ import { basename as basename11 } from "path";
|
|
|
17784
17858
|
|
|
17785
17859
|
// src/commands/devlog/loadBlogSkipDays.ts
|
|
17786
17860
|
import { homedir as homedir18 } from "os";
|
|
17787
|
-
import { join as
|
|
17788
|
-
var BLOG_REPO_ROOT =
|
|
17861
|
+
import { join as join38 } from "path";
|
|
17862
|
+
var BLOG_REPO_ROOT = join38(homedir18(), "git/blog");
|
|
17789
17863
|
function loadBlogSkipDays(repoName) {
|
|
17790
|
-
const config = loadRawYaml(
|
|
17864
|
+
const config = loadRawYaml(join38(BLOG_REPO_ROOT, "assist.yml"));
|
|
17791
17865
|
const devlog = config.devlog;
|
|
17792
17866
|
const skip2 = devlog?.skip;
|
|
17793
17867
|
return new Set(skip2?.[repoName]);
|
|
@@ -17798,15 +17872,15 @@ import { execSync as execSync36 } from "child_process";
|
|
|
17798
17872
|
import chalk140 from "chalk";
|
|
17799
17873
|
|
|
17800
17874
|
// src/shared/getRepoName.ts
|
|
17801
|
-
import { existsSync as
|
|
17802
|
-
import { basename as basename10, join as
|
|
17875
|
+
import { existsSync as existsSync39, readFileSync as readFileSync32 } from "fs";
|
|
17876
|
+
import { basename as basename10, join as join39 } from "path";
|
|
17803
17877
|
function getRepoName() {
|
|
17804
17878
|
const config = loadConfig();
|
|
17805
17879
|
if (config.devlog?.name) {
|
|
17806
17880
|
return config.devlog.name;
|
|
17807
17881
|
}
|
|
17808
|
-
const packageJsonPath =
|
|
17809
|
-
if (
|
|
17882
|
+
const packageJsonPath = join39(process.cwd(), "package.json");
|
|
17883
|
+
if (existsSync39(packageJsonPath)) {
|
|
17810
17884
|
try {
|
|
17811
17885
|
const content = readFileSync32(packageJsonPath, "utf8");
|
|
17812
17886
|
const pkg = JSON.parse(content);
|
|
@@ -17821,8 +17895,8 @@ function getRepoName() {
|
|
|
17821
17895
|
|
|
17822
17896
|
// src/commands/devlog/loadDevlogEntries.ts
|
|
17823
17897
|
import { readdirSync as readdirSync4, readFileSync as readFileSync33 } from "fs";
|
|
17824
|
-
import { join as
|
|
17825
|
-
var DEVLOG_DIR =
|
|
17898
|
+
import { join as join40 } from "path";
|
|
17899
|
+
var DEVLOG_DIR = join40(BLOG_REPO_ROOT, "src/content/devlog");
|
|
17826
17900
|
function extractFrontmatter(content) {
|
|
17827
17901
|
const fm = content.match(/^---\n([\s\S]*?)\n---/);
|
|
17828
17902
|
return fm?.[1] ?? null;
|
|
@@ -17850,7 +17924,7 @@ function readDevlogFiles(callback) {
|
|
|
17850
17924
|
try {
|
|
17851
17925
|
const files = readdirSync4(DEVLOG_DIR).filter((f) => f.endsWith(".md"));
|
|
17852
17926
|
for (const file of files) {
|
|
17853
|
-
const content = readFileSync33(
|
|
17927
|
+
const content = readFileSync33(join40(DEVLOG_DIR, file), "utf8");
|
|
17854
17928
|
const parsed = parseFrontmatter(content, file);
|
|
17855
17929
|
if (parsed) callback(parsed);
|
|
17856
17930
|
}
|
|
@@ -18238,11 +18312,11 @@ function repos(options2) {
|
|
|
18238
18312
|
|
|
18239
18313
|
// src/commands/devlog/skip.ts
|
|
18240
18314
|
import { writeFileSync as writeFileSync29 } from "fs";
|
|
18241
|
-
import { join as
|
|
18315
|
+
import { join as join41 } from "path";
|
|
18242
18316
|
import chalk145 from "chalk";
|
|
18243
18317
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
18244
18318
|
function getBlogConfigPath() {
|
|
18245
|
-
return
|
|
18319
|
+
return join41(BLOG_REPO_ROOT, "assist.yml");
|
|
18246
18320
|
}
|
|
18247
18321
|
function skip(date) {
|
|
18248
18322
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
@@ -18304,7 +18378,7 @@ function registerDevlog(program2) {
|
|
|
18304
18378
|
|
|
18305
18379
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
18306
18380
|
import { closeSync as closeSync3, openSync as openSync3, readdirSync as readdirSync5 } from "fs";
|
|
18307
|
-
import { join as
|
|
18381
|
+
import { join as join42 } from "path";
|
|
18308
18382
|
import chalk147 from "chalk";
|
|
18309
18383
|
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "packages"]);
|
|
18310
18384
|
function isLockedDll(debugDir) {
|
|
@@ -18316,7 +18390,7 @@ function isLockedDll(debugDir) {
|
|
|
18316
18390
|
}
|
|
18317
18391
|
for (const file of files) {
|
|
18318
18392
|
if (!file.toLowerCase().endsWith(".dll")) continue;
|
|
18319
|
-
const dllPath =
|
|
18393
|
+
const dllPath = join42(debugDir, file);
|
|
18320
18394
|
try {
|
|
18321
18395
|
const fd = openSync3(dllPath, "r+");
|
|
18322
18396
|
closeSync3(fd);
|
|
@@ -18334,13 +18408,13 @@ function findFirstLockedDll(dir) {
|
|
|
18334
18408
|
return null;
|
|
18335
18409
|
}
|
|
18336
18410
|
if (entries.includes("bin")) {
|
|
18337
|
-
const locked = isLockedDll(
|
|
18411
|
+
const locked = isLockedDll(join42(dir, "bin", "Debug"));
|
|
18338
18412
|
if (locked) return locked;
|
|
18339
18413
|
}
|
|
18340
18414
|
for (const entry of entries) {
|
|
18341
18415
|
if (SKIP_DIRS.has(entry) || entry === "bin" || entry.startsWith("."))
|
|
18342
18416
|
continue;
|
|
18343
|
-
const found = findFirstLockedDll(
|
|
18417
|
+
const found = findFirstLockedDll(join42(dir, entry));
|
|
18344
18418
|
if (found) return found;
|
|
18345
18419
|
}
|
|
18346
18420
|
return null;
|
|
@@ -18374,9 +18448,9 @@ function getProjectRefs(csprojPath) {
|
|
|
18374
18448
|
}
|
|
18375
18449
|
return refs;
|
|
18376
18450
|
}
|
|
18377
|
-
function buildTree(csprojPath,
|
|
18451
|
+
function buildTree(csprojPath, repoRoot2, visited = /* @__PURE__ */ new Set()) {
|
|
18378
18452
|
const abs = path31.resolve(csprojPath);
|
|
18379
|
-
const rel = path31.relative(
|
|
18453
|
+
const rel = path31.relative(repoRoot2, abs);
|
|
18380
18454
|
const node = { path: abs, relativePath: rel, children: [] };
|
|
18381
18455
|
if (visited.has(abs)) return node;
|
|
18382
18456
|
visited.add(abs);
|
|
@@ -18385,7 +18459,7 @@ function buildTree(csprojPath, repoRoot, visited = /* @__PURE__ */ new Set()) {
|
|
|
18385
18459
|
const childAbs = path31.resolve(dir, ref);
|
|
18386
18460
|
try {
|
|
18387
18461
|
readFileSync34(childAbs);
|
|
18388
|
-
node.children.push(buildTree(childAbs,
|
|
18462
|
+
node.children.push(buildTree(childAbs, repoRoot2, visited));
|
|
18389
18463
|
} catch {
|
|
18390
18464
|
node.children.push({
|
|
18391
18465
|
path: childAbs,
|
|
@@ -18436,17 +18510,17 @@ function findSlnFiles(dir, maxDepth, depth = 0) {
|
|
|
18436
18510
|
}
|
|
18437
18511
|
return results;
|
|
18438
18512
|
}
|
|
18439
|
-
function findContainingSolutions(csprojPath,
|
|
18513
|
+
function findContainingSolutions(csprojPath, repoRoot2) {
|
|
18440
18514
|
const csprojAbs = path32.resolve(csprojPath);
|
|
18441
18515
|
const csprojBasename = path32.basename(csprojAbs);
|
|
18442
|
-
const slnFiles = findSlnFiles(
|
|
18516
|
+
const slnFiles = findSlnFiles(repoRoot2, 3);
|
|
18443
18517
|
const matches = [];
|
|
18444
18518
|
const pattern2 = new RegExp(`[\\\\"/]${escapeRegex(csprojBasename)}"`);
|
|
18445
18519
|
for (const sln of slnFiles) {
|
|
18446
18520
|
try {
|
|
18447
18521
|
const content = readFileSync35(sln, "utf8");
|
|
18448
18522
|
if (pattern2.test(content)) {
|
|
18449
|
-
matches.push(path32.relative(
|
|
18523
|
+
matches.push(path32.relative(repoRoot2, sln));
|
|
18450
18524
|
}
|
|
18451
18525
|
} catch {
|
|
18452
18526
|
}
|
|
@@ -18508,29 +18582,29 @@ function printJson(tree, totalCount, solutions) {
|
|
|
18508
18582
|
}
|
|
18509
18583
|
|
|
18510
18584
|
// src/commands/dotnet/resolveCsproj.ts
|
|
18511
|
-
import { existsSync as
|
|
18585
|
+
import { existsSync as existsSync40 } from "fs";
|
|
18512
18586
|
import path33 from "path";
|
|
18513
18587
|
import chalk149 from "chalk";
|
|
18514
18588
|
function resolveCsproj(csprojPath) {
|
|
18515
18589
|
const resolved = path33.resolve(csprojPath);
|
|
18516
|
-
if (!
|
|
18590
|
+
if (!existsSync40(resolved)) {
|
|
18517
18591
|
console.error(chalk149.red(`File not found: ${resolved}`));
|
|
18518
18592
|
process.exit(1);
|
|
18519
18593
|
}
|
|
18520
|
-
const
|
|
18521
|
-
if (!
|
|
18594
|
+
const repoRoot2 = findRepoRoot(path33.dirname(resolved));
|
|
18595
|
+
if (!repoRoot2) {
|
|
18522
18596
|
console.error(chalk149.red("Could not find git repository root"));
|
|
18523
18597
|
process.exit(1);
|
|
18524
18598
|
}
|
|
18525
|
-
return { resolved, repoRoot };
|
|
18599
|
+
return { resolved, repoRoot: repoRoot2 };
|
|
18526
18600
|
}
|
|
18527
18601
|
|
|
18528
18602
|
// src/commands/dotnet/deps.ts
|
|
18529
18603
|
async function deps(csprojPath, options2) {
|
|
18530
|
-
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
18531
|
-
const tree = buildTree(resolved,
|
|
18604
|
+
const { resolved, repoRoot: repoRoot2 } = resolveCsproj(csprojPath);
|
|
18605
|
+
const tree = buildTree(resolved, repoRoot2);
|
|
18532
18606
|
const totalCount = collectAllDeps(tree).size + 1;
|
|
18533
|
-
const solutions = findContainingSolutions(resolved,
|
|
18607
|
+
const solutions = findContainingSolutions(resolved, repoRoot2);
|
|
18534
18608
|
if (options2.json) {
|
|
18535
18609
|
printJson(tree, totalCount, solutions);
|
|
18536
18610
|
} else {
|
|
@@ -18571,8 +18645,8 @@ function getChangedCsFiles(scope) {
|
|
|
18571
18645
|
// src/commands/dotnet/inSln.ts
|
|
18572
18646
|
import chalk150 from "chalk";
|
|
18573
18647
|
async function inSln(csprojPath) {
|
|
18574
|
-
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
18575
|
-
const solutions = findContainingSolutions(resolved,
|
|
18648
|
+
const { resolved, repoRoot: repoRoot2 } = resolveCsproj(csprojPath);
|
|
18649
|
+
const solutions = findContainingSolutions(resolved, repoRoot2);
|
|
18576
18650
|
if (solutions.length === 0) {
|
|
18577
18651
|
console.log(chalk150.yellow("Not found in any .sln file"));
|
|
18578
18652
|
process.exit(1);
|
|
@@ -18681,24 +18755,24 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
18681
18755
|
}
|
|
18682
18756
|
|
|
18683
18757
|
// src/commands/dotnet/resolveSolution.ts
|
|
18684
|
-
import { existsSync as
|
|
18758
|
+
import { existsSync as existsSync41 } from "fs";
|
|
18685
18759
|
import path34 from "path";
|
|
18686
18760
|
import chalk153 from "chalk";
|
|
18687
18761
|
|
|
18688
18762
|
// src/commands/dotnet/findSolution.ts
|
|
18689
18763
|
import { readdirSync as readdirSync7 } from "fs";
|
|
18690
|
-
import { dirname as
|
|
18764
|
+
import { dirname as dirname24, join as join43 } from "path";
|
|
18691
18765
|
import chalk152 from "chalk";
|
|
18692
18766
|
function findSlnInDir(dir) {
|
|
18693
18767
|
try {
|
|
18694
|
-
return readdirSync7(dir).filter((f) => f.endsWith(".sln")).map((f) =>
|
|
18768
|
+
return readdirSync7(dir).filter((f) => f.endsWith(".sln")).map((f) => join43(dir, f));
|
|
18695
18769
|
} catch {
|
|
18696
18770
|
return [];
|
|
18697
18771
|
}
|
|
18698
18772
|
}
|
|
18699
18773
|
function findSolution() {
|
|
18700
|
-
const
|
|
18701
|
-
const ceiling =
|
|
18774
|
+
const repoRoot2 = findRepoRoot(process.cwd());
|
|
18775
|
+
const ceiling = repoRoot2 ?? process.cwd();
|
|
18702
18776
|
let current = process.cwd();
|
|
18703
18777
|
while (true) {
|
|
18704
18778
|
const slnFiles = findSlnInDir(current);
|
|
@@ -18712,7 +18786,7 @@ function findSolution() {
|
|
|
18712
18786
|
process.exit(1);
|
|
18713
18787
|
}
|
|
18714
18788
|
if (current === ceiling) break;
|
|
18715
|
-
current =
|
|
18789
|
+
current = dirname24(current);
|
|
18716
18790
|
}
|
|
18717
18791
|
console.error(chalk152.red("No .sln file found between cwd and repo root"));
|
|
18718
18792
|
process.exit(1);
|
|
@@ -18722,7 +18796,7 @@ function findSolution() {
|
|
|
18722
18796
|
function resolveSolution(sln) {
|
|
18723
18797
|
if (sln) {
|
|
18724
18798
|
const resolved = path34.resolve(sln);
|
|
18725
|
-
if (!
|
|
18799
|
+
if (!existsSync41(resolved)) {
|
|
18726
18800
|
console.error(chalk153.red(`Solution file not found: ${resolved}`));
|
|
18727
18801
|
process.exit(1);
|
|
18728
18802
|
}
|
|
@@ -18762,7 +18836,7 @@ function parseInspectReport(json) {
|
|
|
18762
18836
|
|
|
18763
18837
|
// src/commands/dotnet/runInspectCode.ts
|
|
18764
18838
|
import { execSync as execSync40 } from "child_process";
|
|
18765
|
-
import { existsSync as
|
|
18839
|
+
import { existsSync as existsSync42, readFileSync as readFileSync36, unlinkSync as unlinkSync10 } from "fs";
|
|
18766
18840
|
import { tmpdir as tmpdir4 } from "os";
|
|
18767
18841
|
import path35 from "path";
|
|
18768
18842
|
import chalk154 from "chalk";
|
|
@@ -18793,7 +18867,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
18793
18867
|
console.error(chalk154.red("jb inspectcode failed"));
|
|
18794
18868
|
process.exit(1);
|
|
18795
18869
|
}
|
|
18796
|
-
if (!
|
|
18870
|
+
if (!existsSync42(reportPath)) {
|
|
18797
18871
|
console.error(chalk154.red("Report file not generated"));
|
|
18798
18872
|
process.exit(1);
|
|
18799
18873
|
}
|
|
@@ -19050,11 +19124,11 @@ function decideCommentGuard(input, existingContent) {
|
|
|
19050
19124
|
}
|
|
19051
19125
|
|
|
19052
19126
|
// src/commands/dbMigration/consumeMigrationApproval.ts
|
|
19053
|
-
import { existsSync as
|
|
19127
|
+
import { existsSync as existsSync43, unlinkSync as unlinkSync11 } from "fs";
|
|
19054
19128
|
function consumeMigrationApproval(migrationId) {
|
|
19055
19129
|
sweepRestrictedDir();
|
|
19056
19130
|
const path71 = getMigrationApprovalPath(migrationId);
|
|
19057
|
-
if (!
|
|
19131
|
+
if (!existsSync43(path71)) return false;
|
|
19058
19132
|
try {
|
|
19059
19133
|
unlinkSync11(path71);
|
|
19060
19134
|
return true;
|
|
@@ -19174,7 +19248,7 @@ function aggregateCommitters(authorLists) {
|
|
|
19174
19248
|
import { spawnSync as spawnSync4 } from "child_process";
|
|
19175
19249
|
import { unlinkSync as unlinkSync12, writeFileSync as writeFileSync30 } from "fs";
|
|
19176
19250
|
import { tmpdir as tmpdir5 } from "os";
|
|
19177
|
-
import { join as
|
|
19251
|
+
import { join as join44 } from "path";
|
|
19178
19252
|
function buildArgs2(queryFile, vars) {
|
|
19179
19253
|
const args = ["api", "graphql", "-F", `query=@${queryFile}`];
|
|
19180
19254
|
for (const [key, value] of Object.entries(vars)) {
|
|
@@ -19199,7 +19273,7 @@ function throwOnGraphqlErrors(stdout) {
|
|
|
19199
19273
|
throw new Error(messages || "GraphQL request returned errors");
|
|
19200
19274
|
}
|
|
19201
19275
|
function runGhGraphql(mutation, vars) {
|
|
19202
|
-
const queryFile =
|
|
19276
|
+
const queryFile = join44(tmpdir5(), `gh-query-${Date.now()}.graphql`);
|
|
19203
19277
|
writeFileSync30(queryFile, mutation);
|
|
19204
19278
|
try {
|
|
19205
19279
|
const result = spawnSync4("gh", buildArgs2(queryFile, vars), {
|
|
@@ -19387,24 +19461,24 @@ async function countPendingHandovers(orm, origin) {
|
|
|
19387
19461
|
|
|
19388
19462
|
// src/commands/handover/migrateDiskHandovers.ts
|
|
19389
19463
|
import {
|
|
19390
|
-
existsSync as
|
|
19464
|
+
existsSync as existsSync44,
|
|
19391
19465
|
readdirSync as readdirSync8,
|
|
19392
19466
|
readFileSync as readFileSync37,
|
|
19393
19467
|
rmSync as rmSync3,
|
|
19394
19468
|
statSync as statSync7
|
|
19395
19469
|
} from "fs";
|
|
19396
|
-
import { basename as basename12, join as
|
|
19470
|
+
import { basename as basename12, join as join47 } from "path";
|
|
19397
19471
|
|
|
19398
19472
|
// src/commands/handover/getHandoverPath.ts
|
|
19399
|
-
import { join as
|
|
19473
|
+
import { join as join45 } from "path";
|
|
19400
19474
|
function getHandoverPath(cwd = process.cwd()) {
|
|
19401
|
-
return
|
|
19475
|
+
return join45(cwd, ".assist", "HANDOVER.md");
|
|
19402
19476
|
}
|
|
19403
19477
|
|
|
19404
19478
|
// src/commands/handover/getHandoversDir.ts
|
|
19405
|
-
import { join as
|
|
19479
|
+
import { join as join46 } from "path";
|
|
19406
19480
|
function getHandoversDir(cwd = process.cwd()) {
|
|
19407
|
-
return
|
|
19481
|
+
return join46(cwd, ".assist", "handovers");
|
|
19408
19482
|
}
|
|
19409
19483
|
|
|
19410
19484
|
// src/commands/handover/parseArchiveTimestamp.ts
|
|
@@ -19442,10 +19516,10 @@ function summariseHandoverContent(content) {
|
|
|
19442
19516
|
|
|
19443
19517
|
// src/commands/handover/migrateDiskHandovers.ts
|
|
19444
19518
|
function collectMarkdown(dir) {
|
|
19445
|
-
if (!
|
|
19519
|
+
if (!existsSync44(dir)) return [];
|
|
19446
19520
|
const out = [];
|
|
19447
19521
|
for (const entry of readdirSync8(dir, { withFileTypes: true })) {
|
|
19448
|
-
const full =
|
|
19522
|
+
const full = join47(dir, entry.name);
|
|
19449
19523
|
if (entry.isDirectory()) out.push(...collectMarkdown(full));
|
|
19450
19524
|
else if (entry.isFile() && entry.name.endsWith(".md")) out.push(full);
|
|
19451
19525
|
}
|
|
@@ -19469,7 +19543,7 @@ async function migrateDiskHandovers(orm, origin, cwd = process.cwd()) {
|
|
|
19469
19543
|
migrated++;
|
|
19470
19544
|
}
|
|
19471
19545
|
const handoverPath = getHandoverPath(cwd);
|
|
19472
|
-
if (
|
|
19546
|
+
if (existsSync44(handoverPath)) {
|
|
19473
19547
|
await migrateFile(orm, origin, handoverPath, statSync7(handoverPath).mtime);
|
|
19474
19548
|
migrated++;
|
|
19475
19549
|
}
|
|
@@ -19815,18 +19889,18 @@ function recentDaemonLogLines() {
|
|
|
19815
19889
|
}
|
|
19816
19890
|
|
|
19817
19891
|
// src/commands/sessions/daemon/worktree/createWorktree.ts
|
|
19818
|
-
import { existsSync as
|
|
19819
|
-
import { basename as basename14, dirname as
|
|
19892
|
+
import { existsSync as existsSync45 } from "fs";
|
|
19893
|
+
import { basename as basename14, dirname as dirname25 } from "path";
|
|
19820
19894
|
|
|
19821
19895
|
// src/commands/sessions/daemon/worktree/planAllocation.ts
|
|
19822
|
-
import { basename as basename13, join as
|
|
19896
|
+
import { basename as basename13, join as join48 } from "path";
|
|
19823
19897
|
function planAllocation(clone, boundTreeRoots2) {
|
|
19824
19898
|
return boundTreeRoots2.has(clone) ? "spill" : "primary";
|
|
19825
19899
|
}
|
|
19826
19900
|
function nextWorktreePath(clone, base, isTaken) {
|
|
19827
19901
|
const name = basename13(clone);
|
|
19828
19902
|
for (let n = 2; n < 1e3; n++) {
|
|
19829
|
-
const candidate =
|
|
19903
|
+
const candidate = join48(base, `${name}-${n}`);
|
|
19830
19904
|
if (!isTaken(candidate)) return candidate;
|
|
19831
19905
|
}
|
|
19832
19906
|
throw new Error(`no free worktree suffix for ${clone}`);
|
|
@@ -19859,13 +19933,13 @@ function cloneHead(clone) {
|
|
|
19859
19933
|
|
|
19860
19934
|
// src/commands/sessions/daemon/worktree/createWorktree.ts
|
|
19861
19935
|
function createWorktree(clone, strategy, boundTreeRoots2) {
|
|
19862
|
-
const base = strategy.root ? expandTilde2(strategy.root) :
|
|
19936
|
+
const base = strategy.root ? expandTilde2(strategy.root) : dirname25(clone);
|
|
19863
19937
|
const registered = new Set(listWorktreePaths(clone));
|
|
19864
19938
|
const branches = new Set(listLocalBranches(clone));
|
|
19865
19939
|
const path71 = nextWorktreePath(
|
|
19866
19940
|
clone,
|
|
19867
19941
|
base,
|
|
19868
|
-
(candidate) => registered.has(candidate) ||
|
|
19942
|
+
(candidate) => registered.has(candidate) || existsSync45(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename14(candidate))
|
|
19869
19943
|
);
|
|
19870
19944
|
const start3 = worktreeStartPoint(clone, strategy.trunk);
|
|
19871
19945
|
gitSync(clone, [
|
|
@@ -19885,7 +19959,7 @@ function createWorktree(clone, strategy, boundTreeRoots2) {
|
|
|
19885
19959
|
}
|
|
19886
19960
|
|
|
19887
19961
|
// src/commands/sessions/daemon/worktree/treeDurability.ts
|
|
19888
|
-
import { existsSync as
|
|
19962
|
+
import { existsSync as existsSync46 } from "fs";
|
|
19889
19963
|
var treeIsGone = { durable: true, gone: true };
|
|
19890
19964
|
function treeDurability(state) {
|
|
19891
19965
|
if (state.dirty) return { durable: false, reason: "uncommitted changes" };
|
|
@@ -19916,14 +19990,14 @@ function* durabilityProbes() {
|
|
|
19916
19990
|
});
|
|
19917
19991
|
}
|
|
19918
19992
|
async function checkDurability(cwd) {
|
|
19919
|
-
if (!
|
|
19993
|
+
if (!existsSync46(cwd)) return treeIsGone;
|
|
19920
19994
|
const probes = durabilityProbes();
|
|
19921
19995
|
let step2 = probes.next();
|
|
19922
19996
|
while (!step2.done) step2 = probes.next(await gitResult(cwd, step2.value));
|
|
19923
19997
|
return step2.value;
|
|
19924
19998
|
}
|
|
19925
19999
|
function checkDurabilitySync(cwd) {
|
|
19926
|
-
if (!
|
|
20000
|
+
if (!existsSync46(cwd)) return treeIsGone;
|
|
19927
20001
|
const probes = durabilityProbes();
|
|
19928
20002
|
let step2 = probes.next();
|
|
19929
20003
|
while (!step2.done) step2 = probes.next(gitSyncResult(cwd, step2.value));
|
|
@@ -19973,11 +20047,11 @@ function allocateTree(requestedCwd, boundTreeRoots2, options2 = {}) {
|
|
|
19973
20047
|
if (!requestedCwd)
|
|
19974
20048
|
return { cwd: requestedCwd, kind: "primary", created: false };
|
|
19975
20049
|
if (options2.inPlace === true) return keptInPlace(requestedCwd);
|
|
19976
|
-
const
|
|
19977
|
-
const cfg = worktreeConfigFor(
|
|
20050
|
+
const repoRoot2 = findRepoRoot(requestedCwd) ?? requestedCwd;
|
|
20051
|
+
const cfg = worktreeConfigFor(repoRoot2);
|
|
19978
20052
|
if (!cfg.enabled)
|
|
19979
20053
|
return { cwd: requestedCwd, kind: "primary", created: false };
|
|
19980
|
-
const clone = mainWorktree(
|
|
20054
|
+
const clone = mainWorktree(repoRoot2) ?? repoRoot2;
|
|
19981
20055
|
const reuse = { ...options2, includeDrafts: cfg.includeDrafts };
|
|
19982
20056
|
if (mustLeaveTrunk(cfg.trunk, options2))
|
|
19983
20057
|
daemonLog(
|
|
@@ -20133,30 +20207,30 @@ function persistedTreeRoots() {
|
|
|
20133
20207
|
}
|
|
20134
20208
|
|
|
20135
20209
|
// src/commands/sessions/daemon/worktree/seedWorktree.ts
|
|
20136
|
-
import { copyFileSync, existsSync as
|
|
20137
|
-
import { dirname as
|
|
20210
|
+
import { copyFileSync, existsSync as existsSync48, mkdirSync as mkdirSync16 } from "fs";
|
|
20211
|
+
import { dirname as dirname26, join as join50 } from "path";
|
|
20138
20212
|
|
|
20139
20213
|
// src/commands/sessions/daemon/worktree/runInstall.ts
|
|
20140
20214
|
import { spawn as spawn5 } from "child_process";
|
|
20141
20215
|
|
|
20142
20216
|
// src/commands/sessions/daemon/worktree/resolveInstallCommand.ts
|
|
20143
|
-
import { existsSync as
|
|
20144
|
-
import { join as
|
|
20145
|
-
function detectInstallCommand(
|
|
20146
|
-
if (!
|
|
20147
|
-
if (
|
|
20148
|
-
if (
|
|
20149
|
-
if (
|
|
20217
|
+
import { existsSync as existsSync47 } from "fs";
|
|
20218
|
+
import { join as join49 } from "path";
|
|
20219
|
+
function detectInstallCommand(repoRoot2) {
|
|
20220
|
+
if (!existsSync47(join49(repoRoot2, "package.json"))) return null;
|
|
20221
|
+
if (existsSync47(join49(repoRoot2, "pnpm-lock.yaml"))) return "pnpm install";
|
|
20222
|
+
if (existsSync47(join49(repoRoot2, "yarn.lock"))) return "yarn install";
|
|
20223
|
+
if (existsSync47(join49(repoRoot2, "bun.lockb"))) return "bun install";
|
|
20150
20224
|
return "npm install";
|
|
20151
20225
|
}
|
|
20152
|
-
function resolveInstallCommand(
|
|
20226
|
+
function resolveInstallCommand(repoRoot2, install) {
|
|
20153
20227
|
if (install === false) return null;
|
|
20154
20228
|
if (typeof install === "string") return install;
|
|
20155
|
-
return detectInstallCommand(
|
|
20229
|
+
return detectInstallCommand(repoRoot2);
|
|
20156
20230
|
}
|
|
20157
20231
|
|
|
20158
20232
|
// src/commands/sessions/daemon/worktree/stopInstall.ts
|
|
20159
|
-
import { execFile as
|
|
20233
|
+
import { execFile as execFile9 } from "child_process";
|
|
20160
20234
|
var running2 = /* @__PURE__ */ new Map();
|
|
20161
20235
|
function trackInstall(worktreePath, child) {
|
|
20162
20236
|
running2.set(worktreePath, child);
|
|
@@ -20175,7 +20249,7 @@ function stopInstall(worktreePath) {
|
|
|
20175
20249
|
}
|
|
20176
20250
|
function killTree(pid) {
|
|
20177
20251
|
if (process.platform === "win32") {
|
|
20178
|
-
|
|
20252
|
+
execFile9(
|
|
20179
20253
|
"taskkill",
|
|
20180
20254
|
["/T", "/F", "/PID", String(pid)],
|
|
20181
20255
|
{ windowsHide: true },
|
|
@@ -20258,11 +20332,11 @@ function seedWorktree(worktreePath, clone, onSeeded = () => {
|
|
|
20258
20332
|
}
|
|
20259
20333
|
function copyConfigFiles(worktreePath, clone, copy) {
|
|
20260
20334
|
for (const rel of copy) {
|
|
20261
|
-
const src =
|
|
20262
|
-
if (!
|
|
20263
|
-
const dest =
|
|
20335
|
+
const src = join50(clone, rel);
|
|
20336
|
+
if (!existsSync48(src)) continue;
|
|
20337
|
+
const dest = join50(worktreePath, rel);
|
|
20264
20338
|
try {
|
|
20265
|
-
mkdirSync16(
|
|
20339
|
+
mkdirSync16(dirname26(dest), { recursive: true });
|
|
20266
20340
|
copyFileSync(src, dest);
|
|
20267
20341
|
daemonLog(`worktree ${worktreePath} seeded ${rel}`);
|
|
20268
20342
|
} catch (error) {
|
|
@@ -20555,7 +20629,7 @@ function registerMermaid(program2) {
|
|
|
20555
20629
|
// src/commands/netcap/netcap.ts
|
|
20556
20630
|
import { mkdir as mkdir4 } from "fs/promises";
|
|
20557
20631
|
import { createServer as createServer2 } from "http";
|
|
20558
|
-
import { dirname as
|
|
20632
|
+
import { dirname as dirname28 } from "path";
|
|
20559
20633
|
import chalk166 from "chalk";
|
|
20560
20634
|
|
|
20561
20635
|
// src/commands/netcap/corsHeaders.ts
|
|
@@ -20632,17 +20706,17 @@ function createNetcapHandler(options2) {
|
|
|
20632
20706
|
}
|
|
20633
20707
|
|
|
20634
20708
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
20635
|
-
import { cp, readFile as
|
|
20709
|
+
import { cp, readFile as readFile4, writeFile as writeFile4 } from "fs/promises";
|
|
20636
20710
|
import { networkInterfaces } from "os";
|
|
20637
|
-
import { join as
|
|
20711
|
+
import { join as join52 } from "path";
|
|
20638
20712
|
import chalk165 from "chalk";
|
|
20639
20713
|
|
|
20640
20714
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
20641
|
-
import { dirname as
|
|
20715
|
+
import { dirname as dirname27, join as join51 } from "path";
|
|
20642
20716
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
20643
|
-
var moduleDir =
|
|
20717
|
+
var moduleDir = dirname27(fileURLToPath6(import.meta.url));
|
|
20644
20718
|
function netcapExtensionDir() {
|
|
20645
|
-
return
|
|
20719
|
+
return join51(moduleDir, "commands", "netcap", "netcap-extension");
|
|
20646
20720
|
}
|
|
20647
20721
|
|
|
20648
20722
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
@@ -20657,9 +20731,9 @@ function lanIPv4() {
|
|
|
20657
20731
|
return void 0;
|
|
20658
20732
|
}
|
|
20659
20733
|
async function configureBackground(dir, host, port, filter) {
|
|
20660
|
-
const file =
|
|
20661
|
-
const source = await
|
|
20662
|
-
await
|
|
20734
|
+
const file = join52(dir, "background.js");
|
|
20735
|
+
const source = await readFile4(file, "utf8");
|
|
20736
|
+
await writeFile4(
|
|
20663
20737
|
file,
|
|
20664
20738
|
source.replace(
|
|
20665
20739
|
/const RECEIVER = "[^"]*";/,
|
|
@@ -20697,20 +20771,20 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
20697
20771
|
}
|
|
20698
20772
|
|
|
20699
20773
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
20700
|
-
import { isAbsolute as isAbsolute3, join as
|
|
20774
|
+
import { isAbsolute as isAbsolute3, join as join54, resolve as resolve16 } from "path";
|
|
20701
20775
|
|
|
20702
20776
|
// src/commands/netcap/defaultCapturePath.ts
|
|
20703
20777
|
import { homedir as homedir19 } from "os";
|
|
20704
|
-
import { join as
|
|
20778
|
+
import { join as join53 } from "path";
|
|
20705
20779
|
function defaultCapturePath() {
|
|
20706
|
-
return
|
|
20780
|
+
return join53(homedir19(), ".assist", "netcap", "capture.jsonl");
|
|
20707
20781
|
}
|
|
20708
20782
|
|
|
20709
20783
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
20710
20784
|
function resolveNetcapOutPath(out) {
|
|
20711
20785
|
if (!out) return defaultCapturePath();
|
|
20712
20786
|
const dir = isAbsolute3(out) ? out : resolve16(process.cwd(), out);
|
|
20713
|
-
return
|
|
20787
|
+
return join54(dir, "capture.jsonl");
|
|
20714
20788
|
}
|
|
20715
20789
|
|
|
20716
20790
|
// src/commands/netcap/netcap.ts
|
|
@@ -20718,7 +20792,7 @@ async function netcap(options2) {
|
|
|
20718
20792
|
const port = Number(options2.port);
|
|
20719
20793
|
const outPath = resolveNetcapOutPath(options2.out);
|
|
20720
20794
|
const filter = options2.filter ?? "";
|
|
20721
|
-
await mkdir4(
|
|
20795
|
+
await mkdir4(dirname28(outPath), { recursive: true });
|
|
20722
20796
|
const extensionPath = await prepareExtensionForLoad(port, filter);
|
|
20723
20797
|
let count8 = 0;
|
|
20724
20798
|
const handler = createNetcapHandler({
|
|
@@ -20757,7 +20831,7 @@ netcap stopped \u2014 captured ${count8} ${count8 === 1 ? "entry" : "entries"} t
|
|
|
20757
20831
|
|
|
20758
20832
|
// src/commands/netcap/netcapExtract.ts
|
|
20759
20833
|
import { writeFileSync as writeFileSync32 } from "fs";
|
|
20760
|
-
import { join as
|
|
20834
|
+
import { join as join55 } from "path";
|
|
20761
20835
|
import chalk167 from "chalk";
|
|
20762
20836
|
|
|
20763
20837
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
@@ -21202,7 +21276,7 @@ function extractPostsFromCapture(captureFile) {
|
|
|
21202
21276
|
function netcapExtract(file) {
|
|
21203
21277
|
const captureFile = file ?? defaultCapturePath();
|
|
21204
21278
|
const posts = extractPostsFromCapture(captureFile);
|
|
21205
|
-
const outFile =
|
|
21279
|
+
const outFile = join55(captureFile, "..", "posts.json");
|
|
21206
21280
|
writeFileSync32(outFile, `${JSON.stringify(posts, null, 2)}
|
|
21207
21281
|
`);
|
|
21208
21282
|
console.log(
|
|
@@ -21727,17 +21801,17 @@ import { execSync as execSync46 } from "child_process";
|
|
|
21727
21801
|
import { execSync as execSync45 } from "child_process";
|
|
21728
21802
|
import { unlinkSync as unlinkSync14, writeFileSync as writeFileSync33 } from "fs";
|
|
21729
21803
|
import { tmpdir as tmpdir6 } from "os";
|
|
21730
|
-
import { join as
|
|
21804
|
+
import { join as join57 } from "path";
|
|
21731
21805
|
|
|
21732
21806
|
// src/commands/prs/loadCommentsCache.ts
|
|
21733
|
-
import { existsSync as
|
|
21807
|
+
import { existsSync as existsSync49, readFileSync as readFileSync40, unlinkSync as unlinkSync13 } from "fs";
|
|
21734
21808
|
import { parse as parse2 } from "yaml";
|
|
21735
21809
|
|
|
21736
21810
|
// src/commands/prs/commentsCachePath.ts
|
|
21737
21811
|
import { homedir as homedir20 } from "os";
|
|
21738
|
-
import { join as
|
|
21812
|
+
import { join as join56 } from "path";
|
|
21739
21813
|
function commentsCachePath(org, repo, prNumber) {
|
|
21740
|
-
return
|
|
21814
|
+
return join56(
|
|
21741
21815
|
homedir20(),
|
|
21742
21816
|
".assist",
|
|
21743
21817
|
"pr-comments",
|
|
@@ -21750,7 +21824,7 @@ function commentsCachePath(org, repo, prNumber) {
|
|
|
21750
21824
|
// src/commands/prs/loadCommentsCache.ts
|
|
21751
21825
|
function loadCommentsCache(org, repo, prNumber) {
|
|
21752
21826
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
21753
|
-
if (!
|
|
21827
|
+
if (!existsSync49(cachePath)) {
|
|
21754
21828
|
return null;
|
|
21755
21829
|
}
|
|
21756
21830
|
const content = readFileSync40(cachePath, "utf8");
|
|
@@ -21758,7 +21832,7 @@ function loadCommentsCache(org, repo, prNumber) {
|
|
|
21758
21832
|
}
|
|
21759
21833
|
function deleteCommentsCache(org, repo, prNumber) {
|
|
21760
21834
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
21761
|
-
if (
|
|
21835
|
+
if (existsSync49(cachePath)) {
|
|
21762
21836
|
unlinkSync13(cachePath);
|
|
21763
21837
|
console.log("No more unresolved line comments. Cache dropped.");
|
|
21764
21838
|
}
|
|
@@ -21776,7 +21850,7 @@ function replyToComment(org, repo, prNumber, commentId, message3) {
|
|
|
21776
21850
|
// src/commands/prs/resolveCommentWithReply.ts
|
|
21777
21851
|
function resolveThread(threadId) {
|
|
21778
21852
|
const mutation = `mutation($threadId: ID!) { resolveReviewThread(input: {threadId: $threadId}) { thread { isResolved } } }`;
|
|
21779
|
-
const queryFile =
|
|
21853
|
+
const queryFile = join57(tmpdir6(), `gh-mutation-${Date.now()}.graphql`);
|
|
21780
21854
|
writeFileSync33(queryFile, mutation);
|
|
21781
21855
|
try {
|
|
21782
21856
|
execSync45(
|
|
@@ -21861,10 +21935,10 @@ function fixed(commentId, sha) {
|
|
|
21861
21935
|
import { execSync as execSync47 } from "child_process";
|
|
21862
21936
|
import { unlinkSync as unlinkSync15, writeFileSync as writeFileSync34 } from "fs";
|
|
21863
21937
|
import { tmpdir as tmpdir7 } from "os";
|
|
21864
|
-
import { join as
|
|
21938
|
+
import { join as join58 } from "path";
|
|
21865
21939
|
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 } } } } } } }`;
|
|
21866
21940
|
function fetchThreadIds(org, repo, prNumber) {
|
|
21867
|
-
const queryFile =
|
|
21941
|
+
const queryFile = join58(tmpdir7(), `gh-query-${Date.now()}.graphql`);
|
|
21868
21942
|
writeFileSync34(queryFile, THREAD_QUERY);
|
|
21869
21943
|
try {
|
|
21870
21944
|
const result = execSync47(
|
|
@@ -21934,15 +22008,15 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
21934
22008
|
|
|
21935
22009
|
// src/commands/prs/listComments/updateCommentsCache.ts
|
|
21936
22010
|
import { mkdirSync as mkdirSync18, writeFileSync as writeFileSync35 } from "fs";
|
|
21937
|
-
import { dirname as
|
|
22011
|
+
import { dirname as dirname29 } from "path";
|
|
21938
22012
|
import { stringify } from "yaml";
|
|
21939
22013
|
|
|
21940
22014
|
// src/commands/prs/removeStaleCommentsCaches.ts
|
|
21941
22015
|
import { readdirSync as readdirSync10, unlinkSync as unlinkSync16 } from "fs";
|
|
21942
|
-
import { join as
|
|
22016
|
+
import { join as join59 } from "path";
|
|
21943
22017
|
var STALE_PATTERN = /^pr-\d+-comments\.yaml$/;
|
|
21944
22018
|
function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
21945
|
-
const dir =
|
|
22019
|
+
const dir = join59(cwd, ".assist");
|
|
21946
22020
|
let entries;
|
|
21947
22021
|
try {
|
|
21948
22022
|
entries = readdirSync10(dir);
|
|
@@ -21950,14 +22024,14 @@ function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
|
21950
22024
|
return;
|
|
21951
22025
|
}
|
|
21952
22026
|
for (const entry of entries.filter((e) => STALE_PATTERN.test(e))) {
|
|
21953
|
-
unlinkSync16(
|
|
22027
|
+
unlinkSync16(join59(dir, entry));
|
|
21954
22028
|
}
|
|
21955
22029
|
}
|
|
21956
22030
|
|
|
21957
22031
|
// src/commands/prs/listComments/updateCommentsCache.ts
|
|
21958
22032
|
function writeCommentsCache(org, repo, prNumber, comments3) {
|
|
21959
22033
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
21960
|
-
mkdirSync18(
|
|
22034
|
+
mkdirSync18(dirname29(cachePath), { recursive: true });
|
|
21961
22035
|
const cacheData = {
|
|
21962
22036
|
prNumber,
|
|
21963
22037
|
fetchedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -24910,21 +24984,21 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
|
|
|
24910
24984
|
|
|
24911
24985
|
// src/commands/review/buildReviewPaths.ts
|
|
24912
24986
|
import { homedir as homedir21 } from "os";
|
|
24913
|
-
import { basename as basename16, join as
|
|
24914
|
-
function buildReviewPaths(
|
|
24915
|
-
const reviewDir =
|
|
24987
|
+
import { basename as basename16, join as join60 } from "path";
|
|
24988
|
+
function buildReviewPaths(repoRoot2, key) {
|
|
24989
|
+
const reviewDir = join60(
|
|
24916
24990
|
homedir21(),
|
|
24917
24991
|
".assist",
|
|
24918
24992
|
"reviews",
|
|
24919
|
-
basename16(
|
|
24993
|
+
basename16(repoRoot2),
|
|
24920
24994
|
key
|
|
24921
24995
|
);
|
|
24922
24996
|
return {
|
|
24923
24997
|
reviewDir,
|
|
24924
|
-
requestPath:
|
|
24925
|
-
claudePath:
|
|
24926
|
-
codexPath:
|
|
24927
|
-
synthesisPath:
|
|
24998
|
+
requestPath: join60(reviewDir, "request.md"),
|
|
24999
|
+
claudePath: join60(reviewDir, "claude.md"),
|
|
25000
|
+
codexPath: join60(reviewDir, "codex.md"),
|
|
25001
|
+
synthesisPath: join60(reviewDir, "synthesis.md")
|
|
24928
25002
|
};
|
|
24929
25003
|
}
|
|
24930
25004
|
|
|
@@ -25581,10 +25655,10 @@ async function handlePostSynthesis(synthesisPath, prInfo, options2) {
|
|
|
25581
25655
|
}
|
|
25582
25656
|
|
|
25583
25657
|
// src/commands/review/prepareReviewDir.ts
|
|
25584
|
-
import { existsSync as
|
|
25658
|
+
import { existsSync as existsSync50, mkdirSync as mkdirSync19, unlinkSync as unlinkSync17, writeFileSync as writeFileSync36 } from "fs";
|
|
25585
25659
|
function clearReviewFiles(paths) {
|
|
25586
25660
|
for (const path71 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
25587
|
-
if (
|
|
25661
|
+
if (existsSync50(path71)) unlinkSync17(path71);
|
|
25588
25662
|
}
|
|
25589
25663
|
}
|
|
25590
25664
|
function prepareReviewDir(paths, requestBody, force) {
|
|
@@ -25811,7 +25885,7 @@ function printReviewerFailures(results) {
|
|
|
25811
25885
|
}
|
|
25812
25886
|
|
|
25813
25887
|
// src/commands/review/runAndSynthesise.ts
|
|
25814
|
-
import { existsSync as
|
|
25888
|
+
import { existsSync as existsSync52, unlinkSync as unlinkSync19 } from "fs";
|
|
25815
25889
|
|
|
25816
25890
|
// src/commands/review/buildReviewerStdin.ts
|
|
25817
25891
|
var REVIEW_PROMPT = `You are acting as a reviewer for a proposed code change made by another engineer. The full review request \u2014 branch, base, changed files, and unified diff \u2014 is in the request file whose absolute path is given below.
|
|
@@ -26231,7 +26305,7 @@ function resolveClaude(args) {
|
|
|
26231
26305
|
}
|
|
26232
26306
|
|
|
26233
26307
|
// src/commands/review/runCodexReviewer.ts
|
|
26234
|
-
import { existsSync as
|
|
26308
|
+
import { existsSync as existsSync51, unlinkSync as unlinkSync18 } from "fs";
|
|
26235
26309
|
|
|
26236
26310
|
// src/commands/review/parseCodexEvent.ts
|
|
26237
26311
|
function isItemStarted(value) {
|
|
@@ -26283,7 +26357,7 @@ async function runCodexReviewer(spec) {
|
|
|
26283
26357
|
reportReviewerToolUse(spec.name, event, spinner);
|
|
26284
26358
|
}
|
|
26285
26359
|
});
|
|
26286
|
-
if (result.exitCode !== 0 &&
|
|
26360
|
+
if (result.exitCode !== 0 && existsSync51(spec.outputPath)) {
|
|
26287
26361
|
unlinkSync18(spec.outputPath);
|
|
26288
26362
|
}
|
|
26289
26363
|
return finaliseReviewerRun({ ...spec, command }, spinner, result);
|
|
@@ -26429,7 +26503,7 @@ async function runAndSynthesise(args) {
|
|
|
26429
26503
|
console.error("Both reviewers failed; skipping synthesis.");
|
|
26430
26504
|
return { ok: false, failures };
|
|
26431
26505
|
}
|
|
26432
|
-
if (anyFresh &&
|
|
26506
|
+
if (anyFresh && existsSync52(paths.synthesisPath)) {
|
|
26433
26507
|
unlinkSync19(paths.synthesisPath);
|
|
26434
26508
|
}
|
|
26435
26509
|
const synthesisResult = await synthesise(paths, { multi });
|
|
@@ -26495,9 +26569,9 @@ function gatherChangedContext() {
|
|
|
26495
26569
|
);
|
|
26496
26570
|
process.exit(1);
|
|
26497
26571
|
}
|
|
26498
|
-
function setupReviewDir(
|
|
26572
|
+
function setupReviewDir(repoRoot2, context, force) {
|
|
26499
26573
|
const paths = buildReviewPaths(
|
|
26500
|
-
|
|
26574
|
+
repoRoot2,
|
|
26501
26575
|
`${context.branch}-${context.shortSha}`
|
|
26502
26576
|
);
|
|
26503
26577
|
const priorComments = fetchExistingComments();
|
|
@@ -26517,9 +26591,9 @@ function runPostSynthesis(synthesisPath, prInfo, options2) {
|
|
|
26517
26591
|
announce: options2.announce ?? false
|
|
26518
26592
|
});
|
|
26519
26593
|
}
|
|
26520
|
-
async function reviewPr(
|
|
26594
|
+
async function reviewPr(repoRoot2, options2) {
|
|
26521
26595
|
const context = gatherChangedContext();
|
|
26522
|
-
const paths = setupReviewDir(
|
|
26596
|
+
const paths = setupReviewDir(repoRoot2, context, options2.force ?? false);
|
|
26523
26597
|
const synthesisOk = await runReviewPipeline(paths, {
|
|
26524
26598
|
verbose: options2.verbose ?? false
|
|
26525
26599
|
});
|
|
@@ -26530,8 +26604,8 @@ async function reviewPr(repoRoot, options2) {
|
|
|
26530
26604
|
|
|
26531
26605
|
// src/commands/review/review.ts
|
|
26532
26606
|
function resolveRepoRoot() {
|
|
26533
|
-
const
|
|
26534
|
-
if (
|
|
26607
|
+
const repoRoot2 = findRepoRoot(process.cwd());
|
|
26608
|
+
if (repoRoot2) return repoRoot2;
|
|
26535
26609
|
console.error("Error: not inside a git repository.");
|
|
26536
26610
|
process.exit(1);
|
|
26537
26611
|
}
|
|
@@ -27277,27 +27351,27 @@ async function configure() {
|
|
|
27277
27351
|
}
|
|
27278
27352
|
|
|
27279
27353
|
// src/commands/transcript/list.ts
|
|
27280
|
-
import { existsSync as
|
|
27281
|
-
import { join as
|
|
27354
|
+
import { existsSync as existsSync53, readdirSync as readdirSync11, statSync as statSync9 } from "fs";
|
|
27355
|
+
import { join as join61 } from "path";
|
|
27282
27356
|
function list4() {
|
|
27283
27357
|
const { vttDir } = getTranscriptConfig();
|
|
27284
|
-
if (!
|
|
27358
|
+
if (!existsSync53(vttDir)) return;
|
|
27285
27359
|
for (const entry of readdirSync11(vttDir)) {
|
|
27286
27360
|
if (!entry.endsWith(".vtt")) continue;
|
|
27287
|
-
if (statSync9(
|
|
27361
|
+
if (statSync9(join61(vttDir, entry)).isDirectory()) continue;
|
|
27288
27362
|
console.log(entry);
|
|
27289
27363
|
}
|
|
27290
27364
|
}
|
|
27291
27365
|
|
|
27292
27366
|
// src/commands/transcript/move.ts
|
|
27293
27367
|
import {
|
|
27294
|
-
existsSync as
|
|
27368
|
+
existsSync as existsSync54,
|
|
27295
27369
|
mkdirSync as mkdirSync20,
|
|
27296
27370
|
readFileSync as readFileSync43,
|
|
27297
27371
|
renameSync as renameSync2,
|
|
27298
27372
|
writeFileSync as writeFileSync38
|
|
27299
27373
|
} from "fs";
|
|
27300
|
-
import { basename as basename17, join as
|
|
27374
|
+
import { basename as basename17, join as join62 } from "path";
|
|
27301
27375
|
|
|
27302
27376
|
// src/commands/transcript/cleanText.ts
|
|
27303
27377
|
function cleanText(text17) {
|
|
@@ -27510,9 +27584,9 @@ function convertVttToMarkdown(inputPath) {
|
|
|
27510
27584
|
return formatChatLog(messages);
|
|
27511
27585
|
}
|
|
27512
27586
|
function archiveRawVtt(vttDir, sourcePath, filename) {
|
|
27513
|
-
const processedDir =
|
|
27587
|
+
const processedDir = join62(vttDir, "processed");
|
|
27514
27588
|
mkdirSync20(processedDir, { recursive: true });
|
|
27515
|
-
renameSync2(sourcePath,
|
|
27589
|
+
renameSync2(sourcePath, join62(processedDir, filename));
|
|
27516
27590
|
}
|
|
27517
27591
|
function move(file, options2) {
|
|
27518
27592
|
const { date, client } = options2;
|
|
@@ -27522,19 +27596,19 @@ function move(file, options2) {
|
|
|
27522
27596
|
}
|
|
27523
27597
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
27524
27598
|
const filename = basename17(file);
|
|
27525
|
-
const sourcePath =
|
|
27526
|
-
if (!
|
|
27599
|
+
const sourcePath = join62(vttDir, filename);
|
|
27600
|
+
if (!existsSync54(sourcePath)) {
|
|
27527
27601
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
27528
27602
|
process.exit(1);
|
|
27529
27603
|
}
|
|
27530
27604
|
const base = basename17(filename, ".vtt").replace(/ Transcription$/, "");
|
|
27531
27605
|
const outputName = `${date} ${base}.md`;
|
|
27532
|
-
const formattedDir =
|
|
27606
|
+
const formattedDir = join62(transcriptsDir, client);
|
|
27533
27607
|
mkdirSync20(formattedDir, { recursive: true });
|
|
27534
|
-
const formattedPath =
|
|
27608
|
+
const formattedPath = join62(formattedDir, outputName);
|
|
27535
27609
|
writeFileSync38(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
|
|
27536
27610
|
archiveRawVtt(vttDir, sourcePath, filename);
|
|
27537
|
-
const summaryPath =
|
|
27611
|
+
const summaryPath = join62(summaryDir, client, outputName);
|
|
27538
27612
|
console.log(`Formatted transcript: ${formattedPath}`);
|
|
27539
27613
|
console.log(`Summary target: ${summaryPath}`);
|
|
27540
27614
|
}
|
|
@@ -27616,45 +27690,45 @@ function registerVerify(program2) {
|
|
|
27616
27690
|
|
|
27617
27691
|
// src/commands/voice/devices.ts
|
|
27618
27692
|
import { spawnSync as spawnSync6 } from "child_process";
|
|
27619
|
-
import { join as
|
|
27693
|
+
import { join as join64 } from "path";
|
|
27620
27694
|
|
|
27621
27695
|
// src/commands/voice/shared.ts
|
|
27622
27696
|
import { homedir as homedir22 } from "os";
|
|
27623
|
-
import { dirname as
|
|
27697
|
+
import { dirname as dirname31, join as join63 } from "path";
|
|
27624
27698
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
27625
|
-
var __dirname5 =
|
|
27626
|
-
var VOICE_DIR =
|
|
27699
|
+
var __dirname5 = dirname31(fileURLToPath7(import.meta.url));
|
|
27700
|
+
var VOICE_DIR = join63(homedir22(), ".assist", "voice");
|
|
27627
27701
|
var voicePaths = {
|
|
27628
27702
|
dir: VOICE_DIR,
|
|
27629
|
-
pid:
|
|
27630
|
-
log:
|
|
27631
|
-
venv:
|
|
27632
|
-
lock:
|
|
27703
|
+
pid: join63(VOICE_DIR, "voice.pid"),
|
|
27704
|
+
log: join63(VOICE_DIR, "voice.log"),
|
|
27705
|
+
venv: join63(VOICE_DIR, ".venv"),
|
|
27706
|
+
lock: join63(VOICE_DIR, "voice.lock")
|
|
27633
27707
|
};
|
|
27634
27708
|
function getPythonDir() {
|
|
27635
|
-
return
|
|
27709
|
+
return join63(__dirname5, "commands", "voice", "python");
|
|
27636
27710
|
}
|
|
27637
27711
|
function getVenvPython() {
|
|
27638
|
-
return process.platform === "win32" ?
|
|
27712
|
+
return process.platform === "win32" ? join63(voicePaths.venv, "Scripts", "python.exe") : join63(voicePaths.venv, "bin", "python");
|
|
27639
27713
|
}
|
|
27640
27714
|
function getLockDir() {
|
|
27641
27715
|
const config = loadConfig();
|
|
27642
27716
|
return config.voice?.lockDir ?? VOICE_DIR;
|
|
27643
27717
|
}
|
|
27644
27718
|
function getLockFile() {
|
|
27645
|
-
return
|
|
27719
|
+
return join63(getLockDir(), "voice.lock");
|
|
27646
27720
|
}
|
|
27647
27721
|
|
|
27648
27722
|
// src/commands/voice/devices.ts
|
|
27649
27723
|
function devices() {
|
|
27650
|
-
const script =
|
|
27724
|
+
const script = join64(getPythonDir(), "list_devices.py");
|
|
27651
27725
|
spawnSync6(getVenvPython(), [script], { stdio: "inherit" });
|
|
27652
27726
|
}
|
|
27653
27727
|
|
|
27654
27728
|
// src/commands/voice/logs.ts
|
|
27655
|
-
import { existsSync as
|
|
27729
|
+
import { existsSync as existsSync55, readFileSync as readFileSync44 } from "fs";
|
|
27656
27730
|
function logs(options2) {
|
|
27657
|
-
if (!
|
|
27731
|
+
if (!existsSync55(voicePaths.log)) {
|
|
27658
27732
|
console.log("No voice log file found");
|
|
27659
27733
|
return;
|
|
27660
27734
|
}
|
|
@@ -27682,12 +27756,12 @@ function logs(options2) {
|
|
|
27682
27756
|
// src/commands/voice/setup.ts
|
|
27683
27757
|
import { spawnSync as spawnSync7 } from "child_process";
|
|
27684
27758
|
import { mkdirSync as mkdirSync22 } from "fs";
|
|
27685
|
-
import { join as
|
|
27759
|
+
import { join as join66 } from "path";
|
|
27686
27760
|
|
|
27687
27761
|
// src/commands/voice/checkLockFile.ts
|
|
27688
27762
|
import { execSync as execSync59 } from "child_process";
|
|
27689
|
-
import { existsSync as
|
|
27690
|
-
import { join as
|
|
27763
|
+
import { existsSync as existsSync56, mkdirSync as mkdirSync21, readFileSync as readFileSync45, writeFileSync as writeFileSync39 } from "fs";
|
|
27764
|
+
import { join as join65 } from "path";
|
|
27691
27765
|
function isProcessAlive2(pid) {
|
|
27692
27766
|
try {
|
|
27693
27767
|
process.kill(pid, 0);
|
|
@@ -27698,7 +27772,7 @@ function isProcessAlive2(pid) {
|
|
|
27698
27772
|
}
|
|
27699
27773
|
function checkLockFile() {
|
|
27700
27774
|
const lockFile = getLockFile();
|
|
27701
|
-
if (!
|
|
27775
|
+
if (!existsSync56(lockFile)) return;
|
|
27702
27776
|
try {
|
|
27703
27777
|
const lock2 = JSON.parse(readFileSync45(lockFile, "utf8"));
|
|
27704
27778
|
if (lock2.pid && isProcessAlive2(lock2.pid)) {
|
|
@@ -27711,7 +27785,7 @@ function checkLockFile() {
|
|
|
27711
27785
|
}
|
|
27712
27786
|
}
|
|
27713
27787
|
function bootstrapVenv() {
|
|
27714
|
-
if (
|
|
27788
|
+
if (existsSync56(getVenvPython())) return;
|
|
27715
27789
|
console.log("Setting up Python environment...");
|
|
27716
27790
|
const pythonDir = getPythonDir();
|
|
27717
27791
|
execSync59(
|
|
@@ -27724,7 +27798,7 @@ function bootstrapVenv() {
|
|
|
27724
27798
|
}
|
|
27725
27799
|
function writeLockFile(pid) {
|
|
27726
27800
|
const lockFile = getLockFile();
|
|
27727
|
-
mkdirSync21(
|
|
27801
|
+
mkdirSync21(join65(lockFile, ".."), { recursive: true });
|
|
27728
27802
|
writeFileSync39(
|
|
27729
27803
|
lockFile,
|
|
27730
27804
|
JSON.stringify({
|
|
@@ -27740,7 +27814,7 @@ function setup() {
|
|
|
27740
27814
|
mkdirSync22(voicePaths.dir, { recursive: true });
|
|
27741
27815
|
bootstrapVenv();
|
|
27742
27816
|
console.log("\nDownloading models...\n");
|
|
27743
|
-
const script =
|
|
27817
|
+
const script = join66(getPythonDir(), "setup_models.py");
|
|
27744
27818
|
const result = spawnSync7(getVenvPython(), [script], {
|
|
27745
27819
|
stdio: "inherit",
|
|
27746
27820
|
env: { ...process.env, VOICE_LOG_FILE: voicePaths.log }
|
|
@@ -27754,7 +27828,7 @@ function setup() {
|
|
|
27754
27828
|
// src/commands/voice/start.ts
|
|
27755
27829
|
import { spawn as spawn8 } from "child_process";
|
|
27756
27830
|
import { mkdirSync as mkdirSync23, writeFileSync as writeFileSync40 } from "fs";
|
|
27757
|
-
import { join as
|
|
27831
|
+
import { join as join67 } from "path";
|
|
27758
27832
|
|
|
27759
27833
|
// src/commands/voice/buildDaemonEnv.ts
|
|
27760
27834
|
function buildDaemonEnv(options2) {
|
|
@@ -27792,7 +27866,7 @@ function start2(options2) {
|
|
|
27792
27866
|
bootstrapVenv();
|
|
27793
27867
|
const debug = options2.debug || options2.foreground || process.platform === "win32";
|
|
27794
27868
|
const env = buildDaemonEnv({ debug });
|
|
27795
|
-
const script =
|
|
27869
|
+
const script = join67(getPythonDir(), "voice_daemon.py");
|
|
27796
27870
|
const python = getVenvPython();
|
|
27797
27871
|
if (options2.foreground) {
|
|
27798
27872
|
spawnForeground(python, script, env);
|
|
@@ -27802,7 +27876,7 @@ function start2(options2) {
|
|
|
27802
27876
|
}
|
|
27803
27877
|
|
|
27804
27878
|
// src/commands/voice/status.ts
|
|
27805
|
-
import { existsSync as
|
|
27879
|
+
import { existsSync as existsSync57, readFileSync as readFileSync46 } from "fs";
|
|
27806
27880
|
function isProcessAlive3(pid) {
|
|
27807
27881
|
try {
|
|
27808
27882
|
process.kill(pid, 0);
|
|
@@ -27812,12 +27886,12 @@ function isProcessAlive3(pid) {
|
|
|
27812
27886
|
}
|
|
27813
27887
|
}
|
|
27814
27888
|
function readRecentLogs(count8) {
|
|
27815
|
-
if (!
|
|
27889
|
+
if (!existsSync57(voicePaths.log)) return [];
|
|
27816
27890
|
const lines2 = readFileSync46(voicePaths.log, "utf8").trim().split("\n");
|
|
27817
27891
|
return lines2.slice(-count8);
|
|
27818
27892
|
}
|
|
27819
27893
|
function status2() {
|
|
27820
|
-
if (!
|
|
27894
|
+
if (!existsSync57(voicePaths.pid)) {
|
|
27821
27895
|
console.log("Voice daemon: not running (no PID file)");
|
|
27822
27896
|
return;
|
|
27823
27897
|
}
|
|
@@ -27840,9 +27914,9 @@ function status2() {
|
|
|
27840
27914
|
}
|
|
27841
27915
|
|
|
27842
27916
|
// src/commands/voice/stop.ts
|
|
27843
|
-
import { existsSync as
|
|
27917
|
+
import { existsSync as existsSync58, readFileSync as readFileSync47, unlinkSync as unlinkSync20 } from "fs";
|
|
27844
27918
|
function stop2() {
|
|
27845
|
-
if (!
|
|
27919
|
+
if (!existsSync58(voicePaths.pid)) {
|
|
27846
27920
|
console.log("Voice daemon is not running (no PID file)");
|
|
27847
27921
|
return;
|
|
27848
27922
|
}
|
|
@@ -27859,7 +27933,7 @@ function stop2() {
|
|
|
27859
27933
|
}
|
|
27860
27934
|
try {
|
|
27861
27935
|
const lockFile = getLockFile();
|
|
27862
|
-
if (
|
|
27936
|
+
if (existsSync58(lockFile)) unlinkSync20(lockFile);
|
|
27863
27937
|
} catch {
|
|
27864
27938
|
}
|
|
27865
27939
|
console.log("Voice daemon stopped");
|
|
@@ -27878,7 +27952,7 @@ function registerVoice(program2) {
|
|
|
27878
27952
|
}
|
|
27879
27953
|
|
|
27880
27954
|
// src/commands/watch/readBuiltVersion.ts
|
|
27881
|
-
import { join as
|
|
27955
|
+
import { join as join68 } from "path";
|
|
27882
27956
|
|
|
27883
27957
|
// src/commands/watch/resolveUpstream.ts
|
|
27884
27958
|
import { execFileSync as execFileSync10 } from "child_process";
|
|
@@ -27924,7 +27998,7 @@ function resolveUpstream(cwd) {
|
|
|
27924
27998
|
function readBuiltVersion(cwd) {
|
|
27925
27999
|
try {
|
|
27926
28000
|
const root = runGit2(["rev-parse", "--show-toplevel"], cwd);
|
|
27927
|
-
return readPackageJson(
|
|
28001
|
+
return readPackageJson(join68(root, "package.json")).version ?? "unknown";
|
|
27928
28002
|
} catch {
|
|
27929
28003
|
return "unknown";
|
|
27930
28004
|
}
|
|
@@ -28222,7 +28296,7 @@ function resolveParams(params, cliArgs) {
|
|
|
28222
28296
|
}
|
|
28223
28297
|
|
|
28224
28298
|
// src/commands/run/resolveRunCwd.ts
|
|
28225
|
-
import { existsSync as
|
|
28299
|
+
import { existsSync as existsSync59 } from "fs";
|
|
28226
28300
|
import { resolve as resolve17 } from "path";
|
|
28227
28301
|
var MissingRunCwdError = class extends Error {
|
|
28228
28302
|
constructor(runName, cwd) {
|
|
@@ -28235,25 +28309,25 @@ var MissingRunCwdError = class extends Error {
|
|
|
28235
28309
|
function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
|
|
28236
28310
|
if (!config.cwd) return void 0;
|
|
28237
28311
|
const cwd = resolve17(baseDir, config.cwd);
|
|
28238
|
-
if (!
|
|
28312
|
+
if (!existsSync59(cwd)) throw new MissingRunCwdError(config.name, cwd);
|
|
28239
28313
|
return cwd;
|
|
28240
28314
|
}
|
|
28241
28315
|
|
|
28242
28316
|
// src/commands/run/runCommandToCompletion.ts
|
|
28243
28317
|
import { spawn as spawn9 } from "child_process";
|
|
28244
|
-
import { existsSync as
|
|
28318
|
+
import { existsSync as existsSync61 } from "fs";
|
|
28245
28319
|
|
|
28246
28320
|
// src/commands/run/resolveCommand.ts
|
|
28247
28321
|
import { execFileSync as execFileSync11 } from "child_process";
|
|
28248
|
-
import { existsSync as
|
|
28249
|
-
import { dirname as
|
|
28322
|
+
import { existsSync as existsSync60 } from "fs";
|
|
28323
|
+
import { dirname as dirname32, join as join69, resolve as resolve18 } from "path";
|
|
28250
28324
|
function resolveCommand2(command) {
|
|
28251
28325
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
28252
28326
|
try {
|
|
28253
28327
|
const gitPath = execFileSync11("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
28254
|
-
const gitRoot = resolve18(
|
|
28255
|
-
const gitBash =
|
|
28256
|
-
if (
|
|
28328
|
+
const gitRoot = resolve18(dirname32(gitPath), "..");
|
|
28329
|
+
const gitBash = join69(gitRoot, "bin", "bash.exe");
|
|
28330
|
+
if (existsSync60(gitBash)) return gitBash;
|
|
28257
28331
|
} catch {
|
|
28258
28332
|
return command;
|
|
28259
28333
|
}
|
|
@@ -28263,7 +28337,7 @@ function resolveCommand2(command) {
|
|
|
28263
28337
|
// src/commands/run/runCommandToCompletion.ts
|
|
28264
28338
|
function runCommandToCompletion(command, args, env, cwd, quiet) {
|
|
28265
28339
|
return new Promise((resolveResult) => {
|
|
28266
|
-
if (cwd && !
|
|
28340
|
+
if (cwd && !existsSync61(cwd)) {
|
|
28267
28341
|
resolveResult({
|
|
28268
28342
|
kind: "failed",
|
|
28269
28343
|
message: `Failed to execute command: cwd ${cwd} does not exist`
|
|
@@ -28653,7 +28727,7 @@ async function auth() {
|
|
|
28653
28727
|
// src/commands/roam/postRoamActivity.ts
|
|
28654
28728
|
import { execFileSync as execFileSync13 } from "child_process";
|
|
28655
28729
|
import { readdirSync as readdirSync12, readFileSync as readFileSync48, statSync as statSync10 } from "fs";
|
|
28656
|
-
import { join as
|
|
28730
|
+
import { join as join70 } from "path";
|
|
28657
28731
|
function findPortFile(roamDir) {
|
|
28658
28732
|
let entries;
|
|
28659
28733
|
try {
|
|
@@ -28662,7 +28736,7 @@ function findPortFile(roamDir) {
|
|
|
28662
28736
|
return void 0;
|
|
28663
28737
|
}
|
|
28664
28738
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
28665
|
-
const path71 =
|
|
28739
|
+
const path71 = join70(roamDir, name);
|
|
28666
28740
|
try {
|
|
28667
28741
|
return { path: path71, mtimeMs: statSync10(path71).mtimeMs };
|
|
28668
28742
|
} catch {
|
|
@@ -28674,7 +28748,7 @@ function findPortFile(roamDir) {
|
|
|
28674
28748
|
function postRoamActivity(app, event) {
|
|
28675
28749
|
const appData = process.env.APPDATA;
|
|
28676
28750
|
if (!appData) return;
|
|
28677
|
-
const portFile = findPortFile(
|
|
28751
|
+
const portFile = findPortFile(join70(appData, "Roam"));
|
|
28678
28752
|
if (!portFile) return;
|
|
28679
28753
|
let port;
|
|
28680
28754
|
try {
|
|
@@ -28807,7 +28881,7 @@ async function run3(name, args) {
|
|
|
28807
28881
|
|
|
28808
28882
|
// src/commands/run/add.ts
|
|
28809
28883
|
import { mkdirSync as mkdirSync24, writeFileSync as writeFileSync41 } from "fs";
|
|
28810
|
-
import { join as
|
|
28884
|
+
import { join as join71 } from "path";
|
|
28811
28885
|
|
|
28812
28886
|
// src/commands/run/extractOption.ts
|
|
28813
28887
|
function extractOption(args, flag) {
|
|
@@ -28868,7 +28942,7 @@ function saveNewRunConfig(name, command, args, cwd) {
|
|
|
28868
28942
|
saveConfig(config);
|
|
28869
28943
|
}
|
|
28870
28944
|
function createCommandFile(name) {
|
|
28871
|
-
const dir =
|
|
28945
|
+
const dir = join71(".claude", "commands");
|
|
28872
28946
|
mkdirSync24(dir, { recursive: true });
|
|
28873
28947
|
const content = `---
|
|
28874
28948
|
description: Run ${name}
|
|
@@ -28876,7 +28950,7 @@ description: Run ${name}
|
|
|
28876
28950
|
|
|
28877
28951
|
Run \`assist run ${name} $ARGUMENTS 2>&1\`.
|
|
28878
28952
|
`;
|
|
28879
|
-
const filePath =
|
|
28953
|
+
const filePath = join71(dir, `${name}.md`);
|
|
28880
28954
|
writeFileSync41(filePath, content);
|
|
28881
28955
|
console.log(`Created command file: ${filePath}`);
|
|
28882
28956
|
}
|
|
@@ -28932,8 +29006,8 @@ function link2() {
|
|
|
28932
29006
|
}
|
|
28933
29007
|
|
|
28934
29008
|
// src/commands/run/remove.ts
|
|
28935
|
-
import { existsSync as
|
|
28936
|
-
import { join as
|
|
29009
|
+
import { existsSync as existsSync62, unlinkSync as unlinkSync21 } from "fs";
|
|
29010
|
+
import { join as join72 } from "path";
|
|
28937
29011
|
function findRemoveIndex() {
|
|
28938
29012
|
const idx = process.argv.indexOf("remove");
|
|
28939
29013
|
if (idx === -1 || idx + 1 >= process.argv.length) return -1;
|
|
@@ -28948,8 +29022,8 @@ function parseRemoveName() {
|
|
|
28948
29022
|
return process.argv[idx + 1];
|
|
28949
29023
|
}
|
|
28950
29024
|
function deleteCommandFile(name) {
|
|
28951
|
-
const filePath =
|
|
28952
|
-
if (
|
|
29025
|
+
const filePath = join72(".claude", "commands", `${name}.md`);
|
|
29026
|
+
if (existsSync62(filePath)) {
|
|
28953
29027
|
unlinkSync21(filePath);
|
|
28954
29028
|
console.log(`Deleted command file: ${filePath}`);
|
|
28955
29029
|
}
|
|
@@ -28994,9 +29068,9 @@ function registerRun(program2) {
|
|
|
28994
29068
|
|
|
28995
29069
|
// src/commands/screenshot/index.ts
|
|
28996
29070
|
import { execSync as execSync61 } from "child_process";
|
|
28997
|
-
import { existsSync as
|
|
29071
|
+
import { existsSync as existsSync63, mkdirSync as mkdirSync25, unlinkSync as unlinkSync22, writeFileSync as writeFileSync42 } from "fs";
|
|
28998
29072
|
import { tmpdir as tmpdir8 } from "os";
|
|
28999
|
-
import { join as
|
|
29073
|
+
import { join as join73, resolve as resolve19 } from "path";
|
|
29000
29074
|
import chalk211 from "chalk";
|
|
29001
29075
|
|
|
29002
29076
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
@@ -29126,14 +29200,14 @@ Write-Output $OutputPath
|
|
|
29126
29200
|
|
|
29127
29201
|
// src/commands/screenshot/index.ts
|
|
29128
29202
|
function buildOutputPath(outputDir, processName) {
|
|
29129
|
-
if (!
|
|
29203
|
+
if (!existsSync63(outputDir)) {
|
|
29130
29204
|
mkdirSync25(outputDir, { recursive: true });
|
|
29131
29205
|
}
|
|
29132
29206
|
const timestamp6 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
29133
29207
|
return resolve19(outputDir, `${processName}-${timestamp6}.png`);
|
|
29134
29208
|
}
|
|
29135
29209
|
function runPowerShellScript(processName, outputPath) {
|
|
29136
|
-
const scriptPath =
|
|
29210
|
+
const scriptPath = join73(tmpdir8(), `assist-screenshot-${Date.now()}.ps1`);
|
|
29137
29211
|
writeFileSync42(scriptPath, captureWindowPs1, "utf8");
|
|
29138
29212
|
try {
|
|
29139
29213
|
execSync61(
|
|
@@ -29615,11 +29689,11 @@ function readDesignSystemPrompt() {
|
|
|
29615
29689
|
}
|
|
29616
29690
|
|
|
29617
29691
|
// src/commands/sessions/daemon/spawnPty.ts
|
|
29618
|
-
import { existsSync as
|
|
29692
|
+
import { existsSync as existsSync65 } from "fs";
|
|
29619
29693
|
import * as pty from "node-pty";
|
|
29620
29694
|
|
|
29621
29695
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
29622
|
-
import { chmodSync, existsSync as
|
|
29696
|
+
import { chmodSync, existsSync as existsSync64, statSync as statSync11 } from "fs";
|
|
29623
29697
|
import { createRequire as createRequire3 } from "module";
|
|
29624
29698
|
import path59 from "path";
|
|
29625
29699
|
var require4 = createRequire3(import.meta.url);
|
|
@@ -29634,7 +29708,7 @@ function ensureSpawnHelperExecutable() {
|
|
|
29634
29708
|
`${process.platform}-${process.arch}`,
|
|
29635
29709
|
"spawn-helper"
|
|
29636
29710
|
);
|
|
29637
|
-
if (!
|
|
29711
|
+
if (!existsSync64(helper)) return;
|
|
29638
29712
|
const mode = statSync11(helper).mode;
|
|
29639
29713
|
if ((mode & 73) === 0) chmodSync(helper, mode | 493);
|
|
29640
29714
|
}
|
|
@@ -29670,7 +29744,7 @@ function spawnPty(args, cwd, sessionId, extraEnv) {
|
|
|
29670
29744
|
});
|
|
29671
29745
|
}
|
|
29672
29746
|
function refuseMissingCwd(cwd, sessionId) {
|
|
29673
|
-
if (!cwd ||
|
|
29747
|
+
if (!cwd || existsSync65(cwd)) return;
|
|
29674
29748
|
daemonLog(
|
|
29675
29749
|
`${sessionId ? `session ${sessionId}` : "pty"} not spawned: working directory ${cwd} no longer exists`
|
|
29676
29750
|
);
|
|
@@ -29793,17 +29867,17 @@ function setStatus2(session, newStatus) {
|
|
|
29793
29867
|
}
|
|
29794
29868
|
|
|
29795
29869
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
29796
|
-
import { existsSync as
|
|
29870
|
+
import { existsSync as existsSync67 } from "fs";
|
|
29797
29871
|
import { basename as basename18 } from "path";
|
|
29798
29872
|
|
|
29799
29873
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
29800
|
-
import { existsSync as
|
|
29801
|
-
import { join as
|
|
29874
|
+
import { existsSync as existsSync66 } from "fs";
|
|
29875
|
+
import { join as join76 } from "path";
|
|
29802
29876
|
|
|
29803
29877
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
29804
29878
|
import { statSync as statSync12 } from "fs";
|
|
29805
29879
|
import { rm as rm2 } from "fs/promises";
|
|
29806
|
-
import { join as
|
|
29880
|
+
import { join as join75 } from "path";
|
|
29807
29881
|
async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
29808
29882
|
if (holdsAGitDirectoryRatherThanALink(worktreePath)) {
|
|
29809
29883
|
const refusal = "it is a clone of its own, not a linked worktree";
|
|
@@ -29831,7 +29905,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
|
29831
29905
|
return { removed: true };
|
|
29832
29906
|
}
|
|
29833
29907
|
function holdsAGitDirectoryRatherThanALink(worktreePath) {
|
|
29834
|
-
return statSync12(
|
|
29908
|
+
return statSync12(join75(worktreePath, ".git"), {
|
|
29835
29909
|
throwIfNoEntry: false
|
|
29836
29910
|
})?.isDirectory() === true;
|
|
29837
29911
|
}
|
|
@@ -29867,7 +29941,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
29867
29941
|
);
|
|
29868
29942
|
}
|
|
29869
29943
|
function strandedReason(worktreePath, cause) {
|
|
29870
|
-
if (!
|
|
29944
|
+
if (!existsSync66(join76(worktreePath, ".git")))
|
|
29871
29945
|
return "its .git link is already gone";
|
|
29872
29946
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
29873
29947
|
return "git no longer recognises it as a working tree";
|
|
@@ -29919,7 +29993,7 @@ function reason3(error) {
|
|
|
29919
29993
|
|
|
29920
29994
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
29921
29995
|
async function reapWorktree(worktreePath, force = false) {
|
|
29922
|
-
if (!
|
|
29996
|
+
if (!existsSync67(worktreePath)) {
|
|
29923
29997
|
forgetWorktree(worktreePath);
|
|
29924
29998
|
daemonLog(
|
|
29925
29999
|
`worktree ${worktreePath} already gone; its record was forgotten`
|
|
@@ -29944,7 +30018,7 @@ async function reapWorktree(worktreePath, force = false) {
|
|
|
29944
30018
|
}
|
|
29945
30019
|
function owningClone(worktreePath) {
|
|
29946
30020
|
const recorded = worktreeAttributionIncludingReaped(worktreePath)?.clone;
|
|
29947
|
-
if (recorded &&
|
|
30021
|
+
if (recorded && existsSync67(recorded)) return recorded;
|
|
29948
30022
|
const detected = mainWorktree(worktreePath);
|
|
29949
30023
|
if (detected) return detected;
|
|
29950
30024
|
daemonLog(
|
|
@@ -30072,12 +30146,12 @@ function closeGateApplies(sessions, session) {
|
|
|
30072
30146
|
}
|
|
30073
30147
|
|
|
30074
30148
|
// src/commands/sessions/daemon/worktree/watchGitState.ts
|
|
30075
|
-
import { existsSync as
|
|
30149
|
+
import { existsSync as existsSync68, watch } from "fs";
|
|
30076
30150
|
var DEBOUNCE_MS = 500;
|
|
30077
30151
|
var POLL_MS = 3e4;
|
|
30078
30152
|
function watchGitState(cwd, onChange) {
|
|
30079
30153
|
const common = gitCommonDir(cwd);
|
|
30080
|
-
if (!common || !
|
|
30154
|
+
if (!common || !existsSync68(common)) return void 0;
|
|
30081
30155
|
const watchers = [
|
|
30082
30156
|
watchGitDir(common, onChange),
|
|
30083
30157
|
pollGitState(cwd, onChange)
|
|
@@ -30436,13 +30510,13 @@ function isBacklogItemId(text17) {
|
|
|
30436
30510
|
}
|
|
30437
30511
|
|
|
30438
30512
|
// src/commands/sessions/daemon/generateSessionTitle.ts
|
|
30439
|
-
import { execFile as
|
|
30440
|
-
import { promisify as
|
|
30441
|
-
var
|
|
30513
|
+
import { execFile as execFile10 } from "child_process";
|
|
30514
|
+
import { promisify as promisify9 } from "util";
|
|
30515
|
+
var execFileAsync8 = promisify9(execFile10);
|
|
30442
30516
|
var SESSION_TITLE_MAX_LENGTH = 48;
|
|
30443
30517
|
async function generateSessionTitle(prompt) {
|
|
30444
30518
|
try {
|
|
30445
|
-
const { stdout } = await
|
|
30519
|
+
const { stdout } = await execFileAsync8(
|
|
30446
30520
|
"claude",
|
|
30447
30521
|
["-p", "--model", "haiku", buildPrompt4(prompt)],
|
|
30448
30522
|
{ encoding: "utf8", windowsHide: true, timeout: 3e4 }
|
|
@@ -30521,10 +30595,10 @@ function emitSessionOutput(session, clients, data) {
|
|
|
30521
30595
|
}
|
|
30522
30596
|
|
|
30523
30597
|
// src/commands/sessions/daemon/exitReason.ts
|
|
30524
|
-
import { existsSync as
|
|
30598
|
+
import { existsSync as existsSync69 } from "fs";
|
|
30525
30599
|
import { resolve as resolve20 } from "path";
|
|
30526
30600
|
function exitDetail(session) {
|
|
30527
|
-
if (session.cwd && !
|
|
30601
|
+
if (session.cwd && !existsSync69(session.cwd))
|
|
30528
30602
|
return `working directory ${session.cwd} no longer exists`;
|
|
30529
30603
|
return missingRunConfigCwd(session);
|
|
30530
30604
|
}
|
|
@@ -30538,7 +30612,7 @@ function missingRunConfigCwd(session) {
|
|
|
30538
30612
|
const config = resolveRunConfig(session.runName, dir);
|
|
30539
30613
|
if (!config?.cwd) return void 0;
|
|
30540
30614
|
const configured = resolve20(runConfigBaseDirFrom(dir), config.cwd);
|
|
30541
|
-
if (
|
|
30615
|
+
if (existsSync69(configured)) return void 0;
|
|
30542
30616
|
return `run config "${config.name}": cwd ${configured} does not exist`;
|
|
30543
30617
|
}
|
|
30544
30618
|
|
|
@@ -30555,8 +30629,8 @@ function handleFailedResume(session, exitCode, onStatusChange) {
|
|
|
30555
30629
|
}
|
|
30556
30630
|
|
|
30557
30631
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
30558
|
-
import { existsSync as
|
|
30559
|
-
import { dirname as
|
|
30632
|
+
import { existsSync as existsSync70, mkdirSync as mkdirSync26, watch as watch2 } from "fs";
|
|
30633
|
+
import { dirname as dirname34 } from "path";
|
|
30560
30634
|
|
|
30561
30635
|
// src/commands/sessions/daemon/applyReviewPause.ts
|
|
30562
30636
|
function applyReviewPause(session, activity2) {
|
|
@@ -30610,7 +30684,7 @@ var DEBOUNCE_MS2 = 50;
|
|
|
30610
30684
|
function watchActivity(session, notify2, onClaudeSessionId) {
|
|
30611
30685
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
30612
30686
|
const path71 = activityPath(session.id);
|
|
30613
|
-
const dir =
|
|
30687
|
+
const dir = dirname34(path71);
|
|
30614
30688
|
try {
|
|
30615
30689
|
mkdirSync26(dir, { recursive: true });
|
|
30616
30690
|
} catch {
|
|
@@ -30636,7 +30710,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
30636
30710
|
if (timer) clearTimeout(timer);
|
|
30637
30711
|
timer = setTimeout(read, DEBOUNCE_MS2);
|
|
30638
30712
|
});
|
|
30639
|
-
if (
|
|
30713
|
+
if (existsSync70(path71)) read();
|
|
30640
30714
|
}
|
|
30641
30715
|
function refreshActivity(session) {
|
|
30642
30716
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -31962,7 +32036,7 @@ function rearmStoppedSessions(sessions, notify2) {
|
|
|
31962
32036
|
}
|
|
31963
32037
|
|
|
31964
32038
|
// src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
|
|
31965
|
-
import { existsSync as
|
|
32039
|
+
import { existsSync as existsSync73 } from "fs";
|
|
31966
32040
|
import { basename as basename20 } from "path";
|
|
31967
32041
|
|
|
31968
32042
|
// src/commands/sessions/daemon/worktree/accountedTrees.ts
|
|
@@ -31984,10 +32058,10 @@ function accountedTrees(sessions) {
|
|
|
31984
32058
|
|
|
31985
32059
|
// src/commands/sessions/daemon/worktree/detectExistingWorktree.ts
|
|
31986
32060
|
function detectExistingWorktree(cwd) {
|
|
31987
|
-
const
|
|
31988
|
-
if (!worktreeConfigFor(
|
|
31989
|
-
const clone = mainWorktree(
|
|
31990
|
-
if (clone && clone !==
|
|
32061
|
+
const repoRoot2 = findRepoRoot(cwd) ?? cwd;
|
|
32062
|
+
if (!worktreeConfigFor(repoRoot2).enabled) return void 0;
|
|
32063
|
+
const clone = mainWorktree(repoRoot2);
|
|
32064
|
+
if (clone && clone !== repoRoot2) return { path: repoRoot2, clone };
|
|
31991
32065
|
return void 0;
|
|
31992
32066
|
}
|
|
31993
32067
|
|
|
@@ -32052,9 +32126,9 @@ function capped(lines2) {
|
|
|
32052
32126
|
}
|
|
32053
32127
|
|
|
32054
32128
|
// src/commands/sessions/daemon/worktree/reclaimVanishedWorktrees.ts
|
|
32055
|
-
import { existsSync as
|
|
32129
|
+
import { existsSync as existsSync72 } from "fs";
|
|
32056
32130
|
async function reclaimVanishedWorktrees(clone, paths) {
|
|
32057
|
-
if (!
|
|
32131
|
+
if (!existsSync72(clone)) {
|
|
32058
32132
|
for (const { path: path71 } of paths) forgetWorktree(path71);
|
|
32059
32133
|
daemonLog(
|
|
32060
32134
|
`clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
|
|
@@ -32161,7 +32235,7 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
|
32161
32235
|
const accounted = accountedTrees(sessions);
|
|
32162
32236
|
const vanished = /* @__PURE__ */ new Map();
|
|
32163
32237
|
for (const { path: path71, clone } of readWorktreeRegistry()) {
|
|
32164
|
-
if (!
|
|
32238
|
+
if (!existsSync73(path71)) {
|
|
32165
32239
|
logVanishedTree(sessions, path71);
|
|
32166
32240
|
vanished.set(clone, [
|
|
32167
32241
|
...vanished.get(clone) ?? [],
|
|
@@ -32626,13 +32700,13 @@ async function defaultConnect() {
|
|
|
32626
32700
|
}
|
|
32627
32701
|
|
|
32628
32702
|
// src/commands/sessions/daemon/hasPersistedWindowsSessions.ts
|
|
32629
|
-
import { existsSync as
|
|
32703
|
+
import { existsSync as existsSync74, readFileSync as readFileSync51 } from "fs";
|
|
32630
32704
|
import { posix } from "path";
|
|
32631
32705
|
function hasPersistedWindowsSessions() {
|
|
32632
32706
|
const sessionsFile = windowsSessionsFileFromWsl();
|
|
32633
32707
|
if (!sessionsFile) return false;
|
|
32634
32708
|
try {
|
|
32635
|
-
if (!
|
|
32709
|
+
if (!existsSync74(sessionsFile)) return false;
|
|
32636
32710
|
const data = JSON.parse(readFileSync51(sessionsFile, "utf8"));
|
|
32637
32711
|
return Array.isArray(data) && data.length > 0;
|
|
32638
32712
|
} catch (error) {
|
|
@@ -33607,9 +33681,9 @@ function safeParse2(line) {
|
|
|
33607
33681
|
}
|
|
33608
33682
|
|
|
33609
33683
|
// src/commands/sessions/daemon/repoDirExists.ts
|
|
33610
|
-
import { existsSync as
|
|
33684
|
+
import { existsSync as existsSync75 } from "fs";
|
|
33611
33685
|
function repoDirExists(cwd) {
|
|
33612
|
-
return
|
|
33686
|
+
return existsSync75(toGitCwd(cwd));
|
|
33613
33687
|
}
|
|
33614
33688
|
|
|
33615
33689
|
// src/commands/sessions/daemon/withRepoGroups.ts
|
|
@@ -34169,9 +34243,9 @@ function buildLimitsSegment(rateLimits) {
|
|
|
34169
34243
|
|
|
34170
34244
|
// src/commands/readGitBranch.ts
|
|
34171
34245
|
import { readFileSync as readFileSync54, statSync as statSync14 } from "fs";
|
|
34172
|
-
import { isAbsolute as isAbsolute4, join as
|
|
34246
|
+
import { isAbsolute as isAbsolute4, join as join78, resolve as resolve21 } from "path";
|
|
34173
34247
|
function resolveGitDir(cwd) {
|
|
34174
|
-
const dotGit =
|
|
34248
|
+
const dotGit = join78(cwd, ".git");
|
|
34175
34249
|
let stat3;
|
|
34176
34250
|
try {
|
|
34177
34251
|
stat3 = statSync14(dotGit);
|
|
@@ -34201,7 +34275,7 @@ function readGitBranch(cwd) {
|
|
|
34201
34275
|
}
|
|
34202
34276
|
let head;
|
|
34203
34277
|
try {
|
|
34204
|
-
head = readFileSync54(
|
|
34278
|
+
head = readFileSync54(join78(gitDir, "HEAD"), "utf8");
|
|
34205
34279
|
} catch {
|
|
34206
34280
|
return null;
|
|
34207
34281
|
}
|