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