@staff0rd/assist 0.341.1 → 0.342.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 +84 -84
- package/dist/index.js +364 -302
- 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.342.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -5579,7 +5579,7 @@ function delay(ms) {
|
|
|
5579
5579
|
|
|
5580
5580
|
// src/commands/sessions/web/handleRequest.ts
|
|
5581
5581
|
import { createHash as createHash2 } from "crypto";
|
|
5582
|
-
import { readFileSync as
|
|
5582
|
+
import { readFileSync as readFileSync18 } from "fs";
|
|
5583
5583
|
import { createRequire as createRequire2 } from "module";
|
|
5584
5584
|
|
|
5585
5585
|
// src/shared/createBundleHandler.ts
|
|
@@ -5940,6 +5940,81 @@ function getHtml() {
|
|
|
5940
5940
|
</html>`;
|
|
5941
5941
|
}
|
|
5942
5942
|
|
|
5943
|
+
// src/commands/sessions/web/getReviewSynthesis.ts
|
|
5944
|
+
import { execFile } from "child_process";
|
|
5945
|
+
import { readFileSync as readFileSync17 } from "fs";
|
|
5946
|
+
import { homedir as homedir9 } from "os";
|
|
5947
|
+
import { basename as basename3, join as join22 } from "path";
|
|
5948
|
+
import { promisify } from "util";
|
|
5949
|
+
|
|
5950
|
+
// src/commands/sessions/web/findSynthesisForBranch.ts
|
|
5951
|
+
import { existsSync as existsSync24, readdirSync, statSync as statSync2 } from "fs";
|
|
5952
|
+
import { basename as basename2, dirname as dirname18, join as join21 } from "path";
|
|
5953
|
+
function findSynthesisForBranch(repoReviewsDir, branch) {
|
|
5954
|
+
const branchKeyPath = join21(repoReviewsDir, `${branch}-`);
|
|
5955
|
+
const parent = dirname18(branchKeyPath);
|
|
5956
|
+
const branchPrefix = basename2(branchKeyPath);
|
|
5957
|
+
if (!existsSync24(parent)) return null;
|
|
5958
|
+
const synthesisFiles = readdirSync(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join21(parent, name, "synthesis.md")).filter((path57) => existsSync24(path57)).map((path57) => ({ path: path57, mtime: statSync2(path57).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
|
|
5959
|
+
return synthesisFiles[0]?.path ?? null;
|
|
5960
|
+
}
|
|
5961
|
+
|
|
5962
|
+
// src/commands/sessions/web/getCwdParam.ts
|
|
5963
|
+
function getCwdParam(req, res) {
|
|
5964
|
+
const url = new URL(req.url ?? "/", "http://localhost");
|
|
5965
|
+
const cwd = url.searchParams.get("cwd");
|
|
5966
|
+
if (!cwd) {
|
|
5967
|
+
respondJson(res, 400, { error: "Missing cwd" });
|
|
5968
|
+
return null;
|
|
5969
|
+
}
|
|
5970
|
+
return cwd;
|
|
5971
|
+
}
|
|
5972
|
+
|
|
5973
|
+
// src/commands/sessions/web/windowsCwdToWslPath.ts
|
|
5974
|
+
function windowsCwdToWslPath(cwd) {
|
|
5975
|
+
const match = /^([A-Za-z]):[\\/](.*)$/.exec(cwd);
|
|
5976
|
+
if (!match) return cwd;
|
|
5977
|
+
const drive = match[1].toLowerCase();
|
|
5978
|
+
const rest = match[2].replace(/\\/g, "/");
|
|
5979
|
+
return `/mnt/${drive}/${rest}`;
|
|
5980
|
+
}
|
|
5981
|
+
|
|
5982
|
+
// src/commands/sessions/web/getReviewSynthesis.ts
|
|
5983
|
+
var execFileAsync = promisify(execFile);
|
|
5984
|
+
function runGit(cwd, args) {
|
|
5985
|
+
return execFileAsync("git", args, {
|
|
5986
|
+
encoding: "utf8",
|
|
5987
|
+
cwd: windowsCwdToWslPath(cwd)
|
|
5988
|
+
}).then((r) => r.stdout.trim());
|
|
5989
|
+
}
|
|
5990
|
+
async function resolveSynthesisPath(cwd) {
|
|
5991
|
+
const [repoRoot, branch] = await Promise.all([
|
|
5992
|
+
runGit(cwd, ["rev-parse", "--show-toplevel"]),
|
|
5993
|
+
runGit(cwd, ["rev-parse", "--abbrev-ref", "HEAD"])
|
|
5994
|
+
]);
|
|
5995
|
+
const repoReviewsDir = join22(
|
|
5996
|
+
homedir9(),
|
|
5997
|
+
".assist",
|
|
5998
|
+
"reviews",
|
|
5999
|
+
basename3(repoRoot)
|
|
6000
|
+
);
|
|
6001
|
+
return findSynthesisForBranch(repoReviewsDir, branch);
|
|
6002
|
+
}
|
|
6003
|
+
async function getReviewSynthesis(req, res) {
|
|
6004
|
+
const cwd = getCwdParam(req, res);
|
|
6005
|
+
if (!cwd) return;
|
|
6006
|
+
try {
|
|
6007
|
+
const path57 = await resolveSynthesisPath(cwd);
|
|
6008
|
+
if (!path57) {
|
|
6009
|
+
respondJson(res, 404, { error: "No synthesis found" });
|
|
6010
|
+
return;
|
|
6011
|
+
}
|
|
6012
|
+
respondJson(res, 200, { synthesis: readFileSync17(path57, "utf8") });
|
|
6013
|
+
} catch {
|
|
6014
|
+
respondJson(res, 404, { error: "No synthesis found" });
|
|
6015
|
+
}
|
|
6016
|
+
}
|
|
6017
|
+
|
|
5943
6018
|
// src/commands/prs/getPreferredRemoteRepo.ts
|
|
5944
6019
|
import { execSync as execSync21 } from "child_process";
|
|
5945
6020
|
var GITHUB_URL_PATTERN = /(?:git@github\.com:|https:\/\/github\.com\/)([^/]+)\/([^/]+?)(?:\.git)?\/?$/;
|
|
@@ -6001,26 +6076,6 @@ function getPreferredRemoteRepo(cwd) {
|
|
|
6001
6076
|
return null;
|
|
6002
6077
|
}
|
|
6003
6078
|
|
|
6004
|
-
// src/commands/sessions/web/getCwdParam.ts
|
|
6005
|
-
function getCwdParam(req, res) {
|
|
6006
|
-
const url = new URL(req.url ?? "/", "http://localhost");
|
|
6007
|
-
const cwd = url.searchParams.get("cwd");
|
|
6008
|
-
if (!cwd) {
|
|
6009
|
-
respondJson(res, 400, { error: "Missing cwd" });
|
|
6010
|
-
return null;
|
|
6011
|
-
}
|
|
6012
|
-
return cwd;
|
|
6013
|
-
}
|
|
6014
|
-
|
|
6015
|
-
// src/commands/sessions/web/windowsCwdToWslPath.ts
|
|
6016
|
-
function windowsCwdToWslPath(cwd) {
|
|
6017
|
-
const match = /^([A-Za-z]):[\\/](.*)$/.exec(cwd);
|
|
6018
|
-
if (!match) return cwd;
|
|
6019
|
-
const drive = match[1].toLowerCase();
|
|
6020
|
-
const rest = match[2].replace(/\\/g, "/");
|
|
6021
|
-
return `/mnt/${drive}/${rest}`;
|
|
6022
|
-
}
|
|
6023
|
-
|
|
6024
6079
|
// src/commands/sessions/web/githubUrl.ts
|
|
6025
6080
|
function githubUrl(req, res) {
|
|
6026
6081
|
const cwd = getCwdParam(req, res);
|
|
@@ -6032,8 +6087,8 @@ function githubUrl(req, res) {
|
|
|
6032
6087
|
}
|
|
6033
6088
|
|
|
6034
6089
|
// src/commands/sessions/web/gitStatus.ts
|
|
6035
|
-
import { execFile } from "child_process";
|
|
6036
|
-
import { promisify } from "util";
|
|
6090
|
+
import { execFile as execFile2 } from "child_process";
|
|
6091
|
+
import { promisify as promisify2 } from "util";
|
|
6037
6092
|
|
|
6038
6093
|
// src/commands/sessions/web/parseGitStatus.ts
|
|
6039
6094
|
function extractPath(rest) {
|
|
@@ -6063,7 +6118,7 @@ function parseGitStatus(output) {
|
|
|
6063
6118
|
}
|
|
6064
6119
|
|
|
6065
6120
|
// src/commands/sessions/web/gitStatus.ts
|
|
6066
|
-
var
|
|
6121
|
+
var execFileAsync2 = promisify2(execFile2);
|
|
6067
6122
|
async function gitStatus(req, res) {
|
|
6068
6123
|
const cwd = getCwdParam(req, res);
|
|
6069
6124
|
if (!cwd) return;
|
|
@@ -6076,7 +6131,7 @@ async function gitStatus(req, res) {
|
|
|
6076
6131
|
function runGitStatus(cwd) {
|
|
6077
6132
|
const args = ["status", "--porcelain"];
|
|
6078
6133
|
const { file, argv } = /^[A-Za-z]:[\\/]/.test(cwd) ? { file: "git.exe", argv: ["-C", cwd, ...args] } : { file: "git", argv: args };
|
|
6079
|
-
return
|
|
6134
|
+
return execFileAsync2(file, argv, {
|
|
6080
6135
|
encoding: "utf8",
|
|
6081
6136
|
...file === "git" ? { cwd } : {}
|
|
6082
6137
|
}).then((r) => r.stdout);
|
|
@@ -6240,8 +6295,8 @@ async function listUsageHistory(req, res) {
|
|
|
6240
6295
|
|
|
6241
6296
|
// src/commands/sessions/web/openInCode.ts
|
|
6242
6297
|
import { exec } from "child_process";
|
|
6243
|
-
import { promisify as
|
|
6244
|
-
var execAsync =
|
|
6298
|
+
import { promisify as promisify3 } from "util";
|
|
6299
|
+
var execAsync = promisify3(exec);
|
|
6245
6300
|
async function openInCode(req, res) {
|
|
6246
6301
|
const cwd = getCwdParam(req, res);
|
|
6247
6302
|
if (!cwd) return;
|
|
@@ -6257,9 +6312,9 @@ async function openInCode(req, res) {
|
|
|
6257
6312
|
}
|
|
6258
6313
|
|
|
6259
6314
|
// src/commands/sessions/web/createCachedGhJson.ts
|
|
6260
|
-
import { execFile as
|
|
6261
|
-
import { promisify as
|
|
6262
|
-
var
|
|
6315
|
+
import { execFile as execFile3 } from "child_process";
|
|
6316
|
+
import { promisify as promisify4 } from "util";
|
|
6317
|
+
var execFileAsync3 = promisify4(execFile3);
|
|
6263
6318
|
var CACHE_TTL_MS = 3e4;
|
|
6264
6319
|
function createCachedGhJson(args, parse3, fallback) {
|
|
6265
6320
|
const cache = /* @__PURE__ */ new Map();
|
|
@@ -6269,7 +6324,7 @@ function createCachedGhJson(args, parse3, fallback) {
|
|
|
6269
6324
|
if (cached && cached.expires > now) return cached.value;
|
|
6270
6325
|
let value = fallback;
|
|
6271
6326
|
try {
|
|
6272
|
-
const { stdout } = await
|
|
6327
|
+
const { stdout } = await execFileAsync3("gh", args, {
|
|
6273
6328
|
encoding: "utf8",
|
|
6274
6329
|
cwd: windowsCwdToWslPath(cwd)
|
|
6275
6330
|
});
|
|
@@ -6435,7 +6490,7 @@ function createCssHandler(packageEntry) {
|
|
|
6435
6490
|
return (req, res) => {
|
|
6436
6491
|
if (!cache) {
|
|
6437
6492
|
const resolved = require3.resolve(packageEntry);
|
|
6438
|
-
const body =
|
|
6493
|
+
const body = readFileSync18(resolved, "utf8");
|
|
6439
6494
|
const etag = `"${createHash2("sha256").update(body).digest("hex").slice(0, 16)}"`;
|
|
6440
6495
|
cache = { body, etag };
|
|
6441
6496
|
}
|
|
@@ -6468,7 +6523,8 @@ var routes2 = {
|
|
|
6468
6523
|
"GET /api/pr-list": prList,
|
|
6469
6524
|
"GET /api/news/items": listNewsItems,
|
|
6470
6525
|
"GET /api/usage/history": listUsageHistory,
|
|
6471
|
-
"GET /api/backups/list": getBackups
|
|
6526
|
+
"GET /api/backups/list": getBackups,
|
|
6527
|
+
"GET /api/review/synthesis": getReviewSynthesis
|
|
6472
6528
|
};
|
|
6473
6529
|
var handleRequest = createFallbackHandler(
|
|
6474
6530
|
routes2,
|
|
@@ -7245,9 +7301,9 @@ async function insertPhaseAt(orm, itemId, phaseIdx, name, tasks, manualChecks, c
|
|
|
7245
7301
|
|
|
7246
7302
|
// src/commands/backlog/add/shared.ts
|
|
7247
7303
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
7248
|
-
import { mkdtempSync, readFileSync as
|
|
7304
|
+
import { mkdtempSync, readFileSync as readFileSync19, unlinkSync as unlinkSync6, writeFileSync as writeFileSync19 } from "fs";
|
|
7249
7305
|
import { tmpdir } from "os";
|
|
7250
|
-
import { join as
|
|
7306
|
+
import { join as join23 } from "path";
|
|
7251
7307
|
import enquirer6 from "enquirer";
|
|
7252
7308
|
async function promptType() {
|
|
7253
7309
|
const { type } = await enquirer6.prompt({
|
|
@@ -7287,15 +7343,15 @@ async function promptDescription() {
|
|
|
7287
7343
|
}
|
|
7288
7344
|
function openEditor() {
|
|
7289
7345
|
const editor = process.env.EDITOR || process.env.VISUAL || "vi";
|
|
7290
|
-
const dir = mkdtempSync(
|
|
7291
|
-
const filePath =
|
|
7346
|
+
const dir = mkdtempSync(join23(tmpdir(), "assist-"));
|
|
7347
|
+
const filePath = join23(dir, "description.md");
|
|
7292
7348
|
writeFileSync19(filePath, "");
|
|
7293
7349
|
const result = spawnSync2(editor, [filePath], { stdio: "inherit" });
|
|
7294
7350
|
if (result.status !== 0) {
|
|
7295
7351
|
unlinkSync6(filePath);
|
|
7296
7352
|
return void 0;
|
|
7297
7353
|
}
|
|
7298
|
-
const content =
|
|
7354
|
+
const content = readFileSync19(filePath, "utf8").trim();
|
|
7299
7355
|
unlinkSync6(filePath);
|
|
7300
7356
|
return content || void 0;
|
|
7301
7357
|
}
|
|
@@ -8444,7 +8500,7 @@ function registerBacklog(program2) {
|
|
|
8444
8500
|
}
|
|
8445
8501
|
|
|
8446
8502
|
// src/commands/cliHook/index.ts
|
|
8447
|
-
import { basename as
|
|
8503
|
+
import { basename as basename4 } from "path";
|
|
8448
8504
|
|
|
8449
8505
|
// src/shared/splitCompound.ts
|
|
8450
8506
|
import { parse } from "shell-quote";
|
|
@@ -8614,12 +8670,12 @@ function findBuiltinDenyRaw(rawCommand) {
|
|
|
8614
8670
|
|
|
8615
8671
|
// src/commands/cliHook/logDeniedToolCall.ts
|
|
8616
8672
|
import { mkdirSync as mkdirSync10 } from "fs";
|
|
8617
|
-
import { homedir as
|
|
8618
|
-
import { join as
|
|
8673
|
+
import { homedir as homedir10 } from "os";
|
|
8674
|
+
import { join as join24 } from "path";
|
|
8619
8675
|
import Database from "better-sqlite3";
|
|
8620
8676
|
var _db;
|
|
8621
8677
|
function getDbDir() {
|
|
8622
|
-
return
|
|
8678
|
+
return join24(homedir10(), ".assist");
|
|
8623
8679
|
}
|
|
8624
8680
|
function initSchema2(db) {
|
|
8625
8681
|
db.exec(`
|
|
@@ -8638,7 +8694,7 @@ function openPromptsDb(dir) {
|
|
|
8638
8694
|
if (_db) return _db;
|
|
8639
8695
|
const dbDir = dir ?? getDbDir();
|
|
8640
8696
|
mkdirSync10(dbDir, { recursive: true });
|
|
8641
|
-
const db = new Database(
|
|
8697
|
+
const db = new Database(join24(dbDir, "assist.db"));
|
|
8642
8698
|
db.pragma("journal_mode = WAL");
|
|
8643
8699
|
initSchema2(db);
|
|
8644
8700
|
_db = db;
|
|
@@ -8740,17 +8796,17 @@ function extractGraphqlQuery(args) {
|
|
|
8740
8796
|
}
|
|
8741
8797
|
|
|
8742
8798
|
// src/shared/loadCliReads.ts
|
|
8743
|
-
import { existsSync as
|
|
8744
|
-
import { dirname as
|
|
8799
|
+
import { existsSync as existsSync25, readFileSync as readFileSync20, writeFileSync as writeFileSync20 } from "fs";
|
|
8800
|
+
import { dirname as dirname19, resolve as resolve8 } from "path";
|
|
8745
8801
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
8746
8802
|
var __filename3 = fileURLToPath4(import.meta.url);
|
|
8747
|
-
var __dirname4 =
|
|
8803
|
+
var __dirname4 = dirname19(__filename3);
|
|
8748
8804
|
function packageRoot() {
|
|
8749
8805
|
return __dirname4;
|
|
8750
8806
|
}
|
|
8751
8807
|
function readLines(path57) {
|
|
8752
|
-
if (!
|
|
8753
|
-
return
|
|
8808
|
+
if (!existsSync25(path57)) return [];
|
|
8809
|
+
return readFileSync20(path57, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
8754
8810
|
}
|
|
8755
8811
|
var cachedReads;
|
|
8756
8812
|
var cachedWrites;
|
|
@@ -8796,14 +8852,14 @@ function findCliWrite(command) {
|
|
|
8796
8852
|
}
|
|
8797
8853
|
|
|
8798
8854
|
// src/shared/readSettingsPerms.ts
|
|
8799
|
-
import { existsSync as
|
|
8800
|
-
import { homedir as
|
|
8801
|
-
import { join as
|
|
8855
|
+
import { existsSync as existsSync26, readFileSync as readFileSync21 } from "fs";
|
|
8856
|
+
import { homedir as homedir11 } from "os";
|
|
8857
|
+
import { join as join25 } from "path";
|
|
8802
8858
|
function readSettingsPerms(key) {
|
|
8803
8859
|
const paths = [
|
|
8804
|
-
|
|
8805
|
-
|
|
8806
|
-
|
|
8860
|
+
join25(homedir11(), ".claude", "settings.json"),
|
|
8861
|
+
join25(process.cwd(), ".claude", "settings.json"),
|
|
8862
|
+
join25(process.cwd(), ".claude", "settings.local.json")
|
|
8807
8863
|
];
|
|
8808
8864
|
const entries = [];
|
|
8809
8865
|
for (const p of paths) {
|
|
@@ -8812,9 +8868,9 @@ function readSettingsPerms(key) {
|
|
|
8812
8868
|
return entries;
|
|
8813
8869
|
}
|
|
8814
8870
|
function readPermissionArray(filePath, key) {
|
|
8815
|
-
if (!
|
|
8871
|
+
if (!existsSync26(filePath)) return [];
|
|
8816
8872
|
try {
|
|
8817
|
-
const data = JSON.parse(
|
|
8873
|
+
const data = JSON.parse(readFileSync21(filePath, "utf8"));
|
|
8818
8874
|
const arr = data?.permissions?.[key];
|
|
8819
8875
|
return Array.isArray(arr) ? arr.filter((e) => typeof e === "string") : [];
|
|
8820
8876
|
} catch {
|
|
@@ -9030,7 +9086,7 @@ async function cliHook() {
|
|
|
9030
9086
|
logDeniedToolCall({
|
|
9031
9087
|
tool: input.toolName,
|
|
9032
9088
|
command: input.command,
|
|
9033
|
-
repo:
|
|
9089
|
+
repo: basename4(process.cwd()),
|
|
9034
9090
|
sessionId: process.env.CLAUDE_SESSION_ID,
|
|
9035
9091
|
denyReason: decision.permissionDecisionReason
|
|
9036
9092
|
});
|
|
@@ -9076,9 +9132,9 @@ ${reasons.join("\n")}`);
|
|
|
9076
9132
|
}
|
|
9077
9133
|
|
|
9078
9134
|
// src/commands/permitCliReads/index.ts
|
|
9079
|
-
import { existsSync as
|
|
9080
|
-
import { homedir as
|
|
9081
|
-
import { join as
|
|
9135
|
+
import { existsSync as existsSync27, mkdirSync as mkdirSync11, readFileSync as readFileSync22, writeFileSync as writeFileSync21 } from "fs";
|
|
9136
|
+
import { homedir as homedir12 } from "os";
|
|
9137
|
+
import { join as join26 } from "path";
|
|
9082
9138
|
|
|
9083
9139
|
// src/shared/checkCliAvailable.ts
|
|
9084
9140
|
import { execSync as execSync23 } from "child_process";
|
|
@@ -9367,15 +9423,15 @@ function updateSettings(cli, commands) {
|
|
|
9367
9423
|
// src/commands/permitCliReads/index.ts
|
|
9368
9424
|
function logPath(cli) {
|
|
9369
9425
|
const safeName = cli.replace(/\s+/g, "-");
|
|
9370
|
-
return
|
|
9426
|
+
return join26(homedir12(), ".assist", `cli-discover-${safeName}.log`);
|
|
9371
9427
|
}
|
|
9372
9428
|
function readCache(cli) {
|
|
9373
9429
|
const path57 = logPath(cli);
|
|
9374
|
-
if (!
|
|
9375
|
-
return
|
|
9430
|
+
if (!existsSync27(path57)) return void 0;
|
|
9431
|
+
return readFileSync22(path57, "utf8");
|
|
9376
9432
|
}
|
|
9377
9433
|
function writeCache(cli, output) {
|
|
9378
|
-
const dir =
|
|
9434
|
+
const dir = join26(homedir12(), ".assist");
|
|
9379
9435
|
mkdirSync11(dir, { recursive: true });
|
|
9380
9436
|
writeFileSync21(logPath(cli), output);
|
|
9381
9437
|
}
|
|
@@ -9504,35 +9560,35 @@ function registerCliHook(program2) {
|
|
|
9504
9560
|
}
|
|
9505
9561
|
|
|
9506
9562
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
9507
|
-
import { existsSync as
|
|
9563
|
+
import { existsSync as existsSync28, readFileSync as readFileSync23, unlinkSync as unlinkSync8, writeFileSync as writeFileSync22 } from "fs";
|
|
9508
9564
|
import chalk94 from "chalk";
|
|
9509
9565
|
|
|
9510
9566
|
// src/commands/codeComment/getRestrictedDir.ts
|
|
9511
|
-
import { homedir as
|
|
9512
|
-
import { join as
|
|
9567
|
+
import { homedir as homedir13 } from "os";
|
|
9568
|
+
import { join as join27 } from "path";
|
|
9513
9569
|
function getRestrictedDir() {
|
|
9514
|
-
return
|
|
9570
|
+
return join27(homedir13(), ".assist", "restricted");
|
|
9515
9571
|
}
|
|
9516
9572
|
function getPinStatePath(pin) {
|
|
9517
|
-
return
|
|
9573
|
+
return join27(getRestrictedDir(), `code-comment-${pin}.json`);
|
|
9518
9574
|
}
|
|
9519
9575
|
|
|
9520
9576
|
// src/commands/codeComment/sweepRestrictedDir.ts
|
|
9521
|
-
import { readdirSync, statSync as
|
|
9522
|
-
import { join as
|
|
9577
|
+
import { readdirSync as readdirSync2, statSync as statSync3, unlinkSync as unlinkSync7 } from "fs";
|
|
9578
|
+
import { join as join28 } from "path";
|
|
9523
9579
|
var STALE_AFTER_MS = 30 * 60 * 1e3;
|
|
9524
9580
|
function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
9525
9581
|
let entries;
|
|
9526
9582
|
try {
|
|
9527
|
-
entries =
|
|
9583
|
+
entries = readdirSync2(dir);
|
|
9528
9584
|
} catch {
|
|
9529
9585
|
return;
|
|
9530
9586
|
}
|
|
9531
9587
|
const cutoff = Date.now() - STALE_AFTER_MS;
|
|
9532
9588
|
for (const entry of entries) {
|
|
9533
|
-
const path57 =
|
|
9589
|
+
const path57 = join28(dir, entry);
|
|
9534
9590
|
try {
|
|
9535
|
-
if (
|
|
9591
|
+
if (statSync3(path57).mtimeMs < cutoff) unlinkSync7(path57);
|
|
9536
9592
|
} catch {
|
|
9537
9593
|
continue;
|
|
9538
9594
|
}
|
|
@@ -9542,9 +9598,9 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
9542
9598
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
9543
9599
|
function readPinState(pin) {
|
|
9544
9600
|
const path57 = getPinStatePath(pin);
|
|
9545
|
-
if (!
|
|
9601
|
+
if (!existsSync28(path57)) return void 0;
|
|
9546
9602
|
try {
|
|
9547
|
-
const state = JSON.parse(
|
|
9603
|
+
const state = JSON.parse(readFileSync23(path57, "utf8"));
|
|
9548
9604
|
if (state.pin !== pin) return void 0;
|
|
9549
9605
|
return state;
|
|
9550
9606
|
} catch {
|
|
@@ -9559,12 +9615,12 @@ function codeCommentConfirm(pin) {
|
|
|
9559
9615
|
process.exitCode = 1;
|
|
9560
9616
|
return;
|
|
9561
9617
|
}
|
|
9562
|
-
if (!
|
|
9618
|
+
if (!existsSync28(state.file)) {
|
|
9563
9619
|
console.error(chalk94.red(`Target file no longer exists: ${state.file}`));
|
|
9564
9620
|
process.exitCode = 1;
|
|
9565
9621
|
return;
|
|
9566
9622
|
}
|
|
9567
|
-
const original =
|
|
9623
|
+
const original = readFileSync23(state.file, "utf8");
|
|
9568
9624
|
const lines = original.split("\n");
|
|
9569
9625
|
const index3 = state.line - 1;
|
|
9570
9626
|
if (index3 > lines.length) {
|
|
@@ -10410,7 +10466,7 @@ function registerConfig(program2) {
|
|
|
10410
10466
|
}
|
|
10411
10467
|
|
|
10412
10468
|
// src/commands/deploy/redirect.ts
|
|
10413
|
-
import { existsSync as
|
|
10469
|
+
import { existsSync as existsSync29, readFileSync as readFileSync24, writeFileSync as writeFileSync24 } from "fs";
|
|
10414
10470
|
import chalk107 from "chalk";
|
|
10415
10471
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
10416
10472
|
if (!window.location.pathname.endsWith('/')) {
|
|
@@ -10419,11 +10475,11 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
10419
10475
|
</script>`;
|
|
10420
10476
|
function redirect() {
|
|
10421
10477
|
const indexPath = "index.html";
|
|
10422
|
-
if (!
|
|
10478
|
+
if (!existsSync29(indexPath)) {
|
|
10423
10479
|
console.log(chalk107.yellow("No index.html found"));
|
|
10424
10480
|
return;
|
|
10425
10481
|
}
|
|
10426
|
-
const content =
|
|
10482
|
+
const content = readFileSync24(indexPath, "utf8");
|
|
10427
10483
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
10428
10484
|
console.log(chalk107.dim("Trailing slash script already present"));
|
|
10429
10485
|
return;
|
|
@@ -10448,14 +10504,14 @@ function registerDeploy(program2) {
|
|
|
10448
10504
|
|
|
10449
10505
|
// src/commands/devlog/list/index.ts
|
|
10450
10506
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
10451
|
-
import { basename as
|
|
10507
|
+
import { basename as basename6 } from "path";
|
|
10452
10508
|
|
|
10453
10509
|
// src/commands/devlog/loadBlogSkipDays.ts
|
|
10454
|
-
import { homedir as
|
|
10455
|
-
import { join as
|
|
10456
|
-
var BLOG_REPO_ROOT =
|
|
10510
|
+
import { homedir as homedir14 } from "os";
|
|
10511
|
+
import { join as join29 } from "path";
|
|
10512
|
+
var BLOG_REPO_ROOT = join29(homedir14(), "git/blog");
|
|
10457
10513
|
function loadBlogSkipDays(repoName) {
|
|
10458
|
-
const config = loadRawYaml(
|
|
10514
|
+
const config = loadRawYaml(join29(BLOG_REPO_ROOT, "assist.yml"));
|
|
10459
10515
|
const devlog = config.devlog;
|
|
10460
10516
|
const skip2 = devlog?.skip;
|
|
10461
10517
|
return new Set(skip2?.[repoName]);
|
|
@@ -10466,17 +10522,17 @@ import { execSync as execSync24 } from "child_process";
|
|
|
10466
10522
|
import chalk108 from "chalk";
|
|
10467
10523
|
|
|
10468
10524
|
// src/shared/getRepoName.ts
|
|
10469
|
-
import { existsSync as
|
|
10470
|
-
import { basename as
|
|
10525
|
+
import { existsSync as existsSync30, readFileSync as readFileSync25 } from "fs";
|
|
10526
|
+
import { basename as basename5, join as join30 } from "path";
|
|
10471
10527
|
function getRepoName() {
|
|
10472
10528
|
const config = loadConfig();
|
|
10473
10529
|
if (config.devlog?.name) {
|
|
10474
10530
|
return config.devlog.name;
|
|
10475
10531
|
}
|
|
10476
|
-
const packageJsonPath =
|
|
10477
|
-
if (
|
|
10532
|
+
const packageJsonPath = join30(process.cwd(), "package.json");
|
|
10533
|
+
if (existsSync30(packageJsonPath)) {
|
|
10478
10534
|
try {
|
|
10479
|
-
const content =
|
|
10535
|
+
const content = readFileSync25(packageJsonPath, "utf8");
|
|
10480
10536
|
const pkg = JSON.parse(content);
|
|
10481
10537
|
if (pkg.name) {
|
|
10482
10538
|
return pkg.name;
|
|
@@ -10484,13 +10540,13 @@ function getRepoName() {
|
|
|
10484
10540
|
} catch {
|
|
10485
10541
|
}
|
|
10486
10542
|
}
|
|
10487
|
-
return
|
|
10543
|
+
return basename5(process.cwd());
|
|
10488
10544
|
}
|
|
10489
10545
|
|
|
10490
10546
|
// src/commands/devlog/loadDevlogEntries.ts
|
|
10491
|
-
import { readdirSync as
|
|
10492
|
-
import { join as
|
|
10493
|
-
var DEVLOG_DIR =
|
|
10547
|
+
import { readdirSync as readdirSync3, readFileSync as readFileSync26 } from "fs";
|
|
10548
|
+
import { join as join31 } from "path";
|
|
10549
|
+
var DEVLOG_DIR = join31(BLOG_REPO_ROOT, "src/content/devlog");
|
|
10494
10550
|
function extractFrontmatter(content) {
|
|
10495
10551
|
const fm = content.match(/^---\n([\s\S]*?)\n---/);
|
|
10496
10552
|
return fm?.[1] ?? null;
|
|
@@ -10516,9 +10572,9 @@ function parseFrontmatter(content, filename) {
|
|
|
10516
10572
|
}
|
|
10517
10573
|
function readDevlogFiles(callback) {
|
|
10518
10574
|
try {
|
|
10519
|
-
const files =
|
|
10575
|
+
const files = readdirSync3(DEVLOG_DIR).filter((f) => f.endsWith(".md"));
|
|
10520
10576
|
for (const file of files) {
|
|
10521
|
-
const content =
|
|
10577
|
+
const content = readFileSync26(join31(DEVLOG_DIR, file), "utf8");
|
|
10522
10578
|
const parsed = parseFrontmatter(content, file);
|
|
10523
10579
|
if (parsed) callback(parsed);
|
|
10524
10580
|
}
|
|
@@ -10620,7 +10676,7 @@ function list3(options2) {
|
|
|
10620
10676
|
const config = loadConfig();
|
|
10621
10677
|
const days = options2.days ?? 30;
|
|
10622
10678
|
const ignore2 = options2.ignore ?? config.devlog?.ignore ?? [];
|
|
10623
|
-
const repoName =
|
|
10679
|
+
const repoName = basename6(process.cwd());
|
|
10624
10680
|
const skipDays = loadBlogSkipDays(repoName);
|
|
10625
10681
|
const devlogEntries = loadDevlogEntries(repoName);
|
|
10626
10682
|
const args = ["log"];
|
|
@@ -10906,11 +10962,11 @@ function repos(options2) {
|
|
|
10906
10962
|
|
|
10907
10963
|
// src/commands/devlog/skip.ts
|
|
10908
10964
|
import { writeFileSync as writeFileSync25 } from "fs";
|
|
10909
|
-
import { join as
|
|
10965
|
+
import { join as join32 } from "path";
|
|
10910
10966
|
import chalk113 from "chalk";
|
|
10911
10967
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
10912
10968
|
function getBlogConfigPath() {
|
|
10913
|
-
return
|
|
10969
|
+
return join32(BLOG_REPO_ROOT, "assist.yml");
|
|
10914
10970
|
}
|
|
10915
10971
|
function skip(date) {
|
|
10916
10972
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
@@ -10970,17 +11026,17 @@ function registerDevlog(program2) {
|
|
|
10970
11026
|
}
|
|
10971
11027
|
|
|
10972
11028
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
10973
|
-
import { closeSync as closeSync2, openSync as openSync2, readdirSync as
|
|
10974
|
-
import { join as
|
|
11029
|
+
import { closeSync as closeSync2, openSync as openSync2, readdirSync as readdirSync4 } from "fs";
|
|
11030
|
+
import { join as join33 } from "path";
|
|
10975
11031
|
import chalk115 from "chalk";
|
|
10976
11032
|
|
|
10977
11033
|
// src/shared/findRepoRoot.ts
|
|
10978
|
-
import { existsSync as
|
|
11034
|
+
import { existsSync as existsSync31 } from "fs";
|
|
10979
11035
|
import path22 from "path";
|
|
10980
11036
|
function findRepoRoot(dir) {
|
|
10981
11037
|
let current = dir;
|
|
10982
11038
|
while (current !== path22.dirname(current)) {
|
|
10983
|
-
if (
|
|
11039
|
+
if (existsSync31(path22.join(current, ".git"))) {
|
|
10984
11040
|
return current;
|
|
10985
11041
|
}
|
|
10986
11042
|
current = path22.dirname(current);
|
|
@@ -10993,13 +11049,13 @@ var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "packages"]);
|
|
|
10993
11049
|
function isLockedDll(debugDir) {
|
|
10994
11050
|
let files;
|
|
10995
11051
|
try {
|
|
10996
|
-
files =
|
|
11052
|
+
files = readdirSync4(debugDir, { recursive: true });
|
|
10997
11053
|
} catch {
|
|
10998
11054
|
return null;
|
|
10999
11055
|
}
|
|
11000
11056
|
for (const file of files) {
|
|
11001
11057
|
if (!file.toLowerCase().endsWith(".dll")) continue;
|
|
11002
|
-
const dllPath =
|
|
11058
|
+
const dllPath = join33(debugDir, file);
|
|
11003
11059
|
try {
|
|
11004
11060
|
const fd = openSync2(dllPath, "r+");
|
|
11005
11061
|
closeSync2(fd);
|
|
@@ -11012,18 +11068,18 @@ function isLockedDll(debugDir) {
|
|
|
11012
11068
|
function findFirstLockedDll(dir) {
|
|
11013
11069
|
let entries;
|
|
11014
11070
|
try {
|
|
11015
|
-
entries =
|
|
11071
|
+
entries = readdirSync4(dir);
|
|
11016
11072
|
} catch {
|
|
11017
11073
|
return null;
|
|
11018
11074
|
}
|
|
11019
11075
|
if (entries.includes("bin")) {
|
|
11020
|
-
const locked = isLockedDll(
|
|
11076
|
+
const locked = isLockedDll(join33(dir, "bin", "Debug"));
|
|
11021
11077
|
if (locked) return locked;
|
|
11022
11078
|
}
|
|
11023
11079
|
for (const entry of entries) {
|
|
11024
11080
|
if (SKIP_DIRS.has(entry) || entry === "bin" || entry.startsWith("."))
|
|
11025
11081
|
continue;
|
|
11026
|
-
const found = findFirstLockedDll(
|
|
11082
|
+
const found = findFirstLockedDll(join33(dir, entry));
|
|
11027
11083
|
if (found) return found;
|
|
11028
11084
|
}
|
|
11029
11085
|
return null;
|
|
@@ -11046,11 +11102,11 @@ async function checkBuildLocksCommand() {
|
|
|
11046
11102
|
}
|
|
11047
11103
|
|
|
11048
11104
|
// src/commands/dotnet/buildTree.ts
|
|
11049
|
-
import { readFileSync as
|
|
11105
|
+
import { readFileSync as readFileSync27 } from "fs";
|
|
11050
11106
|
import path23 from "path";
|
|
11051
11107
|
var PROJECT_REF_RE = /<ProjectReference\s+Include="([^"]+)"/g;
|
|
11052
11108
|
function getProjectRefs(csprojPath) {
|
|
11053
|
-
const content =
|
|
11109
|
+
const content = readFileSync27(csprojPath, "utf8");
|
|
11054
11110
|
const refs = [];
|
|
11055
11111
|
for (const match of content.matchAll(PROJECT_REF_RE)) {
|
|
11056
11112
|
refs.push(match[1].replace(/\\/g, "/"));
|
|
@@ -11067,7 +11123,7 @@ function buildTree(csprojPath, repoRoot, visited = /* @__PURE__ */ new Set()) {
|
|
|
11067
11123
|
for (const ref of getProjectRefs(abs)) {
|
|
11068
11124
|
const childAbs = path23.resolve(dir, ref);
|
|
11069
11125
|
try {
|
|
11070
|
-
|
|
11126
|
+
readFileSync27(childAbs);
|
|
11071
11127
|
node.children.push(buildTree(childAbs, repoRoot, visited));
|
|
11072
11128
|
} catch {
|
|
11073
11129
|
node.children.push({
|
|
@@ -11092,14 +11148,14 @@ function collectAllDeps(node) {
|
|
|
11092
11148
|
}
|
|
11093
11149
|
|
|
11094
11150
|
// src/commands/dotnet/findContainingSolutions.ts
|
|
11095
|
-
import { readdirSync as
|
|
11151
|
+
import { readdirSync as readdirSync5, readFileSync as readFileSync28, statSync as statSync4 } from "fs";
|
|
11096
11152
|
import path24 from "path";
|
|
11097
11153
|
function findSlnFiles(dir, maxDepth, depth = 0) {
|
|
11098
11154
|
if (depth > maxDepth) return [];
|
|
11099
11155
|
const results = [];
|
|
11100
11156
|
let entries;
|
|
11101
11157
|
try {
|
|
11102
|
-
entries =
|
|
11158
|
+
entries = readdirSync5(dir);
|
|
11103
11159
|
} catch {
|
|
11104
11160
|
return results;
|
|
11105
11161
|
}
|
|
@@ -11108,7 +11164,7 @@ function findSlnFiles(dir, maxDepth, depth = 0) {
|
|
|
11108
11164
|
continue;
|
|
11109
11165
|
const full = path24.join(dir, entry);
|
|
11110
11166
|
try {
|
|
11111
|
-
const stat2 =
|
|
11167
|
+
const stat2 = statSync4(full);
|
|
11112
11168
|
if (stat2.isFile() && entry.endsWith(".sln")) {
|
|
11113
11169
|
results.push(full);
|
|
11114
11170
|
} else if (stat2.isDirectory()) {
|
|
@@ -11127,7 +11183,7 @@ function findContainingSolutions(csprojPath, repoRoot) {
|
|
|
11127
11183
|
const pattern2 = new RegExp(`[\\\\"/]${escapeRegex(csprojBasename)}"`);
|
|
11128
11184
|
for (const sln of slnFiles) {
|
|
11129
11185
|
try {
|
|
11130
|
-
const content =
|
|
11186
|
+
const content = readFileSync28(sln, "utf8");
|
|
11131
11187
|
if (pattern2.test(content)) {
|
|
11132
11188
|
matches.push(path24.relative(repoRoot, sln));
|
|
11133
11189
|
}
|
|
@@ -11191,12 +11247,12 @@ function printJson(tree, totalCount, solutions) {
|
|
|
11191
11247
|
}
|
|
11192
11248
|
|
|
11193
11249
|
// src/commands/dotnet/resolveCsproj.ts
|
|
11194
|
-
import { existsSync as
|
|
11250
|
+
import { existsSync as existsSync32 } from "fs";
|
|
11195
11251
|
import path25 from "path";
|
|
11196
11252
|
import chalk117 from "chalk";
|
|
11197
11253
|
function resolveCsproj(csprojPath) {
|
|
11198
11254
|
const resolved = path25.resolve(csprojPath);
|
|
11199
|
-
if (!
|
|
11255
|
+
if (!existsSync32(resolved)) {
|
|
11200
11256
|
console.error(chalk117.red(`File not found: ${resolved}`));
|
|
11201
11257
|
process.exit(1);
|
|
11202
11258
|
}
|
|
@@ -11364,17 +11420,17 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
11364
11420
|
}
|
|
11365
11421
|
|
|
11366
11422
|
// src/commands/dotnet/resolveSolution.ts
|
|
11367
|
-
import { existsSync as
|
|
11423
|
+
import { existsSync as existsSync33 } from "fs";
|
|
11368
11424
|
import path26 from "path";
|
|
11369
11425
|
import chalk121 from "chalk";
|
|
11370
11426
|
|
|
11371
11427
|
// src/commands/dotnet/findSolution.ts
|
|
11372
|
-
import { readdirSync as
|
|
11373
|
-
import { dirname as
|
|
11428
|
+
import { readdirSync as readdirSync6 } from "fs";
|
|
11429
|
+
import { dirname as dirname20, join as join34 } from "path";
|
|
11374
11430
|
import chalk120 from "chalk";
|
|
11375
11431
|
function findSlnInDir(dir) {
|
|
11376
11432
|
try {
|
|
11377
|
-
return
|
|
11433
|
+
return readdirSync6(dir).filter((f) => f.endsWith(".sln")).map((f) => join34(dir, f));
|
|
11378
11434
|
} catch {
|
|
11379
11435
|
return [];
|
|
11380
11436
|
}
|
|
@@ -11395,7 +11451,7 @@ function findSolution() {
|
|
|
11395
11451
|
process.exit(1);
|
|
11396
11452
|
}
|
|
11397
11453
|
if (current === ceiling) break;
|
|
11398
|
-
current =
|
|
11454
|
+
current = dirname20(current);
|
|
11399
11455
|
}
|
|
11400
11456
|
console.error(chalk120.red("No .sln file found between cwd and repo root"));
|
|
11401
11457
|
process.exit(1);
|
|
@@ -11405,7 +11461,7 @@ function findSolution() {
|
|
|
11405
11461
|
function resolveSolution(sln) {
|
|
11406
11462
|
if (sln) {
|
|
11407
11463
|
const resolved = path26.resolve(sln);
|
|
11408
|
-
if (!
|
|
11464
|
+
if (!existsSync33(resolved)) {
|
|
11409
11465
|
console.error(chalk121.red(`Solution file not found: ${resolved}`));
|
|
11410
11466
|
process.exit(1);
|
|
11411
11467
|
}
|
|
@@ -11445,7 +11501,7 @@ function parseInspectReport(json) {
|
|
|
11445
11501
|
|
|
11446
11502
|
// src/commands/dotnet/runInspectCode.ts
|
|
11447
11503
|
import { execSync as execSync28 } from "child_process";
|
|
11448
|
-
import { existsSync as
|
|
11504
|
+
import { existsSync as existsSync34, readFileSync as readFileSync29, unlinkSync as unlinkSync9 } from "fs";
|
|
11449
11505
|
import { tmpdir as tmpdir3 } from "os";
|
|
11450
11506
|
import path27 from "path";
|
|
11451
11507
|
import chalk122 from "chalk";
|
|
@@ -11476,11 +11532,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
11476
11532
|
console.error(chalk122.red("jb inspectcode failed"));
|
|
11477
11533
|
process.exit(1);
|
|
11478
11534
|
}
|
|
11479
|
-
if (!
|
|
11535
|
+
if (!existsSync34(reportPath)) {
|
|
11480
11536
|
console.error(chalk122.red("Report file not generated"));
|
|
11481
11537
|
process.exit(1);
|
|
11482
11538
|
}
|
|
11483
|
-
const xml =
|
|
11539
|
+
const xml = readFileSync29(reportPath, "utf8");
|
|
11484
11540
|
unlinkSync9(reportPath);
|
|
11485
11541
|
return xml;
|
|
11486
11542
|
}
|
|
@@ -11783,7 +11839,7 @@ function aggregateCommitters(authorLists) {
|
|
|
11783
11839
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
11784
11840
|
import { unlinkSync as unlinkSync10, writeFileSync as writeFileSync26 } from "fs";
|
|
11785
11841
|
import { tmpdir as tmpdir4 } from "os";
|
|
11786
|
-
import { join as
|
|
11842
|
+
import { join as join35 } from "path";
|
|
11787
11843
|
function buildArgs2(queryFile, vars) {
|
|
11788
11844
|
const args = ["api", "graphql", "-F", `query=@${queryFile}`];
|
|
11789
11845
|
for (const [key, value] of Object.entries(vars)) {
|
|
@@ -11808,7 +11864,7 @@ function throwOnGraphqlErrors(stdout) {
|
|
|
11808
11864
|
throw new Error(messages || "GraphQL request returned errors");
|
|
11809
11865
|
}
|
|
11810
11866
|
function runGhGraphql(mutation, vars) {
|
|
11811
|
-
const queryFile =
|
|
11867
|
+
const queryFile = join35(tmpdir4(), `gh-query-${Date.now()}.graphql`);
|
|
11812
11868
|
writeFileSync26(queryFile, mutation);
|
|
11813
11869
|
try {
|
|
11814
11870
|
const result = spawnSync3("gh", buildArgs2(queryFile, vars), {
|
|
@@ -11995,24 +12051,24 @@ async function countPendingHandovers(orm, origin) {
|
|
|
11995
12051
|
|
|
11996
12052
|
// src/commands/handover/migrateDiskHandovers.ts
|
|
11997
12053
|
import {
|
|
11998
|
-
existsSync as
|
|
11999
|
-
readdirSync as
|
|
12000
|
-
readFileSync as
|
|
12054
|
+
existsSync as existsSync35,
|
|
12055
|
+
readdirSync as readdirSync7,
|
|
12056
|
+
readFileSync as readFileSync30,
|
|
12001
12057
|
rmSync as rmSync2,
|
|
12002
|
-
statSync as
|
|
12058
|
+
statSync as statSync5
|
|
12003
12059
|
} from "fs";
|
|
12004
|
-
import { basename as
|
|
12060
|
+
import { basename as basename7, join as join38 } from "path";
|
|
12005
12061
|
|
|
12006
12062
|
// src/commands/handover/getHandoverPath.ts
|
|
12007
|
-
import { join as
|
|
12063
|
+
import { join as join36 } from "path";
|
|
12008
12064
|
function getHandoverPath(cwd = process.cwd()) {
|
|
12009
|
-
return
|
|
12065
|
+
return join36(cwd, ".assist", "HANDOVER.md");
|
|
12010
12066
|
}
|
|
12011
12067
|
|
|
12012
12068
|
// src/commands/handover/getHandoversDir.ts
|
|
12013
|
-
import { join as
|
|
12069
|
+
import { join as join37 } from "path";
|
|
12014
12070
|
function getHandoversDir(cwd = process.cwd()) {
|
|
12015
|
-
return
|
|
12071
|
+
return join37(cwd, ".assist", "handovers");
|
|
12016
12072
|
}
|
|
12017
12073
|
|
|
12018
12074
|
// src/commands/handover/parseArchiveTimestamp.ts
|
|
@@ -12050,17 +12106,17 @@ function summariseHandoverContent(content) {
|
|
|
12050
12106
|
|
|
12051
12107
|
// src/commands/handover/migrateDiskHandovers.ts
|
|
12052
12108
|
function collectMarkdown(dir) {
|
|
12053
|
-
if (!
|
|
12109
|
+
if (!existsSync35(dir)) return [];
|
|
12054
12110
|
const out = [];
|
|
12055
|
-
for (const entry of
|
|
12056
|
-
const full =
|
|
12111
|
+
for (const entry of readdirSync7(dir, { withFileTypes: true })) {
|
|
12112
|
+
const full = join38(dir, entry.name);
|
|
12057
12113
|
if (entry.isDirectory()) out.push(...collectMarkdown(full));
|
|
12058
12114
|
else if (entry.isFile() && entry.name.endsWith(".md")) out.push(full);
|
|
12059
12115
|
}
|
|
12060
12116
|
return out;
|
|
12061
12117
|
}
|
|
12062
12118
|
async function migrateFile(orm, origin, file, createdAt) {
|
|
12063
|
-
const content =
|
|
12119
|
+
const content = readFileSync30(file, "utf8");
|
|
12064
12120
|
await saveHandover(orm, {
|
|
12065
12121
|
origin,
|
|
12066
12122
|
summary: summariseHandoverContent(content),
|
|
@@ -12072,13 +12128,13 @@ async function migrateFile(orm, origin, file, createdAt) {
|
|
|
12072
12128
|
async function migrateDiskHandovers(orm, origin, cwd = process.cwd()) {
|
|
12073
12129
|
let migrated = 0;
|
|
12074
12130
|
for (const file of collectMarkdown(getHandoversDir(cwd))) {
|
|
12075
|
-
const createdAt = parseArchiveTimestamp(
|
|
12131
|
+
const createdAt = parseArchiveTimestamp(basename7(file)) ?? statSync5(file).mtime;
|
|
12076
12132
|
await migrateFile(orm, origin, file, createdAt);
|
|
12077
12133
|
migrated++;
|
|
12078
12134
|
}
|
|
12079
12135
|
const handoverPath = getHandoverPath(cwd);
|
|
12080
|
-
if (
|
|
12081
|
-
await migrateFile(orm, origin, handoverPath,
|
|
12136
|
+
if (existsSync35(handoverPath)) {
|
|
12137
|
+
await migrateFile(orm, origin, handoverPath, statSync5(handoverPath).mtime);
|
|
12082
12138
|
migrated++;
|
|
12083
12139
|
}
|
|
12084
12140
|
return migrated;
|
|
@@ -12293,20 +12349,20 @@ function acceptanceCriteria(issueKey) {
|
|
|
12293
12349
|
import { execSync as execSync30 } from "child_process";
|
|
12294
12350
|
|
|
12295
12351
|
// src/shared/loadJson.ts
|
|
12296
|
-
import { existsSync as
|
|
12297
|
-
import { homedir as
|
|
12298
|
-
import { join as
|
|
12352
|
+
import { existsSync as existsSync36, mkdirSync as mkdirSync13, readFileSync as readFileSync31, writeFileSync as writeFileSync27 } from "fs";
|
|
12353
|
+
import { homedir as homedir15 } from "os";
|
|
12354
|
+
import { join as join39 } from "path";
|
|
12299
12355
|
function getStoreDir() {
|
|
12300
|
-
return
|
|
12356
|
+
return join39(homedir15(), ".assist");
|
|
12301
12357
|
}
|
|
12302
12358
|
function getStorePath(filename) {
|
|
12303
|
-
return
|
|
12359
|
+
return join39(getStoreDir(), filename);
|
|
12304
12360
|
}
|
|
12305
12361
|
function loadJson(filename) {
|
|
12306
12362
|
const path57 = getStorePath(filename);
|
|
12307
|
-
if (
|
|
12363
|
+
if (existsSync36(path57)) {
|
|
12308
12364
|
try {
|
|
12309
|
-
return JSON.parse(
|
|
12365
|
+
return JSON.parse(readFileSync31(path57, "utf8"));
|
|
12310
12366
|
} catch {
|
|
12311
12367
|
return {};
|
|
12312
12368
|
}
|
|
@@ -12315,7 +12371,7 @@ function loadJson(filename) {
|
|
|
12315
12371
|
}
|
|
12316
12372
|
function saveJson(filename, data) {
|
|
12317
12373
|
const dir = getStoreDir();
|
|
12318
|
-
if (!
|
|
12374
|
+
if (!existsSync36(dir)) {
|
|
12319
12375
|
mkdirSync13(dir, { recursive: true });
|
|
12320
12376
|
}
|
|
12321
12377
|
writeFileSync27(getStorePath(filename), JSON.stringify(data, null, 2));
|
|
@@ -12485,13 +12541,13 @@ function registerList(program2) {
|
|
|
12485
12541
|
}
|
|
12486
12542
|
|
|
12487
12543
|
// src/commands/mermaid/index.ts
|
|
12488
|
-
import { mkdirSync as mkdirSync14, readdirSync as
|
|
12544
|
+
import { mkdirSync as mkdirSync14, readdirSync as readdirSync8 } from "fs";
|
|
12489
12545
|
import { resolve as resolve11 } from "path";
|
|
12490
12546
|
import chalk132 from "chalk";
|
|
12491
12547
|
|
|
12492
12548
|
// src/commands/mermaid/exportFile.ts
|
|
12493
|
-
import { readFileSync as
|
|
12494
|
-
import { basename as
|
|
12549
|
+
import { readFileSync as readFileSync32, writeFileSync as writeFileSync28 } from "fs";
|
|
12550
|
+
import { basename as basename8, extname, resolve as resolve10 } from "path";
|
|
12495
12551
|
import chalk131 from "chalk";
|
|
12496
12552
|
|
|
12497
12553
|
// src/commands/mermaid/renderBlock.ts
|
|
@@ -12516,9 +12572,9 @@ async function renderBlock(krokiUrl, source) {
|
|
|
12516
12572
|
|
|
12517
12573
|
// src/commands/mermaid/exportFile.ts
|
|
12518
12574
|
async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
12519
|
-
const content =
|
|
12575
|
+
const content = readFileSync32(file, "utf8");
|
|
12520
12576
|
const blocks = extractMermaidBlocks(content);
|
|
12521
|
-
const stem =
|
|
12577
|
+
const stem = basename8(file, extname(file));
|
|
12522
12578
|
if (onlyIndex !== void 0) {
|
|
12523
12579
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
12524
12580
|
console.error(
|
|
@@ -12567,7 +12623,7 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
12567
12623
|
process.exit(1);
|
|
12568
12624
|
}
|
|
12569
12625
|
}
|
|
12570
|
-
const files = file ? [file] :
|
|
12626
|
+
const files = file ? [file] : readdirSync8(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
12571
12627
|
if (files.length === 0) {
|
|
12572
12628
|
console.log(chalk132.gray("No markdown files found in current directory."));
|
|
12573
12629
|
return;
|
|
@@ -12594,7 +12650,7 @@ function registerMermaid(program2) {
|
|
|
12594
12650
|
// src/commands/netcap/netcap.ts
|
|
12595
12651
|
import { mkdir as mkdir3 } from "fs/promises";
|
|
12596
12652
|
import { createServer as createServer2 } from "http";
|
|
12597
|
-
import { dirname as
|
|
12653
|
+
import { dirname as dirname22 } from "path";
|
|
12598
12654
|
import chalk134 from "chalk";
|
|
12599
12655
|
|
|
12600
12656
|
// src/commands/netcap/corsHeaders.ts
|
|
@@ -12673,15 +12729,15 @@ function createNetcapHandler(options2) {
|
|
|
12673
12729
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
12674
12730
|
import { cp, readFile as readFile2, writeFile as writeFile2 } from "fs/promises";
|
|
12675
12731
|
import { networkInterfaces } from "os";
|
|
12676
|
-
import { join as
|
|
12732
|
+
import { join as join41 } from "path";
|
|
12677
12733
|
import chalk133 from "chalk";
|
|
12678
12734
|
|
|
12679
12735
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
12680
|
-
import { dirname as
|
|
12736
|
+
import { dirname as dirname21, join as join40 } from "path";
|
|
12681
12737
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
12682
|
-
var moduleDir =
|
|
12738
|
+
var moduleDir = dirname21(fileURLToPath5(import.meta.url));
|
|
12683
12739
|
function netcapExtensionDir() {
|
|
12684
|
-
return
|
|
12740
|
+
return join40(moduleDir, "commands", "netcap", "netcap-extension");
|
|
12685
12741
|
}
|
|
12686
12742
|
|
|
12687
12743
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
@@ -12696,7 +12752,7 @@ function lanIPv4() {
|
|
|
12696
12752
|
return void 0;
|
|
12697
12753
|
}
|
|
12698
12754
|
async function configureBackground(dir, host, port, filter) {
|
|
12699
|
-
const file =
|
|
12755
|
+
const file = join41(dir, "background.js");
|
|
12700
12756
|
const source = await readFile2(file, "utf8");
|
|
12701
12757
|
await writeFile2(
|
|
12702
12758
|
file,
|
|
@@ -12736,20 +12792,20 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
12736
12792
|
}
|
|
12737
12793
|
|
|
12738
12794
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
12739
|
-
import { isAbsolute, join as
|
|
12795
|
+
import { isAbsolute, join as join43, resolve as resolve12 } from "path";
|
|
12740
12796
|
|
|
12741
12797
|
// src/commands/netcap/defaultCapturePath.ts
|
|
12742
|
-
import { homedir as
|
|
12743
|
-
import { join as
|
|
12798
|
+
import { homedir as homedir16 } from "os";
|
|
12799
|
+
import { join as join42 } from "path";
|
|
12744
12800
|
function defaultCapturePath() {
|
|
12745
|
-
return
|
|
12801
|
+
return join42(homedir16(), ".assist", "netcap", "capture.jsonl");
|
|
12746
12802
|
}
|
|
12747
12803
|
|
|
12748
12804
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
12749
12805
|
function resolveNetcapOutPath(out) {
|
|
12750
12806
|
if (!out) return defaultCapturePath();
|
|
12751
12807
|
const dir = isAbsolute(out) ? out : resolve12(process.cwd(), out);
|
|
12752
|
-
return
|
|
12808
|
+
return join43(dir, "capture.jsonl");
|
|
12753
12809
|
}
|
|
12754
12810
|
|
|
12755
12811
|
// src/commands/netcap/netcap.ts
|
|
@@ -12757,7 +12813,7 @@ async function netcap(options2) {
|
|
|
12757
12813
|
const port = Number(options2.port);
|
|
12758
12814
|
const outPath = resolveNetcapOutPath(options2.out);
|
|
12759
12815
|
const filter = options2.filter ?? "";
|
|
12760
|
-
await mkdir3(
|
|
12816
|
+
await mkdir3(dirname22(outPath), { recursive: true });
|
|
12761
12817
|
const extensionPath = await prepareExtensionForLoad(port, filter);
|
|
12762
12818
|
let count7 = 0;
|
|
12763
12819
|
const handler = createNetcapHandler({
|
|
@@ -12796,11 +12852,11 @@ netcap stopped \u2014 captured ${count7} ${count7 === 1 ? "entry" : "entries"} t
|
|
|
12796
12852
|
|
|
12797
12853
|
// src/commands/netcap/netcapExtract.ts
|
|
12798
12854
|
import { writeFileSync as writeFileSync29 } from "fs";
|
|
12799
|
-
import { join as
|
|
12855
|
+
import { join as join44 } from "path";
|
|
12800
12856
|
import chalk135 from "chalk";
|
|
12801
12857
|
|
|
12802
12858
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
12803
|
-
import { readFileSync as
|
|
12859
|
+
import { readFileSync as readFileSync33 } from "fs";
|
|
12804
12860
|
|
|
12805
12861
|
// src/commands/netcap/parseRscRows.ts
|
|
12806
12862
|
var isRscRef = (v) => typeof v === "string" && /^\$[0-9a-fL@]/.test(v);
|
|
@@ -13196,7 +13252,7 @@ function extractVoyagerPosts(body) {
|
|
|
13196
13252
|
|
|
13197
13253
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
13198
13254
|
function captureEntries(captureFile) {
|
|
13199
|
-
const lines =
|
|
13255
|
+
const lines = readFileSync33(captureFile, "utf8").split("\n").filter(Boolean);
|
|
13200
13256
|
const entries = [];
|
|
13201
13257
|
for (const line of lines) {
|
|
13202
13258
|
let entry;
|
|
@@ -13241,7 +13297,7 @@ function extractPostsFromCapture(captureFile) {
|
|
|
13241
13297
|
function netcapExtract(file) {
|
|
13242
13298
|
const captureFile = file ?? defaultCapturePath();
|
|
13243
13299
|
const posts = extractPostsFromCapture(captureFile);
|
|
13244
|
-
const outFile =
|
|
13300
|
+
const outFile = join44(captureFile, "..", "posts.json");
|
|
13245
13301
|
writeFileSync29(outFile, `${JSON.stringify(posts, null, 2)}
|
|
13246
13302
|
`);
|
|
13247
13303
|
console.log(
|
|
@@ -13677,26 +13733,26 @@ import { execSync as execSync35 } from "child_process";
|
|
|
13677
13733
|
import { execSync as execSync34 } from "child_process";
|
|
13678
13734
|
import { unlinkSync as unlinkSync12, writeFileSync as writeFileSync30 } from "fs";
|
|
13679
13735
|
import { tmpdir as tmpdir5 } from "os";
|
|
13680
|
-
import { join as
|
|
13736
|
+
import { join as join46 } from "path";
|
|
13681
13737
|
|
|
13682
13738
|
// src/commands/prs/loadCommentsCache.ts
|
|
13683
|
-
import { existsSync as
|
|
13684
|
-
import { join as
|
|
13739
|
+
import { existsSync as existsSync37, readFileSync as readFileSync34, unlinkSync as unlinkSync11 } from "fs";
|
|
13740
|
+
import { join as join45 } from "path";
|
|
13685
13741
|
import { parse as parse2 } from "yaml";
|
|
13686
13742
|
function getCachePath(prNumber) {
|
|
13687
|
-
return
|
|
13743
|
+
return join45(process.cwd(), ".assist", `pr-${prNumber}-comments.yaml`);
|
|
13688
13744
|
}
|
|
13689
13745
|
function loadCommentsCache(prNumber) {
|
|
13690
13746
|
const cachePath = getCachePath(prNumber);
|
|
13691
|
-
if (!
|
|
13747
|
+
if (!existsSync37(cachePath)) {
|
|
13692
13748
|
return null;
|
|
13693
13749
|
}
|
|
13694
|
-
const content =
|
|
13750
|
+
const content = readFileSync34(cachePath, "utf8");
|
|
13695
13751
|
return parse2(content);
|
|
13696
13752
|
}
|
|
13697
13753
|
function deleteCommentsCache(prNumber) {
|
|
13698
13754
|
const cachePath = getCachePath(prNumber);
|
|
13699
|
-
if (
|
|
13755
|
+
if (existsSync37(cachePath)) {
|
|
13700
13756
|
unlinkSync11(cachePath);
|
|
13701
13757
|
console.log("No more unresolved line comments. Cache dropped.");
|
|
13702
13758
|
}
|
|
@@ -13714,7 +13770,7 @@ function replyToComment(org, repo, prNumber, commentId, message) {
|
|
|
13714
13770
|
// src/commands/prs/resolveCommentWithReply.ts
|
|
13715
13771
|
function resolveThread(threadId) {
|
|
13716
13772
|
const mutation = `mutation($threadId: ID!) { resolveReviewThread(input: {threadId: $threadId}) { thread { isResolved } } }`;
|
|
13717
|
-
const queryFile =
|
|
13773
|
+
const queryFile = join46(tmpdir5(), `gh-mutation-${Date.now()}.graphql`);
|
|
13718
13774
|
writeFileSync30(queryFile, mutation);
|
|
13719
13775
|
try {
|
|
13720
13776
|
execSync34(
|
|
@@ -13796,18 +13852,18 @@ function fixed(commentId, sha) {
|
|
|
13796
13852
|
}
|
|
13797
13853
|
|
|
13798
13854
|
// src/commands/prs/listComments/index.ts
|
|
13799
|
-
import { existsSync as
|
|
13800
|
-
import { join as
|
|
13855
|
+
import { existsSync as existsSync38, mkdirSync as mkdirSync15, writeFileSync as writeFileSync32 } from "fs";
|
|
13856
|
+
import { join as join48 } from "path";
|
|
13801
13857
|
import { stringify } from "yaml";
|
|
13802
13858
|
|
|
13803
13859
|
// src/commands/prs/fetchThreadIds.ts
|
|
13804
13860
|
import { execSync as execSync36 } from "child_process";
|
|
13805
13861
|
import { unlinkSync as unlinkSync13, writeFileSync as writeFileSync31 } from "fs";
|
|
13806
13862
|
import { tmpdir as tmpdir6 } from "os";
|
|
13807
|
-
import { join as
|
|
13863
|
+
import { join as join47 } from "path";
|
|
13808
13864
|
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 } } } } } } }`;
|
|
13809
13865
|
function fetchThreadIds(org, repo, prNumber) {
|
|
13810
|
-
const queryFile =
|
|
13866
|
+
const queryFile = join47(tmpdir6(), `gh-query-${Date.now()}.graphql`);
|
|
13811
13867
|
writeFileSync31(queryFile, THREAD_QUERY);
|
|
13812
13868
|
try {
|
|
13813
13869
|
const result = execSync36(
|
|
@@ -13921,8 +13977,8 @@ function printComments2(result) {
|
|
|
13921
13977
|
|
|
13922
13978
|
// src/commands/prs/listComments/index.ts
|
|
13923
13979
|
function writeCommentsCache(prNumber, comments3) {
|
|
13924
|
-
const assistDir =
|
|
13925
|
-
if (!
|
|
13980
|
+
const assistDir = join48(process.cwd(), ".assist");
|
|
13981
|
+
if (!existsSync38(assistDir)) {
|
|
13926
13982
|
mkdirSync15(assistDir, { recursive: true });
|
|
13927
13983
|
}
|
|
13928
13984
|
const cacheData = {
|
|
@@ -13930,7 +13986,7 @@ function writeCommentsCache(prNumber, comments3) {
|
|
|
13930
13986
|
fetchedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13931
13987
|
comments: comments3
|
|
13932
13988
|
};
|
|
13933
|
-
const cachePath =
|
|
13989
|
+
const cachePath = join48(assistDir, `pr-${prNumber}-comments.yaml`);
|
|
13934
13990
|
writeFileSync32(cachePath, stringify(cacheData));
|
|
13935
13991
|
}
|
|
13936
13992
|
function handleKnownErrors(error) {
|
|
@@ -13963,7 +14019,7 @@ async function listComments() {
|
|
|
13963
14019
|
];
|
|
13964
14020
|
updateCache(prNumber, allComments);
|
|
13965
14021
|
const hasLineComments = allComments.some((c) => c.type === "line");
|
|
13966
|
-
const cachePath = hasLineComments ?
|
|
14022
|
+
const cachePath = hasLineComments ? join48(process.cwd(), ".assist", `pr-${prNumber}-comments.yaml`) : null;
|
|
13967
14023
|
return { comments: allComments, cachePath };
|
|
13968
14024
|
} catch (error) {
|
|
13969
14025
|
const handled = handleKnownErrors(error);
|
|
@@ -16055,8 +16111,8 @@ function findRootParent(file, importedBy, visited) {
|
|
|
16055
16111
|
function clusterFiles(graph) {
|
|
16056
16112
|
const clusters = /* @__PURE__ */ new Map();
|
|
16057
16113
|
for (const file of graph.files) {
|
|
16058
|
-
const
|
|
16059
|
-
if (
|
|
16114
|
+
const basename13 = path43.basename(file, path43.extname(file));
|
|
16115
|
+
if (basename13 === "index") continue;
|
|
16060
16116
|
const importers = graph.importedBy.get(file);
|
|
16061
16117
|
if (!importers || importers.size !== 1) continue;
|
|
16062
16118
|
const parent = [...importers][0];
|
|
@@ -16468,22 +16524,22 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
|
|
|
16468
16524
|
}
|
|
16469
16525
|
|
|
16470
16526
|
// src/commands/review/buildReviewPaths.ts
|
|
16471
|
-
import { homedir as
|
|
16472
|
-
import { basename as
|
|
16527
|
+
import { homedir as homedir17 } from "os";
|
|
16528
|
+
import { basename as basename9, join as join49 } from "path";
|
|
16473
16529
|
function buildReviewPaths(repoRoot, key) {
|
|
16474
|
-
const reviewDir =
|
|
16475
|
-
|
|
16530
|
+
const reviewDir = join49(
|
|
16531
|
+
homedir17(),
|
|
16476
16532
|
".assist",
|
|
16477
16533
|
"reviews",
|
|
16478
|
-
|
|
16534
|
+
basename9(repoRoot),
|
|
16479
16535
|
key
|
|
16480
16536
|
);
|
|
16481
16537
|
return {
|
|
16482
16538
|
reviewDir,
|
|
16483
|
-
requestPath:
|
|
16484
|
-
claudePath:
|
|
16485
|
-
codexPath:
|
|
16486
|
-
synthesisPath:
|
|
16539
|
+
requestPath: join49(reviewDir, "request.md"),
|
|
16540
|
+
claudePath: join49(reviewDir, "claude.md"),
|
|
16541
|
+
codexPath: join49(reviewDir, "codex.md"),
|
|
16542
|
+
synthesisPath: join49(reviewDir, "synthesis.md")
|
|
16487
16543
|
};
|
|
16488
16544
|
}
|
|
16489
16545
|
|
|
@@ -16626,7 +16682,7 @@ function gatherContext() {
|
|
|
16626
16682
|
}
|
|
16627
16683
|
|
|
16628
16684
|
// src/commands/review/postReviewToPr.ts
|
|
16629
|
-
import { readFileSync as
|
|
16685
|
+
import { readFileSync as readFileSync35 } from "fs";
|
|
16630
16686
|
|
|
16631
16687
|
// src/commands/review/parseFindings.ts
|
|
16632
16688
|
var SEVERITIES = ["blocker", "major", "minor", "nit"];
|
|
@@ -16941,7 +16997,7 @@ async function confirmPost(prNumber, count7, options2) {
|
|
|
16941
16997
|
async function postReviewToPr(synthesisPath, options2) {
|
|
16942
16998
|
const prInfo = fetchPrDiffInfo();
|
|
16943
16999
|
const prNumber = prInfo.prNumber;
|
|
16944
|
-
const markdown =
|
|
17000
|
+
const markdown = readFileSync35(synthesisPath, "utf8");
|
|
16945
17001
|
const findings = parseFindings(markdown);
|
|
16946
17002
|
if (findings.length === 0) {
|
|
16947
17003
|
console.log("Synthesis contains no findings; nothing to post.");
|
|
@@ -17023,10 +17079,10 @@ async function handlePostSynthesis(synthesisPath, options2) {
|
|
|
17023
17079
|
}
|
|
17024
17080
|
|
|
17025
17081
|
// src/commands/review/prepareReviewDir.ts
|
|
17026
|
-
import { existsSync as
|
|
17082
|
+
import { existsSync as existsSync39, mkdirSync as mkdirSync16, unlinkSync as unlinkSync14, writeFileSync as writeFileSync33 } from "fs";
|
|
17027
17083
|
function clearReviewFiles(paths) {
|
|
17028
17084
|
for (const path57 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
17029
|
-
if (
|
|
17085
|
+
if (existsSync39(path57)) unlinkSync14(path57);
|
|
17030
17086
|
}
|
|
17031
17087
|
}
|
|
17032
17088
|
function prepareReviewDir(paths, requestBody, force) {
|
|
@@ -17094,11 +17150,11 @@ async function runBacklogSession(synthesisPath) {
|
|
|
17094
17150
|
}
|
|
17095
17151
|
|
|
17096
17152
|
// src/commands/review/cachedReviewerResult.ts
|
|
17097
|
-
import { statSync as
|
|
17153
|
+
import { statSync as statSync6 } from "fs";
|
|
17098
17154
|
function cachedReviewerResult(name, outputPath) {
|
|
17099
17155
|
let size;
|
|
17100
17156
|
try {
|
|
17101
|
-
size =
|
|
17157
|
+
size = statSync6(outputPath).size;
|
|
17102
17158
|
} catch {
|
|
17103
17159
|
return null;
|
|
17104
17160
|
}
|
|
@@ -17311,7 +17367,7 @@ function printReviewerFailures(results) {
|
|
|
17311
17367
|
}
|
|
17312
17368
|
|
|
17313
17369
|
// src/commands/review/runAndSynthesise.ts
|
|
17314
|
-
import { existsSync as
|
|
17370
|
+
import { existsSync as existsSync41, unlinkSync as unlinkSync16 } from "fs";
|
|
17315
17371
|
|
|
17316
17372
|
// src/commands/review/buildReviewerStdin.ts
|
|
17317
17373
|
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.
|
|
@@ -17731,7 +17787,7 @@ function resolveClaude(args) {
|
|
|
17731
17787
|
}
|
|
17732
17788
|
|
|
17733
17789
|
// src/commands/review/runCodexReviewer.ts
|
|
17734
|
-
import { existsSync as
|
|
17790
|
+
import { existsSync as existsSync40, unlinkSync as unlinkSync15 } from "fs";
|
|
17735
17791
|
|
|
17736
17792
|
// src/commands/review/parseCodexEvent.ts
|
|
17737
17793
|
function isItemStarted(value) {
|
|
@@ -17783,7 +17839,7 @@ async function runCodexReviewer(spec) {
|
|
|
17783
17839
|
reportReviewerToolUse(spec.name, event, spinner);
|
|
17784
17840
|
}
|
|
17785
17841
|
});
|
|
17786
|
-
if (result.exitCode !== 0 &&
|
|
17842
|
+
if (result.exitCode !== 0 && existsSync40(spec.outputPath)) {
|
|
17787
17843
|
unlinkSync15(spec.outputPath);
|
|
17788
17844
|
}
|
|
17789
17845
|
return finaliseReviewerRun({ ...spec, command }, spinner, result);
|
|
@@ -17825,7 +17881,7 @@ async function runReviewers(reviewDir, claudePath, codexPath, stdinPrompt, optio
|
|
|
17825
17881
|
}
|
|
17826
17882
|
|
|
17827
17883
|
// src/commands/review/synthesise.ts
|
|
17828
|
-
import { readFileSync as
|
|
17884
|
+
import { readFileSync as readFileSync36 } from "fs";
|
|
17829
17885
|
|
|
17830
17886
|
// src/commands/review/buildSynthesisStdin.ts
|
|
17831
17887
|
var SYNTHESIS_PROMPT = `You are consolidating two independent code reviews of the same change. The original review request is in request.md. The two reviews are in claude.md and codex.md in the current working directory.
|
|
@@ -17881,7 +17937,7 @@ Files:
|
|
|
17881
17937
|
|
|
17882
17938
|
// src/commands/review/synthesise.ts
|
|
17883
17939
|
function printSummary2(synthesisPath) {
|
|
17884
|
-
const markdown =
|
|
17940
|
+
const markdown = readFileSync36(synthesisPath, "utf8");
|
|
17885
17941
|
console.log("");
|
|
17886
17942
|
console.log(buildReviewSummary(markdown));
|
|
17887
17943
|
console.log("");
|
|
@@ -17929,7 +17985,7 @@ async function runAndSynthesise(args) {
|
|
|
17929
17985
|
console.error("Both reviewers failed; skipping synthesis.");
|
|
17930
17986
|
return { ok: false, failures };
|
|
17931
17987
|
}
|
|
17932
|
-
if (anyFresh &&
|
|
17988
|
+
if (anyFresh && existsSync41(paths.synthesisPath)) {
|
|
17933
17989
|
unlinkSync16(paths.synthesisPath);
|
|
17934
17990
|
}
|
|
17935
17991
|
const synthesisResult = await synthesise(paths, { multi });
|
|
@@ -18779,27 +18835,27 @@ async function configure() {
|
|
|
18779
18835
|
}
|
|
18780
18836
|
|
|
18781
18837
|
// src/commands/transcript/list.ts
|
|
18782
|
-
import { existsSync as
|
|
18783
|
-
import { join as
|
|
18838
|
+
import { existsSync as existsSync42, readdirSync as readdirSync9, statSync as statSync7 } from "fs";
|
|
18839
|
+
import { join as join50 } from "path";
|
|
18784
18840
|
function list4() {
|
|
18785
18841
|
const { vttDir } = getTranscriptConfig();
|
|
18786
|
-
if (!
|
|
18787
|
-
for (const entry of
|
|
18842
|
+
if (!existsSync42(vttDir)) return;
|
|
18843
|
+
for (const entry of readdirSync9(vttDir)) {
|
|
18788
18844
|
if (!entry.endsWith(".vtt")) continue;
|
|
18789
|
-
if (
|
|
18845
|
+
if (statSync7(join50(vttDir, entry)).isDirectory()) continue;
|
|
18790
18846
|
console.log(entry);
|
|
18791
18847
|
}
|
|
18792
18848
|
}
|
|
18793
18849
|
|
|
18794
18850
|
// src/commands/transcript/move.ts
|
|
18795
18851
|
import {
|
|
18796
|
-
existsSync as
|
|
18852
|
+
existsSync as existsSync43,
|
|
18797
18853
|
mkdirSync as mkdirSync17,
|
|
18798
|
-
readFileSync as
|
|
18854
|
+
readFileSync as readFileSync37,
|
|
18799
18855
|
renameSync as renameSync2,
|
|
18800
18856
|
writeFileSync as writeFileSync35
|
|
18801
18857
|
} from "fs";
|
|
18802
|
-
import { basename as
|
|
18858
|
+
import { basename as basename10, join as join51 } from "path";
|
|
18803
18859
|
|
|
18804
18860
|
// src/commands/transcript/cleanText.ts
|
|
18805
18861
|
function cleanText(text6) {
|
|
@@ -19007,14 +19063,14 @@ function formatChatLog(messages) {
|
|
|
19007
19063
|
// src/commands/transcript/move.ts
|
|
19008
19064
|
var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
19009
19065
|
function convertVttToMarkdown(inputPath) {
|
|
19010
|
-
const cues = parseVtt(
|
|
19066
|
+
const cues = parseVtt(readFileSync37(inputPath, "utf8"));
|
|
19011
19067
|
const messages = cuesToChatMessages(deduplicateCues(cues));
|
|
19012
19068
|
return formatChatLog(messages);
|
|
19013
19069
|
}
|
|
19014
19070
|
function archiveRawVtt(vttDir, sourcePath, filename) {
|
|
19015
|
-
const processedDir =
|
|
19071
|
+
const processedDir = join51(vttDir, "processed");
|
|
19016
19072
|
mkdirSync17(processedDir, { recursive: true });
|
|
19017
|
-
renameSync2(sourcePath,
|
|
19073
|
+
renameSync2(sourcePath, join51(processedDir, filename));
|
|
19018
19074
|
}
|
|
19019
19075
|
function move(file, options2) {
|
|
19020
19076
|
const { date, client } = options2;
|
|
@@ -19023,20 +19079,20 @@ function move(file, options2) {
|
|
|
19023
19079
|
process.exit(1);
|
|
19024
19080
|
}
|
|
19025
19081
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
19026
|
-
const filename =
|
|
19027
|
-
const sourcePath =
|
|
19028
|
-
if (!
|
|
19082
|
+
const filename = basename10(file);
|
|
19083
|
+
const sourcePath = join51(vttDir, filename);
|
|
19084
|
+
if (!existsSync43(sourcePath)) {
|
|
19029
19085
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
19030
19086
|
process.exit(1);
|
|
19031
19087
|
}
|
|
19032
|
-
const base =
|
|
19088
|
+
const base = basename10(filename, ".vtt").replace(/ Transcription$/, "");
|
|
19033
19089
|
const outputName = `${date} ${base}.md`;
|
|
19034
|
-
const formattedDir =
|
|
19090
|
+
const formattedDir = join51(transcriptsDir, client);
|
|
19035
19091
|
mkdirSync17(formattedDir, { recursive: true });
|
|
19036
|
-
const formattedPath =
|
|
19092
|
+
const formattedPath = join51(formattedDir, outputName);
|
|
19037
19093
|
writeFileSync35(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
|
|
19038
19094
|
archiveRawVtt(vttDir, sourcePath, filename);
|
|
19039
|
-
const summaryPath =
|
|
19095
|
+
const summaryPath = join51(summaryDir, client, outputName);
|
|
19040
19096
|
console.log(`Formatted transcript: ${formattedPath}`);
|
|
19041
19097
|
console.log(`Summary target: ${summaryPath}`);
|
|
19042
19098
|
}
|
|
@@ -19084,50 +19140,50 @@ function registerVerify(program2) {
|
|
|
19084
19140
|
|
|
19085
19141
|
// src/commands/voice/devices.ts
|
|
19086
19142
|
import { spawnSync as spawnSync5 } from "child_process";
|
|
19087
|
-
import { join as
|
|
19143
|
+
import { join as join53 } from "path";
|
|
19088
19144
|
|
|
19089
19145
|
// src/commands/voice/shared.ts
|
|
19090
|
-
import { homedir as
|
|
19091
|
-
import { dirname as
|
|
19146
|
+
import { homedir as homedir18 } from "os";
|
|
19147
|
+
import { dirname as dirname24, join as join52 } from "path";
|
|
19092
19148
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
19093
|
-
var __dirname5 =
|
|
19094
|
-
var VOICE_DIR =
|
|
19149
|
+
var __dirname5 = dirname24(fileURLToPath6(import.meta.url));
|
|
19150
|
+
var VOICE_DIR = join52(homedir18(), ".assist", "voice");
|
|
19095
19151
|
var voicePaths = {
|
|
19096
19152
|
dir: VOICE_DIR,
|
|
19097
|
-
pid:
|
|
19098
|
-
log:
|
|
19099
|
-
venv:
|
|
19100
|
-
lock:
|
|
19153
|
+
pid: join52(VOICE_DIR, "voice.pid"),
|
|
19154
|
+
log: join52(VOICE_DIR, "voice.log"),
|
|
19155
|
+
venv: join52(VOICE_DIR, ".venv"),
|
|
19156
|
+
lock: join52(VOICE_DIR, "voice.lock")
|
|
19101
19157
|
};
|
|
19102
19158
|
function getPythonDir() {
|
|
19103
|
-
return
|
|
19159
|
+
return join52(__dirname5, "commands", "voice", "python");
|
|
19104
19160
|
}
|
|
19105
19161
|
function getVenvPython() {
|
|
19106
|
-
return process.platform === "win32" ?
|
|
19162
|
+
return process.platform === "win32" ? join52(voicePaths.venv, "Scripts", "python.exe") : join52(voicePaths.venv, "bin", "python");
|
|
19107
19163
|
}
|
|
19108
19164
|
function getLockDir() {
|
|
19109
19165
|
const config = loadConfig();
|
|
19110
19166
|
return config.voice?.lockDir ?? VOICE_DIR;
|
|
19111
19167
|
}
|
|
19112
19168
|
function getLockFile() {
|
|
19113
|
-
return
|
|
19169
|
+
return join52(getLockDir(), "voice.lock");
|
|
19114
19170
|
}
|
|
19115
19171
|
|
|
19116
19172
|
// src/commands/voice/devices.ts
|
|
19117
19173
|
function devices() {
|
|
19118
|
-
const script =
|
|
19174
|
+
const script = join53(getPythonDir(), "list_devices.py");
|
|
19119
19175
|
spawnSync5(getVenvPython(), [script], { stdio: "inherit" });
|
|
19120
19176
|
}
|
|
19121
19177
|
|
|
19122
19178
|
// src/commands/voice/logs.ts
|
|
19123
|
-
import { existsSync as
|
|
19179
|
+
import { existsSync as existsSync44, readFileSync as readFileSync38 } from "fs";
|
|
19124
19180
|
function logs(options2) {
|
|
19125
|
-
if (!
|
|
19181
|
+
if (!existsSync44(voicePaths.log)) {
|
|
19126
19182
|
console.log("No voice log file found");
|
|
19127
19183
|
return;
|
|
19128
19184
|
}
|
|
19129
19185
|
const count7 = Number.parseInt(options2.lines ?? "150", 10);
|
|
19130
|
-
const content =
|
|
19186
|
+
const content = readFileSync38(voicePaths.log, "utf8").trim();
|
|
19131
19187
|
if (!content) {
|
|
19132
19188
|
console.log("Voice log is empty");
|
|
19133
19189
|
return;
|
|
@@ -19150,12 +19206,12 @@ function logs(options2) {
|
|
|
19150
19206
|
// src/commands/voice/setup.ts
|
|
19151
19207
|
import { spawnSync as spawnSync6 } from "child_process";
|
|
19152
19208
|
import { mkdirSync as mkdirSync19 } from "fs";
|
|
19153
|
-
import { join as
|
|
19209
|
+
import { join as join55 } from "path";
|
|
19154
19210
|
|
|
19155
19211
|
// src/commands/voice/checkLockFile.ts
|
|
19156
19212
|
import { execSync as execSync48 } from "child_process";
|
|
19157
|
-
import { existsSync as
|
|
19158
|
-
import { join as
|
|
19213
|
+
import { existsSync as existsSync45, mkdirSync as mkdirSync18, readFileSync as readFileSync39, writeFileSync as writeFileSync36 } from "fs";
|
|
19214
|
+
import { join as join54 } from "path";
|
|
19159
19215
|
function isProcessAlive2(pid) {
|
|
19160
19216
|
try {
|
|
19161
19217
|
process.kill(pid, 0);
|
|
@@ -19166,9 +19222,9 @@ function isProcessAlive2(pid) {
|
|
|
19166
19222
|
}
|
|
19167
19223
|
function checkLockFile() {
|
|
19168
19224
|
const lockFile = getLockFile();
|
|
19169
|
-
if (!
|
|
19225
|
+
if (!existsSync45(lockFile)) return;
|
|
19170
19226
|
try {
|
|
19171
|
-
const lock2 = JSON.parse(
|
|
19227
|
+
const lock2 = JSON.parse(readFileSync39(lockFile, "utf8"));
|
|
19172
19228
|
if (lock2.pid && isProcessAlive2(lock2.pid)) {
|
|
19173
19229
|
console.error(
|
|
19174
19230
|
`Voice daemon already running (PID ${lock2.pid}, env: ${lock2.env}). Stop it first with: assist voice stop`
|
|
@@ -19179,7 +19235,7 @@ function checkLockFile() {
|
|
|
19179
19235
|
}
|
|
19180
19236
|
}
|
|
19181
19237
|
function bootstrapVenv() {
|
|
19182
|
-
if (
|
|
19238
|
+
if (existsSync45(getVenvPython())) return;
|
|
19183
19239
|
console.log("Setting up Python environment...");
|
|
19184
19240
|
const pythonDir = getPythonDir();
|
|
19185
19241
|
execSync48(
|
|
@@ -19192,7 +19248,7 @@ function bootstrapVenv() {
|
|
|
19192
19248
|
}
|
|
19193
19249
|
function writeLockFile(pid) {
|
|
19194
19250
|
const lockFile = getLockFile();
|
|
19195
|
-
mkdirSync18(
|
|
19251
|
+
mkdirSync18(join54(lockFile, ".."), { recursive: true });
|
|
19196
19252
|
writeFileSync36(
|
|
19197
19253
|
lockFile,
|
|
19198
19254
|
JSON.stringify({
|
|
@@ -19208,7 +19264,7 @@ function setup() {
|
|
|
19208
19264
|
mkdirSync19(voicePaths.dir, { recursive: true });
|
|
19209
19265
|
bootstrapVenv();
|
|
19210
19266
|
console.log("\nDownloading models...\n");
|
|
19211
|
-
const script =
|
|
19267
|
+
const script = join55(getPythonDir(), "setup_models.py");
|
|
19212
19268
|
const result = spawnSync6(getVenvPython(), [script], {
|
|
19213
19269
|
stdio: "inherit",
|
|
19214
19270
|
env: { ...process.env, VOICE_LOG_FILE: voicePaths.log }
|
|
@@ -19222,7 +19278,7 @@ function setup() {
|
|
|
19222
19278
|
// src/commands/voice/start.ts
|
|
19223
19279
|
import { spawn as spawn7 } from "child_process";
|
|
19224
19280
|
import { mkdirSync as mkdirSync20, writeFileSync as writeFileSync37 } from "fs";
|
|
19225
|
-
import { join as
|
|
19281
|
+
import { join as join56 } from "path";
|
|
19226
19282
|
|
|
19227
19283
|
// src/commands/voice/buildDaemonEnv.ts
|
|
19228
19284
|
function buildDaemonEnv(options2) {
|
|
@@ -19260,7 +19316,7 @@ function start2(options2) {
|
|
|
19260
19316
|
bootstrapVenv();
|
|
19261
19317
|
const debug = options2.debug || options2.foreground || process.platform === "win32";
|
|
19262
19318
|
const env = buildDaemonEnv({ debug });
|
|
19263
|
-
const script =
|
|
19319
|
+
const script = join56(getPythonDir(), "voice_daemon.py");
|
|
19264
19320
|
const python = getVenvPython();
|
|
19265
19321
|
if (options2.foreground) {
|
|
19266
19322
|
spawnForeground(python, script, env);
|
|
@@ -19270,7 +19326,7 @@ function start2(options2) {
|
|
|
19270
19326
|
}
|
|
19271
19327
|
|
|
19272
19328
|
// src/commands/voice/status.ts
|
|
19273
|
-
import { existsSync as
|
|
19329
|
+
import { existsSync as existsSync46, readFileSync as readFileSync40 } from "fs";
|
|
19274
19330
|
function isProcessAlive3(pid) {
|
|
19275
19331
|
try {
|
|
19276
19332
|
process.kill(pid, 0);
|
|
@@ -19280,16 +19336,16 @@ function isProcessAlive3(pid) {
|
|
|
19280
19336
|
}
|
|
19281
19337
|
}
|
|
19282
19338
|
function readRecentLogs(count7) {
|
|
19283
|
-
if (!
|
|
19284
|
-
const lines =
|
|
19339
|
+
if (!existsSync46(voicePaths.log)) return [];
|
|
19340
|
+
const lines = readFileSync40(voicePaths.log, "utf8").trim().split("\n");
|
|
19285
19341
|
return lines.slice(-count7);
|
|
19286
19342
|
}
|
|
19287
19343
|
function status() {
|
|
19288
|
-
if (!
|
|
19344
|
+
if (!existsSync46(voicePaths.pid)) {
|
|
19289
19345
|
console.log("Voice daemon: not running (no PID file)");
|
|
19290
19346
|
return;
|
|
19291
19347
|
}
|
|
19292
|
-
const pid = Number.parseInt(
|
|
19348
|
+
const pid = Number.parseInt(readFileSync40(voicePaths.pid, "utf8").trim(), 10);
|
|
19293
19349
|
const alive = isProcessAlive3(pid);
|
|
19294
19350
|
console.log(`Voice daemon: ${alive ? "running" : "dead"} (PID ${pid})`);
|
|
19295
19351
|
const recent = readRecentLogs(5);
|
|
@@ -19308,13 +19364,13 @@ function status() {
|
|
|
19308
19364
|
}
|
|
19309
19365
|
|
|
19310
19366
|
// src/commands/voice/stop.ts
|
|
19311
|
-
import { existsSync as
|
|
19367
|
+
import { existsSync as existsSync47, readFileSync as readFileSync41, unlinkSync as unlinkSync17 } from "fs";
|
|
19312
19368
|
function stop2() {
|
|
19313
|
-
if (!
|
|
19369
|
+
if (!existsSync47(voicePaths.pid)) {
|
|
19314
19370
|
console.log("Voice daemon is not running (no PID file)");
|
|
19315
19371
|
return;
|
|
19316
19372
|
}
|
|
19317
|
-
const pid = Number.parseInt(
|
|
19373
|
+
const pid = Number.parseInt(readFileSync41(voicePaths.pid, "utf8").trim(), 10);
|
|
19318
19374
|
try {
|
|
19319
19375
|
process.kill(pid, "SIGTERM");
|
|
19320
19376
|
console.log(`Sent SIGTERM to voice daemon (PID ${pid})`);
|
|
@@ -19327,7 +19383,7 @@ function stop2() {
|
|
|
19327
19383
|
}
|
|
19328
19384
|
try {
|
|
19329
19385
|
const lockFile = getLockFile();
|
|
19330
|
-
if (
|
|
19386
|
+
if (existsSync47(lockFile)) unlinkSync17(lockFile);
|
|
19331
19387
|
} catch {
|
|
19332
19388
|
}
|
|
19333
19389
|
console.log("Voice daemon stopped");
|
|
@@ -19505,19 +19561,19 @@ async function auth() {
|
|
|
19505
19561
|
|
|
19506
19562
|
// src/commands/roam/postRoamActivity.ts
|
|
19507
19563
|
import { execFileSync as execFileSync7 } from "child_process";
|
|
19508
|
-
import { readdirSync as
|
|
19509
|
-
import { join as
|
|
19564
|
+
import { readdirSync as readdirSync10, readFileSync as readFileSync42, statSync as statSync8 } from "fs";
|
|
19565
|
+
import { join as join57 } from "path";
|
|
19510
19566
|
function findPortFile(roamDir) {
|
|
19511
19567
|
let entries;
|
|
19512
19568
|
try {
|
|
19513
|
-
entries =
|
|
19569
|
+
entries = readdirSync10(roamDir);
|
|
19514
19570
|
} catch {
|
|
19515
19571
|
return void 0;
|
|
19516
19572
|
}
|
|
19517
19573
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
19518
|
-
const path57 =
|
|
19574
|
+
const path57 = join57(roamDir, name);
|
|
19519
19575
|
try {
|
|
19520
|
-
return { path: path57, mtimeMs:
|
|
19576
|
+
return { path: path57, mtimeMs: statSync8(path57).mtimeMs };
|
|
19521
19577
|
} catch {
|
|
19522
19578
|
return void 0;
|
|
19523
19579
|
}
|
|
@@ -19527,11 +19583,11 @@ function findPortFile(roamDir) {
|
|
|
19527
19583
|
function postRoamActivity(app, event) {
|
|
19528
19584
|
const appData = process.env.APPDATA;
|
|
19529
19585
|
if (!appData) return;
|
|
19530
|
-
const portFile = findPortFile(
|
|
19586
|
+
const portFile = findPortFile(join57(appData, "Roam"));
|
|
19531
19587
|
if (!portFile) return;
|
|
19532
19588
|
let port;
|
|
19533
19589
|
try {
|
|
19534
|
-
port =
|
|
19590
|
+
port = readFileSync42(portFile, "utf8").trim();
|
|
19535
19591
|
} catch {
|
|
19536
19592
|
return;
|
|
19537
19593
|
}
|
|
@@ -19673,15 +19729,15 @@ function runPreCommands(pre, cwd) {
|
|
|
19673
19729
|
|
|
19674
19730
|
// src/commands/run/spawnRunCommand.ts
|
|
19675
19731
|
import { execFileSync as execFileSync8, spawn as spawn8 } from "child_process";
|
|
19676
|
-
import { existsSync as
|
|
19677
|
-
import { dirname as
|
|
19732
|
+
import { existsSync as existsSync48 } from "fs";
|
|
19733
|
+
import { dirname as dirname25, join as join58, resolve as resolve13 } from "path";
|
|
19678
19734
|
function resolveCommand2(command) {
|
|
19679
19735
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
19680
19736
|
try {
|
|
19681
19737
|
const gitPath = execFileSync8("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
19682
|
-
const gitRoot = resolve13(
|
|
19683
|
-
const gitBash =
|
|
19684
|
-
if (
|
|
19738
|
+
const gitRoot = resolve13(dirname25(gitPath), "..");
|
|
19739
|
+
const gitBash = join58(gitRoot, "bin", "bash.exe");
|
|
19740
|
+
if (existsSync48(gitBash)) return gitBash;
|
|
19685
19741
|
} catch {
|
|
19686
19742
|
}
|
|
19687
19743
|
return command;
|
|
@@ -19767,7 +19823,7 @@ async function run3(name, args) {
|
|
|
19767
19823
|
|
|
19768
19824
|
// src/commands/run/add.ts
|
|
19769
19825
|
import { mkdirSync as mkdirSync21, writeFileSync as writeFileSync38 } from "fs";
|
|
19770
|
-
import { join as
|
|
19826
|
+
import { join as join59 } from "path";
|
|
19771
19827
|
|
|
19772
19828
|
// src/commands/run/extractOption.ts
|
|
19773
19829
|
function extractOption(args, flag) {
|
|
@@ -19828,7 +19884,7 @@ function saveNewRunConfig(name, command, args, cwd) {
|
|
|
19828
19884
|
saveConfig(config);
|
|
19829
19885
|
}
|
|
19830
19886
|
function createCommandFile(name) {
|
|
19831
|
-
const dir =
|
|
19887
|
+
const dir = join59(".claude", "commands");
|
|
19832
19888
|
mkdirSync21(dir, { recursive: true });
|
|
19833
19889
|
const content = `---
|
|
19834
19890
|
description: Run ${name}
|
|
@@ -19836,7 +19892,7 @@ description: Run ${name}
|
|
|
19836
19892
|
|
|
19837
19893
|
Run \`assist run ${name} $ARGUMENTS 2>&1\`.
|
|
19838
19894
|
`;
|
|
19839
|
-
const filePath =
|
|
19895
|
+
const filePath = join59(dir, `${name}.md`);
|
|
19840
19896
|
writeFileSync38(filePath, content);
|
|
19841
19897
|
console.log(`Created command file: ${filePath}`);
|
|
19842
19898
|
}
|
|
@@ -19892,8 +19948,8 @@ function link2() {
|
|
|
19892
19948
|
}
|
|
19893
19949
|
|
|
19894
19950
|
// src/commands/run/remove.ts
|
|
19895
|
-
import { existsSync as
|
|
19896
|
-
import { join as
|
|
19951
|
+
import { existsSync as existsSync49, unlinkSync as unlinkSync18 } from "fs";
|
|
19952
|
+
import { join as join60 } from "path";
|
|
19897
19953
|
function findRemoveIndex() {
|
|
19898
19954
|
const idx = process.argv.indexOf("remove");
|
|
19899
19955
|
if (idx === -1 || idx + 1 >= process.argv.length) return -1;
|
|
@@ -19908,8 +19964,8 @@ function parseRemoveName() {
|
|
|
19908
19964
|
return process.argv[idx + 1];
|
|
19909
19965
|
}
|
|
19910
19966
|
function deleteCommandFile(name) {
|
|
19911
|
-
const filePath =
|
|
19912
|
-
if (
|
|
19967
|
+
const filePath = join60(".claude", "commands", `${name}.md`);
|
|
19968
|
+
if (existsSync49(filePath)) {
|
|
19913
19969
|
unlinkSync18(filePath);
|
|
19914
19970
|
console.log(`Deleted command file: ${filePath}`);
|
|
19915
19971
|
}
|
|
@@ -19948,9 +20004,9 @@ function registerRun(program2) {
|
|
|
19948
20004
|
|
|
19949
20005
|
// src/commands/screenshot/index.ts
|
|
19950
20006
|
import { execSync as execSync50 } from "child_process";
|
|
19951
|
-
import { existsSync as
|
|
20007
|
+
import { existsSync as existsSync50, mkdirSync as mkdirSync22, unlinkSync as unlinkSync19, writeFileSync as writeFileSync39 } from "fs";
|
|
19952
20008
|
import { tmpdir as tmpdir7 } from "os";
|
|
19953
|
-
import { join as
|
|
20009
|
+
import { join as join61, resolve as resolve15 } from "path";
|
|
19954
20010
|
import chalk179 from "chalk";
|
|
19955
20011
|
|
|
19956
20012
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
@@ -20080,14 +20136,14 @@ Write-Output $OutputPath
|
|
|
20080
20136
|
|
|
20081
20137
|
// src/commands/screenshot/index.ts
|
|
20082
20138
|
function buildOutputPath(outputDir, processName) {
|
|
20083
|
-
if (!
|
|
20139
|
+
if (!existsSync50(outputDir)) {
|
|
20084
20140
|
mkdirSync22(outputDir, { recursive: true });
|
|
20085
20141
|
}
|
|
20086
20142
|
const timestamp4 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
20087
20143
|
return resolve15(outputDir, `${processName}-${timestamp4}.png`);
|
|
20088
20144
|
}
|
|
20089
20145
|
function runPowerShellScript(processName, outputPath) {
|
|
20090
|
-
const scriptPath =
|
|
20146
|
+
const scriptPath = join61(tmpdir7(), `assist-screenshot-${Date.now()}.ps1`);
|
|
20091
20147
|
writeFileSync39(scriptPath, captureWindowPs1, "utf8");
|
|
20092
20148
|
try {
|
|
20093
20149
|
execSync50(
|
|
@@ -20164,7 +20220,7 @@ function applyLine(result, pending, line) {
|
|
|
20164
20220
|
}
|
|
20165
20221
|
|
|
20166
20222
|
// src/commands/sessions/daemon/reportStolenSocket.ts
|
|
20167
|
-
import { readFileSync as
|
|
20223
|
+
import { readFileSync as readFileSync43 } from "fs";
|
|
20168
20224
|
function reportStolenSocket(socketPid) {
|
|
20169
20225
|
if (!socketPid) return;
|
|
20170
20226
|
const filePid = readPidFile();
|
|
@@ -20176,7 +20232,7 @@ function reportStolenSocket(socketPid) {
|
|
|
20176
20232
|
function readPidFile() {
|
|
20177
20233
|
try {
|
|
20178
20234
|
const pid = Number.parseInt(
|
|
20179
|
-
|
|
20235
|
+
readFileSync43(daemonPaths.pid, "utf8").trim(),
|
|
20180
20236
|
10
|
|
20181
20237
|
);
|
|
20182
20238
|
return Number.isInteger(pid) ? pid : void 0;
|
|
@@ -20249,6 +20305,8 @@ function recentDaemonLogLines() {
|
|
|
20249
20305
|
var SESSIONS_FILE = "sessions.json";
|
|
20250
20306
|
var persistedSessionSchema = z5.object({
|
|
20251
20307
|
name: z5.string(),
|
|
20308
|
+
title: z5.string().optional(),
|
|
20309
|
+
subtitle: z5.string().optional(),
|
|
20252
20310
|
commandType: z5.enum(["claude", "run", "assist"]),
|
|
20253
20311
|
cwd: z5.string(),
|
|
20254
20312
|
startedAt: z5.number(),
|
|
@@ -20289,6 +20347,8 @@ function logPersist(live) {
|
|
|
20289
20347
|
function toPersistedSession(session) {
|
|
20290
20348
|
return {
|
|
20291
20349
|
name: session.name,
|
|
20350
|
+
title: session.title,
|
|
20351
|
+
subtitle: session.subtitle,
|
|
20292
20352
|
commandType: session.commandType,
|
|
20293
20353
|
cwd: session.cwd ?? process.cwd(),
|
|
20294
20354
|
startedAt: session.startedAt,
|
|
@@ -20524,7 +20584,7 @@ var ClientHub = class extends Set {
|
|
|
20524
20584
|
import * as pty from "node-pty";
|
|
20525
20585
|
|
|
20526
20586
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
20527
|
-
import { chmodSync, existsSync as
|
|
20587
|
+
import { chmodSync, existsSync as existsSync51, statSync as statSync9 } from "fs";
|
|
20528
20588
|
import { createRequire as createRequire3 } from "module";
|
|
20529
20589
|
import path49 from "path";
|
|
20530
20590
|
var require4 = createRequire3(import.meta.url);
|
|
@@ -20539,8 +20599,8 @@ function ensureSpawnHelperExecutable() {
|
|
|
20539
20599
|
`${process.platform}-${process.arch}`,
|
|
20540
20600
|
"spawn-helper"
|
|
20541
20601
|
);
|
|
20542
|
-
if (!
|
|
20543
|
-
const mode =
|
|
20602
|
+
if (!existsSync51(helper)) return;
|
|
20603
|
+
const mode = statSync9(helper).mode;
|
|
20544
20604
|
if ((mode & 73) === 0) chmodSync(helper, mode | 493);
|
|
20545
20605
|
}
|
|
20546
20606
|
|
|
@@ -20782,6 +20842,8 @@ function restoreBase(id2, persisted) {
|
|
|
20782
20842
|
return {
|
|
20783
20843
|
id: id2,
|
|
20784
20844
|
name: persisted.name,
|
|
20845
|
+
title: persisted.title,
|
|
20846
|
+
subtitle: persisted.subtitle,
|
|
20785
20847
|
commandType: persisted.commandType,
|
|
20786
20848
|
scrollback: "",
|
|
20787
20849
|
cwd: persisted.cwd,
|
|
@@ -20982,8 +21044,8 @@ function resumeSession(id2, sessionId, cwd, name) {
|
|
|
20982
21044
|
}
|
|
20983
21045
|
|
|
20984
21046
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
20985
|
-
import { existsSync as
|
|
20986
|
-
import { dirname as
|
|
21047
|
+
import { existsSync as existsSync52, mkdirSync as mkdirSync23, watch } from "fs";
|
|
21048
|
+
import { dirname as dirname26 } from "path";
|
|
20987
21049
|
|
|
20988
21050
|
// src/commands/sessions/daemon/applyReviewPause.ts
|
|
20989
21051
|
function applyReviewPause(session, activity2) {
|
|
@@ -21001,7 +21063,7 @@ var DEBOUNCE_MS = 50;
|
|
|
21001
21063
|
function watchActivity(session, notify2) {
|
|
21002
21064
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
21003
21065
|
const path57 = activityPath(session.id);
|
|
21004
|
-
const dir =
|
|
21066
|
+
const dir = dirname26(path57);
|
|
21005
21067
|
try {
|
|
21006
21068
|
mkdirSync23(dir, { recursive: true });
|
|
21007
21069
|
} catch {
|
|
@@ -21024,7 +21086,7 @@ function watchActivity(session, notify2) {
|
|
|
21024
21086
|
if (timer) clearTimeout(timer);
|
|
21025
21087
|
timer = setTimeout(read, DEBOUNCE_MS);
|
|
21026
21088
|
});
|
|
21027
|
-
if (
|
|
21089
|
+
if (existsSync52(path57)) read();
|
|
21028
21090
|
}
|
|
21029
21091
|
function refreshActivity(session) {
|
|
21030
21092
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -22301,7 +22363,7 @@ function handleConnection(socket, manager) {
|
|
|
22301
22363
|
import { unlinkSync as unlinkSync20, writeFileSync as writeFileSync40 } from "fs";
|
|
22302
22364
|
|
|
22303
22365
|
// src/commands/sessions/daemon/startPidFileWatchdog.ts
|
|
22304
|
-
import { readFileSync as
|
|
22366
|
+
import { readFileSync as readFileSync44 } from "fs";
|
|
22305
22367
|
var WATCHDOG_INTERVAL_MS = 5e3;
|
|
22306
22368
|
function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
22307
22369
|
const timer = setInterval(() => {
|
|
@@ -22312,7 +22374,7 @@ function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
|
22312
22374
|
}
|
|
22313
22375
|
function ownsPidFile() {
|
|
22314
22376
|
try {
|
|
22315
|
-
return
|
|
22377
|
+
return readFileSync44(daemonPaths.pid, "utf8").trim() === String(process.pid);
|
|
22316
22378
|
} catch {
|
|
22317
22379
|
return false;
|
|
22318
22380
|
}
|