@staff0rd/assist 0.314.0 → 0.315.1
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 +275 -185
- 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.1",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -663,8 +663,9 @@ function setupVerifyRunEntry(scriptName, command, options2) {
|
|
|
663
663
|
// src/commands/verify/setup/expectedScripts.ts
|
|
664
664
|
var expectedScripts = {
|
|
665
665
|
"verify:knip": "knip --no-progress --treat-config-hints-as-errors",
|
|
666
|
-
"verify:lint": "oxlint --config .oxlintrc.json .",
|
|
667
|
-
"verify:
|
|
666
|
+
"verify:lint": "oxlint --config .oxlintrc.json --fix .",
|
|
667
|
+
"verify:format": "oxfmt .",
|
|
668
|
+
"verify:duplicate-code": "jscpd --format 'typescript,tsx' --exit-code 1 --ignore '**/*.test.*' -r consoleFull src",
|
|
668
669
|
"verify:test": "vitest run --reporter=dot --silent",
|
|
669
670
|
"verify:hardcoded-colors": "assist verify hardcoded-colors",
|
|
670
671
|
"verify:no-venv": "assist verify no-venv",
|
|
@@ -990,6 +991,12 @@ async function setupLint(packageJsonPath, writer) {
|
|
|
990
991
|
}
|
|
991
992
|
await init();
|
|
992
993
|
writer("verify:lint", expectedScripts["verify:lint"]);
|
|
994
|
+
if (!pkg.devDependencies?.oxfmt) {
|
|
995
|
+
if (!installPackage("oxfmt", cwd)) {
|
|
996
|
+
return;
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
writer("verify:format", expectedScripts["verify:format"]);
|
|
993
1000
|
}
|
|
994
1001
|
|
|
995
1002
|
// src/commands/verify/setup/setupMaintainability.ts
|
|
@@ -2279,6 +2286,61 @@ async function run(options2 = {}) {
|
|
|
2279
2286
|
handleResults(results, entries.length);
|
|
2280
2287
|
}
|
|
2281
2288
|
|
|
2289
|
+
// src/commands/verify/settingsGuard.ts
|
|
2290
|
+
import { existsSync as existsSync12, readFileSync as readFileSync9 } from "fs";
|
|
2291
|
+
|
|
2292
|
+
// src/commands/verify/findAssistReferences.ts
|
|
2293
|
+
function offendingEntries(list4) {
|
|
2294
|
+
if (!Array.isArray(list4)) return [];
|
|
2295
|
+
return list4.filter(
|
|
2296
|
+
(entry) => typeof entry === "string" && /\bassist\b/.test(entry)
|
|
2297
|
+
);
|
|
2298
|
+
}
|
|
2299
|
+
function findAssistReferences(settings) {
|
|
2300
|
+
const permissions = settings?.permissions ?? {};
|
|
2301
|
+
return [
|
|
2302
|
+
...offendingEntries(permissions.allow).map(
|
|
2303
|
+
(entry) => ({ list: "allow", entry })
|
|
2304
|
+
),
|
|
2305
|
+
...offendingEntries(permissions.deny).map(
|
|
2306
|
+
(entry) => ({ list: "deny", entry })
|
|
2307
|
+
)
|
|
2308
|
+
];
|
|
2309
|
+
}
|
|
2310
|
+
|
|
2311
|
+
// src/commands/verify/settingsGuard.ts
|
|
2312
|
+
var SETTINGS_PATH = "claude/settings.json";
|
|
2313
|
+
function settingsGuard() {
|
|
2314
|
+
if (!existsSync12(SETTINGS_PATH)) {
|
|
2315
|
+
console.log(`No ${SETTINGS_PATH}; nothing to guard.`);
|
|
2316
|
+
process.exit(0);
|
|
2317
|
+
}
|
|
2318
|
+
let settings;
|
|
2319
|
+
try {
|
|
2320
|
+
settings = JSON.parse(readFileSync9(SETTINGS_PATH, "utf8"));
|
|
2321
|
+
} catch (error) {
|
|
2322
|
+
console.log(
|
|
2323
|
+
`Could not parse ${SETTINGS_PATH}: ${error.message}`
|
|
2324
|
+
);
|
|
2325
|
+
process.exit(1);
|
|
2326
|
+
}
|
|
2327
|
+
const offenders = findAssistReferences(settings);
|
|
2328
|
+
if (offenders.length === 0) {
|
|
2329
|
+
console.log(`No assist references in ${SETTINGS_PATH} permissions.`);
|
|
2330
|
+
process.exit(0);
|
|
2331
|
+
}
|
|
2332
|
+
console.log(`assist references found in ${SETTINGS_PATH} permissions:
|
|
2333
|
+
`);
|
|
2334
|
+
for (const { list: list4, entry } of offenders) {
|
|
2335
|
+
console.log(` permissions.${list4}: ${entry}`);
|
|
2336
|
+
}
|
|
2337
|
+
console.log(
|
|
2338
|
+
`
|
|
2339
|
+
Total: ${offenders.length} entry(ies). Remove every assist reference from the permission lists.`
|
|
2340
|
+
);
|
|
2341
|
+
process.exit(1);
|
|
2342
|
+
}
|
|
2343
|
+
|
|
2282
2344
|
// src/commands/new/registerNew/initGit.ts
|
|
2283
2345
|
import { execSync as execSync11 } from "child_process";
|
|
2284
2346
|
import { writeFileSync as writeFileSync9 } from "fs";
|
|
@@ -2374,7 +2436,7 @@ async function newCli() {
|
|
|
2374
2436
|
|
|
2375
2437
|
// src/commands/new/registerNew/newProject.ts
|
|
2376
2438
|
import { execSync as execSync15 } from "child_process";
|
|
2377
|
-
import { existsSync as
|
|
2439
|
+
import { existsSync as existsSync14, readFileSync as readFileSync11, writeFileSync as writeFileSync12 } from "fs";
|
|
2378
2440
|
|
|
2379
2441
|
// src/commands/deploy/init/index.ts
|
|
2380
2442
|
import { execSync as execSync14 } from "child_process";
|
|
@@ -2382,33 +2444,33 @@ import chalk26 from "chalk";
|
|
|
2382
2444
|
import enquirer3 from "enquirer";
|
|
2383
2445
|
|
|
2384
2446
|
// src/commands/deploy/init/updateWorkflow.ts
|
|
2385
|
-
import { existsSync as
|
|
2447
|
+
import { existsSync as existsSync13, mkdirSync as mkdirSync3, readFileSync as readFileSync10, writeFileSync as writeFileSync11 } from "fs";
|
|
2386
2448
|
import { dirname as dirname11, join as join9 } from "path";
|
|
2387
2449
|
import { fileURLToPath } from "url";
|
|
2388
2450
|
import chalk25 from "chalk";
|
|
2389
2451
|
var WORKFLOW_PATH = ".github/workflows/build.yml";
|
|
2390
2452
|
var __dirname2 = dirname11(fileURLToPath(import.meta.url));
|
|
2391
2453
|
function getExistingSiteId() {
|
|
2392
|
-
if (!
|
|
2454
|
+
if (!existsSync13(WORKFLOW_PATH)) {
|
|
2393
2455
|
return null;
|
|
2394
2456
|
}
|
|
2395
|
-
const content =
|
|
2457
|
+
const content = readFileSync10(WORKFLOW_PATH, "utf8");
|
|
2396
2458
|
const match = content.match(/-s\s+([a-f0-9-]{36})/);
|
|
2397
2459
|
return match ? match[1] : null;
|
|
2398
2460
|
}
|
|
2399
2461
|
function getTemplateContent(siteId) {
|
|
2400
2462
|
const templatePath = join9(__dirname2, "commands/deploy/build.yml");
|
|
2401
|
-
const template =
|
|
2463
|
+
const template = readFileSync10(templatePath, "utf8");
|
|
2402
2464
|
return template.replace("{{NETLIFY_SITE_ID}}", siteId);
|
|
2403
2465
|
}
|
|
2404
2466
|
async function updateWorkflow(siteId) {
|
|
2405
2467
|
const newContent = getTemplateContent(siteId);
|
|
2406
2468
|
const workflowDir = ".github/workflows";
|
|
2407
|
-
if (!
|
|
2469
|
+
if (!existsSync13(workflowDir)) {
|
|
2408
2470
|
mkdirSync3(workflowDir, { recursive: true });
|
|
2409
2471
|
}
|
|
2410
|
-
if (
|
|
2411
|
-
const oldContent =
|
|
2472
|
+
if (existsSync13(WORKFLOW_PATH)) {
|
|
2473
|
+
const oldContent = readFileSync10(WORKFLOW_PATH, "utf8");
|
|
2412
2474
|
if (oldContent === newContent) {
|
|
2413
2475
|
console.log(chalk25.green("build.yml is already up to date"));
|
|
2414
2476
|
return;
|
|
@@ -2502,11 +2564,11 @@ async function newProject() {
|
|
|
2502
2564
|
}
|
|
2503
2565
|
function addViteBaseConfig() {
|
|
2504
2566
|
const viteConfigPath = "vite.config.ts";
|
|
2505
|
-
if (!
|
|
2567
|
+
if (!existsSync14(viteConfigPath)) {
|
|
2506
2568
|
console.log("No vite.config.ts found, skipping base config");
|
|
2507
2569
|
return;
|
|
2508
2570
|
}
|
|
2509
|
-
const content =
|
|
2571
|
+
const content = readFileSync11(viteConfigPath, "utf8");
|
|
2510
2572
|
if (content.includes("base:")) {
|
|
2511
2573
|
console.log("vite.config.ts already has base config");
|
|
2512
2574
|
return;
|
|
@@ -3143,11 +3205,38 @@ function expandTilde2(value) {
|
|
|
3143
3205
|
}
|
|
3144
3206
|
|
|
3145
3207
|
// src/commands/backup/scheduleBackup.ts
|
|
3146
|
-
import { execSync as execSync17 } from "child_process";
|
|
3147
3208
|
import { mkdir } from "fs/promises";
|
|
3148
3209
|
import { join as join10 } from "path";
|
|
3149
3210
|
import chalk28 from "chalk";
|
|
3150
3211
|
|
|
3212
|
+
// src/commands/backup/readCrontab.ts
|
|
3213
|
+
import { execSync as execSync17 } from "child_process";
|
|
3214
|
+
function readCrontab() {
|
|
3215
|
+
try {
|
|
3216
|
+
return execSync17("crontab -l", {
|
|
3217
|
+
encoding: "utf8",
|
|
3218
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
3219
|
+
});
|
|
3220
|
+
} catch {
|
|
3221
|
+
return "";
|
|
3222
|
+
}
|
|
3223
|
+
}
|
|
3224
|
+
function writeCrontab(content) {
|
|
3225
|
+
try {
|
|
3226
|
+
execSync17("crontab -", {
|
|
3227
|
+
input: content,
|
|
3228
|
+
stdio: ["pipe", "ignore", "pipe"]
|
|
3229
|
+
});
|
|
3230
|
+
} catch (error) {
|
|
3231
|
+
if (error.code === "ENOENT") {
|
|
3232
|
+
throw new Error(
|
|
3233
|
+
"crontab is not available on this system. Backup scheduling requires Linux cron."
|
|
3234
|
+
);
|
|
3235
|
+
}
|
|
3236
|
+
throw error;
|
|
3237
|
+
}
|
|
3238
|
+
}
|
|
3239
|
+
|
|
3151
3240
|
// src/commands/backup/durationToCron.ts
|
|
3152
3241
|
var MINUTES_PER_HOUR = 60;
|
|
3153
3242
|
var HOURS_PER_DAY = 24;
|
|
@@ -3219,6 +3308,14 @@ function upsertScheduleBlock(crontab, every, cronLine) {
|
|
|
3219
3308
|
return `${next3.join("\n")}
|
|
3220
3309
|
`;
|
|
3221
3310
|
}
|
|
3311
|
+
function removeScheduleBlock(crontab) {
|
|
3312
|
+
const lines = crontab.length === 0 ? [] : crontab.replace(/\n$/, "").split("\n");
|
|
3313
|
+
const range = findBlockRange(lines);
|
|
3314
|
+
if (range === void 0) return crontab;
|
|
3315
|
+
const next3 = [...lines.slice(0, range.start), ...lines.slice(range.end + 1)];
|
|
3316
|
+
return next3.length === 0 ? "" : `${next3.join("\n")}
|
|
3317
|
+
`;
|
|
3318
|
+
}
|
|
3222
3319
|
function readScheduleBlock(crontab) {
|
|
3223
3320
|
const lines = crontab.length === 0 ? [] : crontab.split("\n");
|
|
3224
3321
|
const range = findBlockRange(lines);
|
|
@@ -3235,31 +3332,6 @@ function readScheduleBlock(crontab) {
|
|
|
3235
3332
|
}
|
|
3236
3333
|
|
|
3237
3334
|
// 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
3335
|
function fail(message) {
|
|
3264
3336
|
console.error(chalk28.red(message));
|
|
3265
3337
|
process.exit(1);
|
|
@@ -3298,6 +3370,19 @@ function scheduleStatus() {
|
|
|
3298
3370
|
}
|
|
3299
3371
|
console.error(`assist backup runs every ${block.every} (${block.cron}).`);
|
|
3300
3372
|
}
|
|
3373
|
+
function scheduleRemove() {
|
|
3374
|
+
const current = readCrontab();
|
|
3375
|
+
if (!readScheduleBlock(current)) {
|
|
3376
|
+
console.error("No assist backup schedule is set; nothing to remove.");
|
|
3377
|
+
return;
|
|
3378
|
+
}
|
|
3379
|
+
try {
|
|
3380
|
+
writeCrontab(removeScheduleBlock(current));
|
|
3381
|
+
} catch (error) {
|
|
3382
|
+
fail(error.message);
|
|
3383
|
+
}
|
|
3384
|
+
console.error(chalk28.green("Removed the assist backup schedule."));
|
|
3385
|
+
}
|
|
3301
3386
|
|
|
3302
3387
|
// src/commands/backlog/export/index.ts
|
|
3303
3388
|
import { writeFile } from "fs/promises";
|
|
@@ -3401,6 +3486,9 @@ function registerBackup(program2) {
|
|
|
3401
3486
|
).action(backup);
|
|
3402
3487
|
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
3488
|
scheduleCommand.command("status").description("Show the active backup schedule, or report that none is set").action(scheduleStatus);
|
|
3489
|
+
scheduleCommand.command("remove").description(
|
|
3490
|
+
"Remove the marked backup schedule block, leaving other crontab lines intact"
|
|
3491
|
+
).action(scheduleRemove);
|
|
3404
3492
|
}
|
|
3405
3493
|
|
|
3406
3494
|
// src/commands/backlog/next.ts
|
|
@@ -3441,9 +3529,9 @@ function hasLocalChanges() {
|
|
|
3441
3529
|
|
|
3442
3530
|
// src/commands/backlog/acquireLock.ts
|
|
3443
3531
|
import {
|
|
3444
|
-
existsSync as
|
|
3532
|
+
existsSync as existsSync15,
|
|
3445
3533
|
mkdirSync as mkdirSync4,
|
|
3446
|
-
readFileSync as
|
|
3534
|
+
readFileSync as readFileSync12,
|
|
3447
3535
|
unlinkSync as unlinkSync2,
|
|
3448
3536
|
writeFileSync as writeFileSync13
|
|
3449
3537
|
} from "fs";
|
|
@@ -3465,9 +3553,9 @@ function isProcessAlive(pid) {
|
|
|
3465
3553
|
}
|
|
3466
3554
|
function isLockedByOther(itemId) {
|
|
3467
3555
|
const lockPath = getLockPath(itemId);
|
|
3468
|
-
if (!
|
|
3556
|
+
if (!existsSync15(lockPath)) return false;
|
|
3469
3557
|
try {
|
|
3470
|
-
const lock = JSON.parse(
|
|
3558
|
+
const lock = JSON.parse(readFileSync12(lockPath, "utf8"));
|
|
3471
3559
|
if (lock.pid === process.pid) return false;
|
|
3472
3560
|
return isProcessAlive(lock.pid);
|
|
3473
3561
|
} catch {
|
|
@@ -3658,19 +3746,19 @@ function buildArgs(prompt, options2) {
|
|
|
3658
3746
|
import chalk36 from "chalk";
|
|
3659
3747
|
|
|
3660
3748
|
// src/commands/backlog/migrateLocalBacklog.ts
|
|
3661
|
-
import { existsSync as
|
|
3749
|
+
import { existsSync as existsSync17 } from "fs";
|
|
3662
3750
|
import { join as join15 } from "path";
|
|
3663
3751
|
import chalk35 from "chalk";
|
|
3664
3752
|
|
|
3665
3753
|
// src/commands/backlog/backupLocalBacklogFiles.ts
|
|
3666
|
-
import { existsSync as
|
|
3754
|
+
import { existsSync as existsSync16, renameSync } from "fs";
|
|
3667
3755
|
import { join as join14 } from "path";
|
|
3668
3756
|
var LOCAL_FILES = ["backlog.jsonl", "backlog.db"];
|
|
3669
3757
|
function backupLocalBacklogFiles(dir) {
|
|
3670
3758
|
const moved = [];
|
|
3671
3759
|
for (const name of LOCAL_FILES) {
|
|
3672
3760
|
const path57 = join14(dir, ".assist", name);
|
|
3673
|
-
if (
|
|
3761
|
+
if (existsSync16(path57)) {
|
|
3674
3762
|
renameSync(path57, `${path57}.bak`);
|
|
3675
3763
|
moved.push(`${name} \u2192 ${name}.bak`);
|
|
3676
3764
|
}
|
|
@@ -3920,7 +4008,7 @@ async function loadAllItems(orm, origin) {
|
|
|
3920
4008
|
}
|
|
3921
4009
|
|
|
3922
4010
|
// src/commands/backlog/parseBacklogJsonl.ts
|
|
3923
|
-
import { readFileSync as
|
|
4011
|
+
import { readFileSync as readFileSync13 } from "fs";
|
|
3924
4012
|
|
|
3925
4013
|
// src/commands/backlog/types.ts
|
|
3926
4014
|
import { z as z3 } from "zod";
|
|
@@ -3965,7 +4053,7 @@ var backlogFileSchema = z3.array(backlogItemSchema);
|
|
|
3965
4053
|
|
|
3966
4054
|
// src/commands/backlog/parseBacklogJsonl.ts
|
|
3967
4055
|
function parseBacklogJsonl(path57) {
|
|
3968
|
-
const content =
|
|
4056
|
+
const content = readFileSync13(path57, "utf8").trim();
|
|
3969
4057
|
if (content.length === 0) return [];
|
|
3970
4058
|
return content.split("\n").map((line) => line.trim()).filter(Boolean).map((line) => backlogItemSchema.parse(JSON.parse(line)));
|
|
3971
4059
|
}
|
|
@@ -3988,7 +4076,7 @@ async function verifyImport(orm, origin, items2, imported) {
|
|
|
3988
4076
|
}
|
|
3989
4077
|
}
|
|
3990
4078
|
async function migrateLocalBacklog(orm, dir, origin) {
|
|
3991
|
-
if (!
|
|
4079
|
+
if (!existsSync17(jsonlPath(dir))) return;
|
|
3992
4080
|
const existing = (await loadAllItems(orm, origin)).length;
|
|
3993
4081
|
if (existing > 0) {
|
|
3994
4082
|
const moved2 = backupLocalBacklogFiles(dir);
|
|
@@ -4027,7 +4115,7 @@ async function deleteItem(orm, id2) {
|
|
|
4027
4115
|
}
|
|
4028
4116
|
|
|
4029
4117
|
// src/commands/backlog/findBacklogUp.ts
|
|
4030
|
-
import { existsSync as
|
|
4118
|
+
import { existsSync as existsSync18 } from "fs";
|
|
4031
4119
|
import { dirname as dirname13, join as join16 } from "path";
|
|
4032
4120
|
var BACKLOG_MARKERS = [
|
|
4033
4121
|
join16(".assist", "backlog.db"),
|
|
@@ -4037,7 +4125,7 @@ var BACKLOG_MARKERS = [
|
|
|
4037
4125
|
function findBacklogUp(startDir) {
|
|
4038
4126
|
let current = startDir;
|
|
4039
4127
|
while (current !== dirname13(current)) {
|
|
4040
|
-
if (BACKLOG_MARKERS.some((marker) =>
|
|
4128
|
+
if (BACKLOG_MARKERS.some((marker) => existsSync18(join16(current, marker)))) {
|
|
4041
4129
|
return current;
|
|
4042
4130
|
}
|
|
4043
4131
|
current = dirname13(current);
|
|
@@ -4258,7 +4346,7 @@ async function prepareRun(id2) {
|
|
|
4258
4346
|
}
|
|
4259
4347
|
|
|
4260
4348
|
// src/commands/backlog/consumePause.ts
|
|
4261
|
-
import { existsSync as
|
|
4349
|
+
import { existsSync as existsSync19, mkdirSync as mkdirSync6, unlinkSync as unlinkSync3, writeFileSync as writeFileSync15 } from "fs";
|
|
4262
4350
|
import { homedir as homedir6 } from "os";
|
|
4263
4351
|
import { join as join17 } from "path";
|
|
4264
4352
|
function getControlsDir() {
|
|
@@ -4282,7 +4370,7 @@ function clearPause(itemId) {
|
|
|
4282
4370
|
}
|
|
4283
4371
|
function consumePause(itemId) {
|
|
4284
4372
|
const pausePath = getPausePath(itemId);
|
|
4285
|
-
if (!
|
|
4373
|
+
if (!existsSync19(pausePath)) return false;
|
|
4286
4374
|
try {
|
|
4287
4375
|
unlinkSync3(pausePath);
|
|
4288
4376
|
} catch {
|
|
@@ -4311,7 +4399,7 @@ Failed to launch Claude for ${context}: ${message}`)
|
|
|
4311
4399
|
}
|
|
4312
4400
|
|
|
4313
4401
|
// src/shared/emitActivity.ts
|
|
4314
|
-
import { mkdirSync as mkdirSync7, readFileSync as
|
|
4402
|
+
import { mkdirSync as mkdirSync7, readFileSync as readFileSync14, rmSync as rmSync2, writeFileSync as writeFileSync16 } from "fs";
|
|
4315
4403
|
import { homedir as homedir7 } from "os";
|
|
4316
4404
|
import { dirname as dirname14, join as join18 } from "path";
|
|
4317
4405
|
import { z as z4 } from "zod";
|
|
@@ -4337,7 +4425,7 @@ function emitActivity(activity2) {
|
|
|
4337
4425
|
}
|
|
4338
4426
|
function readActivity(path57) {
|
|
4339
4427
|
try {
|
|
4340
|
-
return JSON.parse(
|
|
4428
|
+
return JSON.parse(readFileSync14(path57, "utf8"));
|
|
4341
4429
|
} catch {
|
|
4342
4430
|
return void 0;
|
|
4343
4431
|
}
|
|
@@ -4468,7 +4556,7 @@ function buildResumePrompt() {
|
|
|
4468
4556
|
}
|
|
4469
4557
|
|
|
4470
4558
|
// src/commands/backlog/resolvePhaseResult.ts
|
|
4471
|
-
import { existsSync as
|
|
4559
|
+
import { existsSync as existsSync21, unlinkSync as unlinkSync4 } from "fs";
|
|
4472
4560
|
import chalk39 from "chalk";
|
|
4473
4561
|
|
|
4474
4562
|
// src/commands/backlog/handleIncompletePhase.ts
|
|
@@ -4488,7 +4576,7 @@ async function handleIncompletePhase() {
|
|
|
4488
4576
|
}
|
|
4489
4577
|
|
|
4490
4578
|
// src/commands/backlog/readSignal.ts
|
|
4491
|
-
import { existsSync as
|
|
4579
|
+
import { existsSync as existsSync20, readFileSync as readFileSync15 } from "fs";
|
|
4492
4580
|
|
|
4493
4581
|
// src/commands/backlog/writeSignal.ts
|
|
4494
4582
|
import { writeFileSync as writeFileSync17 } from "fs";
|
|
@@ -4507,9 +4595,9 @@ function writeSignal(event, data) {
|
|
|
4507
4595
|
// src/commands/backlog/readSignal.ts
|
|
4508
4596
|
function readSignal() {
|
|
4509
4597
|
const path57 = getSignalPath();
|
|
4510
|
-
if (!
|
|
4598
|
+
if (!existsSync20(path57)) return void 0;
|
|
4511
4599
|
try {
|
|
4512
|
-
return JSON.parse(
|
|
4600
|
+
return JSON.parse(readFileSync15(path57, "utf8"));
|
|
4513
4601
|
} catch {
|
|
4514
4602
|
return void 0;
|
|
4515
4603
|
}
|
|
@@ -4518,7 +4606,7 @@ function readSignal() {
|
|
|
4518
4606
|
// src/commands/backlog/resolvePhaseResult.ts
|
|
4519
4607
|
function cleanupSignal() {
|
|
4520
4608
|
const statusPath = getSignalPath();
|
|
4521
|
-
if (
|
|
4609
|
+
if (existsSync21(statusPath)) {
|
|
4522
4610
|
unlinkSync4(statusPath);
|
|
4523
4611
|
}
|
|
4524
4612
|
}
|
|
@@ -4528,7 +4616,7 @@ async function isTerminalStatus(itemId) {
|
|
|
4528
4616
|
return item?.status === "done" || item?.status === "wontdo";
|
|
4529
4617
|
}
|
|
4530
4618
|
async function resolvePhaseResult(phaseIndex, itemId) {
|
|
4531
|
-
if (!
|
|
4619
|
+
if (!existsSync21(getSignalPath())) {
|
|
4532
4620
|
if (await isTerminalStatus(itemId)) return -1;
|
|
4533
4621
|
const action = await handleIncompletePhase();
|
|
4534
4622
|
if (action === "abort") return -1;
|
|
@@ -4550,11 +4638,11 @@ Phase ${phaseNumber} completed.`));
|
|
|
4550
4638
|
}
|
|
4551
4639
|
|
|
4552
4640
|
// src/commands/backlog/watchForMarker.ts
|
|
4553
|
-
import { existsSync as
|
|
4641
|
+
import { existsSync as existsSync22, unwatchFile, watchFile } from "fs";
|
|
4554
4642
|
function watchForMarker(child, options2) {
|
|
4555
4643
|
const statusPath = getSignalPath();
|
|
4556
4644
|
watchFile(statusPath, { interval: 1e3 }, () => {
|
|
4557
|
-
if (!
|
|
4645
|
+
if (!existsSync22(statusPath)) return;
|
|
4558
4646
|
const signal = readSignal();
|
|
4559
4647
|
if (!signal) return;
|
|
4560
4648
|
if (signal.event === "done" && !options2?.actOnDone) return;
|
|
@@ -5212,12 +5300,12 @@ function delay(ms) {
|
|
|
5212
5300
|
|
|
5213
5301
|
// src/commands/sessions/web/handleRequest.ts
|
|
5214
5302
|
import { createHash as createHash2 } from "crypto";
|
|
5215
|
-
import { readFileSync as
|
|
5303
|
+
import { readFileSync as readFileSync17 } from "fs";
|
|
5216
5304
|
import { createRequire as createRequire2 } from "module";
|
|
5217
5305
|
|
|
5218
5306
|
// src/shared/createBundleHandler.ts
|
|
5219
5307
|
import { createHash } from "crypto";
|
|
5220
|
-
import { readFileSync as
|
|
5308
|
+
import { readFileSync as readFileSync16 } from "fs";
|
|
5221
5309
|
import { dirname as dirname16, join as join20 } from "path";
|
|
5222
5310
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
5223
5311
|
function createBundleHandler(importMetaUrl, bundlePath) {
|
|
@@ -5225,7 +5313,7 @@ function createBundleHandler(importMetaUrl, bundlePath) {
|
|
|
5225
5313
|
let cache;
|
|
5226
5314
|
return (req, res) => {
|
|
5227
5315
|
if (!cache) {
|
|
5228
|
-
const body =
|
|
5316
|
+
const body = readFileSync16(join20(dir, bundlePath), "utf8");
|
|
5229
5317
|
const etag = `"${createHash("sha256").update(body).digest("hex").slice(0, 16)}"`;
|
|
5230
5318
|
cache = { body, etag };
|
|
5231
5319
|
}
|
|
@@ -5972,7 +6060,7 @@ function createCssHandler(packageEntry) {
|
|
|
5972
6060
|
return (req, res) => {
|
|
5973
6061
|
if (!cache) {
|
|
5974
6062
|
const resolved = require3.resolve(packageEntry);
|
|
5975
|
-
const body =
|
|
6063
|
+
const body = readFileSync17(resolved, "utf8");
|
|
5976
6064
|
const etag = `"${createHash2("sha256").update(body).digest("hex").slice(0, 16)}"`;
|
|
5977
6065
|
cache = { body, etag };
|
|
5978
6066
|
}
|
|
@@ -6682,7 +6770,7 @@ import chalk59 from "chalk";
|
|
|
6682
6770
|
|
|
6683
6771
|
// src/commands/backlog/add/shared.ts
|
|
6684
6772
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
6685
|
-
import { mkdtempSync, readFileSync as
|
|
6773
|
+
import { mkdtempSync, readFileSync as readFileSync18, unlinkSync as unlinkSync6, writeFileSync as writeFileSync18 } from "fs";
|
|
6686
6774
|
import { tmpdir } from "os";
|
|
6687
6775
|
import { join as join21 } from "path";
|
|
6688
6776
|
import enquirer6 from "enquirer";
|
|
@@ -6732,7 +6820,7 @@ function openEditor() {
|
|
|
6732
6820
|
unlinkSync6(filePath);
|
|
6733
6821
|
return void 0;
|
|
6734
6822
|
}
|
|
6735
|
-
const content =
|
|
6823
|
+
const content = readFileSync18(filePath, "utf8").trim();
|
|
6736
6824
|
unlinkSync6(filePath);
|
|
6737
6825
|
return content || void 0;
|
|
6738
6826
|
}
|
|
@@ -8203,7 +8291,7 @@ function extractGraphqlQuery(args) {
|
|
|
8203
8291
|
}
|
|
8204
8292
|
|
|
8205
8293
|
// src/shared/loadCliReads.ts
|
|
8206
|
-
import { existsSync as
|
|
8294
|
+
import { existsSync as existsSync23, readFileSync as readFileSync19, writeFileSync as writeFileSync19 } from "fs";
|
|
8207
8295
|
import { dirname as dirname17, resolve as resolve8 } from "path";
|
|
8208
8296
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
8209
8297
|
var __filename3 = fileURLToPath4(import.meta.url);
|
|
@@ -8212,8 +8300,8 @@ function packageRoot() {
|
|
|
8212
8300
|
return __dirname4;
|
|
8213
8301
|
}
|
|
8214
8302
|
function readLines(path57) {
|
|
8215
|
-
if (!
|
|
8216
|
-
return
|
|
8303
|
+
if (!existsSync23(path57)) return [];
|
|
8304
|
+
return readFileSync19(path57, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
8217
8305
|
}
|
|
8218
8306
|
var cachedReads;
|
|
8219
8307
|
var cachedWrites;
|
|
@@ -8259,7 +8347,7 @@ function findCliWrite(command) {
|
|
|
8259
8347
|
}
|
|
8260
8348
|
|
|
8261
8349
|
// src/shared/readSettingsPerms.ts
|
|
8262
|
-
import { existsSync as
|
|
8350
|
+
import { existsSync as existsSync24, readFileSync as readFileSync20 } from "fs";
|
|
8263
8351
|
import { homedir as homedir9 } from "os";
|
|
8264
8352
|
import { join as join23 } from "path";
|
|
8265
8353
|
function readSettingsPerms(key) {
|
|
@@ -8275,9 +8363,9 @@ function readSettingsPerms(key) {
|
|
|
8275
8363
|
return entries;
|
|
8276
8364
|
}
|
|
8277
8365
|
function readPermissionArray(filePath, key) {
|
|
8278
|
-
if (!
|
|
8366
|
+
if (!existsSync24(filePath)) return [];
|
|
8279
8367
|
try {
|
|
8280
|
-
const data = JSON.parse(
|
|
8368
|
+
const data = JSON.parse(readFileSync20(filePath, "utf8"));
|
|
8281
8369
|
const arr = data?.permissions?.[key];
|
|
8282
8370
|
return Array.isArray(arr) ? arr.filter((e) => typeof e === "string") : [];
|
|
8283
8371
|
} catch {
|
|
@@ -8539,7 +8627,7 @@ ${reasons.join("\n")}`);
|
|
|
8539
8627
|
}
|
|
8540
8628
|
|
|
8541
8629
|
// src/commands/permitCliReads/index.ts
|
|
8542
|
-
import { existsSync as
|
|
8630
|
+
import { existsSync as existsSync25, mkdirSync as mkdirSync10, readFileSync as readFileSync21, writeFileSync as writeFileSync20 } from "fs";
|
|
8543
8631
|
import { homedir as homedir10 } from "os";
|
|
8544
8632
|
import { join as join24 } from "path";
|
|
8545
8633
|
|
|
@@ -8834,8 +8922,8 @@ function logPath(cli) {
|
|
|
8834
8922
|
}
|
|
8835
8923
|
function readCache(cli) {
|
|
8836
8924
|
const path57 = logPath(cli);
|
|
8837
|
-
if (!
|
|
8838
|
-
return
|
|
8925
|
+
if (!existsSync25(path57)) return void 0;
|
|
8926
|
+
return readFileSync21(path57, "utf8");
|
|
8839
8927
|
}
|
|
8840
8928
|
function writeCache(cli, output) {
|
|
8841
8929
|
const dir = join24(homedir10(), ".assist");
|
|
@@ -9647,7 +9735,7 @@ function registerConfig(program2) {
|
|
|
9647
9735
|
}
|
|
9648
9736
|
|
|
9649
9737
|
// src/commands/deploy/redirect.ts
|
|
9650
|
-
import { existsSync as
|
|
9738
|
+
import { existsSync as existsSync26, readFileSync as readFileSync22, writeFileSync as writeFileSync21 } from "fs";
|
|
9651
9739
|
import chalk99 from "chalk";
|
|
9652
9740
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
9653
9741
|
if (!window.location.pathname.endsWith('/')) {
|
|
@@ -9656,11 +9744,11 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
9656
9744
|
</script>`;
|
|
9657
9745
|
function redirect() {
|
|
9658
9746
|
const indexPath = "index.html";
|
|
9659
|
-
if (!
|
|
9747
|
+
if (!existsSync26(indexPath)) {
|
|
9660
9748
|
console.log(chalk99.yellow("No index.html found"));
|
|
9661
9749
|
return;
|
|
9662
9750
|
}
|
|
9663
|
-
const content =
|
|
9751
|
+
const content = readFileSync22(indexPath, "utf8");
|
|
9664
9752
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
9665
9753
|
console.log(chalk99.dim("Trailing slash script already present"));
|
|
9666
9754
|
return;
|
|
@@ -9703,7 +9791,7 @@ import { execSync as execSync24 } from "child_process";
|
|
|
9703
9791
|
import chalk100 from "chalk";
|
|
9704
9792
|
|
|
9705
9793
|
// src/shared/getRepoName.ts
|
|
9706
|
-
import { existsSync as
|
|
9794
|
+
import { existsSync as existsSync27, readFileSync as readFileSync23 } from "fs";
|
|
9707
9795
|
import { basename as basename3, join as join26 } from "path";
|
|
9708
9796
|
function getRepoName() {
|
|
9709
9797
|
const config = loadConfig();
|
|
@@ -9711,9 +9799,9 @@ function getRepoName() {
|
|
|
9711
9799
|
return config.devlog.name;
|
|
9712
9800
|
}
|
|
9713
9801
|
const packageJsonPath = join26(process.cwd(), "package.json");
|
|
9714
|
-
if (
|
|
9802
|
+
if (existsSync27(packageJsonPath)) {
|
|
9715
9803
|
try {
|
|
9716
|
-
const content =
|
|
9804
|
+
const content = readFileSync23(packageJsonPath, "utf8");
|
|
9717
9805
|
const pkg = JSON.parse(content);
|
|
9718
9806
|
if (pkg.name) {
|
|
9719
9807
|
return pkg.name;
|
|
@@ -9725,7 +9813,7 @@ function getRepoName() {
|
|
|
9725
9813
|
}
|
|
9726
9814
|
|
|
9727
9815
|
// src/commands/devlog/loadDevlogEntries.ts
|
|
9728
|
-
import { readdirSync, readFileSync as
|
|
9816
|
+
import { readdirSync, readFileSync as readFileSync24 } from "fs";
|
|
9729
9817
|
import { join as join27 } from "path";
|
|
9730
9818
|
var DEVLOG_DIR = join27(BLOG_REPO_ROOT, "src/content/devlog");
|
|
9731
9819
|
function extractFrontmatter(content) {
|
|
@@ -9755,7 +9843,7 @@ function readDevlogFiles(callback) {
|
|
|
9755
9843
|
try {
|
|
9756
9844
|
const files = readdirSync(DEVLOG_DIR).filter((f) => f.endsWith(".md"));
|
|
9757
9845
|
for (const file of files) {
|
|
9758
|
-
const content =
|
|
9846
|
+
const content = readFileSync24(join27(DEVLOG_DIR, file), "utf8");
|
|
9759
9847
|
const parsed = parseFrontmatter(content, file);
|
|
9760
9848
|
if (parsed) callback(parsed);
|
|
9761
9849
|
}
|
|
@@ -10212,12 +10300,12 @@ import { join as join29 } from "path";
|
|
|
10212
10300
|
import chalk107 from "chalk";
|
|
10213
10301
|
|
|
10214
10302
|
// src/shared/findRepoRoot.ts
|
|
10215
|
-
import { existsSync as
|
|
10303
|
+
import { existsSync as existsSync28 } from "fs";
|
|
10216
10304
|
import path22 from "path";
|
|
10217
10305
|
function findRepoRoot(dir) {
|
|
10218
10306
|
let current = dir;
|
|
10219
10307
|
while (current !== path22.dirname(current)) {
|
|
10220
|
-
if (
|
|
10308
|
+
if (existsSync28(path22.join(current, ".git"))) {
|
|
10221
10309
|
return current;
|
|
10222
10310
|
}
|
|
10223
10311
|
current = path22.dirname(current);
|
|
@@ -10283,11 +10371,11 @@ async function checkBuildLocksCommand() {
|
|
|
10283
10371
|
}
|
|
10284
10372
|
|
|
10285
10373
|
// src/commands/dotnet/buildTree.ts
|
|
10286
|
-
import { readFileSync as
|
|
10374
|
+
import { readFileSync as readFileSync25 } from "fs";
|
|
10287
10375
|
import path23 from "path";
|
|
10288
10376
|
var PROJECT_REF_RE = /<ProjectReference\s+Include="([^"]+)"/g;
|
|
10289
10377
|
function getProjectRefs(csprojPath) {
|
|
10290
|
-
const content =
|
|
10378
|
+
const content = readFileSync25(csprojPath, "utf8");
|
|
10291
10379
|
const refs = [];
|
|
10292
10380
|
for (const match of content.matchAll(PROJECT_REF_RE)) {
|
|
10293
10381
|
refs.push(match[1].replace(/\\/g, "/"));
|
|
@@ -10304,7 +10392,7 @@ function buildTree(csprojPath, repoRoot, visited = /* @__PURE__ */ new Set()) {
|
|
|
10304
10392
|
for (const ref of getProjectRefs(abs)) {
|
|
10305
10393
|
const childAbs = path23.resolve(dir, ref);
|
|
10306
10394
|
try {
|
|
10307
|
-
|
|
10395
|
+
readFileSync25(childAbs);
|
|
10308
10396
|
node.children.push(buildTree(childAbs, repoRoot, visited));
|
|
10309
10397
|
} catch {
|
|
10310
10398
|
node.children.push({
|
|
@@ -10329,7 +10417,7 @@ function collectAllDeps(node) {
|
|
|
10329
10417
|
}
|
|
10330
10418
|
|
|
10331
10419
|
// src/commands/dotnet/findContainingSolutions.ts
|
|
10332
|
-
import { readdirSync as readdirSync3, readFileSync as
|
|
10420
|
+
import { readdirSync as readdirSync3, readFileSync as readFileSync26, statSync as statSync2 } from "fs";
|
|
10333
10421
|
import path24 from "path";
|
|
10334
10422
|
function findSlnFiles(dir, maxDepth, depth = 0) {
|
|
10335
10423
|
if (depth > maxDepth) return [];
|
|
@@ -10364,7 +10452,7 @@ function findContainingSolutions(csprojPath, repoRoot) {
|
|
|
10364
10452
|
const pattern2 = new RegExp(`[\\\\"/]${escapeRegex(csprojBasename)}"`);
|
|
10365
10453
|
for (const sln of slnFiles) {
|
|
10366
10454
|
try {
|
|
10367
|
-
const content =
|
|
10455
|
+
const content = readFileSync26(sln, "utf8");
|
|
10368
10456
|
if (pattern2.test(content)) {
|
|
10369
10457
|
matches.push(path24.relative(repoRoot, sln));
|
|
10370
10458
|
}
|
|
@@ -10428,12 +10516,12 @@ function printJson(tree, totalCount, solutions) {
|
|
|
10428
10516
|
}
|
|
10429
10517
|
|
|
10430
10518
|
// src/commands/dotnet/resolveCsproj.ts
|
|
10431
|
-
import { existsSync as
|
|
10519
|
+
import { existsSync as existsSync29 } from "fs";
|
|
10432
10520
|
import path25 from "path";
|
|
10433
10521
|
import chalk109 from "chalk";
|
|
10434
10522
|
function resolveCsproj(csprojPath) {
|
|
10435
10523
|
const resolved = path25.resolve(csprojPath);
|
|
10436
|
-
if (!
|
|
10524
|
+
if (!existsSync29(resolved)) {
|
|
10437
10525
|
console.error(chalk109.red(`File not found: ${resolved}`));
|
|
10438
10526
|
process.exit(1);
|
|
10439
10527
|
}
|
|
@@ -10601,7 +10689,7 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
10601
10689
|
}
|
|
10602
10690
|
|
|
10603
10691
|
// src/commands/dotnet/resolveSolution.ts
|
|
10604
|
-
import { existsSync as
|
|
10692
|
+
import { existsSync as existsSync30 } from "fs";
|
|
10605
10693
|
import path26 from "path";
|
|
10606
10694
|
import chalk113 from "chalk";
|
|
10607
10695
|
|
|
@@ -10642,7 +10730,7 @@ function findSolution() {
|
|
|
10642
10730
|
function resolveSolution(sln) {
|
|
10643
10731
|
if (sln) {
|
|
10644
10732
|
const resolved = path26.resolve(sln);
|
|
10645
|
-
if (!
|
|
10733
|
+
if (!existsSync30(resolved)) {
|
|
10646
10734
|
console.error(chalk113.red(`Solution file not found: ${resolved}`));
|
|
10647
10735
|
process.exit(1);
|
|
10648
10736
|
}
|
|
@@ -10682,7 +10770,7 @@ function parseInspectReport(json) {
|
|
|
10682
10770
|
|
|
10683
10771
|
// src/commands/dotnet/runInspectCode.ts
|
|
10684
10772
|
import { execSync as execSync28 } from "child_process";
|
|
10685
|
-
import { existsSync as
|
|
10773
|
+
import { existsSync as existsSync31, readFileSync as readFileSync27, unlinkSync as unlinkSync7 } from "fs";
|
|
10686
10774
|
import { tmpdir as tmpdir3 } from "os";
|
|
10687
10775
|
import path27 from "path";
|
|
10688
10776
|
import chalk114 from "chalk";
|
|
@@ -10713,11 +10801,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
10713
10801
|
console.error(chalk114.red("jb inspectcode failed"));
|
|
10714
10802
|
process.exit(1);
|
|
10715
10803
|
}
|
|
10716
|
-
if (!
|
|
10804
|
+
if (!existsSync31(reportPath)) {
|
|
10717
10805
|
console.error(chalk114.red("Report file not generated"));
|
|
10718
10806
|
process.exit(1);
|
|
10719
10807
|
}
|
|
10720
|
-
const xml =
|
|
10808
|
+
const xml = readFileSync27(reportPath, "utf8");
|
|
10721
10809
|
unlinkSync7(reportPath);
|
|
10722
10810
|
return xml;
|
|
10723
10811
|
}
|
|
@@ -11058,9 +11146,9 @@ async function countPendingHandovers(orm, origin) {
|
|
|
11058
11146
|
|
|
11059
11147
|
// src/commands/handover/migrateDiskHandovers.ts
|
|
11060
11148
|
import {
|
|
11061
|
-
existsSync as
|
|
11149
|
+
existsSync as existsSync32,
|
|
11062
11150
|
readdirSync as readdirSync5,
|
|
11063
|
-
readFileSync as
|
|
11151
|
+
readFileSync as readFileSync28,
|
|
11064
11152
|
rmSync as rmSync3,
|
|
11065
11153
|
statSync as statSync3
|
|
11066
11154
|
} from "fs";
|
|
@@ -11113,7 +11201,7 @@ function summariseHandoverContent(content) {
|
|
|
11113
11201
|
|
|
11114
11202
|
// src/commands/handover/migrateDiskHandovers.ts
|
|
11115
11203
|
function collectMarkdown(dir) {
|
|
11116
|
-
if (!
|
|
11204
|
+
if (!existsSync32(dir)) return [];
|
|
11117
11205
|
const out = [];
|
|
11118
11206
|
for (const entry of readdirSync5(dir, { withFileTypes: true })) {
|
|
11119
11207
|
const full = join34(dir, entry.name);
|
|
@@ -11123,7 +11211,7 @@ function collectMarkdown(dir) {
|
|
|
11123
11211
|
return out;
|
|
11124
11212
|
}
|
|
11125
11213
|
async function migrateFile(orm, origin, file, createdAt) {
|
|
11126
|
-
const content =
|
|
11214
|
+
const content = readFileSync28(file, "utf8");
|
|
11127
11215
|
await saveHandover(orm, {
|
|
11128
11216
|
origin,
|
|
11129
11217
|
summary: summariseHandoverContent(content),
|
|
@@ -11140,7 +11228,7 @@ async function migrateDiskHandovers(orm, origin, cwd = process.cwd()) {
|
|
|
11140
11228
|
migrated++;
|
|
11141
11229
|
}
|
|
11142
11230
|
const handoverPath = getHandoverPath(cwd);
|
|
11143
|
-
if (
|
|
11231
|
+
if (existsSync32(handoverPath)) {
|
|
11144
11232
|
await migrateFile(orm, origin, handoverPath, statSync3(handoverPath).mtime);
|
|
11145
11233
|
migrated++;
|
|
11146
11234
|
}
|
|
@@ -11385,7 +11473,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
11385
11473
|
import { execSync as execSync31 } from "child_process";
|
|
11386
11474
|
|
|
11387
11475
|
// src/shared/loadJson.ts
|
|
11388
|
-
import { existsSync as
|
|
11476
|
+
import { existsSync as existsSync33, mkdirSync as mkdirSync11, readFileSync as readFileSync29, writeFileSync as writeFileSync24 } from "fs";
|
|
11389
11477
|
import { homedir as homedir12 } from "os";
|
|
11390
11478
|
import { join as join35 } from "path";
|
|
11391
11479
|
function getStoreDir() {
|
|
@@ -11396,9 +11484,9 @@ function getStorePath(filename) {
|
|
|
11396
11484
|
}
|
|
11397
11485
|
function loadJson(filename) {
|
|
11398
11486
|
const path57 = getStorePath(filename);
|
|
11399
|
-
if (
|
|
11487
|
+
if (existsSync33(path57)) {
|
|
11400
11488
|
try {
|
|
11401
|
-
return JSON.parse(
|
|
11489
|
+
return JSON.parse(readFileSync29(path57, "utf8"));
|
|
11402
11490
|
} catch {
|
|
11403
11491
|
return {};
|
|
11404
11492
|
}
|
|
@@ -11407,7 +11495,7 @@ function loadJson(filename) {
|
|
|
11407
11495
|
}
|
|
11408
11496
|
function saveJson(filename, data) {
|
|
11409
11497
|
const dir = getStoreDir();
|
|
11410
|
-
if (!
|
|
11498
|
+
if (!existsSync33(dir)) {
|
|
11411
11499
|
mkdirSync11(dir, { recursive: true });
|
|
11412
11500
|
}
|
|
11413
11501
|
writeFileSync24(getStorePath(filename), JSON.stringify(data, null, 2));
|
|
@@ -11554,7 +11642,7 @@ import { resolve as resolve11 } from "path";
|
|
|
11554
11642
|
import chalk125 from "chalk";
|
|
11555
11643
|
|
|
11556
11644
|
// src/commands/mermaid/exportFile.ts
|
|
11557
|
-
import { readFileSync as
|
|
11645
|
+
import { readFileSync as readFileSync30, writeFileSync as writeFileSync25 } from "fs";
|
|
11558
11646
|
import { basename as basename6, extname, resolve as resolve10 } from "path";
|
|
11559
11647
|
import chalk124 from "chalk";
|
|
11560
11648
|
|
|
@@ -11580,7 +11668,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
11580
11668
|
|
|
11581
11669
|
// src/commands/mermaid/exportFile.ts
|
|
11582
11670
|
async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
11583
|
-
const content =
|
|
11671
|
+
const content = readFileSync30(file, "utf8");
|
|
11584
11672
|
const blocks = extractMermaidBlocks(content);
|
|
11585
11673
|
const stem = basename6(file, extname(file));
|
|
11586
11674
|
if (onlyIndex !== void 0) {
|
|
@@ -11864,7 +11952,7 @@ import { join as join40 } from "path";
|
|
|
11864
11952
|
import chalk128 from "chalk";
|
|
11865
11953
|
|
|
11866
11954
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
11867
|
-
import { readFileSync as
|
|
11955
|
+
import { readFileSync as readFileSync31 } from "fs";
|
|
11868
11956
|
|
|
11869
11957
|
// src/commands/netcap/parseRscRows.ts
|
|
11870
11958
|
var isRscRef = (v) => typeof v === "string" && /^\$[0-9a-fL@]/.test(v);
|
|
@@ -12260,7 +12348,7 @@ function extractVoyagerPosts(body) {
|
|
|
12260
12348
|
|
|
12261
12349
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
12262
12350
|
function captureEntries(captureFile) {
|
|
12263
|
-
const lines =
|
|
12351
|
+
const lines = readFileSync31(captureFile, "utf8").split("\n").filter(Boolean);
|
|
12264
12352
|
const entries = [];
|
|
12265
12353
|
for (const line of lines) {
|
|
12266
12354
|
let entry;
|
|
@@ -12744,7 +12832,7 @@ import { tmpdir as tmpdir5 } from "os";
|
|
|
12744
12832
|
import { join as join42 } from "path";
|
|
12745
12833
|
|
|
12746
12834
|
// src/commands/prs/loadCommentsCache.ts
|
|
12747
|
-
import { existsSync as
|
|
12835
|
+
import { existsSync as existsSync34, readFileSync as readFileSync32, unlinkSync as unlinkSync9 } from "fs";
|
|
12748
12836
|
import { join as join41 } from "path";
|
|
12749
12837
|
import { parse as parse2 } from "yaml";
|
|
12750
12838
|
function getCachePath(prNumber) {
|
|
@@ -12752,15 +12840,15 @@ function getCachePath(prNumber) {
|
|
|
12752
12840
|
}
|
|
12753
12841
|
function loadCommentsCache(prNumber) {
|
|
12754
12842
|
const cachePath = getCachePath(prNumber);
|
|
12755
|
-
if (!
|
|
12843
|
+
if (!existsSync34(cachePath)) {
|
|
12756
12844
|
return null;
|
|
12757
12845
|
}
|
|
12758
|
-
const content =
|
|
12846
|
+
const content = readFileSync32(cachePath, "utf8");
|
|
12759
12847
|
return parse2(content);
|
|
12760
12848
|
}
|
|
12761
12849
|
function deleteCommentsCache(prNumber) {
|
|
12762
12850
|
const cachePath = getCachePath(prNumber);
|
|
12763
|
-
if (
|
|
12851
|
+
if (existsSync34(cachePath)) {
|
|
12764
12852
|
unlinkSync9(cachePath);
|
|
12765
12853
|
console.log("No more unresolved line comments. Cache dropped.");
|
|
12766
12854
|
}
|
|
@@ -12860,7 +12948,7 @@ function fixed(commentId, sha) {
|
|
|
12860
12948
|
}
|
|
12861
12949
|
|
|
12862
12950
|
// src/commands/prs/listComments/index.ts
|
|
12863
|
-
import { existsSync as
|
|
12951
|
+
import { existsSync as existsSync35, mkdirSync as mkdirSync13, writeFileSync as writeFileSync29 } from "fs";
|
|
12864
12952
|
import { join as join44 } from "path";
|
|
12865
12953
|
import { stringify } from "yaml";
|
|
12866
12954
|
|
|
@@ -12986,7 +13074,7 @@ function printComments2(result) {
|
|
|
12986
13074
|
// src/commands/prs/listComments/index.ts
|
|
12987
13075
|
function writeCommentsCache(prNumber, comments3) {
|
|
12988
13076
|
const assistDir = join44(process.cwd(), ".assist");
|
|
12989
|
-
if (!
|
|
13077
|
+
if (!existsSync35(assistDir)) {
|
|
12990
13078
|
mkdirSync13(assistDir, { recursive: true });
|
|
12991
13079
|
}
|
|
12992
13080
|
const cacheData = {
|
|
@@ -15690,7 +15778,7 @@ function gatherContext() {
|
|
|
15690
15778
|
}
|
|
15691
15779
|
|
|
15692
15780
|
// src/commands/review/postReviewToPr.ts
|
|
15693
|
-
import { readFileSync as
|
|
15781
|
+
import { readFileSync as readFileSync33 } from "fs";
|
|
15694
15782
|
|
|
15695
15783
|
// src/commands/review/parseFindings.ts
|
|
15696
15784
|
var SEVERITIES = ["blocker", "major", "minor", "nit"];
|
|
@@ -16000,7 +16088,7 @@ async function confirmPost(prNumber, count6, options2) {
|
|
|
16000
16088
|
async function postReviewToPr(synthesisPath, options2) {
|
|
16001
16089
|
const prInfo = fetchPrDiffInfo();
|
|
16002
16090
|
const prNumber = prInfo.prNumber;
|
|
16003
|
-
const markdown =
|
|
16091
|
+
const markdown = readFileSync33(synthesisPath, "utf8");
|
|
16004
16092
|
const findings = parseFindings(markdown);
|
|
16005
16093
|
if (findings.length === 0) {
|
|
16006
16094
|
console.log("Synthesis contains no findings; nothing to post.");
|
|
@@ -16082,10 +16170,10 @@ async function handlePostSynthesis(synthesisPath, options2) {
|
|
|
16082
16170
|
}
|
|
16083
16171
|
|
|
16084
16172
|
// src/commands/review/prepareReviewDir.ts
|
|
16085
|
-
import { existsSync as
|
|
16173
|
+
import { existsSync as existsSync36, mkdirSync as mkdirSync14, unlinkSync as unlinkSync12, writeFileSync as writeFileSync30 } from "fs";
|
|
16086
16174
|
function clearReviewFiles(paths) {
|
|
16087
16175
|
for (const path57 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
16088
|
-
if (
|
|
16176
|
+
if (existsSync36(path57)) unlinkSync12(path57);
|
|
16089
16177
|
}
|
|
16090
16178
|
}
|
|
16091
16179
|
function prepareReviewDir(paths, requestBody, force) {
|
|
@@ -16370,7 +16458,7 @@ function printReviewerFailures(results) {
|
|
|
16370
16458
|
}
|
|
16371
16459
|
|
|
16372
16460
|
// src/commands/review/runAndSynthesise.ts
|
|
16373
|
-
import { existsSync as
|
|
16461
|
+
import { existsSync as existsSync38, unlinkSync as unlinkSync14 } from "fs";
|
|
16374
16462
|
|
|
16375
16463
|
// src/commands/review/buildReviewerStdin.ts
|
|
16376
16464
|
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 +16878,7 @@ function resolveClaude(args) {
|
|
|
16790
16878
|
}
|
|
16791
16879
|
|
|
16792
16880
|
// src/commands/review/runCodexReviewer.ts
|
|
16793
|
-
import { existsSync as
|
|
16881
|
+
import { existsSync as existsSync37, unlinkSync as unlinkSync13 } from "fs";
|
|
16794
16882
|
|
|
16795
16883
|
// src/commands/review/parseCodexEvent.ts
|
|
16796
16884
|
function isItemStarted(value) {
|
|
@@ -16842,7 +16930,7 @@ async function runCodexReviewer(spec) {
|
|
|
16842
16930
|
reportReviewerToolUse(spec.name, event, spinner);
|
|
16843
16931
|
}
|
|
16844
16932
|
});
|
|
16845
|
-
if (result.exitCode !== 0 &&
|
|
16933
|
+
if (result.exitCode !== 0 && existsSync37(spec.outputPath)) {
|
|
16846
16934
|
unlinkSync13(spec.outputPath);
|
|
16847
16935
|
}
|
|
16848
16936
|
return finaliseReviewerRun({ ...spec, command }, spinner, result);
|
|
@@ -16884,7 +16972,7 @@ async function runReviewers(reviewDir, claudePath, codexPath, stdinPrompt, optio
|
|
|
16884
16972
|
}
|
|
16885
16973
|
|
|
16886
16974
|
// src/commands/review/synthesise.ts
|
|
16887
|
-
import { readFileSync as
|
|
16975
|
+
import { readFileSync as readFileSync34 } from "fs";
|
|
16888
16976
|
|
|
16889
16977
|
// src/commands/review/buildSynthesisStdin.ts
|
|
16890
16978
|
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 +17028,7 @@ Files:
|
|
|
16940
17028
|
|
|
16941
17029
|
// src/commands/review/synthesise.ts
|
|
16942
17030
|
function printSummary2(synthesisPath) {
|
|
16943
|
-
const markdown =
|
|
17031
|
+
const markdown = readFileSync34(synthesisPath, "utf8");
|
|
16944
17032
|
console.log("");
|
|
16945
17033
|
console.log(buildReviewSummary(markdown));
|
|
16946
17034
|
console.log("");
|
|
@@ -16988,7 +17076,7 @@ async function runAndSynthesise(args) {
|
|
|
16988
17076
|
console.error("Both reviewers failed; skipping synthesis.");
|
|
16989
17077
|
return { ok: false, failures };
|
|
16990
17078
|
}
|
|
16991
|
-
if (anyFresh &&
|
|
17079
|
+
if (anyFresh && existsSync38(paths.synthesisPath)) {
|
|
16992
17080
|
unlinkSync14(paths.synthesisPath);
|
|
16993
17081
|
}
|
|
16994
17082
|
const synthesisResult = await synthesise(paths, { multi });
|
|
@@ -17767,7 +17855,7 @@ function registerSql(program2) {
|
|
|
17767
17855
|
}
|
|
17768
17856
|
|
|
17769
17857
|
// src/commands/transcript/shared.ts
|
|
17770
|
-
import { existsSync as
|
|
17858
|
+
import { existsSync as existsSync39, readdirSync as readdirSync7, statSync as statSync5 } from "fs";
|
|
17771
17859
|
import { basename as basename8, join as join46, relative as relative2 } from "path";
|
|
17772
17860
|
import * as readline2 from "readline";
|
|
17773
17861
|
var DATE_PREFIX_REGEX = /^\d{4}-\d{2}-\d{2}/;
|
|
@@ -17783,7 +17871,7 @@ function isValidDatePrefix(filename) {
|
|
|
17783
17871
|
return DATE_PREFIX_REGEX.test(filename);
|
|
17784
17872
|
}
|
|
17785
17873
|
function collectFiles(dir, extension) {
|
|
17786
|
-
if (!
|
|
17874
|
+
if (!existsSync39(dir)) return [];
|
|
17787
17875
|
const results = [];
|
|
17788
17876
|
for (const entry of readdirSync7(dir)) {
|
|
17789
17877
|
const fullPath = join46(dir, entry);
|
|
@@ -17880,7 +17968,7 @@ async function configure() {
|
|
|
17880
17968
|
}
|
|
17881
17969
|
|
|
17882
17970
|
// src/commands/transcript/format/index.ts
|
|
17883
|
-
import { existsSync as
|
|
17971
|
+
import { existsSync as existsSync41 } from "fs";
|
|
17884
17972
|
|
|
17885
17973
|
// src/commands/transcript/format/fixInvalidDatePrefixes/index.ts
|
|
17886
17974
|
import { dirname as dirname22, join as join48 } from "path";
|
|
@@ -17954,7 +18042,7 @@ async function fixInvalidDatePrefixes(vttFiles) {
|
|
|
17954
18042
|
}
|
|
17955
18043
|
|
|
17956
18044
|
// src/commands/transcript/format/processVttFile/index.ts
|
|
17957
|
-
import { existsSync as
|
|
18045
|
+
import { existsSync as existsSync40, mkdirSync as mkdirSync15, readFileSync as readFileSync35, writeFileSync as writeFileSync32 } from "fs";
|
|
17958
18046
|
import { basename as basename9, dirname as dirname23, join as join49 } from "path";
|
|
17959
18047
|
|
|
17960
18048
|
// src/commands/transcript/cleanText.ts
|
|
@@ -18179,7 +18267,7 @@ function logSkipped(relativeDir, mdFile) {
|
|
|
18179
18267
|
return "skipped";
|
|
18180
18268
|
}
|
|
18181
18269
|
function ensureDirectory(dir, label2) {
|
|
18182
|
-
if (!
|
|
18270
|
+
if (!existsSync40(dir)) {
|
|
18183
18271
|
mkdirSync15(dir, { recursive: true });
|
|
18184
18272
|
console.log(`Created ${label2}: ${dir}`);
|
|
18185
18273
|
}
|
|
@@ -18202,7 +18290,7 @@ function logReduction(cueCount, messageCount) {
|
|
|
18202
18290
|
}
|
|
18203
18291
|
function readAndParseCues(inputPath) {
|
|
18204
18292
|
console.log(`Reading: ${inputPath}`);
|
|
18205
|
-
return processCues(
|
|
18293
|
+
return processCues(readFileSync35(inputPath, "utf8"));
|
|
18206
18294
|
}
|
|
18207
18295
|
function writeFormatted(outputPath, content) {
|
|
18208
18296
|
writeFileSync32(outputPath, content, "utf8");
|
|
@@ -18215,7 +18303,7 @@ function convertVttToMarkdown(inputPath, outputPath) {
|
|
|
18215
18303
|
logReduction(cues.length, chatMessages.length);
|
|
18216
18304
|
}
|
|
18217
18305
|
function tryProcessVtt(vttFile, paths) {
|
|
18218
|
-
if (
|
|
18306
|
+
if (existsSync40(paths.outputPath))
|
|
18219
18307
|
return logSkipped(paths.relativeDir, paths.mdFile);
|
|
18220
18308
|
convertVttToMarkdown(vttFile.absolutePath, paths.outputPath);
|
|
18221
18309
|
return "processed";
|
|
@@ -18241,7 +18329,7 @@ function processAllFiles(vttFiles, transcriptsDir) {
|
|
|
18241
18329
|
logSummary(counts);
|
|
18242
18330
|
}
|
|
18243
18331
|
function requireVttDir(vttDir) {
|
|
18244
|
-
if (!
|
|
18332
|
+
if (!existsSync41(vttDir)) {
|
|
18245
18333
|
console.error(`VTT directory not found: ${vttDir}`);
|
|
18246
18334
|
process.exit(1);
|
|
18247
18335
|
}
|
|
@@ -18273,14 +18361,14 @@ async function format() {
|
|
|
18273
18361
|
}
|
|
18274
18362
|
|
|
18275
18363
|
// src/commands/transcript/summarise/index.ts
|
|
18276
|
-
import { existsSync as
|
|
18364
|
+
import { existsSync as existsSync43 } from "fs";
|
|
18277
18365
|
import { basename as basename10, dirname as dirname25, join as join51, relative as relative3 } from "path";
|
|
18278
18366
|
|
|
18279
18367
|
// src/commands/transcript/summarise/processStagedFile/index.ts
|
|
18280
18368
|
import {
|
|
18281
|
-
existsSync as
|
|
18369
|
+
existsSync as existsSync42,
|
|
18282
18370
|
mkdirSync as mkdirSync16,
|
|
18283
|
-
readFileSync as
|
|
18371
|
+
readFileSync as readFileSync36,
|
|
18284
18372
|
renameSync as renameSync3,
|
|
18285
18373
|
rmSync as rmSync4
|
|
18286
18374
|
} from "fs";
|
|
@@ -18315,7 +18403,7 @@ function validateStagedContent(filename, content) {
|
|
|
18315
18403
|
// src/commands/transcript/summarise/processStagedFile/index.ts
|
|
18316
18404
|
var STAGING_DIR = join50(process.cwd(), ".assist", "transcript");
|
|
18317
18405
|
function processStagedFile() {
|
|
18318
|
-
if (!
|
|
18406
|
+
if (!existsSync42(STAGING_DIR)) {
|
|
18319
18407
|
return false;
|
|
18320
18408
|
}
|
|
18321
18409
|
const stagedFiles = findMdFilesRecursive(STAGING_DIR);
|
|
@@ -18324,7 +18412,7 @@ function processStagedFile() {
|
|
|
18324
18412
|
}
|
|
18325
18413
|
const { transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
18326
18414
|
const stagedFile = stagedFiles[0];
|
|
18327
|
-
const content =
|
|
18415
|
+
const content = readFileSync36(stagedFile.absolutePath, "utf8");
|
|
18328
18416
|
validateStagedContent(stagedFile.filename, content);
|
|
18329
18417
|
const stagedBaseName = getTranscriptBaseName(stagedFile.filename);
|
|
18330
18418
|
const transcriptFiles = findMdFilesRecursive(transcriptsDir);
|
|
@@ -18339,7 +18427,7 @@ function processStagedFile() {
|
|
|
18339
18427
|
}
|
|
18340
18428
|
const destPath = join50(summaryDir, matchingTranscript.relativePath);
|
|
18341
18429
|
const destDir = dirname24(destPath);
|
|
18342
|
-
if (!
|
|
18430
|
+
if (!existsSync42(destDir)) {
|
|
18343
18431
|
mkdirSync16(destDir, { recursive: true });
|
|
18344
18432
|
}
|
|
18345
18433
|
renameSync3(stagedFile.absolutePath, destPath);
|
|
@@ -18366,7 +18454,7 @@ function buildSummaryIndex(summaryDir) {
|
|
|
18366
18454
|
function summarise2() {
|
|
18367
18455
|
processStagedFile();
|
|
18368
18456
|
const { transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
18369
|
-
if (!
|
|
18457
|
+
if (!existsSync43(transcriptsDir)) {
|
|
18370
18458
|
console.log("No transcripts directory found.");
|
|
18371
18459
|
return;
|
|
18372
18460
|
}
|
|
@@ -18413,6 +18501,13 @@ function registerTranscript(program2) {
|
|
|
18413
18501
|
}
|
|
18414
18502
|
|
|
18415
18503
|
// src/commands/registerVerify.ts
|
|
18504
|
+
function runScope(scope, options2) {
|
|
18505
|
+
if (scope && scope !== "all") {
|
|
18506
|
+
console.error(`Unknown scope: "${scope}". Use "all" to run all checks.`);
|
|
18507
|
+
process.exit(1);
|
|
18508
|
+
}
|
|
18509
|
+
run({ ...options2, all: scope === "all" });
|
|
18510
|
+
}
|
|
18416
18511
|
function registerVerify(program2) {
|
|
18417
18512
|
const verifyCommand = program2.command("verify").description("Run all verify:* commands in parallel").argument(
|
|
18418
18513
|
"[scope]",
|
|
@@ -18420,15 +18515,7 @@ function registerVerify(program2) {
|
|
|
18420
18515
|
).option(
|
|
18421
18516
|
"--measure",
|
|
18422
18517
|
"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
|
-
});
|
|
18518
|
+
).option("--verbose", "Show all output (bypass CLAUDECODE suppression)").action(runScope);
|
|
18432
18519
|
verifyCommand.command("list").description("List configured verify commands").action(list);
|
|
18433
18520
|
verifyCommand.command("init").description("Add verify scripts to a project").option(
|
|
18434
18521
|
"--package-json",
|
|
@@ -18437,6 +18524,9 @@ function registerVerify(program2) {
|
|
|
18437
18524
|
verifyCommand.command("hardcoded-colors").description("Check for hardcoded hex colors in src/").action(hardcodedColors);
|
|
18438
18525
|
verifyCommand.command("comment-policy").description("Check for undocumented comments added on changed lines").action(commentPolicy);
|
|
18439
18526
|
verifyCommand.command("no-venv").description("Check that no venv folders exist in the repo").action(noVenv);
|
|
18527
|
+
verifyCommand.command("settings-guard").description(
|
|
18528
|
+
"Check that claude/settings.json permission lists contain no assist references"
|
|
18529
|
+
).action(settingsGuard);
|
|
18440
18530
|
}
|
|
18441
18531
|
|
|
18442
18532
|
// src/commands/voice/devices.ts
|
|
@@ -18477,14 +18567,14 @@ function devices() {
|
|
|
18477
18567
|
}
|
|
18478
18568
|
|
|
18479
18569
|
// src/commands/voice/logs.ts
|
|
18480
|
-
import { existsSync as
|
|
18570
|
+
import { existsSync as existsSync44, readFileSync as readFileSync37 } from "fs";
|
|
18481
18571
|
function logs(options2) {
|
|
18482
|
-
if (!
|
|
18572
|
+
if (!existsSync44(voicePaths.log)) {
|
|
18483
18573
|
console.log("No voice log file found");
|
|
18484
18574
|
return;
|
|
18485
18575
|
}
|
|
18486
18576
|
const count6 = Number.parseInt(options2.lines ?? "150", 10);
|
|
18487
|
-
const content =
|
|
18577
|
+
const content = readFileSync37(voicePaths.log, "utf8").trim();
|
|
18488
18578
|
if (!content) {
|
|
18489
18579
|
console.log("Voice log is empty");
|
|
18490
18580
|
return;
|
|
@@ -18511,7 +18601,7 @@ import { join as join55 } from "path";
|
|
|
18511
18601
|
|
|
18512
18602
|
// src/commands/voice/checkLockFile.ts
|
|
18513
18603
|
import { execSync as execSync49 } from "child_process";
|
|
18514
|
-
import { existsSync as
|
|
18604
|
+
import { existsSync as existsSync45, mkdirSync as mkdirSync17, readFileSync as readFileSync38, writeFileSync as writeFileSync33 } from "fs";
|
|
18515
18605
|
import { join as join54 } from "path";
|
|
18516
18606
|
function isProcessAlive2(pid) {
|
|
18517
18607
|
try {
|
|
@@ -18523,9 +18613,9 @@ function isProcessAlive2(pid) {
|
|
|
18523
18613
|
}
|
|
18524
18614
|
function checkLockFile() {
|
|
18525
18615
|
const lockFile = getLockFile();
|
|
18526
|
-
if (!
|
|
18616
|
+
if (!existsSync45(lockFile)) return;
|
|
18527
18617
|
try {
|
|
18528
|
-
const lock = JSON.parse(
|
|
18618
|
+
const lock = JSON.parse(readFileSync38(lockFile, "utf8"));
|
|
18529
18619
|
if (lock.pid && isProcessAlive2(lock.pid)) {
|
|
18530
18620
|
console.error(
|
|
18531
18621
|
`Voice daemon already running (PID ${lock.pid}, env: ${lock.env}). Stop it first with: assist voice stop`
|
|
@@ -18536,7 +18626,7 @@ function checkLockFile() {
|
|
|
18536
18626
|
}
|
|
18537
18627
|
}
|
|
18538
18628
|
function bootstrapVenv() {
|
|
18539
|
-
if (
|
|
18629
|
+
if (existsSync45(getVenvPython())) return;
|
|
18540
18630
|
console.log("Setting up Python environment...");
|
|
18541
18631
|
const pythonDir = getPythonDir();
|
|
18542
18632
|
execSync49(
|
|
@@ -18627,7 +18717,7 @@ function start2(options2) {
|
|
|
18627
18717
|
}
|
|
18628
18718
|
|
|
18629
18719
|
// src/commands/voice/status.ts
|
|
18630
|
-
import { existsSync as
|
|
18720
|
+
import { existsSync as existsSync46, readFileSync as readFileSync39 } from "fs";
|
|
18631
18721
|
function isProcessAlive3(pid) {
|
|
18632
18722
|
try {
|
|
18633
18723
|
process.kill(pid, 0);
|
|
@@ -18637,16 +18727,16 @@ function isProcessAlive3(pid) {
|
|
|
18637
18727
|
}
|
|
18638
18728
|
}
|
|
18639
18729
|
function readRecentLogs(count6) {
|
|
18640
|
-
if (!
|
|
18641
|
-
const lines =
|
|
18730
|
+
if (!existsSync46(voicePaths.log)) return [];
|
|
18731
|
+
const lines = readFileSync39(voicePaths.log, "utf8").trim().split("\n");
|
|
18642
18732
|
return lines.slice(-count6);
|
|
18643
18733
|
}
|
|
18644
18734
|
function status() {
|
|
18645
|
-
if (!
|
|
18735
|
+
if (!existsSync46(voicePaths.pid)) {
|
|
18646
18736
|
console.log("Voice daemon: not running (no PID file)");
|
|
18647
18737
|
return;
|
|
18648
18738
|
}
|
|
18649
|
-
const pid = Number.parseInt(
|
|
18739
|
+
const pid = Number.parseInt(readFileSync39(voicePaths.pid, "utf8").trim(), 10);
|
|
18650
18740
|
const alive = isProcessAlive3(pid);
|
|
18651
18741
|
console.log(`Voice daemon: ${alive ? "running" : "dead"} (PID ${pid})`);
|
|
18652
18742
|
const recent = readRecentLogs(5);
|
|
@@ -18665,13 +18755,13 @@ function status() {
|
|
|
18665
18755
|
}
|
|
18666
18756
|
|
|
18667
18757
|
// src/commands/voice/stop.ts
|
|
18668
|
-
import { existsSync as
|
|
18758
|
+
import { existsSync as existsSync47, readFileSync as readFileSync40, unlinkSync as unlinkSync15 } from "fs";
|
|
18669
18759
|
function stop2() {
|
|
18670
|
-
if (!
|
|
18760
|
+
if (!existsSync47(voicePaths.pid)) {
|
|
18671
18761
|
console.log("Voice daemon is not running (no PID file)");
|
|
18672
18762
|
return;
|
|
18673
18763
|
}
|
|
18674
|
-
const pid = Number.parseInt(
|
|
18764
|
+
const pid = Number.parseInt(readFileSync40(voicePaths.pid, "utf8").trim(), 10);
|
|
18675
18765
|
try {
|
|
18676
18766
|
process.kill(pid, "SIGTERM");
|
|
18677
18767
|
console.log(`Sent SIGTERM to voice daemon (PID ${pid})`);
|
|
@@ -18684,7 +18774,7 @@ function stop2() {
|
|
|
18684
18774
|
}
|
|
18685
18775
|
try {
|
|
18686
18776
|
const lockFile = getLockFile();
|
|
18687
|
-
if (
|
|
18777
|
+
if (existsSync47(lockFile)) unlinkSync15(lockFile);
|
|
18688
18778
|
} catch {
|
|
18689
18779
|
}
|
|
18690
18780
|
console.log("Voice daemon stopped");
|
|
@@ -18862,7 +18952,7 @@ async function auth() {
|
|
|
18862
18952
|
|
|
18863
18953
|
// src/commands/roam/postRoamActivity.ts
|
|
18864
18954
|
import { execFileSync as execFileSync7 } from "child_process";
|
|
18865
|
-
import { readdirSync as readdirSync8, readFileSync as
|
|
18955
|
+
import { readdirSync as readdirSync8, readFileSync as readFileSync41, statSync as statSync6 } from "fs";
|
|
18866
18956
|
import { join as join57 } from "path";
|
|
18867
18957
|
function findPortFile(roamDir) {
|
|
18868
18958
|
let entries;
|
|
@@ -18888,7 +18978,7 @@ function postRoamActivity(app, event) {
|
|
|
18888
18978
|
if (!portFile) return;
|
|
18889
18979
|
let port;
|
|
18890
18980
|
try {
|
|
18891
|
-
port =
|
|
18981
|
+
port = readFileSync41(portFile, "utf8").trim();
|
|
18892
18982
|
} catch {
|
|
18893
18983
|
return;
|
|
18894
18984
|
}
|
|
@@ -19030,7 +19120,7 @@ function runPreCommands(pre, cwd) {
|
|
|
19030
19120
|
|
|
19031
19121
|
// src/commands/run/spawnRunCommand.ts
|
|
19032
19122
|
import { execFileSync as execFileSync8, spawn as spawn8 } from "child_process";
|
|
19033
|
-
import { existsSync as
|
|
19123
|
+
import { existsSync as existsSync48 } from "fs";
|
|
19034
19124
|
import { dirname as dirname27, join as join58, resolve as resolve13 } from "path";
|
|
19035
19125
|
function resolveCommand2(command) {
|
|
19036
19126
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
@@ -19038,7 +19128,7 @@ function resolveCommand2(command) {
|
|
|
19038
19128
|
const gitPath = execFileSync8("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
19039
19129
|
const gitRoot = resolve13(dirname27(gitPath), "..");
|
|
19040
19130
|
const gitBash = join58(gitRoot, "bin", "bash.exe");
|
|
19041
|
-
if (
|
|
19131
|
+
if (existsSync48(gitBash)) return gitBash;
|
|
19042
19132
|
} catch {
|
|
19043
19133
|
}
|
|
19044
19134
|
return command;
|
|
@@ -19249,7 +19339,7 @@ function link2() {
|
|
|
19249
19339
|
}
|
|
19250
19340
|
|
|
19251
19341
|
// src/commands/run/remove.ts
|
|
19252
|
-
import { existsSync as
|
|
19342
|
+
import { existsSync as existsSync49, unlinkSync as unlinkSync16 } from "fs";
|
|
19253
19343
|
import { join as join60 } from "path";
|
|
19254
19344
|
function findRemoveIndex() {
|
|
19255
19345
|
const idx = process.argv.indexOf("remove");
|
|
@@ -19266,7 +19356,7 @@ function parseRemoveName() {
|
|
|
19266
19356
|
}
|
|
19267
19357
|
function deleteCommandFile(name) {
|
|
19268
19358
|
const filePath = join60(".claude", "commands", `${name}.md`);
|
|
19269
|
-
if (
|
|
19359
|
+
if (existsSync49(filePath)) {
|
|
19270
19360
|
unlinkSync16(filePath);
|
|
19271
19361
|
console.log(`Deleted command file: ${filePath}`);
|
|
19272
19362
|
}
|
|
@@ -19305,7 +19395,7 @@ function registerRun(program2) {
|
|
|
19305
19395
|
|
|
19306
19396
|
// src/commands/screenshot/index.ts
|
|
19307
19397
|
import { execSync as execSync51 } from "child_process";
|
|
19308
|
-
import { existsSync as
|
|
19398
|
+
import { existsSync as existsSync50, mkdirSync as mkdirSync21, unlinkSync as unlinkSync17, writeFileSync as writeFileSync36 } from "fs";
|
|
19309
19399
|
import { tmpdir as tmpdir7 } from "os";
|
|
19310
19400
|
import { join as join61, resolve as resolve15 } from "path";
|
|
19311
19401
|
import chalk173 from "chalk";
|
|
@@ -19437,7 +19527,7 @@ Write-Output $OutputPath
|
|
|
19437
19527
|
|
|
19438
19528
|
// src/commands/screenshot/index.ts
|
|
19439
19529
|
function buildOutputPath(outputDir, processName) {
|
|
19440
|
-
if (!
|
|
19530
|
+
if (!existsSync50(outputDir)) {
|
|
19441
19531
|
mkdirSync21(outputDir, { recursive: true });
|
|
19442
19532
|
}
|
|
19443
19533
|
const timestamp4 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
@@ -19521,7 +19611,7 @@ function applyLine(result, pending, line) {
|
|
|
19521
19611
|
}
|
|
19522
19612
|
|
|
19523
19613
|
// src/commands/sessions/daemon/reportStolenSocket.ts
|
|
19524
|
-
import { readFileSync as
|
|
19614
|
+
import { readFileSync as readFileSync42 } from "fs";
|
|
19525
19615
|
function reportStolenSocket(socketPid) {
|
|
19526
19616
|
if (!socketPid) return;
|
|
19527
19617
|
const filePid = readPidFile();
|
|
@@ -19533,7 +19623,7 @@ function reportStolenSocket(socketPid) {
|
|
|
19533
19623
|
function readPidFile() {
|
|
19534
19624
|
try {
|
|
19535
19625
|
const pid = Number.parseInt(
|
|
19536
|
-
|
|
19626
|
+
readFileSync42(daemonPaths.pid, "utf8").trim(),
|
|
19537
19627
|
10
|
|
19538
19628
|
);
|
|
19539
19629
|
return Number.isInteger(pid) ? pid : void 0;
|
|
@@ -19819,7 +19909,7 @@ var ClientHub = class extends Set {
|
|
|
19819
19909
|
import * as pty from "node-pty";
|
|
19820
19910
|
|
|
19821
19911
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
19822
|
-
import { chmodSync, existsSync as
|
|
19912
|
+
import { chmodSync, existsSync as existsSync51, statSync as statSync7 } from "fs";
|
|
19823
19913
|
import { createRequire as createRequire3 } from "module";
|
|
19824
19914
|
import path49 from "path";
|
|
19825
19915
|
var require4 = createRequire3(import.meta.url);
|
|
@@ -19834,7 +19924,7 @@ function ensureSpawnHelperExecutable() {
|
|
|
19834
19924
|
`${process.platform}-${process.arch}`,
|
|
19835
19925
|
"spawn-helper"
|
|
19836
19926
|
);
|
|
19837
|
-
if (!
|
|
19927
|
+
if (!existsSync51(helper)) return;
|
|
19838
19928
|
const mode = statSync7(helper).mode;
|
|
19839
19929
|
if ((mode & 73) === 0) chmodSync(helper, mode | 493);
|
|
19840
19930
|
}
|
|
@@ -20194,7 +20284,7 @@ function resumeSession(id2, sessionId, cwd, name) {
|
|
|
20194
20284
|
}
|
|
20195
20285
|
|
|
20196
20286
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
20197
|
-
import { existsSync as
|
|
20287
|
+
import { existsSync as existsSync52, mkdirSync as mkdirSync22, watch } from "fs";
|
|
20198
20288
|
import { dirname as dirname28 } from "path";
|
|
20199
20289
|
|
|
20200
20290
|
// src/commands/sessions/daemon/applyReviewPause.ts
|
|
@@ -20236,7 +20326,7 @@ function watchActivity(session, notify2) {
|
|
|
20236
20326
|
if (timer) clearTimeout(timer);
|
|
20237
20327
|
timer = setTimeout(read, DEBOUNCE_MS);
|
|
20238
20328
|
});
|
|
20239
|
-
if (
|
|
20329
|
+
if (existsSync52(path57)) read();
|
|
20240
20330
|
}
|
|
20241
20331
|
function refreshActivity(session) {
|
|
20242
20332
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -21394,7 +21484,7 @@ function handleConnection(socket, manager) {
|
|
|
21394
21484
|
import { unlinkSync as unlinkSync18, writeFileSync as writeFileSync37 } from "fs";
|
|
21395
21485
|
|
|
21396
21486
|
// src/commands/sessions/daemon/startPidFileWatchdog.ts
|
|
21397
|
-
import { readFileSync as
|
|
21487
|
+
import { readFileSync as readFileSync43 } from "fs";
|
|
21398
21488
|
var WATCHDOG_INTERVAL_MS = 5e3;
|
|
21399
21489
|
function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
21400
21490
|
const timer = setInterval(() => {
|
|
@@ -21405,7 +21495,7 @@ function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
|
21405
21495
|
}
|
|
21406
21496
|
function ownsPidFile() {
|
|
21407
21497
|
try {
|
|
21408
|
-
return
|
|
21498
|
+
return readFileSync43(daemonPaths.pid, "utf8").trim() === String(process.pid);
|
|
21409
21499
|
} catch {
|
|
21410
21500
|
return false;
|
|
21411
21501
|
}
|