@staff0rd/assist 0.330.2 → 0.330.4
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 +107 -94
- 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.330.
|
|
9
|
+
version: "0.330.4",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -3901,13 +3901,19 @@ var daemonPaths = {
|
|
|
3901
3901
|
// src/commands/sessions/daemon/ensureHooksSettings.ts
|
|
3902
3902
|
var RUNNING = "assist sessions set-status running";
|
|
3903
3903
|
var WAITING = "assist sessions set-status waiting";
|
|
3904
|
-
function on(command) {
|
|
3905
|
-
|
|
3904
|
+
function on(command, matcher) {
|
|
3905
|
+
const hooks = [{ type: "command", command }];
|
|
3906
|
+
return [matcher == null ? { hooks } : { matcher, hooks }];
|
|
3906
3907
|
}
|
|
3908
|
+
var ASK_USER_QUESTION = "AskUserQuestion";
|
|
3909
|
+
var NOT_ASK_USER_QUESTION = `^(?!${ASK_USER_QUESTION}$).*`;
|
|
3907
3910
|
var hooksSettings = {
|
|
3908
3911
|
hooks: {
|
|
3909
3912
|
UserPromptSubmit: on(RUNNING),
|
|
3910
|
-
PreToolUse:
|
|
3913
|
+
PreToolUse: [
|
|
3914
|
+
...on(WAITING, ASK_USER_QUESTION),
|
|
3915
|
+
...on(RUNNING, NOT_ASK_USER_QUESTION)
|
|
3916
|
+
],
|
|
3911
3917
|
// tool finished, agent resumes; restores running
|
|
3912
3918
|
PostToolUse: on(RUNNING),
|
|
3913
3919
|
Stop: on(WAITING),
|
|
@@ -4867,23 +4873,27 @@ async function handleIncompletePhase() {
|
|
|
4867
4873
|
import { existsSync as existsSync21, readFileSync as readFileSync15 } from "fs";
|
|
4868
4874
|
|
|
4869
4875
|
// src/commands/backlog/writeSignal.ts
|
|
4870
|
-
import { writeFileSync as writeFileSync18 } from "fs";
|
|
4871
|
-
import {
|
|
4876
|
+
import { mkdirSync as mkdirSync8, writeFileSync as writeFileSync18 } from "fs";
|
|
4877
|
+
import { homedir as homedir8 } from "os";
|
|
4878
|
+
import { dirname as dirname15, join as join19 } from "path";
|
|
4872
4879
|
function getSignalPath() {
|
|
4873
4880
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
4874
|
-
|
|
4875
|
-
return join19(
|
|
4881
|
+
if (!sessionId) return void 0;
|
|
4882
|
+
return join19(homedir8(), ".assist", "signals", `signal-${sessionId}.json`);
|
|
4876
4883
|
}
|
|
4877
4884
|
function writeSignal(event, data) {
|
|
4885
|
+
const path57 = getSignalPath();
|
|
4886
|
+
if (!path57) return;
|
|
4878
4887
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
4879
4888
|
const signal = { event, ...sessionId && { sessionId }, ...data };
|
|
4880
|
-
|
|
4889
|
+
mkdirSync8(dirname15(path57), { recursive: true });
|
|
4890
|
+
writeFileSync18(path57, JSON.stringify(signal));
|
|
4881
4891
|
}
|
|
4882
4892
|
|
|
4883
4893
|
// src/commands/backlog/readSignal.ts
|
|
4884
4894
|
function readSignal() {
|
|
4885
4895
|
const path57 = getSignalPath();
|
|
4886
|
-
if (!existsSync21(path57)) return void 0;
|
|
4896
|
+
if (!path57 || !existsSync21(path57)) return void 0;
|
|
4887
4897
|
try {
|
|
4888
4898
|
return JSON.parse(readFileSync15(path57, "utf8"));
|
|
4889
4899
|
} catch {
|
|
@@ -4894,7 +4904,7 @@ function readSignal() {
|
|
|
4894
4904
|
// src/commands/backlog/resolvePhaseResult.ts
|
|
4895
4905
|
function cleanupSignal() {
|
|
4896
4906
|
const statusPath = getSignalPath();
|
|
4897
|
-
if (existsSync22(statusPath)) {
|
|
4907
|
+
if (statusPath && existsSync22(statusPath)) {
|
|
4898
4908
|
unlinkSync4(statusPath);
|
|
4899
4909
|
}
|
|
4900
4910
|
}
|
|
@@ -4904,7 +4914,8 @@ async function isTerminalStatus(itemId) {
|
|
|
4904
4914
|
return item?.status === "done" || item?.status === "wontdo";
|
|
4905
4915
|
}
|
|
4906
4916
|
async function resolvePhaseResult(phaseIndex, itemId) {
|
|
4907
|
-
|
|
4917
|
+
const signalPath = getSignalPath();
|
|
4918
|
+
if (!signalPath || !existsSync22(signalPath)) {
|
|
4908
4919
|
if (await isTerminalStatus(itemId)) return -1;
|
|
4909
4920
|
const action = await handleIncompletePhase();
|
|
4910
4921
|
if (action === "abort") return -1;
|
|
@@ -4929,6 +4940,7 @@ Phase ${phaseNumber} completed.`));
|
|
|
4929
4940
|
import { existsSync as existsSync23, unwatchFile, watchFile } from "fs";
|
|
4930
4941
|
function watchForMarker(child, options2) {
|
|
4931
4942
|
const statusPath = getSignalPath();
|
|
4943
|
+
if (!statusPath) return;
|
|
4932
4944
|
watchFile(statusPath, { interval: 1e3 }, () => {
|
|
4933
4945
|
if (!existsSync23(statusPath)) return;
|
|
4934
4946
|
const signal = readSignal();
|
|
@@ -4939,7 +4951,8 @@ function watchForMarker(child, options2) {
|
|
|
4939
4951
|
});
|
|
4940
4952
|
}
|
|
4941
4953
|
function stopWatching() {
|
|
4942
|
-
|
|
4954
|
+
const statusPath = getSignalPath();
|
|
4955
|
+
if (statusPath) unwatchFile(statusPath);
|
|
4943
4956
|
}
|
|
4944
4957
|
|
|
4945
4958
|
// src/commands/backlog/executePhase.ts
|
|
@@ -5343,10 +5356,10 @@ import { WebSocketServer } from "ws";
|
|
|
5343
5356
|
|
|
5344
5357
|
// src/shared/getInstallDir.ts
|
|
5345
5358
|
import { execSync as execSync19 } from "child_process";
|
|
5346
|
-
import { dirname as
|
|
5359
|
+
import { dirname as dirname16, resolve as resolve7 } from "path";
|
|
5347
5360
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
5348
5361
|
var __filename2 = fileURLToPath2(import.meta.url);
|
|
5349
|
-
var __dirname3 =
|
|
5362
|
+
var __dirname3 = dirname16(__filename2);
|
|
5350
5363
|
function getInstallDir() {
|
|
5351
5364
|
return resolve7(__dirname3, "..");
|
|
5352
5365
|
}
|
|
@@ -5489,7 +5502,7 @@ function startWebServer(label2, port, handler, initialPath, open = true) {
|
|
|
5489
5502
|
import { spawn as spawn4 } from "child_process";
|
|
5490
5503
|
import {
|
|
5491
5504
|
closeSync,
|
|
5492
|
-
mkdirSync as
|
|
5505
|
+
mkdirSync as mkdirSync9,
|
|
5493
5506
|
openSync,
|
|
5494
5507
|
statSync,
|
|
5495
5508
|
unlinkSync as unlinkSync5,
|
|
@@ -5500,7 +5513,7 @@ var RETRY_DELAY_MS = 200;
|
|
|
5500
5513
|
var STALE_LOCK_MS = SPAWN_TIMEOUT_MS + 5e3;
|
|
5501
5514
|
async function ensureDaemonRunning(reason = "unspecified") {
|
|
5502
5515
|
if (await isDaemonRunning()) return;
|
|
5503
|
-
|
|
5516
|
+
mkdirSync9(daemonPaths.dir, { recursive: true });
|
|
5504
5517
|
const holdsLock = acquireSpawnLock();
|
|
5505
5518
|
if (holdsLock) spawnDaemon(reason);
|
|
5506
5519
|
try {
|
|
@@ -5572,10 +5585,10 @@ import { createRequire as createRequire2 } from "module";
|
|
|
5572
5585
|
// src/shared/createBundleHandler.ts
|
|
5573
5586
|
import { createHash } from "crypto";
|
|
5574
5587
|
import { readFileSync as readFileSync16 } from "fs";
|
|
5575
|
-
import { dirname as
|
|
5588
|
+
import { dirname as dirname17, join as join20 } from "path";
|
|
5576
5589
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
5577
5590
|
function createBundleHandler(importMetaUrl, bundlePath) {
|
|
5578
|
-
const dir =
|
|
5591
|
+
const dir = dirname17(fileURLToPath3(importMetaUrl));
|
|
5579
5592
|
let cache;
|
|
5580
5593
|
return (req, res) => {
|
|
5581
5594
|
if (!cache) {
|
|
@@ -8571,13 +8584,13 @@ function findBuiltinDenyRaw(rawCommand) {
|
|
|
8571
8584
|
}
|
|
8572
8585
|
|
|
8573
8586
|
// src/commands/cliHook/logDeniedToolCall.ts
|
|
8574
|
-
import { mkdirSync as
|
|
8575
|
-
import { homedir as
|
|
8587
|
+
import { mkdirSync as mkdirSync10 } from "fs";
|
|
8588
|
+
import { homedir as homedir9 } from "os";
|
|
8576
8589
|
import { join as join22 } from "path";
|
|
8577
8590
|
import Database from "better-sqlite3";
|
|
8578
8591
|
var _db;
|
|
8579
8592
|
function getDbDir() {
|
|
8580
|
-
return join22(
|
|
8593
|
+
return join22(homedir9(), ".assist");
|
|
8581
8594
|
}
|
|
8582
8595
|
function initSchema2(db) {
|
|
8583
8596
|
db.exec(`
|
|
@@ -8595,7 +8608,7 @@ function initSchema2(db) {
|
|
|
8595
8608
|
function openPromptsDb(dir) {
|
|
8596
8609
|
if (_db) return _db;
|
|
8597
8610
|
const dbDir = dir ?? getDbDir();
|
|
8598
|
-
|
|
8611
|
+
mkdirSync10(dbDir, { recursive: true });
|
|
8599
8612
|
const db = new Database(join22(dbDir, "assist.db"));
|
|
8600
8613
|
db.pragma("journal_mode = WAL");
|
|
8601
8614
|
initSchema2(db);
|
|
@@ -8699,10 +8712,10 @@ function extractGraphqlQuery(args) {
|
|
|
8699
8712
|
|
|
8700
8713
|
// src/shared/loadCliReads.ts
|
|
8701
8714
|
import { existsSync as existsSync24, readFileSync as readFileSync19, writeFileSync as writeFileSync20 } from "fs";
|
|
8702
|
-
import { dirname as
|
|
8715
|
+
import { dirname as dirname18, resolve as resolve8 } from "path";
|
|
8703
8716
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
8704
8717
|
var __filename3 = fileURLToPath4(import.meta.url);
|
|
8705
|
-
var __dirname4 =
|
|
8718
|
+
var __dirname4 = dirname18(__filename3);
|
|
8706
8719
|
function packageRoot() {
|
|
8707
8720
|
return __dirname4;
|
|
8708
8721
|
}
|
|
@@ -8755,11 +8768,11 @@ function findCliWrite(command) {
|
|
|
8755
8768
|
|
|
8756
8769
|
// src/shared/readSettingsPerms.ts
|
|
8757
8770
|
import { existsSync as existsSync25, readFileSync as readFileSync20 } from "fs";
|
|
8758
|
-
import { homedir as
|
|
8771
|
+
import { homedir as homedir10 } from "os";
|
|
8759
8772
|
import { join as join23 } from "path";
|
|
8760
8773
|
function readSettingsPerms(key) {
|
|
8761
8774
|
const paths = [
|
|
8762
|
-
join23(
|
|
8775
|
+
join23(homedir10(), ".claude", "settings.json"),
|
|
8763
8776
|
join23(process.cwd(), ".claude", "settings.json"),
|
|
8764
8777
|
join23(process.cwd(), ".claude", "settings.local.json")
|
|
8765
8778
|
];
|
|
@@ -9034,8 +9047,8 @@ ${reasons.join("\n")}`);
|
|
|
9034
9047
|
}
|
|
9035
9048
|
|
|
9036
9049
|
// src/commands/permitCliReads/index.ts
|
|
9037
|
-
import { existsSync as existsSync26, mkdirSync as
|
|
9038
|
-
import { homedir as
|
|
9050
|
+
import { existsSync as existsSync26, mkdirSync as mkdirSync11, readFileSync as readFileSync21, writeFileSync as writeFileSync21 } from "fs";
|
|
9051
|
+
import { homedir as homedir11 } from "os";
|
|
9039
9052
|
import { join as join24 } from "path";
|
|
9040
9053
|
|
|
9041
9054
|
// src/shared/checkCliAvailable.ts
|
|
@@ -9325,7 +9338,7 @@ function updateSettings(cli, commands) {
|
|
|
9325
9338
|
// src/commands/permitCliReads/index.ts
|
|
9326
9339
|
function logPath(cli) {
|
|
9327
9340
|
const safeName = cli.replace(/\s+/g, "-");
|
|
9328
|
-
return join24(
|
|
9341
|
+
return join24(homedir11(), ".assist", `cli-discover-${safeName}.log`);
|
|
9329
9342
|
}
|
|
9330
9343
|
function readCache(cli) {
|
|
9331
9344
|
const path57 = logPath(cli);
|
|
@@ -9333,8 +9346,8 @@ function readCache(cli) {
|
|
|
9333
9346
|
return readFileSync21(path57, "utf8");
|
|
9334
9347
|
}
|
|
9335
9348
|
function writeCache(cli, output) {
|
|
9336
|
-
const dir = join24(
|
|
9337
|
-
|
|
9349
|
+
const dir = join24(homedir11(), ".assist");
|
|
9350
|
+
mkdirSync11(dir, { recursive: true });
|
|
9338
9351
|
writeFileSync21(logPath(cli), output);
|
|
9339
9352
|
}
|
|
9340
9353
|
async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
@@ -9466,10 +9479,10 @@ import { existsSync as existsSync27, readFileSync as readFileSync22, unlinkSync
|
|
|
9466
9479
|
import chalk94 from "chalk";
|
|
9467
9480
|
|
|
9468
9481
|
// src/commands/codeComment/getRestrictedDir.ts
|
|
9469
|
-
import { homedir as
|
|
9482
|
+
import { homedir as homedir12 } from "os";
|
|
9470
9483
|
import { join as join25 } from "path";
|
|
9471
9484
|
function getRestrictedDir() {
|
|
9472
|
-
return join25(
|
|
9485
|
+
return join25(homedir12(), ".assist", "restricted");
|
|
9473
9486
|
}
|
|
9474
9487
|
function getPinStatePath(pin) {
|
|
9475
9488
|
return join25(getRestrictedDir(), `code-comment-${pin}.json`);
|
|
@@ -9573,11 +9586,11 @@ function validateCommentText(raw) {
|
|
|
9573
9586
|
}
|
|
9574
9587
|
|
|
9575
9588
|
// src/commands/codeComment/issuePin.ts
|
|
9576
|
-
import { mkdirSync as
|
|
9589
|
+
import { mkdirSync as mkdirSync12, writeFileSync as writeFileSync23 } from "fs";
|
|
9577
9590
|
import { randomInt } from "crypto";
|
|
9578
9591
|
function issuePin(file, lineNumber, text6) {
|
|
9579
9592
|
const pin = generatePin();
|
|
9580
|
-
|
|
9593
|
+
mkdirSync12(getRestrictedDir(), { recursive: true });
|
|
9581
9594
|
sweepRestrictedDir();
|
|
9582
9595
|
writeFileSync23(
|
|
9583
9596
|
getPinStatePath(pin),
|
|
@@ -10409,9 +10422,9 @@ import { execFileSync as execFileSync2 } from "child_process";
|
|
|
10409
10422
|
import { basename as basename4 } from "path";
|
|
10410
10423
|
|
|
10411
10424
|
// src/commands/devlog/loadBlogSkipDays.ts
|
|
10412
|
-
import { homedir as
|
|
10425
|
+
import { homedir as homedir13 } from "os";
|
|
10413
10426
|
import { join as join27 } from "path";
|
|
10414
|
-
var BLOG_REPO_ROOT = join27(
|
|
10427
|
+
var BLOG_REPO_ROOT = join27(homedir13(), "git/blog");
|
|
10415
10428
|
function loadBlogSkipDays(repoName) {
|
|
10416
10429
|
const config = loadRawYaml(join27(BLOG_REPO_ROOT, "assist.yml"));
|
|
10417
10430
|
const devlog = config.devlog;
|
|
@@ -11328,7 +11341,7 @@ import chalk121 from "chalk";
|
|
|
11328
11341
|
|
|
11329
11342
|
// src/commands/dotnet/findSolution.ts
|
|
11330
11343
|
import { readdirSync as readdirSync5 } from "fs";
|
|
11331
|
-
import { dirname as
|
|
11344
|
+
import { dirname as dirname19, join as join32 } from "path";
|
|
11332
11345
|
import chalk120 from "chalk";
|
|
11333
11346
|
function findSlnInDir(dir) {
|
|
11334
11347
|
try {
|
|
@@ -11353,7 +11366,7 @@ function findSolution() {
|
|
|
11353
11366
|
process.exit(1);
|
|
11354
11367
|
}
|
|
11355
11368
|
if (current === ceiling) break;
|
|
11356
|
-
current =
|
|
11369
|
+
current = dirname19(current);
|
|
11357
11370
|
}
|
|
11358
11371
|
console.error(chalk120.red("No .sln file found between cwd and repo root"));
|
|
11359
11372
|
process.exit(1);
|
|
@@ -12251,11 +12264,11 @@ function acceptanceCriteria(issueKey) {
|
|
|
12251
12264
|
import { execSync as execSync30 } from "child_process";
|
|
12252
12265
|
|
|
12253
12266
|
// src/shared/loadJson.ts
|
|
12254
|
-
import { existsSync as existsSync35, mkdirSync as
|
|
12255
|
-
import { homedir as
|
|
12267
|
+
import { existsSync as existsSync35, mkdirSync as mkdirSync13, readFileSync as readFileSync30, writeFileSync as writeFileSync27 } from "fs";
|
|
12268
|
+
import { homedir as homedir14 } from "os";
|
|
12256
12269
|
import { join as join37 } from "path";
|
|
12257
12270
|
function getStoreDir() {
|
|
12258
|
-
return join37(
|
|
12271
|
+
return join37(homedir14(), ".assist");
|
|
12259
12272
|
}
|
|
12260
12273
|
function getStorePath(filename) {
|
|
12261
12274
|
return join37(getStoreDir(), filename);
|
|
@@ -12274,7 +12287,7 @@ function loadJson(filename) {
|
|
|
12274
12287
|
function saveJson(filename, data) {
|
|
12275
12288
|
const dir = getStoreDir();
|
|
12276
12289
|
if (!existsSync35(dir)) {
|
|
12277
|
-
|
|
12290
|
+
mkdirSync13(dir, { recursive: true });
|
|
12278
12291
|
}
|
|
12279
12292
|
writeFileSync27(getStorePath(filename), JSON.stringify(data, null, 2));
|
|
12280
12293
|
}
|
|
@@ -12443,7 +12456,7 @@ function registerList(program2) {
|
|
|
12443
12456
|
}
|
|
12444
12457
|
|
|
12445
12458
|
// src/commands/mermaid/index.ts
|
|
12446
|
-
import { mkdirSync as
|
|
12459
|
+
import { mkdirSync as mkdirSync14, readdirSync as readdirSync7 } from "fs";
|
|
12447
12460
|
import { resolve as resolve11 } from "path";
|
|
12448
12461
|
import chalk132 from "chalk";
|
|
12449
12462
|
|
|
@@ -12512,7 +12525,7 @@ function extractMermaidBlocks(markdown) {
|
|
|
12512
12525
|
async function mermaidExport(file, options2 = {}) {
|
|
12513
12526
|
const { mermaid } = loadConfig();
|
|
12514
12527
|
const outDir = resolve11(process.cwd(), options2.out ?? ".");
|
|
12515
|
-
|
|
12528
|
+
mkdirSync14(outDir, { recursive: true });
|
|
12516
12529
|
if (options2.index !== void 0) {
|
|
12517
12530
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
12518
12531
|
console.error(
|
|
@@ -12552,7 +12565,7 @@ function registerMermaid(program2) {
|
|
|
12552
12565
|
// src/commands/netcap/netcap.ts
|
|
12553
12566
|
import { mkdir as mkdir3 } from "fs/promises";
|
|
12554
12567
|
import { createServer as createServer2 } from "http";
|
|
12555
|
-
import { dirname as
|
|
12568
|
+
import { dirname as dirname21 } from "path";
|
|
12556
12569
|
import chalk134 from "chalk";
|
|
12557
12570
|
|
|
12558
12571
|
// src/commands/netcap/corsHeaders.ts
|
|
@@ -12635,9 +12648,9 @@ import { join as join39 } from "path";
|
|
|
12635
12648
|
import chalk133 from "chalk";
|
|
12636
12649
|
|
|
12637
12650
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
12638
|
-
import { dirname as
|
|
12651
|
+
import { dirname as dirname20, join as join38 } from "path";
|
|
12639
12652
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
12640
|
-
var moduleDir =
|
|
12653
|
+
var moduleDir = dirname20(fileURLToPath5(import.meta.url));
|
|
12641
12654
|
function netcapExtensionDir() {
|
|
12642
12655
|
return join38(moduleDir, "commands", "netcap", "netcap-extension");
|
|
12643
12656
|
}
|
|
@@ -12697,10 +12710,10 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
12697
12710
|
import { isAbsolute, join as join41, resolve as resolve12 } from "path";
|
|
12698
12711
|
|
|
12699
12712
|
// src/commands/netcap/defaultCapturePath.ts
|
|
12700
|
-
import { homedir as
|
|
12713
|
+
import { homedir as homedir15 } from "os";
|
|
12701
12714
|
import { join as join40 } from "path";
|
|
12702
12715
|
function defaultCapturePath() {
|
|
12703
|
-
return join40(
|
|
12716
|
+
return join40(homedir15(), ".assist", "netcap", "capture.jsonl");
|
|
12704
12717
|
}
|
|
12705
12718
|
|
|
12706
12719
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
@@ -12715,7 +12728,7 @@ async function netcap(options2) {
|
|
|
12715
12728
|
const port = Number(options2.port);
|
|
12716
12729
|
const outPath = resolveNetcapOutPath(options2.out);
|
|
12717
12730
|
const filter = options2.filter ?? "";
|
|
12718
|
-
await mkdir3(
|
|
12731
|
+
await mkdir3(dirname21(outPath), { recursive: true });
|
|
12719
12732
|
const extensionPath = await prepareExtensionForLoad(port, filter);
|
|
12720
12733
|
let count6 = 0;
|
|
12721
12734
|
const handler = createNetcapHandler({
|
|
@@ -13754,7 +13767,7 @@ function fixed(commentId, sha) {
|
|
|
13754
13767
|
}
|
|
13755
13768
|
|
|
13756
13769
|
// src/commands/prs/listComments/index.ts
|
|
13757
|
-
import { existsSync as existsSync37, mkdirSync as
|
|
13770
|
+
import { existsSync as existsSync37, mkdirSync as mkdirSync15, writeFileSync as writeFileSync32 } from "fs";
|
|
13758
13771
|
import { join as join46 } from "path";
|
|
13759
13772
|
import { stringify } from "yaml";
|
|
13760
13773
|
|
|
@@ -13881,7 +13894,7 @@ function printComments2(result) {
|
|
|
13881
13894
|
function writeCommentsCache(prNumber, comments3) {
|
|
13882
13895
|
const assistDir = join46(process.cwd(), ".assist");
|
|
13883
13896
|
if (!existsSync37(assistDir)) {
|
|
13884
|
-
|
|
13897
|
+
mkdirSync15(assistDir, { recursive: true });
|
|
13885
13898
|
}
|
|
13886
13899
|
const cacheData = {
|
|
13887
13900
|
prNumber,
|
|
@@ -16426,11 +16439,11 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
|
|
|
16426
16439
|
}
|
|
16427
16440
|
|
|
16428
16441
|
// src/commands/review/buildReviewPaths.ts
|
|
16429
|
-
import { homedir as
|
|
16442
|
+
import { homedir as homedir16 } from "os";
|
|
16430
16443
|
import { basename as basename7, join as join47 } from "path";
|
|
16431
16444
|
function buildReviewPaths(repoRoot, key) {
|
|
16432
16445
|
const reviewDir = join47(
|
|
16433
|
-
|
|
16446
|
+
homedir16(),
|
|
16434
16447
|
".assist",
|
|
16435
16448
|
"reviews",
|
|
16436
16449
|
basename7(repoRoot),
|
|
@@ -16976,14 +16989,14 @@ async function handlePostSynthesis(synthesisPath, options2) {
|
|
|
16976
16989
|
}
|
|
16977
16990
|
|
|
16978
16991
|
// src/commands/review/prepareReviewDir.ts
|
|
16979
|
-
import { existsSync as existsSync38, mkdirSync as
|
|
16992
|
+
import { existsSync as existsSync38, mkdirSync as mkdirSync16, unlinkSync as unlinkSync14, writeFileSync as writeFileSync33 } from "fs";
|
|
16980
16993
|
function clearReviewFiles(paths) {
|
|
16981
16994
|
for (const path57 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
16982
16995
|
if (existsSync38(path57)) unlinkSync14(path57);
|
|
16983
16996
|
}
|
|
16984
16997
|
}
|
|
16985
16998
|
function prepareReviewDir(paths, requestBody, force) {
|
|
16986
|
-
|
|
16999
|
+
mkdirSync16(paths.reviewDir, { recursive: true });
|
|
16987
17000
|
if (force) clearReviewFiles(paths);
|
|
16988
17001
|
writeFileSync33(paths.requestPath, requestBody);
|
|
16989
17002
|
}
|
|
@@ -18777,7 +18790,7 @@ async function configure() {
|
|
|
18777
18790
|
import { existsSync as existsSync43 } from "fs";
|
|
18778
18791
|
|
|
18779
18792
|
// src/commands/transcript/format/fixInvalidDatePrefixes/index.ts
|
|
18780
|
-
import { dirname as
|
|
18793
|
+
import { dirname as dirname23, join as join50 } from "path";
|
|
18781
18794
|
|
|
18782
18795
|
// src/commands/transcript/format/fixInvalidDatePrefixes/promptForDateFix.ts
|
|
18783
18796
|
import { renameSync as renameSync2 } from "fs";
|
|
@@ -18827,11 +18840,11 @@ async function fixInvalidDatePrefixes(vttFiles) {
|
|
|
18827
18840
|
for (let i = 0; i < vttFiles.length; i++) {
|
|
18828
18841
|
const vttFile = vttFiles[i];
|
|
18829
18842
|
if (!isValidDatePrefix(vttFile.filename)) {
|
|
18830
|
-
const vttFileDir =
|
|
18843
|
+
const vttFileDir = dirname23(vttFile.absolutePath);
|
|
18831
18844
|
const newFilename = await promptForDateFix(vttFile.filename, vttFileDir);
|
|
18832
18845
|
if (newFilename) {
|
|
18833
18846
|
const newRelativePath = join50(
|
|
18834
|
-
|
|
18847
|
+
dirname23(vttFile.relativePath),
|
|
18835
18848
|
newFilename
|
|
18836
18849
|
);
|
|
18837
18850
|
vttFiles[i] = {
|
|
@@ -18848,8 +18861,8 @@ async function fixInvalidDatePrefixes(vttFiles) {
|
|
|
18848
18861
|
}
|
|
18849
18862
|
|
|
18850
18863
|
// src/commands/transcript/format/processVttFile/index.ts
|
|
18851
|
-
import { existsSync as existsSync42, mkdirSync as
|
|
18852
|
-
import { basename as basename9, dirname as
|
|
18864
|
+
import { existsSync as existsSync42, mkdirSync as mkdirSync17, readFileSync as readFileSync36, writeFileSync as writeFileSync35 } from "fs";
|
|
18865
|
+
import { basename as basename9, dirname as dirname24, join as join51 } from "path";
|
|
18853
18866
|
|
|
18854
18867
|
// src/commands/transcript/cleanText.ts
|
|
18855
18868
|
function cleanText(text6) {
|
|
@@ -19063,7 +19076,7 @@ function resolveOutputDir(relativeDir, transcriptsDir) {
|
|
|
19063
19076
|
}
|
|
19064
19077
|
function buildOutputPaths(vttFile, transcriptsDir) {
|
|
19065
19078
|
const mdFile = toMdFilename(vttFile.filename);
|
|
19066
|
-
const relativeDir =
|
|
19079
|
+
const relativeDir = dirname24(vttFile.relativePath);
|
|
19067
19080
|
const outputDir = resolveOutputDir(relativeDir, transcriptsDir);
|
|
19068
19081
|
const outputPath = join51(outputDir, mdFile);
|
|
19069
19082
|
return { outputDir, outputPath, mdFile, relativeDir };
|
|
@@ -19074,7 +19087,7 @@ function logSkipped(relativeDir, mdFile) {
|
|
|
19074
19087
|
}
|
|
19075
19088
|
function ensureDirectory(dir, label2) {
|
|
19076
19089
|
if (!existsSync42(dir)) {
|
|
19077
|
-
|
|
19090
|
+
mkdirSync17(dir, { recursive: true });
|
|
19078
19091
|
console.log(`Created ${label2}: ${dir}`);
|
|
19079
19092
|
}
|
|
19080
19093
|
}
|
|
@@ -19168,17 +19181,17 @@ async function format() {
|
|
|
19168
19181
|
|
|
19169
19182
|
// src/commands/transcript/summarise/index.ts
|
|
19170
19183
|
import { existsSync as existsSync45 } from "fs";
|
|
19171
|
-
import { basename as basename10, dirname as
|
|
19184
|
+
import { basename as basename10, dirname as dirname26, join as join53, relative as relative3 } from "path";
|
|
19172
19185
|
|
|
19173
19186
|
// src/commands/transcript/summarise/processStagedFile/index.ts
|
|
19174
19187
|
import {
|
|
19175
19188
|
existsSync as existsSync44,
|
|
19176
|
-
mkdirSync as
|
|
19189
|
+
mkdirSync as mkdirSync18,
|
|
19177
19190
|
readFileSync as readFileSync37,
|
|
19178
19191
|
renameSync as renameSync3,
|
|
19179
19192
|
rmSync as rmSync3
|
|
19180
19193
|
} from "fs";
|
|
19181
|
-
import { dirname as
|
|
19194
|
+
import { dirname as dirname25, join as join52 } from "path";
|
|
19182
19195
|
|
|
19183
19196
|
// src/commands/transcript/summarise/processStagedFile/validateStagedContent.ts
|
|
19184
19197
|
import chalk178 from "chalk";
|
|
@@ -19232,9 +19245,9 @@ function processStagedFile() {
|
|
|
19232
19245
|
process.exit(1);
|
|
19233
19246
|
}
|
|
19234
19247
|
const destPath = join52(summaryDir, matchingTranscript.relativePath);
|
|
19235
|
-
const destDir =
|
|
19248
|
+
const destDir = dirname25(destPath);
|
|
19236
19249
|
if (!existsSync44(destDir)) {
|
|
19237
|
-
|
|
19250
|
+
mkdirSync18(destDir, { recursive: true });
|
|
19238
19251
|
}
|
|
19239
19252
|
renameSync3(stagedFile.absolutePath, destPath);
|
|
19240
19253
|
const remaining = findMdFilesRecursive(STAGING_DIR);
|
|
@@ -19246,7 +19259,7 @@ function processStagedFile() {
|
|
|
19246
19259
|
|
|
19247
19260
|
// src/commands/transcript/summarise/index.ts
|
|
19248
19261
|
function buildRelativeKey(relativePath, baseName) {
|
|
19249
|
-
const relDir =
|
|
19262
|
+
const relDir = dirname26(relativePath);
|
|
19250
19263
|
return relDir === "." ? baseName : join53(relDir, baseName);
|
|
19251
19264
|
}
|
|
19252
19265
|
function buildSummaryIndex(summaryDir) {
|
|
@@ -19282,7 +19295,7 @@ function summarise2() {
|
|
|
19282
19295
|
const next3 = missing[0];
|
|
19283
19296
|
const outputFilename = `${getTranscriptBaseName(next3.filename)}.md`;
|
|
19284
19297
|
const outputPath = join53(STAGING_DIR, outputFilename);
|
|
19285
|
-
const summaryFileDir = join53(summaryDir,
|
|
19298
|
+
const summaryFileDir = join53(summaryDir, dirname26(next3.relativePath));
|
|
19286
19299
|
const relativeTranscriptPath = encodeURI(
|
|
19287
19300
|
relative3(summaryFileDir, next3.absolutePath).replace(/\\/g, "/")
|
|
19288
19301
|
);
|
|
@@ -19342,11 +19355,11 @@ import { spawnSync as spawnSync5 } from "child_process";
|
|
|
19342
19355
|
import { join as join55 } from "path";
|
|
19343
19356
|
|
|
19344
19357
|
// src/commands/voice/shared.ts
|
|
19345
|
-
import { homedir as
|
|
19346
|
-
import { dirname as
|
|
19358
|
+
import { homedir as homedir17 } from "os";
|
|
19359
|
+
import { dirname as dirname27, join as join54 } from "path";
|
|
19347
19360
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
19348
|
-
var __dirname5 =
|
|
19349
|
-
var VOICE_DIR = join54(
|
|
19361
|
+
var __dirname5 = dirname27(fileURLToPath6(import.meta.url));
|
|
19362
|
+
var VOICE_DIR = join54(homedir17(), ".assist", "voice");
|
|
19350
19363
|
var voicePaths = {
|
|
19351
19364
|
dir: VOICE_DIR,
|
|
19352
19365
|
pid: join54(VOICE_DIR, "voice.pid"),
|
|
@@ -19404,12 +19417,12 @@ function logs(options2) {
|
|
|
19404
19417
|
|
|
19405
19418
|
// src/commands/voice/setup.ts
|
|
19406
19419
|
import { spawnSync as spawnSync6 } from "child_process";
|
|
19407
|
-
import { mkdirSync as
|
|
19420
|
+
import { mkdirSync as mkdirSync20 } from "fs";
|
|
19408
19421
|
import { join as join57 } from "path";
|
|
19409
19422
|
|
|
19410
19423
|
// src/commands/voice/checkLockFile.ts
|
|
19411
19424
|
import { execSync as execSync48 } from "child_process";
|
|
19412
|
-
import { existsSync as existsSync47, mkdirSync as
|
|
19425
|
+
import { existsSync as existsSync47, mkdirSync as mkdirSync19, readFileSync as readFileSync39, writeFileSync as writeFileSync36 } from "fs";
|
|
19413
19426
|
import { join as join56 } from "path";
|
|
19414
19427
|
function isProcessAlive2(pid) {
|
|
19415
19428
|
try {
|
|
@@ -19447,7 +19460,7 @@ function bootstrapVenv() {
|
|
|
19447
19460
|
}
|
|
19448
19461
|
function writeLockFile(pid) {
|
|
19449
19462
|
const lockFile = getLockFile();
|
|
19450
|
-
|
|
19463
|
+
mkdirSync19(join56(lockFile, ".."), { recursive: true });
|
|
19451
19464
|
writeFileSync36(
|
|
19452
19465
|
lockFile,
|
|
19453
19466
|
JSON.stringify({
|
|
@@ -19460,7 +19473,7 @@ function writeLockFile(pid) {
|
|
|
19460
19473
|
|
|
19461
19474
|
// src/commands/voice/setup.ts
|
|
19462
19475
|
function setup() {
|
|
19463
|
-
|
|
19476
|
+
mkdirSync20(voicePaths.dir, { recursive: true });
|
|
19464
19477
|
bootstrapVenv();
|
|
19465
19478
|
console.log("\nDownloading models...\n");
|
|
19466
19479
|
const script = join57(getPythonDir(), "setup_models.py");
|
|
@@ -19476,7 +19489,7 @@ function setup() {
|
|
|
19476
19489
|
|
|
19477
19490
|
// src/commands/voice/start.ts
|
|
19478
19491
|
import { spawn as spawn7 } from "child_process";
|
|
19479
|
-
import { mkdirSync as
|
|
19492
|
+
import { mkdirSync as mkdirSync21, writeFileSync as writeFileSync37 } from "fs";
|
|
19480
19493
|
import { join as join58 } from "path";
|
|
19481
19494
|
|
|
19482
19495
|
// src/commands/voice/buildDaemonEnv.ts
|
|
@@ -19510,7 +19523,7 @@ function spawnBackground(python, script, env) {
|
|
|
19510
19523
|
console.log(`Voice daemon started (PID ${pid})`);
|
|
19511
19524
|
}
|
|
19512
19525
|
function start2(options2) {
|
|
19513
|
-
|
|
19526
|
+
mkdirSync21(voicePaths.dir, { recursive: true });
|
|
19514
19527
|
checkLockFile();
|
|
19515
19528
|
bootstrapVenv();
|
|
19516
19529
|
const debug = options2.debug || options2.foreground || process.platform === "win32";
|
|
@@ -19929,12 +19942,12 @@ function runPreCommands(pre, cwd) {
|
|
|
19929
19942
|
// src/commands/run/spawnRunCommand.ts
|
|
19930
19943
|
import { execFileSync as execFileSync8, spawn as spawn8 } from "child_process";
|
|
19931
19944
|
import { existsSync as existsSync50 } from "fs";
|
|
19932
|
-
import { dirname as
|
|
19945
|
+
import { dirname as dirname28, join as join60, resolve as resolve13 } from "path";
|
|
19933
19946
|
function resolveCommand2(command) {
|
|
19934
19947
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
19935
19948
|
try {
|
|
19936
19949
|
const gitPath = execFileSync8("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
19937
|
-
const gitRoot = resolve13(
|
|
19950
|
+
const gitRoot = resolve13(dirname28(gitPath), "..");
|
|
19938
19951
|
const gitBash = join60(gitRoot, "bin", "bash.exe");
|
|
19939
19952
|
if (existsSync50(gitBash)) return gitBash;
|
|
19940
19953
|
} catch {
|
|
@@ -20021,7 +20034,7 @@ async function run3(name, args) {
|
|
|
20021
20034
|
}
|
|
20022
20035
|
|
|
20023
20036
|
// src/commands/run/add.ts
|
|
20024
|
-
import { mkdirSync as
|
|
20037
|
+
import { mkdirSync as mkdirSync22, writeFileSync as writeFileSync38 } from "fs";
|
|
20025
20038
|
import { join as join61 } from "path";
|
|
20026
20039
|
|
|
20027
20040
|
// src/commands/run/extractOption.ts
|
|
@@ -20084,7 +20097,7 @@ function saveNewRunConfig(name, command, args, cwd) {
|
|
|
20084
20097
|
}
|
|
20085
20098
|
function createCommandFile(name) {
|
|
20086
20099
|
const dir = join61(".claude", "commands");
|
|
20087
|
-
|
|
20100
|
+
mkdirSync22(dir, { recursive: true });
|
|
20088
20101
|
const content = `---
|
|
20089
20102
|
description: Run ${name}
|
|
20090
20103
|
---
|
|
@@ -20203,7 +20216,7 @@ function registerRun(program2) {
|
|
|
20203
20216
|
|
|
20204
20217
|
// src/commands/screenshot/index.ts
|
|
20205
20218
|
import { execSync as execSync50 } from "child_process";
|
|
20206
|
-
import { existsSync as existsSync52, mkdirSync as
|
|
20219
|
+
import { existsSync as existsSync52, mkdirSync as mkdirSync23, unlinkSync as unlinkSync19, writeFileSync as writeFileSync39 } from "fs";
|
|
20207
20220
|
import { tmpdir as tmpdir7 } from "os";
|
|
20208
20221
|
import { join as join63, resolve as resolve15 } from "path";
|
|
20209
20222
|
import chalk180 from "chalk";
|
|
@@ -20336,7 +20349,7 @@ Write-Output $OutputPath
|
|
|
20336
20349
|
// src/commands/screenshot/index.ts
|
|
20337
20350
|
function buildOutputPath(outputDir, processName) {
|
|
20338
20351
|
if (!existsSync52(outputDir)) {
|
|
20339
|
-
|
|
20352
|
+
mkdirSync23(outputDir, { recursive: true });
|
|
20340
20353
|
}
|
|
20341
20354
|
const timestamp4 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
20342
20355
|
return resolve15(outputDir, `${processName}-${timestamp4}.png`);
|
|
@@ -20596,7 +20609,7 @@ function requestDrain(socket) {
|
|
|
20596
20609
|
}
|
|
20597
20610
|
|
|
20598
20611
|
// src/commands/sessions/daemon/runDaemon.ts
|
|
20599
|
-
import { mkdirSync as
|
|
20612
|
+
import { mkdirSync as mkdirSync25 } from "fs";
|
|
20600
20613
|
|
|
20601
20614
|
// src/commands/sessions/daemon/createAutoExit.ts
|
|
20602
20615
|
var DEFAULT_GRACE_MS = 6e4;
|
|
@@ -21237,8 +21250,8 @@ function resumeSession(id2, sessionId, cwd, name) {
|
|
|
21237
21250
|
}
|
|
21238
21251
|
|
|
21239
21252
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
21240
|
-
import { existsSync as existsSync54, mkdirSync as
|
|
21241
|
-
import { dirname as
|
|
21253
|
+
import { existsSync as existsSync54, mkdirSync as mkdirSync24, watch } from "fs";
|
|
21254
|
+
import { dirname as dirname29 } from "path";
|
|
21242
21255
|
|
|
21243
21256
|
// src/commands/sessions/daemon/applyReviewPause.ts
|
|
21244
21257
|
function applyReviewPause(session, activity2) {
|
|
@@ -21256,9 +21269,9 @@ var DEBOUNCE_MS = 50;
|
|
|
21256
21269
|
function watchActivity(session, notify2) {
|
|
21257
21270
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
21258
21271
|
const path57 = activityPath(session.id);
|
|
21259
|
-
const dir =
|
|
21272
|
+
const dir = dirname29(path57);
|
|
21260
21273
|
try {
|
|
21261
|
-
|
|
21274
|
+
mkdirSync24(dir, { recursive: true });
|
|
21262
21275
|
} catch {
|
|
21263
21276
|
return;
|
|
21264
21277
|
}
|
|
@@ -22634,7 +22647,7 @@ async function recoverFromAddrInUse(server, manager, checkAutoExit) {
|
|
|
22634
22647
|
|
|
22635
22648
|
// src/commands/sessions/daemon/runDaemon.ts
|
|
22636
22649
|
async function runDaemon() {
|
|
22637
|
-
|
|
22650
|
+
mkdirSync25(daemonPaths.dir, { recursive: true });
|
|
22638
22651
|
daemonLog(
|
|
22639
22652
|
`starting (reason: ${process.env.ASSIST_DAEMON_SPAWN_REASON ?? "manual"})`
|
|
22640
22653
|
);
|