@staff0rd/assist 0.592.1 → 0.593.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +161 -146
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.593.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -30980,98 +30980,11 @@ function registerSync(program2) {
|
|
|
30980
30980
|
configHelp(syncCommand, rootConfigHelp.sync);
|
|
30981
30981
|
}
|
|
30982
30982
|
|
|
30983
|
-
// src/commands/transcript/
|
|
30984
|
-
import
|
|
30985
|
-
function createReadlineInterface() {
|
|
30986
|
-
return readline3.createInterface({
|
|
30987
|
-
input: process.stdin,
|
|
30988
|
-
output: process.stdout
|
|
30989
|
-
});
|
|
30990
|
-
}
|
|
30991
|
-
function askQuestion(rl, question) {
|
|
30992
|
-
return new Promise((resolve25) => {
|
|
30993
|
-
rl.question(question, (answer) => {
|
|
30994
|
-
resolve25(answer.trim());
|
|
30995
|
-
});
|
|
30996
|
-
});
|
|
30997
|
-
}
|
|
30998
|
-
|
|
30999
|
-
// src/commands/transcript/configure.ts
|
|
31000
|
-
function buildPrompt4(label2, current) {
|
|
31001
|
-
return current ? `${label2} [${current}]: ` : `${label2}: `;
|
|
31002
|
-
}
|
|
31003
|
-
function printExisting(existing) {
|
|
31004
|
-
console.log("Current configuration:");
|
|
31005
|
-
console.log(` VTT directory: ${existing.vttDir}`);
|
|
31006
|
-
console.log(` Transcripts directory: ${existing.transcriptsDir}`);
|
|
31007
|
-
console.log(` Summary directory: ${existing.summaryDir}`);
|
|
31008
|
-
console.log();
|
|
31009
|
-
}
|
|
31010
|
-
async function promptDirectories(rl, existing) {
|
|
31011
|
-
const vttDir = await askQuestion(
|
|
31012
|
-
rl,
|
|
31013
|
-
buildPrompt4("VTT directory", existing?.vttDir)
|
|
31014
|
-
);
|
|
31015
|
-
const transcriptsDir = await askQuestion(
|
|
31016
|
-
rl,
|
|
31017
|
-
buildPrompt4("Transcripts directory", existing?.transcriptsDir)
|
|
31018
|
-
);
|
|
31019
|
-
const summaryDir = await askQuestion(
|
|
31020
|
-
rl,
|
|
31021
|
-
buildPrompt4("Summary directory", existing?.summaryDir)
|
|
31022
|
-
);
|
|
31023
|
-
return {
|
|
31024
|
-
vttDir: vttDir || existing?.vttDir || "",
|
|
31025
|
-
transcriptsDir: transcriptsDir || existing?.transcriptsDir || "",
|
|
31026
|
-
summaryDir: summaryDir || existing?.summaryDir || ""
|
|
31027
|
-
};
|
|
31028
|
-
}
|
|
31029
|
-
function validateDirectories(transcript) {
|
|
31030
|
-
if (!transcript.vttDir || !transcript.transcriptsDir || !transcript.summaryDir) {
|
|
31031
|
-
console.error("\nError: All directories must be specified.");
|
|
31032
|
-
process.exit(1);
|
|
31033
|
-
}
|
|
31034
|
-
}
|
|
31035
|
-
async function configure() {
|
|
31036
|
-
const rl = createReadlineInterface();
|
|
31037
|
-
const config = loadProjectConfig();
|
|
31038
|
-
const existing = config.transcript;
|
|
31039
|
-
console.log("Configure transcript directories\n");
|
|
31040
|
-
if (existing) printExisting(existing);
|
|
31041
|
-
try {
|
|
31042
|
-
const transcript = await promptDirectories(rl, existing);
|
|
31043
|
-
rl.close();
|
|
31044
|
-
validateDirectories(transcript);
|
|
31045
|
-
saveConfig({ ...config, transcript });
|
|
31046
|
-
console.log("\nConfiguration saved.");
|
|
31047
|
-
} catch (error) {
|
|
31048
|
-
rl.close();
|
|
31049
|
-
throw error;
|
|
31050
|
-
}
|
|
31051
|
-
}
|
|
31052
|
-
|
|
31053
|
-
// src/commands/transcript/list.ts
|
|
31054
|
-
import { existsSync as existsSync64, readdirSync as readdirSync19, statSync as statSync10 } from "fs";
|
|
31055
|
-
import { join as join78 } from "path";
|
|
31056
|
-
function list4() {
|
|
31057
|
-
const { vttDir } = getTranscriptConfig();
|
|
31058
|
-
if (!existsSync64(vttDir)) return;
|
|
31059
|
-
for (const entry of readdirSync19(vttDir)) {
|
|
31060
|
-
if (!entry.endsWith(".vtt")) continue;
|
|
31061
|
-
if (statSync10(join78(vttDir, entry)).isDirectory()) continue;
|
|
31062
|
-
console.log(entry);
|
|
31063
|
-
}
|
|
31064
|
-
}
|
|
30983
|
+
// src/commands/transcript/clean.ts
|
|
30984
|
+
import { existsSync as existsSync64 } from "fs";
|
|
31065
30985
|
|
|
31066
|
-
// src/commands/transcript/
|
|
31067
|
-
import {
|
|
31068
|
-
existsSync as existsSync65,
|
|
31069
|
-
mkdirSync as mkdirSync27,
|
|
31070
|
-
readFileSync as readFileSync50,
|
|
31071
|
-
renameSync as renameSync2,
|
|
31072
|
-
writeFileSync as writeFileSync43
|
|
31073
|
-
} from "fs";
|
|
31074
|
-
import { basename as basename21, join as join79 } from "path";
|
|
30986
|
+
// src/commands/transcript/convertVttToMarkdown.ts
|
|
30987
|
+
import { readFileSync as readFileSync50 } from "fs";
|
|
31075
30988
|
|
|
31076
30989
|
// src/commands/transcript/cleanText.ts
|
|
31077
30990
|
function cleanText(text18) {
|
|
@@ -31276,13 +31189,114 @@ function formatChatLog(messages) {
|
|
|
31276
31189
|
return messages.map((msg) => `${msg.speaker}: ${msg.text}`).join("\n\n");
|
|
31277
31190
|
}
|
|
31278
31191
|
|
|
31279
|
-
// src/commands/transcript/
|
|
31280
|
-
var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
31192
|
+
// src/commands/transcript/convertVttToMarkdown.ts
|
|
31281
31193
|
function convertVttToMarkdown(inputPath) {
|
|
31282
31194
|
const cues = parseVtt(readFileSync50(inputPath, "utf8"));
|
|
31283
31195
|
const messages = cuesToChatMessages(deduplicateCues(cues));
|
|
31284
31196
|
return formatChatLog(messages);
|
|
31285
31197
|
}
|
|
31198
|
+
|
|
31199
|
+
// src/commands/transcript/clean.ts
|
|
31200
|
+
function clean(file) {
|
|
31201
|
+
if (!existsSync64(file)) {
|
|
31202
|
+
console.error(`Error: VTT file not found: ${file}`);
|
|
31203
|
+
process.exit(1);
|
|
31204
|
+
}
|
|
31205
|
+
const markdown = convertVttToMarkdown(file);
|
|
31206
|
+
if (!markdown) {
|
|
31207
|
+
console.error(`Error: no cues found in: ${file}`);
|
|
31208
|
+
process.exit(1);
|
|
31209
|
+
}
|
|
31210
|
+
console.log(markdown);
|
|
31211
|
+
}
|
|
31212
|
+
|
|
31213
|
+
// src/commands/transcript/shared.ts
|
|
31214
|
+
import * as readline3 from "readline";
|
|
31215
|
+
function createReadlineInterface() {
|
|
31216
|
+
return readline3.createInterface({
|
|
31217
|
+
input: process.stdin,
|
|
31218
|
+
output: process.stdout
|
|
31219
|
+
});
|
|
31220
|
+
}
|
|
31221
|
+
function askQuestion(rl, question) {
|
|
31222
|
+
return new Promise((resolve25) => {
|
|
31223
|
+
rl.question(question, (answer) => {
|
|
31224
|
+
resolve25(answer.trim());
|
|
31225
|
+
});
|
|
31226
|
+
});
|
|
31227
|
+
}
|
|
31228
|
+
|
|
31229
|
+
// src/commands/transcript/configure.ts
|
|
31230
|
+
function buildPrompt4(label2, current) {
|
|
31231
|
+
return current ? `${label2} [${current}]: ` : `${label2}: `;
|
|
31232
|
+
}
|
|
31233
|
+
function printExisting(existing) {
|
|
31234
|
+
console.log("Current configuration:");
|
|
31235
|
+
console.log(` VTT directory: ${existing.vttDir}`);
|
|
31236
|
+
console.log(` Transcripts directory: ${existing.transcriptsDir}`);
|
|
31237
|
+
console.log(` Summary directory: ${existing.summaryDir}`);
|
|
31238
|
+
console.log();
|
|
31239
|
+
}
|
|
31240
|
+
async function promptDirectories(rl, existing) {
|
|
31241
|
+
const vttDir = await askQuestion(
|
|
31242
|
+
rl,
|
|
31243
|
+
buildPrompt4("VTT directory", existing?.vttDir)
|
|
31244
|
+
);
|
|
31245
|
+
const transcriptsDir = await askQuestion(
|
|
31246
|
+
rl,
|
|
31247
|
+
buildPrompt4("Transcripts directory", existing?.transcriptsDir)
|
|
31248
|
+
);
|
|
31249
|
+
const summaryDir = await askQuestion(
|
|
31250
|
+
rl,
|
|
31251
|
+
buildPrompt4("Summary directory", existing?.summaryDir)
|
|
31252
|
+
);
|
|
31253
|
+
return {
|
|
31254
|
+
vttDir: vttDir || existing?.vttDir || "",
|
|
31255
|
+
transcriptsDir: transcriptsDir || existing?.transcriptsDir || "",
|
|
31256
|
+
summaryDir: summaryDir || existing?.summaryDir || ""
|
|
31257
|
+
};
|
|
31258
|
+
}
|
|
31259
|
+
function validateDirectories(transcript) {
|
|
31260
|
+
if (!transcript.vttDir || !transcript.transcriptsDir || !transcript.summaryDir) {
|
|
31261
|
+
console.error("\nError: All directories must be specified.");
|
|
31262
|
+
process.exit(1);
|
|
31263
|
+
}
|
|
31264
|
+
}
|
|
31265
|
+
async function configure() {
|
|
31266
|
+
const rl = createReadlineInterface();
|
|
31267
|
+
const config = loadProjectConfig();
|
|
31268
|
+
const existing = config.transcript;
|
|
31269
|
+
console.log("Configure transcript directories\n");
|
|
31270
|
+
if (existing) printExisting(existing);
|
|
31271
|
+
try {
|
|
31272
|
+
const transcript = await promptDirectories(rl, existing);
|
|
31273
|
+
rl.close();
|
|
31274
|
+
validateDirectories(transcript);
|
|
31275
|
+
saveConfig({ ...config, transcript });
|
|
31276
|
+
console.log("\nConfiguration saved.");
|
|
31277
|
+
} catch (error) {
|
|
31278
|
+
rl.close();
|
|
31279
|
+
throw error;
|
|
31280
|
+
}
|
|
31281
|
+
}
|
|
31282
|
+
|
|
31283
|
+
// src/commands/transcript/list.ts
|
|
31284
|
+
import { existsSync as existsSync65, readdirSync as readdirSync19, statSync as statSync10 } from "fs";
|
|
31285
|
+
import { join as join78 } from "path";
|
|
31286
|
+
function list4() {
|
|
31287
|
+
const { vttDir } = getTranscriptConfig();
|
|
31288
|
+
if (!existsSync65(vttDir)) return;
|
|
31289
|
+
for (const entry of readdirSync19(vttDir)) {
|
|
31290
|
+
if (!entry.endsWith(".vtt")) continue;
|
|
31291
|
+
if (statSync10(join78(vttDir, entry)).isDirectory()) continue;
|
|
31292
|
+
console.log(entry);
|
|
31293
|
+
}
|
|
31294
|
+
}
|
|
31295
|
+
|
|
31296
|
+
// src/commands/transcript/move.ts
|
|
31297
|
+
import { existsSync as existsSync66, mkdirSync as mkdirSync27, renameSync as renameSync2, writeFileSync as writeFileSync43 } from "fs";
|
|
31298
|
+
import { basename as basename21, join as join79 } from "path";
|
|
31299
|
+
var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
31286
31300
|
function archiveRawVtt(vttDir, sourcePath, filename) {
|
|
31287
31301
|
const processedDir = join79(vttDir, "processed");
|
|
31288
31302
|
mkdirSync27(processedDir, { recursive: true });
|
|
@@ -31297,7 +31311,7 @@ function move(file, options2) {
|
|
|
31297
31311
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
31298
31312
|
const filename = basename21(file);
|
|
31299
31313
|
const sourcePath = join79(vttDir, filename);
|
|
31300
|
-
if (!
|
|
31314
|
+
if (!existsSync66(sourcePath)) {
|
|
31301
31315
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
31302
31316
|
process.exit(1);
|
|
31303
31317
|
}
|
|
@@ -31319,6 +31333,7 @@ function registerTranscript(program2) {
|
|
|
31319
31333
|
configHelp(transcriptCommand, transcriptConfigHelp);
|
|
31320
31334
|
transcriptCommand.command("configure").description("Configure transcript directories").action(configure);
|
|
31321
31335
|
transcriptCommand.command("list").description("List raw .vtt filenames waiting in the pick-up directory").action(list4);
|
|
31336
|
+
transcriptCommand.command("clean <path>").description("Clean any .vtt file and write the chat log to stdout").action(clean);
|
|
31322
31337
|
transcriptCommand.command("move <file>").description(
|
|
31323
31338
|
"Convert a raw .vtt to a dated markdown transcript and archive the original"
|
|
31324
31339
|
).requiredOption("--date <YYYY-MM-DD>", "meeting date").requiredOption("--client <name>", "client name").action(move);
|
|
@@ -31426,9 +31441,9 @@ function devices() {
|
|
|
31426
31441
|
}
|
|
31427
31442
|
|
|
31428
31443
|
// src/commands/voice/logs.ts
|
|
31429
|
-
import { existsSync as
|
|
31444
|
+
import { existsSync as existsSync67, readFileSync as readFileSync51 } from "fs";
|
|
31430
31445
|
function logs(options2) {
|
|
31431
|
-
if (!
|
|
31446
|
+
if (!existsSync67(voicePaths.log)) {
|
|
31432
31447
|
console.log("No voice log file found");
|
|
31433
31448
|
return;
|
|
31434
31449
|
}
|
|
@@ -31460,7 +31475,7 @@ import { join as join83 } from "path";
|
|
|
31460
31475
|
|
|
31461
31476
|
// src/commands/voice/checkLockFile.ts
|
|
31462
31477
|
import { execSync as execSync58 } from "child_process";
|
|
31463
|
-
import { existsSync as
|
|
31478
|
+
import { existsSync as existsSync68, mkdirSync as mkdirSync28, readFileSync as readFileSync52, writeFileSync as writeFileSync44 } from "fs";
|
|
31464
31479
|
import { join as join82 } from "path";
|
|
31465
31480
|
function isProcessAlive2(pid) {
|
|
31466
31481
|
try {
|
|
@@ -31472,7 +31487,7 @@ function isProcessAlive2(pid) {
|
|
|
31472
31487
|
}
|
|
31473
31488
|
function checkLockFile() {
|
|
31474
31489
|
const lockFile = getLockFile();
|
|
31475
|
-
if (!
|
|
31490
|
+
if (!existsSync68(lockFile)) return;
|
|
31476
31491
|
try {
|
|
31477
31492
|
const lock2 = JSON.parse(readFileSync52(lockFile, "utf8"));
|
|
31478
31493
|
if (lock2.pid && isProcessAlive2(lock2.pid)) {
|
|
@@ -31485,7 +31500,7 @@ function checkLockFile() {
|
|
|
31485
31500
|
}
|
|
31486
31501
|
}
|
|
31487
31502
|
function bootstrapVenv() {
|
|
31488
|
-
if (
|
|
31503
|
+
if (existsSync68(getVenvPython())) return;
|
|
31489
31504
|
console.log("Setting up Python environment...");
|
|
31490
31505
|
const pythonDir = getPythonDir();
|
|
31491
31506
|
execSync58(
|
|
@@ -31576,7 +31591,7 @@ function start2(options2) {
|
|
|
31576
31591
|
}
|
|
31577
31592
|
|
|
31578
31593
|
// src/commands/voice/status.ts
|
|
31579
|
-
import { existsSync as
|
|
31594
|
+
import { existsSync as existsSync69, readFileSync as readFileSync53 } from "fs";
|
|
31580
31595
|
function isProcessAlive3(pid) {
|
|
31581
31596
|
try {
|
|
31582
31597
|
process.kill(pid, 0);
|
|
@@ -31586,12 +31601,12 @@ function isProcessAlive3(pid) {
|
|
|
31586
31601
|
}
|
|
31587
31602
|
}
|
|
31588
31603
|
function readRecentLogs(count8) {
|
|
31589
|
-
if (!
|
|
31604
|
+
if (!existsSync69(voicePaths.log)) return [];
|
|
31590
31605
|
const lines2 = readFileSync53(voicePaths.log, "utf8").trim().split("\n");
|
|
31591
31606
|
return lines2.slice(-count8);
|
|
31592
31607
|
}
|
|
31593
31608
|
function status2() {
|
|
31594
|
-
if (!
|
|
31609
|
+
if (!existsSync69(voicePaths.pid)) {
|
|
31595
31610
|
console.log("Voice daemon: not running (no PID file)");
|
|
31596
31611
|
return;
|
|
31597
31612
|
}
|
|
@@ -31614,9 +31629,9 @@ function status2() {
|
|
|
31614
31629
|
}
|
|
31615
31630
|
|
|
31616
31631
|
// src/commands/voice/stop.ts
|
|
31617
|
-
import { existsSync as
|
|
31632
|
+
import { existsSync as existsSync70, readFileSync as readFileSync54, unlinkSync as unlinkSync20 } from "fs";
|
|
31618
31633
|
function stop2() {
|
|
31619
|
-
if (!
|
|
31634
|
+
if (!existsSync70(voicePaths.pid)) {
|
|
31620
31635
|
console.log("Voice daemon is not running (no PID file)");
|
|
31621
31636
|
return;
|
|
31622
31637
|
}
|
|
@@ -31633,7 +31648,7 @@ function stop2() {
|
|
|
31633
31648
|
}
|
|
31634
31649
|
try {
|
|
31635
31650
|
const lockFile = getLockFile();
|
|
31636
|
-
if (
|
|
31651
|
+
if (existsSync70(lockFile)) unlinkSync20(lockFile);
|
|
31637
31652
|
} catch {
|
|
31638
31653
|
}
|
|
31639
31654
|
console.log("Voice daemon stopped");
|
|
@@ -32038,7 +32053,7 @@ function resolveParams(params, cliArgs) {
|
|
|
32038
32053
|
}
|
|
32039
32054
|
|
|
32040
32055
|
// src/commands/run/resolveRunCwd.ts
|
|
32041
|
-
import { existsSync as
|
|
32056
|
+
import { existsSync as existsSync71 } from "fs";
|
|
32042
32057
|
import { resolve as resolve19 } from "path";
|
|
32043
32058
|
var MissingRunCwdError = class extends Error {
|
|
32044
32059
|
constructor(runName, cwd) {
|
|
@@ -32051,17 +32066,17 @@ var MissingRunCwdError = class extends Error {
|
|
|
32051
32066
|
function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
|
|
32052
32067
|
if (!config.cwd) return void 0;
|
|
32053
32068
|
const cwd = resolve19(baseDir, config.cwd);
|
|
32054
|
-
if (!
|
|
32069
|
+
if (!existsSync71(cwd)) throw new MissingRunCwdError(config.name, cwd);
|
|
32055
32070
|
return cwd;
|
|
32056
32071
|
}
|
|
32057
32072
|
|
|
32058
32073
|
// src/commands/run/runCommandToCompletion.ts
|
|
32059
32074
|
import { spawn as spawn9 } from "child_process";
|
|
32060
|
-
import { existsSync as
|
|
32075
|
+
import { existsSync as existsSync73 } from "fs";
|
|
32061
32076
|
|
|
32062
32077
|
// src/commands/run/resolveCommand.ts
|
|
32063
32078
|
import { execFileSync as execFileSync16 } from "child_process";
|
|
32064
|
-
import { existsSync as
|
|
32079
|
+
import { existsSync as existsSync72 } from "fs";
|
|
32065
32080
|
import { dirname as dirname37, join as join86, resolve as resolve20 } from "path";
|
|
32066
32081
|
function resolveCommand2(command) {
|
|
32067
32082
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
@@ -32069,7 +32084,7 @@ function resolveCommand2(command) {
|
|
|
32069
32084
|
const gitPath = execFileSync16("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
32070
32085
|
const gitRoot = resolve20(dirname37(gitPath), "..");
|
|
32071
32086
|
const gitBash = join86(gitRoot, "bin", "bash.exe");
|
|
32072
|
-
if (
|
|
32087
|
+
if (existsSync72(gitBash)) return gitBash;
|
|
32073
32088
|
} catch {
|
|
32074
32089
|
return command;
|
|
32075
32090
|
}
|
|
@@ -32079,7 +32094,7 @@ function resolveCommand2(command) {
|
|
|
32079
32094
|
// src/commands/run/runCommandToCompletion.ts
|
|
32080
32095
|
function runCommandToCompletion(command, args, env, cwd, quiet) {
|
|
32081
32096
|
return new Promise((resolveResult) => {
|
|
32082
|
-
if (cwd && !
|
|
32097
|
+
if (cwd && !existsSync73(cwd)) {
|
|
32083
32098
|
resolveResult({
|
|
32084
32099
|
kind: "failed",
|
|
32085
32100
|
message: `Failed to execute command: cwd ${cwd} does not exist`
|
|
@@ -32775,7 +32790,7 @@ function link2() {
|
|
|
32775
32790
|
}
|
|
32776
32791
|
|
|
32777
32792
|
// src/commands/run/remove.ts
|
|
32778
|
-
import { existsSync as
|
|
32793
|
+
import { existsSync as existsSync74, unlinkSync as unlinkSync21 } from "fs";
|
|
32779
32794
|
import { join as join89 } from "path";
|
|
32780
32795
|
function findRemoveIndex() {
|
|
32781
32796
|
const idx = process.argv.indexOf("remove");
|
|
@@ -32792,7 +32807,7 @@ function parseRemoveName() {
|
|
|
32792
32807
|
}
|
|
32793
32808
|
function deleteCommandFile(name) {
|
|
32794
32809
|
const filePath = join89(".claude", "commands", `${name}.md`);
|
|
32795
|
-
if (
|
|
32810
|
+
if (existsSync74(filePath)) {
|
|
32796
32811
|
unlinkSync21(filePath);
|
|
32797
32812
|
console.log(`Deleted command file: ${filePath}`);
|
|
32798
32813
|
}
|
|
@@ -32837,7 +32852,7 @@ function registerRun(program2) {
|
|
|
32837
32852
|
|
|
32838
32853
|
// src/commands/screenshot/index.ts
|
|
32839
32854
|
import { execSync as execSync60 } from "child_process";
|
|
32840
|
-
import { existsSync as
|
|
32855
|
+
import { existsSync as existsSync75, mkdirSync as mkdirSync32, unlinkSync as unlinkSync22, writeFileSync as writeFileSync47 } from "fs";
|
|
32841
32856
|
import { tmpdir as tmpdir8 } from "os";
|
|
32842
32857
|
import { join as join90, resolve as resolve21 } from "path";
|
|
32843
32858
|
import chalk222 from "chalk";
|
|
@@ -32969,7 +32984,7 @@ Write-Output $OutputPath
|
|
|
32969
32984
|
|
|
32970
32985
|
// src/commands/screenshot/index.ts
|
|
32971
32986
|
function buildOutputPath(outputDir, processName) {
|
|
32972
|
-
if (!
|
|
32987
|
+
if (!existsSync75(outputDir)) {
|
|
32973
32988
|
mkdirSync32(outputDir, { recursive: true });
|
|
32974
32989
|
}
|
|
32975
32990
|
const timestamp6 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
@@ -33314,12 +33329,12 @@ function toSessionRunInfo({
|
|
|
33314
33329
|
}
|
|
33315
33330
|
|
|
33316
33331
|
// src/commands/sessions/daemon/worktree/joinRefusal.ts
|
|
33317
|
-
import { existsSync as
|
|
33332
|
+
import { existsSync as existsSync76 } from "fs";
|
|
33318
33333
|
function joinRefusal(session) {
|
|
33319
33334
|
if (session.commandType === "run") return "a server run has no agent stream";
|
|
33320
33335
|
if (session.closing === true) return "the session is closing";
|
|
33321
33336
|
if (!session.cwd) return "the session has no working directory";
|
|
33322
|
-
if (!
|
|
33337
|
+
if (!existsSync76(session.cwd))
|
|
33323
33338
|
return "the session's workspace no longer exists";
|
|
33324
33339
|
return void 0;
|
|
33325
33340
|
}
|
|
@@ -33483,11 +33498,11 @@ function sessionBase(id, status3) {
|
|
|
33483
33498
|
}
|
|
33484
33499
|
|
|
33485
33500
|
// src/commands/sessions/daemon/spawnPty.ts
|
|
33486
|
-
import { existsSync as
|
|
33501
|
+
import { existsSync as existsSync78 } from "fs";
|
|
33487
33502
|
import * as pty from "node-pty";
|
|
33488
33503
|
|
|
33489
33504
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
33490
|
-
import { chmodSync, existsSync as
|
|
33505
|
+
import { chmodSync, existsSync as existsSync77, statSync as statSync12 } from "fs";
|
|
33491
33506
|
import { createRequire as createRequire3 } from "module";
|
|
33492
33507
|
import path75 from "path";
|
|
33493
33508
|
var require4 = createRequire3(import.meta.url);
|
|
@@ -33502,7 +33517,7 @@ function ensureSpawnHelperExecutable() {
|
|
|
33502
33517
|
`${process.platform}-${process.arch}`,
|
|
33503
33518
|
"spawn-helper"
|
|
33504
33519
|
);
|
|
33505
|
-
if (!
|
|
33520
|
+
if (!existsSync77(helper)) return;
|
|
33506
33521
|
const mode = statSync12(helper).mode;
|
|
33507
33522
|
if ((mode & 73) === 0) chmodSync(helper, mode | 493);
|
|
33508
33523
|
}
|
|
@@ -33538,7 +33553,7 @@ function spawnPty(args, cwd, sessionId, extraEnv) {
|
|
|
33538
33553
|
});
|
|
33539
33554
|
}
|
|
33540
33555
|
function refuseMissingCwd(cwd, sessionId) {
|
|
33541
|
-
if (!cwd ||
|
|
33556
|
+
if (!cwd || existsSync78(cwd)) return;
|
|
33542
33557
|
daemonLog(
|
|
33543
33558
|
`${sessionId ? `session ${sessionId}` : "pty"} not spawned: working directory ${cwd} no longer exists`
|
|
33544
33559
|
);
|
|
@@ -33720,11 +33735,11 @@ function setStatus2(session, newStatus) {
|
|
|
33720
33735
|
}
|
|
33721
33736
|
|
|
33722
33737
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
33723
|
-
import { existsSync as
|
|
33738
|
+
import { existsSync as existsSync80 } from "fs";
|
|
33724
33739
|
import { basename as basename22 } from "path";
|
|
33725
33740
|
|
|
33726
33741
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
33727
|
-
import { existsSync as
|
|
33742
|
+
import { existsSync as existsSync79 } from "fs";
|
|
33728
33743
|
import { join as join93 } from "path";
|
|
33729
33744
|
|
|
33730
33745
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
@@ -33794,7 +33809,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
33794
33809
|
);
|
|
33795
33810
|
}
|
|
33796
33811
|
function strandedReason(worktreePath, cause) {
|
|
33797
|
-
if (!
|
|
33812
|
+
if (!existsSync79(join93(worktreePath, ".git")))
|
|
33798
33813
|
return "its .git link is already gone";
|
|
33799
33814
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
33800
33815
|
return "git no longer recognises it as a working tree";
|
|
@@ -33846,7 +33861,7 @@ function reason3(error) {
|
|
|
33846
33861
|
|
|
33847
33862
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
33848
33863
|
async function reapWorktree(worktreePath, force = false) {
|
|
33849
|
-
if (!
|
|
33864
|
+
if (!existsSync80(worktreePath)) {
|
|
33850
33865
|
forgetWorktree(worktreePath);
|
|
33851
33866
|
daemonLog(
|
|
33852
33867
|
`worktree ${worktreePath} already gone; its record was forgotten`
|
|
@@ -33871,7 +33886,7 @@ async function reapWorktree(worktreePath, force = false) {
|
|
|
33871
33886
|
}
|
|
33872
33887
|
function owningClone(worktreePath) {
|
|
33873
33888
|
const recorded = worktreeAttributionIncludingReaped(worktreePath)?.clone;
|
|
33874
|
-
if (recorded &&
|
|
33889
|
+
if (recorded && existsSync80(recorded)) return recorded;
|
|
33875
33890
|
const detected = mainWorktree(worktreePath);
|
|
33876
33891
|
if (detected) return detected;
|
|
33877
33892
|
daemonLog(
|
|
@@ -34002,12 +34017,12 @@ function closeGateApplies(sessions, session) {
|
|
|
34002
34017
|
}
|
|
34003
34018
|
|
|
34004
34019
|
// src/commands/sessions/daemon/worktree/watchGitState.ts
|
|
34005
|
-
import { existsSync as
|
|
34020
|
+
import { existsSync as existsSync81, watch } from "fs";
|
|
34006
34021
|
var DEBOUNCE_MS = 500;
|
|
34007
34022
|
var POLL_MS = 3e4;
|
|
34008
34023
|
function watchGitState(cwd, onChange) {
|
|
34009
34024
|
const common = gitCommonDir(cwd);
|
|
34010
|
-
if (!common || !
|
|
34025
|
+
if (!common || !existsSync81(common)) return void 0;
|
|
34011
34026
|
const watchers = [
|
|
34012
34027
|
watchGitDir(common, onChange),
|
|
34013
34028
|
pollGitState(cwd, onChange)
|
|
@@ -34484,10 +34499,10 @@ function emitSessionOutput(session, clients, data) {
|
|
|
34484
34499
|
}
|
|
34485
34500
|
|
|
34486
34501
|
// src/commands/sessions/daemon/exitReason.ts
|
|
34487
|
-
import { existsSync as
|
|
34502
|
+
import { existsSync as existsSync82 } from "fs";
|
|
34488
34503
|
import { resolve as resolve22 } from "path";
|
|
34489
34504
|
function exitDetail(session) {
|
|
34490
|
-
if (session.cwd && !
|
|
34505
|
+
if (session.cwd && !existsSync82(session.cwd))
|
|
34491
34506
|
return `working directory ${session.cwd} no longer exists`;
|
|
34492
34507
|
return missingRunConfigCwd(session);
|
|
34493
34508
|
}
|
|
@@ -34501,7 +34516,7 @@ function missingRunConfigCwd(session) {
|
|
|
34501
34516
|
const config = resolveRunConfig(session.runName, dir);
|
|
34502
34517
|
if (!config?.cwd) return void 0;
|
|
34503
34518
|
const configured = resolve22(runConfigBaseDirFrom(dir), config.cwd);
|
|
34504
|
-
if (
|
|
34519
|
+
if (existsSync82(configured)) return void 0;
|
|
34505
34520
|
return `run config "${config.name}": cwd ${configured} does not exist`;
|
|
34506
34521
|
}
|
|
34507
34522
|
|
|
@@ -34542,7 +34557,7 @@ function handleFailedResume(session, exitCode, onStatusChange) {
|
|
|
34542
34557
|
}
|
|
34543
34558
|
|
|
34544
34559
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
34545
|
-
import { existsSync as
|
|
34560
|
+
import { existsSync as existsSync83, mkdirSync as mkdirSync33, watch as watch2 } from "fs";
|
|
34546
34561
|
import { dirname as dirname39 } from "path";
|
|
34547
34562
|
|
|
34548
34563
|
// src/commands/sessions/daemon/applyActivityToSession.ts
|
|
@@ -34628,7 +34643,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
34628
34643
|
if (timer) clearTimeout(timer);
|
|
34629
34644
|
timer = setTimeout(read2, DEBOUNCE_MS2);
|
|
34630
34645
|
});
|
|
34631
|
-
if (
|
|
34646
|
+
if (existsSync83(path80)) read2();
|
|
34632
34647
|
}
|
|
34633
34648
|
function refreshActivity(session) {
|
|
34634
34649
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -36279,7 +36294,7 @@ function rearmStoppedSessions(sessions, notify2) {
|
|
|
36279
36294
|
}
|
|
36280
36295
|
|
|
36281
36296
|
// src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
|
|
36282
|
-
import { existsSync as
|
|
36297
|
+
import { existsSync as existsSync86 } from "fs";
|
|
36283
36298
|
import { basename as basename24 } from "path";
|
|
36284
36299
|
|
|
36285
36300
|
// src/commands/sessions/daemon/worktree/accountedTrees.ts
|
|
@@ -36334,9 +36349,9 @@ function bindResumedWorktree(session, cwd, notify2) {
|
|
|
36334
36349
|
}
|
|
36335
36350
|
|
|
36336
36351
|
// src/commands/sessions/daemon/worktree/reclaimVanishedWorktrees.ts
|
|
36337
|
-
import { existsSync as
|
|
36352
|
+
import { existsSync as existsSync85 } from "fs";
|
|
36338
36353
|
async function reclaimVanishedWorktrees(clone, paths) {
|
|
36339
|
-
if (!
|
|
36354
|
+
if (!existsSync85(clone)) {
|
|
36340
36355
|
for (const { path: path80 } of paths) forgetWorktree(path80);
|
|
36341
36356
|
daemonLog(
|
|
36342
36357
|
`clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
|
|
@@ -36502,7 +36517,7 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
|
36502
36517
|
);
|
|
36503
36518
|
continue;
|
|
36504
36519
|
}
|
|
36505
|
-
if (!
|
|
36520
|
+
if (!existsSync86(path80)) {
|
|
36506
36521
|
logVanishedTree(sessions, path80);
|
|
36507
36522
|
vanished.set(clone, [
|
|
36508
36523
|
...vanished.get(clone) ?? [],
|
|
@@ -37119,13 +37134,13 @@ async function defaultConnect() {
|
|
|
37119
37134
|
}
|
|
37120
37135
|
|
|
37121
37136
|
// src/commands/sessions/daemon/hasPersistedWindowsSessions.ts
|
|
37122
|
-
import { existsSync as
|
|
37137
|
+
import { existsSync as existsSync87, readFileSync as readFileSync58 } from "fs";
|
|
37123
37138
|
import { posix as posix3 } from "path";
|
|
37124
37139
|
function hasPersistedWindowsSessions() {
|
|
37125
37140
|
const sessionsFile = windowsSessionsFileFromWsl();
|
|
37126
37141
|
if (!sessionsFile) return false;
|
|
37127
37142
|
try {
|
|
37128
|
-
if (!
|
|
37143
|
+
if (!existsSync87(sessionsFile)) return false;
|
|
37129
37144
|
const data = JSON.parse(readFileSync58(sessionsFile, "utf8"));
|
|
37130
37145
|
return Array.isArray(data) && data.length > 0;
|
|
37131
37146
|
} catch (error) {
|
|
@@ -37860,7 +37875,7 @@ function setAutoAdvance(sessions, id, enabled) {
|
|
|
37860
37875
|
}
|
|
37861
37876
|
|
|
37862
37877
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
37863
|
-
import { existsSync as
|
|
37878
|
+
import { existsSync as existsSync90 } from "fs";
|
|
37864
37879
|
|
|
37865
37880
|
// src/commands/sessions/daemon/resumeSession.ts
|
|
37866
37881
|
function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
@@ -37891,10 +37906,10 @@ function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
|
37891
37906
|
}
|
|
37892
37907
|
|
|
37893
37908
|
// src/commands/sessions/daemon/worktree/resumeInReplacementTree.ts
|
|
37894
|
-
import { existsSync as
|
|
37909
|
+
import { existsSync as existsSync89 } from "fs";
|
|
37895
37910
|
|
|
37896
37911
|
// src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
|
|
37897
|
-
import { copyFileSync as copyFileSync7, existsSync as
|
|
37912
|
+
import { copyFileSync as copyFileSync7, existsSync as existsSync88, mkdirSync as mkdirSync35 } from "fs";
|
|
37898
37913
|
import { join as join95 } from "path";
|
|
37899
37914
|
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
37900
37915
|
const dir = projectDirForCwd(toCwd);
|
|
@@ -37905,7 +37920,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
37905
37920
|
return;
|
|
37906
37921
|
}
|
|
37907
37922
|
const dest = join95(dir, `${claudeSessionId}.jsonl`);
|
|
37908
|
-
if (
|
|
37923
|
+
if (existsSync88(dest)) {
|
|
37909
37924
|
daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
|
|
37910
37925
|
return;
|
|
37911
37926
|
}
|
|
@@ -37956,7 +37971,7 @@ function resumeInReplacementTree(ctx, claudeSessionId, missingCwd, name, harness
|
|
|
37956
37971
|
}
|
|
37957
37972
|
function cloneForReapedTree(missingCwd) {
|
|
37958
37973
|
const clone = worktreeAttributionIncludingReaped(missingCwd)?.clone;
|
|
37959
|
-
if (!clone || !
|
|
37974
|
+
if (!clone || !existsSync89(clone))
|
|
37960
37975
|
throw new Error(
|
|
37961
37976
|
`working directory no longer exists and no clone is recorded to re-allocate from: ${missingCwd}`
|
|
37962
37977
|
);
|
|
@@ -37965,7 +37980,7 @@ function cloneForReapedTree(missingCwd) {
|
|
|
37965
37980
|
|
|
37966
37981
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
37967
37982
|
function resumeInTree(ctx, sessionId, cwd, name, harness) {
|
|
37968
|
-
if (!
|
|
37983
|
+
if (!existsSync90(cwd))
|
|
37969
37984
|
return resumeInReplacementTree(ctx, sessionId, cwd, name, harness);
|
|
37970
37985
|
const id = ctx.spawnWith(
|
|
37971
37986
|
(sid) => resumeSession(sid, sessionId, cwd, name, void 0, harness)
|