@staff0rd/assist 0.174.0 → 0.174.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/dist/index.js +287 -265
- 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.1",
|
|
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 {
|
|
@@ -4649,9 +4671,9 @@ function denyRemove(pattern2) {
|
|
|
4649
4671
|
}
|
|
4650
4672
|
|
|
4651
4673
|
// src/commands/permitCliReads/index.ts
|
|
4652
|
-
import { existsSync as
|
|
4674
|
+
import { existsSync as existsSync21, mkdirSync as mkdirSync5, readFileSync as readFileSync19, writeFileSync as writeFileSync17 } from "fs";
|
|
4653
4675
|
import { homedir as homedir4 } from "os";
|
|
4654
|
-
import { join as
|
|
4676
|
+
import { join as join18 } from "path";
|
|
4655
4677
|
|
|
4656
4678
|
// src/shared/getInstallDir.ts
|
|
4657
4679
|
import { execSync as execSync15 } from "child_process";
|
|
@@ -4953,17 +4975,17 @@ function updateSettings(cli, commands) {
|
|
|
4953
4975
|
// src/commands/permitCliReads/index.ts
|
|
4954
4976
|
function logPath(cli) {
|
|
4955
4977
|
const safeName = cli.replace(/\s+/g, "-");
|
|
4956
|
-
return
|
|
4978
|
+
return join18(homedir4(), ".assist", `cli-discover-${safeName}.log`);
|
|
4957
4979
|
}
|
|
4958
4980
|
function readCache(cli) {
|
|
4959
4981
|
const path50 = logPath(cli);
|
|
4960
|
-
if (!
|
|
4961
|
-
return
|
|
4982
|
+
if (!existsSync21(path50)) return void 0;
|
|
4983
|
+
return readFileSync19(path50, "utf-8");
|
|
4962
4984
|
}
|
|
4963
4985
|
function writeCache(cli, output) {
|
|
4964
|
-
const dir =
|
|
4986
|
+
const dir = join18(homedir4(), ".assist");
|
|
4965
4987
|
mkdirSync5(dir, { recursive: true });
|
|
4966
|
-
|
|
4988
|
+
writeFileSync17(logPath(cli), output);
|
|
4967
4989
|
}
|
|
4968
4990
|
async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
4969
4991
|
if (!cli) {
|
|
@@ -5510,7 +5532,7 @@ function registerComplexity(program2) {
|
|
|
5510
5532
|
}
|
|
5511
5533
|
|
|
5512
5534
|
// src/commands/deploy/redirect.ts
|
|
5513
|
-
import { existsSync as
|
|
5535
|
+
import { existsSync as existsSync22, readFileSync as readFileSync20, writeFileSync as writeFileSync18 } from "fs";
|
|
5514
5536
|
import chalk66 from "chalk";
|
|
5515
5537
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
5516
5538
|
if (!window.location.pathname.endsWith('/')) {
|
|
@@ -5519,11 +5541,11 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
5519
5541
|
</script>`;
|
|
5520
5542
|
function redirect() {
|
|
5521
5543
|
const indexPath = "index.html";
|
|
5522
|
-
if (!
|
|
5544
|
+
if (!existsSync22(indexPath)) {
|
|
5523
5545
|
console.log(chalk66.yellow("No index.html found"));
|
|
5524
5546
|
return;
|
|
5525
5547
|
}
|
|
5526
|
-
const content =
|
|
5548
|
+
const content = readFileSync20(indexPath, "utf-8");
|
|
5527
5549
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
5528
5550
|
console.log(chalk66.dim("Trailing slash script already present"));
|
|
5529
5551
|
return;
|
|
@@ -5534,7 +5556,7 @@ function redirect() {
|
|
|
5534
5556
|
return;
|
|
5535
5557
|
}
|
|
5536
5558
|
const newContent = content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT + "\n " + content.slice(headCloseIndex);
|
|
5537
|
-
|
|
5559
|
+
writeFileSync18(indexPath, newContent);
|
|
5538
5560
|
console.log(chalk66.green("Added trailing slash redirect to index.html"));
|
|
5539
5561
|
}
|
|
5540
5562
|
|
|
@@ -5551,10 +5573,10 @@ import { basename as basename3 } from "path";
|
|
|
5551
5573
|
|
|
5552
5574
|
// src/commands/devlog/loadBlogSkipDays.ts
|
|
5553
5575
|
import { homedir as homedir5 } from "os";
|
|
5554
|
-
import { join as
|
|
5555
|
-
var BLOG_REPO_ROOT =
|
|
5576
|
+
import { join as join19 } from "path";
|
|
5577
|
+
var BLOG_REPO_ROOT = join19(homedir5(), "git/blog");
|
|
5556
5578
|
function loadBlogSkipDays(repoName) {
|
|
5557
|
-
const config = loadRawYaml(
|
|
5579
|
+
const config = loadRawYaml(join19(BLOG_REPO_ROOT, "assist.yml"));
|
|
5558
5580
|
const devlog = config.devlog;
|
|
5559
5581
|
const skip2 = devlog?.skip;
|
|
5560
5582
|
return new Set(skip2?.[repoName] ?? []);
|
|
@@ -5565,9 +5587,9 @@ import { execSync as execSync17 } from "child_process";
|
|
|
5565
5587
|
import chalk67 from "chalk";
|
|
5566
5588
|
|
|
5567
5589
|
// src/commands/devlog/loadDevlogEntries.ts
|
|
5568
|
-
import { readdirSync, readFileSync as
|
|
5569
|
-
import { join as
|
|
5570
|
-
var DEVLOG_DIR =
|
|
5590
|
+
import { readdirSync, readFileSync as readFileSync21 } from "fs";
|
|
5591
|
+
import { join as join20 } from "path";
|
|
5592
|
+
var DEVLOG_DIR = join20(BLOG_REPO_ROOT, "src/content/devlog");
|
|
5571
5593
|
function extractFrontmatter(content) {
|
|
5572
5594
|
const fm = content.match(/^---\n([\s\S]*?)\n---/);
|
|
5573
5595
|
return fm?.[1] ?? null;
|
|
@@ -5595,7 +5617,7 @@ function readDevlogFiles(callback) {
|
|
|
5595
5617
|
try {
|
|
5596
5618
|
const files = readdirSync(DEVLOG_DIR).filter((f) => f.endsWith(".md"));
|
|
5597
5619
|
for (const file of files) {
|
|
5598
|
-
const content =
|
|
5620
|
+
const content = readFileSync21(join20(DEVLOG_DIR, file), "utf-8");
|
|
5599
5621
|
const parsed = parseFrontmatter(content, file);
|
|
5600
5622
|
if (parsed) callback(parsed);
|
|
5601
5623
|
}
|
|
@@ -5981,12 +6003,12 @@ function repos(options2) {
|
|
|
5981
6003
|
}
|
|
5982
6004
|
|
|
5983
6005
|
// src/commands/devlog/skip.ts
|
|
5984
|
-
import { writeFileSync as
|
|
5985
|
-
import { join as
|
|
6006
|
+
import { writeFileSync as writeFileSync19 } from "fs";
|
|
6007
|
+
import { join as join21 } from "path";
|
|
5986
6008
|
import chalk72 from "chalk";
|
|
5987
6009
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
5988
6010
|
function getBlogConfigPath() {
|
|
5989
|
-
return
|
|
6011
|
+
return join21(BLOG_REPO_ROOT, "assist.yml");
|
|
5990
6012
|
}
|
|
5991
6013
|
function skip(date) {
|
|
5992
6014
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
@@ -6010,7 +6032,7 @@ function skip(date) {
|
|
|
6010
6032
|
skip2[repoName] = skipDays;
|
|
6011
6033
|
devlog.skip = skip2;
|
|
6012
6034
|
config.devlog = devlog;
|
|
6013
|
-
|
|
6035
|
+
writeFileSync19(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
6014
6036
|
console.log(chalk72.green(`Added ${date} to skip list for ${repoName}`));
|
|
6015
6037
|
}
|
|
6016
6038
|
|
|
@@ -6047,16 +6069,16 @@ function registerDevlog(program2) {
|
|
|
6047
6069
|
|
|
6048
6070
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
6049
6071
|
import { closeSync, openSync, readdirSync as readdirSync2 } from "fs";
|
|
6050
|
-
import { join as
|
|
6072
|
+
import { join as join22 } from "path";
|
|
6051
6073
|
import chalk74 from "chalk";
|
|
6052
6074
|
|
|
6053
6075
|
// src/shared/findRepoRoot.ts
|
|
6054
|
-
import { existsSync as
|
|
6076
|
+
import { existsSync as existsSync23 } from "fs";
|
|
6055
6077
|
import path21 from "path";
|
|
6056
6078
|
function findRepoRoot(dir) {
|
|
6057
6079
|
let current = dir;
|
|
6058
6080
|
while (current !== path21.dirname(current)) {
|
|
6059
|
-
if (
|
|
6081
|
+
if (existsSync23(path21.join(current, ".git"))) {
|
|
6060
6082
|
return current;
|
|
6061
6083
|
}
|
|
6062
6084
|
current = path21.dirname(current);
|
|
@@ -6075,7 +6097,7 @@ function isLockedDll(debugDir) {
|
|
|
6075
6097
|
}
|
|
6076
6098
|
for (const file of files) {
|
|
6077
6099
|
if (!file.toLowerCase().endsWith(".dll")) continue;
|
|
6078
|
-
const dllPath =
|
|
6100
|
+
const dllPath = join22(debugDir, file);
|
|
6079
6101
|
try {
|
|
6080
6102
|
const fd = openSync(dllPath, "r+");
|
|
6081
6103
|
closeSync(fd);
|
|
@@ -6093,13 +6115,13 @@ function findFirstLockedDll(dir) {
|
|
|
6093
6115
|
return null;
|
|
6094
6116
|
}
|
|
6095
6117
|
if (entries.includes("bin")) {
|
|
6096
|
-
const locked = isLockedDll(
|
|
6118
|
+
const locked = isLockedDll(join22(dir, "bin", "Debug"));
|
|
6097
6119
|
if (locked) return locked;
|
|
6098
6120
|
}
|
|
6099
6121
|
for (const entry of entries) {
|
|
6100
6122
|
if (SKIP_DIRS.has(entry) || entry === "bin" || entry.startsWith("."))
|
|
6101
6123
|
continue;
|
|
6102
|
-
const found = findFirstLockedDll(
|
|
6124
|
+
const found = findFirstLockedDll(join22(dir, entry));
|
|
6103
6125
|
if (found) return found;
|
|
6104
6126
|
}
|
|
6105
6127
|
return null;
|
|
@@ -6122,11 +6144,11 @@ async function checkBuildLocksCommand() {
|
|
|
6122
6144
|
}
|
|
6123
6145
|
|
|
6124
6146
|
// src/commands/dotnet/buildTree.ts
|
|
6125
|
-
import { readFileSync as
|
|
6147
|
+
import { readFileSync as readFileSync22 } from "fs";
|
|
6126
6148
|
import path22 from "path";
|
|
6127
6149
|
var PROJECT_REF_RE = /<ProjectReference\s+Include="([^"]+)"/g;
|
|
6128
6150
|
function getProjectRefs(csprojPath) {
|
|
6129
|
-
const content =
|
|
6151
|
+
const content = readFileSync22(csprojPath, "utf-8");
|
|
6130
6152
|
const refs = [];
|
|
6131
6153
|
for (const match of content.matchAll(PROJECT_REF_RE)) {
|
|
6132
6154
|
refs.push(match[1].replace(/\\/g, "/"));
|
|
@@ -6143,7 +6165,7 @@ function buildTree(csprojPath, repoRoot, visited = /* @__PURE__ */ new Set()) {
|
|
|
6143
6165
|
for (const ref of getProjectRefs(abs)) {
|
|
6144
6166
|
const childAbs = path22.resolve(dir, ref);
|
|
6145
6167
|
try {
|
|
6146
|
-
|
|
6168
|
+
readFileSync22(childAbs);
|
|
6147
6169
|
node.children.push(buildTree(childAbs, repoRoot, visited));
|
|
6148
6170
|
} catch {
|
|
6149
6171
|
node.children.push({
|
|
@@ -6168,7 +6190,7 @@ function collectAllDeps(node) {
|
|
|
6168
6190
|
}
|
|
6169
6191
|
|
|
6170
6192
|
// src/commands/dotnet/findContainingSolutions.ts
|
|
6171
|
-
import { readdirSync as readdirSync3, readFileSync as
|
|
6193
|
+
import { readdirSync as readdirSync3, readFileSync as readFileSync23, statSync as statSync3 } from "fs";
|
|
6172
6194
|
import path23 from "path";
|
|
6173
6195
|
function findSlnFiles(dir, maxDepth, depth = 0) {
|
|
6174
6196
|
if (depth > maxDepth) return [];
|
|
@@ -6203,7 +6225,7 @@ function findContainingSolutions(csprojPath, repoRoot) {
|
|
|
6203
6225
|
const pattern2 = new RegExp(`[\\\\"/]${escapeRegex(csprojBasename)}"`);
|
|
6204
6226
|
for (const sln of slnFiles) {
|
|
6205
6227
|
try {
|
|
6206
|
-
const content =
|
|
6228
|
+
const content = readFileSync23(sln, "utf-8");
|
|
6207
6229
|
if (pattern2.test(content)) {
|
|
6208
6230
|
matches.push(path23.relative(repoRoot, sln));
|
|
6209
6231
|
}
|
|
@@ -6267,12 +6289,12 @@ function printJson(tree, totalCount, solutions) {
|
|
|
6267
6289
|
}
|
|
6268
6290
|
|
|
6269
6291
|
// src/commands/dotnet/resolveCsproj.ts
|
|
6270
|
-
import { existsSync as
|
|
6292
|
+
import { existsSync as existsSync24 } from "fs";
|
|
6271
6293
|
import path24 from "path";
|
|
6272
6294
|
import chalk76 from "chalk";
|
|
6273
6295
|
function resolveCsproj(csprojPath) {
|
|
6274
6296
|
const resolved = path24.resolve(csprojPath);
|
|
6275
|
-
if (!
|
|
6297
|
+
if (!existsSync24(resolved)) {
|
|
6276
6298
|
console.error(chalk76.red(`File not found: ${resolved}`));
|
|
6277
6299
|
process.exit(1);
|
|
6278
6300
|
}
|
|
@@ -6440,17 +6462,17 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
6440
6462
|
}
|
|
6441
6463
|
|
|
6442
6464
|
// src/commands/dotnet/resolveSolution.ts
|
|
6443
|
-
import { existsSync as
|
|
6465
|
+
import { existsSync as existsSync25 } from "fs";
|
|
6444
6466
|
import path25 from "path";
|
|
6445
6467
|
import chalk80 from "chalk";
|
|
6446
6468
|
|
|
6447
6469
|
// src/commands/dotnet/findSolution.ts
|
|
6448
6470
|
import { readdirSync as readdirSync4 } from "fs";
|
|
6449
|
-
import { dirname as dirname16, join as
|
|
6471
|
+
import { dirname as dirname16, join as join23 } from "path";
|
|
6450
6472
|
import chalk79 from "chalk";
|
|
6451
6473
|
function findSlnInDir(dir) {
|
|
6452
6474
|
try {
|
|
6453
|
-
return readdirSync4(dir).filter((f) => f.endsWith(".sln")).map((f) =>
|
|
6475
|
+
return readdirSync4(dir).filter((f) => f.endsWith(".sln")).map((f) => join23(dir, f));
|
|
6454
6476
|
} catch {
|
|
6455
6477
|
return [];
|
|
6456
6478
|
}
|
|
@@ -6481,7 +6503,7 @@ function findSolution() {
|
|
|
6481
6503
|
function resolveSolution(sln) {
|
|
6482
6504
|
if (sln) {
|
|
6483
6505
|
const resolved = path25.resolve(sln);
|
|
6484
|
-
if (!
|
|
6506
|
+
if (!existsSync25(resolved)) {
|
|
6485
6507
|
console.error(chalk80.red(`Solution file not found: ${resolved}`));
|
|
6486
6508
|
process.exit(1);
|
|
6487
6509
|
}
|
|
@@ -6521,7 +6543,7 @@ function parseInspectReport(json) {
|
|
|
6521
6543
|
|
|
6522
6544
|
// src/commands/dotnet/runInspectCode.ts
|
|
6523
6545
|
import { execSync as execSync23 } from "child_process";
|
|
6524
|
-
import { existsSync as
|
|
6546
|
+
import { existsSync as existsSync26, readFileSync as readFileSync24, unlinkSync as unlinkSync5 } from "fs";
|
|
6525
6547
|
import { tmpdir as tmpdir2 } from "os";
|
|
6526
6548
|
import path26 from "path";
|
|
6527
6549
|
import chalk81 from "chalk";
|
|
@@ -6552,11 +6574,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
6552
6574
|
console.error(chalk81.red("jb inspectcode failed"));
|
|
6553
6575
|
process.exit(1);
|
|
6554
6576
|
}
|
|
6555
|
-
if (!
|
|
6577
|
+
if (!existsSync26(reportPath)) {
|
|
6556
6578
|
console.error(chalk81.red("Report file not generated"));
|
|
6557
6579
|
process.exit(1);
|
|
6558
6580
|
}
|
|
6559
|
-
const xml =
|
|
6581
|
+
const xml = readFileSync24(reportPath, "utf-8");
|
|
6560
6582
|
unlinkSync5(reportPath);
|
|
6561
6583
|
return xml;
|
|
6562
6584
|
}
|
|
@@ -6784,20 +6806,20 @@ function acceptanceCriteria(issueKey) {
|
|
|
6784
6806
|
import { execSync as execSync26 } from "child_process";
|
|
6785
6807
|
|
|
6786
6808
|
// src/shared/loadJson.ts
|
|
6787
|
-
import { existsSync as
|
|
6809
|
+
import { existsSync as existsSync27, mkdirSync as mkdirSync6, readFileSync as readFileSync25, writeFileSync as writeFileSync20 } from "fs";
|
|
6788
6810
|
import { homedir as homedir6 } from "os";
|
|
6789
|
-
import { join as
|
|
6811
|
+
import { join as join24 } from "path";
|
|
6790
6812
|
function getStoreDir() {
|
|
6791
|
-
return
|
|
6813
|
+
return join24(homedir6(), ".assist");
|
|
6792
6814
|
}
|
|
6793
6815
|
function getStorePath(filename) {
|
|
6794
|
-
return
|
|
6816
|
+
return join24(getStoreDir(), filename);
|
|
6795
6817
|
}
|
|
6796
6818
|
function loadJson(filename) {
|
|
6797
6819
|
const path50 = getStorePath(filename);
|
|
6798
|
-
if (
|
|
6820
|
+
if (existsSync27(path50)) {
|
|
6799
6821
|
try {
|
|
6800
|
-
return JSON.parse(
|
|
6822
|
+
return JSON.parse(readFileSync25(path50, "utf-8"));
|
|
6801
6823
|
} catch {
|
|
6802
6824
|
return {};
|
|
6803
6825
|
}
|
|
@@ -6806,10 +6828,10 @@ function loadJson(filename) {
|
|
|
6806
6828
|
}
|
|
6807
6829
|
function saveJson(filename, data) {
|
|
6808
6830
|
const dir = getStoreDir();
|
|
6809
|
-
if (!
|
|
6831
|
+
if (!existsSync27(dir)) {
|
|
6810
6832
|
mkdirSync6(dir, { recursive: true });
|
|
6811
6833
|
}
|
|
6812
|
-
|
|
6834
|
+
writeFileSync20(getStorePath(filename), JSON.stringify(data, null, 2));
|
|
6813
6835
|
}
|
|
6814
6836
|
|
|
6815
6837
|
// src/shared/promptInput.ts
|
|
@@ -7121,9 +7143,9 @@ function registerNews(program2) {
|
|
|
7121
7143
|
|
|
7122
7144
|
// src/commands/prs/comment.ts
|
|
7123
7145
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
7124
|
-
import { unlinkSync as unlinkSync6, writeFileSync as
|
|
7146
|
+
import { unlinkSync as unlinkSync6, writeFileSync as writeFileSync21 } from "fs";
|
|
7125
7147
|
import { tmpdir as tmpdir3 } from "os";
|
|
7126
|
-
import { join as
|
|
7148
|
+
import { join as join25 } from "path";
|
|
7127
7149
|
|
|
7128
7150
|
// src/commands/prs/shared.ts
|
|
7129
7151
|
import { execSync as execSync27 } from "child_process";
|
|
@@ -7195,8 +7217,8 @@ function comment2(path50, line, body) {
|
|
|
7195
7217
|
validateLine(line);
|
|
7196
7218
|
try {
|
|
7197
7219
|
const prId = getCurrentPrNodeId();
|
|
7198
|
-
const queryFile =
|
|
7199
|
-
|
|
7220
|
+
const queryFile = join25(tmpdir3(), `gh-query-${Date.now()}.graphql`);
|
|
7221
|
+
writeFileSync21(queryFile, MUTATION);
|
|
7200
7222
|
try {
|
|
7201
7223
|
const result = spawnSync2(
|
|
7202
7224
|
"gh",
|
|
@@ -7238,28 +7260,28 @@ import { execSync as execSync29 } from "child_process";
|
|
|
7238
7260
|
|
|
7239
7261
|
// src/commands/prs/resolveCommentWithReply.ts
|
|
7240
7262
|
import { execSync as execSync28 } from "child_process";
|
|
7241
|
-
import { unlinkSync as unlinkSync8, writeFileSync as
|
|
7263
|
+
import { unlinkSync as unlinkSync8, writeFileSync as writeFileSync22 } from "fs";
|
|
7242
7264
|
import { tmpdir as tmpdir4 } from "os";
|
|
7243
|
-
import { join as
|
|
7265
|
+
import { join as join27 } from "path";
|
|
7244
7266
|
|
|
7245
7267
|
// src/commands/prs/loadCommentsCache.ts
|
|
7246
|
-
import { existsSync as
|
|
7247
|
-
import { join as
|
|
7268
|
+
import { existsSync as existsSync28, readFileSync as readFileSync26, unlinkSync as unlinkSync7 } from "fs";
|
|
7269
|
+
import { join as join26 } from "path";
|
|
7248
7270
|
import { parse as parse2 } from "yaml";
|
|
7249
7271
|
function getCachePath(prNumber) {
|
|
7250
|
-
return
|
|
7272
|
+
return join26(process.cwd(), ".assist", `pr-${prNumber}-comments.yaml`);
|
|
7251
7273
|
}
|
|
7252
7274
|
function loadCommentsCache(prNumber) {
|
|
7253
7275
|
const cachePath = getCachePath(prNumber);
|
|
7254
|
-
if (!
|
|
7276
|
+
if (!existsSync28(cachePath)) {
|
|
7255
7277
|
return null;
|
|
7256
7278
|
}
|
|
7257
|
-
const content =
|
|
7279
|
+
const content = readFileSync26(cachePath, "utf-8");
|
|
7258
7280
|
return parse2(content);
|
|
7259
7281
|
}
|
|
7260
7282
|
function deleteCommentsCache(prNumber) {
|
|
7261
7283
|
const cachePath = getCachePath(prNumber);
|
|
7262
|
-
if (
|
|
7284
|
+
if (existsSync28(cachePath)) {
|
|
7263
7285
|
unlinkSync7(cachePath);
|
|
7264
7286
|
console.log("No more unresolved line comments. Cache dropped.");
|
|
7265
7287
|
}
|
|
@@ -7274,8 +7296,8 @@ function replyToComment(org, repo, prNumber, commentId, message) {
|
|
|
7274
7296
|
}
|
|
7275
7297
|
function resolveThread(threadId) {
|
|
7276
7298
|
const mutation = `mutation($threadId: ID!) { resolveReviewThread(input: {threadId: $threadId}) { thread { isResolved } } }`;
|
|
7277
|
-
const queryFile =
|
|
7278
|
-
|
|
7299
|
+
const queryFile = join27(tmpdir4(), `gh-mutation-${Date.now()}.graphql`);
|
|
7300
|
+
writeFileSync22(queryFile, mutation);
|
|
7279
7301
|
try {
|
|
7280
7302
|
execSync28(
|
|
7281
7303
|
`gh api graphql -F query=@${queryFile} -f threadId="${threadId}"`,
|
|
@@ -7356,19 +7378,19 @@ function fixed(commentId, sha) {
|
|
|
7356
7378
|
}
|
|
7357
7379
|
|
|
7358
7380
|
// src/commands/prs/listComments/index.ts
|
|
7359
|
-
import { existsSync as
|
|
7360
|
-
import { join as
|
|
7381
|
+
import { existsSync as existsSync29, mkdirSync as mkdirSync7, writeFileSync as writeFileSync24 } from "fs";
|
|
7382
|
+
import { join as join29 } from "path";
|
|
7361
7383
|
import { stringify } from "yaml";
|
|
7362
7384
|
|
|
7363
7385
|
// src/commands/prs/fetchThreadIds.ts
|
|
7364
7386
|
import { execSync as execSync30 } from "child_process";
|
|
7365
|
-
import { unlinkSync as unlinkSync9, writeFileSync as
|
|
7387
|
+
import { unlinkSync as unlinkSync9, writeFileSync as writeFileSync23 } from "fs";
|
|
7366
7388
|
import { tmpdir as tmpdir5 } from "os";
|
|
7367
|
-
import { join as
|
|
7389
|
+
import { join as join28 } from "path";
|
|
7368
7390
|
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
7391
|
function fetchThreadIds(org, repo, prNumber) {
|
|
7370
|
-
const queryFile =
|
|
7371
|
-
|
|
7392
|
+
const queryFile = join28(tmpdir5(), `gh-query-${Date.now()}.graphql`);
|
|
7393
|
+
writeFileSync23(queryFile, THREAD_QUERY);
|
|
7372
7394
|
try {
|
|
7373
7395
|
const result = execSync30(
|
|
7374
7396
|
`gh api graphql -F query=@${queryFile} -F owner="${org}" -F repo="${repo}" -F prNumber=${prNumber}`,
|
|
@@ -7481,8 +7503,8 @@ function printComments2(result) {
|
|
|
7481
7503
|
|
|
7482
7504
|
// src/commands/prs/listComments/index.ts
|
|
7483
7505
|
function writeCommentsCache(prNumber, comments2) {
|
|
7484
|
-
const assistDir =
|
|
7485
|
-
if (!
|
|
7506
|
+
const assistDir = join29(process.cwd(), ".assist");
|
|
7507
|
+
if (!existsSync29(assistDir)) {
|
|
7486
7508
|
mkdirSync7(assistDir, { recursive: true });
|
|
7487
7509
|
}
|
|
7488
7510
|
const cacheData = {
|
|
@@ -7490,8 +7512,8 @@ function writeCommentsCache(prNumber, comments2) {
|
|
|
7490
7512
|
fetchedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
7491
7513
|
comments: comments2
|
|
7492
7514
|
};
|
|
7493
|
-
const cachePath =
|
|
7494
|
-
|
|
7515
|
+
const cachePath = join29(assistDir, `pr-${prNumber}-comments.yaml`);
|
|
7516
|
+
writeFileSync24(cachePath, stringify(cacheData));
|
|
7495
7517
|
}
|
|
7496
7518
|
function handleKnownErrors(error) {
|
|
7497
7519
|
if (isGhNotInstalled(error)) {
|
|
@@ -7523,7 +7545,7 @@ async function listComments() {
|
|
|
7523
7545
|
];
|
|
7524
7546
|
updateCache(prNumber, allComments);
|
|
7525
7547
|
const hasLineComments = allComments.some((c) => c.type === "line");
|
|
7526
|
-
const cachePath = hasLineComments ?
|
|
7548
|
+
const cachePath = hasLineComments ? join29(process.cwd(), ".assist", `pr-${prNumber}-comments.yaml`) : null;
|
|
7527
7549
|
return { comments: allComments, cachePath };
|
|
7528
7550
|
} catch (error) {
|
|
7529
7551
|
const handled = handleKnownErrors(error);
|
|
@@ -9917,8 +9939,8 @@ function registerSeq(program2) {
|
|
|
9917
9939
|
}
|
|
9918
9940
|
|
|
9919
9941
|
// src/commands/transcript/shared.ts
|
|
9920
|
-
import { existsSync as
|
|
9921
|
-
import { basename as basename4, join as
|
|
9942
|
+
import { existsSync as existsSync30, readdirSync as readdirSync5, statSync as statSync4 } from "fs";
|
|
9943
|
+
import { basename as basename4, join as join30, relative } from "path";
|
|
9922
9944
|
import * as readline2 from "readline";
|
|
9923
9945
|
var DATE_PREFIX_REGEX = /^\d{4}-\d{2}-\d{2}/;
|
|
9924
9946
|
function getDatePrefix(daysOffset = 0) {
|
|
@@ -9933,10 +9955,10 @@ function isValidDatePrefix(filename) {
|
|
|
9933
9955
|
return DATE_PREFIX_REGEX.test(filename);
|
|
9934
9956
|
}
|
|
9935
9957
|
function collectFiles(dir, extension) {
|
|
9936
|
-
if (!
|
|
9958
|
+
if (!existsSync30(dir)) return [];
|
|
9937
9959
|
const results = [];
|
|
9938
9960
|
for (const entry of readdirSync5(dir)) {
|
|
9939
|
-
const fullPath =
|
|
9961
|
+
const fullPath = join30(dir, entry);
|
|
9940
9962
|
if (statSync4(fullPath).isDirectory()) {
|
|
9941
9963
|
results.push(...collectFiles(fullPath, extension));
|
|
9942
9964
|
} else if (entry.endsWith(extension)) {
|
|
@@ -10030,14 +10052,14 @@ async function configure() {
|
|
|
10030
10052
|
}
|
|
10031
10053
|
|
|
10032
10054
|
// src/commands/transcript/format/index.ts
|
|
10033
|
-
import { existsSync as
|
|
10055
|
+
import { existsSync as existsSync32 } from "fs";
|
|
10034
10056
|
|
|
10035
10057
|
// src/commands/transcript/format/fixInvalidDatePrefixes/index.ts
|
|
10036
|
-
import { dirname as dirname18, join as
|
|
10058
|
+
import { dirname as dirname18, join as join32 } from "path";
|
|
10037
10059
|
|
|
10038
10060
|
// src/commands/transcript/format/fixInvalidDatePrefixes/promptForDateFix.ts
|
|
10039
10061
|
import { renameSync as renameSync2 } from "fs";
|
|
10040
|
-
import { join as
|
|
10062
|
+
import { join as join31 } from "path";
|
|
10041
10063
|
async function resolveDate(rl, choice) {
|
|
10042
10064
|
if (choice === "1") return getDatePrefix(0);
|
|
10043
10065
|
if (choice === "2") return getDatePrefix(-1);
|
|
@@ -10052,7 +10074,7 @@ async function resolveDate(rl, choice) {
|
|
|
10052
10074
|
}
|
|
10053
10075
|
function renameWithPrefix(vttDir, vttFile, prefix2) {
|
|
10054
10076
|
const newFilename = `${prefix2}.${vttFile}`;
|
|
10055
|
-
renameSync2(
|
|
10077
|
+
renameSync2(join31(vttDir, vttFile), join31(vttDir, newFilename));
|
|
10056
10078
|
console.log(`Renamed to: ${newFilename}`);
|
|
10057
10079
|
return newFilename;
|
|
10058
10080
|
}
|
|
@@ -10086,12 +10108,12 @@ async function fixInvalidDatePrefixes(vttFiles) {
|
|
|
10086
10108
|
const vttFileDir = dirname18(vttFile.absolutePath);
|
|
10087
10109
|
const newFilename = await promptForDateFix(vttFile.filename, vttFileDir);
|
|
10088
10110
|
if (newFilename) {
|
|
10089
|
-
const newRelativePath =
|
|
10111
|
+
const newRelativePath = join32(
|
|
10090
10112
|
dirname18(vttFile.relativePath),
|
|
10091
10113
|
newFilename
|
|
10092
10114
|
);
|
|
10093
10115
|
vttFiles[i] = {
|
|
10094
|
-
absolutePath:
|
|
10116
|
+
absolutePath: join32(vttFileDir, newFilename),
|
|
10095
10117
|
relativePath: newRelativePath,
|
|
10096
10118
|
filename: newFilename
|
|
10097
10119
|
};
|
|
@@ -10104,8 +10126,8 @@ async function fixInvalidDatePrefixes(vttFiles) {
|
|
|
10104
10126
|
}
|
|
10105
10127
|
|
|
10106
10128
|
// src/commands/transcript/format/processVttFile/index.ts
|
|
10107
|
-
import { existsSync as
|
|
10108
|
-
import { basename as basename5, dirname as dirname19, join as
|
|
10129
|
+
import { existsSync as existsSync31, mkdirSync as mkdirSync8, readFileSync as readFileSync27, writeFileSync as writeFileSync25 } from "fs";
|
|
10130
|
+
import { basename as basename5, dirname as dirname19, join as join33 } from "path";
|
|
10109
10131
|
|
|
10110
10132
|
// src/commands/transcript/cleanText.ts
|
|
10111
10133
|
function cleanText(text) {
|
|
@@ -10315,21 +10337,21 @@ function toMdFilename(vttFilename) {
|
|
|
10315
10337
|
return `${basename5(vttFilename, ".vtt").replace(/\s*Transcription\s*/g, " ").trim()}.md`;
|
|
10316
10338
|
}
|
|
10317
10339
|
function resolveOutputDir(relativeDir, transcriptsDir) {
|
|
10318
|
-
return relativeDir === "." ? transcriptsDir :
|
|
10340
|
+
return relativeDir === "." ? transcriptsDir : join33(transcriptsDir, relativeDir);
|
|
10319
10341
|
}
|
|
10320
10342
|
function buildOutputPaths(vttFile, transcriptsDir) {
|
|
10321
10343
|
const mdFile = toMdFilename(vttFile.filename);
|
|
10322
10344
|
const relativeDir = dirname19(vttFile.relativePath);
|
|
10323
10345
|
const outputDir = resolveOutputDir(relativeDir, transcriptsDir);
|
|
10324
|
-
const outputPath =
|
|
10346
|
+
const outputPath = join33(outputDir, mdFile);
|
|
10325
10347
|
return { outputDir, outputPath, mdFile, relativeDir };
|
|
10326
10348
|
}
|
|
10327
10349
|
function logSkipped(relativeDir, mdFile) {
|
|
10328
|
-
console.log(`Skipping (already exists): ${
|
|
10350
|
+
console.log(`Skipping (already exists): ${join33(relativeDir, mdFile)}`);
|
|
10329
10351
|
return "skipped";
|
|
10330
10352
|
}
|
|
10331
10353
|
function ensureDirectory(dir, label2) {
|
|
10332
|
-
if (!
|
|
10354
|
+
if (!existsSync31(dir)) {
|
|
10333
10355
|
mkdirSync8(dir, { recursive: true });
|
|
10334
10356
|
console.log(`Created ${label2}: ${dir}`);
|
|
10335
10357
|
}
|
|
@@ -10352,10 +10374,10 @@ function logReduction(cueCount, messageCount) {
|
|
|
10352
10374
|
}
|
|
10353
10375
|
function readAndParseCues(inputPath) {
|
|
10354
10376
|
console.log(`Reading: ${inputPath}`);
|
|
10355
|
-
return processCues(
|
|
10377
|
+
return processCues(readFileSync27(inputPath, "utf-8"));
|
|
10356
10378
|
}
|
|
10357
10379
|
function writeFormatted(outputPath, content) {
|
|
10358
|
-
|
|
10380
|
+
writeFileSync25(outputPath, content, "utf-8");
|
|
10359
10381
|
console.log(`Written: ${outputPath}`);
|
|
10360
10382
|
}
|
|
10361
10383
|
function convertVttToMarkdown(inputPath, outputPath) {
|
|
@@ -10365,7 +10387,7 @@ function convertVttToMarkdown(inputPath, outputPath) {
|
|
|
10365
10387
|
logReduction(cues.length, chatMessages.length);
|
|
10366
10388
|
}
|
|
10367
10389
|
function tryProcessVtt(vttFile, paths) {
|
|
10368
|
-
if (
|
|
10390
|
+
if (existsSync31(paths.outputPath))
|
|
10369
10391
|
return logSkipped(paths.relativeDir, paths.mdFile);
|
|
10370
10392
|
convertVttToMarkdown(vttFile.absolutePath, paths.outputPath);
|
|
10371
10393
|
return "processed";
|
|
@@ -10391,7 +10413,7 @@ function processAllFiles(vttFiles, transcriptsDir) {
|
|
|
10391
10413
|
logSummary(counts);
|
|
10392
10414
|
}
|
|
10393
10415
|
function requireVttDir(vttDir) {
|
|
10394
|
-
if (!
|
|
10416
|
+
if (!existsSync32(vttDir)) {
|
|
10395
10417
|
console.error(`VTT directory not found: ${vttDir}`);
|
|
10396
10418
|
process.exit(1);
|
|
10397
10419
|
}
|
|
@@ -10423,18 +10445,18 @@ async function format() {
|
|
|
10423
10445
|
}
|
|
10424
10446
|
|
|
10425
10447
|
// src/commands/transcript/summarise/index.ts
|
|
10426
|
-
import { existsSync as
|
|
10427
|
-
import { basename as basename6, dirname as dirname21, join as
|
|
10448
|
+
import { existsSync as existsSync34 } from "fs";
|
|
10449
|
+
import { basename as basename6, dirname as dirname21, join as join35, relative as relative2 } from "path";
|
|
10428
10450
|
|
|
10429
10451
|
// src/commands/transcript/summarise/processStagedFile/index.ts
|
|
10430
10452
|
import {
|
|
10431
|
-
existsSync as
|
|
10453
|
+
existsSync as existsSync33,
|
|
10432
10454
|
mkdirSync as mkdirSync9,
|
|
10433
|
-
readFileSync as
|
|
10455
|
+
readFileSync as readFileSync28,
|
|
10434
10456
|
renameSync as renameSync3,
|
|
10435
10457
|
rmSync
|
|
10436
10458
|
} from "fs";
|
|
10437
|
-
import { dirname as dirname20, join as
|
|
10459
|
+
import { dirname as dirname20, join as join34 } from "path";
|
|
10438
10460
|
|
|
10439
10461
|
// src/commands/transcript/summarise/processStagedFile/validateStagedContent.ts
|
|
10440
10462
|
import chalk120 from "chalk";
|
|
@@ -10463,9 +10485,9 @@ function validateStagedContent(filename, content) {
|
|
|
10463
10485
|
}
|
|
10464
10486
|
|
|
10465
10487
|
// src/commands/transcript/summarise/processStagedFile/index.ts
|
|
10466
|
-
var STAGING_DIR =
|
|
10488
|
+
var STAGING_DIR = join34(process.cwd(), ".assist", "transcript");
|
|
10467
10489
|
function processStagedFile() {
|
|
10468
|
-
if (!
|
|
10490
|
+
if (!existsSync33(STAGING_DIR)) {
|
|
10469
10491
|
return false;
|
|
10470
10492
|
}
|
|
10471
10493
|
const stagedFiles = findMdFilesRecursive(STAGING_DIR);
|
|
@@ -10474,7 +10496,7 @@ function processStagedFile() {
|
|
|
10474
10496
|
}
|
|
10475
10497
|
const { transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
10476
10498
|
const stagedFile = stagedFiles[0];
|
|
10477
|
-
const content =
|
|
10499
|
+
const content = readFileSync28(stagedFile.absolutePath, "utf-8");
|
|
10478
10500
|
validateStagedContent(stagedFile.filename, content);
|
|
10479
10501
|
const stagedBaseName = getTranscriptBaseName(stagedFile.filename);
|
|
10480
10502
|
const transcriptFiles = findMdFilesRecursive(transcriptsDir);
|
|
@@ -10487,9 +10509,9 @@ function processStagedFile() {
|
|
|
10487
10509
|
);
|
|
10488
10510
|
process.exit(1);
|
|
10489
10511
|
}
|
|
10490
|
-
const destPath =
|
|
10512
|
+
const destPath = join34(summaryDir, matchingTranscript.relativePath);
|
|
10491
10513
|
const destDir = dirname20(destPath);
|
|
10492
|
-
if (!
|
|
10514
|
+
if (!existsSync33(destDir)) {
|
|
10493
10515
|
mkdirSync9(destDir, { recursive: true });
|
|
10494
10516
|
}
|
|
10495
10517
|
renameSync3(stagedFile.absolutePath, destPath);
|
|
@@ -10503,7 +10525,7 @@ function processStagedFile() {
|
|
|
10503
10525
|
// src/commands/transcript/summarise/index.ts
|
|
10504
10526
|
function buildRelativeKey(relativePath, baseName) {
|
|
10505
10527
|
const relDir = dirname21(relativePath);
|
|
10506
|
-
return relDir === "." ? baseName :
|
|
10528
|
+
return relDir === "." ? baseName : join35(relDir, baseName);
|
|
10507
10529
|
}
|
|
10508
10530
|
function buildSummaryIndex(summaryDir) {
|
|
10509
10531
|
const summaryFiles = findMdFilesRecursive(summaryDir);
|
|
@@ -10516,7 +10538,7 @@ function buildSummaryIndex(summaryDir) {
|
|
|
10516
10538
|
function summarise2() {
|
|
10517
10539
|
processStagedFile();
|
|
10518
10540
|
const { transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
10519
|
-
if (!
|
|
10541
|
+
if (!existsSync34(transcriptsDir)) {
|
|
10520
10542
|
console.log("No transcripts directory found.");
|
|
10521
10543
|
return;
|
|
10522
10544
|
}
|
|
@@ -10537,8 +10559,8 @@ function summarise2() {
|
|
|
10537
10559
|
}
|
|
10538
10560
|
const next3 = missing[0];
|
|
10539
10561
|
const outputFilename = `${getTranscriptBaseName(next3.filename)}.md`;
|
|
10540
|
-
const outputPath =
|
|
10541
|
-
const summaryFileDir =
|
|
10562
|
+
const outputPath = join35(STAGING_DIR, outputFilename);
|
|
10563
|
+
const summaryFileDir = join35(summaryDir, dirname21(next3.relativePath));
|
|
10542
10564
|
const relativeTranscriptPath = encodeURI(
|
|
10543
10565
|
relative2(summaryFileDir, next3.absolutePath).replace(/\\/g, "/")
|
|
10544
10566
|
);
|
|
@@ -10584,50 +10606,50 @@ function registerVerify(program2) {
|
|
|
10584
10606
|
|
|
10585
10607
|
// src/commands/voice/devices.ts
|
|
10586
10608
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
10587
|
-
import { join as
|
|
10609
|
+
import { join as join37 } from "path";
|
|
10588
10610
|
|
|
10589
10611
|
// src/commands/voice/shared.ts
|
|
10590
10612
|
import { homedir as homedir7 } from "os";
|
|
10591
|
-
import { dirname as dirname22, join as
|
|
10613
|
+
import { dirname as dirname22, join as join36 } from "path";
|
|
10592
10614
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
10593
10615
|
var __dirname6 = dirname22(fileURLToPath6(import.meta.url));
|
|
10594
|
-
var VOICE_DIR =
|
|
10616
|
+
var VOICE_DIR = join36(homedir7(), ".assist", "voice");
|
|
10595
10617
|
var voicePaths = {
|
|
10596
10618
|
dir: VOICE_DIR,
|
|
10597
|
-
pid:
|
|
10598
|
-
log:
|
|
10599
|
-
venv:
|
|
10600
|
-
lock:
|
|
10619
|
+
pid: join36(VOICE_DIR, "voice.pid"),
|
|
10620
|
+
log: join36(VOICE_DIR, "voice.log"),
|
|
10621
|
+
venv: join36(VOICE_DIR, ".venv"),
|
|
10622
|
+
lock: join36(VOICE_DIR, "voice.lock")
|
|
10601
10623
|
};
|
|
10602
10624
|
function getPythonDir() {
|
|
10603
|
-
return
|
|
10625
|
+
return join36(__dirname6, "commands", "voice", "python");
|
|
10604
10626
|
}
|
|
10605
10627
|
function getVenvPython() {
|
|
10606
|
-
return process.platform === "win32" ?
|
|
10628
|
+
return process.platform === "win32" ? join36(voicePaths.venv, "Scripts", "python.exe") : join36(voicePaths.venv, "bin", "python");
|
|
10607
10629
|
}
|
|
10608
10630
|
function getLockDir() {
|
|
10609
10631
|
const config = loadConfig();
|
|
10610
10632
|
return config.voice?.lockDir ?? VOICE_DIR;
|
|
10611
10633
|
}
|
|
10612
10634
|
function getLockFile() {
|
|
10613
|
-
return
|
|
10635
|
+
return join36(getLockDir(), "voice.lock");
|
|
10614
10636
|
}
|
|
10615
10637
|
|
|
10616
10638
|
// src/commands/voice/devices.ts
|
|
10617
10639
|
function devices() {
|
|
10618
|
-
const script =
|
|
10640
|
+
const script = join37(getPythonDir(), "list_devices.py");
|
|
10619
10641
|
spawnSync3(getVenvPython(), [script], { stdio: "inherit" });
|
|
10620
10642
|
}
|
|
10621
10643
|
|
|
10622
10644
|
// src/commands/voice/logs.ts
|
|
10623
|
-
import { existsSync as
|
|
10645
|
+
import { existsSync as existsSync35, readFileSync as readFileSync29 } from "fs";
|
|
10624
10646
|
function logs(options2) {
|
|
10625
|
-
if (!
|
|
10647
|
+
if (!existsSync35(voicePaths.log)) {
|
|
10626
10648
|
console.log("No voice log file found");
|
|
10627
10649
|
return;
|
|
10628
10650
|
}
|
|
10629
10651
|
const count = Number.parseInt(options2.lines ?? "150", 10);
|
|
10630
|
-
const content =
|
|
10652
|
+
const content = readFileSync29(voicePaths.log, "utf-8").trim();
|
|
10631
10653
|
if (!content) {
|
|
10632
10654
|
console.log("Voice log is empty");
|
|
10633
10655
|
return;
|
|
@@ -10650,12 +10672,12 @@ function logs(options2) {
|
|
|
10650
10672
|
// src/commands/voice/setup.ts
|
|
10651
10673
|
import { spawnSync as spawnSync4 } from "child_process";
|
|
10652
10674
|
import { mkdirSync as mkdirSync11 } from "fs";
|
|
10653
|
-
import { join as
|
|
10675
|
+
import { join as join39 } from "path";
|
|
10654
10676
|
|
|
10655
10677
|
// src/commands/voice/checkLockFile.ts
|
|
10656
10678
|
import { execSync as execSync37 } from "child_process";
|
|
10657
|
-
import { existsSync as
|
|
10658
|
-
import { join as
|
|
10679
|
+
import { existsSync as existsSync36, mkdirSync as mkdirSync10, readFileSync as readFileSync30, writeFileSync as writeFileSync26 } from "fs";
|
|
10680
|
+
import { join as join38 } from "path";
|
|
10659
10681
|
function isProcessAlive2(pid) {
|
|
10660
10682
|
try {
|
|
10661
10683
|
process.kill(pid, 0);
|
|
@@ -10666,9 +10688,9 @@ function isProcessAlive2(pid) {
|
|
|
10666
10688
|
}
|
|
10667
10689
|
function checkLockFile() {
|
|
10668
10690
|
const lockFile = getLockFile();
|
|
10669
|
-
if (!
|
|
10691
|
+
if (!existsSync36(lockFile)) return;
|
|
10670
10692
|
try {
|
|
10671
|
-
const lock = JSON.parse(
|
|
10693
|
+
const lock = JSON.parse(readFileSync30(lockFile, "utf-8"));
|
|
10672
10694
|
if (lock.pid && isProcessAlive2(lock.pid)) {
|
|
10673
10695
|
console.error(
|
|
10674
10696
|
`Voice daemon already running (PID ${lock.pid}, env: ${lock.env}). Stop it first with: assist voice stop`
|
|
@@ -10679,7 +10701,7 @@ function checkLockFile() {
|
|
|
10679
10701
|
}
|
|
10680
10702
|
}
|
|
10681
10703
|
function bootstrapVenv() {
|
|
10682
|
-
if (
|
|
10704
|
+
if (existsSync36(getVenvPython())) return;
|
|
10683
10705
|
console.log("Setting up Python environment...");
|
|
10684
10706
|
const pythonDir = getPythonDir();
|
|
10685
10707
|
execSync37(
|
|
@@ -10692,8 +10714,8 @@ function bootstrapVenv() {
|
|
|
10692
10714
|
}
|
|
10693
10715
|
function writeLockFile(pid) {
|
|
10694
10716
|
const lockFile = getLockFile();
|
|
10695
|
-
mkdirSync10(
|
|
10696
|
-
|
|
10717
|
+
mkdirSync10(join38(lockFile, ".."), { recursive: true });
|
|
10718
|
+
writeFileSync26(
|
|
10697
10719
|
lockFile,
|
|
10698
10720
|
JSON.stringify({
|
|
10699
10721
|
pid,
|
|
@@ -10708,7 +10730,7 @@ function setup() {
|
|
|
10708
10730
|
mkdirSync11(voicePaths.dir, { recursive: true });
|
|
10709
10731
|
bootstrapVenv();
|
|
10710
10732
|
console.log("\nDownloading models...\n");
|
|
10711
|
-
const script =
|
|
10733
|
+
const script = join39(getPythonDir(), "setup_models.py");
|
|
10712
10734
|
const result = spawnSync4(getVenvPython(), [script], {
|
|
10713
10735
|
stdio: "inherit",
|
|
10714
10736
|
env: { ...process.env, VOICE_LOG_FILE: voicePaths.log }
|
|
@@ -10721,8 +10743,8 @@ function setup() {
|
|
|
10721
10743
|
|
|
10722
10744
|
// src/commands/voice/start.ts
|
|
10723
10745
|
import { spawn as spawn5 } from "child_process";
|
|
10724
|
-
import { mkdirSync as mkdirSync12, writeFileSync as
|
|
10725
|
-
import { join as
|
|
10746
|
+
import { mkdirSync as mkdirSync12, writeFileSync as writeFileSync27 } from "fs";
|
|
10747
|
+
import { join as join40 } from "path";
|
|
10726
10748
|
|
|
10727
10749
|
// src/commands/voice/buildDaemonEnv.ts
|
|
10728
10750
|
function buildDaemonEnv(options2) {
|
|
@@ -10750,7 +10772,7 @@ function spawnBackground(python, script, env) {
|
|
|
10750
10772
|
console.error("Failed to start voice daemon");
|
|
10751
10773
|
process.exit(1);
|
|
10752
10774
|
}
|
|
10753
|
-
|
|
10775
|
+
writeFileSync27(voicePaths.pid, String(pid));
|
|
10754
10776
|
writeLockFile(pid);
|
|
10755
10777
|
console.log(`Voice daemon started (PID ${pid})`);
|
|
10756
10778
|
}
|
|
@@ -10760,7 +10782,7 @@ function start2(options2) {
|
|
|
10760
10782
|
bootstrapVenv();
|
|
10761
10783
|
const debug = options2.debug || options2.foreground || process.platform === "win32";
|
|
10762
10784
|
const env = buildDaemonEnv({ debug });
|
|
10763
|
-
const script =
|
|
10785
|
+
const script = join40(getPythonDir(), "voice_daemon.py");
|
|
10764
10786
|
const python = getVenvPython();
|
|
10765
10787
|
if (options2.foreground) {
|
|
10766
10788
|
spawnForeground(python, script, env);
|
|
@@ -10770,7 +10792,7 @@ function start2(options2) {
|
|
|
10770
10792
|
}
|
|
10771
10793
|
|
|
10772
10794
|
// src/commands/voice/status.ts
|
|
10773
|
-
import { existsSync as
|
|
10795
|
+
import { existsSync as existsSync37, readFileSync as readFileSync31 } from "fs";
|
|
10774
10796
|
function isProcessAlive3(pid) {
|
|
10775
10797
|
try {
|
|
10776
10798
|
process.kill(pid, 0);
|
|
@@ -10780,16 +10802,16 @@ function isProcessAlive3(pid) {
|
|
|
10780
10802
|
}
|
|
10781
10803
|
}
|
|
10782
10804
|
function readRecentLogs(count) {
|
|
10783
|
-
if (!
|
|
10784
|
-
const lines =
|
|
10805
|
+
if (!existsSync37(voicePaths.log)) return [];
|
|
10806
|
+
const lines = readFileSync31(voicePaths.log, "utf-8").trim().split("\n");
|
|
10785
10807
|
return lines.slice(-count);
|
|
10786
10808
|
}
|
|
10787
10809
|
function status() {
|
|
10788
|
-
if (!
|
|
10810
|
+
if (!existsSync37(voicePaths.pid)) {
|
|
10789
10811
|
console.log("Voice daemon: not running (no PID file)");
|
|
10790
10812
|
return;
|
|
10791
10813
|
}
|
|
10792
|
-
const pid = Number.parseInt(
|
|
10814
|
+
const pid = Number.parseInt(readFileSync31(voicePaths.pid, "utf-8").trim(), 10);
|
|
10793
10815
|
const alive = isProcessAlive3(pid);
|
|
10794
10816
|
console.log(`Voice daemon: ${alive ? "running" : "dead"} (PID ${pid})`);
|
|
10795
10817
|
const recent = readRecentLogs(5);
|
|
@@ -10808,13 +10830,13 @@ function status() {
|
|
|
10808
10830
|
}
|
|
10809
10831
|
|
|
10810
10832
|
// src/commands/voice/stop.ts
|
|
10811
|
-
import { existsSync as
|
|
10833
|
+
import { existsSync as existsSync38, readFileSync as readFileSync32, unlinkSync as unlinkSync10 } from "fs";
|
|
10812
10834
|
function stop() {
|
|
10813
|
-
if (!
|
|
10835
|
+
if (!existsSync38(voicePaths.pid)) {
|
|
10814
10836
|
console.log("Voice daemon is not running (no PID file)");
|
|
10815
10837
|
return;
|
|
10816
10838
|
}
|
|
10817
|
-
const pid = Number.parseInt(
|
|
10839
|
+
const pid = Number.parseInt(readFileSync32(voicePaths.pid, "utf-8").trim(), 10);
|
|
10818
10840
|
try {
|
|
10819
10841
|
process.kill(pid, "SIGTERM");
|
|
10820
10842
|
console.log(`Sent SIGTERM to voice daemon (PID ${pid})`);
|
|
@@ -10827,7 +10849,7 @@ function stop() {
|
|
|
10827
10849
|
}
|
|
10828
10850
|
try {
|
|
10829
10851
|
const lockFile = getLockFile();
|
|
10830
|
-
if (
|
|
10852
|
+
if (existsSync38(lockFile)) unlinkSync10(lockFile);
|
|
10831
10853
|
} catch {
|
|
10832
10854
|
}
|
|
10833
10855
|
console.log("Voice daemon stopped");
|
|
@@ -11048,15 +11070,15 @@ async function auth() {
|
|
|
11048
11070
|
}
|
|
11049
11071
|
|
|
11050
11072
|
// src/commands/roam/showClaudeCodeIcon.ts
|
|
11051
|
-
import { readFileSync as
|
|
11052
|
-
import { join as
|
|
11073
|
+
import { readFileSync as readFileSync33 } from "fs";
|
|
11074
|
+
import { join as join41 } from "path";
|
|
11053
11075
|
async function showClaudeCodeIcon() {
|
|
11054
11076
|
const appData = process.env.APPDATA;
|
|
11055
11077
|
if (!appData) return;
|
|
11056
|
-
const portFile =
|
|
11078
|
+
const portFile = join41(appData, "Roam", "roam-local-api.port");
|
|
11057
11079
|
let port;
|
|
11058
11080
|
try {
|
|
11059
|
-
port =
|
|
11081
|
+
port = readFileSync33(portFile, "utf-8").trim();
|
|
11060
11082
|
} catch {
|
|
11061
11083
|
return;
|
|
11062
11084
|
}
|
|
@@ -11127,8 +11149,8 @@ Done in ${elapsed}`);
|
|
|
11127
11149
|
}
|
|
11128
11150
|
|
|
11129
11151
|
// src/commands/run/add.ts
|
|
11130
|
-
import { mkdirSync as mkdirSync13, writeFileSync as
|
|
11131
|
-
import { join as
|
|
11152
|
+
import { mkdirSync as mkdirSync13, writeFileSync as writeFileSync28 } from "fs";
|
|
11153
|
+
import { join as join42 } from "path";
|
|
11132
11154
|
function findAddIndex() {
|
|
11133
11155
|
const addIndex = process.argv.indexOf("add");
|
|
11134
11156
|
if (addIndex === -1 || addIndex + 2 >= process.argv.length) return -1;
|
|
@@ -11174,7 +11196,7 @@ function saveNewRunConfig(name, command, args) {
|
|
|
11174
11196
|
saveConfig(config);
|
|
11175
11197
|
}
|
|
11176
11198
|
function createCommandFile(name) {
|
|
11177
|
-
const dir =
|
|
11199
|
+
const dir = join42(".claude", "commands");
|
|
11178
11200
|
mkdirSync13(dir, { recursive: true });
|
|
11179
11201
|
const content = `---
|
|
11180
11202
|
description: Run ${name}
|
|
@@ -11182,8 +11204,8 @@ description: Run ${name}
|
|
|
11182
11204
|
|
|
11183
11205
|
Run \`assist run ${name} $ARGUMENTS 2>&1\`.
|
|
11184
11206
|
`;
|
|
11185
|
-
const filePath =
|
|
11186
|
-
|
|
11207
|
+
const filePath = join42(dir, `${name}.md`);
|
|
11208
|
+
writeFileSync28(filePath, content);
|
|
11187
11209
|
console.log(`Created command file: ${filePath}`);
|
|
11188
11210
|
}
|
|
11189
11211
|
function add3() {
|
|
@@ -11253,9 +11275,9 @@ function run3(name, args) {
|
|
|
11253
11275
|
|
|
11254
11276
|
// src/commands/screenshot/index.ts
|
|
11255
11277
|
import { execSync as execSync40 } from "child_process";
|
|
11256
|
-
import { existsSync as
|
|
11278
|
+
import { existsSync as existsSync39, mkdirSync as mkdirSync14, unlinkSync as unlinkSync11, writeFileSync as writeFileSync29 } from "fs";
|
|
11257
11279
|
import { tmpdir as tmpdir6 } from "os";
|
|
11258
|
-
import { join as
|
|
11280
|
+
import { join as join43, resolve as resolve5 } from "path";
|
|
11259
11281
|
import chalk122 from "chalk";
|
|
11260
11282
|
|
|
11261
11283
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
@@ -11385,15 +11407,15 @@ Write-Output $OutputPath
|
|
|
11385
11407
|
|
|
11386
11408
|
// src/commands/screenshot/index.ts
|
|
11387
11409
|
function buildOutputPath(outputDir, processName) {
|
|
11388
|
-
if (!
|
|
11410
|
+
if (!existsSync39(outputDir)) {
|
|
11389
11411
|
mkdirSync14(outputDir, { recursive: true });
|
|
11390
11412
|
}
|
|
11391
11413
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
11392
11414
|
return resolve5(outputDir, `${processName}-${timestamp}.png`);
|
|
11393
11415
|
}
|
|
11394
11416
|
function runPowerShellScript(processName, outputPath) {
|
|
11395
|
-
const scriptPath =
|
|
11396
|
-
|
|
11417
|
+
const scriptPath = join43(tmpdir6(), `assist-screenshot-${Date.now()}.ps1`);
|
|
11418
|
+
writeFileSync29(scriptPath, captureWindowPs1, "utf-8");
|
|
11397
11419
|
try {
|
|
11398
11420
|
execSync40(
|
|
11399
11421
|
`powershell -NoProfile -ExecutionPolicy Bypass -File "${scriptPath}" -ProcessName "${processName}" -OutputPath "${outputPath}"`,
|