@staff0rd/assist 0.174.0 → 0.174.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +293 -269
- 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.174.
|
|
9
|
+
version: "0.174.2",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -100,12 +100,12 @@ async function exitOnCancel(promise) {
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
// src/commands/backlog/acquireLock.ts
|
|
103
|
-
import { existsSync as
|
|
104
|
-
import { join as
|
|
103
|
+
import { existsSync as existsSync4, readFileSync as readFileSync4, unlinkSync, writeFileSync as writeFileSync3 } from "fs";
|
|
104
|
+
import { join as join5 } from "path";
|
|
105
105
|
|
|
106
106
|
// src/commands/backlog/shared.ts
|
|
107
|
-
import { existsSync as
|
|
108
|
-
import { join as
|
|
107
|
+
import { existsSync as existsSync3 } from "fs";
|
|
108
|
+
import { join as join4 } from "path";
|
|
109
109
|
import chalk from "chalk";
|
|
110
110
|
|
|
111
111
|
// src/commands/backlog/deleteItemRelations.ts
|
|
@@ -395,11 +395,32 @@ function migrateYamlIfNeeded(db, yamlPath) {
|
|
|
395
395
|
|
|
396
396
|
// src/commands/backlog/openDb.ts
|
|
397
397
|
import { mkdirSync } from "fs";
|
|
398
|
-
import { join as
|
|
398
|
+
import { join as join3 } from "path";
|
|
399
399
|
import Database from "better-sqlite3";
|
|
400
|
+
|
|
401
|
+
// src/commands/backlog/ensureGitignore.ts
|
|
402
|
+
import { existsSync as existsSync2, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "fs";
|
|
403
|
+
import { join as join2 } from "path";
|
|
404
|
+
var gitignoreEntries = [
|
|
405
|
+
".assist/backlog.db",
|
|
406
|
+
".assist/backlog.db-shm",
|
|
407
|
+
".assist/backlog.db-wal"
|
|
408
|
+
];
|
|
409
|
+
function ensureGitignore(dir) {
|
|
410
|
+
const gitignorePath = join2(dir, ".gitignore");
|
|
411
|
+
const existing = existsSync2(gitignorePath) ? readFileSync3(gitignorePath, "utf-8") : "";
|
|
412
|
+
const lines = existing.split("\n");
|
|
413
|
+
const missing = gitignoreEntries.filter((entry) => !lines.includes(entry));
|
|
414
|
+
if (missing.length === 0) return;
|
|
415
|
+
const suffix = existing.length > 0 && !existing.endsWith("\n") ? "\n" : "";
|
|
416
|
+
writeFileSync2(gitignorePath, `${existing}${suffix}${missing.join("\n")}
|
|
417
|
+
`);
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
// src/commands/backlog/openDb.ts
|
|
400
421
|
var _db;
|
|
401
422
|
function getDbPath(dir) {
|
|
402
|
-
return
|
|
423
|
+
return join3(dir, ".assist", "backlog.db");
|
|
403
424
|
}
|
|
404
425
|
function initSchema(db) {
|
|
405
426
|
db.exec(`
|
|
@@ -456,11 +477,12 @@ function initSchema(db) {
|
|
|
456
477
|
function openDb(dir) {
|
|
457
478
|
if (_db) return _db;
|
|
458
479
|
const dbPath = getDbPath(dir);
|
|
459
|
-
mkdirSync(
|
|
480
|
+
mkdirSync(join3(dir, ".assist"), { recursive: true });
|
|
460
481
|
const db = new Database(dbPath);
|
|
461
482
|
db.pragma("journal_mode = WAL");
|
|
462
483
|
db.pragma("foreign_keys = ON");
|
|
463
484
|
initSchema(db);
|
|
485
|
+
ensureGitignore(dir);
|
|
464
486
|
_db = db;
|
|
465
487
|
return db;
|
|
466
488
|
}
|
|
@@ -505,11 +527,11 @@ function getBacklogDir() {
|
|
|
505
527
|
return _backlogDir ?? process.cwd();
|
|
506
528
|
}
|
|
507
529
|
function getBacklogPath() {
|
|
508
|
-
return
|
|
530
|
+
return join4(getBacklogDir(), "assist.backlog.yml");
|
|
509
531
|
}
|
|
510
532
|
function backlogExists() {
|
|
511
533
|
const dir = getBacklogDir();
|
|
512
|
-
return
|
|
534
|
+
return existsSync3(join4(dir, ".assist", "backlog.db")) || existsSync3(join4(dir, ".assist", "backlog.jsonl")) || existsSync3(join4(dir, "assist.backlog.yml"));
|
|
513
535
|
}
|
|
514
536
|
function getDb() {
|
|
515
537
|
const dir = getBacklogDir();
|
|
@@ -577,7 +599,7 @@ function getNextId(items) {
|
|
|
577
599
|
|
|
578
600
|
// src/commands/backlog/acquireLock.ts
|
|
579
601
|
function getLockPath(itemId) {
|
|
580
|
-
return
|
|
602
|
+
return join5(getBacklogDir(), `.assist-lock-${itemId}.json`);
|
|
581
603
|
}
|
|
582
604
|
function isProcessAlive(pid) {
|
|
583
605
|
try {
|
|
@@ -589,9 +611,9 @@ function isProcessAlive(pid) {
|
|
|
589
611
|
}
|
|
590
612
|
function isLockedByOther(itemId) {
|
|
591
613
|
const lockPath = getLockPath(itemId);
|
|
592
|
-
if (!
|
|
614
|
+
if (!existsSync4(lockPath)) return false;
|
|
593
615
|
try {
|
|
594
|
-
const lock = JSON.parse(
|
|
616
|
+
const lock = JSON.parse(readFileSync4(lockPath, "utf-8"));
|
|
595
617
|
if (lock.pid === process.pid) return false;
|
|
596
618
|
return isProcessAlive(lock.pid);
|
|
597
619
|
} catch {
|
|
@@ -599,7 +621,7 @@ function isLockedByOther(itemId) {
|
|
|
599
621
|
}
|
|
600
622
|
}
|
|
601
623
|
function acquireLock(itemId) {
|
|
602
|
-
|
|
624
|
+
writeFileSync3(
|
|
603
625
|
getLockPath(itemId),
|
|
604
626
|
JSON.stringify({ pid: process.pid, timestamp: (/* @__PURE__ */ new Date()).toISOString() })
|
|
605
627
|
);
|
|
@@ -785,7 +807,7 @@ function buildReviewPhase() {
|
|
|
785
807
|
import chalk4 from "chalk";
|
|
786
808
|
|
|
787
809
|
// src/commands/backlog/resolvePhaseResult.ts
|
|
788
|
-
import { existsSync as
|
|
810
|
+
import { existsSync as existsSync5, unlinkSync as unlinkSync2 } from "fs";
|
|
789
811
|
import chalk3 from "chalk";
|
|
790
812
|
|
|
791
813
|
// src/commands/backlog/handleIncompletePhase.ts
|
|
@@ -805,22 +827,22 @@ async function handleIncompletePhase() {
|
|
|
805
827
|
}
|
|
806
828
|
|
|
807
829
|
// src/commands/backlog/writeSignal.ts
|
|
808
|
-
import { writeFileSync as
|
|
809
|
-
import { join as
|
|
830
|
+
import { writeFileSync as writeFileSync4 } from "fs";
|
|
831
|
+
import { join as join6 } from "path";
|
|
810
832
|
var SIGNAL_FILE = ".assist-signal.json";
|
|
811
833
|
function getSignalPath() {
|
|
812
|
-
return
|
|
834
|
+
return join6(getBacklogDir(), SIGNAL_FILE);
|
|
813
835
|
}
|
|
814
836
|
function writeSignal(event, data) {
|
|
815
837
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
816
838
|
const signal = { event, ...sessionId && { sessionId }, ...data };
|
|
817
|
-
|
|
839
|
+
writeFileSync4(getSignalPath(), JSON.stringify(signal));
|
|
818
840
|
}
|
|
819
841
|
|
|
820
842
|
// src/commands/backlog/resolvePhaseResult.ts
|
|
821
843
|
function cleanupSignal() {
|
|
822
844
|
const statusPath = getSignalPath();
|
|
823
|
-
if (
|
|
845
|
+
if (existsSync5(statusPath)) {
|
|
824
846
|
unlinkSync2(statusPath);
|
|
825
847
|
}
|
|
826
848
|
}
|
|
@@ -830,7 +852,7 @@ function isTerminalStatus(itemId) {
|
|
|
830
852
|
return item?.status === "done" || item?.status === "wontdo";
|
|
831
853
|
}
|
|
832
854
|
async function resolvePhaseResult(phaseIndex, itemId) {
|
|
833
|
-
if (!
|
|
855
|
+
if (!existsSync5(getSignalPath())) {
|
|
834
856
|
if (isTerminalStatus(itemId)) return -1;
|
|
835
857
|
const action = await handleIncompletePhase();
|
|
836
858
|
if (action === "abort") return -1;
|
|
@@ -860,15 +882,15 @@ function spawnClaude(prompt, options2 = {}) {
|
|
|
860
882
|
}
|
|
861
883
|
|
|
862
884
|
// src/commands/backlog/watchForMarker.ts
|
|
863
|
-
import { existsSync as
|
|
885
|
+
import { existsSync as existsSync7, unwatchFile, watchFile } from "fs";
|
|
864
886
|
|
|
865
887
|
// src/commands/backlog/readSignal.ts
|
|
866
|
-
import { existsSync as
|
|
888
|
+
import { existsSync as existsSync6, readFileSync as readFileSync5 } from "fs";
|
|
867
889
|
function readSignal() {
|
|
868
890
|
const path50 = getSignalPath();
|
|
869
|
-
if (!
|
|
891
|
+
if (!existsSync6(path50)) return void 0;
|
|
870
892
|
try {
|
|
871
|
-
return JSON.parse(
|
|
893
|
+
return JSON.parse(readFileSync5(path50, "utf-8"));
|
|
872
894
|
} catch {
|
|
873
895
|
return void 0;
|
|
874
896
|
}
|
|
@@ -879,7 +901,7 @@ function watchForMarker(child) {
|
|
|
879
901
|
const statusPath = getSignalPath();
|
|
880
902
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
881
903
|
watchFile(statusPath, { interval: 1e3 }, () => {
|
|
882
|
-
if (!
|
|
904
|
+
if (!existsSync7(statusPath)) return;
|
|
883
905
|
const signal = readSignal();
|
|
884
906
|
if (signal && (!signal.sessionId || signal.sessionId === sessionId)) {
|
|
885
907
|
unwatchFile(statusPath);
|
|
@@ -1233,11 +1255,11 @@ function printComments(item) {
|
|
|
1233
1255
|
|
|
1234
1256
|
// src/shared/web.ts
|
|
1235
1257
|
import { exec } from "child_process";
|
|
1236
|
-
import { readFileSync as
|
|
1258
|
+
import { readFileSync as readFileSync6 } from "fs";
|
|
1237
1259
|
import {
|
|
1238
1260
|
createServer
|
|
1239
1261
|
} from "http";
|
|
1240
|
-
import { dirname, join as
|
|
1262
|
+
import { dirname, join as join7 } from "path";
|
|
1241
1263
|
import { fileURLToPath } from "url";
|
|
1242
1264
|
import chalk14 from "chalk";
|
|
1243
1265
|
function respondJson(res, status2, data) {
|
|
@@ -1249,7 +1271,7 @@ function createBundleHandler(importMetaUrl, bundlePath) {
|
|
|
1249
1271
|
let cache;
|
|
1250
1272
|
return (_req, res) => {
|
|
1251
1273
|
if (!cache) {
|
|
1252
|
-
cache =
|
|
1274
|
+
cache = readFileSync6(join7(dir, bundlePath), "utf-8");
|
|
1253
1275
|
}
|
|
1254
1276
|
res.writeHead(200, { "Content-Type": "application/javascript" });
|
|
1255
1277
|
res.end(cache);
|
|
@@ -1463,19 +1485,19 @@ async function launchMode(slashCommand) {
|
|
|
1463
1485
|
import { execSync } from "child_process";
|
|
1464
1486
|
|
|
1465
1487
|
// src/shared/loadConfig.ts
|
|
1466
|
-
import { existsSync as
|
|
1488
|
+
import { existsSync as existsSync9, readFileSync as readFileSync8, writeFileSync as writeFileSync5 } from "fs";
|
|
1467
1489
|
import { homedir } from "os";
|
|
1468
|
-
import { basename, dirname as dirname2, join as
|
|
1490
|
+
import { basename, dirname as dirname2, join as join8 } from "path";
|
|
1469
1491
|
import chalk16 from "chalk";
|
|
1470
1492
|
import { stringify as stringifyYaml } from "yaml";
|
|
1471
1493
|
|
|
1472
1494
|
// src/shared/loadRawYaml.ts
|
|
1473
|
-
import { existsSync as
|
|
1495
|
+
import { existsSync as existsSync8, readFileSync as readFileSync7 } from "fs";
|
|
1474
1496
|
import { parse as parseYaml2 } from "yaml";
|
|
1475
1497
|
function loadRawYaml(path50) {
|
|
1476
|
-
if (!
|
|
1498
|
+
if (!existsSync8(path50)) return {};
|
|
1477
1499
|
try {
|
|
1478
|
-
const content =
|
|
1500
|
+
const content = readFileSync7(path50, "utf-8");
|
|
1479
1501
|
return parseYaml2(content) || {};
|
|
1480
1502
|
} catch {
|
|
1481
1503
|
return {};
|
|
@@ -1605,10 +1627,10 @@ var assistConfigSchema = z2.strictObject({
|
|
|
1605
1627
|
function findConfigUp(startDir) {
|
|
1606
1628
|
let current = startDir;
|
|
1607
1629
|
while (current !== dirname2(current)) {
|
|
1608
|
-
const claudePath =
|
|
1609
|
-
if (
|
|
1610
|
-
const rootPath =
|
|
1611
|
-
if (
|
|
1630
|
+
const claudePath = join8(current, ".claude", "assist.yml");
|
|
1631
|
+
if (existsSync9(claudePath)) return claudePath;
|
|
1632
|
+
const rootPath = join8(current, "assist.yml");
|
|
1633
|
+
if (existsSync9(rootPath)) return rootPath;
|
|
1612
1634
|
current = dirname2(current);
|
|
1613
1635
|
}
|
|
1614
1636
|
return null;
|
|
@@ -1616,10 +1638,10 @@ function findConfigUp(startDir) {
|
|
|
1616
1638
|
function getConfigPath() {
|
|
1617
1639
|
const found = findConfigUp(process.cwd());
|
|
1618
1640
|
if (found) return found;
|
|
1619
|
-
return
|
|
1641
|
+
return join8(process.cwd(), "assist.yml");
|
|
1620
1642
|
}
|
|
1621
1643
|
function getGlobalConfigPath() {
|
|
1622
|
-
return
|
|
1644
|
+
return join8(homedir(), ".assist.yml");
|
|
1623
1645
|
}
|
|
1624
1646
|
function loadConfig() {
|
|
1625
1647
|
const globalRaw = loadRawYaml(getGlobalConfigPath());
|
|
@@ -1634,21 +1656,21 @@ function loadGlobalConfigRaw() {
|
|
|
1634
1656
|
return loadRawYaml(getGlobalConfigPath());
|
|
1635
1657
|
}
|
|
1636
1658
|
function saveGlobalConfig(config) {
|
|
1637
|
-
|
|
1659
|
+
writeFileSync5(getGlobalConfigPath(), stringifyYaml(config, { lineWidth: 0 }));
|
|
1638
1660
|
}
|
|
1639
1661
|
function saveConfig(config) {
|
|
1640
1662
|
const configPath = getConfigPath();
|
|
1641
|
-
|
|
1663
|
+
writeFileSync5(configPath, stringifyYaml(config, { lineWidth: 0 }));
|
|
1642
1664
|
}
|
|
1643
1665
|
function getRepoName() {
|
|
1644
1666
|
const config = loadConfig();
|
|
1645
1667
|
if (config.devlog?.name) {
|
|
1646
1668
|
return config.devlog.name;
|
|
1647
1669
|
}
|
|
1648
|
-
const packageJsonPath =
|
|
1649
|
-
if (
|
|
1670
|
+
const packageJsonPath = join8(process.cwd(), "package.json");
|
|
1671
|
+
if (existsSync9(packageJsonPath)) {
|
|
1650
1672
|
try {
|
|
1651
|
-
const content =
|
|
1673
|
+
const content = readFileSync8(packageJsonPath, "utf-8");
|
|
1652
1674
|
const pkg = JSON.parse(content);
|
|
1653
1675
|
if (pkg.name) {
|
|
1654
1676
|
return pkg.name;
|
|
@@ -1989,10 +2011,10 @@ function findPackageJsonWithVerifyScripts(startDir) {
|
|
|
1989
2011
|
|
|
1990
2012
|
// src/commands/verify/installPackage.ts
|
|
1991
2013
|
import { execSync as execSync3 } from "child_process";
|
|
1992
|
-
import { writeFileSync as
|
|
2014
|
+
import { writeFileSync as writeFileSync6 } from "fs";
|
|
1993
2015
|
import chalk21 from "chalk";
|
|
1994
2016
|
function writePackageJson(filePath, pkg) {
|
|
1995
|
-
|
|
2017
|
+
writeFileSync6(filePath, `${JSON.stringify(pkg, null, 2)}
|
|
1996
2018
|
`);
|
|
1997
2019
|
}
|
|
1998
2020
|
function addScript(pkg, name, command) {
|
|
@@ -2097,23 +2119,23 @@ import * as path3 from "path";
|
|
|
2097
2119
|
import chalk25 from "chalk";
|
|
2098
2120
|
|
|
2099
2121
|
// src/commands/verify/addToKnipIgnoreBinaries.ts
|
|
2100
|
-
import { existsSync as
|
|
2101
|
-
import { join as
|
|
2122
|
+
import { existsSync as existsSync11, readFileSync as readFileSync10, writeFileSync as writeFileSync7 } from "fs";
|
|
2123
|
+
import { join as join10 } from "path";
|
|
2102
2124
|
import chalk24 from "chalk";
|
|
2103
2125
|
function loadKnipConfig(knipJsonPath) {
|
|
2104
|
-
if (
|
|
2105
|
-
return JSON.parse(
|
|
2126
|
+
if (existsSync11(knipJsonPath)) {
|
|
2127
|
+
return JSON.parse(readFileSync10(knipJsonPath, "utf-8"));
|
|
2106
2128
|
}
|
|
2107
2129
|
return { $schema: "https://unpkg.com/knip@5/schema.json" };
|
|
2108
2130
|
}
|
|
2109
2131
|
function addToKnipIgnoreBinaries(cwd, binary) {
|
|
2110
|
-
const knipJsonPath =
|
|
2132
|
+
const knipJsonPath = join10(cwd, "knip.json");
|
|
2111
2133
|
try {
|
|
2112
2134
|
const knipConfig = loadKnipConfig(knipJsonPath);
|
|
2113
2135
|
const ignoreBinaries = knipConfig.ignoreBinaries ?? [];
|
|
2114
2136
|
if (!ignoreBinaries.includes(binary)) {
|
|
2115
2137
|
knipConfig.ignoreBinaries = [...ignoreBinaries, binary];
|
|
2116
|
-
|
|
2138
|
+
writeFileSync7(
|
|
2117
2139
|
knipJsonPath,
|
|
2118
2140
|
`${JSON.stringify(knipConfig, null, " ")}
|
|
2119
2141
|
`
|
|
@@ -2155,8 +2177,8 @@ import chalk29 from "chalk";
|
|
|
2155
2177
|
|
|
2156
2178
|
// src/commands/lint/init.ts
|
|
2157
2179
|
import { execSync as execSync5 } from "child_process";
|
|
2158
|
-
import { existsSync as
|
|
2159
|
-
import { dirname as dirname7, join as
|
|
2180
|
+
import { existsSync as existsSync14, readFileSync as readFileSync12, writeFileSync as writeFileSync9 } from "fs";
|
|
2181
|
+
import { dirname as dirname7, join as join11 } from "path";
|
|
2160
2182
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
2161
2183
|
import chalk28 from "chalk";
|
|
2162
2184
|
|
|
@@ -2181,10 +2203,10 @@ async function promptConfirm(message, initial = true) {
|
|
|
2181
2203
|
|
|
2182
2204
|
// src/shared/removeEslint/index.ts
|
|
2183
2205
|
import { execSync as execSync4 } from "child_process";
|
|
2184
|
-
import { existsSync as
|
|
2206
|
+
import { existsSync as existsSync13, readFileSync as readFileSync11, writeFileSync as writeFileSync8 } from "fs";
|
|
2185
2207
|
|
|
2186
2208
|
// src/shared/removeEslint/removeEslintConfigFiles.ts
|
|
2187
|
-
import { existsSync as
|
|
2209
|
+
import { existsSync as existsSync12, unlinkSync as unlinkSync3 } from "fs";
|
|
2188
2210
|
var ESLINT_CONFIG_FILES = [
|
|
2189
2211
|
"eslint.config.js",
|
|
2190
2212
|
"eslint.config.mjs",
|
|
@@ -2200,7 +2222,7 @@ var ESLINT_CONFIG_FILES = [
|
|
|
2200
2222
|
function removeEslintConfigFiles() {
|
|
2201
2223
|
let removed = false;
|
|
2202
2224
|
for (const configFile of ESLINT_CONFIG_FILES) {
|
|
2203
|
-
if (
|
|
2225
|
+
if (existsSync12(configFile)) {
|
|
2204
2226
|
unlinkSync3(configFile);
|
|
2205
2227
|
console.log(`Removed ${configFile}`);
|
|
2206
2228
|
removed = true;
|
|
@@ -2222,16 +2244,16 @@ function removeEslint(options2 = {}) {
|
|
|
2222
2244
|
}
|
|
2223
2245
|
function removeEslintFromPackageJson(options2) {
|
|
2224
2246
|
const packageJsonPath = "package.json";
|
|
2225
|
-
if (!
|
|
2247
|
+
if (!existsSync13(packageJsonPath)) {
|
|
2226
2248
|
return false;
|
|
2227
2249
|
}
|
|
2228
|
-
const packageJson = JSON.parse(
|
|
2250
|
+
const packageJson = JSON.parse(readFileSync11(packageJsonPath, "utf-8"));
|
|
2229
2251
|
let modified = false;
|
|
2230
2252
|
modified = removeEslintDeps(packageJson.dependencies) || modified;
|
|
2231
2253
|
modified = removeEslintDeps(packageJson.devDependencies) || modified;
|
|
2232
2254
|
modified = removeEslintScripts(packageJson.scripts, options2) || modified;
|
|
2233
2255
|
if (modified) {
|
|
2234
|
-
|
|
2256
|
+
writeFileSync8(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}
|
|
2235
2257
|
`);
|
|
2236
2258
|
console.log("Removed eslint references from package.json");
|
|
2237
2259
|
}
|
|
@@ -2295,17 +2317,17 @@ var __dirname2 = dirname7(fileURLToPath2(import.meta.url));
|
|
|
2295
2317
|
async function init() {
|
|
2296
2318
|
removeEslint();
|
|
2297
2319
|
const biomeConfigPath = "biome.json";
|
|
2298
|
-
if (!
|
|
2320
|
+
if (!existsSync14(biomeConfigPath)) {
|
|
2299
2321
|
console.log("Initializing Biome...");
|
|
2300
2322
|
execSync5("npx @biomejs/biome init", { stdio: "inherit" });
|
|
2301
2323
|
}
|
|
2302
|
-
if (!
|
|
2324
|
+
if (!existsSync14(biomeConfigPath)) {
|
|
2303
2325
|
console.log("No biome.json found, skipping linter config");
|
|
2304
2326
|
return;
|
|
2305
2327
|
}
|
|
2306
|
-
const linterConfigPath =
|
|
2307
|
-
const linterConfig = JSON.parse(
|
|
2308
|
-
const biomeConfig = JSON.parse(
|
|
2328
|
+
const linterConfigPath = join11(__dirname2, "commands/lint/biome.linter.json");
|
|
2329
|
+
const linterConfig = JSON.parse(readFileSync12(linterConfigPath, "utf-8"));
|
|
2330
|
+
const biomeConfig = JSON.parse(readFileSync12(biomeConfigPath, "utf-8"));
|
|
2309
2331
|
const oldContent = `${JSON.stringify(biomeConfig, null, 2)}
|
|
2310
2332
|
`;
|
|
2311
2333
|
biomeConfig.linter = linterConfig.linter;
|
|
@@ -2326,7 +2348,7 @@ async function init() {
|
|
|
2326
2348
|
console.log("Skipped biome.json update");
|
|
2327
2349
|
return;
|
|
2328
2350
|
}
|
|
2329
|
-
|
|
2351
|
+
writeFileSync9(biomeConfigPath, newContent);
|
|
2330
2352
|
console.log("Updated biome.json with linter config");
|
|
2331
2353
|
}
|
|
2332
2354
|
|
|
@@ -3340,11 +3362,11 @@ async function run2(options2 = {}) {
|
|
|
3340
3362
|
|
|
3341
3363
|
// src/commands/new/registerNew/initGit.ts
|
|
3342
3364
|
import { execSync as execSync9 } from "child_process";
|
|
3343
|
-
import { writeFileSync as
|
|
3365
|
+
import { writeFileSync as writeFileSync11 } from "fs";
|
|
3344
3366
|
function initGit() {
|
|
3345
3367
|
console.log("Initializing git repository...");
|
|
3346
3368
|
execSync9("git init", { stdio: "inherit" });
|
|
3347
|
-
|
|
3369
|
+
writeFileSync11(".gitignore", "dist\nnode_modules\n");
|
|
3348
3370
|
}
|
|
3349
3371
|
|
|
3350
3372
|
// src/commands/new/registerNew/newCli/initPackageJson.ts
|
|
@@ -3363,10 +3385,10 @@ function initPackageJson(name) {
|
|
|
3363
3385
|
}
|
|
3364
3386
|
|
|
3365
3387
|
// src/commands/new/registerNew/newCli/writeCliTemplate.ts
|
|
3366
|
-
import { mkdirSync as mkdirSync3, writeFileSync as
|
|
3388
|
+
import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync12 } from "fs";
|
|
3367
3389
|
function writeCliTemplate(name) {
|
|
3368
3390
|
console.log("Writing tsconfig.json...");
|
|
3369
|
-
|
|
3391
|
+
writeFileSync12(
|
|
3370
3392
|
"tsconfig.json",
|
|
3371
3393
|
JSON.stringify(
|
|
3372
3394
|
{
|
|
@@ -3390,7 +3412,7 @@ function writeCliTemplate(name) {
|
|
|
3390
3412
|
)
|
|
3391
3413
|
);
|
|
3392
3414
|
console.log("Writing tsup.config.ts...");
|
|
3393
|
-
|
|
3415
|
+
writeFileSync12(
|
|
3394
3416
|
"tsup.config.ts",
|
|
3395
3417
|
`import { defineConfig } from "tsup";
|
|
3396
3418
|
export default defineConfig({
|
|
@@ -3405,7 +3427,7 @@ export default defineConfig({
|
|
|
3405
3427
|
);
|
|
3406
3428
|
console.log("Writing src/index.ts...");
|
|
3407
3429
|
mkdirSync3("src", { recursive: true });
|
|
3408
|
-
|
|
3430
|
+
writeFileSync12(
|
|
3409
3431
|
"src/index.ts",
|
|
3410
3432
|
`#!/usr/bin/env node
|
|
3411
3433
|
import { Command } from "commander";
|
|
@@ -3433,7 +3455,7 @@ async function newCli() {
|
|
|
3433
3455
|
|
|
3434
3456
|
// src/commands/new/registerNew/newProject.ts
|
|
3435
3457
|
import { execSync as execSync13 } from "child_process";
|
|
3436
|
-
import { existsSync as
|
|
3458
|
+
import { existsSync as existsSync18, readFileSync as readFileSync15, writeFileSync as writeFileSync14 } from "fs";
|
|
3437
3459
|
|
|
3438
3460
|
// src/commands/deploy/init/index.ts
|
|
3439
3461
|
import { execSync as execSync12 } from "child_process";
|
|
@@ -3441,33 +3463,33 @@ import chalk40 from "chalk";
|
|
|
3441
3463
|
import enquirer5 from "enquirer";
|
|
3442
3464
|
|
|
3443
3465
|
// src/commands/deploy/init/updateWorkflow.ts
|
|
3444
|
-
import { existsSync as
|
|
3445
|
-
import { dirname as dirname13, join as
|
|
3466
|
+
import { existsSync as existsSync17, mkdirSync as mkdirSync4, readFileSync as readFileSync14, writeFileSync as writeFileSync13 } from "fs";
|
|
3467
|
+
import { dirname as dirname13, join as join14 } from "path";
|
|
3446
3468
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
3447
3469
|
import chalk39 from "chalk";
|
|
3448
3470
|
var WORKFLOW_PATH = ".github/workflows/build.yml";
|
|
3449
3471
|
var __dirname3 = dirname13(fileURLToPath3(import.meta.url));
|
|
3450
3472
|
function getExistingSiteId() {
|
|
3451
|
-
if (!
|
|
3473
|
+
if (!existsSync17(WORKFLOW_PATH)) {
|
|
3452
3474
|
return null;
|
|
3453
3475
|
}
|
|
3454
|
-
const content =
|
|
3476
|
+
const content = readFileSync14(WORKFLOW_PATH, "utf-8");
|
|
3455
3477
|
const match = content.match(/-s\s+([a-f0-9-]{36})/);
|
|
3456
3478
|
return match ? match[1] : null;
|
|
3457
3479
|
}
|
|
3458
3480
|
function getTemplateContent(siteId) {
|
|
3459
|
-
const templatePath =
|
|
3460
|
-
const template =
|
|
3481
|
+
const templatePath = join14(__dirname3, "commands/deploy/build.yml");
|
|
3482
|
+
const template = readFileSync14(templatePath, "utf-8");
|
|
3461
3483
|
return template.replace("{{NETLIFY_SITE_ID}}", siteId);
|
|
3462
3484
|
}
|
|
3463
3485
|
async function updateWorkflow(siteId) {
|
|
3464
3486
|
const newContent = getTemplateContent(siteId);
|
|
3465
3487
|
const workflowDir = ".github/workflows";
|
|
3466
|
-
if (!
|
|
3488
|
+
if (!existsSync17(workflowDir)) {
|
|
3467
3489
|
mkdirSync4(workflowDir, { recursive: true });
|
|
3468
3490
|
}
|
|
3469
|
-
if (
|
|
3470
|
-
const oldContent =
|
|
3491
|
+
if (existsSync17(WORKFLOW_PATH)) {
|
|
3492
|
+
const oldContent = readFileSync14(WORKFLOW_PATH, "utf-8");
|
|
3471
3493
|
if (oldContent === newContent) {
|
|
3472
3494
|
console.log(chalk39.green("build.yml is already up to date"));
|
|
3473
3495
|
return;
|
|
@@ -3481,7 +3503,7 @@ async function updateWorkflow(siteId) {
|
|
|
3481
3503
|
return;
|
|
3482
3504
|
}
|
|
3483
3505
|
}
|
|
3484
|
-
|
|
3506
|
+
writeFileSync13(WORKFLOW_PATH, newContent);
|
|
3485
3507
|
console.log(chalk39.green(`
|
|
3486
3508
|
Created ${WORKFLOW_PATH}`));
|
|
3487
3509
|
}
|
|
@@ -3561,11 +3583,11 @@ async function newProject() {
|
|
|
3561
3583
|
}
|
|
3562
3584
|
function addViteBaseConfig() {
|
|
3563
3585
|
const viteConfigPath = "vite.config.ts";
|
|
3564
|
-
if (!
|
|
3586
|
+
if (!existsSync18(viteConfigPath)) {
|
|
3565
3587
|
console.log("No vite.config.ts found, skipping base config");
|
|
3566
3588
|
return;
|
|
3567
3589
|
}
|
|
3568
|
-
const content =
|
|
3590
|
+
const content = readFileSync15(viteConfigPath, "utf-8");
|
|
3569
3591
|
if (content.includes("base:")) {
|
|
3570
3592
|
console.log("vite.config.ts already has base config");
|
|
3571
3593
|
return;
|
|
@@ -3575,7 +3597,7 @@ function addViteBaseConfig() {
|
|
|
3575
3597
|
'defineConfig({\n base: "./",'
|
|
3576
3598
|
);
|
|
3577
3599
|
if (updated !== content) {
|
|
3578
|
-
|
|
3600
|
+
writeFileSync14(viteConfigPath, updated);
|
|
3579
3601
|
console.log('Added base: "./" to vite.config.ts');
|
|
3580
3602
|
}
|
|
3581
3603
|
}
|
|
@@ -3747,11 +3769,11 @@ import chalk44 from "chalk";
|
|
|
3747
3769
|
|
|
3748
3770
|
// src/commands/backlog/commitBacklog.ts
|
|
3749
3771
|
import { execSync as execSync14 } from "child_process";
|
|
3750
|
-
import { join as
|
|
3772
|
+
import { join as join15 } from "path";
|
|
3751
3773
|
import chalk43 from "chalk";
|
|
3752
3774
|
function commitBacklog(id, name) {
|
|
3753
3775
|
try {
|
|
3754
|
-
const jsonlPath =
|
|
3776
|
+
const jsonlPath = join15(getBacklogDir(), ".assist", "backlog.jsonl");
|
|
3755
3777
|
const message = `chore: add backlog item #${id} \u2014 ${name}`;
|
|
3756
3778
|
execSync14(`git add ${shellQuote(jsonlPath)}`, { stdio: "ignore" });
|
|
3757
3779
|
execSync14(`git commit -m ${shellQuote(message)}`, { stdio: "ignore" });
|
|
@@ -3762,9 +3784,9 @@ function commitBacklog(id, name) {
|
|
|
3762
3784
|
|
|
3763
3785
|
// src/commands/backlog/add/shared.ts
|
|
3764
3786
|
import { spawnSync } from "child_process";
|
|
3765
|
-
import { mkdtempSync, readFileSync as
|
|
3787
|
+
import { mkdtempSync, readFileSync as readFileSync16, unlinkSync as unlinkSync4, writeFileSync as writeFileSync15 } from "fs";
|
|
3766
3788
|
import { tmpdir } from "os";
|
|
3767
|
-
import { join as
|
|
3789
|
+
import { join as join16 } from "path";
|
|
3768
3790
|
import enquirer6 from "enquirer";
|
|
3769
3791
|
async function promptType() {
|
|
3770
3792
|
const { type } = await enquirer6.prompt({
|
|
@@ -3804,15 +3826,15 @@ async function promptDescription() {
|
|
|
3804
3826
|
}
|
|
3805
3827
|
function openEditor() {
|
|
3806
3828
|
const editor = process.env.EDITOR || process.env.VISUAL || "vi";
|
|
3807
|
-
const dir = mkdtempSync(
|
|
3808
|
-
const filePath =
|
|
3809
|
-
|
|
3829
|
+
const dir = mkdtempSync(join16(tmpdir(), "assist-"));
|
|
3830
|
+
const filePath = join16(dir, "description.md");
|
|
3831
|
+
writeFileSync15(filePath, "");
|
|
3810
3832
|
const result = spawnSync(editor, [filePath], { stdio: "inherit" });
|
|
3811
3833
|
if (result.status !== 0) {
|
|
3812
3834
|
unlinkSync4(filePath);
|
|
3813
3835
|
return void 0;
|
|
3814
3836
|
}
|
|
3815
|
-
const content =
|
|
3837
|
+
const content = readFileSync16(filePath, "utf-8").trim();
|
|
3816
3838
|
unlinkSync4(filePath);
|
|
3817
3839
|
return content || void 0;
|
|
3818
3840
|
}
|
|
@@ -4281,7 +4303,7 @@ function extractGraphqlQuery(args) {
|
|
|
4281
4303
|
}
|
|
4282
4304
|
|
|
4283
4305
|
// src/shared/loadCliReads.ts
|
|
4284
|
-
import { existsSync as
|
|
4306
|
+
import { existsSync as existsSync19, readFileSync as readFileSync17, writeFileSync as writeFileSync16 } from "fs";
|
|
4285
4307
|
import { dirname as dirname14, resolve as resolve2 } from "path";
|
|
4286
4308
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
4287
4309
|
var __filename2 = fileURLToPath4(import.meta.url);
|
|
@@ -4290,8 +4312,8 @@ function packageRoot() {
|
|
|
4290
4312
|
return __dirname4;
|
|
4291
4313
|
}
|
|
4292
4314
|
function readLines(path50) {
|
|
4293
|
-
if (!
|
|
4294
|
-
return
|
|
4315
|
+
if (!existsSync19(path50)) return [];
|
|
4316
|
+
return readFileSync17(path50, "utf-8").split("\n").filter((line) => line.trim() !== "");
|
|
4295
4317
|
}
|
|
4296
4318
|
var cachedReads;
|
|
4297
4319
|
var cachedWrites;
|
|
@@ -4311,7 +4333,7 @@ function loadCliReads() {
|
|
|
4311
4333
|
return getCliReadsLines();
|
|
4312
4334
|
}
|
|
4313
4335
|
function saveCliReads(commands) {
|
|
4314
|
-
|
|
4336
|
+
writeFileSync16(
|
|
4315
4337
|
resolve2(packageRoot(), "allowed.cli-reads"),
|
|
4316
4338
|
`${commands.join("\n")}
|
|
4317
4339
|
`
|
|
@@ -4337,14 +4359,14 @@ function findCliWrite(command) {
|
|
|
4337
4359
|
}
|
|
4338
4360
|
|
|
4339
4361
|
// src/shared/readSettingsPerms.ts
|
|
4340
|
-
import { existsSync as
|
|
4362
|
+
import { existsSync as existsSync20, readFileSync as readFileSync18 } from "fs";
|
|
4341
4363
|
import { homedir as homedir3 } from "os";
|
|
4342
|
-
import { join as
|
|
4364
|
+
import { join as join17 } from "path";
|
|
4343
4365
|
function readSettingsPerms(key) {
|
|
4344
4366
|
const paths = [
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4367
|
+
join17(homedir3(), ".claude", "settings.json"),
|
|
4368
|
+
join17(process.cwd(), ".claude", "settings.json"),
|
|
4369
|
+
join17(process.cwd(), ".claude", "settings.local.json")
|
|
4348
4370
|
];
|
|
4349
4371
|
const entries = [];
|
|
4350
4372
|
for (const p of paths) {
|
|
@@ -4353,9 +4375,9 @@ function readSettingsPerms(key) {
|
|
|
4353
4375
|
return entries;
|
|
4354
4376
|
}
|
|
4355
4377
|
function readPermissionArray(filePath, key) {
|
|
4356
|
-
if (!
|
|
4378
|
+
if (!existsSync20(filePath)) return [];
|
|
4357
4379
|
try {
|
|
4358
|
-
const data = JSON.parse(
|
|
4380
|
+
const data = JSON.parse(readFileSync18(filePath, "utf-8"));
|
|
4359
4381
|
const arr = data?.permissions?.[key];
|
|
4360
4382
|
return Array.isArray(arr) ? arr.filter((e) => typeof e === "string") : [];
|
|
4361
4383
|
} catch {
|
|
@@ -4369,6 +4391,8 @@ var denyCache;
|
|
|
4369
4391
|
var TOOL_RE = /^(Bash|PowerShell)\((.+?)(:.*)?\)$/;
|
|
4370
4392
|
var SHELL_TOOLS = ["Bash", "PowerShell"];
|
|
4371
4393
|
var DOTSLASH_RE = /^\.[\\/]/;
|
|
4394
|
+
var FD_REDIRECT_RE = /\d+>&\d+/g;
|
|
4395
|
+
var FD_DEVNULL_RE = /\d*>\/dev\/null/g;
|
|
4372
4396
|
function loadPerms(key) {
|
|
4373
4397
|
return parsePerms(readSettingsPerms(key));
|
|
4374
4398
|
}
|
|
@@ -4379,7 +4403,7 @@ function shellEntries(map, toolName) {
|
|
|
4379
4403
|
return map.get(toolName) ?? [];
|
|
4380
4404
|
}
|
|
4381
4405
|
function normCmd(cmd) {
|
|
4382
|
-
return cmd.replace(DOTSLASH_RE, "");
|
|
4406
|
+
return cmd.replace(FD_DEVNULL_RE, "").replace(FD_REDIRECT_RE, "").trim().replace(DOTSLASH_RE, "");
|
|
4383
4407
|
}
|
|
4384
4408
|
function findMatch2(entries, command) {
|
|
4385
4409
|
const norm = normCmd(command);
|
|
@@ -4460,8 +4484,8 @@ function hasUnquotedBackticks(command) {
|
|
|
4460
4484
|
// src/shared/splitCompound.ts
|
|
4461
4485
|
var SEPARATOR_OPS = /* @__PURE__ */ new Set(["|", "&&", "||", ";"]);
|
|
4462
4486
|
var UNSAFE_OPS = /* @__PURE__ */ new Set(["(", ")", ">", ">>", "<", "<&", "|&", ">&"]);
|
|
4463
|
-
var
|
|
4464
|
-
var
|
|
4487
|
+
var FD_REDIRECT_RE2 = /\d+>&\d+/g;
|
|
4488
|
+
var FD_DEVNULL_RE2 = /\d*>\/dev\/null/g;
|
|
4465
4489
|
function splitCompound(command) {
|
|
4466
4490
|
const tokens = tokenizeCommand(command);
|
|
4467
4491
|
if (!tokens) return void 0;
|
|
@@ -4471,7 +4495,7 @@ function splitCompound(command) {
|
|
|
4471
4495
|
return result.length > 0 ? result : void 0;
|
|
4472
4496
|
}
|
|
4473
4497
|
function tokenizeCommand(command) {
|
|
4474
|
-
const trimmed = command.trim().replace(
|
|
4498
|
+
const trimmed = command.trim().replace(FD_DEVNULL_RE2, "").replace(FD_REDIRECT_RE2, "");
|
|
4475
4499
|
if (!trimmed) return void 0;
|
|
4476
4500
|
if (hasUnquotedBackticks(trimmed)) return void 0;
|
|
4477
4501
|
try {
|
|
@@ -4649,9 +4673,9 @@ function denyRemove(pattern2) {
|
|
|
4649
4673
|
}
|
|
4650
4674
|
|
|
4651
4675
|
// src/commands/permitCliReads/index.ts
|
|
4652
|
-
import { existsSync as
|
|
4676
|
+
import { existsSync as existsSync21, mkdirSync as mkdirSync5, readFileSync as readFileSync19, writeFileSync as writeFileSync17 } from "fs";
|
|
4653
4677
|
import { homedir as homedir4 } from "os";
|
|
4654
|
-
import { join as
|
|
4678
|
+
import { join as join18 } from "path";
|
|
4655
4679
|
|
|
4656
4680
|
// src/shared/getInstallDir.ts
|
|
4657
4681
|
import { execSync as execSync15 } from "child_process";
|
|
@@ -4953,17 +4977,17 @@ function updateSettings(cli, commands) {
|
|
|
4953
4977
|
// src/commands/permitCliReads/index.ts
|
|
4954
4978
|
function logPath(cli) {
|
|
4955
4979
|
const safeName = cli.replace(/\s+/g, "-");
|
|
4956
|
-
return
|
|
4980
|
+
return join18(homedir4(), ".assist", `cli-discover-${safeName}.log`);
|
|
4957
4981
|
}
|
|
4958
4982
|
function readCache(cli) {
|
|
4959
4983
|
const path50 = logPath(cli);
|
|
4960
|
-
if (!
|
|
4961
|
-
return
|
|
4984
|
+
if (!existsSync21(path50)) return void 0;
|
|
4985
|
+
return readFileSync19(path50, "utf-8");
|
|
4962
4986
|
}
|
|
4963
4987
|
function writeCache(cli, output) {
|
|
4964
|
-
const dir =
|
|
4988
|
+
const dir = join18(homedir4(), ".assist");
|
|
4965
4989
|
mkdirSync5(dir, { recursive: true });
|
|
4966
|
-
|
|
4990
|
+
writeFileSync17(logPath(cli), output);
|
|
4967
4991
|
}
|
|
4968
4992
|
async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
4969
4993
|
if (!cli) {
|
|
@@ -5510,7 +5534,7 @@ function registerComplexity(program2) {
|
|
|
5510
5534
|
}
|
|
5511
5535
|
|
|
5512
5536
|
// src/commands/deploy/redirect.ts
|
|
5513
|
-
import { existsSync as
|
|
5537
|
+
import { existsSync as existsSync22, readFileSync as readFileSync20, writeFileSync as writeFileSync18 } from "fs";
|
|
5514
5538
|
import chalk66 from "chalk";
|
|
5515
5539
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
5516
5540
|
if (!window.location.pathname.endsWith('/')) {
|
|
@@ -5519,11 +5543,11 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
5519
5543
|
</script>`;
|
|
5520
5544
|
function redirect() {
|
|
5521
5545
|
const indexPath = "index.html";
|
|
5522
|
-
if (!
|
|
5546
|
+
if (!existsSync22(indexPath)) {
|
|
5523
5547
|
console.log(chalk66.yellow("No index.html found"));
|
|
5524
5548
|
return;
|
|
5525
5549
|
}
|
|
5526
|
-
const content =
|
|
5550
|
+
const content = readFileSync20(indexPath, "utf-8");
|
|
5527
5551
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
5528
5552
|
console.log(chalk66.dim("Trailing slash script already present"));
|
|
5529
5553
|
return;
|
|
@@ -5534,7 +5558,7 @@ function redirect() {
|
|
|
5534
5558
|
return;
|
|
5535
5559
|
}
|
|
5536
5560
|
const newContent = content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT + "\n " + content.slice(headCloseIndex);
|
|
5537
|
-
|
|
5561
|
+
writeFileSync18(indexPath, newContent);
|
|
5538
5562
|
console.log(chalk66.green("Added trailing slash redirect to index.html"));
|
|
5539
5563
|
}
|
|
5540
5564
|
|
|
@@ -5551,10 +5575,10 @@ import { basename as basename3 } from "path";
|
|
|
5551
5575
|
|
|
5552
5576
|
// src/commands/devlog/loadBlogSkipDays.ts
|
|
5553
5577
|
import { homedir as homedir5 } from "os";
|
|
5554
|
-
import { join as
|
|
5555
|
-
var BLOG_REPO_ROOT =
|
|
5578
|
+
import { join as join19 } from "path";
|
|
5579
|
+
var BLOG_REPO_ROOT = join19(homedir5(), "git/blog");
|
|
5556
5580
|
function loadBlogSkipDays(repoName) {
|
|
5557
|
-
const config = loadRawYaml(
|
|
5581
|
+
const config = loadRawYaml(join19(BLOG_REPO_ROOT, "assist.yml"));
|
|
5558
5582
|
const devlog = config.devlog;
|
|
5559
5583
|
const skip2 = devlog?.skip;
|
|
5560
5584
|
return new Set(skip2?.[repoName] ?? []);
|
|
@@ -5565,9 +5589,9 @@ import { execSync as execSync17 } from "child_process";
|
|
|
5565
5589
|
import chalk67 from "chalk";
|
|
5566
5590
|
|
|
5567
5591
|
// src/commands/devlog/loadDevlogEntries.ts
|
|
5568
|
-
import { readdirSync, readFileSync as
|
|
5569
|
-
import { join as
|
|
5570
|
-
var DEVLOG_DIR =
|
|
5592
|
+
import { readdirSync, readFileSync as readFileSync21 } from "fs";
|
|
5593
|
+
import { join as join20 } from "path";
|
|
5594
|
+
var DEVLOG_DIR = join20(BLOG_REPO_ROOT, "src/content/devlog");
|
|
5571
5595
|
function extractFrontmatter(content) {
|
|
5572
5596
|
const fm = content.match(/^---\n([\s\S]*?)\n---/);
|
|
5573
5597
|
return fm?.[1] ?? null;
|
|
@@ -5595,7 +5619,7 @@ function readDevlogFiles(callback) {
|
|
|
5595
5619
|
try {
|
|
5596
5620
|
const files = readdirSync(DEVLOG_DIR).filter((f) => f.endsWith(".md"));
|
|
5597
5621
|
for (const file of files) {
|
|
5598
|
-
const content =
|
|
5622
|
+
const content = readFileSync21(join20(DEVLOG_DIR, file), "utf-8");
|
|
5599
5623
|
const parsed = parseFrontmatter(content, file);
|
|
5600
5624
|
if (parsed) callback(parsed);
|
|
5601
5625
|
}
|
|
@@ -5981,12 +6005,12 @@ function repos(options2) {
|
|
|
5981
6005
|
}
|
|
5982
6006
|
|
|
5983
6007
|
// src/commands/devlog/skip.ts
|
|
5984
|
-
import { writeFileSync as
|
|
5985
|
-
import { join as
|
|
6008
|
+
import { writeFileSync as writeFileSync19 } from "fs";
|
|
6009
|
+
import { join as join21 } from "path";
|
|
5986
6010
|
import chalk72 from "chalk";
|
|
5987
6011
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
5988
6012
|
function getBlogConfigPath() {
|
|
5989
|
-
return
|
|
6013
|
+
return join21(BLOG_REPO_ROOT, "assist.yml");
|
|
5990
6014
|
}
|
|
5991
6015
|
function skip(date) {
|
|
5992
6016
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
@@ -6010,7 +6034,7 @@ function skip(date) {
|
|
|
6010
6034
|
skip2[repoName] = skipDays;
|
|
6011
6035
|
devlog.skip = skip2;
|
|
6012
6036
|
config.devlog = devlog;
|
|
6013
|
-
|
|
6037
|
+
writeFileSync19(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
6014
6038
|
console.log(chalk72.green(`Added ${date} to skip list for ${repoName}`));
|
|
6015
6039
|
}
|
|
6016
6040
|
|
|
@@ -6047,16 +6071,16 @@ function registerDevlog(program2) {
|
|
|
6047
6071
|
|
|
6048
6072
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
6049
6073
|
import { closeSync, openSync, readdirSync as readdirSync2 } from "fs";
|
|
6050
|
-
import { join as
|
|
6074
|
+
import { join as join22 } from "path";
|
|
6051
6075
|
import chalk74 from "chalk";
|
|
6052
6076
|
|
|
6053
6077
|
// src/shared/findRepoRoot.ts
|
|
6054
|
-
import { existsSync as
|
|
6078
|
+
import { existsSync as existsSync23 } from "fs";
|
|
6055
6079
|
import path21 from "path";
|
|
6056
6080
|
function findRepoRoot(dir) {
|
|
6057
6081
|
let current = dir;
|
|
6058
6082
|
while (current !== path21.dirname(current)) {
|
|
6059
|
-
if (
|
|
6083
|
+
if (existsSync23(path21.join(current, ".git"))) {
|
|
6060
6084
|
return current;
|
|
6061
6085
|
}
|
|
6062
6086
|
current = path21.dirname(current);
|
|
@@ -6075,7 +6099,7 @@ function isLockedDll(debugDir) {
|
|
|
6075
6099
|
}
|
|
6076
6100
|
for (const file of files) {
|
|
6077
6101
|
if (!file.toLowerCase().endsWith(".dll")) continue;
|
|
6078
|
-
const dllPath =
|
|
6102
|
+
const dllPath = join22(debugDir, file);
|
|
6079
6103
|
try {
|
|
6080
6104
|
const fd = openSync(dllPath, "r+");
|
|
6081
6105
|
closeSync(fd);
|
|
@@ -6093,13 +6117,13 @@ function findFirstLockedDll(dir) {
|
|
|
6093
6117
|
return null;
|
|
6094
6118
|
}
|
|
6095
6119
|
if (entries.includes("bin")) {
|
|
6096
|
-
const locked = isLockedDll(
|
|
6120
|
+
const locked = isLockedDll(join22(dir, "bin", "Debug"));
|
|
6097
6121
|
if (locked) return locked;
|
|
6098
6122
|
}
|
|
6099
6123
|
for (const entry of entries) {
|
|
6100
6124
|
if (SKIP_DIRS.has(entry) || entry === "bin" || entry.startsWith("."))
|
|
6101
6125
|
continue;
|
|
6102
|
-
const found = findFirstLockedDll(
|
|
6126
|
+
const found = findFirstLockedDll(join22(dir, entry));
|
|
6103
6127
|
if (found) return found;
|
|
6104
6128
|
}
|
|
6105
6129
|
return null;
|
|
@@ -6122,11 +6146,11 @@ async function checkBuildLocksCommand() {
|
|
|
6122
6146
|
}
|
|
6123
6147
|
|
|
6124
6148
|
// src/commands/dotnet/buildTree.ts
|
|
6125
|
-
import { readFileSync as
|
|
6149
|
+
import { readFileSync as readFileSync22 } from "fs";
|
|
6126
6150
|
import path22 from "path";
|
|
6127
6151
|
var PROJECT_REF_RE = /<ProjectReference\s+Include="([^"]+)"/g;
|
|
6128
6152
|
function getProjectRefs(csprojPath) {
|
|
6129
|
-
const content =
|
|
6153
|
+
const content = readFileSync22(csprojPath, "utf-8");
|
|
6130
6154
|
const refs = [];
|
|
6131
6155
|
for (const match of content.matchAll(PROJECT_REF_RE)) {
|
|
6132
6156
|
refs.push(match[1].replace(/\\/g, "/"));
|
|
@@ -6143,7 +6167,7 @@ function buildTree(csprojPath, repoRoot, visited = /* @__PURE__ */ new Set()) {
|
|
|
6143
6167
|
for (const ref of getProjectRefs(abs)) {
|
|
6144
6168
|
const childAbs = path22.resolve(dir, ref);
|
|
6145
6169
|
try {
|
|
6146
|
-
|
|
6170
|
+
readFileSync22(childAbs);
|
|
6147
6171
|
node.children.push(buildTree(childAbs, repoRoot, visited));
|
|
6148
6172
|
} catch {
|
|
6149
6173
|
node.children.push({
|
|
@@ -6168,7 +6192,7 @@ function collectAllDeps(node) {
|
|
|
6168
6192
|
}
|
|
6169
6193
|
|
|
6170
6194
|
// src/commands/dotnet/findContainingSolutions.ts
|
|
6171
|
-
import { readdirSync as readdirSync3, readFileSync as
|
|
6195
|
+
import { readdirSync as readdirSync3, readFileSync as readFileSync23, statSync as statSync3 } from "fs";
|
|
6172
6196
|
import path23 from "path";
|
|
6173
6197
|
function findSlnFiles(dir, maxDepth, depth = 0) {
|
|
6174
6198
|
if (depth > maxDepth) return [];
|
|
@@ -6203,7 +6227,7 @@ function findContainingSolutions(csprojPath, repoRoot) {
|
|
|
6203
6227
|
const pattern2 = new RegExp(`[\\\\"/]${escapeRegex(csprojBasename)}"`);
|
|
6204
6228
|
for (const sln of slnFiles) {
|
|
6205
6229
|
try {
|
|
6206
|
-
const content =
|
|
6230
|
+
const content = readFileSync23(sln, "utf-8");
|
|
6207
6231
|
if (pattern2.test(content)) {
|
|
6208
6232
|
matches.push(path23.relative(repoRoot, sln));
|
|
6209
6233
|
}
|
|
@@ -6267,12 +6291,12 @@ function printJson(tree, totalCount, solutions) {
|
|
|
6267
6291
|
}
|
|
6268
6292
|
|
|
6269
6293
|
// src/commands/dotnet/resolveCsproj.ts
|
|
6270
|
-
import { existsSync as
|
|
6294
|
+
import { existsSync as existsSync24 } from "fs";
|
|
6271
6295
|
import path24 from "path";
|
|
6272
6296
|
import chalk76 from "chalk";
|
|
6273
6297
|
function resolveCsproj(csprojPath) {
|
|
6274
6298
|
const resolved = path24.resolve(csprojPath);
|
|
6275
|
-
if (!
|
|
6299
|
+
if (!existsSync24(resolved)) {
|
|
6276
6300
|
console.error(chalk76.red(`File not found: ${resolved}`));
|
|
6277
6301
|
process.exit(1);
|
|
6278
6302
|
}
|
|
@@ -6440,17 +6464,17 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
6440
6464
|
}
|
|
6441
6465
|
|
|
6442
6466
|
// src/commands/dotnet/resolveSolution.ts
|
|
6443
|
-
import { existsSync as
|
|
6467
|
+
import { existsSync as existsSync25 } from "fs";
|
|
6444
6468
|
import path25 from "path";
|
|
6445
6469
|
import chalk80 from "chalk";
|
|
6446
6470
|
|
|
6447
6471
|
// src/commands/dotnet/findSolution.ts
|
|
6448
6472
|
import { readdirSync as readdirSync4 } from "fs";
|
|
6449
|
-
import { dirname as dirname16, join as
|
|
6473
|
+
import { dirname as dirname16, join as join23 } from "path";
|
|
6450
6474
|
import chalk79 from "chalk";
|
|
6451
6475
|
function findSlnInDir(dir) {
|
|
6452
6476
|
try {
|
|
6453
|
-
return readdirSync4(dir).filter((f) => f.endsWith(".sln")).map((f) =>
|
|
6477
|
+
return readdirSync4(dir).filter((f) => f.endsWith(".sln")).map((f) => join23(dir, f));
|
|
6454
6478
|
} catch {
|
|
6455
6479
|
return [];
|
|
6456
6480
|
}
|
|
@@ -6481,7 +6505,7 @@ function findSolution() {
|
|
|
6481
6505
|
function resolveSolution(sln) {
|
|
6482
6506
|
if (sln) {
|
|
6483
6507
|
const resolved = path25.resolve(sln);
|
|
6484
|
-
if (!
|
|
6508
|
+
if (!existsSync25(resolved)) {
|
|
6485
6509
|
console.error(chalk80.red(`Solution file not found: ${resolved}`));
|
|
6486
6510
|
process.exit(1);
|
|
6487
6511
|
}
|
|
@@ -6521,7 +6545,7 @@ function parseInspectReport(json) {
|
|
|
6521
6545
|
|
|
6522
6546
|
// src/commands/dotnet/runInspectCode.ts
|
|
6523
6547
|
import { execSync as execSync23 } from "child_process";
|
|
6524
|
-
import { existsSync as
|
|
6548
|
+
import { existsSync as existsSync26, readFileSync as readFileSync24, unlinkSync as unlinkSync5 } from "fs";
|
|
6525
6549
|
import { tmpdir as tmpdir2 } from "os";
|
|
6526
6550
|
import path26 from "path";
|
|
6527
6551
|
import chalk81 from "chalk";
|
|
@@ -6552,11 +6576,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
6552
6576
|
console.error(chalk81.red("jb inspectcode failed"));
|
|
6553
6577
|
process.exit(1);
|
|
6554
6578
|
}
|
|
6555
|
-
if (!
|
|
6579
|
+
if (!existsSync26(reportPath)) {
|
|
6556
6580
|
console.error(chalk81.red("Report file not generated"));
|
|
6557
6581
|
process.exit(1);
|
|
6558
6582
|
}
|
|
6559
|
-
const xml =
|
|
6583
|
+
const xml = readFileSync24(reportPath, "utf-8");
|
|
6560
6584
|
unlinkSync5(reportPath);
|
|
6561
6585
|
return xml;
|
|
6562
6586
|
}
|
|
@@ -6784,20 +6808,20 @@ function acceptanceCriteria(issueKey) {
|
|
|
6784
6808
|
import { execSync as execSync26 } from "child_process";
|
|
6785
6809
|
|
|
6786
6810
|
// src/shared/loadJson.ts
|
|
6787
|
-
import { existsSync as
|
|
6811
|
+
import { existsSync as existsSync27, mkdirSync as mkdirSync6, readFileSync as readFileSync25, writeFileSync as writeFileSync20 } from "fs";
|
|
6788
6812
|
import { homedir as homedir6 } from "os";
|
|
6789
|
-
import { join as
|
|
6813
|
+
import { join as join24 } from "path";
|
|
6790
6814
|
function getStoreDir() {
|
|
6791
|
-
return
|
|
6815
|
+
return join24(homedir6(), ".assist");
|
|
6792
6816
|
}
|
|
6793
6817
|
function getStorePath(filename) {
|
|
6794
|
-
return
|
|
6818
|
+
return join24(getStoreDir(), filename);
|
|
6795
6819
|
}
|
|
6796
6820
|
function loadJson(filename) {
|
|
6797
6821
|
const path50 = getStorePath(filename);
|
|
6798
|
-
if (
|
|
6822
|
+
if (existsSync27(path50)) {
|
|
6799
6823
|
try {
|
|
6800
|
-
return JSON.parse(
|
|
6824
|
+
return JSON.parse(readFileSync25(path50, "utf-8"));
|
|
6801
6825
|
} catch {
|
|
6802
6826
|
return {};
|
|
6803
6827
|
}
|
|
@@ -6806,10 +6830,10 @@ function loadJson(filename) {
|
|
|
6806
6830
|
}
|
|
6807
6831
|
function saveJson(filename, data) {
|
|
6808
6832
|
const dir = getStoreDir();
|
|
6809
|
-
if (!
|
|
6833
|
+
if (!existsSync27(dir)) {
|
|
6810
6834
|
mkdirSync6(dir, { recursive: true });
|
|
6811
6835
|
}
|
|
6812
|
-
|
|
6836
|
+
writeFileSync20(getStorePath(filename), JSON.stringify(data, null, 2));
|
|
6813
6837
|
}
|
|
6814
6838
|
|
|
6815
6839
|
// src/shared/promptInput.ts
|
|
@@ -7121,9 +7145,9 @@ function registerNews(program2) {
|
|
|
7121
7145
|
|
|
7122
7146
|
// src/commands/prs/comment.ts
|
|
7123
7147
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
7124
|
-
import { unlinkSync as unlinkSync6, writeFileSync as
|
|
7148
|
+
import { unlinkSync as unlinkSync6, writeFileSync as writeFileSync21 } from "fs";
|
|
7125
7149
|
import { tmpdir as tmpdir3 } from "os";
|
|
7126
|
-
import { join as
|
|
7150
|
+
import { join as join25 } from "path";
|
|
7127
7151
|
|
|
7128
7152
|
// src/commands/prs/shared.ts
|
|
7129
7153
|
import { execSync as execSync27 } from "child_process";
|
|
@@ -7195,8 +7219,8 @@ function comment2(path50, line, body) {
|
|
|
7195
7219
|
validateLine(line);
|
|
7196
7220
|
try {
|
|
7197
7221
|
const prId = getCurrentPrNodeId();
|
|
7198
|
-
const queryFile =
|
|
7199
|
-
|
|
7222
|
+
const queryFile = join25(tmpdir3(), `gh-query-${Date.now()}.graphql`);
|
|
7223
|
+
writeFileSync21(queryFile, MUTATION);
|
|
7200
7224
|
try {
|
|
7201
7225
|
const result = spawnSync2(
|
|
7202
7226
|
"gh",
|
|
@@ -7238,28 +7262,28 @@ import { execSync as execSync29 } from "child_process";
|
|
|
7238
7262
|
|
|
7239
7263
|
// src/commands/prs/resolveCommentWithReply.ts
|
|
7240
7264
|
import { execSync as execSync28 } from "child_process";
|
|
7241
|
-
import { unlinkSync as unlinkSync8, writeFileSync as
|
|
7265
|
+
import { unlinkSync as unlinkSync8, writeFileSync as writeFileSync22 } from "fs";
|
|
7242
7266
|
import { tmpdir as tmpdir4 } from "os";
|
|
7243
|
-
import { join as
|
|
7267
|
+
import { join as join27 } from "path";
|
|
7244
7268
|
|
|
7245
7269
|
// src/commands/prs/loadCommentsCache.ts
|
|
7246
|
-
import { existsSync as
|
|
7247
|
-
import { join as
|
|
7270
|
+
import { existsSync as existsSync28, readFileSync as readFileSync26, unlinkSync as unlinkSync7 } from "fs";
|
|
7271
|
+
import { join as join26 } from "path";
|
|
7248
7272
|
import { parse as parse2 } from "yaml";
|
|
7249
7273
|
function getCachePath(prNumber) {
|
|
7250
|
-
return
|
|
7274
|
+
return join26(process.cwd(), ".assist", `pr-${prNumber}-comments.yaml`);
|
|
7251
7275
|
}
|
|
7252
7276
|
function loadCommentsCache(prNumber) {
|
|
7253
7277
|
const cachePath = getCachePath(prNumber);
|
|
7254
|
-
if (!
|
|
7278
|
+
if (!existsSync28(cachePath)) {
|
|
7255
7279
|
return null;
|
|
7256
7280
|
}
|
|
7257
|
-
const content =
|
|
7281
|
+
const content = readFileSync26(cachePath, "utf-8");
|
|
7258
7282
|
return parse2(content);
|
|
7259
7283
|
}
|
|
7260
7284
|
function deleteCommentsCache(prNumber) {
|
|
7261
7285
|
const cachePath = getCachePath(prNumber);
|
|
7262
|
-
if (
|
|
7286
|
+
if (existsSync28(cachePath)) {
|
|
7263
7287
|
unlinkSync7(cachePath);
|
|
7264
7288
|
console.log("No more unresolved line comments. Cache dropped.");
|
|
7265
7289
|
}
|
|
@@ -7274,8 +7298,8 @@ function replyToComment(org, repo, prNumber, commentId, message) {
|
|
|
7274
7298
|
}
|
|
7275
7299
|
function resolveThread(threadId) {
|
|
7276
7300
|
const mutation = `mutation($threadId: ID!) { resolveReviewThread(input: {threadId: $threadId}) { thread { isResolved } } }`;
|
|
7277
|
-
const queryFile =
|
|
7278
|
-
|
|
7301
|
+
const queryFile = join27(tmpdir4(), `gh-mutation-${Date.now()}.graphql`);
|
|
7302
|
+
writeFileSync22(queryFile, mutation);
|
|
7279
7303
|
try {
|
|
7280
7304
|
execSync28(
|
|
7281
7305
|
`gh api graphql -F query=@${queryFile} -f threadId="${threadId}"`,
|
|
@@ -7356,19 +7380,19 @@ function fixed(commentId, sha) {
|
|
|
7356
7380
|
}
|
|
7357
7381
|
|
|
7358
7382
|
// src/commands/prs/listComments/index.ts
|
|
7359
|
-
import { existsSync as
|
|
7360
|
-
import { join as
|
|
7383
|
+
import { existsSync as existsSync29, mkdirSync as mkdirSync7, writeFileSync as writeFileSync24 } from "fs";
|
|
7384
|
+
import { join as join29 } from "path";
|
|
7361
7385
|
import { stringify } from "yaml";
|
|
7362
7386
|
|
|
7363
7387
|
// src/commands/prs/fetchThreadIds.ts
|
|
7364
7388
|
import { execSync as execSync30 } from "child_process";
|
|
7365
|
-
import { unlinkSync as unlinkSync9, writeFileSync as
|
|
7389
|
+
import { unlinkSync as unlinkSync9, writeFileSync as writeFileSync23 } from "fs";
|
|
7366
7390
|
import { tmpdir as tmpdir5 } from "os";
|
|
7367
|
-
import { join as
|
|
7391
|
+
import { join as join28 } from "path";
|
|
7368
7392
|
var THREAD_QUERY = `query($owner: String!, $repo: String!, $prNumber: Int!) { repository(owner: $owner, name: $repo) { pullRequest(number: $prNumber) { reviewThreads(first: 100) { nodes { id isResolved comments(first: 100) { nodes { databaseId } } } } } } }`;
|
|
7369
7393
|
function fetchThreadIds(org, repo, prNumber) {
|
|
7370
|
-
const queryFile =
|
|
7371
|
-
|
|
7394
|
+
const queryFile = join28(tmpdir5(), `gh-query-${Date.now()}.graphql`);
|
|
7395
|
+
writeFileSync23(queryFile, THREAD_QUERY);
|
|
7372
7396
|
try {
|
|
7373
7397
|
const result = execSync30(
|
|
7374
7398
|
`gh api graphql -F query=@${queryFile} -F owner="${org}" -F repo="${repo}" -F prNumber=${prNumber}`,
|
|
@@ -7481,8 +7505,8 @@ function printComments2(result) {
|
|
|
7481
7505
|
|
|
7482
7506
|
// src/commands/prs/listComments/index.ts
|
|
7483
7507
|
function writeCommentsCache(prNumber, comments2) {
|
|
7484
|
-
const assistDir =
|
|
7485
|
-
if (!
|
|
7508
|
+
const assistDir = join29(process.cwd(), ".assist");
|
|
7509
|
+
if (!existsSync29(assistDir)) {
|
|
7486
7510
|
mkdirSync7(assistDir, { recursive: true });
|
|
7487
7511
|
}
|
|
7488
7512
|
const cacheData = {
|
|
@@ -7490,8 +7514,8 @@ function writeCommentsCache(prNumber, comments2) {
|
|
|
7490
7514
|
fetchedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
7491
7515
|
comments: comments2
|
|
7492
7516
|
};
|
|
7493
|
-
const cachePath =
|
|
7494
|
-
|
|
7517
|
+
const cachePath = join29(assistDir, `pr-${prNumber}-comments.yaml`);
|
|
7518
|
+
writeFileSync24(cachePath, stringify(cacheData));
|
|
7495
7519
|
}
|
|
7496
7520
|
function handleKnownErrors(error) {
|
|
7497
7521
|
if (isGhNotInstalled(error)) {
|
|
@@ -7523,7 +7547,7 @@ async function listComments() {
|
|
|
7523
7547
|
];
|
|
7524
7548
|
updateCache(prNumber, allComments);
|
|
7525
7549
|
const hasLineComments = allComments.some((c) => c.type === "line");
|
|
7526
|
-
const cachePath = hasLineComments ?
|
|
7550
|
+
const cachePath = hasLineComments ? join29(process.cwd(), ".assist", `pr-${prNumber}-comments.yaml`) : null;
|
|
7527
7551
|
return { comments: allComments, cachePath };
|
|
7528
7552
|
} catch (error) {
|
|
7529
7553
|
const handled = handleKnownErrors(error);
|
|
@@ -9917,8 +9941,8 @@ function registerSeq(program2) {
|
|
|
9917
9941
|
}
|
|
9918
9942
|
|
|
9919
9943
|
// src/commands/transcript/shared.ts
|
|
9920
|
-
import { existsSync as
|
|
9921
|
-
import { basename as basename4, join as
|
|
9944
|
+
import { existsSync as existsSync30, readdirSync as readdirSync5, statSync as statSync4 } from "fs";
|
|
9945
|
+
import { basename as basename4, join as join30, relative } from "path";
|
|
9922
9946
|
import * as readline2 from "readline";
|
|
9923
9947
|
var DATE_PREFIX_REGEX = /^\d{4}-\d{2}-\d{2}/;
|
|
9924
9948
|
function getDatePrefix(daysOffset = 0) {
|
|
@@ -9933,10 +9957,10 @@ function isValidDatePrefix(filename) {
|
|
|
9933
9957
|
return DATE_PREFIX_REGEX.test(filename);
|
|
9934
9958
|
}
|
|
9935
9959
|
function collectFiles(dir, extension) {
|
|
9936
|
-
if (!
|
|
9960
|
+
if (!existsSync30(dir)) return [];
|
|
9937
9961
|
const results = [];
|
|
9938
9962
|
for (const entry of readdirSync5(dir)) {
|
|
9939
|
-
const fullPath =
|
|
9963
|
+
const fullPath = join30(dir, entry);
|
|
9940
9964
|
if (statSync4(fullPath).isDirectory()) {
|
|
9941
9965
|
results.push(...collectFiles(fullPath, extension));
|
|
9942
9966
|
} else if (entry.endsWith(extension)) {
|
|
@@ -10030,14 +10054,14 @@ async function configure() {
|
|
|
10030
10054
|
}
|
|
10031
10055
|
|
|
10032
10056
|
// src/commands/transcript/format/index.ts
|
|
10033
|
-
import { existsSync as
|
|
10057
|
+
import { existsSync as existsSync32 } from "fs";
|
|
10034
10058
|
|
|
10035
10059
|
// src/commands/transcript/format/fixInvalidDatePrefixes/index.ts
|
|
10036
|
-
import { dirname as dirname18, join as
|
|
10060
|
+
import { dirname as dirname18, join as join32 } from "path";
|
|
10037
10061
|
|
|
10038
10062
|
// src/commands/transcript/format/fixInvalidDatePrefixes/promptForDateFix.ts
|
|
10039
10063
|
import { renameSync as renameSync2 } from "fs";
|
|
10040
|
-
import { join as
|
|
10064
|
+
import { join as join31 } from "path";
|
|
10041
10065
|
async function resolveDate(rl, choice) {
|
|
10042
10066
|
if (choice === "1") return getDatePrefix(0);
|
|
10043
10067
|
if (choice === "2") return getDatePrefix(-1);
|
|
@@ -10052,7 +10076,7 @@ async function resolveDate(rl, choice) {
|
|
|
10052
10076
|
}
|
|
10053
10077
|
function renameWithPrefix(vttDir, vttFile, prefix2) {
|
|
10054
10078
|
const newFilename = `${prefix2}.${vttFile}`;
|
|
10055
|
-
renameSync2(
|
|
10079
|
+
renameSync2(join31(vttDir, vttFile), join31(vttDir, newFilename));
|
|
10056
10080
|
console.log(`Renamed to: ${newFilename}`);
|
|
10057
10081
|
return newFilename;
|
|
10058
10082
|
}
|
|
@@ -10086,12 +10110,12 @@ async function fixInvalidDatePrefixes(vttFiles) {
|
|
|
10086
10110
|
const vttFileDir = dirname18(vttFile.absolutePath);
|
|
10087
10111
|
const newFilename = await promptForDateFix(vttFile.filename, vttFileDir);
|
|
10088
10112
|
if (newFilename) {
|
|
10089
|
-
const newRelativePath =
|
|
10113
|
+
const newRelativePath = join32(
|
|
10090
10114
|
dirname18(vttFile.relativePath),
|
|
10091
10115
|
newFilename
|
|
10092
10116
|
);
|
|
10093
10117
|
vttFiles[i] = {
|
|
10094
|
-
absolutePath:
|
|
10118
|
+
absolutePath: join32(vttFileDir, newFilename),
|
|
10095
10119
|
relativePath: newRelativePath,
|
|
10096
10120
|
filename: newFilename
|
|
10097
10121
|
};
|
|
@@ -10104,8 +10128,8 @@ async function fixInvalidDatePrefixes(vttFiles) {
|
|
|
10104
10128
|
}
|
|
10105
10129
|
|
|
10106
10130
|
// src/commands/transcript/format/processVttFile/index.ts
|
|
10107
|
-
import { existsSync as
|
|
10108
|
-
import { basename as basename5, dirname as dirname19, join as
|
|
10131
|
+
import { existsSync as existsSync31, mkdirSync as mkdirSync8, readFileSync as readFileSync27, writeFileSync as writeFileSync25 } from "fs";
|
|
10132
|
+
import { basename as basename5, dirname as dirname19, join as join33 } from "path";
|
|
10109
10133
|
|
|
10110
10134
|
// src/commands/transcript/cleanText.ts
|
|
10111
10135
|
function cleanText(text) {
|
|
@@ -10315,21 +10339,21 @@ function toMdFilename(vttFilename) {
|
|
|
10315
10339
|
return `${basename5(vttFilename, ".vtt").replace(/\s*Transcription\s*/g, " ").trim()}.md`;
|
|
10316
10340
|
}
|
|
10317
10341
|
function resolveOutputDir(relativeDir, transcriptsDir) {
|
|
10318
|
-
return relativeDir === "." ? transcriptsDir :
|
|
10342
|
+
return relativeDir === "." ? transcriptsDir : join33(transcriptsDir, relativeDir);
|
|
10319
10343
|
}
|
|
10320
10344
|
function buildOutputPaths(vttFile, transcriptsDir) {
|
|
10321
10345
|
const mdFile = toMdFilename(vttFile.filename);
|
|
10322
10346
|
const relativeDir = dirname19(vttFile.relativePath);
|
|
10323
10347
|
const outputDir = resolveOutputDir(relativeDir, transcriptsDir);
|
|
10324
|
-
const outputPath =
|
|
10348
|
+
const outputPath = join33(outputDir, mdFile);
|
|
10325
10349
|
return { outputDir, outputPath, mdFile, relativeDir };
|
|
10326
10350
|
}
|
|
10327
10351
|
function logSkipped(relativeDir, mdFile) {
|
|
10328
|
-
console.log(`Skipping (already exists): ${
|
|
10352
|
+
console.log(`Skipping (already exists): ${join33(relativeDir, mdFile)}`);
|
|
10329
10353
|
return "skipped";
|
|
10330
10354
|
}
|
|
10331
10355
|
function ensureDirectory(dir, label2) {
|
|
10332
|
-
if (!
|
|
10356
|
+
if (!existsSync31(dir)) {
|
|
10333
10357
|
mkdirSync8(dir, { recursive: true });
|
|
10334
10358
|
console.log(`Created ${label2}: ${dir}`);
|
|
10335
10359
|
}
|
|
@@ -10352,10 +10376,10 @@ function logReduction(cueCount, messageCount) {
|
|
|
10352
10376
|
}
|
|
10353
10377
|
function readAndParseCues(inputPath) {
|
|
10354
10378
|
console.log(`Reading: ${inputPath}`);
|
|
10355
|
-
return processCues(
|
|
10379
|
+
return processCues(readFileSync27(inputPath, "utf-8"));
|
|
10356
10380
|
}
|
|
10357
10381
|
function writeFormatted(outputPath, content) {
|
|
10358
|
-
|
|
10382
|
+
writeFileSync25(outputPath, content, "utf-8");
|
|
10359
10383
|
console.log(`Written: ${outputPath}`);
|
|
10360
10384
|
}
|
|
10361
10385
|
function convertVttToMarkdown(inputPath, outputPath) {
|
|
@@ -10365,7 +10389,7 @@ function convertVttToMarkdown(inputPath, outputPath) {
|
|
|
10365
10389
|
logReduction(cues.length, chatMessages.length);
|
|
10366
10390
|
}
|
|
10367
10391
|
function tryProcessVtt(vttFile, paths) {
|
|
10368
|
-
if (
|
|
10392
|
+
if (existsSync31(paths.outputPath))
|
|
10369
10393
|
return logSkipped(paths.relativeDir, paths.mdFile);
|
|
10370
10394
|
convertVttToMarkdown(vttFile.absolutePath, paths.outputPath);
|
|
10371
10395
|
return "processed";
|
|
@@ -10391,7 +10415,7 @@ function processAllFiles(vttFiles, transcriptsDir) {
|
|
|
10391
10415
|
logSummary(counts);
|
|
10392
10416
|
}
|
|
10393
10417
|
function requireVttDir(vttDir) {
|
|
10394
|
-
if (!
|
|
10418
|
+
if (!existsSync32(vttDir)) {
|
|
10395
10419
|
console.error(`VTT directory not found: ${vttDir}`);
|
|
10396
10420
|
process.exit(1);
|
|
10397
10421
|
}
|
|
@@ -10423,18 +10447,18 @@ async function format() {
|
|
|
10423
10447
|
}
|
|
10424
10448
|
|
|
10425
10449
|
// src/commands/transcript/summarise/index.ts
|
|
10426
|
-
import { existsSync as
|
|
10427
|
-
import { basename as basename6, dirname as dirname21, join as
|
|
10450
|
+
import { existsSync as existsSync34 } from "fs";
|
|
10451
|
+
import { basename as basename6, dirname as dirname21, join as join35, relative as relative2 } from "path";
|
|
10428
10452
|
|
|
10429
10453
|
// src/commands/transcript/summarise/processStagedFile/index.ts
|
|
10430
10454
|
import {
|
|
10431
|
-
existsSync as
|
|
10455
|
+
existsSync as existsSync33,
|
|
10432
10456
|
mkdirSync as mkdirSync9,
|
|
10433
|
-
readFileSync as
|
|
10457
|
+
readFileSync as readFileSync28,
|
|
10434
10458
|
renameSync as renameSync3,
|
|
10435
10459
|
rmSync
|
|
10436
10460
|
} from "fs";
|
|
10437
|
-
import { dirname as dirname20, join as
|
|
10461
|
+
import { dirname as dirname20, join as join34 } from "path";
|
|
10438
10462
|
|
|
10439
10463
|
// src/commands/transcript/summarise/processStagedFile/validateStagedContent.ts
|
|
10440
10464
|
import chalk120 from "chalk";
|
|
@@ -10463,9 +10487,9 @@ function validateStagedContent(filename, content) {
|
|
|
10463
10487
|
}
|
|
10464
10488
|
|
|
10465
10489
|
// src/commands/transcript/summarise/processStagedFile/index.ts
|
|
10466
|
-
var STAGING_DIR =
|
|
10490
|
+
var STAGING_DIR = join34(process.cwd(), ".assist", "transcript");
|
|
10467
10491
|
function processStagedFile() {
|
|
10468
|
-
if (!
|
|
10492
|
+
if (!existsSync33(STAGING_DIR)) {
|
|
10469
10493
|
return false;
|
|
10470
10494
|
}
|
|
10471
10495
|
const stagedFiles = findMdFilesRecursive(STAGING_DIR);
|
|
@@ -10474,7 +10498,7 @@ function processStagedFile() {
|
|
|
10474
10498
|
}
|
|
10475
10499
|
const { transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
10476
10500
|
const stagedFile = stagedFiles[0];
|
|
10477
|
-
const content =
|
|
10501
|
+
const content = readFileSync28(stagedFile.absolutePath, "utf-8");
|
|
10478
10502
|
validateStagedContent(stagedFile.filename, content);
|
|
10479
10503
|
const stagedBaseName = getTranscriptBaseName(stagedFile.filename);
|
|
10480
10504
|
const transcriptFiles = findMdFilesRecursive(transcriptsDir);
|
|
@@ -10487,9 +10511,9 @@ function processStagedFile() {
|
|
|
10487
10511
|
);
|
|
10488
10512
|
process.exit(1);
|
|
10489
10513
|
}
|
|
10490
|
-
const destPath =
|
|
10514
|
+
const destPath = join34(summaryDir, matchingTranscript.relativePath);
|
|
10491
10515
|
const destDir = dirname20(destPath);
|
|
10492
|
-
if (!
|
|
10516
|
+
if (!existsSync33(destDir)) {
|
|
10493
10517
|
mkdirSync9(destDir, { recursive: true });
|
|
10494
10518
|
}
|
|
10495
10519
|
renameSync3(stagedFile.absolutePath, destPath);
|
|
@@ -10503,7 +10527,7 @@ function processStagedFile() {
|
|
|
10503
10527
|
// src/commands/transcript/summarise/index.ts
|
|
10504
10528
|
function buildRelativeKey(relativePath, baseName) {
|
|
10505
10529
|
const relDir = dirname21(relativePath);
|
|
10506
|
-
return relDir === "." ? baseName :
|
|
10530
|
+
return relDir === "." ? baseName : join35(relDir, baseName);
|
|
10507
10531
|
}
|
|
10508
10532
|
function buildSummaryIndex(summaryDir) {
|
|
10509
10533
|
const summaryFiles = findMdFilesRecursive(summaryDir);
|
|
@@ -10516,7 +10540,7 @@ function buildSummaryIndex(summaryDir) {
|
|
|
10516
10540
|
function summarise2() {
|
|
10517
10541
|
processStagedFile();
|
|
10518
10542
|
const { transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
10519
|
-
if (!
|
|
10543
|
+
if (!existsSync34(transcriptsDir)) {
|
|
10520
10544
|
console.log("No transcripts directory found.");
|
|
10521
10545
|
return;
|
|
10522
10546
|
}
|
|
@@ -10537,8 +10561,8 @@ function summarise2() {
|
|
|
10537
10561
|
}
|
|
10538
10562
|
const next3 = missing[0];
|
|
10539
10563
|
const outputFilename = `${getTranscriptBaseName(next3.filename)}.md`;
|
|
10540
|
-
const outputPath =
|
|
10541
|
-
const summaryFileDir =
|
|
10564
|
+
const outputPath = join35(STAGING_DIR, outputFilename);
|
|
10565
|
+
const summaryFileDir = join35(summaryDir, dirname21(next3.relativePath));
|
|
10542
10566
|
const relativeTranscriptPath = encodeURI(
|
|
10543
10567
|
relative2(summaryFileDir, next3.absolutePath).replace(/\\/g, "/")
|
|
10544
10568
|
);
|
|
@@ -10584,50 +10608,50 @@ function registerVerify(program2) {
|
|
|
10584
10608
|
|
|
10585
10609
|
// src/commands/voice/devices.ts
|
|
10586
10610
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
10587
|
-
import { join as
|
|
10611
|
+
import { join as join37 } from "path";
|
|
10588
10612
|
|
|
10589
10613
|
// src/commands/voice/shared.ts
|
|
10590
10614
|
import { homedir as homedir7 } from "os";
|
|
10591
|
-
import { dirname as dirname22, join as
|
|
10615
|
+
import { dirname as dirname22, join as join36 } from "path";
|
|
10592
10616
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
10593
10617
|
var __dirname6 = dirname22(fileURLToPath6(import.meta.url));
|
|
10594
|
-
var VOICE_DIR =
|
|
10618
|
+
var VOICE_DIR = join36(homedir7(), ".assist", "voice");
|
|
10595
10619
|
var voicePaths = {
|
|
10596
10620
|
dir: VOICE_DIR,
|
|
10597
|
-
pid:
|
|
10598
|
-
log:
|
|
10599
|
-
venv:
|
|
10600
|
-
lock:
|
|
10621
|
+
pid: join36(VOICE_DIR, "voice.pid"),
|
|
10622
|
+
log: join36(VOICE_DIR, "voice.log"),
|
|
10623
|
+
venv: join36(VOICE_DIR, ".venv"),
|
|
10624
|
+
lock: join36(VOICE_DIR, "voice.lock")
|
|
10601
10625
|
};
|
|
10602
10626
|
function getPythonDir() {
|
|
10603
|
-
return
|
|
10627
|
+
return join36(__dirname6, "commands", "voice", "python");
|
|
10604
10628
|
}
|
|
10605
10629
|
function getVenvPython() {
|
|
10606
|
-
return process.platform === "win32" ?
|
|
10630
|
+
return process.platform === "win32" ? join36(voicePaths.venv, "Scripts", "python.exe") : join36(voicePaths.venv, "bin", "python");
|
|
10607
10631
|
}
|
|
10608
10632
|
function getLockDir() {
|
|
10609
10633
|
const config = loadConfig();
|
|
10610
10634
|
return config.voice?.lockDir ?? VOICE_DIR;
|
|
10611
10635
|
}
|
|
10612
10636
|
function getLockFile() {
|
|
10613
|
-
return
|
|
10637
|
+
return join36(getLockDir(), "voice.lock");
|
|
10614
10638
|
}
|
|
10615
10639
|
|
|
10616
10640
|
// src/commands/voice/devices.ts
|
|
10617
10641
|
function devices() {
|
|
10618
|
-
const script =
|
|
10642
|
+
const script = join37(getPythonDir(), "list_devices.py");
|
|
10619
10643
|
spawnSync3(getVenvPython(), [script], { stdio: "inherit" });
|
|
10620
10644
|
}
|
|
10621
10645
|
|
|
10622
10646
|
// src/commands/voice/logs.ts
|
|
10623
|
-
import { existsSync as
|
|
10647
|
+
import { existsSync as existsSync35, readFileSync as readFileSync29 } from "fs";
|
|
10624
10648
|
function logs(options2) {
|
|
10625
|
-
if (!
|
|
10649
|
+
if (!existsSync35(voicePaths.log)) {
|
|
10626
10650
|
console.log("No voice log file found");
|
|
10627
10651
|
return;
|
|
10628
10652
|
}
|
|
10629
10653
|
const count = Number.parseInt(options2.lines ?? "150", 10);
|
|
10630
|
-
const content =
|
|
10654
|
+
const content = readFileSync29(voicePaths.log, "utf-8").trim();
|
|
10631
10655
|
if (!content) {
|
|
10632
10656
|
console.log("Voice log is empty");
|
|
10633
10657
|
return;
|
|
@@ -10650,12 +10674,12 @@ function logs(options2) {
|
|
|
10650
10674
|
// src/commands/voice/setup.ts
|
|
10651
10675
|
import { spawnSync as spawnSync4 } from "child_process";
|
|
10652
10676
|
import { mkdirSync as mkdirSync11 } from "fs";
|
|
10653
|
-
import { join as
|
|
10677
|
+
import { join as join39 } from "path";
|
|
10654
10678
|
|
|
10655
10679
|
// src/commands/voice/checkLockFile.ts
|
|
10656
10680
|
import { execSync as execSync37 } from "child_process";
|
|
10657
|
-
import { existsSync as
|
|
10658
|
-
import { join as
|
|
10681
|
+
import { existsSync as existsSync36, mkdirSync as mkdirSync10, readFileSync as readFileSync30, writeFileSync as writeFileSync26 } from "fs";
|
|
10682
|
+
import { join as join38 } from "path";
|
|
10659
10683
|
function isProcessAlive2(pid) {
|
|
10660
10684
|
try {
|
|
10661
10685
|
process.kill(pid, 0);
|
|
@@ -10666,9 +10690,9 @@ function isProcessAlive2(pid) {
|
|
|
10666
10690
|
}
|
|
10667
10691
|
function checkLockFile() {
|
|
10668
10692
|
const lockFile = getLockFile();
|
|
10669
|
-
if (!
|
|
10693
|
+
if (!existsSync36(lockFile)) return;
|
|
10670
10694
|
try {
|
|
10671
|
-
const lock = JSON.parse(
|
|
10695
|
+
const lock = JSON.parse(readFileSync30(lockFile, "utf-8"));
|
|
10672
10696
|
if (lock.pid && isProcessAlive2(lock.pid)) {
|
|
10673
10697
|
console.error(
|
|
10674
10698
|
`Voice daemon already running (PID ${lock.pid}, env: ${lock.env}). Stop it first with: assist voice stop`
|
|
@@ -10679,7 +10703,7 @@ function checkLockFile() {
|
|
|
10679
10703
|
}
|
|
10680
10704
|
}
|
|
10681
10705
|
function bootstrapVenv() {
|
|
10682
|
-
if (
|
|
10706
|
+
if (existsSync36(getVenvPython())) return;
|
|
10683
10707
|
console.log("Setting up Python environment...");
|
|
10684
10708
|
const pythonDir = getPythonDir();
|
|
10685
10709
|
execSync37(
|
|
@@ -10692,8 +10716,8 @@ function bootstrapVenv() {
|
|
|
10692
10716
|
}
|
|
10693
10717
|
function writeLockFile(pid) {
|
|
10694
10718
|
const lockFile = getLockFile();
|
|
10695
|
-
mkdirSync10(
|
|
10696
|
-
|
|
10719
|
+
mkdirSync10(join38(lockFile, ".."), { recursive: true });
|
|
10720
|
+
writeFileSync26(
|
|
10697
10721
|
lockFile,
|
|
10698
10722
|
JSON.stringify({
|
|
10699
10723
|
pid,
|
|
@@ -10708,7 +10732,7 @@ function setup() {
|
|
|
10708
10732
|
mkdirSync11(voicePaths.dir, { recursive: true });
|
|
10709
10733
|
bootstrapVenv();
|
|
10710
10734
|
console.log("\nDownloading models...\n");
|
|
10711
|
-
const script =
|
|
10735
|
+
const script = join39(getPythonDir(), "setup_models.py");
|
|
10712
10736
|
const result = spawnSync4(getVenvPython(), [script], {
|
|
10713
10737
|
stdio: "inherit",
|
|
10714
10738
|
env: { ...process.env, VOICE_LOG_FILE: voicePaths.log }
|
|
@@ -10721,8 +10745,8 @@ function setup() {
|
|
|
10721
10745
|
|
|
10722
10746
|
// src/commands/voice/start.ts
|
|
10723
10747
|
import { spawn as spawn5 } from "child_process";
|
|
10724
|
-
import { mkdirSync as mkdirSync12, writeFileSync as
|
|
10725
|
-
import { join as
|
|
10748
|
+
import { mkdirSync as mkdirSync12, writeFileSync as writeFileSync27 } from "fs";
|
|
10749
|
+
import { join as join40 } from "path";
|
|
10726
10750
|
|
|
10727
10751
|
// src/commands/voice/buildDaemonEnv.ts
|
|
10728
10752
|
function buildDaemonEnv(options2) {
|
|
@@ -10750,7 +10774,7 @@ function spawnBackground(python, script, env) {
|
|
|
10750
10774
|
console.error("Failed to start voice daemon");
|
|
10751
10775
|
process.exit(1);
|
|
10752
10776
|
}
|
|
10753
|
-
|
|
10777
|
+
writeFileSync27(voicePaths.pid, String(pid));
|
|
10754
10778
|
writeLockFile(pid);
|
|
10755
10779
|
console.log(`Voice daemon started (PID ${pid})`);
|
|
10756
10780
|
}
|
|
@@ -10760,7 +10784,7 @@ function start2(options2) {
|
|
|
10760
10784
|
bootstrapVenv();
|
|
10761
10785
|
const debug = options2.debug || options2.foreground || process.platform === "win32";
|
|
10762
10786
|
const env = buildDaemonEnv({ debug });
|
|
10763
|
-
const script =
|
|
10787
|
+
const script = join40(getPythonDir(), "voice_daemon.py");
|
|
10764
10788
|
const python = getVenvPython();
|
|
10765
10789
|
if (options2.foreground) {
|
|
10766
10790
|
spawnForeground(python, script, env);
|
|
@@ -10770,7 +10794,7 @@ function start2(options2) {
|
|
|
10770
10794
|
}
|
|
10771
10795
|
|
|
10772
10796
|
// src/commands/voice/status.ts
|
|
10773
|
-
import { existsSync as
|
|
10797
|
+
import { existsSync as existsSync37, readFileSync as readFileSync31 } from "fs";
|
|
10774
10798
|
function isProcessAlive3(pid) {
|
|
10775
10799
|
try {
|
|
10776
10800
|
process.kill(pid, 0);
|
|
@@ -10780,16 +10804,16 @@ function isProcessAlive3(pid) {
|
|
|
10780
10804
|
}
|
|
10781
10805
|
}
|
|
10782
10806
|
function readRecentLogs(count) {
|
|
10783
|
-
if (!
|
|
10784
|
-
const lines =
|
|
10807
|
+
if (!existsSync37(voicePaths.log)) return [];
|
|
10808
|
+
const lines = readFileSync31(voicePaths.log, "utf-8").trim().split("\n");
|
|
10785
10809
|
return lines.slice(-count);
|
|
10786
10810
|
}
|
|
10787
10811
|
function status() {
|
|
10788
|
-
if (!
|
|
10812
|
+
if (!existsSync37(voicePaths.pid)) {
|
|
10789
10813
|
console.log("Voice daemon: not running (no PID file)");
|
|
10790
10814
|
return;
|
|
10791
10815
|
}
|
|
10792
|
-
const pid = Number.parseInt(
|
|
10816
|
+
const pid = Number.parseInt(readFileSync31(voicePaths.pid, "utf-8").trim(), 10);
|
|
10793
10817
|
const alive = isProcessAlive3(pid);
|
|
10794
10818
|
console.log(`Voice daemon: ${alive ? "running" : "dead"} (PID ${pid})`);
|
|
10795
10819
|
const recent = readRecentLogs(5);
|
|
@@ -10808,13 +10832,13 @@ function status() {
|
|
|
10808
10832
|
}
|
|
10809
10833
|
|
|
10810
10834
|
// src/commands/voice/stop.ts
|
|
10811
|
-
import { existsSync as
|
|
10835
|
+
import { existsSync as existsSync38, readFileSync as readFileSync32, unlinkSync as unlinkSync10 } from "fs";
|
|
10812
10836
|
function stop() {
|
|
10813
|
-
if (!
|
|
10837
|
+
if (!existsSync38(voicePaths.pid)) {
|
|
10814
10838
|
console.log("Voice daemon is not running (no PID file)");
|
|
10815
10839
|
return;
|
|
10816
10840
|
}
|
|
10817
|
-
const pid = Number.parseInt(
|
|
10841
|
+
const pid = Number.parseInt(readFileSync32(voicePaths.pid, "utf-8").trim(), 10);
|
|
10818
10842
|
try {
|
|
10819
10843
|
process.kill(pid, "SIGTERM");
|
|
10820
10844
|
console.log(`Sent SIGTERM to voice daemon (PID ${pid})`);
|
|
@@ -10827,7 +10851,7 @@ function stop() {
|
|
|
10827
10851
|
}
|
|
10828
10852
|
try {
|
|
10829
10853
|
const lockFile = getLockFile();
|
|
10830
|
-
if (
|
|
10854
|
+
if (existsSync38(lockFile)) unlinkSync10(lockFile);
|
|
10831
10855
|
} catch {
|
|
10832
10856
|
}
|
|
10833
10857
|
console.log("Voice daemon stopped");
|
|
@@ -11048,15 +11072,15 @@ async function auth() {
|
|
|
11048
11072
|
}
|
|
11049
11073
|
|
|
11050
11074
|
// src/commands/roam/showClaudeCodeIcon.ts
|
|
11051
|
-
import { readFileSync as
|
|
11052
|
-
import { join as
|
|
11075
|
+
import { readFileSync as readFileSync33 } from "fs";
|
|
11076
|
+
import { join as join41 } from "path";
|
|
11053
11077
|
async function showClaudeCodeIcon() {
|
|
11054
11078
|
const appData = process.env.APPDATA;
|
|
11055
11079
|
if (!appData) return;
|
|
11056
|
-
const portFile =
|
|
11080
|
+
const portFile = join41(appData, "Roam", "roam-local-api.port");
|
|
11057
11081
|
let port;
|
|
11058
11082
|
try {
|
|
11059
|
-
port =
|
|
11083
|
+
port = readFileSync33(portFile, "utf-8").trim();
|
|
11060
11084
|
} catch {
|
|
11061
11085
|
return;
|
|
11062
11086
|
}
|
|
@@ -11127,8 +11151,8 @@ Done in ${elapsed}`);
|
|
|
11127
11151
|
}
|
|
11128
11152
|
|
|
11129
11153
|
// src/commands/run/add.ts
|
|
11130
|
-
import { mkdirSync as mkdirSync13, writeFileSync as
|
|
11131
|
-
import { join as
|
|
11154
|
+
import { mkdirSync as mkdirSync13, writeFileSync as writeFileSync28 } from "fs";
|
|
11155
|
+
import { join as join42 } from "path";
|
|
11132
11156
|
function findAddIndex() {
|
|
11133
11157
|
const addIndex = process.argv.indexOf("add");
|
|
11134
11158
|
if (addIndex === -1 || addIndex + 2 >= process.argv.length) return -1;
|
|
@@ -11174,7 +11198,7 @@ function saveNewRunConfig(name, command, args) {
|
|
|
11174
11198
|
saveConfig(config);
|
|
11175
11199
|
}
|
|
11176
11200
|
function createCommandFile(name) {
|
|
11177
|
-
const dir =
|
|
11201
|
+
const dir = join42(".claude", "commands");
|
|
11178
11202
|
mkdirSync13(dir, { recursive: true });
|
|
11179
11203
|
const content = `---
|
|
11180
11204
|
description: Run ${name}
|
|
@@ -11182,8 +11206,8 @@ description: Run ${name}
|
|
|
11182
11206
|
|
|
11183
11207
|
Run \`assist run ${name} $ARGUMENTS 2>&1\`.
|
|
11184
11208
|
`;
|
|
11185
|
-
const filePath =
|
|
11186
|
-
|
|
11209
|
+
const filePath = join42(dir, `${name}.md`);
|
|
11210
|
+
writeFileSync28(filePath, content);
|
|
11187
11211
|
console.log(`Created command file: ${filePath}`);
|
|
11188
11212
|
}
|
|
11189
11213
|
function add3() {
|
|
@@ -11253,9 +11277,9 @@ function run3(name, args) {
|
|
|
11253
11277
|
|
|
11254
11278
|
// src/commands/screenshot/index.ts
|
|
11255
11279
|
import { execSync as execSync40 } from "child_process";
|
|
11256
|
-
import { existsSync as
|
|
11280
|
+
import { existsSync as existsSync39, mkdirSync as mkdirSync14, unlinkSync as unlinkSync11, writeFileSync as writeFileSync29 } from "fs";
|
|
11257
11281
|
import { tmpdir as tmpdir6 } from "os";
|
|
11258
|
-
import { join as
|
|
11282
|
+
import { join as join43, resolve as resolve5 } from "path";
|
|
11259
11283
|
import chalk122 from "chalk";
|
|
11260
11284
|
|
|
11261
11285
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
@@ -11385,15 +11409,15 @@ Write-Output $OutputPath
|
|
|
11385
11409
|
|
|
11386
11410
|
// src/commands/screenshot/index.ts
|
|
11387
11411
|
function buildOutputPath(outputDir, processName) {
|
|
11388
|
-
if (!
|
|
11412
|
+
if (!existsSync39(outputDir)) {
|
|
11389
11413
|
mkdirSync14(outputDir, { recursive: true });
|
|
11390
11414
|
}
|
|
11391
11415
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
11392
11416
|
return resolve5(outputDir, `${processName}-${timestamp}.png`);
|
|
11393
11417
|
}
|
|
11394
11418
|
function runPowerShellScript(processName, outputPath) {
|
|
11395
|
-
const scriptPath =
|
|
11396
|
-
|
|
11419
|
+
const scriptPath = join43(tmpdir6(), `assist-screenshot-${Date.now()}.ps1`);
|
|
11420
|
+
writeFileSync29(scriptPath, captureWindowPs1, "utf-8");
|
|
11397
11421
|
try {
|
|
11398
11422
|
execSync40(
|
|
11399
11423
|
`powershell -NoProfile -ExecutionPolicy Bypass -File "${scriptPath}" -ProcessName "${processName}" -OutputPath "${outputPath}"`,
|