@staff0rd/assist 0.517.0 → 0.519.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 +505 -504
- package/dist/index.js +399 -298
- 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.519.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,10 @@ async function fileContent(req, res) {
|
|
|
10308
10322
|
respondJson(res, 413, { error: "File too large" });
|
|
10309
10323
|
return;
|
|
10310
10324
|
}
|
|
10311
|
-
respondJson(res, 200, {
|
|
10325
|
+
respondJson(res, 200, {
|
|
10326
|
+
content: await readFile(resolved.target, "utf8"),
|
|
10327
|
+
mtimeMs: info.mtimeMs
|
|
10328
|
+
});
|
|
10312
10329
|
} catch {
|
|
10313
10330
|
respondJson(res, 404, { error: "File not found" });
|
|
10314
10331
|
}
|
|
@@ -10647,7 +10664,7 @@ function runGit(cwd, args) {
|
|
|
10647
10664
|
}).then((r) => r.stdout.trim());
|
|
10648
10665
|
}
|
|
10649
10666
|
async function resolveSynthesisPath(cwd) {
|
|
10650
|
-
const [
|
|
10667
|
+
const [repoRoot2, branch2] = await Promise.all([
|
|
10651
10668
|
runGit(cwd, ["rev-parse", "--show-toplevel"]),
|
|
10652
10669
|
runGit(cwd, ["rev-parse", "--abbrev-ref", "HEAD"])
|
|
10653
10670
|
]);
|
|
@@ -10655,7 +10672,7 @@ async function resolveSynthesisPath(cwd) {
|
|
|
10655
10672
|
homedir13(),
|
|
10656
10673
|
".assist",
|
|
10657
10674
|
"reviews",
|
|
10658
|
-
basename8(
|
|
10675
|
+
basename8(repoRoot2)
|
|
10659
10676
|
);
|
|
10660
10677
|
return findSynthesisForBranch(repoReviewsDir, branch2);
|
|
10661
10678
|
}
|
|
@@ -12063,6 +12080,89 @@ async function uploadPrImage(req, res) {
|
|
|
12063
12080
|
}
|
|
12064
12081
|
}
|
|
12065
12082
|
|
|
12083
|
+
// src/commands/sessions/web/writeFileContent.ts
|
|
12084
|
+
import { readFile as readFile2, stat as stat3, writeFile as writeFile3 } from "fs/promises";
|
|
12085
|
+
|
|
12086
|
+
// src/commands/sessions/web/formatWithOxfmt.ts
|
|
12087
|
+
import { execFile as execFile8 } from "child_process";
|
|
12088
|
+
import { existsSync as existsSync30 } from "fs";
|
|
12089
|
+
import { dirname as dirname22, join as join30 } from "path";
|
|
12090
|
+
import { promisify as promisify8 } from "util";
|
|
12091
|
+
var execFileAsync7 = promisify8(execFile8);
|
|
12092
|
+
var TIMEOUT_MS = 15e3;
|
|
12093
|
+
function findOxfmtScript(root) {
|
|
12094
|
+
let dir = root;
|
|
12095
|
+
for (; ; ) {
|
|
12096
|
+
const candidate = join30(dir, "node_modules", "oxfmt", "bin", "oxfmt");
|
|
12097
|
+
if (existsSync30(candidate)) return candidate;
|
|
12098
|
+
const parent = dirname22(dir);
|
|
12099
|
+
if (parent === dir) return void 0;
|
|
12100
|
+
dir = parent;
|
|
12101
|
+
}
|
|
12102
|
+
}
|
|
12103
|
+
async function formatWithOxfmt(target, root) {
|
|
12104
|
+
const script = findOxfmtScript(root);
|
|
12105
|
+
if (!script) return;
|
|
12106
|
+
await execFileAsync7(process.execPath, [script, target], {
|
|
12107
|
+
cwd: root,
|
|
12108
|
+
windowsHide: true,
|
|
12109
|
+
timeout: TIMEOUT_MS
|
|
12110
|
+
}).catch(() => {
|
|
12111
|
+
});
|
|
12112
|
+
}
|
|
12113
|
+
|
|
12114
|
+
// src/commands/sessions/web/getFileWriteBody.ts
|
|
12115
|
+
async function getFileWriteBody(req, res) {
|
|
12116
|
+
let body;
|
|
12117
|
+
try {
|
|
12118
|
+
body = await readJsonBody(req);
|
|
12119
|
+
} catch {
|
|
12120
|
+
respondJson(res, 400, { error: "Invalid JSON body" });
|
|
12121
|
+
return null;
|
|
12122
|
+
}
|
|
12123
|
+
if (typeof body.content !== "string") {
|
|
12124
|
+
respondJson(res, 400, { error: "Missing content" });
|
|
12125
|
+
return null;
|
|
12126
|
+
}
|
|
12127
|
+
if (typeof body.mtimeMs !== "number") {
|
|
12128
|
+
respondJson(res, 400, { error: "Missing mtimeMs" });
|
|
12129
|
+
return null;
|
|
12130
|
+
}
|
|
12131
|
+
return { content: body.content, mtimeMs: body.mtimeMs };
|
|
12132
|
+
}
|
|
12133
|
+
|
|
12134
|
+
// src/commands/sessions/web/writeFileContent.ts
|
|
12135
|
+
var STALE_MESSAGE = "The file changed on disk since it was opened";
|
|
12136
|
+
async function currentMtimeMs(target) {
|
|
12137
|
+
try {
|
|
12138
|
+
return (await stat3(target)).mtimeMs;
|
|
12139
|
+
} catch {
|
|
12140
|
+
return null;
|
|
12141
|
+
}
|
|
12142
|
+
}
|
|
12143
|
+
async function writeFileContent(req, res) {
|
|
12144
|
+
const resolved = getFileTarget(req, res);
|
|
12145
|
+
if (!resolved) return;
|
|
12146
|
+
const body = await getFileWriteBody(req, res);
|
|
12147
|
+
if (!body) return;
|
|
12148
|
+
if (await currentMtimeMs(resolved.target) !== body.mtimeMs) {
|
|
12149
|
+
respondJson(res, 409, { error: STALE_MESSAGE });
|
|
12150
|
+
return;
|
|
12151
|
+
}
|
|
12152
|
+
try {
|
|
12153
|
+
await writeFile3(resolved.target, body.content, "utf8");
|
|
12154
|
+
await formatWithOxfmt(resolved.target, repoRoot(resolved.cwd));
|
|
12155
|
+
respondJson(res, 200, {
|
|
12156
|
+
content: await readFile2(resolved.target, "utf8"),
|
|
12157
|
+
mtimeMs: await currentMtimeMs(resolved.target)
|
|
12158
|
+
});
|
|
12159
|
+
} catch (error) {
|
|
12160
|
+
respondJson(res, 500, {
|
|
12161
|
+
error: error instanceof Error ? error.message : "Failed to write file"
|
|
12162
|
+
});
|
|
12163
|
+
}
|
|
12164
|
+
}
|
|
12165
|
+
|
|
12066
12166
|
// src/commands/sessions/web/createCssHandler.ts
|
|
12067
12167
|
import { createHash as createHash2 } from "crypto";
|
|
12068
12168
|
import { readFileSync as readFileSync22 } from "fs";
|
|
@@ -12125,6 +12225,7 @@ var routes2 = {
|
|
|
12125
12225
|
"GET /api/diff": diff2,
|
|
12126
12226
|
"GET /api/diff-scopes": diffScopes,
|
|
12127
12227
|
"GET /api/file": fileContent,
|
|
12228
|
+
"POST /api/file": writeFileContent,
|
|
12128
12229
|
"GET /api/files": listFiles,
|
|
12129
12230
|
"GET /api/jira-site": jiraSite,
|
|
12130
12231
|
"GET /api/harness": harnessCapabilities,
|
|
@@ -12755,7 +12856,7 @@ function registerAssociateJiraCommand(cmd) {
|
|
|
12755
12856
|
|
|
12756
12857
|
// src/commands/backlog/cloneRepo.ts
|
|
12757
12858
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
12758
|
-
import { existsSync as
|
|
12859
|
+
import { existsSync as existsSync31 } from "fs";
|
|
12759
12860
|
import { mkdir as mkdir3 } from "fs/promises";
|
|
12760
12861
|
import chalk69 from "chalk";
|
|
12761
12862
|
|
|
@@ -12791,7 +12892,7 @@ async function cloneRepo(originRaw) {
|
|
|
12791
12892
|
if (!target) {
|
|
12792
12893
|
return fail2(`Could not derive a repository name from "${origin}".`);
|
|
12793
12894
|
}
|
|
12794
|
-
if (
|
|
12895
|
+
if (existsSync31(target)) {
|
|
12795
12896
|
return fail2(`Clone target already exists: ${target}`);
|
|
12796
12897
|
}
|
|
12797
12898
|
await mkdir3(baseDir, { recursive: true });
|
|
@@ -12902,7 +13003,7 @@ function registerExportCommand(cmd) {
|
|
|
12902
13003
|
}
|
|
12903
13004
|
|
|
12904
13005
|
// src/commands/backlog/import/index.ts
|
|
12905
|
-
import { readFile as
|
|
13006
|
+
import { readFile as readFile3 } from "fs/promises";
|
|
12906
13007
|
import chalk74 from "chalk";
|
|
12907
13008
|
|
|
12908
13009
|
// src/commands/backlog/dump/countCopyRows.ts
|
|
@@ -13079,7 +13180,7 @@ async function restore(client, parsed) {
|
|
|
13079
13180
|
|
|
13080
13181
|
// src/commands/backlog/import/index.ts
|
|
13081
13182
|
async function importBacklog(file, options2 = {}) {
|
|
13082
|
-
const raw = file ? await
|
|
13183
|
+
const raw = file ? await readFile3(file) : await readStdinBuffer();
|
|
13083
13184
|
const parsed = parseDump(raw);
|
|
13084
13185
|
validateDump(parsed);
|
|
13085
13186
|
const { tables } = parsed.header;
|
|
@@ -13216,7 +13317,7 @@ function ensureRemoteOrigin() {
|
|
|
13216
13317
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
13217
13318
|
import { mkdtempSync, readFileSync as readFileSync23, unlinkSync as unlinkSync6, writeFileSync as writeFileSync21 } from "fs";
|
|
13218
13319
|
import { tmpdir as tmpdir2 } from "os";
|
|
13219
|
-
import { join as
|
|
13320
|
+
import { join as join31 } from "path";
|
|
13220
13321
|
import enquirer6 from "enquirer";
|
|
13221
13322
|
async function promptType() {
|
|
13222
13323
|
const { type } = await enquirer6.prompt({
|
|
@@ -13256,8 +13357,8 @@ async function promptDescription() {
|
|
|
13256
13357
|
}
|
|
13257
13358
|
function openEditor() {
|
|
13258
13359
|
const editor = process.env.EDITOR || process.env.VISUAL || "vi";
|
|
13259
|
-
const dir = mkdtempSync(
|
|
13260
|
-
const filePath =
|
|
13360
|
+
const dir = mkdtempSync(join31(tmpdir2(), "assist-"));
|
|
13361
|
+
const filePath = join31(dir, "description.md");
|
|
13261
13362
|
writeFileSync21(filePath, "");
|
|
13262
13363
|
const result = spawnSync3(editor, [filePath], { stdio: "inherit" });
|
|
13263
13364
|
if (result.status !== 0) {
|
|
@@ -15731,16 +15832,16 @@ function extractGraphqlQuery(args) {
|
|
|
15731
15832
|
}
|
|
15732
15833
|
|
|
15733
15834
|
// src/shared/loadCliReads.ts
|
|
15734
|
-
import { existsSync as
|
|
15735
|
-
import { dirname as
|
|
15835
|
+
import { existsSync as existsSync32, readFileSync as readFileSync25, writeFileSync as writeFileSync22 } from "fs";
|
|
15836
|
+
import { dirname as dirname23, resolve as resolve12 } from "path";
|
|
15736
15837
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
15737
15838
|
var __filename3 = fileURLToPath5(import.meta.url);
|
|
15738
|
-
var __dirname4 =
|
|
15839
|
+
var __dirname4 = dirname23(__filename3);
|
|
15739
15840
|
function packageRoot() {
|
|
15740
15841
|
return __dirname4;
|
|
15741
15842
|
}
|
|
15742
15843
|
function readLines(path71) {
|
|
15743
|
-
if (!
|
|
15844
|
+
if (!existsSync32(path71)) return [];
|
|
15744
15845
|
return readFileSync25(path71, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
15745
15846
|
}
|
|
15746
15847
|
var cachedReads;
|
|
@@ -15787,14 +15888,14 @@ function findCliWrite(command) {
|
|
|
15787
15888
|
}
|
|
15788
15889
|
|
|
15789
15890
|
// src/shared/readSettingsPerms.ts
|
|
15790
|
-
import { existsSync as
|
|
15891
|
+
import { existsSync as existsSync33, readFileSync as readFileSync26 } from "fs";
|
|
15791
15892
|
import { homedir as homedir14 } from "os";
|
|
15792
|
-
import { join as
|
|
15893
|
+
import { join as join32 } from "path";
|
|
15793
15894
|
function readSettingsPerms(key) {
|
|
15794
15895
|
const paths = [
|
|
15795
|
-
|
|
15796
|
-
|
|
15797
|
-
|
|
15896
|
+
join32(homedir14(), ".claude", "settings.json"),
|
|
15897
|
+
join32(process.cwd(), ".claude", "settings.json"),
|
|
15898
|
+
join32(process.cwd(), ".claude", "settings.local.json")
|
|
15798
15899
|
];
|
|
15799
15900
|
const entries = [];
|
|
15800
15901
|
for (const p of paths) {
|
|
@@ -15803,7 +15904,7 @@ function readSettingsPerms(key) {
|
|
|
15803
15904
|
return entries;
|
|
15804
15905
|
}
|
|
15805
15906
|
function readPermissionArray(filePath, key) {
|
|
15806
|
-
if (!
|
|
15907
|
+
if (!existsSync33(filePath)) return [];
|
|
15807
15908
|
try {
|
|
15808
15909
|
const data = JSON.parse(readFileSync26(filePath, "utf8"));
|
|
15809
15910
|
const arr = data?.permissions?.[key];
|
|
@@ -16003,11 +16104,11 @@ function decideCommand(toolName, rawCommand) {
|
|
|
16003
16104
|
// src/commands/cliHook/logDeniedToolCall.ts
|
|
16004
16105
|
import { mkdirSync as mkdirSync12 } from "fs";
|
|
16005
16106
|
import { homedir as homedir15 } from "os";
|
|
16006
|
-
import { join as
|
|
16107
|
+
import { join as join33 } from "path";
|
|
16007
16108
|
import Database from "better-sqlite3";
|
|
16008
16109
|
var _db;
|
|
16009
16110
|
function getDbDir() {
|
|
16010
|
-
return
|
|
16111
|
+
return join33(homedir15(), ".assist");
|
|
16011
16112
|
}
|
|
16012
16113
|
function initSchema(db) {
|
|
16013
16114
|
db.exec(`
|
|
@@ -16026,7 +16127,7 @@ function openPromptsDb(dir) {
|
|
|
16026
16127
|
if (_db) return _db;
|
|
16027
16128
|
const dbDir = dir ?? getDbDir();
|
|
16028
16129
|
mkdirSync12(dbDir, { recursive: true });
|
|
16029
|
-
const db = new Database(
|
|
16130
|
+
const db = new Database(join33(dbDir, "assist.db"));
|
|
16030
16131
|
db.pragma("journal_mode = WAL");
|
|
16031
16132
|
initSchema(db);
|
|
16032
16133
|
_db = db;
|
|
@@ -16122,9 +16223,9 @@ ${reasons.join("\n")}`);
|
|
|
16122
16223
|
}
|
|
16123
16224
|
|
|
16124
16225
|
// src/commands/permitCliReads/index.ts
|
|
16125
|
-
import { existsSync as
|
|
16226
|
+
import { existsSync as existsSync34, mkdirSync as mkdirSync13, readFileSync as readFileSync27, writeFileSync as writeFileSync23 } from "fs";
|
|
16126
16227
|
import { homedir as homedir16 } from "os";
|
|
16127
|
-
import { join as
|
|
16228
|
+
import { join as join34 } from "path";
|
|
16128
16229
|
|
|
16129
16230
|
// src/commands/permitCliReads/assertCliExists.ts
|
|
16130
16231
|
function assertCliExists(cli) {
|
|
@@ -16387,15 +16488,15 @@ function updateSettings(cli, commands) {
|
|
|
16387
16488
|
// src/commands/permitCliReads/index.ts
|
|
16388
16489
|
function logPath(cli) {
|
|
16389
16490
|
const safeName = cli.replace(/\s+/g, "-");
|
|
16390
|
-
return
|
|
16491
|
+
return join34(homedir16(), ".assist", `cli-discover-${safeName}.log`);
|
|
16391
16492
|
}
|
|
16392
16493
|
function readCache(cli) {
|
|
16393
16494
|
const path71 = logPath(cli);
|
|
16394
|
-
if (!
|
|
16495
|
+
if (!existsSync34(path71)) return void 0;
|
|
16395
16496
|
return readFileSync27(path71, "utf8");
|
|
16396
16497
|
}
|
|
16397
16498
|
function writeCache(cli, output) {
|
|
16398
|
-
const dir =
|
|
16499
|
+
const dir = join34(homedir16(), ".assist");
|
|
16399
16500
|
mkdirSync13(dir, { recursive: true });
|
|
16400
16501
|
writeFileSync23(logPath(cli), output);
|
|
16401
16502
|
}
|
|
@@ -16526,22 +16627,22 @@ function registerCliHook(program2) {
|
|
|
16526
16627
|
}
|
|
16527
16628
|
|
|
16528
16629
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
16529
|
-
import { existsSync as
|
|
16630
|
+
import { existsSync as existsSync36, readFileSync as readFileSync29, unlinkSync as unlinkSync8, writeFileSync as writeFileSync24 } from "fs";
|
|
16530
16631
|
import chalk121 from "chalk";
|
|
16531
16632
|
|
|
16532
16633
|
// src/commands/codeComment/getRestrictedDir.ts
|
|
16533
16634
|
import { homedir as homedir17 } from "os";
|
|
16534
|
-
import { join as
|
|
16635
|
+
import { join as join35 } from "path";
|
|
16535
16636
|
function getRestrictedDir() {
|
|
16536
|
-
return
|
|
16637
|
+
return join35(homedir17(), ".assist", "restricted");
|
|
16537
16638
|
}
|
|
16538
16639
|
function getPinStatePath(pin) {
|
|
16539
|
-
return
|
|
16640
|
+
return join35(getRestrictedDir(), `code-comment-${pin}.json`);
|
|
16540
16641
|
}
|
|
16541
16642
|
|
|
16542
16643
|
// src/commands/codeComment/sweepRestrictedDir.ts
|
|
16543
16644
|
import { readdirSync as readdirSync3, statSync as statSync5, unlinkSync as unlinkSync7 } from "fs";
|
|
16544
|
-
import { join as
|
|
16645
|
+
import { join as join36 } from "path";
|
|
16545
16646
|
var STALE_AFTER_MS = 30 * 60 * 1e3;
|
|
16546
16647
|
function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
16547
16648
|
let entries;
|
|
@@ -16552,7 +16653,7 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
16552
16653
|
}
|
|
16553
16654
|
const cutoff = Date.now() - STALE_AFTER_MS;
|
|
16554
16655
|
for (const entry of entries) {
|
|
16555
|
-
const path71 =
|
|
16656
|
+
const path71 = join36(dir, entry);
|
|
16556
16657
|
try {
|
|
16557
16658
|
if (statSync5(path71).mtimeMs < cutoff) unlinkSync7(path71);
|
|
16558
16659
|
} catch {
|
|
@@ -16562,10 +16663,10 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
16562
16663
|
}
|
|
16563
16664
|
|
|
16564
16665
|
// src/commands/codeComment/readPinState.ts
|
|
16565
|
-
import { existsSync as
|
|
16666
|
+
import { existsSync as existsSync35, readFileSync as readFileSync28 } from "fs";
|
|
16566
16667
|
function readPinState(pin) {
|
|
16567
16668
|
const path71 = getPinStatePath(pin);
|
|
16568
|
-
if (!
|
|
16669
|
+
if (!existsSync35(path71)) return void 0;
|
|
16569
16670
|
try {
|
|
16570
16671
|
const state = JSON.parse(readFileSync28(path71, "utf8"));
|
|
16571
16672
|
if (state.pin !== pin) return void 0;
|
|
@@ -16584,7 +16685,7 @@ function codeCommentConfirm(pin) {
|
|
|
16584
16685
|
process.exitCode = 1;
|
|
16585
16686
|
return;
|
|
16586
16687
|
}
|
|
16587
|
-
if (!
|
|
16688
|
+
if (!existsSync36(state.file)) {
|
|
16588
16689
|
console.error(chalk121.red(`Target file no longer exists: ${state.file}`));
|
|
16589
16690
|
process.exitCode = 1;
|
|
16590
16691
|
return;
|
|
@@ -17641,19 +17742,19 @@ import { unlinkSync as unlinkSync9, writeFileSync as writeFileSync26 } from "fs"
|
|
|
17641
17742
|
import chalk137 from "chalk";
|
|
17642
17743
|
|
|
17643
17744
|
// src/commands/dbMigration/getMigrationPinPath.ts
|
|
17644
|
-
import { join as
|
|
17745
|
+
import { join as join37 } from "path";
|
|
17645
17746
|
function getMigrationPinPath(pin) {
|
|
17646
|
-
return
|
|
17747
|
+
return join37(getRestrictedDir(), `db-migration-pin-${pin}.json`);
|
|
17647
17748
|
}
|
|
17648
17749
|
function getMigrationApprovalPath(migrationId) {
|
|
17649
|
-
return
|
|
17750
|
+
return join37(getRestrictedDir(), `db-migration-approval-${migrationId}.json`);
|
|
17650
17751
|
}
|
|
17651
17752
|
|
|
17652
17753
|
// src/commands/dbMigration/readMigrationPinState.ts
|
|
17653
|
-
import { existsSync as
|
|
17754
|
+
import { existsSync as existsSync37, readFileSync as readFileSync30 } from "fs";
|
|
17654
17755
|
function readMigrationPinState(pin) {
|
|
17655
17756
|
const path71 = getMigrationPinPath(pin);
|
|
17656
|
-
if (!
|
|
17757
|
+
if (!existsSync37(path71)) return void 0;
|
|
17657
17758
|
try {
|
|
17658
17759
|
const state = JSON.parse(readFileSync30(path71, "utf8"));
|
|
17659
17760
|
if (state.pin !== pin) return void 0;
|
|
@@ -17742,7 +17843,7 @@ function registerDbMigration(parent) {
|
|
|
17742
17843
|
}
|
|
17743
17844
|
|
|
17744
17845
|
// src/commands/deploy/redirect.ts
|
|
17745
|
-
import { existsSync as
|
|
17846
|
+
import { existsSync as existsSync38, readFileSync as readFileSync31, writeFileSync as writeFileSync28 } from "fs";
|
|
17746
17847
|
import chalk139 from "chalk";
|
|
17747
17848
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
17748
17849
|
if (!window.location.pathname.endsWith('/')) {
|
|
@@ -17751,7 +17852,7 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
17751
17852
|
</script>`;
|
|
17752
17853
|
function redirect() {
|
|
17753
17854
|
const indexPath = "index.html";
|
|
17754
|
-
if (!
|
|
17855
|
+
if (!existsSync38(indexPath)) {
|
|
17755
17856
|
console.log(chalk139.yellow("No index.html found"));
|
|
17756
17857
|
return;
|
|
17757
17858
|
}
|
|
@@ -17784,10 +17885,10 @@ import { basename as basename11 } from "path";
|
|
|
17784
17885
|
|
|
17785
17886
|
// src/commands/devlog/loadBlogSkipDays.ts
|
|
17786
17887
|
import { homedir as homedir18 } from "os";
|
|
17787
|
-
import { join as
|
|
17788
|
-
var BLOG_REPO_ROOT =
|
|
17888
|
+
import { join as join38 } from "path";
|
|
17889
|
+
var BLOG_REPO_ROOT = join38(homedir18(), "git/blog");
|
|
17789
17890
|
function loadBlogSkipDays(repoName) {
|
|
17790
|
-
const config = loadRawYaml(
|
|
17891
|
+
const config = loadRawYaml(join38(BLOG_REPO_ROOT, "assist.yml"));
|
|
17791
17892
|
const devlog = config.devlog;
|
|
17792
17893
|
const skip2 = devlog?.skip;
|
|
17793
17894
|
return new Set(skip2?.[repoName]);
|
|
@@ -17798,15 +17899,15 @@ import { execSync as execSync36 } from "child_process";
|
|
|
17798
17899
|
import chalk140 from "chalk";
|
|
17799
17900
|
|
|
17800
17901
|
// src/shared/getRepoName.ts
|
|
17801
|
-
import { existsSync as
|
|
17802
|
-
import { basename as basename10, join as
|
|
17902
|
+
import { existsSync as existsSync39, readFileSync as readFileSync32 } from "fs";
|
|
17903
|
+
import { basename as basename10, join as join39 } from "path";
|
|
17803
17904
|
function getRepoName() {
|
|
17804
17905
|
const config = loadConfig();
|
|
17805
17906
|
if (config.devlog?.name) {
|
|
17806
17907
|
return config.devlog.name;
|
|
17807
17908
|
}
|
|
17808
|
-
const packageJsonPath =
|
|
17809
|
-
if (
|
|
17909
|
+
const packageJsonPath = join39(process.cwd(), "package.json");
|
|
17910
|
+
if (existsSync39(packageJsonPath)) {
|
|
17810
17911
|
try {
|
|
17811
17912
|
const content = readFileSync32(packageJsonPath, "utf8");
|
|
17812
17913
|
const pkg = JSON.parse(content);
|
|
@@ -17821,8 +17922,8 @@ function getRepoName() {
|
|
|
17821
17922
|
|
|
17822
17923
|
// src/commands/devlog/loadDevlogEntries.ts
|
|
17823
17924
|
import { readdirSync as readdirSync4, readFileSync as readFileSync33 } from "fs";
|
|
17824
|
-
import { join as
|
|
17825
|
-
var DEVLOG_DIR =
|
|
17925
|
+
import { join as join40 } from "path";
|
|
17926
|
+
var DEVLOG_DIR = join40(BLOG_REPO_ROOT, "src/content/devlog");
|
|
17826
17927
|
function extractFrontmatter(content) {
|
|
17827
17928
|
const fm = content.match(/^---\n([\s\S]*?)\n---/);
|
|
17828
17929
|
return fm?.[1] ?? null;
|
|
@@ -17850,7 +17951,7 @@ function readDevlogFiles(callback) {
|
|
|
17850
17951
|
try {
|
|
17851
17952
|
const files = readdirSync4(DEVLOG_DIR).filter((f) => f.endsWith(".md"));
|
|
17852
17953
|
for (const file of files) {
|
|
17853
|
-
const content = readFileSync33(
|
|
17954
|
+
const content = readFileSync33(join40(DEVLOG_DIR, file), "utf8");
|
|
17854
17955
|
const parsed = parseFrontmatter(content, file);
|
|
17855
17956
|
if (parsed) callback(parsed);
|
|
17856
17957
|
}
|
|
@@ -18238,11 +18339,11 @@ function repos(options2) {
|
|
|
18238
18339
|
|
|
18239
18340
|
// src/commands/devlog/skip.ts
|
|
18240
18341
|
import { writeFileSync as writeFileSync29 } from "fs";
|
|
18241
|
-
import { join as
|
|
18342
|
+
import { join as join41 } from "path";
|
|
18242
18343
|
import chalk145 from "chalk";
|
|
18243
18344
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
18244
18345
|
function getBlogConfigPath() {
|
|
18245
|
-
return
|
|
18346
|
+
return join41(BLOG_REPO_ROOT, "assist.yml");
|
|
18246
18347
|
}
|
|
18247
18348
|
function skip(date) {
|
|
18248
18349
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
@@ -18304,7 +18405,7 @@ function registerDevlog(program2) {
|
|
|
18304
18405
|
|
|
18305
18406
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
18306
18407
|
import { closeSync as closeSync3, openSync as openSync3, readdirSync as readdirSync5 } from "fs";
|
|
18307
|
-
import { join as
|
|
18408
|
+
import { join as join42 } from "path";
|
|
18308
18409
|
import chalk147 from "chalk";
|
|
18309
18410
|
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "packages"]);
|
|
18310
18411
|
function isLockedDll(debugDir) {
|
|
@@ -18316,7 +18417,7 @@ function isLockedDll(debugDir) {
|
|
|
18316
18417
|
}
|
|
18317
18418
|
for (const file of files) {
|
|
18318
18419
|
if (!file.toLowerCase().endsWith(".dll")) continue;
|
|
18319
|
-
const dllPath =
|
|
18420
|
+
const dllPath = join42(debugDir, file);
|
|
18320
18421
|
try {
|
|
18321
18422
|
const fd = openSync3(dllPath, "r+");
|
|
18322
18423
|
closeSync3(fd);
|
|
@@ -18334,13 +18435,13 @@ function findFirstLockedDll(dir) {
|
|
|
18334
18435
|
return null;
|
|
18335
18436
|
}
|
|
18336
18437
|
if (entries.includes("bin")) {
|
|
18337
|
-
const locked = isLockedDll(
|
|
18438
|
+
const locked = isLockedDll(join42(dir, "bin", "Debug"));
|
|
18338
18439
|
if (locked) return locked;
|
|
18339
18440
|
}
|
|
18340
18441
|
for (const entry of entries) {
|
|
18341
18442
|
if (SKIP_DIRS.has(entry) || entry === "bin" || entry.startsWith("."))
|
|
18342
18443
|
continue;
|
|
18343
|
-
const found = findFirstLockedDll(
|
|
18444
|
+
const found = findFirstLockedDll(join42(dir, entry));
|
|
18344
18445
|
if (found) return found;
|
|
18345
18446
|
}
|
|
18346
18447
|
return null;
|
|
@@ -18374,9 +18475,9 @@ function getProjectRefs(csprojPath) {
|
|
|
18374
18475
|
}
|
|
18375
18476
|
return refs;
|
|
18376
18477
|
}
|
|
18377
|
-
function buildTree(csprojPath,
|
|
18478
|
+
function buildTree(csprojPath, repoRoot2, visited = /* @__PURE__ */ new Set()) {
|
|
18378
18479
|
const abs = path31.resolve(csprojPath);
|
|
18379
|
-
const rel = path31.relative(
|
|
18480
|
+
const rel = path31.relative(repoRoot2, abs);
|
|
18380
18481
|
const node = { path: abs, relativePath: rel, children: [] };
|
|
18381
18482
|
if (visited.has(abs)) return node;
|
|
18382
18483
|
visited.add(abs);
|
|
@@ -18385,7 +18486,7 @@ function buildTree(csprojPath, repoRoot, visited = /* @__PURE__ */ new Set()) {
|
|
|
18385
18486
|
const childAbs = path31.resolve(dir, ref);
|
|
18386
18487
|
try {
|
|
18387
18488
|
readFileSync34(childAbs);
|
|
18388
|
-
node.children.push(buildTree(childAbs,
|
|
18489
|
+
node.children.push(buildTree(childAbs, repoRoot2, visited));
|
|
18389
18490
|
} catch {
|
|
18390
18491
|
node.children.push({
|
|
18391
18492
|
path: childAbs,
|
|
@@ -18425,10 +18526,10 @@ function findSlnFiles(dir, maxDepth, depth = 0) {
|
|
|
18425
18526
|
continue;
|
|
18426
18527
|
const full = path32.join(dir, entry);
|
|
18427
18528
|
try {
|
|
18428
|
-
const
|
|
18429
|
-
if (
|
|
18529
|
+
const stat4 = statSync6(full);
|
|
18530
|
+
if (stat4.isFile() && entry.endsWith(".sln")) {
|
|
18430
18531
|
results.push(full);
|
|
18431
|
-
} else if (
|
|
18532
|
+
} else if (stat4.isDirectory()) {
|
|
18432
18533
|
results.push(...findSlnFiles(full, maxDepth, depth + 1));
|
|
18433
18534
|
}
|
|
18434
18535
|
} catch {
|
|
@@ -18436,17 +18537,17 @@ function findSlnFiles(dir, maxDepth, depth = 0) {
|
|
|
18436
18537
|
}
|
|
18437
18538
|
return results;
|
|
18438
18539
|
}
|
|
18439
|
-
function findContainingSolutions(csprojPath,
|
|
18540
|
+
function findContainingSolutions(csprojPath, repoRoot2) {
|
|
18440
18541
|
const csprojAbs = path32.resolve(csprojPath);
|
|
18441
18542
|
const csprojBasename = path32.basename(csprojAbs);
|
|
18442
|
-
const slnFiles = findSlnFiles(
|
|
18543
|
+
const slnFiles = findSlnFiles(repoRoot2, 3);
|
|
18443
18544
|
const matches = [];
|
|
18444
18545
|
const pattern2 = new RegExp(`[\\\\"/]${escapeRegex(csprojBasename)}"`);
|
|
18445
18546
|
for (const sln of slnFiles) {
|
|
18446
18547
|
try {
|
|
18447
18548
|
const content = readFileSync35(sln, "utf8");
|
|
18448
18549
|
if (pattern2.test(content)) {
|
|
18449
|
-
matches.push(path32.relative(
|
|
18550
|
+
matches.push(path32.relative(repoRoot2, sln));
|
|
18450
18551
|
}
|
|
18451
18552
|
} catch {
|
|
18452
18553
|
}
|
|
@@ -18508,29 +18609,29 @@ function printJson(tree, totalCount, solutions) {
|
|
|
18508
18609
|
}
|
|
18509
18610
|
|
|
18510
18611
|
// src/commands/dotnet/resolveCsproj.ts
|
|
18511
|
-
import { existsSync as
|
|
18612
|
+
import { existsSync as existsSync40 } from "fs";
|
|
18512
18613
|
import path33 from "path";
|
|
18513
18614
|
import chalk149 from "chalk";
|
|
18514
18615
|
function resolveCsproj(csprojPath) {
|
|
18515
18616
|
const resolved = path33.resolve(csprojPath);
|
|
18516
|
-
if (!
|
|
18617
|
+
if (!existsSync40(resolved)) {
|
|
18517
18618
|
console.error(chalk149.red(`File not found: ${resolved}`));
|
|
18518
18619
|
process.exit(1);
|
|
18519
18620
|
}
|
|
18520
|
-
const
|
|
18521
|
-
if (!
|
|
18621
|
+
const repoRoot2 = findRepoRoot(path33.dirname(resolved));
|
|
18622
|
+
if (!repoRoot2) {
|
|
18522
18623
|
console.error(chalk149.red("Could not find git repository root"));
|
|
18523
18624
|
process.exit(1);
|
|
18524
18625
|
}
|
|
18525
|
-
return { resolved, repoRoot };
|
|
18626
|
+
return { resolved, repoRoot: repoRoot2 };
|
|
18526
18627
|
}
|
|
18527
18628
|
|
|
18528
18629
|
// src/commands/dotnet/deps.ts
|
|
18529
18630
|
async function deps(csprojPath, options2) {
|
|
18530
|
-
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
18531
|
-
const tree = buildTree(resolved,
|
|
18631
|
+
const { resolved, repoRoot: repoRoot2 } = resolveCsproj(csprojPath);
|
|
18632
|
+
const tree = buildTree(resolved, repoRoot2);
|
|
18532
18633
|
const totalCount = collectAllDeps(tree).size + 1;
|
|
18533
|
-
const solutions = findContainingSolutions(resolved,
|
|
18634
|
+
const solutions = findContainingSolutions(resolved, repoRoot2);
|
|
18534
18635
|
if (options2.json) {
|
|
18535
18636
|
printJson(tree, totalCount, solutions);
|
|
18536
18637
|
} else {
|
|
@@ -18571,8 +18672,8 @@ function getChangedCsFiles(scope) {
|
|
|
18571
18672
|
// src/commands/dotnet/inSln.ts
|
|
18572
18673
|
import chalk150 from "chalk";
|
|
18573
18674
|
async function inSln(csprojPath) {
|
|
18574
|
-
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
18575
|
-
const solutions = findContainingSolutions(resolved,
|
|
18675
|
+
const { resolved, repoRoot: repoRoot2 } = resolveCsproj(csprojPath);
|
|
18676
|
+
const solutions = findContainingSolutions(resolved, repoRoot2);
|
|
18576
18677
|
if (solutions.length === 0) {
|
|
18577
18678
|
console.log(chalk150.yellow("Not found in any .sln file"));
|
|
18578
18679
|
process.exit(1);
|
|
@@ -18681,24 +18782,24 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
18681
18782
|
}
|
|
18682
18783
|
|
|
18683
18784
|
// src/commands/dotnet/resolveSolution.ts
|
|
18684
|
-
import { existsSync as
|
|
18785
|
+
import { existsSync as existsSync41 } from "fs";
|
|
18685
18786
|
import path34 from "path";
|
|
18686
18787
|
import chalk153 from "chalk";
|
|
18687
18788
|
|
|
18688
18789
|
// src/commands/dotnet/findSolution.ts
|
|
18689
18790
|
import { readdirSync as readdirSync7 } from "fs";
|
|
18690
|
-
import { dirname as
|
|
18791
|
+
import { dirname as dirname24, join as join43 } from "path";
|
|
18691
18792
|
import chalk152 from "chalk";
|
|
18692
18793
|
function findSlnInDir(dir) {
|
|
18693
18794
|
try {
|
|
18694
|
-
return readdirSync7(dir).filter((f) => f.endsWith(".sln")).map((f) =>
|
|
18795
|
+
return readdirSync7(dir).filter((f) => f.endsWith(".sln")).map((f) => join43(dir, f));
|
|
18695
18796
|
} catch {
|
|
18696
18797
|
return [];
|
|
18697
18798
|
}
|
|
18698
18799
|
}
|
|
18699
18800
|
function findSolution() {
|
|
18700
|
-
const
|
|
18701
|
-
const ceiling =
|
|
18801
|
+
const repoRoot2 = findRepoRoot(process.cwd());
|
|
18802
|
+
const ceiling = repoRoot2 ?? process.cwd();
|
|
18702
18803
|
let current = process.cwd();
|
|
18703
18804
|
while (true) {
|
|
18704
18805
|
const slnFiles = findSlnInDir(current);
|
|
@@ -18712,7 +18813,7 @@ function findSolution() {
|
|
|
18712
18813
|
process.exit(1);
|
|
18713
18814
|
}
|
|
18714
18815
|
if (current === ceiling) break;
|
|
18715
|
-
current =
|
|
18816
|
+
current = dirname24(current);
|
|
18716
18817
|
}
|
|
18717
18818
|
console.error(chalk152.red("No .sln file found between cwd and repo root"));
|
|
18718
18819
|
process.exit(1);
|
|
@@ -18722,7 +18823,7 @@ function findSolution() {
|
|
|
18722
18823
|
function resolveSolution(sln) {
|
|
18723
18824
|
if (sln) {
|
|
18724
18825
|
const resolved = path34.resolve(sln);
|
|
18725
|
-
if (!
|
|
18826
|
+
if (!existsSync41(resolved)) {
|
|
18726
18827
|
console.error(chalk153.red(`Solution file not found: ${resolved}`));
|
|
18727
18828
|
process.exit(1);
|
|
18728
18829
|
}
|
|
@@ -18762,7 +18863,7 @@ function parseInspectReport(json) {
|
|
|
18762
18863
|
|
|
18763
18864
|
// src/commands/dotnet/runInspectCode.ts
|
|
18764
18865
|
import { execSync as execSync40 } from "child_process";
|
|
18765
|
-
import { existsSync as
|
|
18866
|
+
import { existsSync as existsSync42, readFileSync as readFileSync36, unlinkSync as unlinkSync10 } from "fs";
|
|
18766
18867
|
import { tmpdir as tmpdir4 } from "os";
|
|
18767
18868
|
import path35 from "path";
|
|
18768
18869
|
import chalk154 from "chalk";
|
|
@@ -18793,7 +18894,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
18793
18894
|
console.error(chalk154.red("jb inspectcode failed"));
|
|
18794
18895
|
process.exit(1);
|
|
18795
18896
|
}
|
|
18796
|
-
if (!
|
|
18897
|
+
if (!existsSync42(reportPath)) {
|
|
18797
18898
|
console.error(chalk154.red("Report file not generated"));
|
|
18798
18899
|
process.exit(1);
|
|
18799
18900
|
}
|
|
@@ -19050,11 +19151,11 @@ function decideCommentGuard(input, existingContent) {
|
|
|
19050
19151
|
}
|
|
19051
19152
|
|
|
19052
19153
|
// src/commands/dbMigration/consumeMigrationApproval.ts
|
|
19053
|
-
import { existsSync as
|
|
19154
|
+
import { existsSync as existsSync43, unlinkSync as unlinkSync11 } from "fs";
|
|
19054
19155
|
function consumeMigrationApproval(migrationId) {
|
|
19055
19156
|
sweepRestrictedDir();
|
|
19056
19157
|
const path71 = getMigrationApprovalPath(migrationId);
|
|
19057
|
-
if (!
|
|
19158
|
+
if (!existsSync43(path71)) return false;
|
|
19058
19159
|
try {
|
|
19059
19160
|
unlinkSync11(path71);
|
|
19060
19161
|
return true;
|
|
@@ -19174,7 +19275,7 @@ function aggregateCommitters(authorLists) {
|
|
|
19174
19275
|
import { spawnSync as spawnSync4 } from "child_process";
|
|
19175
19276
|
import { unlinkSync as unlinkSync12, writeFileSync as writeFileSync30 } from "fs";
|
|
19176
19277
|
import { tmpdir as tmpdir5 } from "os";
|
|
19177
|
-
import { join as
|
|
19278
|
+
import { join as join44 } from "path";
|
|
19178
19279
|
function buildArgs2(queryFile, vars) {
|
|
19179
19280
|
const args = ["api", "graphql", "-F", `query=@${queryFile}`];
|
|
19180
19281
|
for (const [key, value] of Object.entries(vars)) {
|
|
@@ -19199,7 +19300,7 @@ function throwOnGraphqlErrors(stdout) {
|
|
|
19199
19300
|
throw new Error(messages || "GraphQL request returned errors");
|
|
19200
19301
|
}
|
|
19201
19302
|
function runGhGraphql(mutation, vars) {
|
|
19202
|
-
const queryFile =
|
|
19303
|
+
const queryFile = join44(tmpdir5(), `gh-query-${Date.now()}.graphql`);
|
|
19203
19304
|
writeFileSync30(queryFile, mutation);
|
|
19204
19305
|
try {
|
|
19205
19306
|
const result = spawnSync4("gh", buildArgs2(queryFile, vars), {
|
|
@@ -19387,24 +19488,24 @@ async function countPendingHandovers(orm, origin) {
|
|
|
19387
19488
|
|
|
19388
19489
|
// src/commands/handover/migrateDiskHandovers.ts
|
|
19389
19490
|
import {
|
|
19390
|
-
existsSync as
|
|
19491
|
+
existsSync as existsSync44,
|
|
19391
19492
|
readdirSync as readdirSync8,
|
|
19392
19493
|
readFileSync as readFileSync37,
|
|
19393
19494
|
rmSync as rmSync3,
|
|
19394
19495
|
statSync as statSync7
|
|
19395
19496
|
} from "fs";
|
|
19396
|
-
import { basename as basename12, join as
|
|
19497
|
+
import { basename as basename12, join as join47 } from "path";
|
|
19397
19498
|
|
|
19398
19499
|
// src/commands/handover/getHandoverPath.ts
|
|
19399
|
-
import { join as
|
|
19500
|
+
import { join as join45 } from "path";
|
|
19400
19501
|
function getHandoverPath(cwd = process.cwd()) {
|
|
19401
|
-
return
|
|
19502
|
+
return join45(cwd, ".assist", "HANDOVER.md");
|
|
19402
19503
|
}
|
|
19403
19504
|
|
|
19404
19505
|
// src/commands/handover/getHandoversDir.ts
|
|
19405
|
-
import { join as
|
|
19506
|
+
import { join as join46 } from "path";
|
|
19406
19507
|
function getHandoversDir(cwd = process.cwd()) {
|
|
19407
|
-
return
|
|
19508
|
+
return join46(cwd, ".assist", "handovers");
|
|
19408
19509
|
}
|
|
19409
19510
|
|
|
19410
19511
|
// src/commands/handover/parseArchiveTimestamp.ts
|
|
@@ -19442,10 +19543,10 @@ function summariseHandoverContent(content) {
|
|
|
19442
19543
|
|
|
19443
19544
|
// src/commands/handover/migrateDiskHandovers.ts
|
|
19444
19545
|
function collectMarkdown(dir) {
|
|
19445
|
-
if (!
|
|
19546
|
+
if (!existsSync44(dir)) return [];
|
|
19446
19547
|
const out = [];
|
|
19447
19548
|
for (const entry of readdirSync8(dir, { withFileTypes: true })) {
|
|
19448
|
-
const full =
|
|
19549
|
+
const full = join47(dir, entry.name);
|
|
19449
19550
|
if (entry.isDirectory()) out.push(...collectMarkdown(full));
|
|
19450
19551
|
else if (entry.isFile() && entry.name.endsWith(".md")) out.push(full);
|
|
19451
19552
|
}
|
|
@@ -19469,7 +19570,7 @@ async function migrateDiskHandovers(orm, origin, cwd = process.cwd()) {
|
|
|
19469
19570
|
migrated++;
|
|
19470
19571
|
}
|
|
19471
19572
|
const handoverPath = getHandoverPath(cwd);
|
|
19472
|
-
if (
|
|
19573
|
+
if (existsSync44(handoverPath)) {
|
|
19473
19574
|
await migrateFile(orm, origin, handoverPath, statSync7(handoverPath).mtime);
|
|
19474
19575
|
migrated++;
|
|
19475
19576
|
}
|
|
@@ -19815,18 +19916,18 @@ function recentDaemonLogLines() {
|
|
|
19815
19916
|
}
|
|
19816
19917
|
|
|
19817
19918
|
// src/commands/sessions/daemon/worktree/createWorktree.ts
|
|
19818
|
-
import { existsSync as
|
|
19819
|
-
import { basename as basename14, dirname as
|
|
19919
|
+
import { existsSync as existsSync45 } from "fs";
|
|
19920
|
+
import { basename as basename14, dirname as dirname25 } from "path";
|
|
19820
19921
|
|
|
19821
19922
|
// src/commands/sessions/daemon/worktree/planAllocation.ts
|
|
19822
|
-
import { basename as basename13, join as
|
|
19923
|
+
import { basename as basename13, join as join48 } from "path";
|
|
19823
19924
|
function planAllocation(clone, boundTreeRoots2) {
|
|
19824
19925
|
return boundTreeRoots2.has(clone) ? "spill" : "primary";
|
|
19825
19926
|
}
|
|
19826
19927
|
function nextWorktreePath(clone, base, isTaken) {
|
|
19827
19928
|
const name = basename13(clone);
|
|
19828
19929
|
for (let n = 2; n < 1e3; n++) {
|
|
19829
|
-
const candidate =
|
|
19930
|
+
const candidate = join48(base, `${name}-${n}`);
|
|
19830
19931
|
if (!isTaken(candidate)) return candidate;
|
|
19831
19932
|
}
|
|
19832
19933
|
throw new Error(`no free worktree suffix for ${clone}`);
|
|
@@ -19859,13 +19960,13 @@ function cloneHead(clone) {
|
|
|
19859
19960
|
|
|
19860
19961
|
// src/commands/sessions/daemon/worktree/createWorktree.ts
|
|
19861
19962
|
function createWorktree(clone, strategy, boundTreeRoots2) {
|
|
19862
|
-
const base = strategy.root ? expandTilde2(strategy.root) :
|
|
19963
|
+
const base = strategy.root ? expandTilde2(strategy.root) : dirname25(clone);
|
|
19863
19964
|
const registered = new Set(listWorktreePaths(clone));
|
|
19864
19965
|
const branches = new Set(listLocalBranches(clone));
|
|
19865
19966
|
const path71 = nextWorktreePath(
|
|
19866
19967
|
clone,
|
|
19867
19968
|
base,
|
|
19868
|
-
(candidate) => registered.has(candidate) ||
|
|
19969
|
+
(candidate) => registered.has(candidate) || existsSync45(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename14(candidate))
|
|
19869
19970
|
);
|
|
19870
19971
|
const start3 = worktreeStartPoint(clone, strategy.trunk);
|
|
19871
19972
|
gitSync(clone, [
|
|
@@ -19885,7 +19986,7 @@ function createWorktree(clone, strategy, boundTreeRoots2) {
|
|
|
19885
19986
|
}
|
|
19886
19987
|
|
|
19887
19988
|
// src/commands/sessions/daemon/worktree/treeDurability.ts
|
|
19888
|
-
import { existsSync as
|
|
19989
|
+
import { existsSync as existsSync46 } from "fs";
|
|
19889
19990
|
var treeIsGone = { durable: true, gone: true };
|
|
19890
19991
|
function treeDurability(state) {
|
|
19891
19992
|
if (state.dirty) return { durable: false, reason: "uncommitted changes" };
|
|
@@ -19916,14 +20017,14 @@ function* durabilityProbes() {
|
|
|
19916
20017
|
});
|
|
19917
20018
|
}
|
|
19918
20019
|
async function checkDurability(cwd) {
|
|
19919
|
-
if (!
|
|
20020
|
+
if (!existsSync46(cwd)) return treeIsGone;
|
|
19920
20021
|
const probes = durabilityProbes();
|
|
19921
20022
|
let step2 = probes.next();
|
|
19922
20023
|
while (!step2.done) step2 = probes.next(await gitResult(cwd, step2.value));
|
|
19923
20024
|
return step2.value;
|
|
19924
20025
|
}
|
|
19925
20026
|
function checkDurabilitySync(cwd) {
|
|
19926
|
-
if (!
|
|
20027
|
+
if (!existsSync46(cwd)) return treeIsGone;
|
|
19927
20028
|
const probes = durabilityProbes();
|
|
19928
20029
|
let step2 = probes.next();
|
|
19929
20030
|
while (!step2.done) step2 = probes.next(gitSyncResult(cwd, step2.value));
|
|
@@ -19973,11 +20074,11 @@ function allocateTree(requestedCwd, boundTreeRoots2, options2 = {}) {
|
|
|
19973
20074
|
if (!requestedCwd)
|
|
19974
20075
|
return { cwd: requestedCwd, kind: "primary", created: false };
|
|
19975
20076
|
if (options2.inPlace === true) return keptInPlace(requestedCwd);
|
|
19976
|
-
const
|
|
19977
|
-
const cfg = worktreeConfigFor(
|
|
20077
|
+
const repoRoot2 = findRepoRoot(requestedCwd) ?? requestedCwd;
|
|
20078
|
+
const cfg = worktreeConfigFor(repoRoot2);
|
|
19978
20079
|
if (!cfg.enabled)
|
|
19979
20080
|
return { cwd: requestedCwd, kind: "primary", created: false };
|
|
19980
|
-
const clone = mainWorktree(
|
|
20081
|
+
const clone = mainWorktree(repoRoot2) ?? repoRoot2;
|
|
19981
20082
|
const reuse = { ...options2, includeDrafts: cfg.includeDrafts };
|
|
19982
20083
|
if (mustLeaveTrunk(cfg.trunk, options2))
|
|
19983
20084
|
daemonLog(
|
|
@@ -20133,30 +20234,30 @@ function persistedTreeRoots() {
|
|
|
20133
20234
|
}
|
|
20134
20235
|
|
|
20135
20236
|
// src/commands/sessions/daemon/worktree/seedWorktree.ts
|
|
20136
|
-
import { copyFileSync, existsSync as
|
|
20137
|
-
import { dirname as
|
|
20237
|
+
import { copyFileSync, existsSync as existsSync48, mkdirSync as mkdirSync16 } from "fs";
|
|
20238
|
+
import { dirname as dirname26, join as join50 } from "path";
|
|
20138
20239
|
|
|
20139
20240
|
// src/commands/sessions/daemon/worktree/runInstall.ts
|
|
20140
20241
|
import { spawn as spawn5 } from "child_process";
|
|
20141
20242
|
|
|
20142
20243
|
// 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 (
|
|
20244
|
+
import { existsSync as existsSync47 } from "fs";
|
|
20245
|
+
import { join as join49 } from "path";
|
|
20246
|
+
function detectInstallCommand(repoRoot2) {
|
|
20247
|
+
if (!existsSync47(join49(repoRoot2, "package.json"))) return null;
|
|
20248
|
+
if (existsSync47(join49(repoRoot2, "pnpm-lock.yaml"))) return "pnpm install";
|
|
20249
|
+
if (existsSync47(join49(repoRoot2, "yarn.lock"))) return "yarn install";
|
|
20250
|
+
if (existsSync47(join49(repoRoot2, "bun.lockb"))) return "bun install";
|
|
20150
20251
|
return "npm install";
|
|
20151
20252
|
}
|
|
20152
|
-
function resolveInstallCommand(
|
|
20253
|
+
function resolveInstallCommand(repoRoot2, install) {
|
|
20153
20254
|
if (install === false) return null;
|
|
20154
20255
|
if (typeof install === "string") return install;
|
|
20155
|
-
return detectInstallCommand(
|
|
20256
|
+
return detectInstallCommand(repoRoot2);
|
|
20156
20257
|
}
|
|
20157
20258
|
|
|
20158
20259
|
// src/commands/sessions/daemon/worktree/stopInstall.ts
|
|
20159
|
-
import { execFile as
|
|
20260
|
+
import { execFile as execFile9 } from "child_process";
|
|
20160
20261
|
var running2 = /* @__PURE__ */ new Map();
|
|
20161
20262
|
function trackInstall(worktreePath, child) {
|
|
20162
20263
|
running2.set(worktreePath, child);
|
|
@@ -20175,7 +20276,7 @@ function stopInstall(worktreePath) {
|
|
|
20175
20276
|
}
|
|
20176
20277
|
function killTree(pid) {
|
|
20177
20278
|
if (process.platform === "win32") {
|
|
20178
|
-
|
|
20279
|
+
execFile9(
|
|
20179
20280
|
"taskkill",
|
|
20180
20281
|
["/T", "/F", "/PID", String(pid)],
|
|
20181
20282
|
{ windowsHide: true },
|
|
@@ -20258,11 +20359,11 @@ function seedWorktree(worktreePath, clone, onSeeded = () => {
|
|
|
20258
20359
|
}
|
|
20259
20360
|
function copyConfigFiles(worktreePath, clone, copy) {
|
|
20260
20361
|
for (const rel of copy) {
|
|
20261
|
-
const src =
|
|
20262
|
-
if (!
|
|
20263
|
-
const dest =
|
|
20362
|
+
const src = join50(clone, rel);
|
|
20363
|
+
if (!existsSync48(src)) continue;
|
|
20364
|
+
const dest = join50(worktreePath, rel);
|
|
20264
20365
|
try {
|
|
20265
|
-
mkdirSync16(
|
|
20366
|
+
mkdirSync16(dirname26(dest), { recursive: true });
|
|
20266
20367
|
copyFileSync(src, dest);
|
|
20267
20368
|
daemonLog(`worktree ${worktreePath} seeded ${rel}`);
|
|
20268
20369
|
} catch (error) {
|
|
@@ -20555,7 +20656,7 @@ function registerMermaid(program2) {
|
|
|
20555
20656
|
// src/commands/netcap/netcap.ts
|
|
20556
20657
|
import { mkdir as mkdir4 } from "fs/promises";
|
|
20557
20658
|
import { createServer as createServer2 } from "http";
|
|
20558
|
-
import { dirname as
|
|
20659
|
+
import { dirname as dirname28 } from "path";
|
|
20559
20660
|
import chalk166 from "chalk";
|
|
20560
20661
|
|
|
20561
20662
|
// src/commands/netcap/corsHeaders.ts
|
|
@@ -20632,17 +20733,17 @@ function createNetcapHandler(options2) {
|
|
|
20632
20733
|
}
|
|
20633
20734
|
|
|
20634
20735
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
20635
|
-
import { cp, readFile as
|
|
20736
|
+
import { cp, readFile as readFile4, writeFile as writeFile4 } from "fs/promises";
|
|
20636
20737
|
import { networkInterfaces } from "os";
|
|
20637
|
-
import { join as
|
|
20738
|
+
import { join as join52 } from "path";
|
|
20638
20739
|
import chalk165 from "chalk";
|
|
20639
20740
|
|
|
20640
20741
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
20641
|
-
import { dirname as
|
|
20742
|
+
import { dirname as dirname27, join as join51 } from "path";
|
|
20642
20743
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
20643
|
-
var moduleDir =
|
|
20744
|
+
var moduleDir = dirname27(fileURLToPath6(import.meta.url));
|
|
20644
20745
|
function netcapExtensionDir() {
|
|
20645
|
-
return
|
|
20746
|
+
return join51(moduleDir, "commands", "netcap", "netcap-extension");
|
|
20646
20747
|
}
|
|
20647
20748
|
|
|
20648
20749
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
@@ -20657,9 +20758,9 @@ function lanIPv4() {
|
|
|
20657
20758
|
return void 0;
|
|
20658
20759
|
}
|
|
20659
20760
|
async function configureBackground(dir, host, port, filter) {
|
|
20660
|
-
const file =
|
|
20661
|
-
const source = await
|
|
20662
|
-
await
|
|
20761
|
+
const file = join52(dir, "background.js");
|
|
20762
|
+
const source = await readFile4(file, "utf8");
|
|
20763
|
+
await writeFile4(
|
|
20663
20764
|
file,
|
|
20664
20765
|
source.replace(
|
|
20665
20766
|
/const RECEIVER = "[^"]*";/,
|
|
@@ -20697,20 +20798,20 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
20697
20798
|
}
|
|
20698
20799
|
|
|
20699
20800
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
20700
|
-
import { isAbsolute as isAbsolute3, join as
|
|
20801
|
+
import { isAbsolute as isAbsolute3, join as join54, resolve as resolve16 } from "path";
|
|
20701
20802
|
|
|
20702
20803
|
// src/commands/netcap/defaultCapturePath.ts
|
|
20703
20804
|
import { homedir as homedir19 } from "os";
|
|
20704
|
-
import { join as
|
|
20805
|
+
import { join as join53 } from "path";
|
|
20705
20806
|
function defaultCapturePath() {
|
|
20706
|
-
return
|
|
20807
|
+
return join53(homedir19(), ".assist", "netcap", "capture.jsonl");
|
|
20707
20808
|
}
|
|
20708
20809
|
|
|
20709
20810
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
20710
20811
|
function resolveNetcapOutPath(out) {
|
|
20711
20812
|
if (!out) return defaultCapturePath();
|
|
20712
20813
|
const dir = isAbsolute3(out) ? out : resolve16(process.cwd(), out);
|
|
20713
|
-
return
|
|
20814
|
+
return join54(dir, "capture.jsonl");
|
|
20714
20815
|
}
|
|
20715
20816
|
|
|
20716
20817
|
// src/commands/netcap/netcap.ts
|
|
@@ -20718,7 +20819,7 @@ async function netcap(options2) {
|
|
|
20718
20819
|
const port = Number(options2.port);
|
|
20719
20820
|
const outPath = resolveNetcapOutPath(options2.out);
|
|
20720
20821
|
const filter = options2.filter ?? "";
|
|
20721
|
-
await mkdir4(
|
|
20822
|
+
await mkdir4(dirname28(outPath), { recursive: true });
|
|
20722
20823
|
const extensionPath = await prepareExtensionForLoad(port, filter);
|
|
20723
20824
|
let count8 = 0;
|
|
20724
20825
|
const handler = createNetcapHandler({
|
|
@@ -20757,7 +20858,7 @@ netcap stopped \u2014 captured ${count8} ${count8 === 1 ? "entry" : "entries"} t
|
|
|
20757
20858
|
|
|
20758
20859
|
// src/commands/netcap/netcapExtract.ts
|
|
20759
20860
|
import { writeFileSync as writeFileSync32 } from "fs";
|
|
20760
|
-
import { join as
|
|
20861
|
+
import { join as join55 } from "path";
|
|
20761
20862
|
import chalk167 from "chalk";
|
|
20762
20863
|
|
|
20763
20864
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
@@ -21202,7 +21303,7 @@ function extractPostsFromCapture(captureFile) {
|
|
|
21202
21303
|
function netcapExtract(file) {
|
|
21203
21304
|
const captureFile = file ?? defaultCapturePath();
|
|
21204
21305
|
const posts = extractPostsFromCapture(captureFile);
|
|
21205
|
-
const outFile =
|
|
21306
|
+
const outFile = join55(captureFile, "..", "posts.json");
|
|
21206
21307
|
writeFileSync32(outFile, `${JSON.stringify(posts, null, 2)}
|
|
21207
21308
|
`);
|
|
21208
21309
|
console.log(
|
|
@@ -21727,17 +21828,17 @@ import { execSync as execSync46 } from "child_process";
|
|
|
21727
21828
|
import { execSync as execSync45 } from "child_process";
|
|
21728
21829
|
import { unlinkSync as unlinkSync14, writeFileSync as writeFileSync33 } from "fs";
|
|
21729
21830
|
import { tmpdir as tmpdir6 } from "os";
|
|
21730
|
-
import { join as
|
|
21831
|
+
import { join as join57 } from "path";
|
|
21731
21832
|
|
|
21732
21833
|
// src/commands/prs/loadCommentsCache.ts
|
|
21733
|
-
import { existsSync as
|
|
21834
|
+
import { existsSync as existsSync49, readFileSync as readFileSync40, unlinkSync as unlinkSync13 } from "fs";
|
|
21734
21835
|
import { parse as parse2 } from "yaml";
|
|
21735
21836
|
|
|
21736
21837
|
// src/commands/prs/commentsCachePath.ts
|
|
21737
21838
|
import { homedir as homedir20 } from "os";
|
|
21738
|
-
import { join as
|
|
21839
|
+
import { join as join56 } from "path";
|
|
21739
21840
|
function commentsCachePath(org, repo, prNumber) {
|
|
21740
|
-
return
|
|
21841
|
+
return join56(
|
|
21741
21842
|
homedir20(),
|
|
21742
21843
|
".assist",
|
|
21743
21844
|
"pr-comments",
|
|
@@ -21750,7 +21851,7 @@ function commentsCachePath(org, repo, prNumber) {
|
|
|
21750
21851
|
// src/commands/prs/loadCommentsCache.ts
|
|
21751
21852
|
function loadCommentsCache(org, repo, prNumber) {
|
|
21752
21853
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
21753
|
-
if (!
|
|
21854
|
+
if (!existsSync49(cachePath)) {
|
|
21754
21855
|
return null;
|
|
21755
21856
|
}
|
|
21756
21857
|
const content = readFileSync40(cachePath, "utf8");
|
|
@@ -21758,7 +21859,7 @@ function loadCommentsCache(org, repo, prNumber) {
|
|
|
21758
21859
|
}
|
|
21759
21860
|
function deleteCommentsCache(org, repo, prNumber) {
|
|
21760
21861
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
21761
|
-
if (
|
|
21862
|
+
if (existsSync49(cachePath)) {
|
|
21762
21863
|
unlinkSync13(cachePath);
|
|
21763
21864
|
console.log("No more unresolved line comments. Cache dropped.");
|
|
21764
21865
|
}
|
|
@@ -21776,7 +21877,7 @@ function replyToComment(org, repo, prNumber, commentId, message3) {
|
|
|
21776
21877
|
// src/commands/prs/resolveCommentWithReply.ts
|
|
21777
21878
|
function resolveThread(threadId) {
|
|
21778
21879
|
const mutation = `mutation($threadId: ID!) { resolveReviewThread(input: {threadId: $threadId}) { thread { isResolved } } }`;
|
|
21779
|
-
const queryFile =
|
|
21880
|
+
const queryFile = join57(tmpdir6(), `gh-mutation-${Date.now()}.graphql`);
|
|
21780
21881
|
writeFileSync33(queryFile, mutation);
|
|
21781
21882
|
try {
|
|
21782
21883
|
execSync45(
|
|
@@ -21861,10 +21962,10 @@ function fixed(commentId, sha) {
|
|
|
21861
21962
|
import { execSync as execSync47 } from "child_process";
|
|
21862
21963
|
import { unlinkSync as unlinkSync15, writeFileSync as writeFileSync34 } from "fs";
|
|
21863
21964
|
import { tmpdir as tmpdir7 } from "os";
|
|
21864
|
-
import { join as
|
|
21965
|
+
import { join as join58 } from "path";
|
|
21865
21966
|
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
21967
|
function fetchThreadIds(org, repo, prNumber) {
|
|
21867
|
-
const queryFile =
|
|
21968
|
+
const queryFile = join58(tmpdir7(), `gh-query-${Date.now()}.graphql`);
|
|
21868
21969
|
writeFileSync34(queryFile, THREAD_QUERY);
|
|
21869
21970
|
try {
|
|
21870
21971
|
const result = execSync47(
|
|
@@ -21934,15 +22035,15 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
21934
22035
|
|
|
21935
22036
|
// src/commands/prs/listComments/updateCommentsCache.ts
|
|
21936
22037
|
import { mkdirSync as mkdirSync18, writeFileSync as writeFileSync35 } from "fs";
|
|
21937
|
-
import { dirname as
|
|
22038
|
+
import { dirname as dirname29 } from "path";
|
|
21938
22039
|
import { stringify } from "yaml";
|
|
21939
22040
|
|
|
21940
22041
|
// src/commands/prs/removeStaleCommentsCaches.ts
|
|
21941
22042
|
import { readdirSync as readdirSync10, unlinkSync as unlinkSync16 } from "fs";
|
|
21942
|
-
import { join as
|
|
22043
|
+
import { join as join59 } from "path";
|
|
21943
22044
|
var STALE_PATTERN = /^pr-\d+-comments\.yaml$/;
|
|
21944
22045
|
function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
21945
|
-
const dir =
|
|
22046
|
+
const dir = join59(cwd, ".assist");
|
|
21946
22047
|
let entries;
|
|
21947
22048
|
try {
|
|
21948
22049
|
entries = readdirSync10(dir);
|
|
@@ -21950,14 +22051,14 @@ function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
|
21950
22051
|
return;
|
|
21951
22052
|
}
|
|
21952
22053
|
for (const entry of entries.filter((e) => STALE_PATTERN.test(e))) {
|
|
21953
|
-
unlinkSync16(
|
|
22054
|
+
unlinkSync16(join59(dir, entry));
|
|
21954
22055
|
}
|
|
21955
22056
|
}
|
|
21956
22057
|
|
|
21957
22058
|
// src/commands/prs/listComments/updateCommentsCache.ts
|
|
21958
22059
|
function writeCommentsCache(org, repo, prNumber, comments3) {
|
|
21959
22060
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
21960
|
-
mkdirSync18(
|
|
22061
|
+
mkdirSync18(dirname29(cachePath), { recursive: true });
|
|
21961
22062
|
const cacheData = {
|
|
21962
22063
|
prNumber,
|
|
21963
22064
|
fetchedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -24910,21 +25011,21 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
|
|
|
24910
25011
|
|
|
24911
25012
|
// src/commands/review/buildReviewPaths.ts
|
|
24912
25013
|
import { homedir as homedir21 } from "os";
|
|
24913
|
-
import { basename as basename16, join as
|
|
24914
|
-
function buildReviewPaths(
|
|
24915
|
-
const reviewDir =
|
|
25014
|
+
import { basename as basename16, join as join60 } from "path";
|
|
25015
|
+
function buildReviewPaths(repoRoot2, key) {
|
|
25016
|
+
const reviewDir = join60(
|
|
24916
25017
|
homedir21(),
|
|
24917
25018
|
".assist",
|
|
24918
25019
|
"reviews",
|
|
24919
|
-
basename16(
|
|
25020
|
+
basename16(repoRoot2),
|
|
24920
25021
|
key
|
|
24921
25022
|
);
|
|
24922
25023
|
return {
|
|
24923
25024
|
reviewDir,
|
|
24924
|
-
requestPath:
|
|
24925
|
-
claudePath:
|
|
24926
|
-
codexPath:
|
|
24927
|
-
synthesisPath:
|
|
25025
|
+
requestPath: join60(reviewDir, "request.md"),
|
|
25026
|
+
claudePath: join60(reviewDir, "claude.md"),
|
|
25027
|
+
codexPath: join60(reviewDir, "codex.md"),
|
|
25028
|
+
synthesisPath: join60(reviewDir, "synthesis.md")
|
|
24928
25029
|
};
|
|
24929
25030
|
}
|
|
24930
25031
|
|
|
@@ -25581,10 +25682,10 @@ async function handlePostSynthesis(synthesisPath, prInfo, options2) {
|
|
|
25581
25682
|
}
|
|
25582
25683
|
|
|
25583
25684
|
// src/commands/review/prepareReviewDir.ts
|
|
25584
|
-
import { existsSync as
|
|
25685
|
+
import { existsSync as existsSync50, mkdirSync as mkdirSync19, unlinkSync as unlinkSync17, writeFileSync as writeFileSync36 } from "fs";
|
|
25585
25686
|
function clearReviewFiles(paths) {
|
|
25586
25687
|
for (const path71 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
25587
|
-
if (
|
|
25688
|
+
if (existsSync50(path71)) unlinkSync17(path71);
|
|
25588
25689
|
}
|
|
25589
25690
|
}
|
|
25590
25691
|
function prepareReviewDir(paths, requestBody, force) {
|
|
@@ -25811,7 +25912,7 @@ function printReviewerFailures(results) {
|
|
|
25811
25912
|
}
|
|
25812
25913
|
|
|
25813
25914
|
// src/commands/review/runAndSynthesise.ts
|
|
25814
|
-
import { existsSync as
|
|
25915
|
+
import { existsSync as existsSync52, unlinkSync as unlinkSync19 } from "fs";
|
|
25815
25916
|
|
|
25816
25917
|
// src/commands/review/buildReviewerStdin.ts
|
|
25817
25918
|
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 +26332,7 @@ function resolveClaude(args) {
|
|
|
26231
26332
|
}
|
|
26232
26333
|
|
|
26233
26334
|
// src/commands/review/runCodexReviewer.ts
|
|
26234
|
-
import { existsSync as
|
|
26335
|
+
import { existsSync as existsSync51, unlinkSync as unlinkSync18 } from "fs";
|
|
26235
26336
|
|
|
26236
26337
|
// src/commands/review/parseCodexEvent.ts
|
|
26237
26338
|
function isItemStarted(value) {
|
|
@@ -26283,7 +26384,7 @@ async function runCodexReviewer(spec) {
|
|
|
26283
26384
|
reportReviewerToolUse(spec.name, event, spinner);
|
|
26284
26385
|
}
|
|
26285
26386
|
});
|
|
26286
|
-
if (result.exitCode !== 0 &&
|
|
26387
|
+
if (result.exitCode !== 0 && existsSync51(spec.outputPath)) {
|
|
26287
26388
|
unlinkSync18(spec.outputPath);
|
|
26288
26389
|
}
|
|
26289
26390
|
return finaliseReviewerRun({ ...spec, command }, spinner, result);
|
|
@@ -26429,7 +26530,7 @@ async function runAndSynthesise(args) {
|
|
|
26429
26530
|
console.error("Both reviewers failed; skipping synthesis.");
|
|
26430
26531
|
return { ok: false, failures };
|
|
26431
26532
|
}
|
|
26432
|
-
if (anyFresh &&
|
|
26533
|
+
if (anyFresh && existsSync52(paths.synthesisPath)) {
|
|
26433
26534
|
unlinkSync19(paths.synthesisPath);
|
|
26434
26535
|
}
|
|
26435
26536
|
const synthesisResult = await synthesise(paths, { multi });
|
|
@@ -26495,9 +26596,9 @@ function gatherChangedContext() {
|
|
|
26495
26596
|
);
|
|
26496
26597
|
process.exit(1);
|
|
26497
26598
|
}
|
|
26498
|
-
function setupReviewDir(
|
|
26599
|
+
function setupReviewDir(repoRoot2, context, force) {
|
|
26499
26600
|
const paths = buildReviewPaths(
|
|
26500
|
-
|
|
26601
|
+
repoRoot2,
|
|
26501
26602
|
`${context.branch}-${context.shortSha}`
|
|
26502
26603
|
);
|
|
26503
26604
|
const priorComments = fetchExistingComments();
|
|
@@ -26517,9 +26618,9 @@ function runPostSynthesis(synthesisPath, prInfo, options2) {
|
|
|
26517
26618
|
announce: options2.announce ?? false
|
|
26518
26619
|
});
|
|
26519
26620
|
}
|
|
26520
|
-
async function reviewPr(
|
|
26621
|
+
async function reviewPr(repoRoot2, options2) {
|
|
26521
26622
|
const context = gatherChangedContext();
|
|
26522
|
-
const paths = setupReviewDir(
|
|
26623
|
+
const paths = setupReviewDir(repoRoot2, context, options2.force ?? false);
|
|
26523
26624
|
const synthesisOk = await runReviewPipeline(paths, {
|
|
26524
26625
|
verbose: options2.verbose ?? false
|
|
26525
26626
|
});
|
|
@@ -26530,8 +26631,8 @@ async function reviewPr(repoRoot, options2) {
|
|
|
26530
26631
|
|
|
26531
26632
|
// src/commands/review/review.ts
|
|
26532
26633
|
function resolveRepoRoot() {
|
|
26533
|
-
const
|
|
26534
|
-
if (
|
|
26634
|
+
const repoRoot2 = findRepoRoot(process.cwd());
|
|
26635
|
+
if (repoRoot2) return repoRoot2;
|
|
26535
26636
|
console.error("Error: not inside a git repository.");
|
|
26536
26637
|
process.exit(1);
|
|
26537
26638
|
}
|
|
@@ -27277,27 +27378,27 @@ async function configure() {
|
|
|
27277
27378
|
}
|
|
27278
27379
|
|
|
27279
27380
|
// src/commands/transcript/list.ts
|
|
27280
|
-
import { existsSync as
|
|
27281
|
-
import { join as
|
|
27381
|
+
import { existsSync as existsSync53, readdirSync as readdirSync11, statSync as statSync9 } from "fs";
|
|
27382
|
+
import { join as join61 } from "path";
|
|
27282
27383
|
function list4() {
|
|
27283
27384
|
const { vttDir } = getTranscriptConfig();
|
|
27284
|
-
if (!
|
|
27385
|
+
if (!existsSync53(vttDir)) return;
|
|
27285
27386
|
for (const entry of readdirSync11(vttDir)) {
|
|
27286
27387
|
if (!entry.endsWith(".vtt")) continue;
|
|
27287
|
-
if (statSync9(
|
|
27388
|
+
if (statSync9(join61(vttDir, entry)).isDirectory()) continue;
|
|
27288
27389
|
console.log(entry);
|
|
27289
27390
|
}
|
|
27290
27391
|
}
|
|
27291
27392
|
|
|
27292
27393
|
// src/commands/transcript/move.ts
|
|
27293
27394
|
import {
|
|
27294
|
-
existsSync as
|
|
27395
|
+
existsSync as existsSync54,
|
|
27295
27396
|
mkdirSync as mkdirSync20,
|
|
27296
27397
|
readFileSync as readFileSync43,
|
|
27297
27398
|
renameSync as renameSync2,
|
|
27298
27399
|
writeFileSync as writeFileSync38
|
|
27299
27400
|
} from "fs";
|
|
27300
|
-
import { basename as basename17, join as
|
|
27401
|
+
import { basename as basename17, join as join62 } from "path";
|
|
27301
27402
|
|
|
27302
27403
|
// src/commands/transcript/cleanText.ts
|
|
27303
27404
|
function cleanText(text17) {
|
|
@@ -27510,9 +27611,9 @@ function convertVttToMarkdown(inputPath) {
|
|
|
27510
27611
|
return formatChatLog(messages);
|
|
27511
27612
|
}
|
|
27512
27613
|
function archiveRawVtt(vttDir, sourcePath, filename) {
|
|
27513
|
-
const processedDir =
|
|
27614
|
+
const processedDir = join62(vttDir, "processed");
|
|
27514
27615
|
mkdirSync20(processedDir, { recursive: true });
|
|
27515
|
-
renameSync2(sourcePath,
|
|
27616
|
+
renameSync2(sourcePath, join62(processedDir, filename));
|
|
27516
27617
|
}
|
|
27517
27618
|
function move(file, options2) {
|
|
27518
27619
|
const { date, client } = options2;
|
|
@@ -27522,19 +27623,19 @@ function move(file, options2) {
|
|
|
27522
27623
|
}
|
|
27523
27624
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
27524
27625
|
const filename = basename17(file);
|
|
27525
|
-
const sourcePath =
|
|
27526
|
-
if (!
|
|
27626
|
+
const sourcePath = join62(vttDir, filename);
|
|
27627
|
+
if (!existsSync54(sourcePath)) {
|
|
27527
27628
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
27528
27629
|
process.exit(1);
|
|
27529
27630
|
}
|
|
27530
27631
|
const base = basename17(filename, ".vtt").replace(/ Transcription$/, "");
|
|
27531
27632
|
const outputName = `${date} ${base}.md`;
|
|
27532
|
-
const formattedDir =
|
|
27633
|
+
const formattedDir = join62(transcriptsDir, client);
|
|
27533
27634
|
mkdirSync20(formattedDir, { recursive: true });
|
|
27534
|
-
const formattedPath =
|
|
27635
|
+
const formattedPath = join62(formattedDir, outputName);
|
|
27535
27636
|
writeFileSync38(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
|
|
27536
27637
|
archiveRawVtt(vttDir, sourcePath, filename);
|
|
27537
|
-
const summaryPath =
|
|
27638
|
+
const summaryPath = join62(summaryDir, client, outputName);
|
|
27538
27639
|
console.log(`Formatted transcript: ${formattedPath}`);
|
|
27539
27640
|
console.log(`Summary target: ${summaryPath}`);
|
|
27540
27641
|
}
|
|
@@ -27616,45 +27717,45 @@ function registerVerify(program2) {
|
|
|
27616
27717
|
|
|
27617
27718
|
// src/commands/voice/devices.ts
|
|
27618
27719
|
import { spawnSync as spawnSync6 } from "child_process";
|
|
27619
|
-
import { join as
|
|
27720
|
+
import { join as join64 } from "path";
|
|
27620
27721
|
|
|
27621
27722
|
// src/commands/voice/shared.ts
|
|
27622
27723
|
import { homedir as homedir22 } from "os";
|
|
27623
|
-
import { dirname as
|
|
27724
|
+
import { dirname as dirname31, join as join63 } from "path";
|
|
27624
27725
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
27625
|
-
var __dirname5 =
|
|
27626
|
-
var VOICE_DIR =
|
|
27726
|
+
var __dirname5 = dirname31(fileURLToPath7(import.meta.url));
|
|
27727
|
+
var VOICE_DIR = join63(homedir22(), ".assist", "voice");
|
|
27627
27728
|
var voicePaths = {
|
|
27628
27729
|
dir: VOICE_DIR,
|
|
27629
|
-
pid:
|
|
27630
|
-
log:
|
|
27631
|
-
venv:
|
|
27632
|
-
lock:
|
|
27730
|
+
pid: join63(VOICE_DIR, "voice.pid"),
|
|
27731
|
+
log: join63(VOICE_DIR, "voice.log"),
|
|
27732
|
+
venv: join63(VOICE_DIR, ".venv"),
|
|
27733
|
+
lock: join63(VOICE_DIR, "voice.lock")
|
|
27633
27734
|
};
|
|
27634
27735
|
function getPythonDir() {
|
|
27635
|
-
return
|
|
27736
|
+
return join63(__dirname5, "commands", "voice", "python");
|
|
27636
27737
|
}
|
|
27637
27738
|
function getVenvPython() {
|
|
27638
|
-
return process.platform === "win32" ?
|
|
27739
|
+
return process.platform === "win32" ? join63(voicePaths.venv, "Scripts", "python.exe") : join63(voicePaths.venv, "bin", "python");
|
|
27639
27740
|
}
|
|
27640
27741
|
function getLockDir() {
|
|
27641
27742
|
const config = loadConfig();
|
|
27642
27743
|
return config.voice?.lockDir ?? VOICE_DIR;
|
|
27643
27744
|
}
|
|
27644
27745
|
function getLockFile() {
|
|
27645
|
-
return
|
|
27746
|
+
return join63(getLockDir(), "voice.lock");
|
|
27646
27747
|
}
|
|
27647
27748
|
|
|
27648
27749
|
// src/commands/voice/devices.ts
|
|
27649
27750
|
function devices() {
|
|
27650
|
-
const script =
|
|
27751
|
+
const script = join64(getPythonDir(), "list_devices.py");
|
|
27651
27752
|
spawnSync6(getVenvPython(), [script], { stdio: "inherit" });
|
|
27652
27753
|
}
|
|
27653
27754
|
|
|
27654
27755
|
// src/commands/voice/logs.ts
|
|
27655
|
-
import { existsSync as
|
|
27756
|
+
import { existsSync as existsSync55, readFileSync as readFileSync44 } from "fs";
|
|
27656
27757
|
function logs(options2) {
|
|
27657
|
-
if (!
|
|
27758
|
+
if (!existsSync55(voicePaths.log)) {
|
|
27658
27759
|
console.log("No voice log file found");
|
|
27659
27760
|
return;
|
|
27660
27761
|
}
|
|
@@ -27682,12 +27783,12 @@ function logs(options2) {
|
|
|
27682
27783
|
// src/commands/voice/setup.ts
|
|
27683
27784
|
import { spawnSync as spawnSync7 } from "child_process";
|
|
27684
27785
|
import { mkdirSync as mkdirSync22 } from "fs";
|
|
27685
|
-
import { join as
|
|
27786
|
+
import { join as join66 } from "path";
|
|
27686
27787
|
|
|
27687
27788
|
// src/commands/voice/checkLockFile.ts
|
|
27688
27789
|
import { execSync as execSync59 } from "child_process";
|
|
27689
|
-
import { existsSync as
|
|
27690
|
-
import { join as
|
|
27790
|
+
import { existsSync as existsSync56, mkdirSync as mkdirSync21, readFileSync as readFileSync45, writeFileSync as writeFileSync39 } from "fs";
|
|
27791
|
+
import { join as join65 } from "path";
|
|
27691
27792
|
function isProcessAlive2(pid) {
|
|
27692
27793
|
try {
|
|
27693
27794
|
process.kill(pid, 0);
|
|
@@ -27698,7 +27799,7 @@ function isProcessAlive2(pid) {
|
|
|
27698
27799
|
}
|
|
27699
27800
|
function checkLockFile() {
|
|
27700
27801
|
const lockFile = getLockFile();
|
|
27701
|
-
if (!
|
|
27802
|
+
if (!existsSync56(lockFile)) return;
|
|
27702
27803
|
try {
|
|
27703
27804
|
const lock2 = JSON.parse(readFileSync45(lockFile, "utf8"));
|
|
27704
27805
|
if (lock2.pid && isProcessAlive2(lock2.pid)) {
|
|
@@ -27711,7 +27812,7 @@ function checkLockFile() {
|
|
|
27711
27812
|
}
|
|
27712
27813
|
}
|
|
27713
27814
|
function bootstrapVenv() {
|
|
27714
|
-
if (
|
|
27815
|
+
if (existsSync56(getVenvPython())) return;
|
|
27715
27816
|
console.log("Setting up Python environment...");
|
|
27716
27817
|
const pythonDir = getPythonDir();
|
|
27717
27818
|
execSync59(
|
|
@@ -27724,7 +27825,7 @@ function bootstrapVenv() {
|
|
|
27724
27825
|
}
|
|
27725
27826
|
function writeLockFile(pid) {
|
|
27726
27827
|
const lockFile = getLockFile();
|
|
27727
|
-
mkdirSync21(
|
|
27828
|
+
mkdirSync21(join65(lockFile, ".."), { recursive: true });
|
|
27728
27829
|
writeFileSync39(
|
|
27729
27830
|
lockFile,
|
|
27730
27831
|
JSON.stringify({
|
|
@@ -27740,7 +27841,7 @@ function setup() {
|
|
|
27740
27841
|
mkdirSync22(voicePaths.dir, { recursive: true });
|
|
27741
27842
|
bootstrapVenv();
|
|
27742
27843
|
console.log("\nDownloading models...\n");
|
|
27743
|
-
const script =
|
|
27844
|
+
const script = join66(getPythonDir(), "setup_models.py");
|
|
27744
27845
|
const result = spawnSync7(getVenvPython(), [script], {
|
|
27745
27846
|
stdio: "inherit",
|
|
27746
27847
|
env: { ...process.env, VOICE_LOG_FILE: voicePaths.log }
|
|
@@ -27754,7 +27855,7 @@ function setup() {
|
|
|
27754
27855
|
// src/commands/voice/start.ts
|
|
27755
27856
|
import { spawn as spawn8 } from "child_process";
|
|
27756
27857
|
import { mkdirSync as mkdirSync23, writeFileSync as writeFileSync40 } from "fs";
|
|
27757
|
-
import { join as
|
|
27858
|
+
import { join as join67 } from "path";
|
|
27758
27859
|
|
|
27759
27860
|
// src/commands/voice/buildDaemonEnv.ts
|
|
27760
27861
|
function buildDaemonEnv(options2) {
|
|
@@ -27792,7 +27893,7 @@ function start2(options2) {
|
|
|
27792
27893
|
bootstrapVenv();
|
|
27793
27894
|
const debug = options2.debug || options2.foreground || process.platform === "win32";
|
|
27794
27895
|
const env = buildDaemonEnv({ debug });
|
|
27795
|
-
const script =
|
|
27896
|
+
const script = join67(getPythonDir(), "voice_daemon.py");
|
|
27796
27897
|
const python = getVenvPython();
|
|
27797
27898
|
if (options2.foreground) {
|
|
27798
27899
|
spawnForeground(python, script, env);
|
|
@@ -27802,7 +27903,7 @@ function start2(options2) {
|
|
|
27802
27903
|
}
|
|
27803
27904
|
|
|
27804
27905
|
// src/commands/voice/status.ts
|
|
27805
|
-
import { existsSync as
|
|
27906
|
+
import { existsSync as existsSync57, readFileSync as readFileSync46 } from "fs";
|
|
27806
27907
|
function isProcessAlive3(pid) {
|
|
27807
27908
|
try {
|
|
27808
27909
|
process.kill(pid, 0);
|
|
@@ -27812,12 +27913,12 @@ function isProcessAlive3(pid) {
|
|
|
27812
27913
|
}
|
|
27813
27914
|
}
|
|
27814
27915
|
function readRecentLogs(count8) {
|
|
27815
|
-
if (!
|
|
27916
|
+
if (!existsSync57(voicePaths.log)) return [];
|
|
27816
27917
|
const lines2 = readFileSync46(voicePaths.log, "utf8").trim().split("\n");
|
|
27817
27918
|
return lines2.slice(-count8);
|
|
27818
27919
|
}
|
|
27819
27920
|
function status2() {
|
|
27820
|
-
if (!
|
|
27921
|
+
if (!existsSync57(voicePaths.pid)) {
|
|
27821
27922
|
console.log("Voice daemon: not running (no PID file)");
|
|
27822
27923
|
return;
|
|
27823
27924
|
}
|
|
@@ -27840,9 +27941,9 @@ function status2() {
|
|
|
27840
27941
|
}
|
|
27841
27942
|
|
|
27842
27943
|
// src/commands/voice/stop.ts
|
|
27843
|
-
import { existsSync as
|
|
27944
|
+
import { existsSync as existsSync58, readFileSync as readFileSync47, unlinkSync as unlinkSync20 } from "fs";
|
|
27844
27945
|
function stop2() {
|
|
27845
|
-
if (!
|
|
27946
|
+
if (!existsSync58(voicePaths.pid)) {
|
|
27846
27947
|
console.log("Voice daemon is not running (no PID file)");
|
|
27847
27948
|
return;
|
|
27848
27949
|
}
|
|
@@ -27859,7 +27960,7 @@ function stop2() {
|
|
|
27859
27960
|
}
|
|
27860
27961
|
try {
|
|
27861
27962
|
const lockFile = getLockFile();
|
|
27862
|
-
if (
|
|
27963
|
+
if (existsSync58(lockFile)) unlinkSync20(lockFile);
|
|
27863
27964
|
} catch {
|
|
27864
27965
|
}
|
|
27865
27966
|
console.log("Voice daemon stopped");
|
|
@@ -27878,7 +27979,7 @@ function registerVoice(program2) {
|
|
|
27878
27979
|
}
|
|
27879
27980
|
|
|
27880
27981
|
// src/commands/watch/readBuiltVersion.ts
|
|
27881
|
-
import { join as
|
|
27982
|
+
import { join as join68 } from "path";
|
|
27882
27983
|
|
|
27883
27984
|
// src/commands/watch/resolveUpstream.ts
|
|
27884
27985
|
import { execFileSync as execFileSync10 } from "child_process";
|
|
@@ -27924,7 +28025,7 @@ function resolveUpstream(cwd) {
|
|
|
27924
28025
|
function readBuiltVersion(cwd) {
|
|
27925
28026
|
try {
|
|
27926
28027
|
const root = runGit2(["rev-parse", "--show-toplevel"], cwd);
|
|
27927
|
-
return readPackageJson(
|
|
28028
|
+
return readPackageJson(join68(root, "package.json")).version ?? "unknown";
|
|
27928
28029
|
} catch {
|
|
27929
28030
|
return "unknown";
|
|
27930
28031
|
}
|
|
@@ -28222,7 +28323,7 @@ function resolveParams(params, cliArgs) {
|
|
|
28222
28323
|
}
|
|
28223
28324
|
|
|
28224
28325
|
// src/commands/run/resolveRunCwd.ts
|
|
28225
|
-
import { existsSync as
|
|
28326
|
+
import { existsSync as existsSync59 } from "fs";
|
|
28226
28327
|
import { resolve as resolve17 } from "path";
|
|
28227
28328
|
var MissingRunCwdError = class extends Error {
|
|
28228
28329
|
constructor(runName, cwd) {
|
|
@@ -28235,25 +28336,25 @@ var MissingRunCwdError = class extends Error {
|
|
|
28235
28336
|
function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
|
|
28236
28337
|
if (!config.cwd) return void 0;
|
|
28237
28338
|
const cwd = resolve17(baseDir, config.cwd);
|
|
28238
|
-
if (!
|
|
28339
|
+
if (!existsSync59(cwd)) throw new MissingRunCwdError(config.name, cwd);
|
|
28239
28340
|
return cwd;
|
|
28240
28341
|
}
|
|
28241
28342
|
|
|
28242
28343
|
// src/commands/run/runCommandToCompletion.ts
|
|
28243
28344
|
import { spawn as spawn9 } from "child_process";
|
|
28244
|
-
import { existsSync as
|
|
28345
|
+
import { existsSync as existsSync61 } from "fs";
|
|
28245
28346
|
|
|
28246
28347
|
// src/commands/run/resolveCommand.ts
|
|
28247
28348
|
import { execFileSync as execFileSync11 } from "child_process";
|
|
28248
|
-
import { existsSync as
|
|
28249
|
-
import { dirname as
|
|
28349
|
+
import { existsSync as existsSync60 } from "fs";
|
|
28350
|
+
import { dirname as dirname32, join as join69, resolve as resolve18 } from "path";
|
|
28250
28351
|
function resolveCommand2(command) {
|
|
28251
28352
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
28252
28353
|
try {
|
|
28253
28354
|
const gitPath = execFileSync11("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
28254
|
-
const gitRoot = resolve18(
|
|
28255
|
-
const gitBash =
|
|
28256
|
-
if (
|
|
28355
|
+
const gitRoot = resolve18(dirname32(gitPath), "..");
|
|
28356
|
+
const gitBash = join69(gitRoot, "bin", "bash.exe");
|
|
28357
|
+
if (existsSync60(gitBash)) return gitBash;
|
|
28257
28358
|
} catch {
|
|
28258
28359
|
return command;
|
|
28259
28360
|
}
|
|
@@ -28263,7 +28364,7 @@ function resolveCommand2(command) {
|
|
|
28263
28364
|
// src/commands/run/runCommandToCompletion.ts
|
|
28264
28365
|
function runCommandToCompletion(command, args, env, cwd, quiet) {
|
|
28265
28366
|
return new Promise((resolveResult) => {
|
|
28266
|
-
if (cwd && !
|
|
28367
|
+
if (cwd && !existsSync61(cwd)) {
|
|
28267
28368
|
resolveResult({
|
|
28268
28369
|
kind: "failed",
|
|
28269
28370
|
message: `Failed to execute command: cwd ${cwd} does not exist`
|
|
@@ -28653,7 +28754,7 @@ async function auth() {
|
|
|
28653
28754
|
// src/commands/roam/postRoamActivity.ts
|
|
28654
28755
|
import { execFileSync as execFileSync13 } from "child_process";
|
|
28655
28756
|
import { readdirSync as readdirSync12, readFileSync as readFileSync48, statSync as statSync10 } from "fs";
|
|
28656
|
-
import { join as
|
|
28757
|
+
import { join as join70 } from "path";
|
|
28657
28758
|
function findPortFile(roamDir) {
|
|
28658
28759
|
let entries;
|
|
28659
28760
|
try {
|
|
@@ -28662,7 +28763,7 @@ function findPortFile(roamDir) {
|
|
|
28662
28763
|
return void 0;
|
|
28663
28764
|
}
|
|
28664
28765
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
28665
|
-
const path71 =
|
|
28766
|
+
const path71 = join70(roamDir, name);
|
|
28666
28767
|
try {
|
|
28667
28768
|
return { path: path71, mtimeMs: statSync10(path71).mtimeMs };
|
|
28668
28769
|
} catch {
|
|
@@ -28674,7 +28775,7 @@ function findPortFile(roamDir) {
|
|
|
28674
28775
|
function postRoamActivity(app, event) {
|
|
28675
28776
|
const appData = process.env.APPDATA;
|
|
28676
28777
|
if (!appData) return;
|
|
28677
|
-
const portFile = findPortFile(
|
|
28778
|
+
const portFile = findPortFile(join70(appData, "Roam"));
|
|
28678
28779
|
if (!portFile) return;
|
|
28679
28780
|
let port;
|
|
28680
28781
|
try {
|
|
@@ -28807,7 +28908,7 @@ async function run3(name, args) {
|
|
|
28807
28908
|
|
|
28808
28909
|
// src/commands/run/add.ts
|
|
28809
28910
|
import { mkdirSync as mkdirSync24, writeFileSync as writeFileSync41 } from "fs";
|
|
28810
|
-
import { join as
|
|
28911
|
+
import { join as join71 } from "path";
|
|
28811
28912
|
|
|
28812
28913
|
// src/commands/run/extractOption.ts
|
|
28813
28914
|
function extractOption(args, flag) {
|
|
@@ -28868,7 +28969,7 @@ function saveNewRunConfig(name, command, args, cwd) {
|
|
|
28868
28969
|
saveConfig(config);
|
|
28869
28970
|
}
|
|
28870
28971
|
function createCommandFile(name) {
|
|
28871
|
-
const dir =
|
|
28972
|
+
const dir = join71(".claude", "commands");
|
|
28872
28973
|
mkdirSync24(dir, { recursive: true });
|
|
28873
28974
|
const content = `---
|
|
28874
28975
|
description: Run ${name}
|
|
@@ -28876,7 +28977,7 @@ description: Run ${name}
|
|
|
28876
28977
|
|
|
28877
28978
|
Run \`assist run ${name} $ARGUMENTS 2>&1\`.
|
|
28878
28979
|
`;
|
|
28879
|
-
const filePath =
|
|
28980
|
+
const filePath = join71(dir, `${name}.md`);
|
|
28880
28981
|
writeFileSync41(filePath, content);
|
|
28881
28982
|
console.log(`Created command file: ${filePath}`);
|
|
28882
28983
|
}
|
|
@@ -28932,8 +29033,8 @@ function link2() {
|
|
|
28932
29033
|
}
|
|
28933
29034
|
|
|
28934
29035
|
// src/commands/run/remove.ts
|
|
28935
|
-
import { existsSync as
|
|
28936
|
-
import { join as
|
|
29036
|
+
import { existsSync as existsSync62, unlinkSync as unlinkSync21 } from "fs";
|
|
29037
|
+
import { join as join72 } from "path";
|
|
28937
29038
|
function findRemoveIndex() {
|
|
28938
29039
|
const idx = process.argv.indexOf("remove");
|
|
28939
29040
|
if (idx === -1 || idx + 1 >= process.argv.length) return -1;
|
|
@@ -28948,8 +29049,8 @@ function parseRemoveName() {
|
|
|
28948
29049
|
return process.argv[idx + 1];
|
|
28949
29050
|
}
|
|
28950
29051
|
function deleteCommandFile(name) {
|
|
28951
|
-
const filePath =
|
|
28952
|
-
if (
|
|
29052
|
+
const filePath = join72(".claude", "commands", `${name}.md`);
|
|
29053
|
+
if (existsSync62(filePath)) {
|
|
28953
29054
|
unlinkSync21(filePath);
|
|
28954
29055
|
console.log(`Deleted command file: ${filePath}`);
|
|
28955
29056
|
}
|
|
@@ -28994,9 +29095,9 @@ function registerRun(program2) {
|
|
|
28994
29095
|
|
|
28995
29096
|
// src/commands/screenshot/index.ts
|
|
28996
29097
|
import { execSync as execSync61 } from "child_process";
|
|
28997
|
-
import { existsSync as
|
|
29098
|
+
import { existsSync as existsSync63, mkdirSync as mkdirSync25, unlinkSync as unlinkSync22, writeFileSync as writeFileSync42 } from "fs";
|
|
28998
29099
|
import { tmpdir as tmpdir8 } from "os";
|
|
28999
|
-
import { join as
|
|
29100
|
+
import { join as join73, resolve as resolve19 } from "path";
|
|
29000
29101
|
import chalk211 from "chalk";
|
|
29001
29102
|
|
|
29002
29103
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
@@ -29126,14 +29227,14 @@ Write-Output $OutputPath
|
|
|
29126
29227
|
|
|
29127
29228
|
// src/commands/screenshot/index.ts
|
|
29128
29229
|
function buildOutputPath(outputDir, processName) {
|
|
29129
|
-
if (!
|
|
29230
|
+
if (!existsSync63(outputDir)) {
|
|
29130
29231
|
mkdirSync25(outputDir, { recursive: true });
|
|
29131
29232
|
}
|
|
29132
29233
|
const timestamp6 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
29133
29234
|
return resolve19(outputDir, `${processName}-${timestamp6}.png`);
|
|
29134
29235
|
}
|
|
29135
29236
|
function runPowerShellScript(processName, outputPath) {
|
|
29136
|
-
const scriptPath =
|
|
29237
|
+
const scriptPath = join73(tmpdir8(), `assist-screenshot-${Date.now()}.ps1`);
|
|
29137
29238
|
writeFileSync42(scriptPath, captureWindowPs1, "utf8");
|
|
29138
29239
|
try {
|
|
29139
29240
|
execSync61(
|
|
@@ -29615,11 +29716,11 @@ function readDesignSystemPrompt() {
|
|
|
29615
29716
|
}
|
|
29616
29717
|
|
|
29617
29718
|
// src/commands/sessions/daemon/spawnPty.ts
|
|
29618
|
-
import { existsSync as
|
|
29719
|
+
import { existsSync as existsSync65 } from "fs";
|
|
29619
29720
|
import * as pty from "node-pty";
|
|
29620
29721
|
|
|
29621
29722
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
29622
|
-
import { chmodSync, existsSync as
|
|
29723
|
+
import { chmodSync, existsSync as existsSync64, statSync as statSync11 } from "fs";
|
|
29623
29724
|
import { createRequire as createRequire3 } from "module";
|
|
29624
29725
|
import path59 from "path";
|
|
29625
29726
|
var require4 = createRequire3(import.meta.url);
|
|
@@ -29634,7 +29735,7 @@ function ensureSpawnHelperExecutable() {
|
|
|
29634
29735
|
`${process.platform}-${process.arch}`,
|
|
29635
29736
|
"spawn-helper"
|
|
29636
29737
|
);
|
|
29637
|
-
if (!
|
|
29738
|
+
if (!existsSync64(helper)) return;
|
|
29638
29739
|
const mode = statSync11(helper).mode;
|
|
29639
29740
|
if ((mode & 73) === 0) chmodSync(helper, mode | 493);
|
|
29640
29741
|
}
|
|
@@ -29670,7 +29771,7 @@ function spawnPty(args, cwd, sessionId, extraEnv) {
|
|
|
29670
29771
|
});
|
|
29671
29772
|
}
|
|
29672
29773
|
function refuseMissingCwd(cwd, sessionId) {
|
|
29673
|
-
if (!cwd ||
|
|
29774
|
+
if (!cwd || existsSync65(cwd)) return;
|
|
29674
29775
|
daemonLog(
|
|
29675
29776
|
`${sessionId ? `session ${sessionId}` : "pty"} not spawned: working directory ${cwd} no longer exists`
|
|
29676
29777
|
);
|
|
@@ -29793,17 +29894,17 @@ function setStatus2(session, newStatus) {
|
|
|
29793
29894
|
}
|
|
29794
29895
|
|
|
29795
29896
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
29796
|
-
import { existsSync as
|
|
29897
|
+
import { existsSync as existsSync67 } from "fs";
|
|
29797
29898
|
import { basename as basename18 } from "path";
|
|
29798
29899
|
|
|
29799
29900
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
29800
|
-
import { existsSync as
|
|
29801
|
-
import { join as
|
|
29901
|
+
import { existsSync as existsSync66 } from "fs";
|
|
29902
|
+
import { join as join76 } from "path";
|
|
29802
29903
|
|
|
29803
29904
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
29804
29905
|
import { statSync as statSync12 } from "fs";
|
|
29805
29906
|
import { rm as rm2 } from "fs/promises";
|
|
29806
|
-
import { join as
|
|
29907
|
+
import { join as join75 } from "path";
|
|
29807
29908
|
async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
29808
29909
|
if (holdsAGitDirectoryRatherThanALink(worktreePath)) {
|
|
29809
29910
|
const refusal = "it is a clone of its own, not a linked worktree";
|
|
@@ -29831,7 +29932,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
|
29831
29932
|
return { removed: true };
|
|
29832
29933
|
}
|
|
29833
29934
|
function holdsAGitDirectoryRatherThanALink(worktreePath) {
|
|
29834
|
-
return statSync12(
|
|
29935
|
+
return statSync12(join75(worktreePath, ".git"), {
|
|
29835
29936
|
throwIfNoEntry: false
|
|
29836
29937
|
})?.isDirectory() === true;
|
|
29837
29938
|
}
|
|
@@ -29867,7 +29968,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
29867
29968
|
);
|
|
29868
29969
|
}
|
|
29869
29970
|
function strandedReason(worktreePath, cause) {
|
|
29870
|
-
if (!
|
|
29971
|
+
if (!existsSync66(join76(worktreePath, ".git")))
|
|
29871
29972
|
return "its .git link is already gone";
|
|
29872
29973
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
29873
29974
|
return "git no longer recognises it as a working tree";
|
|
@@ -29919,7 +30020,7 @@ function reason3(error) {
|
|
|
29919
30020
|
|
|
29920
30021
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
29921
30022
|
async function reapWorktree(worktreePath, force = false) {
|
|
29922
|
-
if (!
|
|
30023
|
+
if (!existsSync67(worktreePath)) {
|
|
29923
30024
|
forgetWorktree(worktreePath);
|
|
29924
30025
|
daemonLog(
|
|
29925
30026
|
`worktree ${worktreePath} already gone; its record was forgotten`
|
|
@@ -29944,7 +30045,7 @@ async function reapWorktree(worktreePath, force = false) {
|
|
|
29944
30045
|
}
|
|
29945
30046
|
function owningClone(worktreePath) {
|
|
29946
30047
|
const recorded = worktreeAttributionIncludingReaped(worktreePath)?.clone;
|
|
29947
|
-
if (recorded &&
|
|
30048
|
+
if (recorded && existsSync67(recorded)) return recorded;
|
|
29948
30049
|
const detected = mainWorktree(worktreePath);
|
|
29949
30050
|
if (detected) return detected;
|
|
29950
30051
|
daemonLog(
|
|
@@ -30072,12 +30173,12 @@ function closeGateApplies(sessions, session) {
|
|
|
30072
30173
|
}
|
|
30073
30174
|
|
|
30074
30175
|
// src/commands/sessions/daemon/worktree/watchGitState.ts
|
|
30075
|
-
import { existsSync as
|
|
30176
|
+
import { existsSync as existsSync68, watch } from "fs";
|
|
30076
30177
|
var DEBOUNCE_MS = 500;
|
|
30077
30178
|
var POLL_MS = 3e4;
|
|
30078
30179
|
function watchGitState(cwd, onChange) {
|
|
30079
30180
|
const common = gitCommonDir(cwd);
|
|
30080
|
-
if (!common || !
|
|
30181
|
+
if (!common || !existsSync68(common)) return void 0;
|
|
30081
30182
|
const watchers = [
|
|
30082
30183
|
watchGitDir(common, onChange),
|
|
30083
30184
|
pollGitState(cwd, onChange)
|
|
@@ -30436,13 +30537,13 @@ function isBacklogItemId(text17) {
|
|
|
30436
30537
|
}
|
|
30437
30538
|
|
|
30438
30539
|
// src/commands/sessions/daemon/generateSessionTitle.ts
|
|
30439
|
-
import { execFile as
|
|
30440
|
-
import { promisify as
|
|
30441
|
-
var
|
|
30540
|
+
import { execFile as execFile10 } from "child_process";
|
|
30541
|
+
import { promisify as promisify9 } from "util";
|
|
30542
|
+
var execFileAsync8 = promisify9(execFile10);
|
|
30442
30543
|
var SESSION_TITLE_MAX_LENGTH = 48;
|
|
30443
30544
|
async function generateSessionTitle(prompt) {
|
|
30444
30545
|
try {
|
|
30445
|
-
const { stdout } = await
|
|
30546
|
+
const { stdout } = await execFileAsync8(
|
|
30446
30547
|
"claude",
|
|
30447
30548
|
["-p", "--model", "haiku", buildPrompt4(prompt)],
|
|
30448
30549
|
{ encoding: "utf8", windowsHide: true, timeout: 3e4 }
|
|
@@ -30521,10 +30622,10 @@ function emitSessionOutput(session, clients, data) {
|
|
|
30521
30622
|
}
|
|
30522
30623
|
|
|
30523
30624
|
// src/commands/sessions/daemon/exitReason.ts
|
|
30524
|
-
import { existsSync as
|
|
30625
|
+
import { existsSync as existsSync69 } from "fs";
|
|
30525
30626
|
import { resolve as resolve20 } from "path";
|
|
30526
30627
|
function exitDetail(session) {
|
|
30527
|
-
if (session.cwd && !
|
|
30628
|
+
if (session.cwd && !existsSync69(session.cwd))
|
|
30528
30629
|
return `working directory ${session.cwd} no longer exists`;
|
|
30529
30630
|
return missingRunConfigCwd(session);
|
|
30530
30631
|
}
|
|
@@ -30538,7 +30639,7 @@ function missingRunConfigCwd(session) {
|
|
|
30538
30639
|
const config = resolveRunConfig(session.runName, dir);
|
|
30539
30640
|
if (!config?.cwd) return void 0;
|
|
30540
30641
|
const configured = resolve20(runConfigBaseDirFrom(dir), config.cwd);
|
|
30541
|
-
if (
|
|
30642
|
+
if (existsSync69(configured)) return void 0;
|
|
30542
30643
|
return `run config "${config.name}": cwd ${configured} does not exist`;
|
|
30543
30644
|
}
|
|
30544
30645
|
|
|
@@ -30555,8 +30656,8 @@ function handleFailedResume(session, exitCode, onStatusChange) {
|
|
|
30555
30656
|
}
|
|
30556
30657
|
|
|
30557
30658
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
30558
|
-
import { existsSync as
|
|
30559
|
-
import { dirname as
|
|
30659
|
+
import { existsSync as existsSync70, mkdirSync as mkdirSync26, watch as watch2 } from "fs";
|
|
30660
|
+
import { dirname as dirname34 } from "path";
|
|
30560
30661
|
|
|
30561
30662
|
// src/commands/sessions/daemon/applyReviewPause.ts
|
|
30562
30663
|
function applyReviewPause(session, activity2) {
|
|
@@ -30610,7 +30711,7 @@ var DEBOUNCE_MS2 = 50;
|
|
|
30610
30711
|
function watchActivity(session, notify2, onClaudeSessionId) {
|
|
30611
30712
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
30612
30713
|
const path71 = activityPath(session.id);
|
|
30613
|
-
const dir =
|
|
30714
|
+
const dir = dirname34(path71);
|
|
30614
30715
|
try {
|
|
30615
30716
|
mkdirSync26(dir, { recursive: true });
|
|
30616
30717
|
} catch {
|
|
@@ -30636,7 +30737,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
30636
30737
|
if (timer) clearTimeout(timer);
|
|
30637
30738
|
timer = setTimeout(read, DEBOUNCE_MS2);
|
|
30638
30739
|
});
|
|
30639
|
-
if (
|
|
30740
|
+
if (existsSync70(path71)) read();
|
|
30640
30741
|
}
|
|
30641
30742
|
function refreshActivity(session) {
|
|
30642
30743
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -31962,7 +32063,7 @@ function rearmStoppedSessions(sessions, notify2) {
|
|
|
31962
32063
|
}
|
|
31963
32064
|
|
|
31964
32065
|
// src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
|
|
31965
|
-
import { existsSync as
|
|
32066
|
+
import { existsSync as existsSync73 } from "fs";
|
|
31966
32067
|
import { basename as basename20 } from "path";
|
|
31967
32068
|
|
|
31968
32069
|
// src/commands/sessions/daemon/worktree/accountedTrees.ts
|
|
@@ -31984,10 +32085,10 @@ function accountedTrees(sessions) {
|
|
|
31984
32085
|
|
|
31985
32086
|
// src/commands/sessions/daemon/worktree/detectExistingWorktree.ts
|
|
31986
32087
|
function detectExistingWorktree(cwd) {
|
|
31987
|
-
const
|
|
31988
|
-
if (!worktreeConfigFor(
|
|
31989
|
-
const clone = mainWorktree(
|
|
31990
|
-
if (clone && clone !==
|
|
32088
|
+
const repoRoot2 = findRepoRoot(cwd) ?? cwd;
|
|
32089
|
+
if (!worktreeConfigFor(repoRoot2).enabled) return void 0;
|
|
32090
|
+
const clone = mainWorktree(repoRoot2);
|
|
32091
|
+
if (clone && clone !== repoRoot2) return { path: repoRoot2, clone };
|
|
31991
32092
|
return void 0;
|
|
31992
32093
|
}
|
|
31993
32094
|
|
|
@@ -32052,9 +32153,9 @@ function capped(lines2) {
|
|
|
32052
32153
|
}
|
|
32053
32154
|
|
|
32054
32155
|
// src/commands/sessions/daemon/worktree/reclaimVanishedWorktrees.ts
|
|
32055
|
-
import { existsSync as
|
|
32156
|
+
import { existsSync as existsSync72 } from "fs";
|
|
32056
32157
|
async function reclaimVanishedWorktrees(clone, paths) {
|
|
32057
|
-
if (!
|
|
32158
|
+
if (!existsSync72(clone)) {
|
|
32058
32159
|
for (const { path: path71 } of paths) forgetWorktree(path71);
|
|
32059
32160
|
daemonLog(
|
|
32060
32161
|
`clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
|
|
@@ -32161,7 +32262,7 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
|
32161
32262
|
const accounted = accountedTrees(sessions);
|
|
32162
32263
|
const vanished = /* @__PURE__ */ new Map();
|
|
32163
32264
|
for (const { path: path71, clone } of readWorktreeRegistry()) {
|
|
32164
|
-
if (!
|
|
32265
|
+
if (!existsSync73(path71)) {
|
|
32165
32266
|
logVanishedTree(sessions, path71);
|
|
32166
32267
|
vanished.set(clone, [
|
|
32167
32268
|
...vanished.get(clone) ?? [],
|
|
@@ -32626,13 +32727,13 @@ async function defaultConnect() {
|
|
|
32626
32727
|
}
|
|
32627
32728
|
|
|
32628
32729
|
// src/commands/sessions/daemon/hasPersistedWindowsSessions.ts
|
|
32629
|
-
import { existsSync as
|
|
32730
|
+
import { existsSync as existsSync74, readFileSync as readFileSync51 } from "fs";
|
|
32630
32731
|
import { posix } from "path";
|
|
32631
32732
|
function hasPersistedWindowsSessions() {
|
|
32632
32733
|
const sessionsFile = windowsSessionsFileFromWsl();
|
|
32633
32734
|
if (!sessionsFile) return false;
|
|
32634
32735
|
try {
|
|
32635
|
-
if (!
|
|
32736
|
+
if (!existsSync74(sessionsFile)) return false;
|
|
32636
32737
|
const data = JSON.parse(readFileSync51(sessionsFile, "utf8"));
|
|
32637
32738
|
return Array.isArray(data) && data.length > 0;
|
|
32638
32739
|
} catch (error) {
|
|
@@ -33607,9 +33708,9 @@ function safeParse2(line) {
|
|
|
33607
33708
|
}
|
|
33608
33709
|
|
|
33609
33710
|
// src/commands/sessions/daemon/repoDirExists.ts
|
|
33610
|
-
import { existsSync as
|
|
33711
|
+
import { existsSync as existsSync75 } from "fs";
|
|
33611
33712
|
function repoDirExists(cwd) {
|
|
33612
|
-
return
|
|
33713
|
+
return existsSync75(toGitCwd(cwd));
|
|
33613
33714
|
}
|
|
33614
33715
|
|
|
33615
33716
|
// src/commands/sessions/daemon/withRepoGroups.ts
|
|
@@ -34169,16 +34270,16 @@ function buildLimitsSegment(rateLimits) {
|
|
|
34169
34270
|
|
|
34170
34271
|
// src/commands/readGitBranch.ts
|
|
34171
34272
|
import { readFileSync as readFileSync54, statSync as statSync14 } from "fs";
|
|
34172
|
-
import { isAbsolute as isAbsolute4, join as
|
|
34273
|
+
import { isAbsolute as isAbsolute4, join as join78, resolve as resolve21 } from "path";
|
|
34173
34274
|
function resolveGitDir(cwd) {
|
|
34174
|
-
const dotGit =
|
|
34175
|
-
let
|
|
34275
|
+
const dotGit = join78(cwd, ".git");
|
|
34276
|
+
let stat4;
|
|
34176
34277
|
try {
|
|
34177
|
-
|
|
34278
|
+
stat4 = statSync14(dotGit);
|
|
34178
34279
|
} catch {
|
|
34179
34280
|
return null;
|
|
34180
34281
|
}
|
|
34181
|
-
if (
|
|
34282
|
+
if (stat4.isDirectory()) {
|
|
34182
34283
|
return dotGit;
|
|
34183
34284
|
}
|
|
34184
34285
|
let contents;
|
|
@@ -34201,7 +34302,7 @@ function readGitBranch(cwd) {
|
|
|
34201
34302
|
}
|
|
34202
34303
|
let head;
|
|
34203
34304
|
try {
|
|
34204
|
-
head = readFileSync54(
|
|
34305
|
+
head = readFileSync54(join78(gitDir, "HEAD"), "utf8");
|
|
34205
34306
|
} catch {
|
|
34206
34307
|
return null;
|
|
34207
34308
|
}
|