@staff0rd/assist 0.1059.0 → 0.1059.2
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/built-version +1 -0
- package/dist/commands/sessions/web/bundle.js +2 -2
- package/dist/index.js +774 -682
- 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.1059.
|
|
9
|
+
version: "0.1059.2",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -12979,6 +12979,12 @@ function unsetConfig(req, res) {
|
|
|
12979
12979
|
});
|
|
12980
12980
|
}
|
|
12981
12981
|
|
|
12982
|
+
// src/commands/watch/isBuildPending.ts
|
|
12983
|
+
import { existsSync as existsSync25 } from "fs";
|
|
12984
|
+
|
|
12985
|
+
// src/commands/watch/gitMarkerPath.ts
|
|
12986
|
+
import { resolve as resolve11 } from "path";
|
|
12987
|
+
|
|
12982
12988
|
// src/commands/watch/resolveUpstream.ts
|
|
12983
12989
|
import { execFileSync as execFileSync4 } from "child_process";
|
|
12984
12990
|
function runGit3(args, cwd) {
|
|
@@ -13020,9 +13026,17 @@ function resolveUpstream(cwd) {
|
|
|
13020
13026
|
}
|
|
13021
13027
|
}
|
|
13022
13028
|
|
|
13023
|
-
// src/commands/watch/
|
|
13024
|
-
function
|
|
13025
|
-
return
|
|
13029
|
+
// src/commands/watch/gitMarkerPath.ts
|
|
13030
|
+
function gitMarkerPath(name, cwd) {
|
|
13031
|
+
return resolve11(
|
|
13032
|
+
cwd ?? process.cwd(),
|
|
13033
|
+
runGit3(["rev-parse", "--git-path", name], cwd)
|
|
13034
|
+
);
|
|
13035
|
+
}
|
|
13036
|
+
|
|
13037
|
+
// src/commands/watch/buildPendingPath.ts
|
|
13038
|
+
function buildPendingPath(cwd) {
|
|
13039
|
+
return gitMarkerPath("assist-watch-build-pending", cwd);
|
|
13026
13040
|
}
|
|
13027
13041
|
|
|
13028
13042
|
// src/commands/watch/readBuiltVersion.ts
|
|
@@ -13082,6 +13096,36 @@ function readBuiltVersion(cwd) {
|
|
|
13082
13096
|
}
|
|
13083
13097
|
}
|
|
13084
13098
|
|
|
13099
|
+
// src/commands/watch/readDistVersion.ts
|
|
13100
|
+
import { readFileSync as readFileSync10 } from "fs";
|
|
13101
|
+
import { join as join29 } from "path";
|
|
13102
|
+
function readDistVersion(cwd) {
|
|
13103
|
+
try {
|
|
13104
|
+
const root2 = runGit3(["rev-parse", "--show-toplevel"], cwd);
|
|
13105
|
+
return readFileSync10(join29(root2, "dist", "built-version"), "utf8").trim();
|
|
13106
|
+
} catch {
|
|
13107
|
+
return void 0;
|
|
13108
|
+
}
|
|
13109
|
+
}
|
|
13110
|
+
|
|
13111
|
+
// src/commands/watch/isDistBehind.ts
|
|
13112
|
+
function isDistBehind(cwd) {
|
|
13113
|
+
const dist = readDistVersion(cwd);
|
|
13114
|
+
return dist !== void 0 && dist !== readBuiltVersion(cwd);
|
|
13115
|
+
}
|
|
13116
|
+
|
|
13117
|
+
// src/commands/watch/isBuildPending.ts
|
|
13118
|
+
function markedPending(cwd) {
|
|
13119
|
+
try {
|
|
13120
|
+
return existsSync25(buildPendingPath(cwd));
|
|
13121
|
+
} catch {
|
|
13122
|
+
return false;
|
|
13123
|
+
}
|
|
13124
|
+
}
|
|
13125
|
+
function isBuildPending(cwd) {
|
|
13126
|
+
return markedPending(cwd) || isDistBehind(cwd);
|
|
13127
|
+
}
|
|
13128
|
+
|
|
13085
13129
|
// src/commands/extension/extensionUpdateStatus.ts
|
|
13086
13130
|
import semver from "semver";
|
|
13087
13131
|
function extensionUpdateStatus(connected, latest2) {
|
|
@@ -13099,17 +13143,17 @@ function extensionUpdateStatus(connected, latest2) {
|
|
|
13099
13143
|
|
|
13100
13144
|
// src/commands/extension/fetchLatestSignedExtension.ts
|
|
13101
13145
|
import { readFile as readFile2 } from "fs/promises";
|
|
13102
|
-
import { join as
|
|
13146
|
+
import { join as join31 } from "path";
|
|
13103
13147
|
|
|
13104
13148
|
// src/commands/extension/extensionDir.ts
|
|
13105
|
-
import { existsSync as
|
|
13106
|
-
import { dirname as dirname14, join as
|
|
13149
|
+
import { existsSync as existsSync26 } from "fs";
|
|
13150
|
+
import { dirname as dirname14, join as join30 } from "path";
|
|
13107
13151
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
13108
13152
|
var moduleDir = dirname14(fileURLToPath2(import.meta.url));
|
|
13109
13153
|
function extensionDir() {
|
|
13110
|
-
const bundled =
|
|
13111
|
-
if (
|
|
13112
|
-
return
|
|
13154
|
+
const bundled = join30(moduleDir, "commands", "extension", "extension");
|
|
13155
|
+
if (existsSync26(bundled)) return bundled;
|
|
13156
|
+
return join30(moduleDir, "..", "..", "..", "extension");
|
|
13113
13157
|
}
|
|
13114
13158
|
|
|
13115
13159
|
// src/commands/extension/latestUpdate.ts
|
|
@@ -13121,7 +13165,7 @@ function latestUpdate(manifest, updates2) {
|
|
|
13121
13165
|
// src/commands/extension/fetchLatestSignedExtension.ts
|
|
13122
13166
|
async function fetchLatestSignedExtension() {
|
|
13123
13167
|
const manifest = await readFile2(
|
|
13124
|
-
|
|
13168
|
+
join31(extensionDir(), "manifest.json"),
|
|
13125
13169
|
"utf8"
|
|
13126
13170
|
);
|
|
13127
13171
|
const updateUrl = JSON.parse(manifest).browser_specific_settings.gecko.update_url;
|
|
@@ -13173,6 +13217,7 @@ function targetsSince(commit2, target, changedSince2) {
|
|
|
13173
13217
|
return commit2 !== void 0 && restartTargets(changedSince2(commit2)).includes(target);
|
|
13174
13218
|
}
|
|
13175
13219
|
function pendingRestarts(input) {
|
|
13220
|
+
if (input.buildPending) return [];
|
|
13176
13221
|
const { daemonVersion, built, changedSince: changedSince2 } = input;
|
|
13177
13222
|
const daemon = daemonVersion !== void 0 && (built !== "unknown" && daemonVersion !== built || targetsSince(input.daemonStartCommit, "daemon", changedSince2));
|
|
13178
13223
|
const web3 = targetsSince(input.webStartCommit, "webserver", changedSince2);
|
|
@@ -13194,16 +13239,16 @@ function stripAnsi(text20) {
|
|
|
13194
13239
|
// src/commands/sessions/daemon/worktree/watcherLogPath.ts
|
|
13195
13240
|
import { createHash } from "crypto";
|
|
13196
13241
|
import { homedir as homedir13 } from "os";
|
|
13197
|
-
import { basename as basename10, join as
|
|
13242
|
+
import { basename as basename10, join as join32 } from "path";
|
|
13198
13243
|
|
|
13199
13244
|
// src/commands/sessions/daemon/worktree/canonicalTreePath.ts
|
|
13200
13245
|
import { realpathSync } from "fs";
|
|
13201
|
-
import { resolve as
|
|
13246
|
+
import { resolve as resolve12 } from "path";
|
|
13202
13247
|
function canonicalTreePath(path109) {
|
|
13203
13248
|
try {
|
|
13204
13249
|
return realpathSync(path109);
|
|
13205
13250
|
} catch {
|
|
13206
|
-
return
|
|
13251
|
+
return resolve12(path109);
|
|
13207
13252
|
}
|
|
13208
13253
|
}
|
|
13209
13254
|
|
|
@@ -13211,8 +13256,8 @@ function canonicalTreePath(path109) {
|
|
|
13211
13256
|
function watcherLogPath(cwd) {
|
|
13212
13257
|
const clone = canonicalTreePath(cwd);
|
|
13213
13258
|
const key = createHash("sha1").update(clone).digest("hex").slice(0, 8);
|
|
13214
|
-
const dir = process.env.ASSIST_WATCHER_LOG_DIR ??
|
|
13215
|
-
return
|
|
13259
|
+
const dir = process.env.ASSIST_WATCHER_LOG_DIR ?? join32(homedir13(), ".assist", "watchers");
|
|
13260
|
+
return join32(dir, `${basename10(clone) || "root"}-${key}.log`);
|
|
13216
13261
|
}
|
|
13217
13262
|
|
|
13218
13263
|
// src/commands/sessions/web/updates/readUpdateHistory.ts
|
|
@@ -13239,7 +13284,12 @@ var webStartCommit = {
|
|
|
13239
13284
|
value: () => captured
|
|
13240
13285
|
};
|
|
13241
13286
|
|
|
13242
|
-
// src/commands/
|
|
13287
|
+
// src/commands/watch/changedPaths.ts
|
|
13288
|
+
function changedPaths(from, cwd) {
|
|
13289
|
+
return runGit3(["diff", "--name-only", `${from}..HEAD`], cwd).split("\n").filter((line) => line.length > 0);
|
|
13290
|
+
}
|
|
13291
|
+
|
|
13292
|
+
// src/commands/sessions/web/updates/changedSince.ts
|
|
13243
13293
|
function changedSince(installDir) {
|
|
13244
13294
|
return (commit2) => {
|
|
13245
13295
|
try {
|
|
@@ -13249,6 +13299,8 @@ function changedSince(installDir) {
|
|
|
13249
13299
|
}
|
|
13250
13300
|
};
|
|
13251
13301
|
}
|
|
13302
|
+
|
|
13303
|
+
// src/commands/sessions/web/updates/updates.ts
|
|
13252
13304
|
async function updates(_req, res) {
|
|
13253
13305
|
const installDir = getInstallDir();
|
|
13254
13306
|
const reply2 = await requestDaemonReply(
|
|
@@ -13256,16 +13308,19 @@ async function updates(_req, res) {
|
|
|
13256
13308
|
"auto-update"
|
|
13257
13309
|
);
|
|
13258
13310
|
const built = readBuiltVersion(installDir);
|
|
13311
|
+
const buildPending = isBuildPending(installDir);
|
|
13259
13312
|
const status2 = {
|
|
13260
13313
|
nodeName: resolveNodeName(),
|
|
13261
13314
|
installDir,
|
|
13262
13315
|
running: reply2?.version ?? ASSIST_VERSION,
|
|
13263
13316
|
built,
|
|
13317
|
+
buildPending,
|
|
13264
13318
|
restart: pendingRestarts({
|
|
13265
13319
|
daemonVersion: reply2?.version,
|
|
13266
13320
|
daemonStartCommit: reply2?.startCommit,
|
|
13267
13321
|
webStartCommit: webStartCommit.value(),
|
|
13268
13322
|
built,
|
|
13323
|
+
buildPending,
|
|
13269
13324
|
changedSince: changedSince(installDir)
|
|
13270
13325
|
}),
|
|
13271
13326
|
daemonReachable: reply2 !== void 0,
|
|
@@ -13331,7 +13386,7 @@ async function readRequestBuffer(req, limit) {
|
|
|
13331
13386
|
|
|
13332
13387
|
// src/commands/sessions/web/stageAttachment.ts
|
|
13333
13388
|
import { mkdir, mkdtemp, writeFile } from "fs/promises";
|
|
13334
|
-
import { extname as extname2, join as
|
|
13389
|
+
import { extname as extname2, join as join33 } from "path";
|
|
13335
13390
|
|
|
13336
13391
|
// src/commands/sessions/web/ghAttachableExtensions.ts
|
|
13337
13392
|
var ghAttachableExtensions = /* @__PURE__ */ new Set([
|
|
@@ -13363,9 +13418,9 @@ function safeBaseName(name) {
|
|
|
13363
13418
|
async function stageAttachment(name, contentType, body) {
|
|
13364
13419
|
const ext = pickExtension(name, contentType);
|
|
13365
13420
|
await mkdir(stagedAttachmentsDir, { recursive: true });
|
|
13366
|
-
const dir = await mkdtemp(
|
|
13421
|
+
const dir = await mkdtemp(join33(stagedAttachmentsDir, "upload-"));
|
|
13367
13422
|
const alt = safeBaseName(name);
|
|
13368
|
-
const filePath =
|
|
13423
|
+
const filePath = join33(dir, `${alt}.${ext}`);
|
|
13369
13424
|
await writeFile(filePath, body);
|
|
13370
13425
|
return { dir, filePath, alt };
|
|
13371
13426
|
}
|
|
@@ -13414,16 +13469,16 @@ import { readFile as readFile3, stat as stat3, writeFile as writeFile2 } from "f
|
|
|
13414
13469
|
|
|
13415
13470
|
// src/commands/sessions/web/formatWithOxfmt.ts
|
|
13416
13471
|
import { execFile as execFile9 } from "child_process";
|
|
13417
|
-
import { existsSync as
|
|
13418
|
-
import { dirname as dirname15, join as
|
|
13472
|
+
import { existsSync as existsSync27 } from "fs";
|
|
13473
|
+
import { dirname as dirname15, join as join34 } from "path";
|
|
13419
13474
|
import { promisify as promisify10 } from "util";
|
|
13420
13475
|
var execFileAsync9 = promisify10(execFile9);
|
|
13421
13476
|
var TIMEOUT_MS = 15e3;
|
|
13422
13477
|
function findOxfmtScript(root2) {
|
|
13423
13478
|
let dir = root2;
|
|
13424
13479
|
for (; ; ) {
|
|
13425
|
-
const candidate =
|
|
13426
|
-
if (
|
|
13480
|
+
const candidate = join34(dir, "node_modules", "oxfmt", "bin", "oxfmt");
|
|
13481
|
+
if (existsSync27(candidate)) return candidate;
|
|
13427
13482
|
const parent = dirname15(dir);
|
|
13428
13483
|
if (parent === dir) return void 0;
|
|
13429
13484
|
dir = parent;
|
|
@@ -13494,16 +13549,16 @@ async function writeFileContent(req, res) {
|
|
|
13494
13549
|
|
|
13495
13550
|
// src/shared/createBundleHandler.ts
|
|
13496
13551
|
import { createHash as createHash2 } from "crypto";
|
|
13497
|
-
import { readFileSync as
|
|
13498
|
-
import { dirname as dirname16, join as
|
|
13552
|
+
import { readFileSync as readFileSync11, statSync as statSync7 } from "fs";
|
|
13553
|
+
import { dirname as dirname16, join as join35 } from "path";
|
|
13499
13554
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
13500
13555
|
function createBundleHandler(importMetaUrl, bundlePath, contentType = "application/javascript") {
|
|
13501
|
-
const file =
|
|
13556
|
+
const file = join35(dirname16(fileURLToPath3(importMetaUrl)), bundlePath);
|
|
13502
13557
|
let cache7;
|
|
13503
13558
|
return (req, res) => {
|
|
13504
13559
|
const mtimeMs = statSync7(file).mtimeMs;
|
|
13505
13560
|
if (cache7?.mtimeMs !== mtimeMs) {
|
|
13506
|
-
const body =
|
|
13561
|
+
const body = readFileSync11(file);
|
|
13507
13562
|
const etag = `"${createHash2("sha256").update(body).digest("hex").slice(0, 16)}"`;
|
|
13508
13563
|
cache7 = { body, etag, mtimeMs };
|
|
13509
13564
|
}
|
|
@@ -13526,7 +13581,7 @@ function createBundleHandler(importMetaUrl, bundlePath, contentType = "applicati
|
|
|
13526
13581
|
|
|
13527
13582
|
// src/commands/sessions/web/createCssHandler.ts
|
|
13528
13583
|
import { createHash as createHash3 } from "crypto";
|
|
13529
|
-
import { readFileSync as
|
|
13584
|
+
import { readFileSync as readFileSync12 } from "fs";
|
|
13530
13585
|
import { createRequire } from "module";
|
|
13531
13586
|
var require2 = createRequire(import.meta.url);
|
|
13532
13587
|
function createCssHandler(packageEntry) {
|
|
@@ -13534,7 +13589,7 @@ function createCssHandler(packageEntry) {
|
|
|
13534
13589
|
return (req, res) => {
|
|
13535
13590
|
if (!cache7) {
|
|
13536
13591
|
const resolved = require2.resolve(packageEntry);
|
|
13537
|
-
const body =
|
|
13592
|
+
const body = readFileSync12(resolved, "utf8");
|
|
13538
13593
|
const etag = `"${createHash3("sha256").update(body).digest("hex").slice(0, 16)}"`;
|
|
13539
13594
|
cache7 = { body, etag };
|
|
13540
13595
|
}
|
|
@@ -13940,9 +13995,9 @@ function originForCwd(cwd) {
|
|
|
13940
13995
|
}
|
|
13941
13996
|
|
|
13942
13997
|
// src/commands/sessions/daemon/repoDirExists.ts
|
|
13943
|
-
import { existsSync as
|
|
13998
|
+
import { existsSync as existsSync28 } from "fs";
|
|
13944
13999
|
function repoDirExists(cwd) {
|
|
13945
|
-
return
|
|
14000
|
+
return existsSync28(cwd);
|
|
13946
14001
|
}
|
|
13947
14002
|
|
|
13948
14003
|
// src/commands/sessions/daemon/worktree/git.ts
|
|
@@ -14139,7 +14194,7 @@ async function web(options2) {
|
|
|
14139
14194
|
|
|
14140
14195
|
// src/commands/new/registerNew/newCli.ts
|
|
14141
14196
|
import { execSync as execSync12 } from "child_process";
|
|
14142
|
-
import { basename as basename11, resolve as
|
|
14197
|
+
import { basename as basename11, resolve as resolve15 } from "path";
|
|
14143
14198
|
|
|
14144
14199
|
// src/commands/verify/init.ts
|
|
14145
14200
|
import chalk30 from "chalk";
|
|
@@ -14445,17 +14500,17 @@ import * as path16 from "path";
|
|
|
14445
14500
|
import chalk21 from "chalk";
|
|
14446
14501
|
|
|
14447
14502
|
// src/commands/verify/addToKnipIgnoreBinaries.ts
|
|
14448
|
-
import { existsSync as
|
|
14449
|
-
import { join as
|
|
14503
|
+
import { existsSync as existsSync29, readFileSync as readFileSync13, writeFileSync as writeFileSync7 } from "fs";
|
|
14504
|
+
import { join as join36 } from "path";
|
|
14450
14505
|
import chalk20 from "chalk";
|
|
14451
14506
|
function loadKnipConfig(knipJsonPath) {
|
|
14452
|
-
if (
|
|
14453
|
-
return JSON.parse(
|
|
14507
|
+
if (existsSync29(knipJsonPath)) {
|
|
14508
|
+
return JSON.parse(readFileSync13(knipJsonPath, "utf8"));
|
|
14454
14509
|
}
|
|
14455
14510
|
return { $schema: "https://unpkg.com/knip@5/schema.json" };
|
|
14456
14511
|
}
|
|
14457
14512
|
function addToKnipIgnoreBinaries(cwd, binary) {
|
|
14458
|
-
const knipJsonPath =
|
|
14513
|
+
const knipJsonPath = join36(cwd, "knip.json");
|
|
14459
14514
|
try {
|
|
14460
14515
|
const knipConfig = loadKnipConfig(knipJsonPath);
|
|
14461
14516
|
const ignoreBinaries = knipConfig.ignoreBinaries ?? [];
|
|
@@ -14502,7 +14557,7 @@ import * as path18 from "path";
|
|
|
14502
14557
|
import chalk26 from "chalk";
|
|
14503
14558
|
|
|
14504
14559
|
// src/commands/format/init.ts
|
|
14505
|
-
import { existsSync as
|
|
14560
|
+
import { existsSync as existsSync30, readFileSync as readFileSync14, writeFileSync as writeFileSync8 } from "fs";
|
|
14506
14561
|
import chalk24 from "chalk";
|
|
14507
14562
|
|
|
14508
14563
|
// src/shared/promptConfirm.ts
|
|
@@ -14564,7 +14619,7 @@ async function init() {
|
|
|
14564
14619
|
const newContent = `${JSON.stringify(oxfmtrc_template_default, null, " ")}
|
|
14565
14620
|
`;
|
|
14566
14621
|
const configPath = ".oxfmtrc.json";
|
|
14567
|
-
const oldContent =
|
|
14622
|
+
const oldContent = existsSync30(configPath) ? readFileSync14(configPath, "utf8") : "";
|
|
14568
14623
|
if (oldContent === newContent) {
|
|
14569
14624
|
console.log(".oxfmtrc.json already has the baseline formatter config");
|
|
14570
14625
|
return;
|
|
@@ -14587,15 +14642,15 @@ async function init() {
|
|
|
14587
14642
|
}
|
|
14588
14643
|
|
|
14589
14644
|
// src/commands/lint/init.ts
|
|
14590
|
-
import { existsSync as
|
|
14645
|
+
import { existsSync as existsSync33, readFileSync as readFileSync16, writeFileSync as writeFileSync10 } from "fs";
|
|
14591
14646
|
import chalk25 from "chalk";
|
|
14592
14647
|
|
|
14593
14648
|
// src/shared/removeEslint.ts
|
|
14594
14649
|
import { execSync as execSync7 } from "child_process";
|
|
14595
|
-
import { existsSync as
|
|
14650
|
+
import { existsSync as existsSync32, readFileSync as readFileSync15, writeFileSync as writeFileSync9 } from "fs";
|
|
14596
14651
|
|
|
14597
14652
|
// src/shared/removeEslint/removeEslintConfigFiles.ts
|
|
14598
|
-
import { existsSync as
|
|
14653
|
+
import { existsSync as existsSync31, unlinkSync as unlinkSync2 } from "fs";
|
|
14599
14654
|
var ESLINT_CONFIG_FILES = [
|
|
14600
14655
|
"eslint.config.js",
|
|
14601
14656
|
"eslint.config.mjs",
|
|
@@ -14611,7 +14666,7 @@ var ESLINT_CONFIG_FILES = [
|
|
|
14611
14666
|
function removeEslintConfigFiles() {
|
|
14612
14667
|
let removed = false;
|
|
14613
14668
|
for (const configFile of ESLINT_CONFIG_FILES) {
|
|
14614
|
-
if (
|
|
14669
|
+
if (existsSync31(configFile)) {
|
|
14615
14670
|
unlinkSync2(configFile);
|
|
14616
14671
|
console.log(`Removed ${configFile}`);
|
|
14617
14672
|
removed = true;
|
|
@@ -14633,10 +14688,10 @@ function removeEslint(options2 = {}) {
|
|
|
14633
14688
|
}
|
|
14634
14689
|
function removeEslintFromPackageJson(options2) {
|
|
14635
14690
|
const packageJsonPath = "package.json";
|
|
14636
|
-
if (!
|
|
14691
|
+
if (!existsSync32(packageJsonPath)) {
|
|
14637
14692
|
return false;
|
|
14638
14693
|
}
|
|
14639
|
-
const packageJson = JSON.parse(
|
|
14694
|
+
const packageJson = JSON.parse(readFileSync15(packageJsonPath, "utf8"));
|
|
14640
14695
|
let modified = false;
|
|
14641
14696
|
modified = removeEslintDeps(packageJson.dependencies) || modified;
|
|
14642
14697
|
modified = removeEslintDeps(packageJson.devDependencies) || modified;
|
|
@@ -14700,7 +14755,7 @@ async function writeOxlintConfig() {
|
|
|
14700
14755
|
const newContent = `${JSON.stringify(oxlintrc_template_default, null, " ")}
|
|
14701
14756
|
`;
|
|
14702
14757
|
const configPath = ".oxlintrc.json";
|
|
14703
|
-
const oldContent =
|
|
14758
|
+
const oldContent = existsSync33(configPath) ? readFileSync16(configPath, "utf8") : "";
|
|
14704
14759
|
if (oldContent === newContent) {
|
|
14705
14760
|
console.log(".oxlintrc.json already has the baseline linter config");
|
|
14706
14761
|
return;
|
|
@@ -15466,7 +15521,7 @@ program.parse();
|
|
|
15466
15521
|
|
|
15467
15522
|
// src/commands/new/registerNew/newCli.ts
|
|
15468
15523
|
async function newCli() {
|
|
15469
|
-
const name = basename11(
|
|
15524
|
+
const name = basename11(resolve15("."));
|
|
15470
15525
|
initGit();
|
|
15471
15526
|
initPackageJson(name);
|
|
15472
15527
|
console.log("Installing dependencies...");
|
|
@@ -15481,7 +15536,7 @@ async function newCli() {
|
|
|
15481
15536
|
|
|
15482
15537
|
// src/commands/new/registerNew/newProject.ts
|
|
15483
15538
|
import { execSync as execSync14 } from "child_process";
|
|
15484
|
-
import { existsSync as
|
|
15539
|
+
import { existsSync as existsSync38, readFileSync as readFileSync20, writeFileSync as writeFileSync17 } from "fs";
|
|
15485
15540
|
|
|
15486
15541
|
// src/commands/deploy/init.ts
|
|
15487
15542
|
import { execSync as execSync13 } from "child_process";
|
|
@@ -15489,33 +15544,33 @@ import chalk36 from "chalk";
|
|
|
15489
15544
|
import enquirer3 from "enquirer";
|
|
15490
15545
|
|
|
15491
15546
|
// src/commands/deploy/init/updateWorkflow.ts
|
|
15492
|
-
import { existsSync as
|
|
15493
|
-
import { dirname as dirname24, join as
|
|
15547
|
+
import { existsSync as existsSync37, mkdirSync as mkdirSync9, readFileSync as readFileSync19, writeFileSync as writeFileSync16 } from "fs";
|
|
15548
|
+
import { dirname as dirname24, join as join43 } from "path";
|
|
15494
15549
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
15495
15550
|
import chalk35 from "chalk";
|
|
15496
15551
|
var WORKFLOW_PATH = ".github/workflows/build.yml";
|
|
15497
15552
|
var __dirname3 = dirname24(fileURLToPath4(import.meta.url));
|
|
15498
15553
|
function getExistingSiteId() {
|
|
15499
|
-
if (!
|
|
15554
|
+
if (!existsSync37(WORKFLOW_PATH)) {
|
|
15500
15555
|
return null;
|
|
15501
15556
|
}
|
|
15502
|
-
const content =
|
|
15557
|
+
const content = readFileSync19(WORKFLOW_PATH, "utf8");
|
|
15503
15558
|
const match = content.match(/-s\s+([a-f0-9-]{36})/);
|
|
15504
15559
|
return match ? match[1] : null;
|
|
15505
15560
|
}
|
|
15506
15561
|
function getTemplateContent(siteId) {
|
|
15507
|
-
const templatePath =
|
|
15508
|
-
const template =
|
|
15562
|
+
const templatePath = join43(__dirname3, "commands/deploy/build.yml");
|
|
15563
|
+
const template = readFileSync19(templatePath, "utf8");
|
|
15509
15564
|
return template.replace("{{NETLIFY_SITE_ID}}", siteId);
|
|
15510
15565
|
}
|
|
15511
15566
|
async function updateWorkflow(siteId) {
|
|
15512
15567
|
const newContent = getTemplateContent(siteId);
|
|
15513
15568
|
const workflowDir = ".github/workflows";
|
|
15514
|
-
if (!
|
|
15569
|
+
if (!existsSync37(workflowDir)) {
|
|
15515
15570
|
mkdirSync9(workflowDir, { recursive: true });
|
|
15516
15571
|
}
|
|
15517
|
-
if (
|
|
15518
|
-
const oldContent =
|
|
15572
|
+
if (existsSync37(WORKFLOW_PATH)) {
|
|
15573
|
+
const oldContent = readFileSync19(WORKFLOW_PATH, "utf8");
|
|
15519
15574
|
if (oldContent === newContent) {
|
|
15520
15575
|
console.log(chalk35.green("build.yml is already up to date"));
|
|
15521
15576
|
return;
|
|
@@ -15609,11 +15664,11 @@ async function newProject() {
|
|
|
15609
15664
|
}
|
|
15610
15665
|
function addViteBaseConfig() {
|
|
15611
15666
|
const viteConfigPath = "vite.config.ts";
|
|
15612
|
-
if (!
|
|
15667
|
+
if (!existsSync38(viteConfigPath)) {
|
|
15613
15668
|
console.log("No vite.config.ts found, skipping base config");
|
|
15614
15669
|
return;
|
|
15615
15670
|
}
|
|
15616
|
-
const content =
|
|
15671
|
+
const content = readFileSync20(viteConfigPath, "utf8");
|
|
15617
15672
|
if (content.includes("base:")) {
|
|
15618
15673
|
console.log("vite.config.ts already has base config");
|
|
15619
15674
|
return;
|
|
@@ -15811,18 +15866,18 @@ function adviceContextFor(cwd, env = process.env) {
|
|
|
15811
15866
|
}
|
|
15812
15867
|
|
|
15813
15868
|
// src/commands/advise/loadAdviceFragments.ts
|
|
15814
|
-
import { readdirSync as readdirSync7, readFileSync as
|
|
15815
|
-
import { basename as basename12, join as
|
|
15869
|
+
import { readdirSync as readdirSync7, readFileSync as readFileSync21 } from "fs";
|
|
15870
|
+
import { basename as basename12, join as join45 } from "path";
|
|
15816
15871
|
|
|
15817
15872
|
// src/commands/advise/adviceDir.ts
|
|
15818
|
-
import { existsSync as
|
|
15819
|
-
import { dirname as dirname25, join as
|
|
15873
|
+
import { existsSync as existsSync39 } from "fs";
|
|
15874
|
+
import { dirname as dirname25, join as join44 } from "path";
|
|
15820
15875
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
15821
15876
|
function adviceDir() {
|
|
15822
15877
|
let current = dirname25(fileURLToPath5(import.meta.url));
|
|
15823
15878
|
while (current !== dirname25(current)) {
|
|
15824
|
-
const candidate =
|
|
15825
|
-
if (
|
|
15879
|
+
const candidate = join44(current, "claude", "advice");
|
|
15880
|
+
if (existsSync39(candidate)) return candidate;
|
|
15826
15881
|
current = dirname25(current);
|
|
15827
15882
|
}
|
|
15828
15883
|
throw new Error("Could not locate the shipped claude/advice directory");
|
|
@@ -15854,7 +15909,7 @@ function loadAdviceFragments(dir = adviceDir()) {
|
|
|
15854
15909
|
return readdirSync7(dir).filter((file) => file.endsWith(".md")).sort().map(
|
|
15855
15910
|
(file) => parseAdviceFragment(
|
|
15856
15911
|
basename12(file, ".md"),
|
|
15857
|
-
|
|
15912
|
+
readFileSync21(join45(dir, file), "utf8")
|
|
15858
15913
|
)
|
|
15859
15914
|
);
|
|
15860
15915
|
}
|
|
@@ -15888,13 +15943,13 @@ function renderAdviceBody(fragment, context) {
|
|
|
15888
15943
|
}
|
|
15889
15944
|
|
|
15890
15945
|
// src/commands/advise/adviceConditions.ts
|
|
15891
|
-
import { existsSync as
|
|
15892
|
-
import { join as
|
|
15946
|
+
import { existsSync as existsSync40 } from "fs";
|
|
15947
|
+
import { join as join46 } from "path";
|
|
15893
15948
|
function repoFile(file, label) {
|
|
15894
15949
|
return {
|
|
15895
15950
|
whenMet: `the repo has ${label}`,
|
|
15896
15951
|
whenUnmet: `the repo has no ${label}`,
|
|
15897
|
-
matches: ({ rootDir }) =>
|
|
15952
|
+
matches: ({ rootDir }) => existsSync40(join46(rootDir, file))
|
|
15898
15953
|
};
|
|
15899
15954
|
}
|
|
15900
15955
|
var adviceConditions = {
|
|
@@ -15920,11 +15975,11 @@ var adviceConditions = {
|
|
|
15920
15975
|
},
|
|
15921
15976
|
typescript: repoFile("tsconfig.json", "a tsconfig.json"),
|
|
15922
15977
|
filenameConvention: repoFile(
|
|
15923
|
-
|
|
15978
|
+
join46("oxlint-rules", "filenameConvention.ts"),
|
|
15924
15979
|
"oxlint-rules/filenameConvention.ts"
|
|
15925
15980
|
),
|
|
15926
15981
|
claudeSettings: repoFile(
|
|
15927
|
-
|
|
15982
|
+
join46("claude", "settings.json"),
|
|
15928
15983
|
"claude/settings.json"
|
|
15929
15984
|
),
|
|
15930
15985
|
verify: {
|
|
@@ -16532,7 +16587,7 @@ async function resolveCheckBump(check2) {
|
|
|
16532
16587
|
}
|
|
16533
16588
|
|
|
16534
16589
|
// src/commands/backlog/readJsonPayload.ts
|
|
16535
|
-
import { readFileSync as
|
|
16590
|
+
import { readFileSync as readFileSync22 } from "fs";
|
|
16536
16591
|
import chalk38 from "chalk";
|
|
16537
16592
|
function fail(message3) {
|
|
16538
16593
|
console.error(chalk38.red(message3));
|
|
@@ -16544,7 +16599,7 @@ function describe(error) {
|
|
|
16544
16599
|
async function readSource(source) {
|
|
16545
16600
|
try {
|
|
16546
16601
|
if (source === "-") return (await readStdinBuffer()).toString("utf8");
|
|
16547
|
-
return
|
|
16602
|
+
return readFileSync22(source, "utf8");
|
|
16548
16603
|
} catch (error) {
|
|
16549
16604
|
return fail(
|
|
16550
16605
|
`Cannot read the payload from ${source === "-" ? "stdin" : source}: ${describe(error)}`
|
|
@@ -16804,7 +16859,7 @@ function registerAskQuestion(program) {
|
|
|
16804
16859
|
|
|
16805
16860
|
// src/commands/registerBackup.ts
|
|
16806
16861
|
import { mkdir as mkdir3, stat as stat4 } from "fs/promises";
|
|
16807
|
-
import { join as
|
|
16862
|
+
import { join as join48, resolve as resolve16 } from "path";
|
|
16808
16863
|
import chalk41 from "chalk";
|
|
16809
16864
|
|
|
16810
16865
|
// src/shared/db/recordBackup.ts
|
|
@@ -16818,7 +16873,7 @@ async function recordBackup(db, {
|
|
|
16818
16873
|
|
|
16819
16874
|
// src/commands/backup/scheduleBackup.ts
|
|
16820
16875
|
import { mkdir as mkdir2 } from "fs/promises";
|
|
16821
|
-
import { join as
|
|
16876
|
+
import { join as join47 } from "path";
|
|
16822
16877
|
import chalk39 from "chalk";
|
|
16823
16878
|
|
|
16824
16879
|
// src/commands/backup/readCrontab.ts
|
|
@@ -16960,7 +17015,7 @@ async function scheduleBackup({
|
|
|
16960
17015
|
const cronExpr = durationToCron(every);
|
|
16961
17016
|
const dir = expandTilde(loadConfig().backup.dir);
|
|
16962
17017
|
await mkdir2(dir, { recursive: true });
|
|
16963
|
-
const logPath2 =
|
|
17018
|
+
const logPath2 = join47(dir, "cron.log");
|
|
16964
17019
|
const cronLine = `${cronExpr} ${resolveAssistCommand()} backup >> ${logPath2} 2>&1`;
|
|
16965
17020
|
writeCrontab(upsertScheduleBlock(readCrontab(), every, cronLine));
|
|
16966
17021
|
console.error(
|
|
@@ -17139,7 +17194,7 @@ async function backup({ out }) {
|
|
|
17139
17194
|
await mkdir3(dir, { recursive: true });
|
|
17140
17195
|
const start2 = Date.now();
|
|
17141
17196
|
const timestamp9 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
17142
|
-
const filePath =
|
|
17197
|
+
const filePath = resolve16(join48(dir, `backup-${timestamp9}.dump`));
|
|
17143
17198
|
await exportBacklog(filePath);
|
|
17144
17199
|
const { size } = await stat4(filePath);
|
|
17145
17200
|
const durationMs = Date.now() - start2;
|
|
@@ -17650,7 +17705,7 @@ function registerAssociateJiraCommand(cmd) {
|
|
|
17650
17705
|
|
|
17651
17706
|
// src/commands/backlog/cloneRepo.ts
|
|
17652
17707
|
import { spawnSync as spawnSync4 } from "child_process";
|
|
17653
|
-
import { existsSync as
|
|
17708
|
+
import { existsSync as existsSync42 } from "fs";
|
|
17654
17709
|
import { mkdir as mkdir4 } from "fs/promises";
|
|
17655
17710
|
import chalk48 from "chalk";
|
|
17656
17711
|
|
|
@@ -17686,7 +17741,7 @@ async function cloneRepo(originRaw) {
|
|
|
17686
17741
|
if (!target) {
|
|
17687
17742
|
return fail3(`Could not derive a repository name from "${origin}".`);
|
|
17688
17743
|
}
|
|
17689
|
-
if (
|
|
17744
|
+
if (existsSync42(target)) {
|
|
17690
17745
|
return fail3(`Clone target already exists: ${target}`);
|
|
17691
17746
|
}
|
|
17692
17747
|
await mkdir4(baseDir, { recursive: true });
|
|
@@ -18035,9 +18090,9 @@ function ensureRemoteOrigin() {
|
|
|
18035
18090
|
|
|
18036
18091
|
// src/commands/backlog/add/shared.ts
|
|
18037
18092
|
import { spawnSync as spawnSync5 } from "child_process";
|
|
18038
|
-
import { mkdtempSync, readFileSync as
|
|
18093
|
+
import { mkdtempSync, readFileSync as readFileSync23, unlinkSync as unlinkSync3, writeFileSync as writeFileSync18 } from "fs";
|
|
18039
18094
|
import { tmpdir } from "os";
|
|
18040
|
-
import { join as
|
|
18095
|
+
import { join as join50 } from "path";
|
|
18041
18096
|
import enquirer4 from "enquirer";
|
|
18042
18097
|
async function promptType() {
|
|
18043
18098
|
const { type } = await enquirer4.prompt({
|
|
@@ -18077,15 +18132,15 @@ async function promptDescription() {
|
|
|
18077
18132
|
}
|
|
18078
18133
|
function openEditor() {
|
|
18079
18134
|
const editor = process.env.EDITOR || process.env.VISUAL || "vi";
|
|
18080
|
-
const dir = mkdtempSync(
|
|
18081
|
-
const filePath =
|
|
18135
|
+
const dir = mkdtempSync(join50(tmpdir(), "assist-"));
|
|
18136
|
+
const filePath = join50(dir, "description.md");
|
|
18082
18137
|
writeFileSync18(filePath, "");
|
|
18083
18138
|
const result = spawnSync5(editor, [filePath], { stdio: "inherit" });
|
|
18084
18139
|
if (result.status !== 0) {
|
|
18085
18140
|
unlinkSync3(filePath);
|
|
18086
18141
|
return void 0;
|
|
18087
18142
|
}
|
|
18088
|
-
const content =
|
|
18143
|
+
const content = readFileSync23(filePath, "utf8").trim();
|
|
18089
18144
|
unlinkSync3(filePath);
|
|
18090
18145
|
return content || void 0;
|
|
18091
18146
|
}
|
|
@@ -18512,11 +18567,11 @@ function startProposedRun(id) {
|
|
|
18512
18567
|
import { randomUUID as randomUUID9 } from "crypto";
|
|
18513
18568
|
|
|
18514
18569
|
// src/commands/backlog/propose/mutateLedger.ts
|
|
18515
|
-
import { mkdirSync as mkdirSync10, readFileSync as
|
|
18570
|
+
import { mkdirSync as mkdirSync10, readFileSync as readFileSync24, renameSync as renameSync4, writeFileSync as writeFileSync19 } from "fs";
|
|
18516
18571
|
import { dirname as dirname26 } from "path";
|
|
18517
18572
|
function readLedger(path109) {
|
|
18518
18573
|
try {
|
|
18519
|
-
const parsed = JSON.parse(
|
|
18574
|
+
const parsed = JSON.parse(readFileSync24(path109, "utf8"));
|
|
18520
18575
|
return { open: parsed.open ?? [], created: parsed.created };
|
|
18521
18576
|
} catch {
|
|
18522
18577
|
return { open: [] };
|
|
@@ -18556,9 +18611,9 @@ async function findPredecessor(path109, token, startedAt) {
|
|
|
18556
18611
|
|
|
18557
18612
|
// src/commands/backlog/propose/proposalLedgerPath.ts
|
|
18558
18613
|
import { homedir as homedir14 } from "os";
|
|
18559
|
-
import { join as
|
|
18614
|
+
import { join as join51 } from "path";
|
|
18560
18615
|
function proposalLedgerPath(sessionId2) {
|
|
18561
|
-
return
|
|
18616
|
+
return join51(homedir14(), ".assist", "proposals", `session-${sessionId2}.json`);
|
|
18562
18617
|
}
|
|
18563
18618
|
|
|
18564
18619
|
// src/commands/backlog/propose/trackProposal.ts
|
|
@@ -18914,8 +18969,8 @@ import chalk69 from "chalk";
|
|
|
18914
18969
|
|
|
18915
18970
|
// src/shared/waitForIndexUnlocked.ts
|
|
18916
18971
|
import { execSync as execSync18 } from "child_process";
|
|
18917
|
-
import { existsSync as
|
|
18918
|
-
import { resolve as
|
|
18972
|
+
import { existsSync as existsSync43 } from "fs";
|
|
18973
|
+
import { resolve as resolve17 } from "path";
|
|
18919
18974
|
var POLL_MS2 = 200;
|
|
18920
18975
|
function indexLockPath() {
|
|
18921
18976
|
try {
|
|
@@ -18923,7 +18978,7 @@ function indexLockPath() {
|
|
|
18923
18978
|
encoding: "utf8",
|
|
18924
18979
|
stdio: ["ignore", "pipe", "ignore"]
|
|
18925
18980
|
}).trim();
|
|
18926
|
-
return rel ?
|
|
18981
|
+
return rel ? resolve17(rel) : void 0;
|
|
18927
18982
|
} catch {
|
|
18928
18983
|
return void 0;
|
|
18929
18984
|
}
|
|
@@ -18935,7 +18990,7 @@ function waitForIndexUnlocked(timeoutMs) {
|
|
|
18935
18990
|
const lock2 = indexLockPath();
|
|
18936
18991
|
if (!lock2) return true;
|
|
18937
18992
|
const deadline = Date.now() + timeoutMs;
|
|
18938
|
-
while (
|
|
18993
|
+
while (existsSync43(lock2)) {
|
|
18939
18994
|
if (Date.now() >= deadline) return false;
|
|
18940
18995
|
sleepSync(POLL_MS2);
|
|
18941
18996
|
}
|
|
@@ -19051,14 +19106,14 @@ function hasLocalChanges() {
|
|
|
19051
19106
|
|
|
19052
19107
|
// src/commands/backlog/acquireLock.ts
|
|
19053
19108
|
import {
|
|
19054
|
-
existsSync as
|
|
19109
|
+
existsSync as existsSync44,
|
|
19055
19110
|
mkdirSync as mkdirSync11,
|
|
19056
|
-
readFileSync as
|
|
19111
|
+
readFileSync as readFileSync26,
|
|
19057
19112
|
unlinkSync as unlinkSync4,
|
|
19058
19113
|
writeFileSync as writeFileSync20
|
|
19059
19114
|
} from "fs";
|
|
19060
19115
|
import { homedir as homedir15 } from "os";
|
|
19061
|
-
import { join as
|
|
19116
|
+
import { join as join52 } from "path";
|
|
19062
19117
|
|
|
19063
19118
|
// src/commands/backlog/bootedAt.ts
|
|
19064
19119
|
import { uptime } from "os";
|
|
@@ -19067,11 +19122,11 @@ function bootedAt() {
|
|
|
19067
19122
|
}
|
|
19068
19123
|
|
|
19069
19124
|
// src/commands/backlog/processStartedAt.ts
|
|
19070
|
-
import { readFileSync as
|
|
19125
|
+
import { readFileSync as readFileSync25 } from "fs";
|
|
19071
19126
|
var clockTicksPerSecond = 100;
|
|
19072
19127
|
function processStartedAt(pid) {
|
|
19073
19128
|
try {
|
|
19074
|
-
const stat5 =
|
|
19129
|
+
const stat5 = readFileSync25(`/proc/${pid}/stat`, "utf8");
|
|
19075
19130
|
const fields = stat5.slice(stat5.lastIndexOf(")") + 2).split(" ");
|
|
19076
19131
|
const ticks = Number(fields[19]);
|
|
19077
19132
|
if (!Number.isFinite(ticks)) return void 0;
|
|
@@ -19094,10 +19149,10 @@ function isStaleLock(pid, timestamp9) {
|
|
|
19094
19149
|
|
|
19095
19150
|
// src/commands/backlog/acquireLock.ts
|
|
19096
19151
|
function getLocksDir() {
|
|
19097
|
-
return
|
|
19152
|
+
return join52(homedir15(), ".assist", "locks");
|
|
19098
19153
|
}
|
|
19099
19154
|
function getLockPath(itemId2) {
|
|
19100
|
-
return
|
|
19155
|
+
return join52(getLocksDir(), `lock-${itemId2}.json`);
|
|
19101
19156
|
}
|
|
19102
19157
|
function isProcessAlive(pid) {
|
|
19103
19158
|
try {
|
|
@@ -19109,9 +19164,9 @@ function isProcessAlive(pid) {
|
|
|
19109
19164
|
}
|
|
19110
19165
|
function foreignLockHolder(itemId2) {
|
|
19111
19166
|
const lockPath = getLockPath(itemId2);
|
|
19112
|
-
if (!
|
|
19167
|
+
if (!existsSync44(lockPath)) return null;
|
|
19113
19168
|
try {
|
|
19114
|
-
const lock2 = JSON.parse(
|
|
19169
|
+
const lock2 = JSON.parse(readFileSync26(lockPath, "utf8"));
|
|
19115
19170
|
if (typeof lock2.pid !== "number" || lock2.pid === process.pid) return null;
|
|
19116
19171
|
if (!isProcessAlive(lock2.pid)) return null;
|
|
19117
19172
|
if (isStaleLock(lock2.pid, lock2.timestamp)) return null;
|
|
@@ -19594,14 +19649,14 @@ async function resumeDoneConversation({ item, resumeSessionId }, spawnOptions) {
|
|
|
19594
19649
|
}
|
|
19595
19650
|
|
|
19596
19651
|
// src/commands/backlog/consumePause.ts
|
|
19597
|
-
import { existsSync as
|
|
19652
|
+
import { existsSync as existsSync45, mkdirSync as mkdirSync13, unlinkSync as unlinkSync5, writeFileSync as writeFileSync22 } from "fs";
|
|
19598
19653
|
import { homedir as homedir16 } from "os";
|
|
19599
|
-
import { join as
|
|
19654
|
+
import { join as join53 } from "path";
|
|
19600
19655
|
function getControlsDir() {
|
|
19601
|
-
return
|
|
19656
|
+
return join53(homedir16(), ".assist", "controls");
|
|
19602
19657
|
}
|
|
19603
19658
|
function getPausePath(itemId2) {
|
|
19604
|
-
return
|
|
19659
|
+
return join53(getControlsDir(), `pause-${itemId2}.json`);
|
|
19605
19660
|
}
|
|
19606
19661
|
function requestPause(itemId2) {
|
|
19607
19662
|
mkdirSync13(getControlsDir(), { recursive: true });
|
|
@@ -19611,7 +19666,7 @@ function requestPause(itemId2) {
|
|
|
19611
19666
|
);
|
|
19612
19667
|
}
|
|
19613
19668
|
function isPausePending(itemId2) {
|
|
19614
|
-
return
|
|
19669
|
+
return existsSync45(getPausePath(itemId2));
|
|
19615
19670
|
}
|
|
19616
19671
|
function clearPause(itemId2) {
|
|
19617
19672
|
try {
|
|
@@ -19621,7 +19676,7 @@ function clearPause(itemId2) {
|
|
|
19621
19676
|
}
|
|
19622
19677
|
function consumePause(itemId2) {
|
|
19623
19678
|
const pausePath = getPausePath(itemId2);
|
|
19624
|
-
if (!
|
|
19679
|
+
if (!existsSync45(pausePath)) return false;
|
|
19625
19680
|
try {
|
|
19626
19681
|
unlinkSync5(pausePath);
|
|
19627
19682
|
} catch {
|
|
@@ -19873,15 +19928,15 @@ function spawnHarness(harness, prompt, options2 = {}) {
|
|
|
19873
19928
|
}
|
|
19874
19929
|
|
|
19875
19930
|
// src/commands/backlog/watchForMarker.ts
|
|
19876
|
-
import { existsSync as
|
|
19931
|
+
import { existsSync as existsSync47, unwatchFile, watchFile } from "fs";
|
|
19877
19932
|
|
|
19878
19933
|
// src/commands/backlog/readSignal.ts
|
|
19879
|
-
import { existsSync as
|
|
19934
|
+
import { existsSync as existsSync46, readFileSync as readFileSync27 } from "fs";
|
|
19880
19935
|
function readSignal() {
|
|
19881
19936
|
const path109 = getSignalPath();
|
|
19882
|
-
if (!path109 || !
|
|
19937
|
+
if (!path109 || !existsSync46(path109)) return void 0;
|
|
19883
19938
|
try {
|
|
19884
|
-
return JSON.parse(
|
|
19939
|
+
return JSON.parse(readFileSync27(path109, "utf8"));
|
|
19885
19940
|
} catch {
|
|
19886
19941
|
return void 0;
|
|
19887
19942
|
}
|
|
@@ -19893,7 +19948,7 @@ function watchForMarker(child, options2) {
|
|
|
19893
19948
|
const statusPath = getSignalPath();
|
|
19894
19949
|
if (!statusPath) return { killedOnMarker: () => killed };
|
|
19895
19950
|
watchFile(statusPath, { interval: 1e3 }, () => {
|
|
19896
|
-
if (!
|
|
19951
|
+
if (!existsSync47(statusPath)) return;
|
|
19897
19952
|
const signal = readSignal();
|
|
19898
19953
|
if (!signal) return;
|
|
19899
19954
|
if (signal.event === "done" && !options2?.actOnDone) return;
|
|
@@ -19945,7 +20000,7 @@ function launchPhaseSession(item, phaseNumber, phase, phaseLabel2, claudeSession
|
|
|
19945
20000
|
}
|
|
19946
20001
|
|
|
19947
20002
|
// src/commands/backlog/resolvePhaseResult.ts
|
|
19948
|
-
import { existsSync as
|
|
20003
|
+
import { existsSync as existsSync48, unlinkSync as unlinkSync6 } from "fs";
|
|
19949
20004
|
import chalk77 from "chalk";
|
|
19950
20005
|
|
|
19951
20006
|
// src/commands/backlog/handleIncompletePhase.ts
|
|
@@ -19967,7 +20022,7 @@ async function handleIncompletePhase() {
|
|
|
19967
20022
|
// src/commands/backlog/resolvePhaseResult.ts
|
|
19968
20023
|
function cleanupSignal() {
|
|
19969
20024
|
const statusPath = getSignalPath();
|
|
19970
|
-
if (statusPath &&
|
|
20025
|
+
if (statusPath && existsSync48(statusPath)) {
|
|
19971
20026
|
unlinkSync6(statusPath);
|
|
19972
20027
|
}
|
|
19973
20028
|
}
|
|
@@ -19978,7 +20033,7 @@ async function isTerminalStatus(itemId2) {
|
|
|
19978
20033
|
}
|
|
19979
20034
|
async function resolvePhaseResult(phaseIndex, itemId2) {
|
|
19980
20035
|
const signalPath = getSignalPath();
|
|
19981
|
-
if (!signalPath || !
|
|
20036
|
+
if (!signalPath || !existsSync48(signalPath)) {
|
|
19982
20037
|
if (await isTerminalStatus(itemId2)) return { kind: "abort" };
|
|
19983
20038
|
const action = await handleIncompletePhase();
|
|
19984
20039
|
if (action === "abort") return { kind: "abort" };
|
|
@@ -20057,9 +20112,9 @@ async function persistPhaseSessionId(itemId2, phaseIdx, claudeSessionId) {
|
|
|
20057
20112
|
}
|
|
20058
20113
|
|
|
20059
20114
|
// src/shared/emitActivity.ts
|
|
20060
|
-
import { mkdirSync as mkdirSync14, readFileSync as
|
|
20115
|
+
import { mkdirSync as mkdirSync14, readFileSync as readFileSync28, rmSync as rmSync4, writeFileSync as writeFileSync23 } from "fs";
|
|
20061
20116
|
import { homedir as homedir17 } from "os";
|
|
20062
|
-
import { dirname as dirname28, join as
|
|
20117
|
+
import { dirname as dirname28, join as join54 } from "path";
|
|
20063
20118
|
import { z as z17 } from "zod";
|
|
20064
20119
|
var activitySchema = z17.object({
|
|
20065
20120
|
kind: z17.enum(["command", "backlog"]),
|
|
@@ -20076,7 +20131,7 @@ var activitySchema = z17.object({
|
|
|
20076
20131
|
startedAt: z17.number()
|
|
20077
20132
|
});
|
|
20078
20133
|
function activityPath(sessionId2) {
|
|
20079
|
-
return
|
|
20134
|
+
return join54(homedir17(), ".assist", "activity", `activity-${sessionId2}.json`);
|
|
20080
20135
|
}
|
|
20081
20136
|
function emitActivity(activity2) {
|
|
20082
20137
|
const sessionId2 = process.env.ASSIST_ACTIVITY_ID;
|
|
@@ -20087,7 +20142,7 @@ function emitActivity(activity2) {
|
|
|
20087
20142
|
}
|
|
20088
20143
|
function readActivity(path109) {
|
|
20089
20144
|
try {
|
|
20090
|
-
return JSON.parse(
|
|
20145
|
+
return JSON.parse(readFileSync28(path109, "utf8"));
|
|
20091
20146
|
} catch {
|
|
20092
20147
|
return void 0;
|
|
20093
20148
|
}
|
|
@@ -22361,7 +22416,7 @@ function stripEnvPrefix(parts) {
|
|
|
22361
22416
|
}
|
|
22362
22417
|
|
|
22363
22418
|
// src/commands/cliHook/isGhGraphqlIssueMutation.ts
|
|
22364
|
-
import { readFileSync as
|
|
22419
|
+
import { readFileSync as readFileSync29 } from "fs";
|
|
22365
22420
|
var ISSUE_MUTATION = /\bmutation\b[\s\S]*(?:issue|comment|label|assign|reaction|milestone)/i;
|
|
22366
22421
|
var FILE_REFERENCE = /(?:=@|--input[\s=]+)["']?([^\s"';&|)]+)/g;
|
|
22367
22422
|
function isGhGraphqlIssueMutation(command) {
|
|
@@ -22373,7 +22428,7 @@ function isGhGraphqlIssueMutation(command) {
|
|
|
22373
22428
|
}
|
|
22374
22429
|
function readOrEmpty(path109) {
|
|
22375
22430
|
try {
|
|
22376
|
-
return
|
|
22431
|
+
return readFileSync29(path109, "utf8");
|
|
22377
22432
|
} catch {
|
|
22378
22433
|
return "";
|
|
22379
22434
|
}
|
|
@@ -22608,7 +22663,7 @@ function findTruncatedReadDenyRaw(rawCommand) {
|
|
|
22608
22663
|
}
|
|
22609
22664
|
|
|
22610
22665
|
// src/shared/isApprovedRead.ts
|
|
22611
|
-
import { resolve as
|
|
22666
|
+
import { resolve as resolve19, sep as sep2 } from "path";
|
|
22612
22667
|
|
|
22613
22668
|
// src/shared/appliesFixStructure.ts
|
|
22614
22669
|
var APPLY_RE = /^assist\s+github\s+issue\s+fix-structure\b.*\s--apply\b/;
|
|
@@ -22704,8 +22759,8 @@ function extractGraphqlQuery(args) {
|
|
|
22704
22759
|
}
|
|
22705
22760
|
|
|
22706
22761
|
// src/shared/loadCliReads.ts
|
|
22707
|
-
import { existsSync as
|
|
22708
|
-
import { dirname as dirname29, resolve as
|
|
22762
|
+
import { existsSync as existsSync49, readFileSync as readFileSync30, writeFileSync as writeFileSync24 } from "fs";
|
|
22763
|
+
import { dirname as dirname29, resolve as resolve18 } from "path";
|
|
22709
22764
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
22710
22765
|
var __filename3 = fileURLToPath6(import.meta.url);
|
|
22711
22766
|
var __dirname4 = dirname29(__filename3);
|
|
@@ -22713,20 +22768,20 @@ function packageRoot() {
|
|
|
22713
22768
|
return __dirname4;
|
|
22714
22769
|
}
|
|
22715
22770
|
function readLines(path109) {
|
|
22716
|
-
if (!
|
|
22717
|
-
return
|
|
22771
|
+
if (!existsSync49(path109)) return [];
|
|
22772
|
+
return readFileSync30(path109, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
22718
22773
|
}
|
|
22719
22774
|
var cachedReads;
|
|
22720
22775
|
var cachedWrites;
|
|
22721
22776
|
function getCliReadsLines() {
|
|
22722
22777
|
if (!cachedReads) {
|
|
22723
|
-
cachedReads = readLines(
|
|
22778
|
+
cachedReads = readLines(resolve18(packageRoot(), "allowed.cli-reads"));
|
|
22724
22779
|
}
|
|
22725
22780
|
return cachedReads;
|
|
22726
22781
|
}
|
|
22727
22782
|
function getCliWritesLines() {
|
|
22728
22783
|
if (!cachedWrites) {
|
|
22729
|
-
cachedWrites = readLines(
|
|
22784
|
+
cachedWrites = readLines(resolve18(packageRoot(), "allowed.cli-writes"));
|
|
22730
22785
|
}
|
|
22731
22786
|
return cachedWrites;
|
|
22732
22787
|
}
|
|
@@ -22735,7 +22790,7 @@ function loadCliReads() {
|
|
|
22735
22790
|
}
|
|
22736
22791
|
function saveCliReads(commands) {
|
|
22737
22792
|
writeFileSync24(
|
|
22738
|
-
|
|
22793
|
+
resolve18(packageRoot(), "allowed.cli-reads"),
|
|
22739
22794
|
`${commands.join("\n")}
|
|
22740
22795
|
`
|
|
22741
22796
|
);
|
|
@@ -22760,14 +22815,14 @@ function findCliWrite(command) {
|
|
|
22760
22815
|
}
|
|
22761
22816
|
|
|
22762
22817
|
// src/shared/readSettingsPerms.ts
|
|
22763
|
-
import { existsSync as
|
|
22818
|
+
import { existsSync as existsSync50, readFileSync as readFileSync31 } from "fs";
|
|
22764
22819
|
import { homedir as homedir18 } from "os";
|
|
22765
|
-
import { join as
|
|
22820
|
+
import { join as join55 } from "path";
|
|
22766
22821
|
function readSettingsPerms(key) {
|
|
22767
22822
|
const paths = [
|
|
22768
|
-
|
|
22769
|
-
|
|
22770
|
-
|
|
22823
|
+
join55(homedir18(), ".claude", "settings.json"),
|
|
22824
|
+
join55(process.cwd(), ".claude", "settings.json"),
|
|
22825
|
+
join55(process.cwd(), ".claude", "settings.local.json")
|
|
22771
22826
|
];
|
|
22772
22827
|
const entries = [];
|
|
22773
22828
|
for (const p of paths) {
|
|
@@ -22776,9 +22831,9 @@ function readSettingsPerms(key) {
|
|
|
22776
22831
|
return entries;
|
|
22777
22832
|
}
|
|
22778
22833
|
function readPermissionArray(filePath, key) {
|
|
22779
|
-
if (!
|
|
22834
|
+
if (!existsSync50(filePath)) return [];
|
|
22780
22835
|
try {
|
|
22781
|
-
const data = JSON.parse(
|
|
22836
|
+
const data = JSON.parse(readFileSync31(filePath, "utf8"));
|
|
22782
22837
|
const arr = data?.permissions?.[key];
|
|
22783
22838
|
return Array.isArray(arr) ? arr.filter((e) => typeof e === "string") : [];
|
|
22784
22839
|
} catch {
|
|
@@ -22873,19 +22928,19 @@ function isCdToCwd(command) {
|
|
|
22873
22928
|
const parts = command.split(/\s+/);
|
|
22874
22929
|
if (parts[0] !== "cd" || parts.length > 2) return false;
|
|
22875
22930
|
if (parts.length === 1) return false;
|
|
22876
|
-
const resolved =
|
|
22877
|
-
return resolved ===
|
|
22931
|
+
const resolved = resolve19(normalizeMsysPath(parts[1]));
|
|
22932
|
+
return resolved === resolve19(process.cwd());
|
|
22878
22933
|
}
|
|
22879
22934
|
function isCdToReadAllowedDir(command) {
|
|
22880
22935
|
const parts = command.split(/\s+/);
|
|
22881
22936
|
if (parts[0] !== "cd" || parts.length !== 2) return void 0;
|
|
22882
|
-
const target =
|
|
22937
|
+
const target = resolve19(normalizeMsysPath(parts[1]));
|
|
22883
22938
|
for (const entry of readSettingsPerms("allow")) {
|
|
22884
22939
|
const m = entry.match(READ_RE);
|
|
22885
22940
|
if (!m) continue;
|
|
22886
22941
|
const base = globBaseDir(m[1]);
|
|
22887
22942
|
if (!base) continue;
|
|
22888
|
-
const resolved =
|
|
22943
|
+
const resolved = resolve19(normalizeMsysPath(base));
|
|
22889
22944
|
if (target === resolved || target.startsWith(resolved + sep2)) {
|
|
22890
22945
|
return `cd to Read-allowed directory: ${entry}`;
|
|
22891
22946
|
}
|
|
@@ -23009,7 +23064,7 @@ ${questionsJson}`
|
|
|
23009
23064
|
}
|
|
23010
23065
|
|
|
23011
23066
|
// src/commands/backlog/isDocsPath.ts
|
|
23012
|
-
import { relative as relative6, resolve as
|
|
23067
|
+
import { relative as relative6, resolve as resolve20 } from "path";
|
|
23013
23068
|
var LOCKED_DOCS_DIRS = ["docs/src/content/docs/", "docs/public/screenshots/"];
|
|
23014
23069
|
var DOCS_LOCK_REASON = `Docs pages and screenshots (${LOCKED_DOCS_DIRS.join(", ")}) are locked during development: they are updated by the Refresh docs backlog item after stories ship, not during development. Leave them untouched and carry on with the phase. If this phase genuinely needs to change docs (e.g. the item is about the docs site itself), first confirm that with the user, then run \`assist docs unlock\` and wait for the user to confirm the PIN with \`assist docs confirm <pin>\` before retrying. The unlock applies to the current phase only.`;
|
|
23015
23070
|
var SEP = String.raw`[/\\]`;
|
|
@@ -23025,7 +23080,7 @@ function isLockedDocsRelativePath(rel) {
|
|
|
23025
23080
|
return LOCKED_DOCS_DIRS.some((dir) => normalized.startsWith(dir));
|
|
23026
23081
|
}
|
|
23027
23082
|
function isDocsPath(filePath, root2 = getProjectRoot()) {
|
|
23028
|
-
return isLockedDocsRelativePath(relative6(root2,
|
|
23083
|
+
return isLockedDocsRelativePath(relative6(root2, resolve20(root2, filePath)));
|
|
23029
23084
|
}
|
|
23030
23085
|
function mentionsDocsPath(command, root2 = getProjectRoot()) {
|
|
23031
23086
|
if (RELATIVE_DOCS.test(command)) return true;
|
|
@@ -23048,14 +23103,14 @@ function findDocsPathDeny(toolName, rawCommand, root2) {
|
|
|
23048
23103
|
}
|
|
23049
23104
|
|
|
23050
23105
|
// src/commands/schema/isSchemaPath.ts
|
|
23051
|
-
import { readFileSync as
|
|
23052
|
-
import { relative as relative7, resolve as
|
|
23106
|
+
import { readFileSync as readFileSync32 } from "fs";
|
|
23107
|
+
import { relative as relative7, resolve as resolve21 } from "path";
|
|
23053
23108
|
var SCHEMA_LOCK_REASON = "Database schema files (src/shared/db/migrations/migrationNNNN*.ts, src/shared/db/migrations.ts, src/shared/db/schema.ts and any src/shared/db/*.ts that defines a pgTable) are locked: a schema change needs the user's sign-off (see src/shared/db/CLAUDE.md). Confirm the schema change with the user first, then run `assist schema unlock` to request a PIN and wait for the user to confirm it with `assist schema confirm <pin>` before retrying. In a backlog item session the unlock lasts for the current phase; otherwise it lasts for this Claude session.";
|
|
23054
23109
|
var FIXED_SCHEMA_PATH = /^src\/shared\/db\/(?:migrations\/migration\d{4}[^/]*\.ts|migrations\.ts|schema\.ts)$/;
|
|
23055
23110
|
var DB_MODULE = /^src\/shared\/db\/[^/]+\.ts$/;
|
|
23056
23111
|
function readOrEmpty2(path109) {
|
|
23057
23112
|
try {
|
|
23058
|
-
return
|
|
23113
|
+
return readFileSync32(path109, "utf8");
|
|
23059
23114
|
} catch {
|
|
23060
23115
|
return "";
|
|
23061
23116
|
}
|
|
@@ -23064,13 +23119,13 @@ function isSchemaRelativePath(rel, root2, incomingContents2 = []) {
|
|
|
23064
23119
|
const normalized = rel.replace(/\\/g, "/");
|
|
23065
23120
|
if (FIXED_SCHEMA_PATH.test(normalized)) return true;
|
|
23066
23121
|
if (!DB_MODULE.test(normalized)) return false;
|
|
23067
|
-
return [...incomingContents2, readOrEmpty2(
|
|
23122
|
+
return [...incomingContents2, readOrEmpty2(resolve21(root2, normalized))].some(
|
|
23068
23123
|
(text20) => text20.includes("pgTable")
|
|
23069
23124
|
);
|
|
23070
23125
|
}
|
|
23071
23126
|
function isSchemaPath(filePath, incomingContents2 = [], root2 = getProjectRoot()) {
|
|
23072
23127
|
return isSchemaRelativePath(
|
|
23073
|
-
relative7(root2,
|
|
23128
|
+
relative7(root2, resolve21(root2, filePath)),
|
|
23074
23129
|
root2,
|
|
23075
23130
|
incomingContents2
|
|
23076
23131
|
);
|
|
@@ -23124,11 +23179,11 @@ function findSchemaPathDeny(toolName, rawCommand, root2 = getProjectRoot()) {
|
|
|
23124
23179
|
// src/commands/cliHook/logDeniedToolCall.ts
|
|
23125
23180
|
import { mkdirSync as mkdirSync15 } from "fs";
|
|
23126
23181
|
import { homedir as homedir19 } from "os";
|
|
23127
|
-
import { join as
|
|
23182
|
+
import { join as join56 } from "path";
|
|
23128
23183
|
import Database from "better-sqlite3";
|
|
23129
23184
|
var _db;
|
|
23130
23185
|
function getDbDir() {
|
|
23131
|
-
return
|
|
23186
|
+
return join56(homedir19(), ".assist");
|
|
23132
23187
|
}
|
|
23133
23188
|
function initSchema(db) {
|
|
23134
23189
|
db.exec(`
|
|
@@ -23147,7 +23202,7 @@ function openPromptsDb(dir) {
|
|
|
23147
23202
|
if (_db) return _db;
|
|
23148
23203
|
const dbDir = dir ?? getDbDir();
|
|
23149
23204
|
mkdirSync15(dbDir, { recursive: true });
|
|
23150
|
-
const db = new Database(
|
|
23205
|
+
const db = new Database(join56(dbDir, "assist.db"));
|
|
23151
23206
|
db.pragma("journal_mode = WAL");
|
|
23152
23207
|
initSchema(db);
|
|
23153
23208
|
_db = db;
|
|
@@ -23211,29 +23266,29 @@ function tryParseInput(raw) {
|
|
|
23211
23266
|
}
|
|
23212
23267
|
|
|
23213
23268
|
// src/commands/schema/isSchemaLocked.ts
|
|
23214
|
-
import { existsSync as
|
|
23269
|
+
import { existsSync as existsSync51 } from "fs";
|
|
23215
23270
|
|
|
23216
23271
|
// src/commands/schema/getSchemaSessionApprovalPath.ts
|
|
23217
|
-
import { join as
|
|
23272
|
+
import { join as join58 } from "path";
|
|
23218
23273
|
|
|
23219
23274
|
// src/commands/codeComment/getRestrictedDir.ts
|
|
23220
23275
|
import { homedir as homedir20 } from "os";
|
|
23221
|
-
import { join as
|
|
23276
|
+
import { join as join57 } from "path";
|
|
23222
23277
|
function getRestrictedDir() {
|
|
23223
|
-
return
|
|
23278
|
+
return join57(homedir20(), ".assist", "restricted");
|
|
23224
23279
|
}
|
|
23225
23280
|
function getPinStatePath(pin2) {
|
|
23226
|
-
return
|
|
23281
|
+
return join57(getRestrictedDir(), `code-comment-${pin2}.json`);
|
|
23227
23282
|
}
|
|
23228
23283
|
|
|
23229
23284
|
// src/commands/schema/getSchemaSessionApprovalPath.ts
|
|
23230
23285
|
var SESSION_ID = /^[\w-]+$/;
|
|
23231
23286
|
function getSchemaSessionApprovalDir() {
|
|
23232
|
-
return
|
|
23287
|
+
return join58(getRestrictedDir(), "schema-sessions");
|
|
23233
23288
|
}
|
|
23234
23289
|
function getSchemaSessionApprovalPath(claudeSessionId) {
|
|
23235
23290
|
if (!SESSION_ID.test(claudeSessionId)) return void 0;
|
|
23236
|
-
return
|
|
23291
|
+
return join58(getSchemaSessionApprovalDir(), `${claudeSessionId}.json`);
|
|
23237
23292
|
}
|
|
23238
23293
|
|
|
23239
23294
|
// src/commands/schema/isSchemaLocked.ts
|
|
@@ -23241,7 +23296,7 @@ function hasSessionApproval() {
|
|
|
23241
23296
|
const claudeSessionId = process.env.CLAUDE_CODE_SESSION_ID;
|
|
23242
23297
|
if (!claudeSessionId) return false;
|
|
23243
23298
|
const path109 = getSchemaSessionApprovalPath(claudeSessionId);
|
|
23244
|
-
return path109 !== void 0 &&
|
|
23299
|
+
return path109 !== void 0 && existsSync51(path109);
|
|
23245
23300
|
}
|
|
23246
23301
|
async function isSchemaLocked() {
|
|
23247
23302
|
if (!process.env.CLAUDECODE) return false;
|
|
@@ -23330,9 +23385,9 @@ ${reasons.join("\n")}`);
|
|
|
23330
23385
|
}
|
|
23331
23386
|
|
|
23332
23387
|
// src/commands/permitCliReads.ts
|
|
23333
|
-
import { existsSync as
|
|
23388
|
+
import { existsSync as existsSync52, mkdirSync as mkdirSync16, readFileSync as readFileSync33, writeFileSync as writeFileSync25 } from "fs";
|
|
23334
23389
|
import { homedir as homedir21 } from "os";
|
|
23335
|
-
import { join as
|
|
23390
|
+
import { join as join59 } from "path";
|
|
23336
23391
|
|
|
23337
23392
|
// src/commands/permitCliReads/assertCliExists.ts
|
|
23338
23393
|
function assertCliExists(cli) {
|
|
@@ -23595,15 +23650,15 @@ function updateSettings(cli, commands) {
|
|
|
23595
23650
|
// src/commands/permitCliReads.ts
|
|
23596
23651
|
function logPath(cli) {
|
|
23597
23652
|
const safeName = cli.replace(/\s+/g, "-");
|
|
23598
|
-
return
|
|
23653
|
+
return join59(homedir21(), ".assist", `cli-discover-${safeName}.log`);
|
|
23599
23654
|
}
|
|
23600
23655
|
function readCache(cli) {
|
|
23601
23656
|
const path109 = logPath(cli);
|
|
23602
|
-
if (!
|
|
23603
|
-
return
|
|
23657
|
+
if (!existsSync52(path109)) return void 0;
|
|
23658
|
+
return readFileSync33(path109, "utf8");
|
|
23604
23659
|
}
|
|
23605
23660
|
function writeCache(cli, output) {
|
|
23606
|
-
const dir =
|
|
23661
|
+
const dir = join59(homedir21(), ".assist");
|
|
23607
23662
|
mkdirSync16(dir, { recursive: true });
|
|
23608
23663
|
writeFileSync25(logPath(cli), output);
|
|
23609
23664
|
}
|
|
@@ -23735,7 +23790,7 @@ function registerCliHook(program) {
|
|
|
23735
23790
|
}
|
|
23736
23791
|
|
|
23737
23792
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
23738
|
-
import { existsSync as
|
|
23793
|
+
import { existsSync as existsSync54, readFileSync as readFileSync35, unlinkSync as unlinkSync8, writeFileSync as writeFileSync26 } from "fs";
|
|
23739
23794
|
import chalk120 from "chalk";
|
|
23740
23795
|
|
|
23741
23796
|
// src/shared/isHashCommentFile.ts
|
|
@@ -23769,7 +23824,7 @@ function isHashCommentFile(filePath) {
|
|
|
23769
23824
|
|
|
23770
23825
|
// src/commands/codeComment/sweepRestrictedDir.ts
|
|
23771
23826
|
import { readdirSync as readdirSync9, statSync as statSync8, unlinkSync as unlinkSync7 } from "fs";
|
|
23772
|
-
import { join as
|
|
23827
|
+
import { join as join60 } from "path";
|
|
23773
23828
|
var STALE_AFTER_MS = 30 * 60 * 1e3;
|
|
23774
23829
|
function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
23775
23830
|
let entries;
|
|
@@ -23780,7 +23835,7 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
23780
23835
|
}
|
|
23781
23836
|
const cutoff = Date.now() - STALE_AFTER_MS;
|
|
23782
23837
|
for (const entry of entries) {
|
|
23783
|
-
const path109 =
|
|
23838
|
+
const path109 = join60(dir, entry);
|
|
23784
23839
|
try {
|
|
23785
23840
|
if (statSync8(path109).mtimeMs < cutoff) unlinkSync7(path109);
|
|
23786
23841
|
} catch {
|
|
@@ -23790,12 +23845,12 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
23790
23845
|
}
|
|
23791
23846
|
|
|
23792
23847
|
// src/commands/codeComment/readPinState.ts
|
|
23793
|
-
import { existsSync as
|
|
23848
|
+
import { existsSync as existsSync53, readFileSync as readFileSync34 } from "fs";
|
|
23794
23849
|
function readPinState(pin2) {
|
|
23795
23850
|
const path109 = getPinStatePath(pin2);
|
|
23796
|
-
if (!
|
|
23851
|
+
if (!existsSync53(path109)) return void 0;
|
|
23797
23852
|
try {
|
|
23798
|
-
const state = JSON.parse(
|
|
23853
|
+
const state = JSON.parse(readFileSync34(path109, "utf8"));
|
|
23799
23854
|
if (state.pin !== pin2) return void 0;
|
|
23800
23855
|
return state;
|
|
23801
23856
|
} catch {
|
|
@@ -23812,12 +23867,12 @@ function codeCommentConfirm(pin2) {
|
|
|
23812
23867
|
process.exitCode = 1;
|
|
23813
23868
|
return;
|
|
23814
23869
|
}
|
|
23815
|
-
if (!
|
|
23870
|
+
if (!existsSync54(state.file)) {
|
|
23816
23871
|
console.error(chalk120.red(`Target file no longer exists: ${state.file}`));
|
|
23817
23872
|
process.exitCode = 1;
|
|
23818
23873
|
return;
|
|
23819
23874
|
}
|
|
23820
|
-
const original =
|
|
23875
|
+
const original = readFileSync35(state.file, "utf8");
|
|
23821
23876
|
const lines2 = original.split("\n");
|
|
23822
23877
|
const index3 = state.line - 1;
|
|
23823
23878
|
if (index3 > lines2.length) {
|
|
@@ -25997,7 +26052,7 @@ async function browserInspect(selector, options2) {
|
|
|
25997
26052
|
}
|
|
25998
26053
|
|
|
25999
26054
|
// src/commands/browser/browserRun.ts
|
|
26000
|
-
import { readFileSync as
|
|
26055
|
+
import { readFileSync as readFileSync36 } from "fs";
|
|
26001
26056
|
import chalk149 from "chalk";
|
|
26002
26057
|
|
|
26003
26058
|
// src/commands/browser/formatRunOutcome.ts
|
|
@@ -26017,7 +26072,7 @@ function formatRunOutcome(run4) {
|
|
|
26017
26072
|
async function browserRun(options2) {
|
|
26018
26073
|
let code;
|
|
26019
26074
|
try {
|
|
26020
|
-
code =
|
|
26075
|
+
code = readFileSync36(options2.file, "utf8");
|
|
26021
26076
|
} catch (error) {
|
|
26022
26077
|
console.error(
|
|
26023
26078
|
chalk149.red(
|
|
@@ -26047,11 +26102,11 @@ import { dirname as dirname30 } from "path";
|
|
|
26047
26102
|
|
|
26048
26103
|
// src/commands/browser/snapshotPath.ts
|
|
26049
26104
|
import { homedir as homedir22 } from "os";
|
|
26050
|
-
import { join as
|
|
26105
|
+
import { join as join61 } from "path";
|
|
26051
26106
|
function snapshotPath(tabUrl, now) {
|
|
26052
26107
|
const host = new URL(tabUrl).host.replace(/[^\w.-]/g, "-");
|
|
26053
26108
|
const timestamp9 = now.toISOString().replace(/[:.]/g, "-");
|
|
26054
|
-
return
|
|
26109
|
+
return join61(homedir22(), ".assist", "browser", `${host}-${timestamp9}.html`);
|
|
26055
26110
|
}
|
|
26056
26111
|
|
|
26057
26112
|
// src/commands/browser/browserSnapshot.ts
|
|
@@ -26258,28 +26313,28 @@ async function printExtensionUrl() {
|
|
|
26258
26313
|
// src/commands/extension/signExtension.ts
|
|
26259
26314
|
import { rm as rm2 } from "fs/promises";
|
|
26260
26315
|
import { homedir as homedir23, tmpdir as tmpdir3 } from "os";
|
|
26261
|
-
import { join as
|
|
26316
|
+
import { join as join67 } from "path";
|
|
26262
26317
|
import chalk154 from "chalk";
|
|
26263
26318
|
|
|
26264
26319
|
// src/commands/extension/copySignedXpi.ts
|
|
26265
26320
|
import { copyFile } from "fs/promises";
|
|
26266
|
-
import { join as
|
|
26321
|
+
import { join as join62 } from "path";
|
|
26267
26322
|
var SIGNED_XPI_NAME = "assist-extension.xpi";
|
|
26268
26323
|
async function copySignedXpi(xpi, dir) {
|
|
26269
|
-
const fixed2 =
|
|
26324
|
+
const fixed2 = join62(dir, SIGNED_XPI_NAME);
|
|
26270
26325
|
if (fixed2 === xpi) return fixed2;
|
|
26271
26326
|
await copyFile(xpi, fixed2);
|
|
26272
26327
|
return fixed2;
|
|
26273
26328
|
}
|
|
26274
26329
|
|
|
26275
26330
|
// src/commands/extension/findSignedXpi.ts
|
|
26276
|
-
import { existsSync as
|
|
26331
|
+
import { existsSync as existsSync55 } from "fs";
|
|
26277
26332
|
import { readdir } from "fs/promises";
|
|
26278
|
-
import { join as
|
|
26333
|
+
import { join as join63 } from "path";
|
|
26279
26334
|
async function findSignedXpi(dir) {
|
|
26280
|
-
if (!
|
|
26335
|
+
if (!existsSync55(dir)) return null;
|
|
26281
26336
|
const name = (await readdir(dir)).find((entry) => entry.endsWith(".xpi"));
|
|
26282
|
-
return name ?
|
|
26337
|
+
return name ? join63(dir, name) : null;
|
|
26283
26338
|
}
|
|
26284
26339
|
|
|
26285
26340
|
// src/commands/extension/signedAddonInstallPath.ts
|
|
@@ -26301,11 +26356,11 @@ async function signedAddonInstallPath(xpi) {
|
|
|
26301
26356
|
}
|
|
26302
26357
|
|
|
26303
26358
|
// src/commands/extension/signPreflightProblem.ts
|
|
26304
|
-
import { existsSync as
|
|
26305
|
-
import { join as
|
|
26359
|
+
import { existsSync as existsSync56 } from "fs";
|
|
26360
|
+
import { join as join64 } from "path";
|
|
26306
26361
|
var KEY_URL = "https://addons.mozilla.org/en-US/developers/addon/api/key/";
|
|
26307
26362
|
function signPreflightProblem(source) {
|
|
26308
|
-
if (!
|
|
26363
|
+
if (!existsSync56(join64(source, "content.js")))
|
|
26309
26364
|
return {
|
|
26310
26365
|
message: `no content.js in ${source}`,
|
|
26311
26366
|
hint: "run npm run build to bundle the content script"
|
|
@@ -26320,7 +26375,7 @@ function signPreflightProblem(source) {
|
|
|
26320
26375
|
|
|
26321
26376
|
// src/commands/extension/stageExtension.ts
|
|
26322
26377
|
import { cp as cp3, mkdir as mkdir5, readFile as readFile5, rm, writeFile as writeFile4 } from "fs/promises";
|
|
26323
|
-
import { basename as basename16, join as
|
|
26378
|
+
import { basename as basename16, join as join65 } from "path";
|
|
26324
26379
|
|
|
26325
26380
|
// src/commands/extension/stampManifestVersion.ts
|
|
26326
26381
|
function stampManifestVersion(manifest, version2) {
|
|
@@ -26337,7 +26392,7 @@ async function stageExtension(source, staging, version2) {
|
|
|
26337
26392
|
recursive: true,
|
|
26338
26393
|
filter: (path109) => basename16(path109) !== "updates.json"
|
|
26339
26394
|
});
|
|
26340
|
-
const manifest =
|
|
26395
|
+
const manifest = join65(staging, "manifest.json");
|
|
26341
26396
|
const stamped = stampManifestVersion(
|
|
26342
26397
|
await readFile5(manifest, "utf8"),
|
|
26343
26398
|
version2
|
|
@@ -26347,7 +26402,7 @@ async function stageExtension(source, staging, version2) {
|
|
|
26347
26402
|
|
|
26348
26403
|
// src/commands/extension/writeUpdateManifest.ts
|
|
26349
26404
|
import { readFile as readFile6, writeFile as writeFile5 } from "fs/promises";
|
|
26350
|
-
import { join as
|
|
26405
|
+
import { join as join66 } from "path";
|
|
26351
26406
|
|
|
26352
26407
|
// src/commands/extension/buildUpdateManifest.ts
|
|
26353
26408
|
var RELEASE_DOWNLOAD_URL = "https://github.com/staff0rd/assist/releases/download";
|
|
@@ -26372,17 +26427,17 @@ function buildUpdateManifest(manifest, version2) {
|
|
|
26372
26427
|
// src/commands/extension/writeUpdateManifest.ts
|
|
26373
26428
|
async function writeUpdateManifest(source, dir, version2) {
|
|
26374
26429
|
await writeFile5(
|
|
26375
|
-
|
|
26430
|
+
join66(dir, "updates.json"),
|
|
26376
26431
|
buildUpdateManifest(
|
|
26377
|
-
await readFile6(
|
|
26432
|
+
await readFile6(join66(source, "manifest.json"), "utf8"),
|
|
26378
26433
|
version2
|
|
26379
26434
|
)
|
|
26380
26435
|
);
|
|
26381
26436
|
}
|
|
26382
26437
|
|
|
26383
26438
|
// src/commands/extension/signExtension.ts
|
|
26384
|
-
var ARTIFACTS_DIR =
|
|
26385
|
-
var STAGING_DIR =
|
|
26439
|
+
var ARTIFACTS_DIR = join67(homedir23(), ".assist", "extension");
|
|
26440
|
+
var STAGING_DIR = join67(tmpdir3(), "assist-extension");
|
|
26386
26441
|
async function signExtension() {
|
|
26387
26442
|
const source = extensionDir();
|
|
26388
26443
|
const problem = signPreflightProblem(source);
|
|
@@ -26566,7 +26621,7 @@ function registerDb(program) {
|
|
|
26566
26621
|
}
|
|
26567
26622
|
|
|
26568
26623
|
// src/commands/deploy/redirect.ts
|
|
26569
|
-
import { existsSync as
|
|
26624
|
+
import { existsSync as existsSync57, readFileSync as readFileSync37, writeFileSync as writeFileSync29 } from "fs";
|
|
26570
26625
|
import chalk157 from "chalk";
|
|
26571
26626
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
26572
26627
|
if (!window.location.pathname.endsWith('/')) {
|
|
@@ -26575,11 +26630,11 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
26575
26630
|
</script>`;
|
|
26576
26631
|
function redirect() {
|
|
26577
26632
|
const indexPath = "index.html";
|
|
26578
|
-
if (!
|
|
26633
|
+
if (!existsSync57(indexPath)) {
|
|
26579
26634
|
console.log(chalk157.yellow("No index.html found"));
|
|
26580
26635
|
return;
|
|
26581
26636
|
}
|
|
26582
|
-
const content =
|
|
26637
|
+
const content = readFileSync37(indexPath, "utf8");
|
|
26583
26638
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
26584
26639
|
console.log(chalk157.dim("Trailing slash script already present"));
|
|
26585
26640
|
return;
|
|
@@ -26670,22 +26725,22 @@ function printWeekHeader(week, state) {
|
|
|
26670
26725
|
}
|
|
26671
26726
|
|
|
26672
26727
|
// src/commands/devlog/loadDevEntry.ts
|
|
26673
|
-
import { readFileSync as
|
|
26674
|
-
import { join as
|
|
26728
|
+
import { readFileSync as readFileSync38 } from "fs";
|
|
26729
|
+
import { join as join68 } from "path";
|
|
26675
26730
|
import { parse as parseYaml3 } from "yaml";
|
|
26676
26731
|
function asString(value) {
|
|
26677
26732
|
return value === void 0 || value === null ? null : String(value);
|
|
26678
26733
|
}
|
|
26679
26734
|
function readFrontmatter(path109) {
|
|
26680
26735
|
try {
|
|
26681
|
-
const match =
|
|
26736
|
+
const match = readFileSync38(path109, "utf8").match(/^---\n([\s\S]*?)\n---/);
|
|
26682
26737
|
return match ? parseYaml3(match[1]) ?? {} : null;
|
|
26683
26738
|
} catch {
|
|
26684
26739
|
return null;
|
|
26685
26740
|
}
|
|
26686
26741
|
}
|
|
26687
26742
|
function loadDevEntry(repoName, week, devDir) {
|
|
26688
|
-
const path109 =
|
|
26743
|
+
const path109 = join68(devDir, repoName, `${week.toLowerCase()}.md`);
|
|
26689
26744
|
const frontmatter2 = readFrontmatter(path109);
|
|
26690
26745
|
if (!frontmatter2) return null;
|
|
26691
26746
|
const versions = frontmatter2.versions;
|
|
@@ -26781,17 +26836,17 @@ function findTargetWeek(weeks, { lastWeek, skip: skip3, today }) {
|
|
|
26781
26836
|
import chalk160 from "chalk";
|
|
26782
26837
|
|
|
26783
26838
|
// src/shared/getRepoName.ts
|
|
26784
|
-
import { existsSync as
|
|
26785
|
-
import { basename as basename17, join as
|
|
26839
|
+
import { existsSync as existsSync58, readFileSync as readFileSync39 } from "fs";
|
|
26840
|
+
import { basename as basename17, join as join69 } from "path";
|
|
26786
26841
|
function getRepoName() {
|
|
26787
26842
|
const config = loadConfig();
|
|
26788
26843
|
if (config.devlog?.name) {
|
|
26789
26844
|
return config.devlog.name;
|
|
26790
26845
|
}
|
|
26791
|
-
const packageJsonPath =
|
|
26792
|
-
if (
|
|
26846
|
+
const packageJsonPath = join69(process.cwd(), "package.json");
|
|
26847
|
+
if (existsSync58(packageJsonPath)) {
|
|
26793
26848
|
try {
|
|
26794
|
-
const content =
|
|
26849
|
+
const content = readFileSync39(packageJsonPath, "utf8");
|
|
26795
26850
|
const pkg = JSON.parse(content);
|
|
26796
26851
|
if (pkg.name) {
|
|
26797
26852
|
return pkg.name;
|
|
@@ -26867,7 +26922,7 @@ function list2(options2) {
|
|
|
26867
26922
|
|
|
26868
26923
|
// src/commands/devlog/loadDevWeeks.ts
|
|
26869
26924
|
import { readdirSync as readdirSync10 } from "fs";
|
|
26870
|
-
import { join as
|
|
26925
|
+
import { join as join70 } from "path";
|
|
26871
26926
|
var DEV_FILENAME_PATTERN = /^(\d{4})-w(\d{2})\.md$/;
|
|
26872
26927
|
function parseDevWeekFilename(filename) {
|
|
26873
26928
|
const match = filename.match(DEV_FILENAME_PATTERN);
|
|
@@ -26881,7 +26936,7 @@ function readFilenames(dir) {
|
|
|
26881
26936
|
}
|
|
26882
26937
|
}
|
|
26883
26938
|
function loadDevWeeks(repoName, devDir) {
|
|
26884
|
-
return readFilenames(
|
|
26939
|
+
return readFilenames(join70(devDir, repoName)).map(parseDevWeekFilename).filter((week) => week !== null).sort();
|
|
26885
26940
|
}
|
|
26886
26941
|
|
|
26887
26942
|
// src/commands/devlog/next/displayNextEntry.ts
|
|
@@ -27036,7 +27091,7 @@ async function skip2(week, cwd = process.cwd()) {
|
|
|
27036
27091
|
|
|
27037
27092
|
// src/commands/devlog/write.ts
|
|
27038
27093
|
import { mkdirSync as mkdirSync19, writeFileSync as writeFileSync30 } from "fs";
|
|
27039
|
-
import { dirname as dirname31, join as
|
|
27094
|
+
import { dirname as dirname31, join as join71 } from "path";
|
|
27040
27095
|
import chalk164 from "chalk";
|
|
27041
27096
|
|
|
27042
27097
|
// src/commands/devlog/write/devEntryInputSchema.ts
|
|
@@ -27129,7 +27184,7 @@ async function write() {
|
|
|
27129
27184
|
}
|
|
27130
27185
|
const devDir = resolveDevDir();
|
|
27131
27186
|
const repoName = getRepoName();
|
|
27132
|
-
const path109 =
|
|
27187
|
+
const path109 = join71(devDir, repoName, `${result.data.week.toLowerCase()}.md`);
|
|
27133
27188
|
mkdirSync19(dirname31(path109), { recursive: true });
|
|
27134
27189
|
writeFileSync30(path109, formatDevEntry(repoName, result.data));
|
|
27135
27190
|
console.log(chalk164.green(`Wrote ${path109}`));
|
|
@@ -27317,21 +27372,21 @@ async function findPhaseUnlockItem(itemId2, phase) {
|
|
|
27317
27372
|
}
|
|
27318
27373
|
|
|
27319
27374
|
// src/commands/docs/getDocsUnlockPinPath.ts
|
|
27320
|
-
import { join as
|
|
27375
|
+
import { join as join72 } from "path";
|
|
27321
27376
|
function getDocsUnlockPinPath(pin2) {
|
|
27322
|
-
return
|
|
27377
|
+
return join72(getRestrictedDir(), `docs-unlock-pin-${pin2}.json`);
|
|
27323
27378
|
}
|
|
27324
27379
|
|
|
27325
27380
|
// src/commands/docs/readDocsUnlockPinState.ts
|
|
27326
|
-
import { existsSync as
|
|
27381
|
+
import { existsSync as existsSync59, readFileSync as readFileSync40 } from "fs";
|
|
27327
27382
|
function isPositiveInteger(value) {
|
|
27328
27383
|
return Number.isInteger(value) && value > 0;
|
|
27329
27384
|
}
|
|
27330
27385
|
function readDocsUnlockPinState(pin2) {
|
|
27331
27386
|
const path109 = getDocsUnlockPinPath(pin2);
|
|
27332
|
-
if (!
|
|
27387
|
+
if (!existsSync59(path109)) return void 0;
|
|
27333
27388
|
try {
|
|
27334
|
-
const state = JSON.parse(
|
|
27389
|
+
const state = JSON.parse(readFileSync40(path109, "utf8"));
|
|
27335
27390
|
if (state.pin !== pin2) return void 0;
|
|
27336
27391
|
if (!isPositiveInteger(state.itemId)) return void 0;
|
|
27337
27392
|
if (!isPositiveInteger(state.phase)) return void 0;
|
|
@@ -27467,13 +27522,13 @@ import { mkdirSync as mkdirSync21, unlinkSync as unlinkSync11, writeFileSync as
|
|
|
27467
27522
|
import chalk170 from "chalk";
|
|
27468
27523
|
|
|
27469
27524
|
// src/commands/schema/getSchemaUnlockPinPath.ts
|
|
27470
|
-
import { join as
|
|
27525
|
+
import { join as join73 } from "path";
|
|
27471
27526
|
function getSchemaUnlockPinPath(pin2) {
|
|
27472
|
-
return
|
|
27527
|
+
return join73(getRestrictedDir(), `schema-unlock-pin-${pin2}.json`);
|
|
27473
27528
|
}
|
|
27474
27529
|
|
|
27475
27530
|
// src/commands/schema/readSchemaUnlockPinState.ts
|
|
27476
|
-
import { existsSync as
|
|
27531
|
+
import { existsSync as existsSync60, readFileSync as readFileSync41 } from "fs";
|
|
27477
27532
|
function isPositiveInteger2(value) {
|
|
27478
27533
|
return Number.isInteger(value) && value > 0;
|
|
27479
27534
|
}
|
|
@@ -27487,9 +27542,9 @@ function toState(raw) {
|
|
|
27487
27542
|
}
|
|
27488
27543
|
function readSchemaUnlockPinState(pin2) {
|
|
27489
27544
|
const path109 = getSchemaUnlockPinPath(pin2);
|
|
27490
|
-
if (!
|
|
27545
|
+
if (!existsSync60(path109)) return void 0;
|
|
27491
27546
|
try {
|
|
27492
|
-
const raw = JSON.parse(
|
|
27547
|
+
const raw = JSON.parse(readFileSync41(path109, "utf8"));
|
|
27493
27548
|
if (raw.pin !== pin2) return void 0;
|
|
27494
27549
|
return toState(raw);
|
|
27495
27550
|
} catch {
|
|
@@ -27612,7 +27667,7 @@ function registerSchema(parent) {
|
|
|
27612
27667
|
|
|
27613
27668
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
27614
27669
|
import { closeSync as closeSync5, openSync as openSync6, readdirSync as readdirSync12 } from "fs";
|
|
27615
|
-
import { join as
|
|
27670
|
+
import { join as join74 } from "path";
|
|
27616
27671
|
import chalk172 from "chalk";
|
|
27617
27672
|
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "packages"]);
|
|
27618
27673
|
function isLockedDll(debugDir) {
|
|
@@ -27624,7 +27679,7 @@ function isLockedDll(debugDir) {
|
|
|
27624
27679
|
}
|
|
27625
27680
|
for (const file of files) {
|
|
27626
27681
|
if (!file.toLowerCase().endsWith(".dll")) continue;
|
|
27627
|
-
const dllPath =
|
|
27682
|
+
const dllPath = join74(debugDir, file);
|
|
27628
27683
|
try {
|
|
27629
27684
|
const fd = openSync6(dllPath, "r+");
|
|
27630
27685
|
closeSync5(fd);
|
|
@@ -27642,13 +27697,13 @@ function findFirstLockedDll(dir) {
|
|
|
27642
27697
|
return null;
|
|
27643
27698
|
}
|
|
27644
27699
|
if (entries.includes("bin")) {
|
|
27645
|
-
const locked = isLockedDll(
|
|
27700
|
+
const locked = isLockedDll(join74(dir, "bin", "Debug"));
|
|
27646
27701
|
if (locked) return locked;
|
|
27647
27702
|
}
|
|
27648
27703
|
for (const entry of entries) {
|
|
27649
27704
|
if (SKIP_DIRS.has(entry) || entry === "bin" || entry.startsWith("."))
|
|
27650
27705
|
continue;
|
|
27651
|
-
const found = findFirstLockedDll(
|
|
27706
|
+
const found = findFirstLockedDll(join74(dir, entry));
|
|
27652
27707
|
if (found) return found;
|
|
27653
27708
|
}
|
|
27654
27709
|
return null;
|
|
@@ -27671,11 +27726,11 @@ async function checkBuildLocksCommand() {
|
|
|
27671
27726
|
}
|
|
27672
27727
|
|
|
27673
27728
|
// src/commands/dotnet/buildTree.ts
|
|
27674
|
-
import { readFileSync as
|
|
27729
|
+
import { readFileSync as readFileSync42 } from "fs";
|
|
27675
27730
|
import path36 from "path";
|
|
27676
27731
|
var PROJECT_REF_RE = /<ProjectReference\s+Include="([^"]+)"/g;
|
|
27677
27732
|
function getProjectRefs(csprojPath) {
|
|
27678
|
-
const content =
|
|
27733
|
+
const content = readFileSync42(csprojPath, "utf8");
|
|
27679
27734
|
const refs = [];
|
|
27680
27735
|
for (const match of content.matchAll(PROJECT_REF_RE)) {
|
|
27681
27736
|
refs.push(match[1].replace(/\\/g, "/"));
|
|
@@ -27692,7 +27747,7 @@ function buildTree(csprojPath, repoRoot2, visited = /* @__PURE__ */ new Set()) {
|
|
|
27692
27747
|
for (const ref of getProjectRefs(abs)) {
|
|
27693
27748
|
const childAbs = path36.resolve(dir, ref);
|
|
27694
27749
|
try {
|
|
27695
|
-
|
|
27750
|
+
readFileSync42(childAbs);
|
|
27696
27751
|
node.children.push(buildTree(childAbs, repoRoot2, visited));
|
|
27697
27752
|
} catch {
|
|
27698
27753
|
node.children.push({
|
|
@@ -27717,7 +27772,7 @@ function collectAllDeps(node) {
|
|
|
27717
27772
|
}
|
|
27718
27773
|
|
|
27719
27774
|
// src/commands/dotnet/findContainingSolutions.ts
|
|
27720
|
-
import { readdirSync as readdirSync13, readFileSync as
|
|
27775
|
+
import { readdirSync as readdirSync13, readFileSync as readFileSync43, statSync as statSync9 } from "fs";
|
|
27721
27776
|
import path37 from "path";
|
|
27722
27777
|
function findSlnFiles(dir, maxDepth, depth = 0) {
|
|
27723
27778
|
if (depth > maxDepth) return [];
|
|
@@ -27752,7 +27807,7 @@ function findContainingSolutions(csprojPath, repoRoot2) {
|
|
|
27752
27807
|
const pattern2 = new RegExp(`[\\\\"/]${escapeRegex(csprojBasename)}"`);
|
|
27753
27808
|
for (const sln of slnFiles) {
|
|
27754
27809
|
try {
|
|
27755
|
-
const content =
|
|
27810
|
+
const content = readFileSync43(sln, "utf8");
|
|
27756
27811
|
if (pattern2.test(content)) {
|
|
27757
27812
|
matches.push(path37.relative(repoRoot2, sln));
|
|
27758
27813
|
}
|
|
@@ -27816,12 +27871,12 @@ function printJson(tree, totalCount, solutions) {
|
|
|
27816
27871
|
}
|
|
27817
27872
|
|
|
27818
27873
|
// src/commands/dotnet/resolveCsproj.ts
|
|
27819
|
-
import { existsSync as
|
|
27874
|
+
import { existsSync as existsSync61 } from "fs";
|
|
27820
27875
|
import path38 from "path";
|
|
27821
27876
|
import chalk174 from "chalk";
|
|
27822
27877
|
function resolveCsproj(csprojPath) {
|
|
27823
27878
|
const resolved = path38.resolve(csprojPath);
|
|
27824
|
-
if (!
|
|
27879
|
+
if (!existsSync61(resolved)) {
|
|
27825
27880
|
console.error(chalk174.red(`File not found: ${resolved}`));
|
|
27826
27881
|
process.exit(1);
|
|
27827
27882
|
}
|
|
@@ -27989,17 +28044,17 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
27989
28044
|
}
|
|
27990
28045
|
|
|
27991
28046
|
// src/commands/dotnet/resolveSolution.ts
|
|
27992
|
-
import { existsSync as
|
|
28047
|
+
import { existsSync as existsSync62 } from "fs";
|
|
27993
28048
|
import path39 from "path";
|
|
27994
28049
|
import chalk178 from "chalk";
|
|
27995
28050
|
|
|
27996
28051
|
// src/commands/dotnet/findSolution.ts
|
|
27997
28052
|
import { readdirSync as readdirSync14 } from "fs";
|
|
27998
|
-
import { dirname as dirname32, join as
|
|
28053
|
+
import { dirname as dirname32, join as join75 } from "path";
|
|
27999
28054
|
import chalk177 from "chalk";
|
|
28000
28055
|
function findSlnInDir(dir) {
|
|
28001
28056
|
try {
|
|
28002
|
-
return readdirSync14(dir).filter((f) => f.endsWith(".sln")).map((f) =>
|
|
28057
|
+
return readdirSync14(dir).filter((f) => f.endsWith(".sln")).map((f) => join75(dir, f));
|
|
28003
28058
|
} catch {
|
|
28004
28059
|
return [];
|
|
28005
28060
|
}
|
|
@@ -28030,7 +28085,7 @@ function findSolution() {
|
|
|
28030
28085
|
function resolveSolution(sln) {
|
|
28031
28086
|
if (sln) {
|
|
28032
28087
|
const resolved = path39.resolve(sln);
|
|
28033
|
-
if (!
|
|
28088
|
+
if (!existsSync62(resolved)) {
|
|
28034
28089
|
console.error(chalk178.red(`Solution file not found: ${resolved}`));
|
|
28035
28090
|
process.exit(1);
|
|
28036
28091
|
}
|
|
@@ -28070,7 +28125,7 @@ function parseInspectReport(json) {
|
|
|
28070
28125
|
|
|
28071
28126
|
// src/commands/dotnet/runInspectCode.ts
|
|
28072
28127
|
import { execSync as execSync40 } from "child_process";
|
|
28073
|
-
import { existsSync as
|
|
28128
|
+
import { existsSync as existsSync63, readFileSync as readFileSync44, unlinkSync as unlinkSync12 } from "fs";
|
|
28074
28129
|
import { tmpdir as tmpdir4 } from "os";
|
|
28075
28130
|
import path40 from "path";
|
|
28076
28131
|
import chalk179 from "chalk";
|
|
@@ -28101,11 +28156,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
28101
28156
|
console.error(chalk179.red("jb inspectcode failed"));
|
|
28102
28157
|
process.exit(1);
|
|
28103
28158
|
}
|
|
28104
|
-
if (!
|
|
28159
|
+
if (!existsSync63(reportPath)) {
|
|
28105
28160
|
console.error(chalk179.red("Report file not generated"));
|
|
28106
28161
|
process.exit(1);
|
|
28107
28162
|
}
|
|
28108
|
-
const xml =
|
|
28163
|
+
const xml = readFileSync44(reportPath, "utf8");
|
|
28109
28164
|
unlinkSync12(reportPath);
|
|
28110
28165
|
return xml;
|
|
28111
28166
|
}
|
|
@@ -28987,7 +29042,7 @@ function aggregateCommitters(authorLists) {
|
|
|
28987
29042
|
import { spawnSync as spawnSync6 } from "child_process";
|
|
28988
29043
|
import { unlinkSync as unlinkSync13, writeFileSync as writeFileSync33 } from "fs";
|
|
28989
29044
|
import { tmpdir as tmpdir5 } from "os";
|
|
28990
|
-
import { join as
|
|
29045
|
+
import { join as join76 } from "path";
|
|
28991
29046
|
function buildArgs2(queryFile, vars) {
|
|
28992
29047
|
const args = ["api", "graphql", "-F", `query=@${queryFile}`];
|
|
28993
29048
|
for (const [key, value] of Object.entries(vars)) {
|
|
@@ -28997,7 +29052,7 @@ function buildArgs2(queryFile, vars) {
|
|
|
28997
29052
|
return args;
|
|
28998
29053
|
}
|
|
28999
29054
|
function runGhGraphql(mutation, vars) {
|
|
29000
|
-
const queryFile =
|
|
29055
|
+
const queryFile = join76(tmpdir5(), `gh-query-${Date.now()}.graphql`);
|
|
29001
29056
|
writeFileSync33(queryFile, mutation);
|
|
29002
29057
|
try {
|
|
29003
29058
|
const result = spawnSync6("gh", buildArgs2(queryFile, vars), {
|
|
@@ -30448,14 +30503,14 @@ function slugFromUrl(url) {
|
|
|
30448
30503
|
import { mkdirSync as mkdirSync22, writeFileSync as writeFileSync34 } from "fs";
|
|
30449
30504
|
|
|
30450
30505
|
// src/commands/github/issue/issueWorkingFile.ts
|
|
30451
|
-
import { join as
|
|
30506
|
+
import { join as join77 } from "path";
|
|
30452
30507
|
function issueWorkingFile(slug2, number) {
|
|
30453
30508
|
const [owner = "unknown", repo = "unknown"] = slug2.split("/");
|
|
30454
|
-
const dir =
|
|
30509
|
+
const dir = join77(getStoreDir(), "github-issues", owner, repo);
|
|
30455
30510
|
return {
|
|
30456
30511
|
dir,
|
|
30457
|
-
bodyPath:
|
|
30458
|
-
metaPath:
|
|
30512
|
+
bodyPath: join77(dir, `${number}.md`),
|
|
30513
|
+
metaPath: join77(dir, `${number}.json`)
|
|
30459
30514
|
};
|
|
30460
30515
|
}
|
|
30461
30516
|
|
|
@@ -30490,14 +30545,14 @@ function fetchIssueToWorkingFile(number, repo) {
|
|
|
30490
30545
|
}
|
|
30491
30546
|
|
|
30492
30547
|
// src/commands/github/issue/resumeIssueBody.ts
|
|
30493
|
-
import { existsSync as
|
|
30548
|
+
import { existsSync as existsSync64, readFileSync as readFileSync45 } from "fs";
|
|
30494
30549
|
function resumeIssueBody(slug2, number, updatedAt) {
|
|
30495
30550
|
const { bodyPath, metaPath } = issueWorkingFile(slug2, number);
|
|
30496
|
-
if (!
|
|
30551
|
+
if (!existsSync64(bodyPath) || !existsSync64(metaPath)) return void 0;
|
|
30497
30552
|
try {
|
|
30498
|
-
const meta = JSON.parse(
|
|
30553
|
+
const meta = JSON.parse(readFileSync45(metaPath, "utf8"));
|
|
30499
30554
|
if (meta.updatedAt !== updatedAt) return void 0;
|
|
30500
|
-
return
|
|
30555
|
+
return readFileSync45(bodyPath, "utf8");
|
|
30501
30556
|
} catch {
|
|
30502
30557
|
return void 0;
|
|
30503
30558
|
}
|
|
@@ -31360,15 +31415,15 @@ function recentDaemonLogLines(includeRelayed = true) {
|
|
|
31360
31415
|
}
|
|
31361
31416
|
|
|
31362
31417
|
// src/commands/sessions/daemon/worktree/createWorktree.ts
|
|
31363
|
-
import { existsSync as
|
|
31418
|
+
import { existsSync as existsSync65 } from "fs";
|
|
31364
31419
|
import { basename as basename20, dirname as dirname34 } from "path";
|
|
31365
31420
|
|
|
31366
31421
|
// src/commands/sessions/daemon/worktree/nextWorktreePath.ts
|
|
31367
|
-
import { basename as basename19, join as
|
|
31422
|
+
import { basename as basename19, join as join78 } from "path";
|
|
31368
31423
|
function nextWorktreePath(clone, base, isTaken) {
|
|
31369
31424
|
const name = basename19(clone);
|
|
31370
31425
|
for (let n = 2; n < 1e3; n++) {
|
|
31371
|
-
const candidate =
|
|
31426
|
+
const candidate = join78(base, `${name}-${n}`);
|
|
31372
31427
|
if (!isTaken(candidate)) return candidate;
|
|
31373
31428
|
}
|
|
31374
31429
|
throw new Error(`no free worktree suffix for ${clone}`);
|
|
@@ -31392,7 +31447,7 @@ function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
|
|
|
31392
31447
|
const base = strategy.root ? expandTilde(strategy.root) : dirname34(clone);
|
|
31393
31448
|
const registered = new Set(listWorktreePaths(clone));
|
|
31394
31449
|
const branches = new Set(listLocalBranches(clone));
|
|
31395
|
-
const isTaken = (candidate) => registered.has(candidate) ||
|
|
31450
|
+
const isTaken = (candidate) => registered.has(candidate) || existsSync65(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename20(candidate));
|
|
31396
31451
|
const path109 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
|
|
31397
31452
|
const ready = addWorktree(clone, path109, strategy.trunk);
|
|
31398
31453
|
ready.catch(() => {
|
|
@@ -31630,21 +31685,21 @@ function persistedTreeRoots() {
|
|
|
31630
31685
|
}
|
|
31631
31686
|
|
|
31632
31687
|
// src/commands/sessions/daemon/worktree/seedWorktree.ts
|
|
31633
|
-
import { copyFileSync, existsSync as
|
|
31634
|
-
import { dirname as dirname35, join as
|
|
31688
|
+
import { copyFileSync, existsSync as existsSync67, mkdirSync as mkdirSync23 } from "fs";
|
|
31689
|
+
import { dirname as dirname35, join as join80 } from "path";
|
|
31635
31690
|
|
|
31636
31691
|
// src/commands/sessions/daemon/worktree/runInstall.ts
|
|
31637
|
-
import { resolve as
|
|
31692
|
+
import { resolve as resolve22 } from "path";
|
|
31638
31693
|
|
|
31639
31694
|
// src/commands/sessions/daemon/worktree/detectInstallCommand.ts
|
|
31640
|
-
import { existsSync as
|
|
31641
|
-
import { join as
|
|
31695
|
+
import { existsSync as existsSync66 } from "fs";
|
|
31696
|
+
import { join as join79 } from "path";
|
|
31642
31697
|
function detectInstallCommand(dir) {
|
|
31643
|
-
if (!
|
|
31644
|
-
if (
|
|
31645
|
-
if (
|
|
31646
|
-
if (
|
|
31647
|
-
if (
|
|
31698
|
+
if (!existsSync66(join79(dir, "package.json"))) return null;
|
|
31699
|
+
if (existsSync66(join79(dir, "pnpm-lock.yaml"))) return "pnpm install";
|
|
31700
|
+
if (existsSync66(join79(dir, "yarn.lock"))) return "yarn install";
|
|
31701
|
+
if (existsSync66(join79(dir, "bun.lockb"))) return "bun install";
|
|
31702
|
+
if (existsSync66(join79(dir, "package-lock.json"))) return "npm ci";
|
|
31648
31703
|
return "npm install";
|
|
31649
31704
|
}
|
|
31650
31705
|
|
|
@@ -31775,7 +31830,7 @@ function installPaths(worktreePath, paths, onSeeded, onInstalling) {
|
|
|
31775
31830
|
onSeeded();
|
|
31776
31831
|
return;
|
|
31777
31832
|
}
|
|
31778
|
-
const dir =
|
|
31833
|
+
const dir = resolve22(worktreePath, rel);
|
|
31779
31834
|
const command = detectInstallCommand(dir);
|
|
31780
31835
|
if (!command) {
|
|
31781
31836
|
daemonLog(
|
|
@@ -31809,9 +31864,9 @@ function seedWorktree(worktreePath, clone, onSeeded = () => {
|
|
|
31809
31864
|
}
|
|
31810
31865
|
function copyConfigFiles(worktreePath, clone, copy) {
|
|
31811
31866
|
for (const rel of copy) {
|
|
31812
|
-
const src =
|
|
31813
|
-
if (!
|
|
31814
|
-
const dest =
|
|
31867
|
+
const src = join80(clone, rel);
|
|
31868
|
+
if (!existsSync67(src)) continue;
|
|
31869
|
+
const dest = join80(worktreePath, rel);
|
|
31815
31870
|
try {
|
|
31816
31871
|
mkdirSync23(dirname35(dest), { recursive: true });
|
|
31817
31872
|
copyFileSync(src, dest);
|
|
@@ -32281,12 +32336,12 @@ function registerLitellm(program) {
|
|
|
32281
32336
|
|
|
32282
32337
|
// src/commands/mermaidExport.ts
|
|
32283
32338
|
import { mkdirSync as mkdirSync24, readdirSync as readdirSync15 } from "fs";
|
|
32284
|
-
import { resolve as
|
|
32339
|
+
import { resolve as resolve24 } from "path";
|
|
32285
32340
|
import chalk196 from "chalk";
|
|
32286
32341
|
|
|
32287
32342
|
// src/commands/mermaid/exportFile.ts
|
|
32288
|
-
import { readFileSync as
|
|
32289
|
-
import { basename as basename21, extname as extname4, resolve as
|
|
32343
|
+
import { readFileSync as readFileSync46, writeFileSync as writeFileSync35 } from "fs";
|
|
32344
|
+
import { basename as basename21, extname as extname4, resolve as resolve23 } from "path";
|
|
32290
32345
|
import chalk195 from "chalk";
|
|
32291
32346
|
|
|
32292
32347
|
// src/commands/mermaid/renderBlock.ts
|
|
@@ -32311,7 +32366,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
32311
32366
|
|
|
32312
32367
|
// src/commands/mermaid/exportFile.ts
|
|
32313
32368
|
async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
32314
|
-
const content =
|
|
32369
|
+
const content = readFileSync46(file, "utf8");
|
|
32315
32370
|
const blocks = extractMermaidBlocks(content);
|
|
32316
32371
|
const stem = basename21(file, extname4(file));
|
|
32317
32372
|
if (onlyIndex !== void 0) {
|
|
@@ -32334,7 +32389,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
32334
32389
|
for (const [i, source] of blocks.entries()) {
|
|
32335
32390
|
const idx = i + 1;
|
|
32336
32391
|
if (onlyIndex !== void 0 && idx !== onlyIndex) continue;
|
|
32337
|
-
const outPath =
|
|
32392
|
+
const outPath = resolve23(outDir, `${stem}-${idx}.svg`);
|
|
32338
32393
|
const svg = await renderBlock(krokiUrl, source);
|
|
32339
32394
|
writeFileSync35(outPath, svg, "utf8");
|
|
32340
32395
|
console.log(chalk195.green(` \u2192 ${outPath}`));
|
|
@@ -32348,7 +32403,7 @@ function extractMermaidBlocks(markdown) {
|
|
|
32348
32403
|
// src/commands/mermaidExport.ts
|
|
32349
32404
|
async function mermaidExport(file, options2 = {}) {
|
|
32350
32405
|
const { mermaid } = loadConfig();
|
|
32351
|
-
const outDir =
|
|
32406
|
+
const outDir = resolve24(process.cwd(), options2.out ?? ".");
|
|
32352
32407
|
mkdirSync24(outDir, { recursive: true });
|
|
32353
32408
|
if (options2.index !== void 0) {
|
|
32354
32409
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
@@ -32476,17 +32531,17 @@ function emitExtract(out, header, texts) {
|
|
|
32476
32531
|
}
|
|
32477
32532
|
|
|
32478
32533
|
// src/commands/miro/resolveExtractPath.ts
|
|
32479
|
-
import { isAbsolute as isAbsolute4, relative as relative8, resolve as
|
|
32534
|
+
import { isAbsolute as isAbsolute4, relative as relative8, resolve as resolve25 } from "path";
|
|
32480
32535
|
function extractRoot(cwd) {
|
|
32481
32536
|
return findConfigUp(cwd)?.rootDir ?? cwd;
|
|
32482
32537
|
}
|
|
32483
32538
|
function resolveExtractPath(value, cwd) {
|
|
32484
32539
|
if (value === void 0) return void 0;
|
|
32485
|
-
return isAbsolute4(value) ? value :
|
|
32540
|
+
return isAbsolute4(value) ? value : resolve25(extractRoot(cwd), value);
|
|
32486
32541
|
}
|
|
32487
32542
|
function storedExtractPath(value, cwd) {
|
|
32488
32543
|
if (value === void 0) return void 0;
|
|
32489
|
-
const absolute2 =
|
|
32544
|
+
const absolute2 = resolve25(cwd, value);
|
|
32490
32545
|
const within2 = relative8(extractRoot(cwd), absolute2);
|
|
32491
32546
|
return within2.startsWith("..") ? absolute2 : within2;
|
|
32492
32547
|
}
|
|
@@ -32523,14 +32578,14 @@ function applyIgnore(texts, ignore3) {
|
|
|
32523
32578
|
}
|
|
32524
32579
|
|
|
32525
32580
|
// src/commands/miro/readIgnoreList.ts
|
|
32526
|
-
import { existsSync as
|
|
32581
|
+
import { existsSync as existsSync68, readFileSync as readFileSync47 } from "fs";
|
|
32527
32582
|
import { parse as parse2 } from "yaml";
|
|
32528
32583
|
function readIgnoreList(file) {
|
|
32529
|
-
if (!
|
|
32584
|
+
if (!existsSync68(file))
|
|
32530
32585
|
throw new MiroExtractError(
|
|
32531
32586
|
`No ignore file at ${file}. Write a YAML list of the box texts to drop, or omit --ignore.`
|
|
32532
32587
|
);
|
|
32533
|
-
const parsed = parse2(
|
|
32588
|
+
const parsed = parse2(readFileSync47(file, "utf8"));
|
|
32534
32589
|
if (parsed === null || parsed === void 0) return [];
|
|
32535
32590
|
if (!Array.isArray(parsed) || parsed.some((entry) => typeof entry !== "string"))
|
|
32536
32591
|
throw new MiroExtractError(
|
|
@@ -32710,7 +32765,7 @@ async function pickAnchors(sessionId2, items2) {
|
|
|
32710
32765
|
}
|
|
32711
32766
|
|
|
32712
32767
|
// src/commands/miro/readMiroItems.ts
|
|
32713
|
-
import { readFileSync as
|
|
32768
|
+
import { readFileSync as readFileSync48 } from "fs";
|
|
32714
32769
|
function tryParse(text20) {
|
|
32715
32770
|
try {
|
|
32716
32771
|
return JSON.parse(text20);
|
|
@@ -32739,7 +32794,7 @@ function parsePages(raw, file) {
|
|
|
32739
32794
|
return Array.isArray(parsed) ? parsed.map(toPage) : [toPage(parsed)];
|
|
32740
32795
|
}
|
|
32741
32796
|
function readMiroItems(file) {
|
|
32742
|
-
const items2 = parsePages(
|
|
32797
|
+
const items2 = parsePages(readFileSync48(file, "utf8"), file).flatMap(
|
|
32743
32798
|
(page) => page.data ?? []
|
|
32744
32799
|
);
|
|
32745
32800
|
if (items2.length === 0)
|
|
@@ -33011,15 +33066,15 @@ function createNetcapHandler(options2) {
|
|
|
33011
33066
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
33012
33067
|
import { cp as cp4, readFile as readFile7, writeFile as writeFile6 } from "fs/promises";
|
|
33013
33068
|
import { networkInterfaces } from "os";
|
|
33014
|
-
import { join as
|
|
33069
|
+
import { join as join82 } from "path";
|
|
33015
33070
|
import chalk199 from "chalk";
|
|
33016
33071
|
|
|
33017
33072
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
33018
|
-
import { dirname as dirname37, join as
|
|
33073
|
+
import { dirname as dirname37, join as join81 } from "path";
|
|
33019
33074
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
33020
33075
|
var moduleDir2 = dirname37(fileURLToPath7(import.meta.url));
|
|
33021
33076
|
function netcapExtensionDir() {
|
|
33022
|
-
return
|
|
33077
|
+
return join81(moduleDir2, "commands", "netcap", "netcap-extension");
|
|
33023
33078
|
}
|
|
33024
33079
|
|
|
33025
33080
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
@@ -33034,7 +33089,7 @@ function lanIPv4() {
|
|
|
33034
33089
|
return void 0;
|
|
33035
33090
|
}
|
|
33036
33091
|
async function configureBackground(dir, host, port, filter) {
|
|
33037
|
-
const file =
|
|
33092
|
+
const file = join82(dir, "background.js");
|
|
33038
33093
|
const source = await readFile7(file, "utf8");
|
|
33039
33094
|
await writeFile6(
|
|
33040
33095
|
file,
|
|
@@ -33074,20 +33129,20 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
33074
33129
|
}
|
|
33075
33130
|
|
|
33076
33131
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
33077
|
-
import { isAbsolute as isAbsolute5, join as
|
|
33132
|
+
import { isAbsolute as isAbsolute5, join as join84, resolve as resolve26 } from "path";
|
|
33078
33133
|
|
|
33079
33134
|
// src/commands/netcap/defaultCapturePath.ts
|
|
33080
33135
|
import { homedir as homedir24 } from "os";
|
|
33081
|
-
import { join as
|
|
33136
|
+
import { join as join83 } from "path";
|
|
33082
33137
|
function defaultCapturePath() {
|
|
33083
|
-
return
|
|
33138
|
+
return join83(homedir24(), ".assist", "netcap", "capture.jsonl");
|
|
33084
33139
|
}
|
|
33085
33140
|
|
|
33086
33141
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
33087
33142
|
function resolveNetcapOutPath(out) {
|
|
33088
33143
|
if (!out) return defaultCapturePath();
|
|
33089
|
-
const dir = isAbsolute5(out) ? out :
|
|
33090
|
-
return
|
|
33144
|
+
const dir = isAbsolute5(out) ? out : resolve26(process.cwd(), out);
|
|
33145
|
+
return join84(dir, "capture.jsonl");
|
|
33091
33146
|
}
|
|
33092
33147
|
|
|
33093
33148
|
// src/commands/netcap/netcap.ts
|
|
@@ -33134,11 +33189,11 @@ netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"}
|
|
|
33134
33189
|
|
|
33135
33190
|
// src/commands/netcap/netcapExtract.ts
|
|
33136
33191
|
import { writeFileSync as writeFileSync37 } from "fs";
|
|
33137
|
-
import { join as
|
|
33192
|
+
import { join as join85 } from "path";
|
|
33138
33193
|
import chalk201 from "chalk";
|
|
33139
33194
|
|
|
33140
33195
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
33141
|
-
import { readFileSync as
|
|
33196
|
+
import { readFileSync as readFileSync49 } from "fs";
|
|
33142
33197
|
|
|
33143
33198
|
// src/commands/netcap/parseRscRows.ts
|
|
33144
33199
|
var isRscRef = (v) => typeof v === "string" && /^\$[0-9a-fL@]/.test(v);
|
|
@@ -33534,7 +33589,7 @@ function extractVoyagerPosts(body) {
|
|
|
33534
33589
|
|
|
33535
33590
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
33536
33591
|
function captureEntries(captureFile) {
|
|
33537
|
-
const lines2 =
|
|
33592
|
+
const lines2 = readFileSync49(captureFile, "utf8").split("\n").filter(Boolean);
|
|
33538
33593
|
const entries = [];
|
|
33539
33594
|
for (const line of lines2) {
|
|
33540
33595
|
let entry;
|
|
@@ -33579,7 +33634,7 @@ function extractPostsFromCapture(captureFile) {
|
|
|
33579
33634
|
function netcapExtract(file) {
|
|
33580
33635
|
const captureFile = file ?? defaultCapturePath();
|
|
33581
33636
|
const posts = extractPostsFromCapture(captureFile);
|
|
33582
|
-
const outFile =
|
|
33637
|
+
const outFile = join85(captureFile, "..", "posts.json");
|
|
33583
33638
|
writeFileSync37(outFile, `${JSON.stringify(posts, null, 2)}
|
|
33584
33639
|
`);
|
|
33585
33640
|
console.log(
|
|
@@ -33975,9 +34030,9 @@ async function comment2(path109, line, body, options2 = {}) {
|
|
|
33975
34030
|
|
|
33976
34031
|
// src/commands/prs/commentsCachePath.ts
|
|
33977
34032
|
import { homedir as homedir25 } from "os";
|
|
33978
|
-
import { join as
|
|
34033
|
+
import { join as join86 } from "path";
|
|
33979
34034
|
function commentsCachePath(org, repo, prNumber) {
|
|
33980
|
-
return
|
|
34035
|
+
return join86(
|
|
33981
34036
|
homedir25(),
|
|
33982
34037
|
".assist",
|
|
33983
34038
|
"pr-comments",
|
|
@@ -33993,19 +34048,19 @@ import { dirname as dirname39 } from "path";
|
|
|
33993
34048
|
import { stringify as stringify3 } from "yaml";
|
|
33994
34049
|
|
|
33995
34050
|
// src/commands/prs/loadCommentsCache.ts
|
|
33996
|
-
import { existsSync as
|
|
34051
|
+
import { existsSync as existsSync69, readFileSync as readFileSync50, unlinkSync as unlinkSync14 } from "fs";
|
|
33997
34052
|
import { parse as parse3 } from "yaml";
|
|
33998
34053
|
function loadCommentsCache(org, repo, prNumber) {
|
|
33999
34054
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
34000
|
-
if (!
|
|
34055
|
+
if (!existsSync69(cachePath)) {
|
|
34001
34056
|
return null;
|
|
34002
34057
|
}
|
|
34003
|
-
const content =
|
|
34058
|
+
const content = readFileSync50(cachePath, "utf8");
|
|
34004
34059
|
return parse3(content);
|
|
34005
34060
|
}
|
|
34006
34061
|
function deleteCommentsCache(org, repo, prNumber) {
|
|
34007
34062
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
34008
|
-
if (
|
|
34063
|
+
if (existsSync69(cachePath)) {
|
|
34009
34064
|
unlinkSync14(cachePath);
|
|
34010
34065
|
console.log("No more unresolved line comments. Cache dropped.");
|
|
34011
34066
|
}
|
|
@@ -34013,10 +34068,10 @@ function deleteCommentsCache(org, repo, prNumber) {
|
|
|
34013
34068
|
|
|
34014
34069
|
// src/commands/prs/removeStaleCommentsCaches.ts
|
|
34015
34070
|
import { readdirSync as readdirSync16, unlinkSync as unlinkSync15 } from "fs";
|
|
34016
|
-
import { join as
|
|
34071
|
+
import { join as join87 } from "path";
|
|
34017
34072
|
var STALE_PATTERN = /^pr-\d+-comments\.yaml$/;
|
|
34018
34073
|
function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
34019
|
-
const dir =
|
|
34074
|
+
const dir = join87(cwd, ".assist");
|
|
34020
34075
|
let entries;
|
|
34021
34076
|
try {
|
|
34022
34077
|
entries = readdirSync16(dir);
|
|
@@ -34024,7 +34079,7 @@ function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
|
34024
34079
|
return;
|
|
34025
34080
|
}
|
|
34026
34081
|
for (const entry of entries.filter((e) => STALE_PATTERN.test(e))) {
|
|
34027
|
-
unlinkSync15(
|
|
34082
|
+
unlinkSync15(join87(dir, entry));
|
|
34028
34083
|
}
|
|
34029
34084
|
}
|
|
34030
34085
|
|
|
@@ -34142,7 +34197,7 @@ function failAzureDevops(error) {
|
|
|
34142
34197
|
import { execFileSync as execFileSync19 } from "child_process";
|
|
34143
34198
|
import { mkdtempSync as mkdtempSync2, rmSync as rmSync6, writeFileSync as writeFileSync39 } from "fs";
|
|
34144
34199
|
import { tmpdir as tmpdir6 } from "os";
|
|
34145
|
-
import { join as
|
|
34200
|
+
import { join as join88 } from "path";
|
|
34146
34201
|
function azDevopsInvokeArgs(request, inFile) {
|
|
34147
34202
|
return [
|
|
34148
34203
|
"devops",
|
|
@@ -34177,8 +34232,8 @@ function runAz2(args) {
|
|
|
34177
34232
|
}
|
|
34178
34233
|
function invokeAzDevops(request) {
|
|
34179
34234
|
if (request.body === void 0) return runAz2(azDevopsInvokeArgs(request));
|
|
34180
|
-
const dir = mkdtempSync2(
|
|
34181
|
-
const inFile =
|
|
34235
|
+
const dir = mkdtempSync2(join88(tmpdir6(), "assist-az-"));
|
|
34236
|
+
const inFile = join88(dir, "body.json");
|
|
34182
34237
|
try {
|
|
34183
34238
|
writeFileSync39(inFile, JSON.stringify(request.body));
|
|
34184
34239
|
return runAz2(azDevopsInvokeArgs(request, inFile));
|
|
@@ -34925,7 +34980,7 @@ ${resolves}` : baseWhy);
|
|
|
34925
34980
|
|
|
34926
34981
|
// src/commands/prs/parseScreenshotSpec.ts
|
|
34927
34982
|
import { statSync as statSync10 } from "fs";
|
|
34928
|
-
import { basename as basename22, extname as extname5, resolve as
|
|
34983
|
+
import { basename as basename22, extname as extname5, resolve as resolve27 } from "path";
|
|
34929
34984
|
function splitOnce(value, separator) {
|
|
34930
34985
|
const index3 = value.indexOf(separator);
|
|
34931
34986
|
if (index3 === -1) return null;
|
|
@@ -34941,7 +34996,7 @@ function isFile2(path109) {
|
|
|
34941
34996
|
function parseScreenshotSpec(spec) {
|
|
34942
34997
|
const [label, rawPath] = splitOnce(spec, "=") ?? ["", spec];
|
|
34943
34998
|
const [group, caption] = splitOnce(label, "/") ?? ["", label];
|
|
34944
|
-
const path109 =
|
|
34999
|
+
const path109 = resolve27(rawPath.trim());
|
|
34945
35000
|
const ext = extname5(path109).replace(/^\./, "").toLowerCase();
|
|
34946
35001
|
if (!isFile2(path109))
|
|
34947
35002
|
throw new Error(`--screenshot '${spec}': file not found: ${path109}`);
|
|
@@ -35964,7 +36019,7 @@ function registerPrsStatus(prsCommand) {
|
|
|
35964
36019
|
}
|
|
35965
36020
|
|
|
35966
36021
|
// src/commands/readTime/readTime.ts
|
|
35967
|
-
import { readFileSync as
|
|
36022
|
+
import { readFileSync as readFileSync51 } from "fs";
|
|
35968
36023
|
|
|
35969
36024
|
// src/commands/readTime/countReadingWords.ts
|
|
35970
36025
|
var FENCE_PATTERN = /^\s*(```|~~~)/;
|
|
@@ -36125,7 +36180,7 @@ async function loadBody(target) {
|
|
|
36125
36180
|
}
|
|
36126
36181
|
function readDraftFile(path109) {
|
|
36127
36182
|
try {
|
|
36128
|
-
return
|
|
36183
|
+
return readFileSync51(path109, "utf8");
|
|
36129
36184
|
} catch {
|
|
36130
36185
|
console.error(`Error: Could not read \`${path109}\`.`);
|
|
36131
36186
|
console.error(
|
|
@@ -36632,10 +36687,10 @@ function checkStreamGraph(streams) {
|
|
|
36632
36687
|
}
|
|
36633
36688
|
|
|
36634
36689
|
// src/commands/releases/readStreamsInput.ts
|
|
36635
|
-
import { readFileSync as
|
|
36690
|
+
import { readFileSync as readFileSync52 } from "fs";
|
|
36636
36691
|
import { parse as parse4 } from "yaml";
|
|
36637
36692
|
function readSource2(source) {
|
|
36638
|
-
return
|
|
36693
|
+
return readFileSync52(source === "-" ? 0 : source, "utf8");
|
|
36639
36694
|
}
|
|
36640
36695
|
function readStreamsInput(source) {
|
|
36641
36696
|
let parsed;
|
|
@@ -37306,9 +37361,9 @@ async function notify() {
|
|
|
37306
37361
|
|
|
37307
37362
|
// src/commands/screenshot.ts
|
|
37308
37363
|
import { execSync as execSync54 } from "child_process";
|
|
37309
|
-
import { existsSync as
|
|
37364
|
+
import { existsSync as existsSync70, mkdirSync as mkdirSync27, unlinkSync as unlinkSync16, writeFileSync as writeFileSync40 } from "fs";
|
|
37310
37365
|
import { tmpdir as tmpdir7 } from "os";
|
|
37311
|
-
import { join as
|
|
37366
|
+
import { join as join89, resolve as resolve28 } from "path";
|
|
37312
37367
|
import chalk228 from "chalk";
|
|
37313
37368
|
|
|
37314
37369
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
@@ -37438,14 +37493,14 @@ Write-Output $OutputPath
|
|
|
37438
37493
|
|
|
37439
37494
|
// src/commands/screenshot.ts
|
|
37440
37495
|
function buildOutputPath(outputDir, processName) {
|
|
37441
|
-
if (!
|
|
37496
|
+
if (!existsSync70(outputDir)) {
|
|
37442
37497
|
mkdirSync27(outputDir, { recursive: true });
|
|
37443
37498
|
}
|
|
37444
37499
|
const timestamp9 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
37445
|
-
return
|
|
37500
|
+
return resolve28(outputDir, `${processName}-${timestamp9}.png`);
|
|
37446
37501
|
}
|
|
37447
37502
|
function runPowerShellScript(processName, outputPath) {
|
|
37448
|
-
const scriptPath =
|
|
37503
|
+
const scriptPath = join89(tmpdir7(), `assist-screenshot-${Date.now()}.ps1`);
|
|
37449
37504
|
writeFileSync40(scriptPath, captureWindowPs1, "utf8");
|
|
37450
37505
|
try {
|
|
37451
37506
|
execSync54(
|
|
@@ -37458,7 +37513,7 @@ function runPowerShellScript(processName, outputPath) {
|
|
|
37458
37513
|
}
|
|
37459
37514
|
function screenshot(processName) {
|
|
37460
37515
|
const config = loadConfig();
|
|
37461
|
-
const outputDir =
|
|
37516
|
+
const outputDir = resolve28(config.screenshot.outputDir);
|
|
37462
37517
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
37463
37518
|
console.log(chalk228.gray(`Capturing window for process "${processName}" ...`));
|
|
37464
37519
|
try {
|
|
@@ -37546,10 +37601,10 @@ function buildLimitsSegment(rateLimits) {
|
|
|
37546
37601
|
}
|
|
37547
37602
|
|
|
37548
37603
|
// src/commands/readGitBranch.ts
|
|
37549
|
-
import { readFileSync as
|
|
37550
|
-
import { isAbsolute as isAbsolute6, join as
|
|
37604
|
+
import { readFileSync as readFileSync53, statSync as statSync11 } from "fs";
|
|
37605
|
+
import { isAbsolute as isAbsolute6, join as join90, resolve as resolve29 } from "path";
|
|
37551
37606
|
function resolveGitDir(cwd) {
|
|
37552
|
-
const dotGit =
|
|
37607
|
+
const dotGit = join90(cwd, ".git");
|
|
37553
37608
|
let stat5;
|
|
37554
37609
|
try {
|
|
37555
37610
|
stat5 = statSync11(dotGit);
|
|
@@ -37561,7 +37616,7 @@ function resolveGitDir(cwd) {
|
|
|
37561
37616
|
}
|
|
37562
37617
|
let contents;
|
|
37563
37618
|
try {
|
|
37564
|
-
contents =
|
|
37619
|
+
contents = readFileSync53(dotGit, "utf8");
|
|
37565
37620
|
} catch {
|
|
37566
37621
|
return null;
|
|
37567
37622
|
}
|
|
@@ -37570,7 +37625,7 @@ function resolveGitDir(cwd) {
|
|
|
37570
37625
|
return null;
|
|
37571
37626
|
}
|
|
37572
37627
|
const gitDir = match[1].trim();
|
|
37573
|
-
return isAbsolute6(gitDir) ? gitDir :
|
|
37628
|
+
return isAbsolute6(gitDir) ? gitDir : resolve29(cwd, gitDir);
|
|
37574
37629
|
}
|
|
37575
37630
|
function readGitBranch(cwd) {
|
|
37576
37631
|
const gitDir = resolveGitDir(cwd);
|
|
@@ -37579,7 +37634,7 @@ function readGitBranch(cwd) {
|
|
|
37579
37634
|
}
|
|
37580
37635
|
let head;
|
|
37581
37636
|
try {
|
|
37582
|
-
head =
|
|
37637
|
+
head = readFileSync53(join90(gitDir, "HEAD"), "utf8");
|
|
37583
37638
|
} catch {
|
|
37584
37639
|
return null;
|
|
37585
37640
|
}
|
|
@@ -40698,7 +40753,7 @@ function fetchHighLevelPr(prNumber, repo) {
|
|
|
40698
40753
|
}
|
|
40699
40754
|
|
|
40700
40755
|
// src/commands/review/highLevel/gatherHighLevelSlices.ts
|
|
40701
|
-
import { readFileSync as
|
|
40756
|
+
import { readFileSync as readFileSync55 } from "fs";
|
|
40702
40757
|
|
|
40703
40758
|
// src/commands/review/highLevel/formatSlicingRequest.ts
|
|
40704
40759
|
var RULES = [
|
|
@@ -40759,12 +40814,12 @@ function formatSlicingRequest(hunks) {
|
|
|
40759
40814
|
}
|
|
40760
40815
|
|
|
40761
40816
|
// src/commands/review/highLevel/highLevelReviewPath.ts
|
|
40762
|
-
import { join as
|
|
40817
|
+
import { join as join91 } from "path";
|
|
40763
40818
|
function slug(value) {
|
|
40764
40819
|
return value.replace(/[^\w.-]+/g, "-");
|
|
40765
40820
|
}
|
|
40766
40821
|
function highLevelReviewPath(repo, headRef, headSha) {
|
|
40767
|
-
return
|
|
40822
|
+
return join91(
|
|
40768
40823
|
getStoreDir(),
|
|
40769
40824
|
"high-level-reviews",
|
|
40770
40825
|
slug(repo),
|
|
@@ -40816,11 +40871,11 @@ function listHighLevelHunks(files) {
|
|
|
40816
40871
|
}
|
|
40817
40872
|
|
|
40818
40873
|
// src/commands/review/highLevel/readJsonFile.ts
|
|
40819
|
-
import { existsSync as
|
|
40874
|
+
import { existsSync as existsSync71, readFileSync as readFileSync54 } from "fs";
|
|
40820
40875
|
function readJsonFile(path109) {
|
|
40821
|
-
if (!
|
|
40876
|
+
if (!existsSync71(path109)) return void 0;
|
|
40822
40877
|
try {
|
|
40823
|
-
return JSON.parse(
|
|
40878
|
+
return JSON.parse(readFileSync54(path109, "utf8"));
|
|
40824
40879
|
} catch {
|
|
40825
40880
|
return void 0;
|
|
40826
40881
|
}
|
|
@@ -40911,7 +40966,7 @@ function writeJsonFile(path109, data) {
|
|
|
40911
40966
|
// src/commands/review/highLevel/gatherHighLevelSlices.ts
|
|
40912
40967
|
function readSlicesFile(file) {
|
|
40913
40968
|
try {
|
|
40914
|
-
return JSON.parse(
|
|
40969
|
+
return JSON.parse(readFileSync55(file, "utf8"));
|
|
40915
40970
|
} catch (error) {
|
|
40916
40971
|
throw new Error(
|
|
40917
40972
|
`could not read slices from ${file}: ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -41792,7 +41847,7 @@ async function runHighLevelReview(number, options2 = {}) {
|
|
|
41792
41847
|
import { basename as basename26 } from "path";
|
|
41793
41848
|
|
|
41794
41849
|
// src/commands/review/ci/writeJobSummary.ts
|
|
41795
|
-
import { appendFileSync as appendFileSync3, readFileSync as
|
|
41850
|
+
import { appendFileSync as appendFileSync3, readFileSync as readFileSync56 } from "fs";
|
|
41796
41851
|
|
|
41797
41852
|
// src/commands/review/carriedUnanchoredFindings.ts
|
|
41798
41853
|
function carriedUnanchoredFindings(unanchored) {
|
|
@@ -42174,7 +42229,7 @@ function buildTokenUsageTable(usages) {
|
|
|
42174
42229
|
// src/commands/review/ci/writeJobSummary.ts
|
|
42175
42230
|
function writeJobSummary(synthesisPath, prInfo, summaryPath, slots) {
|
|
42176
42231
|
if (!summaryPath) return;
|
|
42177
|
-
const markdown =
|
|
42232
|
+
const markdown = readFileSync56(synthesisPath, "utf8");
|
|
42178
42233
|
const { unanchored } = selectPostableFindings(markdown, prInfo);
|
|
42179
42234
|
const usageTable = buildTokenUsageTable(slots.map((slot) => slot.usage));
|
|
42180
42235
|
appendFileSync3(
|
|
@@ -42293,7 +42348,7 @@ import { format as format2 } from "util";
|
|
|
42293
42348
|
|
|
42294
42349
|
// src/commands/review/createReviewLogSink.ts
|
|
42295
42350
|
import { appendFileSync as appendFileSync4, mkdirSync as mkdirSync29 } from "fs";
|
|
42296
|
-
import { join as
|
|
42351
|
+
import { join as join92 } from "path";
|
|
42297
42352
|
var LOG_FILE = "review.log";
|
|
42298
42353
|
function createReviewLogSink() {
|
|
42299
42354
|
let logPath2;
|
|
@@ -42310,7 +42365,7 @@ function createReviewLogSink() {
|
|
|
42310
42365
|
},
|
|
42311
42366
|
attach(reviewDir) {
|
|
42312
42367
|
mkdirSync29(reviewDir, { recursive: true });
|
|
42313
|
-
logPath2 =
|
|
42368
|
+
logPath2 = join92(reviewDir, LOG_FILE);
|
|
42314
42369
|
const lines2 = [
|
|
42315
42370
|
"",
|
|
42316
42371
|
`=== ${(/* @__PURE__ */ new Date()).toISOString()} ===`,
|
|
@@ -42995,7 +43050,7 @@ async function runClaudeReviewer(spec) {
|
|
|
42995
43050
|
}
|
|
42996
43051
|
|
|
42997
43052
|
// src/commands/review/runCodexReviewer.ts
|
|
42998
|
-
import { existsSync as
|
|
43053
|
+
import { existsSync as existsSync72, unlinkSync as unlinkSync17 } from "fs";
|
|
42999
43054
|
|
|
43000
43055
|
// src/commands/review/parseCodexUsage.ts
|
|
43001
43056
|
function parseCodexUsage(usage) {
|
|
@@ -43084,7 +43139,7 @@ async function runCodexReviewer(spec) {
|
|
|
43084
43139
|
...override.args.length > 0 ? { env: override.env } : {},
|
|
43085
43140
|
onLine
|
|
43086
43141
|
});
|
|
43087
|
-
if (result.exitCode !== 0 &&
|
|
43142
|
+
if (result.exitCode !== 0 && existsSync72(spec.outputPath)) {
|
|
43088
43143
|
unlinkSync17(spec.outputPath);
|
|
43089
43144
|
}
|
|
43090
43145
|
const finalised = finaliseReviewerRun(
|
|
@@ -43178,10 +43233,10 @@ async function runReviewers(reviewDir, claudePath, codexPath, stdinPrompt, optio
|
|
|
43178
43233
|
}
|
|
43179
43234
|
|
|
43180
43235
|
// src/commands/review/synthesiseAfterReviewers.ts
|
|
43181
|
-
import { existsSync as
|
|
43236
|
+
import { existsSync as existsSync73, unlinkSync as unlinkSync18 } from "fs";
|
|
43182
43237
|
|
|
43183
43238
|
// src/commands/review/synthesise.ts
|
|
43184
|
-
import { readFileSync as
|
|
43239
|
+
import { readFileSync as readFileSync57 } from "fs";
|
|
43185
43240
|
|
|
43186
43241
|
// src/commands/review/buildSynthesisStdin.ts
|
|
43187
43242
|
var SYNTHESIS_PROMPT = `You are consolidating two independent code reviews of the same change. The original review request is in request.md. The two reviews are in claude.md and codex.md in the current working directory.
|
|
@@ -43250,7 +43305,7 @@ Files:
|
|
|
43250
43305
|
|
|
43251
43306
|
// src/commands/review/synthesise.ts
|
|
43252
43307
|
function printSummary2(synthesisPath) {
|
|
43253
|
-
const markdown =
|
|
43308
|
+
const markdown = readFileSync57(synthesisPath, "utf8");
|
|
43254
43309
|
console.log("");
|
|
43255
43310
|
console.log(buildReviewSummary(markdown));
|
|
43256
43311
|
console.log("");
|
|
@@ -43285,7 +43340,7 @@ async function synthesise(paths, options2) {
|
|
|
43285
43340
|
// src/commands/review/synthesiseAfterReviewers.ts
|
|
43286
43341
|
async function synthesiseAfterReviewers(input) {
|
|
43287
43342
|
const { paths, failures } = input;
|
|
43288
|
-
if (input.anyFresh &&
|
|
43343
|
+
if (input.anyFresh && existsSync73(paths.synthesisPath)) {
|
|
43289
43344
|
unlinkSync18(paths.synthesisPath);
|
|
43290
43345
|
}
|
|
43291
43346
|
const synthesisResult = await synthesise(paths, {
|
|
@@ -43517,9 +43572,9 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
|
|
|
43517
43572
|
|
|
43518
43573
|
// src/commands/review/buildReviewPaths.ts
|
|
43519
43574
|
import { homedir as homedir26 } from "os";
|
|
43520
|
-
import { basename as basename25, join as
|
|
43575
|
+
import { basename as basename25, join as join93 } from "path";
|
|
43521
43576
|
function buildReviewPaths(repoRoot2, key) {
|
|
43522
|
-
const reviewDir =
|
|
43577
|
+
const reviewDir = join93(
|
|
43523
43578
|
homedir26(),
|
|
43524
43579
|
".assist",
|
|
43525
43580
|
"reviews",
|
|
@@ -43528,10 +43583,10 @@ function buildReviewPaths(repoRoot2, key) {
|
|
|
43528
43583
|
);
|
|
43529
43584
|
return {
|
|
43530
43585
|
reviewDir,
|
|
43531
|
-
requestPath:
|
|
43532
|
-
claudePath:
|
|
43533
|
-
codexPath:
|
|
43534
|
-
synthesisPath:
|
|
43586
|
+
requestPath: join93(reviewDir, "request.md"),
|
|
43587
|
+
claudePath: join93(reviewDir, "claude.md"),
|
|
43588
|
+
codexPath: join93(reviewDir, "codex.md"),
|
|
43589
|
+
synthesisPath: join93(reviewDir, "synthesis.md")
|
|
43535
43590
|
};
|
|
43536
43591
|
}
|
|
43537
43592
|
|
|
@@ -43569,10 +43624,10 @@ function fetchExistingComments() {
|
|
|
43569
43624
|
}
|
|
43570
43625
|
|
|
43571
43626
|
// src/commands/review/prepareReviewDir.ts
|
|
43572
|
-
import { existsSync as
|
|
43627
|
+
import { existsSync as existsSync74, mkdirSync as mkdirSync30, unlinkSync as unlinkSync19, writeFileSync as writeFileSync43 } from "fs";
|
|
43573
43628
|
function clearReviewFiles(paths) {
|
|
43574
43629
|
for (const path109 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
43575
|
-
if (
|
|
43630
|
+
if (existsSync74(path109)) unlinkSync19(path109);
|
|
43576
43631
|
}
|
|
43577
43632
|
}
|
|
43578
43633
|
function prepareReviewDir(paths, requestBody, force) {
|
|
@@ -43695,7 +43750,7 @@ function gatherChangedContext() {
|
|
|
43695
43750
|
}
|
|
43696
43751
|
|
|
43697
43752
|
// src/commands/review/postReviewToPr.ts
|
|
43698
|
-
import { readFileSync as
|
|
43753
|
+
import { readFileSync as readFileSync58 } from "fs";
|
|
43699
43754
|
|
|
43700
43755
|
// src/commands/review/chainAddressComments.ts
|
|
43701
43756
|
function chainAddressComments(prNumber, announce) {
|
|
@@ -43877,7 +43932,7 @@ async function confirmPost(prNumber, work, options2) {
|
|
|
43877
43932
|
return promptConfirm(`Post ${work} to PR #${prNumber}?`, false);
|
|
43878
43933
|
}
|
|
43879
43934
|
async function postFindingsToPr(prInfo, synthesisPath, options2) {
|
|
43880
|
-
const markdown =
|
|
43935
|
+
const markdown = readFileSync58(synthesisPath, "utf8");
|
|
43881
43936
|
const { inDiff, unanchored } = selectPostableFindings(markdown, prInfo);
|
|
43882
43937
|
const carried = carriedUnanchoredFindings(unanchored);
|
|
43883
43938
|
if (inDiff.length === 0 && carried.length === 0)
|
|
@@ -44241,11 +44296,11 @@ import path88 from "path";
|
|
|
44241
44296
|
import chalk263 from "chalk";
|
|
44242
44297
|
|
|
44243
44298
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
44244
|
-
import { existsSync as
|
|
44299
|
+
import { existsSync as existsSync75, readFileSync as readFileSync60, writeFileSync as writeFileSync44 } from "fs";
|
|
44245
44300
|
import path87 from "path";
|
|
44246
44301
|
|
|
44247
44302
|
// src/commands/rules/scopedRuleDirectories.ts
|
|
44248
|
-
import { readFileSync as
|
|
44303
|
+
import { readFileSync as readFileSync59 } from "fs";
|
|
44249
44304
|
import path86 from "path";
|
|
44250
44305
|
|
|
44251
44306
|
// src/commands/rules/findClaudeFiles.ts
|
|
@@ -44269,7 +44324,7 @@ function findClaudeFiles(dir) {
|
|
|
44269
44324
|
// src/commands/rules/scopedRuleDirectories.ts
|
|
44270
44325
|
function scopedRuleDirectories(root2) {
|
|
44271
44326
|
return findClaudeFiles(root2).filter(
|
|
44272
|
-
(file) => path86.dirname(file) !== root2 && parseRulesSection(
|
|
44327
|
+
(file) => path86.dirname(file) !== root2 && parseRulesSection(readFileSync59(file, "utf8")).length > 0
|
|
44273
44328
|
).map(
|
|
44274
44329
|
(file) => `${path86.relative(root2, path86.dirname(file)).split(path86.sep).join("/")}/`
|
|
44275
44330
|
).sort();
|
|
@@ -44311,7 +44366,7 @@ function upsertScopedRulesPointer(content, directories) {
|
|
|
44311
44366
|
function updateScopedRulesIndex(root2) {
|
|
44312
44367
|
const directories = scopedRuleDirectories(root2);
|
|
44313
44368
|
const rootFile = path87.join(root2, "CLAUDE.md");
|
|
44314
|
-
const before =
|
|
44369
|
+
const before = existsSync75(rootFile) ? readFileSync60(rootFile, "utf8") : "";
|
|
44315
44370
|
const after = upsertScopedRulesPointer(before, directories);
|
|
44316
44371
|
if (after !== before) writeFileSync44(rootFile, after);
|
|
44317
44372
|
return directories;
|
|
@@ -44364,7 +44419,7 @@ function listRules(target, options2 = {}) {
|
|
|
44364
44419
|
}
|
|
44365
44420
|
|
|
44366
44421
|
// src/commands/rules/addRule.ts
|
|
44367
|
-
import { existsSync as
|
|
44422
|
+
import { existsSync as existsSync77, readFileSync as readFileSync62, writeFileSync as writeFileSync45 } from "fs";
|
|
44368
44423
|
import path91 from "path";
|
|
44369
44424
|
import chalk265 from "chalk";
|
|
44370
44425
|
|
|
@@ -44389,11 +44444,11 @@ function insertRuleBullet(content, rule) {
|
|
|
44389
44444
|
}
|
|
44390
44445
|
|
|
44391
44446
|
// src/commands/rules/nextRuleCode.ts
|
|
44392
|
-
import { readFileSync as
|
|
44447
|
+
import { readFileSync as readFileSync61 } from "fs";
|
|
44393
44448
|
var CODE_PREFIX = "R";
|
|
44394
44449
|
function nextRuleCode(root2) {
|
|
44395
44450
|
const numbers = findClaudeFiles(root2).flatMap(
|
|
44396
|
-
(file) => parseRulesSection(
|
|
44451
|
+
(file) => parseRulesSection(readFileSync61(file, "utf8")).map(
|
|
44397
44452
|
(rule) => Number(/(\d+)\s*$/.exec(rule.code)?.[1] ?? 0)
|
|
44398
44453
|
)
|
|
44399
44454
|
);
|
|
@@ -44401,7 +44456,7 @@ function nextRuleCode(root2) {
|
|
|
44401
44456
|
}
|
|
44402
44457
|
|
|
44403
44458
|
// src/commands/rules/resolveRuleScope.ts
|
|
44404
|
-
import { existsSync as
|
|
44459
|
+
import { existsSync as existsSync76 } from "fs";
|
|
44405
44460
|
import path90 from "path";
|
|
44406
44461
|
function resolveRuleScope(target) {
|
|
44407
44462
|
const resolved = path90.resolve(target);
|
|
@@ -44411,7 +44466,7 @@ function resolveRuleScope(target) {
|
|
|
44411
44466
|
let current = startDir;
|
|
44412
44467
|
while (true) {
|
|
44413
44468
|
const candidate = path90.join(current, "CLAUDE.md");
|
|
44414
|
-
if (
|
|
44469
|
+
if (existsSync76(candidate)) return candidate;
|
|
44415
44470
|
if (current === root2 || current === path90.dirname(current)) break;
|
|
44416
44471
|
current = path90.dirname(current);
|
|
44417
44472
|
}
|
|
@@ -44420,7 +44475,7 @@ function resolveRuleScope(target) {
|
|
|
44420
44475
|
|
|
44421
44476
|
// src/commands/rules/addRule.ts
|
|
44422
44477
|
function read2(file) {
|
|
44423
|
-
return
|
|
44478
|
+
return existsSync77(file) ? readFileSync62(file, "utf8") : "";
|
|
44424
44479
|
}
|
|
44425
44480
|
function addRule(text20, options2) {
|
|
44426
44481
|
const rule = text20.trim();
|
|
@@ -44943,7 +44998,7 @@ function findShownSessionFiles(body, writtenPaths, locations) {
|
|
|
44943
44998
|
}
|
|
44944
44999
|
|
|
44945
45000
|
// src/commands/show/sessionWrittenPaths.ts
|
|
44946
|
-
import { readFileSync as
|
|
45001
|
+
import { readFileSync as readFileSync63 } from "fs";
|
|
44947
45002
|
|
|
44948
45003
|
// src/commands/sessions/shared/asRecord.ts
|
|
44949
45004
|
function asRecord(value) {
|
|
@@ -44971,7 +45026,7 @@ function writtenFilePaths(entry) {
|
|
|
44971
45026
|
function sessionWrittenPaths(transcriptPath2) {
|
|
44972
45027
|
let text20;
|
|
44973
45028
|
try {
|
|
44974
|
-
text20 =
|
|
45029
|
+
text20 = readFileSync63(transcriptPath2, "utf8");
|
|
44975
45030
|
} catch {
|
|
44976
45031
|
return [];
|
|
44977
45032
|
}
|
|
@@ -45090,12 +45145,12 @@ import { mkdirSync as mkdirSync32, writeFileSync as writeFileSync47 } from "fs";
|
|
|
45090
45145
|
import { mkdirSync as mkdirSync31, writeFileSync as writeFileSync46 } from "fs";
|
|
45091
45146
|
|
|
45092
45147
|
// src/commands/slack/readSlackParts.ts
|
|
45093
|
-
import { readFileSync as
|
|
45148
|
+
import { readFileSync as readFileSync64 } from "fs";
|
|
45094
45149
|
function readSlackParts(files) {
|
|
45095
45150
|
return files.map((file) => {
|
|
45096
45151
|
let contents;
|
|
45097
45152
|
try {
|
|
45098
|
-
contents =
|
|
45153
|
+
contents = readFileSync64(file, "utf8");
|
|
45099
45154
|
} catch {
|
|
45100
45155
|
console.error(`Error: Part file not found: ${file}`);
|
|
45101
45156
|
process.exit(1);
|
|
@@ -45133,12 +45188,12 @@ async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
|
45133
45188
|
}
|
|
45134
45189
|
|
|
45135
45190
|
// src/commands/slack/slackWorkingFile.ts
|
|
45136
|
-
import { join as
|
|
45191
|
+
import { join as join94 } from "path";
|
|
45137
45192
|
function slackWorkingFile(channel, partIndex) {
|
|
45138
45193
|
const slug2 = channel.replace(/^[#@]/, "").toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "channel";
|
|
45139
|
-
const dir =
|
|
45194
|
+
const dir = join94(getStoreDir(), "slack");
|
|
45140
45195
|
const name = partIndex === void 0 ? slug2 : `${slug2}-${partIndex}`;
|
|
45141
|
-
return { dir, bodyPath:
|
|
45196
|
+
return { dir, bodyPath: join94(dir, `${name}.md`) };
|
|
45142
45197
|
}
|
|
45143
45198
|
|
|
45144
45199
|
// src/commands/slack/previewSlackThreadParts.ts
|
|
@@ -45959,7 +46014,7 @@ function registerSync(program) {
|
|
|
45959
46014
|
}
|
|
45960
46015
|
|
|
45961
46016
|
// src/commands/transcript/clean.ts
|
|
45962
|
-
import { existsSync as
|
|
46017
|
+
import { existsSync as existsSync82 } from "fs";
|
|
45963
46018
|
|
|
45964
46019
|
// src/commands/transcript/convert/formatTimestamp.ts
|
|
45965
46020
|
function pad2(value, width2) {
|
|
@@ -46209,9 +46264,9 @@ function formatVttPassages(passages, notes = [], { sourceMarks = true } = {}) {
|
|
|
46209
46264
|
}
|
|
46210
46265
|
|
|
46211
46266
|
// src/commands/transcript/convert/readCleanedCues.ts
|
|
46212
|
-
import { readFileSync as
|
|
46267
|
+
import { readFileSync as readFileSync69 } from "fs";
|
|
46213
46268
|
function readCleanedCues(inputPath) {
|
|
46214
|
-
return deduplicateCues(parseVtt(
|
|
46269
|
+
return deduplicateCues(parseVtt(readFileSync69(inputPath, "utf8")));
|
|
46215
46270
|
}
|
|
46216
46271
|
|
|
46217
46272
|
// src/commands/transcript/clean.ts
|
|
@@ -46237,7 +46292,7 @@ function clean(file, options2 = {}) {
|
|
|
46237
46292
|
);
|
|
46238
46293
|
process.exit(1);
|
|
46239
46294
|
}
|
|
46240
|
-
if (!
|
|
46295
|
+
if (!existsSync82(file)) {
|
|
46241
46296
|
console.error(`Error: VTT file not found: ${file}`);
|
|
46242
46297
|
process.exit(1);
|
|
46243
46298
|
}
|
|
@@ -46320,21 +46375,21 @@ async function configure() {
|
|
|
46320
46375
|
}
|
|
46321
46376
|
|
|
46322
46377
|
// src/commands/transcript/list.ts
|
|
46323
|
-
import { existsSync as
|
|
46324
|
-
import { join as
|
|
46378
|
+
import { existsSync as existsSync83, readdirSync as readdirSync24, statSync as statSync13 } from "fs";
|
|
46379
|
+
import { join as join106 } from "path";
|
|
46325
46380
|
function list5() {
|
|
46326
46381
|
const { vttDir } = getTranscriptConfig();
|
|
46327
|
-
if (!
|
|
46382
|
+
if (!existsSync83(vttDir)) return;
|
|
46328
46383
|
for (const entry of readdirSync24(vttDir)) {
|
|
46329
46384
|
if (!entry.endsWith(".vtt")) continue;
|
|
46330
|
-
if (statSync13(
|
|
46385
|
+
if (statSync13(join106(vttDir, entry)).isDirectory()) continue;
|
|
46331
46386
|
console.log(entry);
|
|
46332
46387
|
}
|
|
46333
46388
|
}
|
|
46334
46389
|
|
|
46335
46390
|
// src/commands/transcript/move.ts
|
|
46336
|
-
import { existsSync as
|
|
46337
|
-
import { basename as basename29, join as
|
|
46391
|
+
import { existsSync as existsSync84, mkdirSync as mkdirSync38, renameSync as renameSync5, writeFileSync as writeFileSync52 } from "fs";
|
|
46392
|
+
import { basename as basename29, join as join107 } from "path";
|
|
46338
46393
|
|
|
46339
46394
|
// src/commands/transcript/convertVttToMarkdown.ts
|
|
46340
46395
|
function convertVttToMarkdown(inputPath) {
|
|
@@ -46344,9 +46399,9 @@ function convertVttToMarkdown(inputPath) {
|
|
|
46344
46399
|
// src/commands/transcript/move.ts
|
|
46345
46400
|
var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
46346
46401
|
function archiveRawVtt(vttDir, sourcePath, filename) {
|
|
46347
|
-
const processedDir =
|
|
46402
|
+
const processedDir = join107(vttDir, "processed");
|
|
46348
46403
|
mkdirSync38(processedDir, { recursive: true });
|
|
46349
|
-
renameSync5(sourcePath,
|
|
46404
|
+
renameSync5(sourcePath, join107(processedDir, filename));
|
|
46350
46405
|
}
|
|
46351
46406
|
function move(file, options2) {
|
|
46352
46407
|
const { date, client } = options2;
|
|
@@ -46356,25 +46411,25 @@ function move(file, options2) {
|
|
|
46356
46411
|
}
|
|
46357
46412
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
46358
46413
|
const filename = basename29(file);
|
|
46359
|
-
const sourcePath =
|
|
46360
|
-
if (!
|
|
46414
|
+
const sourcePath = join107(vttDir, filename);
|
|
46415
|
+
if (!existsSync84(sourcePath)) {
|
|
46361
46416
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
46362
46417
|
process.exit(1);
|
|
46363
46418
|
}
|
|
46364
46419
|
const base = basename29(filename, ".vtt").replace(/ Transcription$/, "");
|
|
46365
46420
|
const outputName = `${date} ${base}.md`;
|
|
46366
|
-
const formattedDir =
|
|
46421
|
+
const formattedDir = join107(transcriptsDir, client);
|
|
46367
46422
|
mkdirSync38(formattedDir, { recursive: true });
|
|
46368
|
-
const formattedPath =
|
|
46423
|
+
const formattedPath = join107(formattedDir, outputName);
|
|
46369
46424
|
writeFileSync52(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
|
|
46370
46425
|
archiveRawVtt(vttDir, sourcePath, filename);
|
|
46371
|
-
const summaryPath =
|
|
46426
|
+
const summaryPath = join107(summaryDir, client, outputName);
|
|
46372
46427
|
console.log(`Formatted transcript: ${formattedPath}`);
|
|
46373
46428
|
console.log(`Summary target: ${summaryPath}`);
|
|
46374
46429
|
}
|
|
46375
46430
|
|
|
46376
46431
|
// src/commands/transcript/merge.ts
|
|
46377
|
-
import { existsSync as
|
|
46432
|
+
import { existsSync as existsSync85, writeFileSync as writeFileSync53 } from "fs";
|
|
46378
46433
|
import { basename as basename30 } from "path";
|
|
46379
46434
|
|
|
46380
46435
|
// src/commands/transcript/failTranscript.ts
|
|
@@ -46518,7 +46573,7 @@ function widenAudience(passages) {
|
|
|
46518
46573
|
|
|
46519
46574
|
// src/commands/transcript/merge.ts
|
|
46520
46575
|
function readSource3(file) {
|
|
46521
|
-
if (!
|
|
46576
|
+
if (!existsSync85(file)) failTranscript(`VTT file not found: ${file}`);
|
|
46522
46577
|
const cues = readCleanedCues(file);
|
|
46523
46578
|
if (cues.length === 0) failTranscript(`no cues found in: ${file}`);
|
|
46524
46579
|
return { path: file, name: basename30(file), cues };
|
|
@@ -46991,7 +47046,7 @@ function configKeys2() {
|
|
|
46991
47046
|
}
|
|
46992
47047
|
|
|
46993
47048
|
// src/commands/verify/forbiddenStrings.ts
|
|
46994
|
-
import { existsSync as
|
|
47049
|
+
import { existsSync as existsSync86, readFileSync as readFileSync70 } from "fs";
|
|
46995
47050
|
|
|
46996
47051
|
// src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
|
|
46997
47052
|
import { minimatch as minimatch10 } from "minimatch";
|
|
@@ -47032,13 +47087,13 @@ function forbiddenStrings() {
|
|
|
47032
47087
|
const cache7 = /* @__PURE__ */ new Map();
|
|
47033
47088
|
const readJson = (file) => {
|
|
47034
47089
|
if (cache7.has(file)) return cache7.get(file);
|
|
47035
|
-
if (!
|
|
47090
|
+
if (!existsSync86(file)) {
|
|
47036
47091
|
console.log(`Forbidden-strings file not found: ${file}`);
|
|
47037
47092
|
process.exit(1);
|
|
47038
47093
|
}
|
|
47039
47094
|
let parsed;
|
|
47040
47095
|
try {
|
|
47041
|
-
parsed = JSON.parse(
|
|
47096
|
+
parsed = JSON.parse(readFileSync70(file, "utf8"));
|
|
47042
47097
|
} catch (error) {
|
|
47043
47098
|
console.log(`Could not parse ${file}: ${error.message}`);
|
|
47044
47099
|
process.exit(1);
|
|
@@ -47110,7 +47165,7 @@ Total: ${lines2.length} hardcoded color(s)`);
|
|
|
47110
47165
|
}
|
|
47111
47166
|
|
|
47112
47167
|
// src/commands/verify/migrations.ts
|
|
47113
|
-
import { readFileSync as
|
|
47168
|
+
import { readFileSync as readFileSync71 } from "fs";
|
|
47114
47169
|
import path105 from "path";
|
|
47115
47170
|
|
|
47116
47171
|
// src/commands/verify/migrations/checkAppendOnly.ts
|
|
@@ -47275,7 +47330,7 @@ function migrations2() {
|
|
|
47275
47330
|
if (ref) {
|
|
47276
47331
|
const baseline = readBaselineMigrations(REPO_RELATIVE_DIR, ref);
|
|
47277
47332
|
const current = new Map(
|
|
47278
|
-
files.map((file) => [file,
|
|
47333
|
+
files.map((file) => [file, readFileSync71(path105.join(dir, file), "utf8")])
|
|
47279
47334
|
);
|
|
47280
47335
|
for (const finding of checkAppendOnly(baseline, current)) {
|
|
47281
47336
|
problems.push(
|
|
@@ -47448,6 +47503,231 @@ function emitWatchState(watchState) {
|
|
|
47448
47503
|
emitActivity({ kind: "command", name: "watch", watchState });
|
|
47449
47504
|
}
|
|
47450
47505
|
|
|
47506
|
+
// src/commands/watch/clearBuildPending.ts
|
|
47507
|
+
import { rmSync as rmSync11 } from "fs";
|
|
47508
|
+
function clearBuildPending() {
|
|
47509
|
+
try {
|
|
47510
|
+
rmSync11(buildPendingPath(), { force: true });
|
|
47511
|
+
} catch {
|
|
47512
|
+
}
|
|
47513
|
+
}
|
|
47514
|
+
|
|
47515
|
+
// src/commands/watch/isSyncPending.ts
|
|
47516
|
+
import { existsSync as existsSync87 } from "fs";
|
|
47517
|
+
|
|
47518
|
+
// src/commands/watch/syncPendingPath.ts
|
|
47519
|
+
function syncPendingPath(cwd) {
|
|
47520
|
+
return gitMarkerPath("assist-watch-sync-pending", cwd);
|
|
47521
|
+
}
|
|
47522
|
+
|
|
47523
|
+
// src/commands/watch/isSyncPending.ts
|
|
47524
|
+
function isSyncPending() {
|
|
47525
|
+
try {
|
|
47526
|
+
return existsSync87(syncPendingPath());
|
|
47527
|
+
} catch {
|
|
47528
|
+
return false;
|
|
47529
|
+
}
|
|
47530
|
+
}
|
|
47531
|
+
|
|
47532
|
+
// src/commands/watch/reportSyncOrExit.ts
|
|
47533
|
+
import { rmSync as rmSync12 } from "fs";
|
|
47534
|
+
|
|
47535
|
+
// src/commands/watch/toBuildOutcome.ts
|
|
47536
|
+
function toBuildOutcome(result) {
|
|
47537
|
+
if (result.kind === "failed")
|
|
47538
|
+
return { kind: "failed", exitCode: 1, output: result.message };
|
|
47539
|
+
if (result.exitCode !== 0)
|
|
47540
|
+
return { kind: "failed", exitCode: result.exitCode, output: result.output };
|
|
47541
|
+
return { kind: "built" };
|
|
47542
|
+
}
|
|
47543
|
+
|
|
47544
|
+
// src/commands/watch/runPostBuildSync.ts
|
|
47545
|
+
async function runPostBuildSync() {
|
|
47546
|
+
return toBuildOutcome(
|
|
47547
|
+
await runCommandToCompletion(
|
|
47548
|
+
process.execPath,
|
|
47549
|
+
[process.argv[1], "sync", "--yes"],
|
|
47550
|
+
void 0,
|
|
47551
|
+
void 0,
|
|
47552
|
+
true
|
|
47553
|
+
)
|
|
47554
|
+
);
|
|
47555
|
+
}
|
|
47556
|
+
|
|
47557
|
+
// src/commands/watch/reportSyncOrExit.ts
|
|
47558
|
+
function clearPendingMarker() {
|
|
47559
|
+
try {
|
|
47560
|
+
rmSync12(syncPendingPath(), { force: true });
|
|
47561
|
+
} catch {
|
|
47562
|
+
}
|
|
47563
|
+
}
|
|
47564
|
+
async function reportSyncOrExit() {
|
|
47565
|
+
const outcome = await runPostBuildSync();
|
|
47566
|
+
if (outcome.kind === "built") {
|
|
47567
|
+
clearPendingMarker();
|
|
47568
|
+
console.log("synced ~/.claude");
|
|
47569
|
+
return;
|
|
47570
|
+
}
|
|
47571
|
+
if (outcome.output.length > 0)
|
|
47572
|
+
process.stdout.write(
|
|
47573
|
+
outcome.output.endsWith("\n") ? outcome.output : `${outcome.output}
|
|
47574
|
+
`
|
|
47575
|
+
);
|
|
47576
|
+
console.error(
|
|
47577
|
+
`sync failed with exit code ${outcome.exitCode}; a later lap will retry it`
|
|
47578
|
+
);
|
|
47579
|
+
process.exit(4);
|
|
47580
|
+
}
|
|
47581
|
+
|
|
47582
|
+
// src/commands/run/findRunConfig.ts
|
|
47583
|
+
function exitNoRunConfigs() {
|
|
47584
|
+
console.error("No run configurations found in assist.yml");
|
|
47585
|
+
process.exit(1);
|
|
47586
|
+
}
|
|
47587
|
+
function exitWithConfigNotFound(name, configs) {
|
|
47588
|
+
console.error(`No run configuration found with name: ${name}`);
|
|
47589
|
+
console.error("Available configurations:");
|
|
47590
|
+
for (const r of configs) {
|
|
47591
|
+
console.error(` - ${r.name}`);
|
|
47592
|
+
}
|
|
47593
|
+
process.exit(1);
|
|
47594
|
+
}
|
|
47595
|
+
function exitWithAmbiguousConfig(name, matches) {
|
|
47596
|
+
console.error(`Ambiguous run configuration: ${name}`);
|
|
47597
|
+
console.error("Did you mean:");
|
|
47598
|
+
for (const r of matches) {
|
|
47599
|
+
console.error(` - ${r.name}`);
|
|
47600
|
+
}
|
|
47601
|
+
process.exit(1);
|
|
47602
|
+
}
|
|
47603
|
+
function requireRunConfigs() {
|
|
47604
|
+
const { run: run4 } = loadConfig();
|
|
47605
|
+
const configs = resolveRunConfigs(run4, runConfigBaseDir());
|
|
47606
|
+
if (configs.length === 0) return exitNoRunConfigs();
|
|
47607
|
+
return configs;
|
|
47608
|
+
}
|
|
47609
|
+
function lookupRunConfig(name) {
|
|
47610
|
+
const configs = requireRunConfigs();
|
|
47611
|
+
const exact = configs.find((r) => r.name === name);
|
|
47612
|
+
if (exact) return { kind: "match", config: exact };
|
|
47613
|
+
const suffixMatches = configs.filter((r) => r.name.endsWith(`:${name}`));
|
|
47614
|
+
if (suffixMatches.length === 1)
|
|
47615
|
+
return { kind: "match", config: suffixMatches[0] };
|
|
47616
|
+
if (suffixMatches.length > 1)
|
|
47617
|
+
return { kind: "ambiguous", matches: suffixMatches };
|
|
47618
|
+
return { kind: "not-found" };
|
|
47619
|
+
}
|
|
47620
|
+
function findRunConfig(name) {
|
|
47621
|
+
const result = lookupRunConfig(name);
|
|
47622
|
+
if (result.kind === "match") return result.config;
|
|
47623
|
+
if (result.kind === "ambiguous")
|
|
47624
|
+
return exitWithAmbiguousConfig(name, result.matches);
|
|
47625
|
+
return exitWithConfigNotFound(name, requireRunConfigs());
|
|
47626
|
+
}
|
|
47627
|
+
|
|
47628
|
+
// src/commands/run/resolveParams.ts
|
|
47629
|
+
function resolveParams(params, cliArgs) {
|
|
47630
|
+
if (!params || params.length === 0) return cliArgs;
|
|
47631
|
+
const resolved = [];
|
|
47632
|
+
const missing = [];
|
|
47633
|
+
for (let i = 0; i < params.length; i++) {
|
|
47634
|
+
const param = params[i];
|
|
47635
|
+
const value = cliArgs[i] ?? param.default;
|
|
47636
|
+
if (value !== void 0) {
|
|
47637
|
+
resolved.push(value);
|
|
47638
|
+
} else if (param.required) {
|
|
47639
|
+
missing.push(param.name);
|
|
47640
|
+
}
|
|
47641
|
+
}
|
|
47642
|
+
if (missing.length > 0) {
|
|
47643
|
+
const s = missing.length > 1 ? "s" : "";
|
|
47644
|
+
const names = missing.map((n) => `"${n}"`).join(", ");
|
|
47645
|
+
console.error(`Missing required param${s}: ${names}`);
|
|
47646
|
+
process.exit(1);
|
|
47647
|
+
}
|
|
47648
|
+
resolved.push(...cliArgs.slice(params.length));
|
|
47649
|
+
return resolved;
|
|
47650
|
+
}
|
|
47651
|
+
|
|
47652
|
+
// src/commands/run/resolveRunCwd.ts
|
|
47653
|
+
import { existsSync as existsSync88 } from "fs";
|
|
47654
|
+
import { resolve as resolve31 } from "path";
|
|
47655
|
+
var MissingRunCwdError = class extends Error {
|
|
47656
|
+
constructor(runName, cwd) {
|
|
47657
|
+
super(`run config "${runName}": cwd ${cwd} does not exist`);
|
|
47658
|
+
this.runName = runName;
|
|
47659
|
+
this.cwd = cwd;
|
|
47660
|
+
this.name = "MissingRunCwdError";
|
|
47661
|
+
}
|
|
47662
|
+
};
|
|
47663
|
+
function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
|
|
47664
|
+
if (!config.cwd) return void 0;
|
|
47665
|
+
const cwd = resolve31(baseDir, config.cwd);
|
|
47666
|
+
if (!existsSync88(cwd)) throw new MissingRunCwdError(config.name, cwd);
|
|
47667
|
+
return cwd;
|
|
47668
|
+
}
|
|
47669
|
+
|
|
47670
|
+
// src/commands/run/runPreCommands.ts
|
|
47671
|
+
import { execSync as execSync66 } from "child_process";
|
|
47672
|
+
function writeCapturedOutput(error) {
|
|
47673
|
+
for (const stream of ["stdout", "stderr"]) {
|
|
47674
|
+
const output = error[stream];
|
|
47675
|
+
if (output) process.stdout.write(output);
|
|
47676
|
+
}
|
|
47677
|
+
}
|
|
47678
|
+
function runPreCommands(pre, cwd, quiet) {
|
|
47679
|
+
for (const cmd of pre) {
|
|
47680
|
+
try {
|
|
47681
|
+
execSync66(cmd, { stdio: quiet ? "pipe" : "inherit", cwd });
|
|
47682
|
+
} catch (error) {
|
|
47683
|
+
if (quiet && error && typeof error === "object")
|
|
47684
|
+
writeCapturedOutput(error);
|
|
47685
|
+
const code = error && typeof error === "object" && "status" in error ? error.status : 1;
|
|
47686
|
+
process.exit(code);
|
|
47687
|
+
}
|
|
47688
|
+
}
|
|
47689
|
+
}
|
|
47690
|
+
|
|
47691
|
+
// src/commands/watch/runWatchBuild.ts
|
|
47692
|
+
async function runWatchBuild(entry) {
|
|
47693
|
+
const config = findRunConfig(entry);
|
|
47694
|
+
let cwd;
|
|
47695
|
+
try {
|
|
47696
|
+
cwd = resolveRunCwd(config);
|
|
47697
|
+
} catch (error) {
|
|
47698
|
+
if (!(error instanceof MissingRunCwdError)) throw error;
|
|
47699
|
+
return { kind: "failed", exitCode: 1, output: error.message };
|
|
47700
|
+
}
|
|
47701
|
+
if (config.pre) runPreCommands(config.pre, cwd, true);
|
|
47702
|
+
return toBuildOutcome(
|
|
47703
|
+
await runCommandToCompletion(
|
|
47704
|
+
config.command,
|
|
47705
|
+
[...config.args ?? [], ...resolveParams(config.params, [])],
|
|
47706
|
+
config.env,
|
|
47707
|
+
cwd,
|
|
47708
|
+
true
|
|
47709
|
+
)
|
|
47710
|
+
);
|
|
47711
|
+
}
|
|
47712
|
+
|
|
47713
|
+
// src/commands/watch/finishPendingBuild.ts
|
|
47714
|
+
async function finishPendingBuild(entry) {
|
|
47715
|
+
if (!isBuildPending()) return;
|
|
47716
|
+
console.log("an earlier lap pulled but did not finish building; rebuilding");
|
|
47717
|
+
emitWatchState("updating");
|
|
47718
|
+
const outcome = await runWatchBuild(entry);
|
|
47719
|
+
if (outcome.kind !== "built") {
|
|
47720
|
+
if (outcome.output.length > 0) process.stdout.write(outcome.output);
|
|
47721
|
+
console.error(
|
|
47722
|
+
`build "${entry}" failed with exit code ${outcome.exitCode}; the next pull retries it`
|
|
47723
|
+
);
|
|
47724
|
+
return;
|
|
47725
|
+
}
|
|
47726
|
+
clearBuildPending();
|
|
47727
|
+
console.log(`built with "${entry}"`);
|
|
47728
|
+
if (isSyncPending()) await reportSyncOrExit();
|
|
47729
|
+
}
|
|
47730
|
+
|
|
47451
47731
|
// src/commands/watch/parseWatchDurations.ts
|
|
47452
47732
|
function parseOrExit(value) {
|
|
47453
47733
|
try {
|
|
@@ -47578,39 +47858,25 @@ ${result.reason}`
|
|
|
47578
47858
|
};
|
|
47579
47859
|
}
|
|
47580
47860
|
|
|
47581
|
-
// src/commands/watch/
|
|
47582
|
-
import {
|
|
47583
|
-
|
|
47584
|
-
// src/commands/watch/gitMarkerPath.ts
|
|
47585
|
-
import { resolve as resolve30 } from "path";
|
|
47586
|
-
function gitMarkerPath(name, cwd) {
|
|
47587
|
-
return resolve30(
|
|
47588
|
-
cwd ?? process.cwd(),
|
|
47589
|
-
runGit3(["rev-parse", "--git-path", name], cwd)
|
|
47590
|
-
);
|
|
47591
|
-
}
|
|
47592
|
-
|
|
47593
|
-
// src/commands/watch/syncPendingPath.ts
|
|
47594
|
-
function syncPendingPath(cwd) {
|
|
47595
|
-
return gitMarkerPath("assist-watch-sync-pending", cwd);
|
|
47596
|
-
}
|
|
47597
|
-
|
|
47598
|
-
// src/commands/watch/markSyncPending.ts
|
|
47599
|
-
function pendingFromEarlierLap() {
|
|
47861
|
+
// src/commands/watch/markBuildPending.ts
|
|
47862
|
+
import { writeFileSync as writeFileSync54 } from "fs";
|
|
47863
|
+
function markBuildPending() {
|
|
47600
47864
|
try {
|
|
47601
|
-
|
|
47865
|
+
writeFileSync54(buildPendingPath(), "");
|
|
47602
47866
|
} catch {
|
|
47603
|
-
return false;
|
|
47604
47867
|
}
|
|
47605
47868
|
}
|
|
47869
|
+
|
|
47870
|
+
// src/commands/watch/markSyncPending.ts
|
|
47871
|
+
import { writeFileSync as writeFileSync55 } from "fs";
|
|
47606
47872
|
function writePendingMarker() {
|
|
47607
47873
|
try {
|
|
47608
|
-
|
|
47874
|
+
writeFileSync55(syncPendingPath(), "");
|
|
47609
47875
|
} catch {
|
|
47610
47876
|
}
|
|
47611
47877
|
}
|
|
47612
47878
|
function markSyncPending(from) {
|
|
47613
|
-
const owed =
|
|
47879
|
+
const owed = isSyncPending();
|
|
47614
47880
|
if (syncAdvice(changedPaths(from)).length > 0) {
|
|
47615
47881
|
writePendingMarker();
|
|
47616
47882
|
return true;
|
|
@@ -47690,146 +47956,6 @@ function pullFastForward(cwd) {
|
|
|
47690
47956
|
return mergeBehindBranch(cwd);
|
|
47691
47957
|
}
|
|
47692
47958
|
|
|
47693
|
-
// src/commands/run/findRunConfig.ts
|
|
47694
|
-
function exitNoRunConfigs() {
|
|
47695
|
-
console.error("No run configurations found in assist.yml");
|
|
47696
|
-
process.exit(1);
|
|
47697
|
-
}
|
|
47698
|
-
function exitWithConfigNotFound(name, configs) {
|
|
47699
|
-
console.error(`No run configuration found with name: ${name}`);
|
|
47700
|
-
console.error("Available configurations:");
|
|
47701
|
-
for (const r of configs) {
|
|
47702
|
-
console.error(` - ${r.name}`);
|
|
47703
|
-
}
|
|
47704
|
-
process.exit(1);
|
|
47705
|
-
}
|
|
47706
|
-
function exitWithAmbiguousConfig(name, matches) {
|
|
47707
|
-
console.error(`Ambiguous run configuration: ${name}`);
|
|
47708
|
-
console.error("Did you mean:");
|
|
47709
|
-
for (const r of matches) {
|
|
47710
|
-
console.error(` - ${r.name}`);
|
|
47711
|
-
}
|
|
47712
|
-
process.exit(1);
|
|
47713
|
-
}
|
|
47714
|
-
function requireRunConfigs() {
|
|
47715
|
-
const { run: run4 } = loadConfig();
|
|
47716
|
-
const configs = resolveRunConfigs(run4, runConfigBaseDir());
|
|
47717
|
-
if (configs.length === 0) return exitNoRunConfigs();
|
|
47718
|
-
return configs;
|
|
47719
|
-
}
|
|
47720
|
-
function lookupRunConfig(name) {
|
|
47721
|
-
const configs = requireRunConfigs();
|
|
47722
|
-
const exact = configs.find((r) => r.name === name);
|
|
47723
|
-
if (exact) return { kind: "match", config: exact };
|
|
47724
|
-
const suffixMatches = configs.filter((r) => r.name.endsWith(`:${name}`));
|
|
47725
|
-
if (suffixMatches.length === 1)
|
|
47726
|
-
return { kind: "match", config: suffixMatches[0] };
|
|
47727
|
-
if (suffixMatches.length > 1)
|
|
47728
|
-
return { kind: "ambiguous", matches: suffixMatches };
|
|
47729
|
-
return { kind: "not-found" };
|
|
47730
|
-
}
|
|
47731
|
-
function findRunConfig(name) {
|
|
47732
|
-
const result = lookupRunConfig(name);
|
|
47733
|
-
if (result.kind === "match") return result.config;
|
|
47734
|
-
if (result.kind === "ambiguous")
|
|
47735
|
-
return exitWithAmbiguousConfig(name, result.matches);
|
|
47736
|
-
return exitWithConfigNotFound(name, requireRunConfigs());
|
|
47737
|
-
}
|
|
47738
|
-
|
|
47739
|
-
// src/commands/run/resolveParams.ts
|
|
47740
|
-
function resolveParams(params, cliArgs) {
|
|
47741
|
-
if (!params || params.length === 0) return cliArgs;
|
|
47742
|
-
const resolved = [];
|
|
47743
|
-
const missing = [];
|
|
47744
|
-
for (let i = 0; i < params.length; i++) {
|
|
47745
|
-
const param = params[i];
|
|
47746
|
-
const value = cliArgs[i] ?? param.default;
|
|
47747
|
-
if (value !== void 0) {
|
|
47748
|
-
resolved.push(value);
|
|
47749
|
-
} else if (param.required) {
|
|
47750
|
-
missing.push(param.name);
|
|
47751
|
-
}
|
|
47752
|
-
}
|
|
47753
|
-
if (missing.length > 0) {
|
|
47754
|
-
const s = missing.length > 1 ? "s" : "";
|
|
47755
|
-
const names = missing.map((n) => `"${n}"`).join(", ");
|
|
47756
|
-
console.error(`Missing required param${s}: ${names}`);
|
|
47757
|
-
process.exit(1);
|
|
47758
|
-
}
|
|
47759
|
-
resolved.push(...cliArgs.slice(params.length));
|
|
47760
|
-
return resolved;
|
|
47761
|
-
}
|
|
47762
|
-
|
|
47763
|
-
// src/commands/run/resolveRunCwd.ts
|
|
47764
|
-
import { existsSync as existsSync87 } from "fs";
|
|
47765
|
-
import { resolve as resolve31 } from "path";
|
|
47766
|
-
var MissingRunCwdError = class extends Error {
|
|
47767
|
-
constructor(runName, cwd) {
|
|
47768
|
-
super(`run config "${runName}": cwd ${cwd} does not exist`);
|
|
47769
|
-
this.runName = runName;
|
|
47770
|
-
this.cwd = cwd;
|
|
47771
|
-
this.name = "MissingRunCwdError";
|
|
47772
|
-
}
|
|
47773
|
-
};
|
|
47774
|
-
function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
|
|
47775
|
-
if (!config.cwd) return void 0;
|
|
47776
|
-
const cwd = resolve31(baseDir, config.cwd);
|
|
47777
|
-
if (!existsSync87(cwd)) throw new MissingRunCwdError(config.name, cwd);
|
|
47778
|
-
return cwd;
|
|
47779
|
-
}
|
|
47780
|
-
|
|
47781
|
-
// src/commands/run/runPreCommands.ts
|
|
47782
|
-
import { execSync as execSync66 } from "child_process";
|
|
47783
|
-
function writeCapturedOutput(error) {
|
|
47784
|
-
for (const stream of ["stdout", "stderr"]) {
|
|
47785
|
-
const output = error[stream];
|
|
47786
|
-
if (output) process.stdout.write(output);
|
|
47787
|
-
}
|
|
47788
|
-
}
|
|
47789
|
-
function runPreCommands(pre, cwd, quiet) {
|
|
47790
|
-
for (const cmd of pre) {
|
|
47791
|
-
try {
|
|
47792
|
-
execSync66(cmd, { stdio: quiet ? "pipe" : "inherit", cwd });
|
|
47793
|
-
} catch (error) {
|
|
47794
|
-
if (quiet && error && typeof error === "object")
|
|
47795
|
-
writeCapturedOutput(error);
|
|
47796
|
-
const code = error && typeof error === "object" && "status" in error ? error.status : 1;
|
|
47797
|
-
process.exit(code);
|
|
47798
|
-
}
|
|
47799
|
-
}
|
|
47800
|
-
}
|
|
47801
|
-
|
|
47802
|
-
// src/commands/watch/toBuildOutcome.ts
|
|
47803
|
-
function toBuildOutcome(result) {
|
|
47804
|
-
if (result.kind === "failed")
|
|
47805
|
-
return { kind: "failed", exitCode: 1, output: result.message };
|
|
47806
|
-
if (result.exitCode !== 0)
|
|
47807
|
-
return { kind: "failed", exitCode: result.exitCode, output: result.output };
|
|
47808
|
-
return { kind: "built" };
|
|
47809
|
-
}
|
|
47810
|
-
|
|
47811
|
-
// src/commands/watch/runWatchBuild.ts
|
|
47812
|
-
async function runWatchBuild(entry) {
|
|
47813
|
-
const config = findRunConfig(entry);
|
|
47814
|
-
let cwd;
|
|
47815
|
-
try {
|
|
47816
|
-
cwd = resolveRunCwd(config);
|
|
47817
|
-
} catch (error) {
|
|
47818
|
-
if (!(error instanceof MissingRunCwdError)) throw error;
|
|
47819
|
-
return { kind: "failed", exitCode: 1, output: error.message };
|
|
47820
|
-
}
|
|
47821
|
-
if (config.pre) runPreCommands(config.pre, cwd, true);
|
|
47822
|
-
return toBuildOutcome(
|
|
47823
|
-
await runCommandToCompletion(
|
|
47824
|
-
config.command,
|
|
47825
|
-
[...config.args ?? [], ...resolveParams(config.params, [])],
|
|
47826
|
-
config.env,
|
|
47827
|
-
cwd,
|
|
47828
|
-
true
|
|
47829
|
-
)
|
|
47830
|
-
);
|
|
47831
|
-
}
|
|
47832
|
-
|
|
47833
47959
|
// src/commands/watch/reportBuildOrExit.ts
|
|
47834
47960
|
async function reportBuildOrExit(entry) {
|
|
47835
47961
|
const outcome = await runWatchBuild(entry);
|
|
@@ -47848,49 +47974,13 @@ function reportOutcome({ exitCode, message: message3 }) {
|
|
|
47848
47974
|
else console.error(message3);
|
|
47849
47975
|
}
|
|
47850
47976
|
|
|
47851
|
-
// src/commands/watch/
|
|
47852
|
-
|
|
47853
|
-
|
|
47854
|
-
|
|
47855
|
-
async function runPostBuildSync() {
|
|
47856
|
-
return toBuildOutcome(
|
|
47857
|
-
await runCommandToCompletion(
|
|
47858
|
-
process.execPath,
|
|
47859
|
-
[process.argv[1], "sync", "--yes"],
|
|
47860
|
-
void 0,
|
|
47861
|
-
void 0,
|
|
47862
|
-
true
|
|
47863
|
-
)
|
|
47864
|
-
);
|
|
47865
|
-
}
|
|
47866
|
-
|
|
47867
|
-
// src/commands/watch/reportSyncOrExit.ts
|
|
47868
|
-
function clearPendingMarker() {
|
|
47869
|
-
try {
|
|
47870
|
-
rmSync11(syncPendingPath(), { force: true });
|
|
47871
|
-
} catch {
|
|
47872
|
-
}
|
|
47873
|
-
}
|
|
47874
|
-
async function reportSyncOrExit() {
|
|
47875
|
-
const outcome = await runPostBuildSync();
|
|
47876
|
-
if (outcome.kind === "built") {
|
|
47877
|
-
clearPendingMarker();
|
|
47878
|
-
console.log("synced ~/.claude");
|
|
47879
|
-
return;
|
|
47880
|
-
}
|
|
47881
|
-
if (outcome.output.length > 0)
|
|
47882
|
-
process.stdout.write(
|
|
47883
|
-
outcome.output.endsWith("\n") ? outcome.output : `${outcome.output}
|
|
47884
|
-
`
|
|
47885
|
-
);
|
|
47886
|
-
console.error(
|
|
47887
|
-
`sync failed with exit code ${outcome.exitCode}; a later lap will retry it`
|
|
47888
|
-
);
|
|
47889
|
-
process.exit(4);
|
|
47977
|
+
// src/commands/watch/watchBuildEntry.ts
|
|
47978
|
+
var DEFAULT_BUILD_ENTRY = "auto-build";
|
|
47979
|
+
function watchBuildEntry(build2) {
|
|
47980
|
+
return typeof build2 === "string" ? build2 : DEFAULT_BUILD_ENTRY;
|
|
47890
47981
|
}
|
|
47891
47982
|
|
|
47892
47983
|
// src/commands/watch/pullAndBuild.ts
|
|
47893
|
-
var DEFAULT_BUILD_ENTRY = "auto-build";
|
|
47894
47984
|
async function pullAndBuild(from, build2) {
|
|
47895
47985
|
emitWatchState("updating");
|
|
47896
47986
|
const pullResult = pullFastForward();
|
|
@@ -47898,24 +47988,24 @@ async function pullAndBuild(from, build2) {
|
|
|
47898
47988
|
reportOutcome(pullReport);
|
|
47899
47989
|
if (pullResult.kind !== "fast-forwarded")
|
|
47900
47990
|
return process.exit(pullReport.exitCode);
|
|
47991
|
+
if (build2) markBuildPending();
|
|
47901
47992
|
console.log(`
|
|
47902
47993
|
${buildWatchReport(from)}`);
|
|
47903
47994
|
if (build2) {
|
|
47904
47995
|
const syncNeeded = markSyncPending(from);
|
|
47905
|
-
await reportBuildOrExit(
|
|
47906
|
-
|
|
47907
|
-
);
|
|
47996
|
+
await reportBuildOrExit(watchBuildEntry(build2));
|
|
47997
|
+
clearBuildPending();
|
|
47908
47998
|
if (syncNeeded) await reportSyncOrExit();
|
|
47909
47999
|
}
|
|
47910
48000
|
process.exit(0);
|
|
47911
48001
|
}
|
|
47912
48002
|
|
|
47913
48003
|
// src/commands/watch/consumeMarker.ts
|
|
47914
|
-
import { existsSync as
|
|
48004
|
+
import { existsSync as existsSync89, rmSync as rmSync13 } from "fs";
|
|
47915
48005
|
function consumeMarker(path109) {
|
|
47916
48006
|
try {
|
|
47917
|
-
if (!
|
|
47918
|
-
|
|
48007
|
+
if (!existsSync89(path109)) return false;
|
|
48008
|
+
rmSync13(path109);
|
|
47919
48009
|
return true;
|
|
47920
48010
|
} catch {
|
|
47921
48011
|
return false;
|
|
@@ -48056,6 +48146,8 @@ async function watchWait(options2) {
|
|
|
48056
48146
|
options2.interval,
|
|
48057
48147
|
options2.timeout
|
|
48058
48148
|
);
|
|
48149
|
+
if (options2.pull && options2.build)
|
|
48150
|
+
await finishPendingBuild(watchBuildEntry(options2.build));
|
|
48059
48151
|
const outcome = await waitForUpstream({
|
|
48060
48152
|
intervalMs,
|
|
48061
48153
|
timeoutMs,
|
|
@@ -48099,10 +48191,10 @@ function registerWatchWait(watchCommand) {
|
|
|
48099
48191
|
}
|
|
48100
48192
|
|
|
48101
48193
|
// src/commands/watch/simulateDivergence.ts
|
|
48102
|
-
import { writeFileSync as
|
|
48194
|
+
import { writeFileSync as writeFileSync56 } from "fs";
|
|
48103
48195
|
function simulateDivergence() {
|
|
48104
48196
|
try {
|
|
48105
|
-
|
|
48197
|
+
writeFileSync56(simulatedDivergencePath(), "");
|
|
48106
48198
|
console.log(
|
|
48107
48199
|
`the next assist watch wait poll in ${runGit3(["rev-parse", "--show-toplevel"])} will exit 3 as a simulated divergence`
|
|
48108
48200
|
);
|
|
@@ -48196,8 +48288,8 @@ function registerWatch(program) {
|
|
|
48196
48288
|
|
|
48197
48289
|
// src/commands/roam/postRoamActivity.ts
|
|
48198
48290
|
import { execFileSync as execFileSync31 } from "child_process";
|
|
48199
|
-
import { readdirSync as readdirSync26, readFileSync as
|
|
48200
|
-
import { join as
|
|
48291
|
+
import { readdirSync as readdirSync26, readFileSync as readFileSync72, statSync as statSync14 } from "fs";
|
|
48292
|
+
import { join as join108 } from "path";
|
|
48201
48293
|
function findPortFile(roamDir) {
|
|
48202
48294
|
let entries;
|
|
48203
48295
|
try {
|
|
@@ -48206,7 +48298,7 @@ function findPortFile(roamDir) {
|
|
|
48206
48298
|
return void 0;
|
|
48207
48299
|
}
|
|
48208
48300
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
48209
|
-
const path109 =
|
|
48301
|
+
const path109 = join108(roamDir, name);
|
|
48210
48302
|
try {
|
|
48211
48303
|
return { path: path109, mtimeMs: statSync14(path109).mtimeMs };
|
|
48212
48304
|
} catch {
|
|
@@ -48223,11 +48315,11 @@ var PID_BY_APP = {
|
|
|
48223
48315
|
function postRoamActivity(app, event) {
|
|
48224
48316
|
const appData = process.env.APPDATA;
|
|
48225
48317
|
if (!appData) return;
|
|
48226
|
-
const portFile = findPortFile(
|
|
48318
|
+
const portFile = findPortFile(join108(appData, "Roam"));
|
|
48227
48319
|
if (!portFile) return;
|
|
48228
48320
|
let port;
|
|
48229
48321
|
try {
|
|
48230
|
-
port =
|
|
48322
|
+
port = readFileSync72(portFile, "utf8").trim();
|
|
48231
48323
|
} catch {
|
|
48232
48324
|
return;
|
|
48233
48325
|
}
|
|
@@ -48406,7 +48498,7 @@ function link2() {
|
|
|
48406
48498
|
}
|
|
48407
48499
|
|
|
48408
48500
|
// src/commands/run/add.ts
|
|
48409
|
-
import { mkdirSync as mkdirSync39, writeFileSync as
|
|
48501
|
+
import { mkdirSync as mkdirSync39, writeFileSync as writeFileSync57 } from "fs";
|
|
48410
48502
|
import { dirname as dirname46 } from "path";
|
|
48411
48503
|
|
|
48412
48504
|
// src/commands/run/editRepoRunList.ts
|
|
@@ -48566,11 +48658,11 @@ function requireParsedArgs() {
|
|
|
48566
48658
|
}
|
|
48567
48659
|
|
|
48568
48660
|
// src/commands/run/runCommandFilePath.ts
|
|
48569
|
-
import { join as
|
|
48661
|
+
import { join as join109 } from "path";
|
|
48570
48662
|
function runCommandFilePath(name) {
|
|
48571
48663
|
const segments = name.split(":");
|
|
48572
48664
|
const file = `${segments.pop()}.md`;
|
|
48573
|
-
return
|
|
48665
|
+
return join109(".claude", "commands", ...segments, file);
|
|
48574
48666
|
}
|
|
48575
48667
|
|
|
48576
48668
|
// src/commands/run/add.ts
|
|
@@ -48594,7 +48686,7 @@ description: Run ${name}
|
|
|
48594
48686
|
|
|
48595
48687
|
Run \`assist run ${name} $ARGUMENTS 2>&1\`.
|
|
48596
48688
|
`;
|
|
48597
|
-
|
|
48689
|
+
writeFileSync57(filePath, content);
|
|
48598
48690
|
console.log(`Created command file: ${filePath}`);
|
|
48599
48691
|
}
|
|
48600
48692
|
async function add4() {
|
|
@@ -48698,8 +48790,8 @@ function registerRunAdd(runCommand) {
|
|
|
48698
48790
|
}
|
|
48699
48791
|
|
|
48700
48792
|
// src/commands/run/remove.ts
|
|
48701
|
-
import { existsSync as
|
|
48702
|
-
import { dirname as dirname47, join as
|
|
48793
|
+
import { existsSync as existsSync90, readdirSync as readdirSync27, rmdirSync, unlinkSync as unlinkSync20 } from "fs";
|
|
48794
|
+
import { dirname as dirname47, join as join110 } from "path";
|
|
48703
48795
|
|
|
48704
48796
|
// src/commands/run/removeRepoRunConfig.ts
|
|
48705
48797
|
function isNamed(entry, name) {
|
|
@@ -48717,17 +48809,17 @@ function removeRepoRunConfig(name, repoName, cwd = process.cwd()) {
|
|
|
48717
48809
|
|
|
48718
48810
|
// src/commands/run/remove.ts
|
|
48719
48811
|
function removeEmptyNamespaceDirs(filePath) {
|
|
48720
|
-
const root2 =
|
|
48812
|
+
const root2 = join110(".claude", "commands");
|
|
48721
48813
|
for (let dir = dirname47(filePath); dir !== root2; dir = dirname47(dir)) {
|
|
48722
|
-
if (!
|
|
48814
|
+
if (!existsSync90(dir) || readdirSync27(dir).length > 0) return;
|
|
48723
48815
|
rmdirSync(dir);
|
|
48724
48816
|
}
|
|
48725
48817
|
}
|
|
48726
48818
|
function deleteCommandFile(name) {
|
|
48727
48819
|
const filePath = runCommandFilePath(name);
|
|
48728
|
-
const legacyPath =
|
|
48820
|
+
const legacyPath = join110(".claude", "commands", `${name}.md`);
|
|
48729
48821
|
for (const path109 of /* @__PURE__ */ new Set([filePath, legacyPath])) {
|
|
48730
|
-
if (
|
|
48822
|
+
if (existsSync90(path109)) {
|
|
48731
48823
|
unlinkSync20(path109);
|
|
48732
48824
|
console.log(`Deleted command file: ${path109}`);
|
|
48733
48825
|
}
|
|
@@ -48848,11 +48940,11 @@ function applyLine(result, pending, line) {
|
|
|
48848
48940
|
}
|
|
48849
48941
|
|
|
48850
48942
|
// src/commands/sessions/daemon/readDaemonPidFile.ts
|
|
48851
|
-
import { readFileSync as
|
|
48943
|
+
import { readFileSync as readFileSync73 } from "fs";
|
|
48852
48944
|
function readDaemonPidFile() {
|
|
48853
48945
|
try {
|
|
48854
48946
|
const pid = Number.parseInt(
|
|
48855
|
-
|
|
48947
|
+
readFileSync73(daemonPaths.pid, "utf8").trim(),
|
|
48856
48948
|
10
|
|
48857
48949
|
);
|
|
48858
48950
|
return Number.isInteger(pid) ? pid : void 0;
|
|
@@ -49450,12 +49542,12 @@ function toSessionViewInfo({
|
|
|
49450
49542
|
}
|
|
49451
49543
|
|
|
49452
49544
|
// src/commands/sessions/daemon/worktree/joinRefusal.ts
|
|
49453
|
-
import { existsSync as
|
|
49545
|
+
import { existsSync as existsSync91 } from "fs";
|
|
49454
49546
|
function joinRefusal(session) {
|
|
49455
49547
|
if (session.commandType === "run") return "a server run has no agent stream";
|
|
49456
49548
|
if (session.closing === true) return "the session is closing";
|
|
49457
49549
|
if (!session.cwd) return "the session has no working directory";
|
|
49458
|
-
if (!
|
|
49550
|
+
if (!existsSync91(session.cwd))
|
|
49459
49551
|
return "the session's workspace no longer exists";
|
|
49460
49552
|
return void 0;
|
|
49461
49553
|
}
|
|
@@ -49531,8 +49623,8 @@ function broadcastSessions(sessions, clients, linkedSessions = [], active) {
|
|
|
49531
49623
|
}
|
|
49532
49624
|
|
|
49533
49625
|
// src/commands/sessions/daemon/findServerParents.ts
|
|
49534
|
-
import { existsSync as
|
|
49535
|
-
import { join as
|
|
49626
|
+
import { existsSync as existsSync92 } from "fs";
|
|
49627
|
+
import { join as join111, resolve as resolve32 } from "path";
|
|
49536
49628
|
function isLive(session) {
|
|
49537
49629
|
return !!session.pty && session.status !== "done" && session.status !== "error";
|
|
49538
49630
|
}
|
|
@@ -49541,7 +49633,7 @@ function isLiveAgent(session) {
|
|
|
49541
49633
|
}
|
|
49542
49634
|
function serverRunDirs(sessions, file) {
|
|
49543
49635
|
return new Set(
|
|
49544
|
-
sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve32(s.cwd)).filter((dir) =>
|
|
49636
|
+
sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve32(s.cwd)).filter((dir) => existsSync92(join111(dir, file)))
|
|
49545
49637
|
);
|
|
49546
49638
|
}
|
|
49547
49639
|
function findServerParents(sessions, file) {
|
|
@@ -49695,7 +49787,7 @@ function sendResizeSnapshot(s, send) {
|
|
|
49695
49787
|
}
|
|
49696
49788
|
|
|
49697
49789
|
// src/commands/sessions/daemon/viewerSize.ts
|
|
49698
|
-
import { readFileSync as
|
|
49790
|
+
import { readFileSync as readFileSync74, writeFileSync as writeFileSync58 } from "fs";
|
|
49699
49791
|
var DEFAULT_SIZE = { cols: 120, rows: 30 };
|
|
49700
49792
|
var remembered;
|
|
49701
49793
|
function rememberViewerSize(cols, rows) {
|
|
@@ -49703,7 +49795,7 @@ function rememberViewerSize(cols, rows) {
|
|
|
49703
49795
|
if (remembered?.cols === cols && remembered.rows === rows) return;
|
|
49704
49796
|
remembered = { cols, rows };
|
|
49705
49797
|
try {
|
|
49706
|
-
|
|
49798
|
+
writeFileSync58(daemonPaths.viewerSize, JSON.stringify(remembered));
|
|
49707
49799
|
} catch (error) {
|
|
49708
49800
|
daemonLog(
|
|
49709
49801
|
`viewer size ${cols}x${rows} not saved: ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -49717,7 +49809,7 @@ function viewerSize() {
|
|
|
49717
49809
|
function readSavedSize() {
|
|
49718
49810
|
try {
|
|
49719
49811
|
const { cols, rows } = JSON.parse(
|
|
49720
|
-
|
|
49812
|
+
readFileSync74(daemonPaths.viewerSize, "utf8")
|
|
49721
49813
|
);
|
|
49722
49814
|
if (typeof cols === "number" && typeof rows === "number" && cols > 0)
|
|
49723
49815
|
return { cols, rows };
|
|
@@ -50210,11 +50302,11 @@ function sessionBase(id, status2) {
|
|
|
50210
50302
|
}
|
|
50211
50303
|
|
|
50212
50304
|
// src/commands/sessions/daemon/spawnPty.ts
|
|
50213
|
-
import { existsSync as
|
|
50305
|
+
import { existsSync as existsSync94 } from "fs";
|
|
50214
50306
|
import * as pty from "node-pty";
|
|
50215
50307
|
|
|
50216
50308
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
50217
|
-
import { chmodSync, existsSync as
|
|
50309
|
+
import { chmodSync, existsSync as existsSync93, statSync as statSync15 } from "fs";
|
|
50218
50310
|
import { createRequire as createRequire3 } from "module";
|
|
50219
50311
|
import path106 from "path";
|
|
50220
50312
|
var require4 = createRequire3(import.meta.url);
|
|
@@ -50229,7 +50321,7 @@ function ensureSpawnHelperExecutable() {
|
|
|
50229
50321
|
`${process.platform}-${process.arch}`,
|
|
50230
50322
|
"spawn-helper"
|
|
50231
50323
|
);
|
|
50232
|
-
if (!
|
|
50324
|
+
if (!existsSync93(helper)) return;
|
|
50233
50325
|
const mode = statSync15(helper).mode;
|
|
50234
50326
|
if ((mode & 73) === 0) chmodSync(helper, mode | 493);
|
|
50235
50327
|
}
|
|
@@ -50285,7 +50377,7 @@ function spawnPty(args, cwd, sessionId2, extraEnv) {
|
|
|
50285
50377
|
});
|
|
50286
50378
|
}
|
|
50287
50379
|
function refuseMissingCwd(cwd, sessionId2) {
|
|
50288
|
-
if (!cwd ||
|
|
50380
|
+
if (!cwd || existsSync94(cwd)) return;
|
|
50289
50381
|
daemonLog(
|
|
50290
50382
|
`${sessionId2 ? `session ${sessionId2}` : "pty"} not spawned: working directory ${cwd} no longer exists`
|
|
50291
50383
|
);
|
|
@@ -50455,20 +50547,20 @@ function createRunSession(id, { runName, runArgs, cwd, meta }) {
|
|
|
50455
50547
|
}
|
|
50456
50548
|
|
|
50457
50549
|
// src/commands/sessions/daemon/autoUpdate/autoUpdateControl.ts
|
|
50458
|
-
import { existsSync as
|
|
50550
|
+
import { existsSync as existsSync95, rmSync as rmSync14, writeFileSync as writeFileSync59 } from "fs";
|
|
50459
50551
|
var paused;
|
|
50460
50552
|
var wake;
|
|
50461
50553
|
var holdReleased = false;
|
|
50462
50554
|
function persist2(value) {
|
|
50463
50555
|
try {
|
|
50464
|
-
if (value)
|
|
50465
|
-
else
|
|
50556
|
+
if (value) writeFileSync59(daemonPaths.autoUpdatePaused, "");
|
|
50557
|
+
else rmSync14(daemonPaths.autoUpdatePaused, { force: true });
|
|
50466
50558
|
} catch {
|
|
50467
50559
|
}
|
|
50468
50560
|
}
|
|
50469
50561
|
var autoUpdateControl = {
|
|
50470
50562
|
paused: () => {
|
|
50471
|
-
paused ??=
|
|
50563
|
+
paused ??= existsSync95(daemonPaths.autoUpdatePaused);
|
|
50472
50564
|
return paused;
|
|
50473
50565
|
},
|
|
50474
50566
|
setPaused: (value) => {
|
|
@@ -50602,19 +50694,19 @@ async function runAutoUpdateLoop(deps2, maxLaps = Number.POSITIVE_INFINITY) {
|
|
|
50602
50694
|
}
|
|
50603
50695
|
|
|
50604
50696
|
// src/commands/sessions/daemon/autoUpdate/trimWatcherLog.ts
|
|
50605
|
-
import { readFileSync as
|
|
50697
|
+
import { readFileSync as readFileSync76, writeFileSync as writeFileSync60 } from "fs";
|
|
50606
50698
|
var KEEP_TAIL = 256 * 1024;
|
|
50607
50699
|
var MAX_LOG_SIZE = 4 * 1024 * 1024;
|
|
50608
50700
|
function trimWatcherLog(cwd) {
|
|
50609
50701
|
const path109 = watcherLogPath(cwd);
|
|
50610
50702
|
let log2;
|
|
50611
50703
|
try {
|
|
50612
|
-
log2 =
|
|
50704
|
+
log2 = readFileSync76(path109, "utf8");
|
|
50613
50705
|
} catch {
|
|
50614
50706
|
return;
|
|
50615
50707
|
}
|
|
50616
50708
|
if (log2.length <= MAX_LOG_SIZE) return;
|
|
50617
|
-
|
|
50709
|
+
writeFileSync60(path109, log2.slice(-KEEP_TAIL));
|
|
50618
50710
|
daemonLog(`auto-update: log ${path109} trimmed to its last ${KEEP_TAIL} chars`);
|
|
50619
50711
|
}
|
|
50620
50712
|
|
|
@@ -50697,7 +50789,7 @@ function bindResumedWorktree(session, cwd, notify2) {
|
|
|
50697
50789
|
}
|
|
50698
50790
|
|
|
50699
50791
|
// src/commands/sessions/daemon/worktree/treeDurability.ts
|
|
50700
|
-
import { existsSync as
|
|
50792
|
+
import { existsSync as existsSync96 } from "fs";
|
|
50701
50793
|
var treeIsGone = { durable: true, gone: true };
|
|
50702
50794
|
function treeDurability(state) {
|
|
50703
50795
|
if (state.dirty) return { durable: false, reason: "uncommitted changes" };
|
|
@@ -50728,14 +50820,14 @@ function* durabilityProbes() {
|
|
|
50728
50820
|
});
|
|
50729
50821
|
}
|
|
50730
50822
|
async function checkDurability(cwd) {
|
|
50731
|
-
if (!
|
|
50823
|
+
if (!existsSync96(cwd)) return treeIsGone;
|
|
50732
50824
|
const probes = durabilityProbes();
|
|
50733
50825
|
let step3 = probes.next();
|
|
50734
50826
|
while (!step3.done) step3 = probes.next(await gitResult(cwd, step3.value));
|
|
50735
50827
|
return step3.value;
|
|
50736
50828
|
}
|
|
50737
50829
|
function checkDurabilitySync(cwd) {
|
|
50738
|
-
if (!
|
|
50830
|
+
if (!existsSync96(cwd)) return treeIsGone;
|
|
50739
50831
|
const probes = durabilityProbes();
|
|
50740
50832
|
let step3 = probes.next();
|
|
50741
50833
|
while (!step3.done) step3 = probes.next(gitSyncResult(cwd, step3.value));
|
|
@@ -50884,12 +50976,12 @@ function noteAutoUpdate(installDir, text20) {
|
|
|
50884
50976
|
|
|
50885
50977
|
// src/commands/sessions/daemon/autoUpdate/runUpdateLap.ts
|
|
50886
50978
|
import { spawn as spawn12 } from "child_process";
|
|
50887
|
-
import { rmSync as
|
|
50979
|
+
import { rmSync as rmSync15 } from "fs";
|
|
50888
50980
|
function clearLapSignals(cwd) {
|
|
50889
50981
|
const control = watchControlPaths(cwd);
|
|
50890
50982
|
if (!control) return;
|
|
50891
50983
|
for (const path109 of [control.check, control.stop])
|
|
50892
|
-
|
|
50984
|
+
rmSync15(path109, { force: true });
|
|
50893
50985
|
}
|
|
50894
50986
|
function runUpdateLap(cwd, onOutput) {
|
|
50895
50987
|
clearLapSignals(cwd);
|
|
@@ -51019,17 +51111,17 @@ function setStatus2(session, newStatus) {
|
|
|
51019
51111
|
}
|
|
51020
51112
|
|
|
51021
51113
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
51022
|
-
import { existsSync as
|
|
51114
|
+
import { existsSync as existsSync98 } from "fs";
|
|
51023
51115
|
import { basename as basename32 } from "path";
|
|
51024
51116
|
|
|
51025
51117
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
51026
|
-
import { existsSync as
|
|
51027
|
-
import { join as
|
|
51118
|
+
import { existsSync as existsSync97 } from "fs";
|
|
51119
|
+
import { join as join114 } from "path";
|
|
51028
51120
|
|
|
51029
51121
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
51030
51122
|
import { statSync as statSync16 } from "fs";
|
|
51031
51123
|
import { rm as rm3 } from "fs/promises";
|
|
51032
|
-
import { join as
|
|
51124
|
+
import { join as join113 } from "path";
|
|
51033
51125
|
async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
51034
51126
|
if (holdsAGitDirectoryRatherThanALink(worktreePath)) {
|
|
51035
51127
|
const refusal = "it is a clone of its own, not a linked worktree";
|
|
@@ -51057,7 +51149,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
|
51057
51149
|
return { removed: true };
|
|
51058
51150
|
}
|
|
51059
51151
|
function holdsAGitDirectoryRatherThanALink(worktreePath) {
|
|
51060
|
-
return statSync16(
|
|
51152
|
+
return statSync16(join113(worktreePath, ".git"), {
|
|
51061
51153
|
throwIfNoEntry: false
|
|
51062
51154
|
})?.isDirectory() === true;
|
|
51063
51155
|
}
|
|
@@ -51093,7 +51185,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
51093
51185
|
);
|
|
51094
51186
|
}
|
|
51095
51187
|
function strandedReason(worktreePath, cause) {
|
|
51096
|
-
if (!
|
|
51188
|
+
if (!existsSync97(join114(worktreePath, ".git")))
|
|
51097
51189
|
return "its .git link is already gone";
|
|
51098
51190
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
51099
51191
|
return "git no longer recognises it as a working tree";
|
|
@@ -51145,7 +51237,7 @@ function reason3(error) {
|
|
|
51145
51237
|
|
|
51146
51238
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
51147
51239
|
async function reapWorktree(worktreePath, force = false) {
|
|
51148
|
-
if (!
|
|
51240
|
+
if (!existsSync98(worktreePath)) {
|
|
51149
51241
|
forgetWorktree(worktreePath);
|
|
51150
51242
|
daemonLog(
|
|
51151
51243
|
`worktree ${worktreePath} already gone; its record was forgotten`
|
|
@@ -51170,7 +51262,7 @@ async function reapWorktree(worktreePath, force = false) {
|
|
|
51170
51262
|
}
|
|
51171
51263
|
function owningClone(worktreePath) {
|
|
51172
51264
|
const recorded = worktreeAttributionIncludingReaped(worktreePath)?.clone;
|
|
51173
|
-
if (recorded &&
|
|
51265
|
+
if (recorded && existsSync98(recorded)) return recorded;
|
|
51174
51266
|
const detected = mainWorktree(worktreePath);
|
|
51175
51267
|
if (detected) return detected;
|
|
51176
51268
|
daemonLog(
|
|
@@ -51393,7 +51485,7 @@ function pidList(pids) {
|
|
|
51393
51485
|
}
|
|
51394
51486
|
|
|
51395
51487
|
// src/commands/sessions/daemon/worktree/readOccupant.ts
|
|
51396
|
-
import { readFileSync as
|
|
51488
|
+
import { readFileSync as readFileSync77 } from "fs";
|
|
51397
51489
|
var VSCODE_PATHS = [
|
|
51398
51490
|
"/.vscode-server/",
|
|
51399
51491
|
"/.vscode-server-insiders/",
|
|
@@ -51428,7 +51520,7 @@ function parentPid(stat5) {
|
|
|
51428
51520
|
}
|
|
51429
51521
|
function readProc(procRoot, pid, file) {
|
|
51430
51522
|
try {
|
|
51431
|
-
return
|
|
51523
|
+
return readFileSync77(`${procRoot}/${pid}/${file}`, "utf8");
|
|
51432
51524
|
} catch {
|
|
51433
51525
|
return void 0;
|
|
51434
51526
|
}
|
|
@@ -51457,12 +51549,12 @@ async function closeBlockReason(sessionId2, tree) {
|
|
|
51457
51549
|
}
|
|
51458
51550
|
|
|
51459
51551
|
// src/commands/sessions/daemon/worktree/watchGitState.ts
|
|
51460
|
-
import { existsSync as
|
|
51552
|
+
import { existsSync as existsSync99, watch } from "fs";
|
|
51461
51553
|
var DEBOUNCE_MS = 500;
|
|
51462
51554
|
var POLL_MS5 = 3e4;
|
|
51463
51555
|
function watchGitState(cwd, onChange) {
|
|
51464
51556
|
const common = gitCommonDir(cwd);
|
|
51465
|
-
if (!common || !
|
|
51557
|
+
if (!common || !existsSync99(common)) return void 0;
|
|
51466
51558
|
const watchers = [
|
|
51467
51559
|
watchGitDir(common, onChange),
|
|
51468
51560
|
pollGitState(cwd, onChange)
|
|
@@ -52185,10 +52277,10 @@ function emitSessionOutput(session, clients, data) {
|
|
|
52185
52277
|
}
|
|
52186
52278
|
|
|
52187
52279
|
// src/commands/sessions/daemon/exitReason.ts
|
|
52188
|
-
import { existsSync as
|
|
52280
|
+
import { existsSync as existsSync100 } from "fs";
|
|
52189
52281
|
import { resolve as resolve33 } from "path";
|
|
52190
52282
|
function exitDetail(session) {
|
|
52191
|
-
if (session.cwd && !
|
|
52283
|
+
if (session.cwd && !existsSync100(session.cwd))
|
|
52192
52284
|
return `working directory ${session.cwd} no longer exists`;
|
|
52193
52285
|
return missingRunConfigCwd(session);
|
|
52194
52286
|
}
|
|
@@ -52202,7 +52294,7 @@ function missingRunConfigCwd(session) {
|
|
|
52202
52294
|
const config = resolveRunConfig(session.runName, dir);
|
|
52203
52295
|
if (!config?.cwd) return void 0;
|
|
52204
52296
|
const configured = resolve33(runConfigBaseDirFrom(dir), config.cwd);
|
|
52205
|
-
if (
|
|
52297
|
+
if (existsSync100(configured)) return void 0;
|
|
52206
52298
|
return `run config "${config.name}": cwd ${configured} does not exist`;
|
|
52207
52299
|
}
|
|
52208
52300
|
|
|
@@ -52250,7 +52342,7 @@ function handleRefusedRun(session, exitCode, onStatusChange) {
|
|
|
52250
52342
|
}
|
|
52251
52343
|
|
|
52252
52344
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
52253
|
-
import { existsSync as
|
|
52345
|
+
import { existsSync as existsSync101, mkdirSync as mkdirSync41, watch as watch2 } from "fs";
|
|
52254
52346
|
import { dirname as dirname50 } from "path";
|
|
52255
52347
|
|
|
52256
52348
|
// src/commands/sessions/daemon/applyActivityToSession.ts
|
|
@@ -52335,7 +52427,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
52335
52427
|
if (timer) clearTimeout(timer);
|
|
52336
52428
|
timer = setTimeout(read3, DEBOUNCE_MS2);
|
|
52337
52429
|
});
|
|
52338
|
-
if (
|
|
52430
|
+
if (existsSync101(path109)) read3();
|
|
52339
52431
|
}
|
|
52340
52432
|
function refreshActivity(session) {
|
|
52341
52433
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -54613,7 +54705,7 @@ function rearmStoppedSessions(sessions, notify2) {
|
|
|
54613
54705
|
}
|
|
54614
54706
|
|
|
54615
54707
|
// src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
|
|
54616
|
-
import { existsSync as
|
|
54708
|
+
import { existsSync as existsSync103 } from "fs";
|
|
54617
54709
|
import { basename as basename35 } from "path";
|
|
54618
54710
|
|
|
54619
54711
|
// src/commands/sessions/daemon/worktree/accountedTrees.ts
|
|
@@ -54634,9 +54726,9 @@ function accountedTrees(sessions) {
|
|
|
54634
54726
|
}
|
|
54635
54727
|
|
|
54636
54728
|
// src/commands/sessions/daemon/worktree/reclaimVanishedWorktrees.ts
|
|
54637
|
-
import { existsSync as
|
|
54729
|
+
import { existsSync as existsSync102 } from "fs";
|
|
54638
54730
|
async function reclaimVanishedWorktrees(clone, paths) {
|
|
54639
|
-
if (!
|
|
54731
|
+
if (!existsSync102(clone)) {
|
|
54640
54732
|
for (const { path: path109 } of paths) forgetWorktree(path109);
|
|
54641
54733
|
daemonLog(
|
|
54642
54734
|
`clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
|
|
@@ -54802,7 +54894,7 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
|
54802
54894
|
);
|
|
54803
54895
|
continue;
|
|
54804
54896
|
}
|
|
54805
|
-
if (!
|
|
54897
|
+
if (!existsSync103(path109)) {
|
|
54806
54898
|
logVanishedTree(sessions, path109);
|
|
54807
54899
|
vanished.set(clone, [
|
|
54808
54900
|
...vanished.get(clone) ?? [],
|
|
@@ -56002,7 +56094,7 @@ function spawnAssistInTree(ctx, assistArgs, cwd, meta, context) {
|
|
|
56002
56094
|
}
|
|
56003
56095
|
|
|
56004
56096
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
56005
|
-
import { existsSync as
|
|
56097
|
+
import { existsSync as existsSync106 } from "fs";
|
|
56006
56098
|
|
|
56007
56099
|
// src/commands/sessions/daemon/resumeSession.ts
|
|
56008
56100
|
function resumeSession(id, sessionId2, cwd, name, holdPty, harness) {
|
|
@@ -56033,11 +56125,11 @@ function resumeSession(id, sessionId2, cwd, name, holdPty, harness) {
|
|
|
56033
56125
|
}
|
|
56034
56126
|
|
|
56035
56127
|
// src/commands/sessions/daemon/worktree/resumeInReplacementTree.ts
|
|
56036
|
-
import { existsSync as
|
|
56128
|
+
import { existsSync as existsSync105 } from "fs";
|
|
56037
56129
|
|
|
56038
56130
|
// src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
|
|
56039
|
-
import { copyFileSync as copyFileSync4, existsSync as
|
|
56040
|
-
import { join as
|
|
56131
|
+
import { copyFileSync as copyFileSync4, existsSync as existsSync104, mkdirSync as mkdirSync43 } from "fs";
|
|
56132
|
+
import { join as join115 } from "path";
|
|
56041
56133
|
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
56042
56134
|
const dir = projectDirForCwd(toCwd);
|
|
56043
56135
|
if (dir === projectDirForCwd(fromCwd)) {
|
|
@@ -56046,8 +56138,8 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
56046
56138
|
);
|
|
56047
56139
|
return;
|
|
56048
56140
|
}
|
|
56049
|
-
const dest =
|
|
56050
|
-
if (
|
|
56141
|
+
const dest = join115(dir, `${claudeSessionId}.jsonl`);
|
|
56142
|
+
if (existsSync104(dest)) {
|
|
56051
56143
|
daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
|
|
56052
56144
|
return;
|
|
56053
56145
|
}
|
|
@@ -56098,7 +56190,7 @@ function resumeInReplacementTree(ctx, claudeSessionId, missingCwd, name, harness
|
|
|
56098
56190
|
}
|
|
56099
56191
|
function cloneForReapedTree(missingCwd) {
|
|
56100
56192
|
const clone = worktreeAttributionIncludingReaped(missingCwd)?.clone;
|
|
56101
|
-
if (!clone || !
|
|
56193
|
+
if (!clone || !existsSync105(clone))
|
|
56102
56194
|
throw new Error(
|
|
56103
56195
|
`working directory no longer exists and no clone is recorded to re-allocate from: ${missingCwd}`
|
|
56104
56196
|
);
|
|
@@ -56107,7 +56199,7 @@ function cloneForReapedTree(missingCwd) {
|
|
|
56107
56199
|
|
|
56108
56200
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
56109
56201
|
function resumeInTree(ctx, sessionId2, cwd, name, harness) {
|
|
56110
|
-
if (!
|
|
56202
|
+
if (!existsSync106(cwd))
|
|
56111
56203
|
return resumeInReplacementTree(ctx, sessionId2, cwd, name, harness);
|
|
56112
56204
|
const id = ctx.spawnWith(
|
|
56113
56205
|
(sid) => resumeSession(sid, sessionId2, cwd, name, void 0, harness)
|
|
@@ -56364,10 +56456,10 @@ function autoUpdateReply() {
|
|
|
56364
56456
|
}
|
|
56365
56457
|
|
|
56366
56458
|
// src/commands/sessions/daemon/autoUpdate/applyAutoUpdateAction.ts
|
|
56367
|
-
import { rmSync as
|
|
56459
|
+
import { rmSync as rmSync16, writeFileSync as writeFileSync61 } from "fs";
|
|
56368
56460
|
function signalLap(installDir, marker2) {
|
|
56369
56461
|
const control = watchControlPaths(installDir);
|
|
56370
|
-
if (control)
|
|
56462
|
+
if (control) writeFileSync61(control[marker2], "");
|
|
56371
56463
|
}
|
|
56372
56464
|
function applyAutoUpdateAction(action) {
|
|
56373
56465
|
const installDir = getInstallDir();
|
|
@@ -56375,7 +56467,7 @@ function applyAutoUpdateAction(action) {
|
|
|
56375
56467
|
if (action === "resume") {
|
|
56376
56468
|
if (!autoUpdateControl.paused()) return void 0;
|
|
56377
56469
|
const control = watchControlPaths(installDir);
|
|
56378
|
-
if (control)
|
|
56470
|
+
if (control) rmSync16(control.stop, { force: true });
|
|
56379
56471
|
autoUpdateControl.setPaused(false);
|
|
56380
56472
|
noteAutoUpdate(installDir, "resumed from Updates");
|
|
56381
56473
|
return void 0;
|
|
@@ -57376,7 +57468,7 @@ function isPrCheckoutArgs(args) {
|
|
|
57376
57468
|
|
|
57377
57469
|
// src/commands/sessions/daemon/worktree/prCheckoutHolder.ts
|
|
57378
57470
|
import { execFile as execFile14 } from "child_process";
|
|
57379
|
-
import { existsSync as
|
|
57471
|
+
import { existsSync as existsSync107 } from "fs";
|
|
57380
57472
|
function prHeadBranch2(number, cwd) {
|
|
57381
57473
|
const { headBranch } = prCliCommands(number, cwd);
|
|
57382
57474
|
return new Promise((resolve34) => {
|
|
@@ -57390,12 +57482,12 @@ function prHeadBranch2(number, cwd) {
|
|
|
57390
57482
|
}
|
|
57391
57483
|
async function prCheckoutHolder(assistArgs, cwd) {
|
|
57392
57484
|
const number = prCheckoutNumber(assistArgs);
|
|
57393
|
-
if (!number || !cwd || !
|
|
57485
|
+
if (!number || !cwd || !existsSync107(cwd)) return void 0;
|
|
57394
57486
|
const headRef = await prHeadBranch2(number, cwd);
|
|
57395
57487
|
if (!headRef) return void 0;
|
|
57396
57488
|
const listing = await gitOrNull(cwd, ["worktree", "list", "--porcelain"]);
|
|
57397
57489
|
const holder = listing ? worktreeWithBranch(listing, headRef) : null;
|
|
57398
|
-
if (!holder || !
|
|
57490
|
+
if (!holder || !existsSync107(holder)) return void 0;
|
|
57399
57491
|
daemonLog(
|
|
57400
57492
|
`pr #${number} assist ${assistArgs[0]} launched in its checkout ${holder}: head branch ${headRef} is already checked out there, so no worktree is allocated`
|
|
57401
57493
|
);
|
|
@@ -57612,10 +57704,10 @@ function handleConnection(socket, manager) {
|
|
|
57612
57704
|
}
|
|
57613
57705
|
|
|
57614
57706
|
// src/commands/sessions/daemon/onListening.ts
|
|
57615
|
-
import { unlinkSync as unlinkSync21, writeFileSync as
|
|
57707
|
+
import { unlinkSync as unlinkSync21, writeFileSync as writeFileSync62 } from "fs";
|
|
57616
57708
|
|
|
57617
57709
|
// src/commands/sessions/daemon/startPidFileWatchdog.ts
|
|
57618
|
-
import { readFileSync as
|
|
57710
|
+
import { readFileSync as readFileSync78 } from "fs";
|
|
57619
57711
|
var WATCHDOG_INTERVAL_MS = 5e3;
|
|
57620
57712
|
function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
57621
57713
|
const timer = setInterval(() => {
|
|
@@ -57626,7 +57718,7 @@ function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
|
57626
57718
|
}
|
|
57627
57719
|
function ownsPidFile() {
|
|
57628
57720
|
try {
|
|
57629
|
-
return
|
|
57721
|
+
return readFileSync78(daemonPaths.pid, "utf8").trim() === String(process.pid);
|
|
57630
57722
|
} catch {
|
|
57631
57723
|
return false;
|
|
57632
57724
|
}
|
|
@@ -57634,7 +57726,7 @@ function ownsPidFile() {
|
|
|
57634
57726
|
|
|
57635
57727
|
// src/commands/sessions/daemon/onListening.ts
|
|
57636
57728
|
function onListening(manager, checkAutoExit) {
|
|
57637
|
-
|
|
57729
|
+
writeFileSync62(daemonPaths.pid, String(process.pid));
|
|
57638
57730
|
startPidFileWatchdog(() => {
|
|
57639
57731
|
daemonLog("lost daemon.pid ownership; shutting down sessions and exiting");
|
|
57640
57732
|
void manager.flushActiveMs().finally(() => {
|