@staff0rd/assist 0.313.0 → 0.315.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/allowed.cli-reads +1 -0
- package/claude/settings.json +1 -2
- package/dist/allowed.cli-reads +1 -0
- package/dist/commands/sessions/web/bundle.js +81 -82
- package/dist/index.js +266 -184
- package/package.json +1 -2
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.315.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -94,7 +94,6 @@ var package_default = {
|
|
|
94
94
|
"@types/ws": "^8.18.1",
|
|
95
95
|
"@vitest/coverage-v8": "^4.1.2",
|
|
96
96
|
"@xterm/addon-fit": "^0.11.0",
|
|
97
|
-
"@xterm/addon-web-links": "^0.12.0",
|
|
98
97
|
"@xterm/xterm": "^6.0.0",
|
|
99
98
|
esbuild: "^0.27.3",
|
|
100
99
|
jscpd: "^4.0.5",
|
|
@@ -2280,6 +2279,61 @@ async function run(options2 = {}) {
|
|
|
2280
2279
|
handleResults(results, entries.length);
|
|
2281
2280
|
}
|
|
2282
2281
|
|
|
2282
|
+
// src/commands/verify/settingsGuard.ts
|
|
2283
|
+
import { existsSync as existsSync12, readFileSync as readFileSync9 } from "fs";
|
|
2284
|
+
|
|
2285
|
+
// src/commands/verify/findAssistReferences.ts
|
|
2286
|
+
function offendingEntries(list4) {
|
|
2287
|
+
if (!Array.isArray(list4)) return [];
|
|
2288
|
+
return list4.filter(
|
|
2289
|
+
(entry) => typeof entry === "string" && /\bassist\b/.test(entry)
|
|
2290
|
+
);
|
|
2291
|
+
}
|
|
2292
|
+
function findAssistReferences(settings) {
|
|
2293
|
+
const permissions = settings?.permissions ?? {};
|
|
2294
|
+
return [
|
|
2295
|
+
...offendingEntries(permissions.allow).map(
|
|
2296
|
+
(entry) => ({ list: "allow", entry })
|
|
2297
|
+
),
|
|
2298
|
+
...offendingEntries(permissions.deny).map(
|
|
2299
|
+
(entry) => ({ list: "deny", entry })
|
|
2300
|
+
)
|
|
2301
|
+
];
|
|
2302
|
+
}
|
|
2303
|
+
|
|
2304
|
+
// src/commands/verify/settingsGuard.ts
|
|
2305
|
+
var SETTINGS_PATH = "claude/settings.json";
|
|
2306
|
+
function settingsGuard() {
|
|
2307
|
+
if (!existsSync12(SETTINGS_PATH)) {
|
|
2308
|
+
console.log(`No ${SETTINGS_PATH}; nothing to guard.`);
|
|
2309
|
+
process.exit(0);
|
|
2310
|
+
}
|
|
2311
|
+
let settings;
|
|
2312
|
+
try {
|
|
2313
|
+
settings = JSON.parse(readFileSync9(SETTINGS_PATH, "utf8"));
|
|
2314
|
+
} catch (error) {
|
|
2315
|
+
console.log(
|
|
2316
|
+
`Could not parse ${SETTINGS_PATH}: ${error.message}`
|
|
2317
|
+
);
|
|
2318
|
+
process.exit(1);
|
|
2319
|
+
}
|
|
2320
|
+
const offenders = findAssistReferences(settings);
|
|
2321
|
+
if (offenders.length === 0) {
|
|
2322
|
+
console.log(`No assist references in ${SETTINGS_PATH} permissions.`);
|
|
2323
|
+
process.exit(0);
|
|
2324
|
+
}
|
|
2325
|
+
console.log(`assist references found in ${SETTINGS_PATH} permissions:
|
|
2326
|
+
`);
|
|
2327
|
+
for (const { list: list4, entry } of offenders) {
|
|
2328
|
+
console.log(` permissions.${list4}: ${entry}`);
|
|
2329
|
+
}
|
|
2330
|
+
console.log(
|
|
2331
|
+
`
|
|
2332
|
+
Total: ${offenders.length} entry(ies). Remove every assist reference from the permission lists.`
|
|
2333
|
+
);
|
|
2334
|
+
process.exit(1);
|
|
2335
|
+
}
|
|
2336
|
+
|
|
2283
2337
|
// src/commands/new/registerNew/initGit.ts
|
|
2284
2338
|
import { execSync as execSync11 } from "child_process";
|
|
2285
2339
|
import { writeFileSync as writeFileSync9 } from "fs";
|
|
@@ -2375,7 +2429,7 @@ async function newCli() {
|
|
|
2375
2429
|
|
|
2376
2430
|
// src/commands/new/registerNew/newProject.ts
|
|
2377
2431
|
import { execSync as execSync15 } from "child_process";
|
|
2378
|
-
import { existsSync as
|
|
2432
|
+
import { existsSync as existsSync14, readFileSync as readFileSync11, writeFileSync as writeFileSync12 } from "fs";
|
|
2379
2433
|
|
|
2380
2434
|
// src/commands/deploy/init/index.ts
|
|
2381
2435
|
import { execSync as execSync14 } from "child_process";
|
|
@@ -2383,33 +2437,33 @@ import chalk26 from "chalk";
|
|
|
2383
2437
|
import enquirer3 from "enquirer";
|
|
2384
2438
|
|
|
2385
2439
|
// src/commands/deploy/init/updateWorkflow.ts
|
|
2386
|
-
import { existsSync as
|
|
2440
|
+
import { existsSync as existsSync13, mkdirSync as mkdirSync3, readFileSync as readFileSync10, writeFileSync as writeFileSync11 } from "fs";
|
|
2387
2441
|
import { dirname as dirname11, join as join9 } from "path";
|
|
2388
2442
|
import { fileURLToPath } from "url";
|
|
2389
2443
|
import chalk25 from "chalk";
|
|
2390
2444
|
var WORKFLOW_PATH = ".github/workflows/build.yml";
|
|
2391
2445
|
var __dirname2 = dirname11(fileURLToPath(import.meta.url));
|
|
2392
2446
|
function getExistingSiteId() {
|
|
2393
|
-
if (!
|
|
2447
|
+
if (!existsSync13(WORKFLOW_PATH)) {
|
|
2394
2448
|
return null;
|
|
2395
2449
|
}
|
|
2396
|
-
const content =
|
|
2450
|
+
const content = readFileSync10(WORKFLOW_PATH, "utf8");
|
|
2397
2451
|
const match = content.match(/-s\s+([a-f0-9-]{36})/);
|
|
2398
2452
|
return match ? match[1] : null;
|
|
2399
2453
|
}
|
|
2400
2454
|
function getTemplateContent(siteId) {
|
|
2401
2455
|
const templatePath = join9(__dirname2, "commands/deploy/build.yml");
|
|
2402
|
-
const template =
|
|
2456
|
+
const template = readFileSync10(templatePath, "utf8");
|
|
2403
2457
|
return template.replace("{{NETLIFY_SITE_ID}}", siteId);
|
|
2404
2458
|
}
|
|
2405
2459
|
async function updateWorkflow(siteId) {
|
|
2406
2460
|
const newContent = getTemplateContent(siteId);
|
|
2407
2461
|
const workflowDir = ".github/workflows";
|
|
2408
|
-
if (!
|
|
2462
|
+
if (!existsSync13(workflowDir)) {
|
|
2409
2463
|
mkdirSync3(workflowDir, { recursive: true });
|
|
2410
2464
|
}
|
|
2411
|
-
if (
|
|
2412
|
-
const oldContent =
|
|
2465
|
+
if (existsSync13(WORKFLOW_PATH)) {
|
|
2466
|
+
const oldContent = readFileSync10(WORKFLOW_PATH, "utf8");
|
|
2413
2467
|
if (oldContent === newContent) {
|
|
2414
2468
|
console.log(chalk25.green("build.yml is already up to date"));
|
|
2415
2469
|
return;
|
|
@@ -2503,11 +2557,11 @@ async function newProject() {
|
|
|
2503
2557
|
}
|
|
2504
2558
|
function addViteBaseConfig() {
|
|
2505
2559
|
const viteConfigPath = "vite.config.ts";
|
|
2506
|
-
if (!
|
|
2560
|
+
if (!existsSync14(viteConfigPath)) {
|
|
2507
2561
|
console.log("No vite.config.ts found, skipping base config");
|
|
2508
2562
|
return;
|
|
2509
2563
|
}
|
|
2510
|
-
const content =
|
|
2564
|
+
const content = readFileSync11(viteConfigPath, "utf8");
|
|
2511
2565
|
if (content.includes("base:")) {
|
|
2512
2566
|
console.log("vite.config.ts already has base config");
|
|
2513
2567
|
return;
|
|
@@ -3144,11 +3198,38 @@ function expandTilde2(value) {
|
|
|
3144
3198
|
}
|
|
3145
3199
|
|
|
3146
3200
|
// src/commands/backup/scheduleBackup.ts
|
|
3147
|
-
import { execSync as execSync17 } from "child_process";
|
|
3148
3201
|
import { mkdir } from "fs/promises";
|
|
3149
3202
|
import { join as join10 } from "path";
|
|
3150
3203
|
import chalk28 from "chalk";
|
|
3151
3204
|
|
|
3205
|
+
// src/commands/backup/readCrontab.ts
|
|
3206
|
+
import { execSync as execSync17 } from "child_process";
|
|
3207
|
+
function readCrontab() {
|
|
3208
|
+
try {
|
|
3209
|
+
return execSync17("crontab -l", {
|
|
3210
|
+
encoding: "utf8",
|
|
3211
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
3212
|
+
});
|
|
3213
|
+
} catch {
|
|
3214
|
+
return "";
|
|
3215
|
+
}
|
|
3216
|
+
}
|
|
3217
|
+
function writeCrontab(content) {
|
|
3218
|
+
try {
|
|
3219
|
+
execSync17("crontab -", {
|
|
3220
|
+
input: content,
|
|
3221
|
+
stdio: ["pipe", "ignore", "pipe"]
|
|
3222
|
+
});
|
|
3223
|
+
} catch (error) {
|
|
3224
|
+
if (error.code === "ENOENT") {
|
|
3225
|
+
throw new Error(
|
|
3226
|
+
"crontab is not available on this system. Backup scheduling requires Linux cron."
|
|
3227
|
+
);
|
|
3228
|
+
}
|
|
3229
|
+
throw error;
|
|
3230
|
+
}
|
|
3231
|
+
}
|
|
3232
|
+
|
|
3152
3233
|
// src/commands/backup/durationToCron.ts
|
|
3153
3234
|
var MINUTES_PER_HOUR = 60;
|
|
3154
3235
|
var HOURS_PER_DAY = 24;
|
|
@@ -3220,6 +3301,14 @@ function upsertScheduleBlock(crontab, every, cronLine) {
|
|
|
3220
3301
|
return `${next3.join("\n")}
|
|
3221
3302
|
`;
|
|
3222
3303
|
}
|
|
3304
|
+
function removeScheduleBlock(crontab) {
|
|
3305
|
+
const lines = crontab.length === 0 ? [] : crontab.replace(/\n$/, "").split("\n");
|
|
3306
|
+
const range = findBlockRange(lines);
|
|
3307
|
+
if (range === void 0) return crontab;
|
|
3308
|
+
const next3 = [...lines.slice(0, range.start), ...lines.slice(range.end + 1)];
|
|
3309
|
+
return next3.length === 0 ? "" : `${next3.join("\n")}
|
|
3310
|
+
`;
|
|
3311
|
+
}
|
|
3223
3312
|
function readScheduleBlock(crontab) {
|
|
3224
3313
|
const lines = crontab.length === 0 ? [] : crontab.split("\n");
|
|
3225
3314
|
const range = findBlockRange(lines);
|
|
@@ -3236,31 +3325,6 @@ function readScheduleBlock(crontab) {
|
|
|
3236
3325
|
}
|
|
3237
3326
|
|
|
3238
3327
|
// src/commands/backup/scheduleBackup.ts
|
|
3239
|
-
function readCrontab() {
|
|
3240
|
-
try {
|
|
3241
|
-
return execSync17("crontab -l", {
|
|
3242
|
-
encoding: "utf8",
|
|
3243
|
-
stdio: ["ignore", "pipe", "ignore"]
|
|
3244
|
-
});
|
|
3245
|
-
} catch {
|
|
3246
|
-
return "";
|
|
3247
|
-
}
|
|
3248
|
-
}
|
|
3249
|
-
function writeCrontab(content) {
|
|
3250
|
-
try {
|
|
3251
|
-
execSync17("crontab -", {
|
|
3252
|
-
input: content,
|
|
3253
|
-
stdio: ["pipe", "ignore", "pipe"]
|
|
3254
|
-
});
|
|
3255
|
-
} catch (error) {
|
|
3256
|
-
if (error.code === "ENOENT") {
|
|
3257
|
-
throw new Error(
|
|
3258
|
-
"crontab is not available on this system. Backup scheduling requires Linux cron."
|
|
3259
|
-
);
|
|
3260
|
-
}
|
|
3261
|
-
throw error;
|
|
3262
|
-
}
|
|
3263
|
-
}
|
|
3264
3328
|
function fail(message) {
|
|
3265
3329
|
console.error(chalk28.red(message));
|
|
3266
3330
|
process.exit(1);
|
|
@@ -3299,6 +3363,19 @@ function scheduleStatus() {
|
|
|
3299
3363
|
}
|
|
3300
3364
|
console.error(`assist backup runs every ${block.every} (${block.cron}).`);
|
|
3301
3365
|
}
|
|
3366
|
+
function scheduleRemove() {
|
|
3367
|
+
const current = readCrontab();
|
|
3368
|
+
if (!readScheduleBlock(current)) {
|
|
3369
|
+
console.error("No assist backup schedule is set; nothing to remove.");
|
|
3370
|
+
return;
|
|
3371
|
+
}
|
|
3372
|
+
try {
|
|
3373
|
+
writeCrontab(removeScheduleBlock(current));
|
|
3374
|
+
} catch (error) {
|
|
3375
|
+
fail(error.message);
|
|
3376
|
+
}
|
|
3377
|
+
console.error(chalk28.green("Removed the assist backup schedule."));
|
|
3378
|
+
}
|
|
3302
3379
|
|
|
3303
3380
|
// src/commands/backlog/export/index.ts
|
|
3304
3381
|
import { writeFile } from "fs/promises";
|
|
@@ -3402,6 +3479,9 @@ function registerBackup(program2) {
|
|
|
3402
3479
|
).action(backup);
|
|
3403
3480
|
const scheduleCommand = backupCommand.command("schedule").description("Manage a recurring crontab entry that runs assist backup").option("--every <duration>", "Cadence to run the backup (e.g. 5m, 6h)").action(scheduleBackup);
|
|
3404
3481
|
scheduleCommand.command("status").description("Show the active backup schedule, or report that none is set").action(scheduleStatus);
|
|
3482
|
+
scheduleCommand.command("remove").description(
|
|
3483
|
+
"Remove the marked backup schedule block, leaving other crontab lines intact"
|
|
3484
|
+
).action(scheduleRemove);
|
|
3405
3485
|
}
|
|
3406
3486
|
|
|
3407
3487
|
// src/commands/backlog/next.ts
|
|
@@ -3442,9 +3522,9 @@ function hasLocalChanges() {
|
|
|
3442
3522
|
|
|
3443
3523
|
// src/commands/backlog/acquireLock.ts
|
|
3444
3524
|
import {
|
|
3445
|
-
existsSync as
|
|
3525
|
+
existsSync as existsSync15,
|
|
3446
3526
|
mkdirSync as mkdirSync4,
|
|
3447
|
-
readFileSync as
|
|
3527
|
+
readFileSync as readFileSync12,
|
|
3448
3528
|
unlinkSync as unlinkSync2,
|
|
3449
3529
|
writeFileSync as writeFileSync13
|
|
3450
3530
|
} from "fs";
|
|
@@ -3466,9 +3546,9 @@ function isProcessAlive(pid) {
|
|
|
3466
3546
|
}
|
|
3467
3547
|
function isLockedByOther(itemId) {
|
|
3468
3548
|
const lockPath = getLockPath(itemId);
|
|
3469
|
-
if (!
|
|
3549
|
+
if (!existsSync15(lockPath)) return false;
|
|
3470
3550
|
try {
|
|
3471
|
-
const lock = JSON.parse(
|
|
3551
|
+
const lock = JSON.parse(readFileSync12(lockPath, "utf8"));
|
|
3472
3552
|
if (lock.pid === process.pid) return false;
|
|
3473
3553
|
return isProcessAlive(lock.pid);
|
|
3474
3554
|
} catch {
|
|
@@ -3659,19 +3739,19 @@ function buildArgs(prompt, options2) {
|
|
|
3659
3739
|
import chalk36 from "chalk";
|
|
3660
3740
|
|
|
3661
3741
|
// src/commands/backlog/migrateLocalBacklog.ts
|
|
3662
|
-
import { existsSync as
|
|
3742
|
+
import { existsSync as existsSync17 } from "fs";
|
|
3663
3743
|
import { join as join15 } from "path";
|
|
3664
3744
|
import chalk35 from "chalk";
|
|
3665
3745
|
|
|
3666
3746
|
// src/commands/backlog/backupLocalBacklogFiles.ts
|
|
3667
|
-
import { existsSync as
|
|
3747
|
+
import { existsSync as existsSync16, renameSync } from "fs";
|
|
3668
3748
|
import { join as join14 } from "path";
|
|
3669
3749
|
var LOCAL_FILES = ["backlog.jsonl", "backlog.db"];
|
|
3670
3750
|
function backupLocalBacklogFiles(dir) {
|
|
3671
3751
|
const moved = [];
|
|
3672
3752
|
for (const name of LOCAL_FILES) {
|
|
3673
3753
|
const path57 = join14(dir, ".assist", name);
|
|
3674
|
-
if (
|
|
3754
|
+
if (existsSync16(path57)) {
|
|
3675
3755
|
renameSync(path57, `${path57}.bak`);
|
|
3676
3756
|
moved.push(`${name} \u2192 ${name}.bak`);
|
|
3677
3757
|
}
|
|
@@ -3921,7 +4001,7 @@ async function loadAllItems(orm, origin) {
|
|
|
3921
4001
|
}
|
|
3922
4002
|
|
|
3923
4003
|
// src/commands/backlog/parseBacklogJsonl.ts
|
|
3924
|
-
import { readFileSync as
|
|
4004
|
+
import { readFileSync as readFileSync13 } from "fs";
|
|
3925
4005
|
|
|
3926
4006
|
// src/commands/backlog/types.ts
|
|
3927
4007
|
import { z as z3 } from "zod";
|
|
@@ -3966,7 +4046,7 @@ var backlogFileSchema = z3.array(backlogItemSchema);
|
|
|
3966
4046
|
|
|
3967
4047
|
// src/commands/backlog/parseBacklogJsonl.ts
|
|
3968
4048
|
function parseBacklogJsonl(path57) {
|
|
3969
|
-
const content =
|
|
4049
|
+
const content = readFileSync13(path57, "utf8").trim();
|
|
3970
4050
|
if (content.length === 0) return [];
|
|
3971
4051
|
return content.split("\n").map((line) => line.trim()).filter(Boolean).map((line) => backlogItemSchema.parse(JSON.parse(line)));
|
|
3972
4052
|
}
|
|
@@ -3989,7 +4069,7 @@ async function verifyImport(orm, origin, items2, imported) {
|
|
|
3989
4069
|
}
|
|
3990
4070
|
}
|
|
3991
4071
|
async function migrateLocalBacklog(orm, dir, origin) {
|
|
3992
|
-
if (!
|
|
4072
|
+
if (!existsSync17(jsonlPath(dir))) return;
|
|
3993
4073
|
const existing = (await loadAllItems(orm, origin)).length;
|
|
3994
4074
|
if (existing > 0) {
|
|
3995
4075
|
const moved2 = backupLocalBacklogFiles(dir);
|
|
@@ -4028,7 +4108,7 @@ async function deleteItem(orm, id2) {
|
|
|
4028
4108
|
}
|
|
4029
4109
|
|
|
4030
4110
|
// src/commands/backlog/findBacklogUp.ts
|
|
4031
|
-
import { existsSync as
|
|
4111
|
+
import { existsSync as existsSync18 } from "fs";
|
|
4032
4112
|
import { dirname as dirname13, join as join16 } from "path";
|
|
4033
4113
|
var BACKLOG_MARKERS = [
|
|
4034
4114
|
join16(".assist", "backlog.db"),
|
|
@@ -4038,7 +4118,7 @@ var BACKLOG_MARKERS = [
|
|
|
4038
4118
|
function findBacklogUp(startDir) {
|
|
4039
4119
|
let current = startDir;
|
|
4040
4120
|
while (current !== dirname13(current)) {
|
|
4041
|
-
if (BACKLOG_MARKERS.some((marker) =>
|
|
4121
|
+
if (BACKLOG_MARKERS.some((marker) => existsSync18(join16(current, marker)))) {
|
|
4042
4122
|
return current;
|
|
4043
4123
|
}
|
|
4044
4124
|
current = dirname13(current);
|
|
@@ -4259,7 +4339,7 @@ async function prepareRun(id2) {
|
|
|
4259
4339
|
}
|
|
4260
4340
|
|
|
4261
4341
|
// src/commands/backlog/consumePause.ts
|
|
4262
|
-
import { existsSync as
|
|
4342
|
+
import { existsSync as existsSync19, mkdirSync as mkdirSync6, unlinkSync as unlinkSync3, writeFileSync as writeFileSync15 } from "fs";
|
|
4263
4343
|
import { homedir as homedir6 } from "os";
|
|
4264
4344
|
import { join as join17 } from "path";
|
|
4265
4345
|
function getControlsDir() {
|
|
@@ -4283,7 +4363,7 @@ function clearPause(itemId) {
|
|
|
4283
4363
|
}
|
|
4284
4364
|
function consumePause(itemId) {
|
|
4285
4365
|
const pausePath = getPausePath(itemId);
|
|
4286
|
-
if (!
|
|
4366
|
+
if (!existsSync19(pausePath)) return false;
|
|
4287
4367
|
try {
|
|
4288
4368
|
unlinkSync3(pausePath);
|
|
4289
4369
|
} catch {
|
|
@@ -4312,7 +4392,7 @@ Failed to launch Claude for ${context}: ${message}`)
|
|
|
4312
4392
|
}
|
|
4313
4393
|
|
|
4314
4394
|
// src/shared/emitActivity.ts
|
|
4315
|
-
import { mkdirSync as mkdirSync7, readFileSync as
|
|
4395
|
+
import { mkdirSync as mkdirSync7, readFileSync as readFileSync14, rmSync as rmSync2, writeFileSync as writeFileSync16 } from "fs";
|
|
4316
4396
|
import { homedir as homedir7 } from "os";
|
|
4317
4397
|
import { dirname as dirname14, join as join18 } from "path";
|
|
4318
4398
|
import { z as z4 } from "zod";
|
|
@@ -4338,7 +4418,7 @@ function emitActivity(activity2) {
|
|
|
4338
4418
|
}
|
|
4339
4419
|
function readActivity(path57) {
|
|
4340
4420
|
try {
|
|
4341
|
-
return JSON.parse(
|
|
4421
|
+
return JSON.parse(readFileSync14(path57, "utf8"));
|
|
4342
4422
|
} catch {
|
|
4343
4423
|
return void 0;
|
|
4344
4424
|
}
|
|
@@ -4469,7 +4549,7 @@ function buildResumePrompt() {
|
|
|
4469
4549
|
}
|
|
4470
4550
|
|
|
4471
4551
|
// src/commands/backlog/resolvePhaseResult.ts
|
|
4472
|
-
import { existsSync as
|
|
4552
|
+
import { existsSync as existsSync21, unlinkSync as unlinkSync4 } from "fs";
|
|
4473
4553
|
import chalk39 from "chalk";
|
|
4474
4554
|
|
|
4475
4555
|
// src/commands/backlog/handleIncompletePhase.ts
|
|
@@ -4489,7 +4569,7 @@ async function handleIncompletePhase() {
|
|
|
4489
4569
|
}
|
|
4490
4570
|
|
|
4491
4571
|
// src/commands/backlog/readSignal.ts
|
|
4492
|
-
import { existsSync as
|
|
4572
|
+
import { existsSync as existsSync20, readFileSync as readFileSync15 } from "fs";
|
|
4493
4573
|
|
|
4494
4574
|
// src/commands/backlog/writeSignal.ts
|
|
4495
4575
|
import { writeFileSync as writeFileSync17 } from "fs";
|
|
@@ -4508,9 +4588,9 @@ function writeSignal(event, data) {
|
|
|
4508
4588
|
// src/commands/backlog/readSignal.ts
|
|
4509
4589
|
function readSignal() {
|
|
4510
4590
|
const path57 = getSignalPath();
|
|
4511
|
-
if (!
|
|
4591
|
+
if (!existsSync20(path57)) return void 0;
|
|
4512
4592
|
try {
|
|
4513
|
-
return JSON.parse(
|
|
4593
|
+
return JSON.parse(readFileSync15(path57, "utf8"));
|
|
4514
4594
|
} catch {
|
|
4515
4595
|
return void 0;
|
|
4516
4596
|
}
|
|
@@ -4519,7 +4599,7 @@ function readSignal() {
|
|
|
4519
4599
|
// src/commands/backlog/resolvePhaseResult.ts
|
|
4520
4600
|
function cleanupSignal() {
|
|
4521
4601
|
const statusPath = getSignalPath();
|
|
4522
|
-
if (
|
|
4602
|
+
if (existsSync21(statusPath)) {
|
|
4523
4603
|
unlinkSync4(statusPath);
|
|
4524
4604
|
}
|
|
4525
4605
|
}
|
|
@@ -4529,7 +4609,7 @@ async function isTerminalStatus(itemId) {
|
|
|
4529
4609
|
return item?.status === "done" || item?.status === "wontdo";
|
|
4530
4610
|
}
|
|
4531
4611
|
async function resolvePhaseResult(phaseIndex, itemId) {
|
|
4532
|
-
if (!
|
|
4612
|
+
if (!existsSync21(getSignalPath())) {
|
|
4533
4613
|
if (await isTerminalStatus(itemId)) return -1;
|
|
4534
4614
|
const action = await handleIncompletePhase();
|
|
4535
4615
|
if (action === "abort") return -1;
|
|
@@ -4551,11 +4631,11 @@ Phase ${phaseNumber} completed.`));
|
|
|
4551
4631
|
}
|
|
4552
4632
|
|
|
4553
4633
|
// src/commands/backlog/watchForMarker.ts
|
|
4554
|
-
import { existsSync as
|
|
4634
|
+
import { existsSync as existsSync22, unwatchFile, watchFile } from "fs";
|
|
4555
4635
|
function watchForMarker(child, options2) {
|
|
4556
4636
|
const statusPath = getSignalPath();
|
|
4557
4637
|
watchFile(statusPath, { interval: 1e3 }, () => {
|
|
4558
|
-
if (!
|
|
4638
|
+
if (!existsSync22(statusPath)) return;
|
|
4559
4639
|
const signal = readSignal();
|
|
4560
4640
|
if (!signal) return;
|
|
4561
4641
|
if (signal.event === "done" && !options2?.actOnDone) return;
|
|
@@ -5213,12 +5293,12 @@ function delay(ms) {
|
|
|
5213
5293
|
|
|
5214
5294
|
// src/commands/sessions/web/handleRequest.ts
|
|
5215
5295
|
import { createHash as createHash2 } from "crypto";
|
|
5216
|
-
import { readFileSync as
|
|
5296
|
+
import { readFileSync as readFileSync17 } from "fs";
|
|
5217
5297
|
import { createRequire as createRequire2 } from "module";
|
|
5218
5298
|
|
|
5219
5299
|
// src/shared/createBundleHandler.ts
|
|
5220
5300
|
import { createHash } from "crypto";
|
|
5221
|
-
import { readFileSync as
|
|
5301
|
+
import { readFileSync as readFileSync16 } from "fs";
|
|
5222
5302
|
import { dirname as dirname16, join as join20 } from "path";
|
|
5223
5303
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
5224
5304
|
function createBundleHandler(importMetaUrl, bundlePath) {
|
|
@@ -5226,7 +5306,7 @@ function createBundleHandler(importMetaUrl, bundlePath) {
|
|
|
5226
5306
|
let cache;
|
|
5227
5307
|
return (req, res) => {
|
|
5228
5308
|
if (!cache) {
|
|
5229
|
-
const body =
|
|
5309
|
+
const body = readFileSync16(join20(dir, bundlePath), "utf8");
|
|
5230
5310
|
const etag = `"${createHash("sha256").update(body).digest("hex").slice(0, 16)}"`;
|
|
5231
5311
|
cache = { body, etag };
|
|
5232
5312
|
}
|
|
@@ -5973,7 +6053,7 @@ function createCssHandler(packageEntry) {
|
|
|
5973
6053
|
return (req, res) => {
|
|
5974
6054
|
if (!cache) {
|
|
5975
6055
|
const resolved = require3.resolve(packageEntry);
|
|
5976
|
-
const body =
|
|
6056
|
+
const body = readFileSync17(resolved, "utf8");
|
|
5977
6057
|
const etag = `"${createHash2("sha256").update(body).digest("hex").slice(0, 16)}"`;
|
|
5978
6058
|
cache = { body, etag };
|
|
5979
6059
|
}
|
|
@@ -6683,7 +6763,7 @@ import chalk59 from "chalk";
|
|
|
6683
6763
|
|
|
6684
6764
|
// src/commands/backlog/add/shared.ts
|
|
6685
6765
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
6686
|
-
import { mkdtempSync, readFileSync as
|
|
6766
|
+
import { mkdtempSync, readFileSync as readFileSync18, unlinkSync as unlinkSync6, writeFileSync as writeFileSync18 } from "fs";
|
|
6687
6767
|
import { tmpdir } from "os";
|
|
6688
6768
|
import { join as join21 } from "path";
|
|
6689
6769
|
import enquirer6 from "enquirer";
|
|
@@ -6733,7 +6813,7 @@ function openEditor() {
|
|
|
6733
6813
|
unlinkSync6(filePath);
|
|
6734
6814
|
return void 0;
|
|
6735
6815
|
}
|
|
6736
|
-
const content =
|
|
6816
|
+
const content = readFileSync18(filePath, "utf8").trim();
|
|
6737
6817
|
unlinkSync6(filePath);
|
|
6738
6818
|
return content || void 0;
|
|
6739
6819
|
}
|
|
@@ -8204,7 +8284,7 @@ function extractGraphqlQuery(args) {
|
|
|
8204
8284
|
}
|
|
8205
8285
|
|
|
8206
8286
|
// src/shared/loadCliReads.ts
|
|
8207
|
-
import { existsSync as
|
|
8287
|
+
import { existsSync as existsSync23, readFileSync as readFileSync19, writeFileSync as writeFileSync19 } from "fs";
|
|
8208
8288
|
import { dirname as dirname17, resolve as resolve8 } from "path";
|
|
8209
8289
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
8210
8290
|
var __filename3 = fileURLToPath4(import.meta.url);
|
|
@@ -8213,8 +8293,8 @@ function packageRoot() {
|
|
|
8213
8293
|
return __dirname4;
|
|
8214
8294
|
}
|
|
8215
8295
|
function readLines(path57) {
|
|
8216
|
-
if (!
|
|
8217
|
-
return
|
|
8296
|
+
if (!existsSync23(path57)) return [];
|
|
8297
|
+
return readFileSync19(path57, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
8218
8298
|
}
|
|
8219
8299
|
var cachedReads;
|
|
8220
8300
|
var cachedWrites;
|
|
@@ -8260,7 +8340,7 @@ function findCliWrite(command) {
|
|
|
8260
8340
|
}
|
|
8261
8341
|
|
|
8262
8342
|
// src/shared/readSettingsPerms.ts
|
|
8263
|
-
import { existsSync as
|
|
8343
|
+
import { existsSync as existsSync24, readFileSync as readFileSync20 } from "fs";
|
|
8264
8344
|
import { homedir as homedir9 } from "os";
|
|
8265
8345
|
import { join as join23 } from "path";
|
|
8266
8346
|
function readSettingsPerms(key) {
|
|
@@ -8276,9 +8356,9 @@ function readSettingsPerms(key) {
|
|
|
8276
8356
|
return entries;
|
|
8277
8357
|
}
|
|
8278
8358
|
function readPermissionArray(filePath, key) {
|
|
8279
|
-
if (!
|
|
8359
|
+
if (!existsSync24(filePath)) return [];
|
|
8280
8360
|
try {
|
|
8281
|
-
const data = JSON.parse(
|
|
8361
|
+
const data = JSON.parse(readFileSync20(filePath, "utf8"));
|
|
8282
8362
|
const arr = data?.permissions?.[key];
|
|
8283
8363
|
return Array.isArray(arr) ? arr.filter((e) => typeof e === "string") : [];
|
|
8284
8364
|
} catch {
|
|
@@ -8540,7 +8620,7 @@ ${reasons.join("\n")}`);
|
|
|
8540
8620
|
}
|
|
8541
8621
|
|
|
8542
8622
|
// src/commands/permitCliReads/index.ts
|
|
8543
|
-
import { existsSync as
|
|
8623
|
+
import { existsSync as existsSync25, mkdirSync as mkdirSync10, readFileSync as readFileSync21, writeFileSync as writeFileSync20 } from "fs";
|
|
8544
8624
|
import { homedir as homedir10 } from "os";
|
|
8545
8625
|
import { join as join24 } from "path";
|
|
8546
8626
|
|
|
@@ -8835,8 +8915,8 @@ function logPath(cli) {
|
|
|
8835
8915
|
}
|
|
8836
8916
|
function readCache(cli) {
|
|
8837
8917
|
const path57 = logPath(cli);
|
|
8838
|
-
if (!
|
|
8839
|
-
return
|
|
8918
|
+
if (!existsSync25(path57)) return void 0;
|
|
8919
|
+
return readFileSync21(path57, "utf8");
|
|
8840
8920
|
}
|
|
8841
8921
|
function writeCache(cli, output) {
|
|
8842
8922
|
const dir = join24(homedir10(), ".assist");
|
|
@@ -9648,7 +9728,7 @@ function registerConfig(program2) {
|
|
|
9648
9728
|
}
|
|
9649
9729
|
|
|
9650
9730
|
// src/commands/deploy/redirect.ts
|
|
9651
|
-
import { existsSync as
|
|
9731
|
+
import { existsSync as existsSync26, readFileSync as readFileSync22, writeFileSync as writeFileSync21 } from "fs";
|
|
9652
9732
|
import chalk99 from "chalk";
|
|
9653
9733
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
9654
9734
|
if (!window.location.pathname.endsWith('/')) {
|
|
@@ -9657,11 +9737,11 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
9657
9737
|
</script>`;
|
|
9658
9738
|
function redirect() {
|
|
9659
9739
|
const indexPath = "index.html";
|
|
9660
|
-
if (!
|
|
9740
|
+
if (!existsSync26(indexPath)) {
|
|
9661
9741
|
console.log(chalk99.yellow("No index.html found"));
|
|
9662
9742
|
return;
|
|
9663
9743
|
}
|
|
9664
|
-
const content =
|
|
9744
|
+
const content = readFileSync22(indexPath, "utf8");
|
|
9665
9745
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
9666
9746
|
console.log(chalk99.dim("Trailing slash script already present"));
|
|
9667
9747
|
return;
|
|
@@ -9704,7 +9784,7 @@ import { execSync as execSync24 } from "child_process";
|
|
|
9704
9784
|
import chalk100 from "chalk";
|
|
9705
9785
|
|
|
9706
9786
|
// src/shared/getRepoName.ts
|
|
9707
|
-
import { existsSync as
|
|
9787
|
+
import { existsSync as existsSync27, readFileSync as readFileSync23 } from "fs";
|
|
9708
9788
|
import { basename as basename3, join as join26 } from "path";
|
|
9709
9789
|
function getRepoName() {
|
|
9710
9790
|
const config = loadConfig();
|
|
@@ -9712,9 +9792,9 @@ function getRepoName() {
|
|
|
9712
9792
|
return config.devlog.name;
|
|
9713
9793
|
}
|
|
9714
9794
|
const packageJsonPath = join26(process.cwd(), "package.json");
|
|
9715
|
-
if (
|
|
9795
|
+
if (existsSync27(packageJsonPath)) {
|
|
9716
9796
|
try {
|
|
9717
|
-
const content =
|
|
9797
|
+
const content = readFileSync23(packageJsonPath, "utf8");
|
|
9718
9798
|
const pkg = JSON.parse(content);
|
|
9719
9799
|
if (pkg.name) {
|
|
9720
9800
|
return pkg.name;
|
|
@@ -9726,7 +9806,7 @@ function getRepoName() {
|
|
|
9726
9806
|
}
|
|
9727
9807
|
|
|
9728
9808
|
// src/commands/devlog/loadDevlogEntries.ts
|
|
9729
|
-
import { readdirSync, readFileSync as
|
|
9809
|
+
import { readdirSync, readFileSync as readFileSync24 } from "fs";
|
|
9730
9810
|
import { join as join27 } from "path";
|
|
9731
9811
|
var DEVLOG_DIR = join27(BLOG_REPO_ROOT, "src/content/devlog");
|
|
9732
9812
|
function extractFrontmatter(content) {
|
|
@@ -9756,7 +9836,7 @@ function readDevlogFiles(callback) {
|
|
|
9756
9836
|
try {
|
|
9757
9837
|
const files = readdirSync(DEVLOG_DIR).filter((f) => f.endsWith(".md"));
|
|
9758
9838
|
for (const file of files) {
|
|
9759
|
-
const content =
|
|
9839
|
+
const content = readFileSync24(join27(DEVLOG_DIR, file), "utf8");
|
|
9760
9840
|
const parsed = parseFrontmatter(content, file);
|
|
9761
9841
|
if (parsed) callback(parsed);
|
|
9762
9842
|
}
|
|
@@ -10213,12 +10293,12 @@ import { join as join29 } from "path";
|
|
|
10213
10293
|
import chalk107 from "chalk";
|
|
10214
10294
|
|
|
10215
10295
|
// src/shared/findRepoRoot.ts
|
|
10216
|
-
import { existsSync as
|
|
10296
|
+
import { existsSync as existsSync28 } from "fs";
|
|
10217
10297
|
import path22 from "path";
|
|
10218
10298
|
function findRepoRoot(dir) {
|
|
10219
10299
|
let current = dir;
|
|
10220
10300
|
while (current !== path22.dirname(current)) {
|
|
10221
|
-
if (
|
|
10301
|
+
if (existsSync28(path22.join(current, ".git"))) {
|
|
10222
10302
|
return current;
|
|
10223
10303
|
}
|
|
10224
10304
|
current = path22.dirname(current);
|
|
@@ -10284,11 +10364,11 @@ async function checkBuildLocksCommand() {
|
|
|
10284
10364
|
}
|
|
10285
10365
|
|
|
10286
10366
|
// src/commands/dotnet/buildTree.ts
|
|
10287
|
-
import { readFileSync as
|
|
10367
|
+
import { readFileSync as readFileSync25 } from "fs";
|
|
10288
10368
|
import path23 from "path";
|
|
10289
10369
|
var PROJECT_REF_RE = /<ProjectReference\s+Include="([^"]+)"/g;
|
|
10290
10370
|
function getProjectRefs(csprojPath) {
|
|
10291
|
-
const content =
|
|
10371
|
+
const content = readFileSync25(csprojPath, "utf8");
|
|
10292
10372
|
const refs = [];
|
|
10293
10373
|
for (const match of content.matchAll(PROJECT_REF_RE)) {
|
|
10294
10374
|
refs.push(match[1].replace(/\\/g, "/"));
|
|
@@ -10305,7 +10385,7 @@ function buildTree(csprojPath, repoRoot, visited = /* @__PURE__ */ new Set()) {
|
|
|
10305
10385
|
for (const ref of getProjectRefs(abs)) {
|
|
10306
10386
|
const childAbs = path23.resolve(dir, ref);
|
|
10307
10387
|
try {
|
|
10308
|
-
|
|
10388
|
+
readFileSync25(childAbs);
|
|
10309
10389
|
node.children.push(buildTree(childAbs, repoRoot, visited));
|
|
10310
10390
|
} catch {
|
|
10311
10391
|
node.children.push({
|
|
@@ -10330,7 +10410,7 @@ function collectAllDeps(node) {
|
|
|
10330
10410
|
}
|
|
10331
10411
|
|
|
10332
10412
|
// src/commands/dotnet/findContainingSolutions.ts
|
|
10333
|
-
import { readdirSync as readdirSync3, readFileSync as
|
|
10413
|
+
import { readdirSync as readdirSync3, readFileSync as readFileSync26, statSync as statSync2 } from "fs";
|
|
10334
10414
|
import path24 from "path";
|
|
10335
10415
|
function findSlnFiles(dir, maxDepth, depth = 0) {
|
|
10336
10416
|
if (depth > maxDepth) return [];
|
|
@@ -10365,7 +10445,7 @@ function findContainingSolutions(csprojPath, repoRoot) {
|
|
|
10365
10445
|
const pattern2 = new RegExp(`[\\\\"/]${escapeRegex(csprojBasename)}"`);
|
|
10366
10446
|
for (const sln of slnFiles) {
|
|
10367
10447
|
try {
|
|
10368
|
-
const content =
|
|
10448
|
+
const content = readFileSync26(sln, "utf8");
|
|
10369
10449
|
if (pattern2.test(content)) {
|
|
10370
10450
|
matches.push(path24.relative(repoRoot, sln));
|
|
10371
10451
|
}
|
|
@@ -10429,12 +10509,12 @@ function printJson(tree, totalCount, solutions) {
|
|
|
10429
10509
|
}
|
|
10430
10510
|
|
|
10431
10511
|
// src/commands/dotnet/resolveCsproj.ts
|
|
10432
|
-
import { existsSync as
|
|
10512
|
+
import { existsSync as existsSync29 } from "fs";
|
|
10433
10513
|
import path25 from "path";
|
|
10434
10514
|
import chalk109 from "chalk";
|
|
10435
10515
|
function resolveCsproj(csprojPath) {
|
|
10436
10516
|
const resolved = path25.resolve(csprojPath);
|
|
10437
|
-
if (!
|
|
10517
|
+
if (!existsSync29(resolved)) {
|
|
10438
10518
|
console.error(chalk109.red(`File not found: ${resolved}`));
|
|
10439
10519
|
process.exit(1);
|
|
10440
10520
|
}
|
|
@@ -10602,7 +10682,7 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
10602
10682
|
}
|
|
10603
10683
|
|
|
10604
10684
|
// src/commands/dotnet/resolveSolution.ts
|
|
10605
|
-
import { existsSync as
|
|
10685
|
+
import { existsSync as existsSync30 } from "fs";
|
|
10606
10686
|
import path26 from "path";
|
|
10607
10687
|
import chalk113 from "chalk";
|
|
10608
10688
|
|
|
@@ -10643,7 +10723,7 @@ function findSolution() {
|
|
|
10643
10723
|
function resolveSolution(sln) {
|
|
10644
10724
|
if (sln) {
|
|
10645
10725
|
const resolved = path26.resolve(sln);
|
|
10646
|
-
if (!
|
|
10726
|
+
if (!existsSync30(resolved)) {
|
|
10647
10727
|
console.error(chalk113.red(`Solution file not found: ${resolved}`));
|
|
10648
10728
|
process.exit(1);
|
|
10649
10729
|
}
|
|
@@ -10683,7 +10763,7 @@ function parseInspectReport(json) {
|
|
|
10683
10763
|
|
|
10684
10764
|
// src/commands/dotnet/runInspectCode.ts
|
|
10685
10765
|
import { execSync as execSync28 } from "child_process";
|
|
10686
|
-
import { existsSync as
|
|
10766
|
+
import { existsSync as existsSync31, readFileSync as readFileSync27, unlinkSync as unlinkSync7 } from "fs";
|
|
10687
10767
|
import { tmpdir as tmpdir3 } from "os";
|
|
10688
10768
|
import path27 from "path";
|
|
10689
10769
|
import chalk114 from "chalk";
|
|
@@ -10714,11 +10794,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
10714
10794
|
console.error(chalk114.red("jb inspectcode failed"));
|
|
10715
10795
|
process.exit(1);
|
|
10716
10796
|
}
|
|
10717
|
-
if (!
|
|
10797
|
+
if (!existsSync31(reportPath)) {
|
|
10718
10798
|
console.error(chalk114.red("Report file not generated"));
|
|
10719
10799
|
process.exit(1);
|
|
10720
10800
|
}
|
|
10721
|
-
const xml =
|
|
10801
|
+
const xml = readFileSync27(reportPath, "utf8");
|
|
10722
10802
|
unlinkSync7(reportPath);
|
|
10723
10803
|
return xml;
|
|
10724
10804
|
}
|
|
@@ -11059,9 +11139,9 @@ async function countPendingHandovers(orm, origin) {
|
|
|
11059
11139
|
|
|
11060
11140
|
// src/commands/handover/migrateDiskHandovers.ts
|
|
11061
11141
|
import {
|
|
11062
|
-
existsSync as
|
|
11142
|
+
existsSync as existsSync32,
|
|
11063
11143
|
readdirSync as readdirSync5,
|
|
11064
|
-
readFileSync as
|
|
11144
|
+
readFileSync as readFileSync28,
|
|
11065
11145
|
rmSync as rmSync3,
|
|
11066
11146
|
statSync as statSync3
|
|
11067
11147
|
} from "fs";
|
|
@@ -11114,7 +11194,7 @@ function summariseHandoverContent(content) {
|
|
|
11114
11194
|
|
|
11115
11195
|
// src/commands/handover/migrateDiskHandovers.ts
|
|
11116
11196
|
function collectMarkdown(dir) {
|
|
11117
|
-
if (!
|
|
11197
|
+
if (!existsSync32(dir)) return [];
|
|
11118
11198
|
const out = [];
|
|
11119
11199
|
for (const entry of readdirSync5(dir, { withFileTypes: true })) {
|
|
11120
11200
|
const full = join34(dir, entry.name);
|
|
@@ -11124,7 +11204,7 @@ function collectMarkdown(dir) {
|
|
|
11124
11204
|
return out;
|
|
11125
11205
|
}
|
|
11126
11206
|
async function migrateFile(orm, origin, file, createdAt) {
|
|
11127
|
-
const content =
|
|
11207
|
+
const content = readFileSync28(file, "utf8");
|
|
11128
11208
|
await saveHandover(orm, {
|
|
11129
11209
|
origin,
|
|
11130
11210
|
summary: summariseHandoverContent(content),
|
|
@@ -11141,7 +11221,7 @@ async function migrateDiskHandovers(orm, origin, cwd = process.cwd()) {
|
|
|
11141
11221
|
migrated++;
|
|
11142
11222
|
}
|
|
11143
11223
|
const handoverPath = getHandoverPath(cwd);
|
|
11144
|
-
if (
|
|
11224
|
+
if (existsSync32(handoverPath)) {
|
|
11145
11225
|
await migrateFile(orm, origin, handoverPath, statSync3(handoverPath).mtime);
|
|
11146
11226
|
migrated++;
|
|
11147
11227
|
}
|
|
@@ -11386,7 +11466,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
11386
11466
|
import { execSync as execSync31 } from "child_process";
|
|
11387
11467
|
|
|
11388
11468
|
// src/shared/loadJson.ts
|
|
11389
|
-
import { existsSync as
|
|
11469
|
+
import { existsSync as existsSync33, mkdirSync as mkdirSync11, readFileSync as readFileSync29, writeFileSync as writeFileSync24 } from "fs";
|
|
11390
11470
|
import { homedir as homedir12 } from "os";
|
|
11391
11471
|
import { join as join35 } from "path";
|
|
11392
11472
|
function getStoreDir() {
|
|
@@ -11397,9 +11477,9 @@ function getStorePath(filename) {
|
|
|
11397
11477
|
}
|
|
11398
11478
|
function loadJson(filename) {
|
|
11399
11479
|
const path57 = getStorePath(filename);
|
|
11400
|
-
if (
|
|
11480
|
+
if (existsSync33(path57)) {
|
|
11401
11481
|
try {
|
|
11402
|
-
return JSON.parse(
|
|
11482
|
+
return JSON.parse(readFileSync29(path57, "utf8"));
|
|
11403
11483
|
} catch {
|
|
11404
11484
|
return {};
|
|
11405
11485
|
}
|
|
@@ -11408,7 +11488,7 @@ function loadJson(filename) {
|
|
|
11408
11488
|
}
|
|
11409
11489
|
function saveJson(filename, data) {
|
|
11410
11490
|
const dir = getStoreDir();
|
|
11411
|
-
if (!
|
|
11491
|
+
if (!existsSync33(dir)) {
|
|
11412
11492
|
mkdirSync11(dir, { recursive: true });
|
|
11413
11493
|
}
|
|
11414
11494
|
writeFileSync24(getStorePath(filename), JSON.stringify(data, null, 2));
|
|
@@ -11555,7 +11635,7 @@ import { resolve as resolve11 } from "path";
|
|
|
11555
11635
|
import chalk125 from "chalk";
|
|
11556
11636
|
|
|
11557
11637
|
// src/commands/mermaid/exportFile.ts
|
|
11558
|
-
import { readFileSync as
|
|
11638
|
+
import { readFileSync as readFileSync30, writeFileSync as writeFileSync25 } from "fs";
|
|
11559
11639
|
import { basename as basename6, extname, resolve as resolve10 } from "path";
|
|
11560
11640
|
import chalk124 from "chalk";
|
|
11561
11641
|
|
|
@@ -11581,7 +11661,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
11581
11661
|
|
|
11582
11662
|
// src/commands/mermaid/exportFile.ts
|
|
11583
11663
|
async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
11584
|
-
const content =
|
|
11664
|
+
const content = readFileSync30(file, "utf8");
|
|
11585
11665
|
const blocks = extractMermaidBlocks(content);
|
|
11586
11666
|
const stem = basename6(file, extname(file));
|
|
11587
11667
|
if (onlyIndex !== void 0) {
|
|
@@ -11865,7 +11945,7 @@ import { join as join40 } from "path";
|
|
|
11865
11945
|
import chalk128 from "chalk";
|
|
11866
11946
|
|
|
11867
11947
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
11868
|
-
import { readFileSync as
|
|
11948
|
+
import { readFileSync as readFileSync31 } from "fs";
|
|
11869
11949
|
|
|
11870
11950
|
// src/commands/netcap/parseRscRows.ts
|
|
11871
11951
|
var isRscRef = (v) => typeof v === "string" && /^\$[0-9a-fL@]/.test(v);
|
|
@@ -12261,7 +12341,7 @@ function extractVoyagerPosts(body) {
|
|
|
12261
12341
|
|
|
12262
12342
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
12263
12343
|
function captureEntries(captureFile) {
|
|
12264
|
-
const lines =
|
|
12344
|
+
const lines = readFileSync31(captureFile, "utf8").split("\n").filter(Boolean);
|
|
12265
12345
|
const entries = [];
|
|
12266
12346
|
for (const line of lines) {
|
|
12267
12347
|
let entry;
|
|
@@ -12745,7 +12825,7 @@ import { tmpdir as tmpdir5 } from "os";
|
|
|
12745
12825
|
import { join as join42 } from "path";
|
|
12746
12826
|
|
|
12747
12827
|
// src/commands/prs/loadCommentsCache.ts
|
|
12748
|
-
import { existsSync as
|
|
12828
|
+
import { existsSync as existsSync34, readFileSync as readFileSync32, unlinkSync as unlinkSync9 } from "fs";
|
|
12749
12829
|
import { join as join41 } from "path";
|
|
12750
12830
|
import { parse as parse2 } from "yaml";
|
|
12751
12831
|
function getCachePath(prNumber) {
|
|
@@ -12753,15 +12833,15 @@ function getCachePath(prNumber) {
|
|
|
12753
12833
|
}
|
|
12754
12834
|
function loadCommentsCache(prNumber) {
|
|
12755
12835
|
const cachePath = getCachePath(prNumber);
|
|
12756
|
-
if (!
|
|
12836
|
+
if (!existsSync34(cachePath)) {
|
|
12757
12837
|
return null;
|
|
12758
12838
|
}
|
|
12759
|
-
const content =
|
|
12839
|
+
const content = readFileSync32(cachePath, "utf8");
|
|
12760
12840
|
return parse2(content);
|
|
12761
12841
|
}
|
|
12762
12842
|
function deleteCommentsCache(prNumber) {
|
|
12763
12843
|
const cachePath = getCachePath(prNumber);
|
|
12764
|
-
if (
|
|
12844
|
+
if (existsSync34(cachePath)) {
|
|
12765
12845
|
unlinkSync9(cachePath);
|
|
12766
12846
|
console.log("No more unresolved line comments. Cache dropped.");
|
|
12767
12847
|
}
|
|
@@ -12861,7 +12941,7 @@ function fixed(commentId, sha) {
|
|
|
12861
12941
|
}
|
|
12862
12942
|
|
|
12863
12943
|
// src/commands/prs/listComments/index.ts
|
|
12864
|
-
import { existsSync as
|
|
12944
|
+
import { existsSync as existsSync35, mkdirSync as mkdirSync13, writeFileSync as writeFileSync29 } from "fs";
|
|
12865
12945
|
import { join as join44 } from "path";
|
|
12866
12946
|
import { stringify } from "yaml";
|
|
12867
12947
|
|
|
@@ -12987,7 +13067,7 @@ function printComments2(result) {
|
|
|
12987
13067
|
// src/commands/prs/listComments/index.ts
|
|
12988
13068
|
function writeCommentsCache(prNumber, comments3) {
|
|
12989
13069
|
const assistDir = join44(process.cwd(), ".assist");
|
|
12990
|
-
if (!
|
|
13070
|
+
if (!existsSync35(assistDir)) {
|
|
12991
13071
|
mkdirSync13(assistDir, { recursive: true });
|
|
12992
13072
|
}
|
|
12993
13073
|
const cacheData = {
|
|
@@ -15691,7 +15771,7 @@ function gatherContext() {
|
|
|
15691
15771
|
}
|
|
15692
15772
|
|
|
15693
15773
|
// src/commands/review/postReviewToPr.ts
|
|
15694
|
-
import { readFileSync as
|
|
15774
|
+
import { readFileSync as readFileSync33 } from "fs";
|
|
15695
15775
|
|
|
15696
15776
|
// src/commands/review/parseFindings.ts
|
|
15697
15777
|
var SEVERITIES = ["blocker", "major", "minor", "nit"];
|
|
@@ -16001,7 +16081,7 @@ async function confirmPost(prNumber, count6, options2) {
|
|
|
16001
16081
|
async function postReviewToPr(synthesisPath, options2) {
|
|
16002
16082
|
const prInfo = fetchPrDiffInfo();
|
|
16003
16083
|
const prNumber = prInfo.prNumber;
|
|
16004
|
-
const markdown =
|
|
16084
|
+
const markdown = readFileSync33(synthesisPath, "utf8");
|
|
16005
16085
|
const findings = parseFindings(markdown);
|
|
16006
16086
|
if (findings.length === 0) {
|
|
16007
16087
|
console.log("Synthesis contains no findings; nothing to post.");
|
|
@@ -16083,10 +16163,10 @@ async function handlePostSynthesis(synthesisPath, options2) {
|
|
|
16083
16163
|
}
|
|
16084
16164
|
|
|
16085
16165
|
// src/commands/review/prepareReviewDir.ts
|
|
16086
|
-
import { existsSync as
|
|
16166
|
+
import { existsSync as existsSync36, mkdirSync as mkdirSync14, unlinkSync as unlinkSync12, writeFileSync as writeFileSync30 } from "fs";
|
|
16087
16167
|
function clearReviewFiles(paths) {
|
|
16088
16168
|
for (const path57 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
16089
|
-
if (
|
|
16169
|
+
if (existsSync36(path57)) unlinkSync12(path57);
|
|
16090
16170
|
}
|
|
16091
16171
|
}
|
|
16092
16172
|
function prepareReviewDir(paths, requestBody, force) {
|
|
@@ -16371,7 +16451,7 @@ function printReviewerFailures(results) {
|
|
|
16371
16451
|
}
|
|
16372
16452
|
|
|
16373
16453
|
// src/commands/review/runAndSynthesise.ts
|
|
16374
|
-
import { existsSync as
|
|
16454
|
+
import { existsSync as existsSync38, unlinkSync as unlinkSync14 } from "fs";
|
|
16375
16455
|
|
|
16376
16456
|
// src/commands/review/buildReviewerStdin.ts
|
|
16377
16457
|
var REVIEW_PROMPT = `You are acting as a reviewer for a proposed code change made by another engineer. The full review request \u2014 branch, base, changed files, and unified diff \u2014 is in the request file whose absolute path is given below.
|
|
@@ -16791,7 +16871,7 @@ function resolveClaude(args) {
|
|
|
16791
16871
|
}
|
|
16792
16872
|
|
|
16793
16873
|
// src/commands/review/runCodexReviewer.ts
|
|
16794
|
-
import { existsSync as
|
|
16874
|
+
import { existsSync as existsSync37, unlinkSync as unlinkSync13 } from "fs";
|
|
16795
16875
|
|
|
16796
16876
|
// src/commands/review/parseCodexEvent.ts
|
|
16797
16877
|
function isItemStarted(value) {
|
|
@@ -16843,7 +16923,7 @@ async function runCodexReviewer(spec) {
|
|
|
16843
16923
|
reportReviewerToolUse(spec.name, event, spinner);
|
|
16844
16924
|
}
|
|
16845
16925
|
});
|
|
16846
|
-
if (result.exitCode !== 0 &&
|
|
16926
|
+
if (result.exitCode !== 0 && existsSync37(spec.outputPath)) {
|
|
16847
16927
|
unlinkSync13(spec.outputPath);
|
|
16848
16928
|
}
|
|
16849
16929
|
return finaliseReviewerRun({ ...spec, command }, spinner, result);
|
|
@@ -16885,7 +16965,7 @@ async function runReviewers(reviewDir, claudePath, codexPath, stdinPrompt, optio
|
|
|
16885
16965
|
}
|
|
16886
16966
|
|
|
16887
16967
|
// src/commands/review/synthesise.ts
|
|
16888
|
-
import { readFileSync as
|
|
16968
|
+
import { readFileSync as readFileSync34 } from "fs";
|
|
16889
16969
|
|
|
16890
16970
|
// src/commands/review/buildSynthesisStdin.ts
|
|
16891
16971
|
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.
|
|
@@ -16941,7 +17021,7 @@ Files:
|
|
|
16941
17021
|
|
|
16942
17022
|
// src/commands/review/synthesise.ts
|
|
16943
17023
|
function printSummary2(synthesisPath) {
|
|
16944
|
-
const markdown =
|
|
17024
|
+
const markdown = readFileSync34(synthesisPath, "utf8");
|
|
16945
17025
|
console.log("");
|
|
16946
17026
|
console.log(buildReviewSummary(markdown));
|
|
16947
17027
|
console.log("");
|
|
@@ -16989,7 +17069,7 @@ async function runAndSynthesise(args) {
|
|
|
16989
17069
|
console.error("Both reviewers failed; skipping synthesis.");
|
|
16990
17070
|
return { ok: false, failures };
|
|
16991
17071
|
}
|
|
16992
|
-
if (anyFresh &&
|
|
17072
|
+
if (anyFresh && existsSync38(paths.synthesisPath)) {
|
|
16993
17073
|
unlinkSync14(paths.synthesisPath);
|
|
16994
17074
|
}
|
|
16995
17075
|
const synthesisResult = await synthesise(paths, { multi });
|
|
@@ -17768,7 +17848,7 @@ function registerSql(program2) {
|
|
|
17768
17848
|
}
|
|
17769
17849
|
|
|
17770
17850
|
// src/commands/transcript/shared.ts
|
|
17771
|
-
import { existsSync as
|
|
17851
|
+
import { existsSync as existsSync39, readdirSync as readdirSync7, statSync as statSync5 } from "fs";
|
|
17772
17852
|
import { basename as basename8, join as join46, relative as relative2 } from "path";
|
|
17773
17853
|
import * as readline2 from "readline";
|
|
17774
17854
|
var DATE_PREFIX_REGEX = /^\d{4}-\d{2}-\d{2}/;
|
|
@@ -17784,7 +17864,7 @@ function isValidDatePrefix(filename) {
|
|
|
17784
17864
|
return DATE_PREFIX_REGEX.test(filename);
|
|
17785
17865
|
}
|
|
17786
17866
|
function collectFiles(dir, extension) {
|
|
17787
|
-
if (!
|
|
17867
|
+
if (!existsSync39(dir)) return [];
|
|
17788
17868
|
const results = [];
|
|
17789
17869
|
for (const entry of readdirSync7(dir)) {
|
|
17790
17870
|
const fullPath = join46(dir, entry);
|
|
@@ -17881,7 +17961,7 @@ async function configure() {
|
|
|
17881
17961
|
}
|
|
17882
17962
|
|
|
17883
17963
|
// src/commands/transcript/format/index.ts
|
|
17884
|
-
import { existsSync as
|
|
17964
|
+
import { existsSync as existsSync41 } from "fs";
|
|
17885
17965
|
|
|
17886
17966
|
// src/commands/transcript/format/fixInvalidDatePrefixes/index.ts
|
|
17887
17967
|
import { dirname as dirname22, join as join48 } from "path";
|
|
@@ -17955,7 +18035,7 @@ async function fixInvalidDatePrefixes(vttFiles) {
|
|
|
17955
18035
|
}
|
|
17956
18036
|
|
|
17957
18037
|
// src/commands/transcript/format/processVttFile/index.ts
|
|
17958
|
-
import { existsSync as
|
|
18038
|
+
import { existsSync as existsSync40, mkdirSync as mkdirSync15, readFileSync as readFileSync35, writeFileSync as writeFileSync32 } from "fs";
|
|
17959
18039
|
import { basename as basename9, dirname as dirname23, join as join49 } from "path";
|
|
17960
18040
|
|
|
17961
18041
|
// src/commands/transcript/cleanText.ts
|
|
@@ -18180,7 +18260,7 @@ function logSkipped(relativeDir, mdFile) {
|
|
|
18180
18260
|
return "skipped";
|
|
18181
18261
|
}
|
|
18182
18262
|
function ensureDirectory(dir, label2) {
|
|
18183
|
-
if (!
|
|
18263
|
+
if (!existsSync40(dir)) {
|
|
18184
18264
|
mkdirSync15(dir, { recursive: true });
|
|
18185
18265
|
console.log(`Created ${label2}: ${dir}`);
|
|
18186
18266
|
}
|
|
@@ -18203,7 +18283,7 @@ function logReduction(cueCount, messageCount) {
|
|
|
18203
18283
|
}
|
|
18204
18284
|
function readAndParseCues(inputPath) {
|
|
18205
18285
|
console.log(`Reading: ${inputPath}`);
|
|
18206
|
-
return processCues(
|
|
18286
|
+
return processCues(readFileSync35(inputPath, "utf8"));
|
|
18207
18287
|
}
|
|
18208
18288
|
function writeFormatted(outputPath, content) {
|
|
18209
18289
|
writeFileSync32(outputPath, content, "utf8");
|
|
@@ -18216,7 +18296,7 @@ function convertVttToMarkdown(inputPath, outputPath) {
|
|
|
18216
18296
|
logReduction(cues.length, chatMessages.length);
|
|
18217
18297
|
}
|
|
18218
18298
|
function tryProcessVtt(vttFile, paths) {
|
|
18219
|
-
if (
|
|
18299
|
+
if (existsSync40(paths.outputPath))
|
|
18220
18300
|
return logSkipped(paths.relativeDir, paths.mdFile);
|
|
18221
18301
|
convertVttToMarkdown(vttFile.absolutePath, paths.outputPath);
|
|
18222
18302
|
return "processed";
|
|
@@ -18242,7 +18322,7 @@ function processAllFiles(vttFiles, transcriptsDir) {
|
|
|
18242
18322
|
logSummary(counts);
|
|
18243
18323
|
}
|
|
18244
18324
|
function requireVttDir(vttDir) {
|
|
18245
|
-
if (!
|
|
18325
|
+
if (!existsSync41(vttDir)) {
|
|
18246
18326
|
console.error(`VTT directory not found: ${vttDir}`);
|
|
18247
18327
|
process.exit(1);
|
|
18248
18328
|
}
|
|
@@ -18274,14 +18354,14 @@ async function format() {
|
|
|
18274
18354
|
}
|
|
18275
18355
|
|
|
18276
18356
|
// src/commands/transcript/summarise/index.ts
|
|
18277
|
-
import { existsSync as
|
|
18357
|
+
import { existsSync as existsSync43 } from "fs";
|
|
18278
18358
|
import { basename as basename10, dirname as dirname25, join as join51, relative as relative3 } from "path";
|
|
18279
18359
|
|
|
18280
18360
|
// src/commands/transcript/summarise/processStagedFile/index.ts
|
|
18281
18361
|
import {
|
|
18282
|
-
existsSync as
|
|
18362
|
+
existsSync as existsSync42,
|
|
18283
18363
|
mkdirSync as mkdirSync16,
|
|
18284
|
-
readFileSync as
|
|
18364
|
+
readFileSync as readFileSync36,
|
|
18285
18365
|
renameSync as renameSync3,
|
|
18286
18366
|
rmSync as rmSync4
|
|
18287
18367
|
} from "fs";
|
|
@@ -18316,7 +18396,7 @@ function validateStagedContent(filename, content) {
|
|
|
18316
18396
|
// src/commands/transcript/summarise/processStagedFile/index.ts
|
|
18317
18397
|
var STAGING_DIR = join50(process.cwd(), ".assist", "transcript");
|
|
18318
18398
|
function processStagedFile() {
|
|
18319
|
-
if (!
|
|
18399
|
+
if (!existsSync42(STAGING_DIR)) {
|
|
18320
18400
|
return false;
|
|
18321
18401
|
}
|
|
18322
18402
|
const stagedFiles = findMdFilesRecursive(STAGING_DIR);
|
|
@@ -18325,7 +18405,7 @@ function processStagedFile() {
|
|
|
18325
18405
|
}
|
|
18326
18406
|
const { transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
18327
18407
|
const stagedFile = stagedFiles[0];
|
|
18328
|
-
const content =
|
|
18408
|
+
const content = readFileSync36(stagedFile.absolutePath, "utf8");
|
|
18329
18409
|
validateStagedContent(stagedFile.filename, content);
|
|
18330
18410
|
const stagedBaseName = getTranscriptBaseName(stagedFile.filename);
|
|
18331
18411
|
const transcriptFiles = findMdFilesRecursive(transcriptsDir);
|
|
@@ -18340,7 +18420,7 @@ function processStagedFile() {
|
|
|
18340
18420
|
}
|
|
18341
18421
|
const destPath = join50(summaryDir, matchingTranscript.relativePath);
|
|
18342
18422
|
const destDir = dirname24(destPath);
|
|
18343
|
-
if (!
|
|
18423
|
+
if (!existsSync42(destDir)) {
|
|
18344
18424
|
mkdirSync16(destDir, { recursive: true });
|
|
18345
18425
|
}
|
|
18346
18426
|
renameSync3(stagedFile.absolutePath, destPath);
|
|
@@ -18367,7 +18447,7 @@ function buildSummaryIndex(summaryDir) {
|
|
|
18367
18447
|
function summarise2() {
|
|
18368
18448
|
processStagedFile();
|
|
18369
18449
|
const { transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
18370
|
-
if (!
|
|
18450
|
+
if (!existsSync43(transcriptsDir)) {
|
|
18371
18451
|
console.log("No transcripts directory found.");
|
|
18372
18452
|
return;
|
|
18373
18453
|
}
|
|
@@ -18414,6 +18494,13 @@ function registerTranscript(program2) {
|
|
|
18414
18494
|
}
|
|
18415
18495
|
|
|
18416
18496
|
// src/commands/registerVerify.ts
|
|
18497
|
+
function runScope(scope, options2) {
|
|
18498
|
+
if (scope && scope !== "all") {
|
|
18499
|
+
console.error(`Unknown scope: "${scope}". Use "all" to run all checks.`);
|
|
18500
|
+
process.exit(1);
|
|
18501
|
+
}
|
|
18502
|
+
run({ ...options2, all: scope === "all" });
|
|
18503
|
+
}
|
|
18417
18504
|
function registerVerify(program2) {
|
|
18418
18505
|
const verifyCommand = program2.command("verify").description("Run all verify:* commands in parallel").argument(
|
|
18419
18506
|
"[scope]",
|
|
@@ -18421,15 +18508,7 @@ function registerVerify(program2) {
|
|
|
18421
18508
|
).option(
|
|
18422
18509
|
"--measure",
|
|
18423
18510
|
"Print a summary table of each command's status and duration after the run"
|
|
18424
|
-
).option("--verbose", "Show all output (bypass CLAUDECODE suppression)").action(
|
|
18425
|
-
if (scope && scope !== "all") {
|
|
18426
|
-
console.error(
|
|
18427
|
-
`Unknown scope: "${scope}". Use "all" to run all checks.`
|
|
18428
|
-
);
|
|
18429
|
-
process.exit(1);
|
|
18430
|
-
}
|
|
18431
|
-
run({ ...options2, all: scope === "all" });
|
|
18432
|
-
});
|
|
18511
|
+
).option("--verbose", "Show all output (bypass CLAUDECODE suppression)").action(runScope);
|
|
18433
18512
|
verifyCommand.command("list").description("List configured verify commands").action(list);
|
|
18434
18513
|
verifyCommand.command("init").description("Add verify scripts to a project").option(
|
|
18435
18514
|
"--package-json",
|
|
@@ -18438,6 +18517,9 @@ function registerVerify(program2) {
|
|
|
18438
18517
|
verifyCommand.command("hardcoded-colors").description("Check for hardcoded hex colors in src/").action(hardcodedColors);
|
|
18439
18518
|
verifyCommand.command("comment-policy").description("Check for undocumented comments added on changed lines").action(commentPolicy);
|
|
18440
18519
|
verifyCommand.command("no-venv").description("Check that no venv folders exist in the repo").action(noVenv);
|
|
18520
|
+
verifyCommand.command("settings-guard").description(
|
|
18521
|
+
"Check that claude/settings.json permission lists contain no assist references"
|
|
18522
|
+
).action(settingsGuard);
|
|
18441
18523
|
}
|
|
18442
18524
|
|
|
18443
18525
|
// src/commands/voice/devices.ts
|
|
@@ -18478,14 +18560,14 @@ function devices() {
|
|
|
18478
18560
|
}
|
|
18479
18561
|
|
|
18480
18562
|
// src/commands/voice/logs.ts
|
|
18481
|
-
import { existsSync as
|
|
18563
|
+
import { existsSync as existsSync44, readFileSync as readFileSync37 } from "fs";
|
|
18482
18564
|
function logs(options2) {
|
|
18483
|
-
if (!
|
|
18565
|
+
if (!existsSync44(voicePaths.log)) {
|
|
18484
18566
|
console.log("No voice log file found");
|
|
18485
18567
|
return;
|
|
18486
18568
|
}
|
|
18487
18569
|
const count6 = Number.parseInt(options2.lines ?? "150", 10);
|
|
18488
|
-
const content =
|
|
18570
|
+
const content = readFileSync37(voicePaths.log, "utf8").trim();
|
|
18489
18571
|
if (!content) {
|
|
18490
18572
|
console.log("Voice log is empty");
|
|
18491
18573
|
return;
|
|
@@ -18512,7 +18594,7 @@ import { join as join55 } from "path";
|
|
|
18512
18594
|
|
|
18513
18595
|
// src/commands/voice/checkLockFile.ts
|
|
18514
18596
|
import { execSync as execSync49 } from "child_process";
|
|
18515
|
-
import { existsSync as
|
|
18597
|
+
import { existsSync as existsSync45, mkdirSync as mkdirSync17, readFileSync as readFileSync38, writeFileSync as writeFileSync33 } from "fs";
|
|
18516
18598
|
import { join as join54 } from "path";
|
|
18517
18599
|
function isProcessAlive2(pid) {
|
|
18518
18600
|
try {
|
|
@@ -18524,9 +18606,9 @@ function isProcessAlive2(pid) {
|
|
|
18524
18606
|
}
|
|
18525
18607
|
function checkLockFile() {
|
|
18526
18608
|
const lockFile = getLockFile();
|
|
18527
|
-
if (!
|
|
18609
|
+
if (!existsSync45(lockFile)) return;
|
|
18528
18610
|
try {
|
|
18529
|
-
const lock = JSON.parse(
|
|
18611
|
+
const lock = JSON.parse(readFileSync38(lockFile, "utf8"));
|
|
18530
18612
|
if (lock.pid && isProcessAlive2(lock.pid)) {
|
|
18531
18613
|
console.error(
|
|
18532
18614
|
`Voice daemon already running (PID ${lock.pid}, env: ${lock.env}). Stop it first with: assist voice stop`
|
|
@@ -18537,7 +18619,7 @@ function checkLockFile() {
|
|
|
18537
18619
|
}
|
|
18538
18620
|
}
|
|
18539
18621
|
function bootstrapVenv() {
|
|
18540
|
-
if (
|
|
18622
|
+
if (existsSync45(getVenvPython())) return;
|
|
18541
18623
|
console.log("Setting up Python environment...");
|
|
18542
18624
|
const pythonDir = getPythonDir();
|
|
18543
18625
|
execSync49(
|
|
@@ -18628,7 +18710,7 @@ function start2(options2) {
|
|
|
18628
18710
|
}
|
|
18629
18711
|
|
|
18630
18712
|
// src/commands/voice/status.ts
|
|
18631
|
-
import { existsSync as
|
|
18713
|
+
import { existsSync as existsSync46, readFileSync as readFileSync39 } from "fs";
|
|
18632
18714
|
function isProcessAlive3(pid) {
|
|
18633
18715
|
try {
|
|
18634
18716
|
process.kill(pid, 0);
|
|
@@ -18638,16 +18720,16 @@ function isProcessAlive3(pid) {
|
|
|
18638
18720
|
}
|
|
18639
18721
|
}
|
|
18640
18722
|
function readRecentLogs(count6) {
|
|
18641
|
-
if (!
|
|
18642
|
-
const lines =
|
|
18723
|
+
if (!existsSync46(voicePaths.log)) return [];
|
|
18724
|
+
const lines = readFileSync39(voicePaths.log, "utf8").trim().split("\n");
|
|
18643
18725
|
return lines.slice(-count6);
|
|
18644
18726
|
}
|
|
18645
18727
|
function status() {
|
|
18646
|
-
if (!
|
|
18728
|
+
if (!existsSync46(voicePaths.pid)) {
|
|
18647
18729
|
console.log("Voice daemon: not running (no PID file)");
|
|
18648
18730
|
return;
|
|
18649
18731
|
}
|
|
18650
|
-
const pid = Number.parseInt(
|
|
18732
|
+
const pid = Number.parseInt(readFileSync39(voicePaths.pid, "utf8").trim(), 10);
|
|
18651
18733
|
const alive = isProcessAlive3(pid);
|
|
18652
18734
|
console.log(`Voice daemon: ${alive ? "running" : "dead"} (PID ${pid})`);
|
|
18653
18735
|
const recent = readRecentLogs(5);
|
|
@@ -18666,13 +18748,13 @@ function status() {
|
|
|
18666
18748
|
}
|
|
18667
18749
|
|
|
18668
18750
|
// src/commands/voice/stop.ts
|
|
18669
|
-
import { existsSync as
|
|
18751
|
+
import { existsSync as existsSync47, readFileSync as readFileSync40, unlinkSync as unlinkSync15 } from "fs";
|
|
18670
18752
|
function stop2() {
|
|
18671
|
-
if (!
|
|
18753
|
+
if (!existsSync47(voicePaths.pid)) {
|
|
18672
18754
|
console.log("Voice daemon is not running (no PID file)");
|
|
18673
18755
|
return;
|
|
18674
18756
|
}
|
|
18675
|
-
const pid = Number.parseInt(
|
|
18757
|
+
const pid = Number.parseInt(readFileSync40(voicePaths.pid, "utf8").trim(), 10);
|
|
18676
18758
|
try {
|
|
18677
18759
|
process.kill(pid, "SIGTERM");
|
|
18678
18760
|
console.log(`Sent SIGTERM to voice daemon (PID ${pid})`);
|
|
@@ -18685,7 +18767,7 @@ function stop2() {
|
|
|
18685
18767
|
}
|
|
18686
18768
|
try {
|
|
18687
18769
|
const lockFile = getLockFile();
|
|
18688
|
-
if (
|
|
18770
|
+
if (existsSync47(lockFile)) unlinkSync15(lockFile);
|
|
18689
18771
|
} catch {
|
|
18690
18772
|
}
|
|
18691
18773
|
console.log("Voice daemon stopped");
|
|
@@ -18863,7 +18945,7 @@ async function auth() {
|
|
|
18863
18945
|
|
|
18864
18946
|
// src/commands/roam/postRoamActivity.ts
|
|
18865
18947
|
import { execFileSync as execFileSync7 } from "child_process";
|
|
18866
|
-
import { readdirSync as readdirSync8, readFileSync as
|
|
18948
|
+
import { readdirSync as readdirSync8, readFileSync as readFileSync41, statSync as statSync6 } from "fs";
|
|
18867
18949
|
import { join as join57 } from "path";
|
|
18868
18950
|
function findPortFile(roamDir) {
|
|
18869
18951
|
let entries;
|
|
@@ -18889,7 +18971,7 @@ function postRoamActivity(app, event) {
|
|
|
18889
18971
|
if (!portFile) return;
|
|
18890
18972
|
let port;
|
|
18891
18973
|
try {
|
|
18892
|
-
port =
|
|
18974
|
+
port = readFileSync41(portFile, "utf8").trim();
|
|
18893
18975
|
} catch {
|
|
18894
18976
|
return;
|
|
18895
18977
|
}
|
|
@@ -19031,7 +19113,7 @@ function runPreCommands(pre, cwd) {
|
|
|
19031
19113
|
|
|
19032
19114
|
// src/commands/run/spawnRunCommand.ts
|
|
19033
19115
|
import { execFileSync as execFileSync8, spawn as spawn8 } from "child_process";
|
|
19034
|
-
import { existsSync as
|
|
19116
|
+
import { existsSync as existsSync48 } from "fs";
|
|
19035
19117
|
import { dirname as dirname27, join as join58, resolve as resolve13 } from "path";
|
|
19036
19118
|
function resolveCommand2(command) {
|
|
19037
19119
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
@@ -19039,7 +19121,7 @@ function resolveCommand2(command) {
|
|
|
19039
19121
|
const gitPath = execFileSync8("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
19040
19122
|
const gitRoot = resolve13(dirname27(gitPath), "..");
|
|
19041
19123
|
const gitBash = join58(gitRoot, "bin", "bash.exe");
|
|
19042
|
-
if (
|
|
19124
|
+
if (existsSync48(gitBash)) return gitBash;
|
|
19043
19125
|
} catch {
|
|
19044
19126
|
}
|
|
19045
19127
|
return command;
|
|
@@ -19250,7 +19332,7 @@ function link2() {
|
|
|
19250
19332
|
}
|
|
19251
19333
|
|
|
19252
19334
|
// src/commands/run/remove.ts
|
|
19253
|
-
import { existsSync as
|
|
19335
|
+
import { existsSync as existsSync49, unlinkSync as unlinkSync16 } from "fs";
|
|
19254
19336
|
import { join as join60 } from "path";
|
|
19255
19337
|
function findRemoveIndex() {
|
|
19256
19338
|
const idx = process.argv.indexOf("remove");
|
|
@@ -19267,7 +19349,7 @@ function parseRemoveName() {
|
|
|
19267
19349
|
}
|
|
19268
19350
|
function deleteCommandFile(name) {
|
|
19269
19351
|
const filePath = join60(".claude", "commands", `${name}.md`);
|
|
19270
|
-
if (
|
|
19352
|
+
if (existsSync49(filePath)) {
|
|
19271
19353
|
unlinkSync16(filePath);
|
|
19272
19354
|
console.log(`Deleted command file: ${filePath}`);
|
|
19273
19355
|
}
|
|
@@ -19306,7 +19388,7 @@ function registerRun(program2) {
|
|
|
19306
19388
|
|
|
19307
19389
|
// src/commands/screenshot/index.ts
|
|
19308
19390
|
import { execSync as execSync51 } from "child_process";
|
|
19309
|
-
import { existsSync as
|
|
19391
|
+
import { existsSync as existsSync50, mkdirSync as mkdirSync21, unlinkSync as unlinkSync17, writeFileSync as writeFileSync36 } from "fs";
|
|
19310
19392
|
import { tmpdir as tmpdir7 } from "os";
|
|
19311
19393
|
import { join as join61, resolve as resolve15 } from "path";
|
|
19312
19394
|
import chalk173 from "chalk";
|
|
@@ -19438,7 +19520,7 @@ Write-Output $OutputPath
|
|
|
19438
19520
|
|
|
19439
19521
|
// src/commands/screenshot/index.ts
|
|
19440
19522
|
function buildOutputPath(outputDir, processName) {
|
|
19441
|
-
if (!
|
|
19523
|
+
if (!existsSync50(outputDir)) {
|
|
19442
19524
|
mkdirSync21(outputDir, { recursive: true });
|
|
19443
19525
|
}
|
|
19444
19526
|
const timestamp4 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
@@ -19522,7 +19604,7 @@ function applyLine(result, pending, line) {
|
|
|
19522
19604
|
}
|
|
19523
19605
|
|
|
19524
19606
|
// src/commands/sessions/daemon/reportStolenSocket.ts
|
|
19525
|
-
import { readFileSync as
|
|
19607
|
+
import { readFileSync as readFileSync42 } from "fs";
|
|
19526
19608
|
function reportStolenSocket(socketPid) {
|
|
19527
19609
|
if (!socketPid) return;
|
|
19528
19610
|
const filePid = readPidFile();
|
|
@@ -19534,7 +19616,7 @@ function reportStolenSocket(socketPid) {
|
|
|
19534
19616
|
function readPidFile() {
|
|
19535
19617
|
try {
|
|
19536
19618
|
const pid = Number.parseInt(
|
|
19537
|
-
|
|
19619
|
+
readFileSync42(daemonPaths.pid, "utf8").trim(),
|
|
19538
19620
|
10
|
|
19539
19621
|
);
|
|
19540
19622
|
return Number.isInteger(pid) ? pid : void 0;
|
|
@@ -19820,7 +19902,7 @@ var ClientHub = class extends Set {
|
|
|
19820
19902
|
import * as pty from "node-pty";
|
|
19821
19903
|
|
|
19822
19904
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
19823
|
-
import { chmodSync, existsSync as
|
|
19905
|
+
import { chmodSync, existsSync as existsSync51, statSync as statSync7 } from "fs";
|
|
19824
19906
|
import { createRequire as createRequire3 } from "module";
|
|
19825
19907
|
import path49 from "path";
|
|
19826
19908
|
var require4 = createRequire3(import.meta.url);
|
|
@@ -19835,7 +19917,7 @@ function ensureSpawnHelperExecutable() {
|
|
|
19835
19917
|
`${process.platform}-${process.arch}`,
|
|
19836
19918
|
"spawn-helper"
|
|
19837
19919
|
);
|
|
19838
|
-
if (!
|
|
19920
|
+
if (!existsSync51(helper)) return;
|
|
19839
19921
|
const mode = statSync7(helper).mode;
|
|
19840
19922
|
if ((mode & 73) === 0) chmodSync(helper, mode | 493);
|
|
19841
19923
|
}
|
|
@@ -20195,7 +20277,7 @@ function resumeSession(id2, sessionId, cwd, name) {
|
|
|
20195
20277
|
}
|
|
20196
20278
|
|
|
20197
20279
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
20198
|
-
import { existsSync as
|
|
20280
|
+
import { existsSync as existsSync52, mkdirSync as mkdirSync22, watch } from "fs";
|
|
20199
20281
|
import { dirname as dirname28 } from "path";
|
|
20200
20282
|
|
|
20201
20283
|
// src/commands/sessions/daemon/applyReviewPause.ts
|
|
@@ -20237,7 +20319,7 @@ function watchActivity(session, notify2) {
|
|
|
20237
20319
|
if (timer) clearTimeout(timer);
|
|
20238
20320
|
timer = setTimeout(read, DEBOUNCE_MS);
|
|
20239
20321
|
});
|
|
20240
|
-
if (
|
|
20322
|
+
if (existsSync52(path57)) read();
|
|
20241
20323
|
}
|
|
20242
20324
|
function refreshActivity(session) {
|
|
20243
20325
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -21395,7 +21477,7 @@ function handleConnection(socket, manager) {
|
|
|
21395
21477
|
import { unlinkSync as unlinkSync18, writeFileSync as writeFileSync37 } from "fs";
|
|
21396
21478
|
|
|
21397
21479
|
// src/commands/sessions/daemon/startPidFileWatchdog.ts
|
|
21398
|
-
import { readFileSync as
|
|
21480
|
+
import { readFileSync as readFileSync43 } from "fs";
|
|
21399
21481
|
var WATCHDOG_INTERVAL_MS = 5e3;
|
|
21400
21482
|
function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
21401
21483
|
const timer = setInterval(() => {
|
|
@@ -21406,7 +21488,7 @@ function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
|
21406
21488
|
}
|
|
21407
21489
|
function ownsPidFile() {
|
|
21408
21490
|
try {
|
|
21409
|
-
return
|
|
21491
|
+
return readFileSync43(daemonPaths.pid, "utf8").trim() === String(process.pid);
|
|
21410
21492
|
} catch {
|
|
21411
21493
|
return false;
|
|
21412
21494
|
}
|