@staff0rd/assist 0.669.0 → 0.670.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 +2 -1
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +132 -65
- 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.670.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -33611,43 +33611,98 @@ function parseSlackThreadRef(value) {
|
|
|
33611
33611
|
}
|
|
33612
33612
|
|
|
33613
33613
|
// src/commands/slack/postSlackMessage.ts
|
|
33614
|
+
import { mkdirSync as mkdirSync25, writeFileSync as writeFileSync44 } from "fs";
|
|
33615
|
+
|
|
33616
|
+
// src/commands/slack/previewSlackThreadParts.ts
|
|
33614
33617
|
import { mkdirSync as mkdirSync24, writeFileSync as writeFileSync43 } from "fs";
|
|
33615
33618
|
|
|
33619
|
+
// src/commands/slack/readSlackParts.ts
|
|
33620
|
+
import { readFileSync as readFileSync53 } from "fs";
|
|
33621
|
+
function readSlackParts(files) {
|
|
33622
|
+
return files.map((file) => {
|
|
33623
|
+
let contents;
|
|
33624
|
+
try {
|
|
33625
|
+
contents = readFileSync53(file, "utf8");
|
|
33626
|
+
} catch {
|
|
33627
|
+
console.error(`Error: Part file not found: ${file}`);
|
|
33628
|
+
process.exit(1);
|
|
33629
|
+
}
|
|
33630
|
+
const body = contents.trim();
|
|
33631
|
+
if (body.length === 0) {
|
|
33632
|
+
console.error(`Error: Part file is empty: ${file}`);
|
|
33633
|
+
process.exit(1);
|
|
33634
|
+
}
|
|
33635
|
+
return body;
|
|
33636
|
+
});
|
|
33637
|
+
}
|
|
33638
|
+
|
|
33616
33639
|
// src/commands/slack/reviewProposedSlackMessage.ts
|
|
33617
33640
|
import { randomUUID as randomUUID18 } from "crypto";
|
|
33618
33641
|
async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
33619
33642
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
33620
33643
|
if (process.env.ASSIST_SESSION !== "1" || !sessionId) return;
|
|
33621
|
-
const { channel, threadTs } = target;
|
|
33644
|
+
const { channel, threadTs, part } = target;
|
|
33645
|
+
const destination = threadTs ? `Reply in ${channel} thread ${threadTs}` : `Post to ${channel}`;
|
|
33622
33646
|
await awaitPreviewApproval(
|
|
33623
|
-
"Slack message preview",
|
|
33647
|
+
part ? `Slack message ${part.index} of ${part.total}` : "Slack message preview",
|
|
33624
33648
|
{
|
|
33625
33649
|
sessionId,
|
|
33626
33650
|
requestId: randomUUID18(),
|
|
33627
|
-
title:
|
|
33651
|
+
title: part ? `${destination} (${part.index}/${part.total})` : destination,
|
|
33628
33652
|
body,
|
|
33629
33653
|
prNumber: null,
|
|
33630
33654
|
kind: "slack-post"
|
|
33631
33655
|
},
|
|
33632
33656
|
{
|
|
33633
|
-
rejectionAdvice: `Nothing was posted to ${channel}. The previewed markdown is at ${workingPath}: revise that file in place and re-run this command to preview the revision.`
|
|
33657
|
+
rejectionAdvice: part ? `Nothing was posted to ${channel} and no part of this thread was handed back. The previewed markdown for part ${part.index} of ${part.total} is at ${workingPath}: revise that file in place, then re-run the whole batch with it in place of part ${part.index} to preview again from part 1.` : `Nothing was posted to ${channel}. The previewed markdown is at ${workingPath}: revise that file in place and re-run this command to preview the revision.`
|
|
33634
33658
|
}
|
|
33635
33659
|
);
|
|
33636
33660
|
}
|
|
33637
33661
|
|
|
33638
33662
|
// src/commands/slack/slackWorkingFile.ts
|
|
33639
33663
|
import { join as join78 } from "path";
|
|
33640
|
-
function slackWorkingFile(channel) {
|
|
33664
|
+
function slackWorkingFile(channel, partIndex) {
|
|
33641
33665
|
const slug2 = channel.replace(/^[#@]/, "").toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "channel";
|
|
33642
33666
|
const dir = join78(getStoreDir(), "slack");
|
|
33643
|
-
|
|
33667
|
+
const name = partIndex === void 0 ? slug2 : `${slug2}-${partIndex}`;
|
|
33668
|
+
return { dir, bodyPath: join78(dir, `${name}.md`) };
|
|
33669
|
+
}
|
|
33670
|
+
|
|
33671
|
+
// src/commands/slack/previewSlackThreadParts.ts
|
|
33672
|
+
async function previewSlackThreadParts({
|
|
33673
|
+
channel,
|
|
33674
|
+
threadTs,
|
|
33675
|
+
target,
|
|
33676
|
+
partFiles
|
|
33677
|
+
}) {
|
|
33678
|
+
const bodies = readSlackParts(partFiles);
|
|
33679
|
+
const { dir } = slackWorkingFile(channel);
|
|
33680
|
+
mkdirSync24(dir, { recursive: true });
|
|
33681
|
+
const paths = bodies.map((body, index3) => {
|
|
33682
|
+
const { bodyPath } = slackWorkingFile(channel, index3 + 1);
|
|
33683
|
+
writeFileSync43(bodyPath, `${body}
|
|
33684
|
+
`);
|
|
33685
|
+
return bodyPath;
|
|
33686
|
+
});
|
|
33687
|
+
for (const [index3, body] of bodies.entries()) {
|
|
33688
|
+
await reviewProposedSlackMessage(
|
|
33689
|
+
{ channel, threadTs, part: { index: index3 + 1, total: bodies.length } },
|
|
33690
|
+
body,
|
|
33691
|
+
paths[index3]
|
|
33692
|
+
);
|
|
33693
|
+
}
|
|
33694
|
+
console.log(
|
|
33695
|
+
`Approved for ${target}. The ${bodies.length} bodies to post, in thread order, are at:`
|
|
33696
|
+
);
|
|
33697
|
+
for (const path91 of paths) console.log(path91);
|
|
33644
33698
|
}
|
|
33645
33699
|
|
|
33646
33700
|
// src/commands/slack/postSlackMessage.ts
|
|
33647
|
-
var USAGE7 = "Usage: assist slack post [channel] --body <body|->";
|
|
33701
|
+
var USAGE7 = "Usage: assist slack post [channel] --body <body|-> | --parts <file>...";
|
|
33648
33702
|
async function postSlackMessage(channelArg, options2) {
|
|
33649
33703
|
const channel = (channelArg ?? loadConfig().slack?.channel ?? "").trim();
|
|
33650
33704
|
const body = options2.body?.trim();
|
|
33705
|
+
const partFiles = options2.parts ?? [];
|
|
33651
33706
|
if (!channel) {
|
|
33652
33707
|
console.error(
|
|
33653
33708
|
'No channel given and slack.channel is not set. Pass one, or set a default with: assist config set slack.channel "#general"'
|
|
@@ -33655,17 +33710,26 @@ async function postSlackMessage(channelArg, options2) {
|
|
|
33655
33710
|
console.error(USAGE7);
|
|
33656
33711
|
process.exit(1);
|
|
33657
33712
|
}
|
|
33658
|
-
if (
|
|
33713
|
+
if (body && partFiles.length > 0) {
|
|
33714
|
+
console.error("Error: --parts cannot be combined with --body.");
|
|
33659
33715
|
console.error(USAGE7);
|
|
33660
33716
|
process.exit(1);
|
|
33661
33717
|
}
|
|
33662
33718
|
const threadTs = options2.thread;
|
|
33719
|
+
const target = threadTs ? `${channel} (thread_ts ${threadTs})` : channel;
|
|
33720
|
+
if (partFiles.length > 0) {
|
|
33721
|
+
await previewSlackThreadParts({ channel, threadTs, target, partFiles });
|
|
33722
|
+
return;
|
|
33723
|
+
}
|
|
33724
|
+
if (!body) {
|
|
33725
|
+
console.error(USAGE7);
|
|
33726
|
+
process.exit(1);
|
|
33727
|
+
}
|
|
33663
33728
|
const { dir, bodyPath } = slackWorkingFile(channel);
|
|
33664
|
-
|
|
33665
|
-
|
|
33729
|
+
mkdirSync25(dir, { recursive: true });
|
|
33730
|
+
writeFileSync44(bodyPath, `${body}
|
|
33666
33731
|
`);
|
|
33667
33732
|
await reviewProposedSlackMessage({ channel, threadTs }, body, bodyPath);
|
|
33668
|
-
const target = threadTs ? `${channel} (thread_ts ${threadTs})` : channel;
|
|
33669
33733
|
console.log(`Approved for ${target}. The body to post is at:`);
|
|
33670
33734
|
console.log(bodyPath);
|
|
33671
33735
|
}
|
|
@@ -33674,14 +33738,17 @@ async function postSlackMessage(channelArg, options2) {
|
|
|
33674
33738
|
function registerSlack(program2) {
|
|
33675
33739
|
const slackCommand = program2.command("slack").description("Slack utilities");
|
|
33676
33740
|
const postCommand = slackCommand.command("post [channel]").description(
|
|
33677
|
-
"Preview a markdown message bound for a Slack channel (body of - reads it from stdin)"
|
|
33741
|
+
"Preview a markdown message, or a thread of them with --parts, bound for a Slack channel (body of - reads it from stdin)"
|
|
33678
33742
|
).option("--body <body>", "Message body (- reads it from stdin)").option(
|
|
33743
|
+
"--parts <files...>",
|
|
33744
|
+
"Files holding the messages of one thread, in thread order (not with --body)"
|
|
33745
|
+
).option(
|
|
33679
33746
|
"--thread <ts-or-permalink>",
|
|
33680
33747
|
"Reply in this thread: a message ts (1712345678.123456) or a Slack archives permalink",
|
|
33681
33748
|
parseSlackThreadRef
|
|
33682
33749
|
).addHelpText(
|
|
33683
33750
|
"after",
|
|
33684
|
-
"\nThe command does not post: Slack is reachable only over MCP, so it previews the message and hands the approved body back for /slack-post to send.\nIn an assist web session the body is previewed for approve/reject first (with inline comments). On approval the body is written to a working file under ~/.assist/slack/ and its path printed on the last line, preceded by the resolved thread_ts when --thread was given. On rejection nothing is handed back: the command exits non-zero with the reason and any inline comments, leaving the previewed markdown in the working file to revise in place.\nOutside a web session there is no preview and the body passes straight through.\nslack_send_message accepts standard markdown as it is \u2014 bold, italic, code, blockquotes, lists, links, code blocks, tables and headers \u2014 capped at 5000 characters."
|
|
33751
|
+
"\nThe command does not post: Slack is reachable only over MCP, so it previews the message and hands the approved body back for /slack-post to send.\nIn an assist web session the body is previewed for approve/reject first (with inline comments). On approval the body is written to a working file under ~/.assist/slack/ and its path printed on the last line, preceded by the resolved thread_ts when --thread was given. On rejection nothing is handed back: the command exits non-zero with the reason and any inline comments, leaving the previewed markdown in the working file to revise in place.\n--parts takes the files holding one thread's messages in thread order, each getting its own working file (channel-1.md, channel-2.md, \u2026) and its own preview pane titled with its position in the batch (2/3). The panes pop in sequence and no path is printed until every part is approved; the first rejection halts the batch and exits non-zero naming that part's position, reason, inline comments and working file, with no path handed back. A missing or empty part file, or --parts with --body, is an error before any pane opens.\nOutside a web session there is no preview and the body passes straight through.\nslack_send_message accepts standard markdown as it is \u2014 bold, italic, code, blockquotes, lists, links, code blocks, tables and headers \u2014 capped at 5000 characters."
|
|
33685
33752
|
).action(
|
|
33686
33753
|
async (channel, options2) => {
|
|
33687
33754
|
await postSlackMessage(channel, {
|
|
@@ -34626,9 +34693,9 @@ function formatVttPassages(passages, notes = [], { sourceMarks = true } = {}) {
|
|
|
34626
34693
|
}
|
|
34627
34694
|
|
|
34628
34695
|
// src/commands/transcript/convert/readCleanedCues.ts
|
|
34629
|
-
import { readFileSync as
|
|
34696
|
+
import { readFileSync as readFileSync57 } from "fs";
|
|
34630
34697
|
function readCleanedCues(inputPath) {
|
|
34631
|
-
return deduplicateCues(parseVtt(
|
|
34698
|
+
return deduplicateCues(parseVtt(readFileSync57(inputPath, "utf8")));
|
|
34632
34699
|
}
|
|
34633
34700
|
|
|
34634
34701
|
// src/commands/transcript/clean.ts
|
|
@@ -34750,7 +34817,7 @@ function list4() {
|
|
|
34750
34817
|
}
|
|
34751
34818
|
|
|
34752
34819
|
// src/commands/transcript/move.ts
|
|
34753
|
-
import { existsSync as existsSync75, mkdirSync as
|
|
34820
|
+
import { existsSync as existsSync75, mkdirSync as mkdirSync31, renameSync as renameSync2, writeFileSync as writeFileSync48 } from "fs";
|
|
34754
34821
|
import { basename as basename23, join as join90 } from "path";
|
|
34755
34822
|
|
|
34756
34823
|
// src/commands/transcript/convertVttToMarkdown.ts
|
|
@@ -34762,7 +34829,7 @@ function convertVttToMarkdown(inputPath) {
|
|
|
34762
34829
|
var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
34763
34830
|
function archiveRawVtt(vttDir, sourcePath, filename) {
|
|
34764
34831
|
const processedDir = join90(vttDir, "processed");
|
|
34765
|
-
|
|
34832
|
+
mkdirSync31(processedDir, { recursive: true });
|
|
34766
34833
|
renameSync2(sourcePath, join90(processedDir, filename));
|
|
34767
34834
|
}
|
|
34768
34835
|
function move(file, options2) {
|
|
@@ -34781,9 +34848,9 @@ function move(file, options2) {
|
|
|
34781
34848
|
const base = basename23(filename, ".vtt").replace(/ Transcription$/, "");
|
|
34782
34849
|
const outputName = `${date} ${base}.md`;
|
|
34783
34850
|
const formattedDir = join90(transcriptsDir, client);
|
|
34784
|
-
|
|
34851
|
+
mkdirSync31(formattedDir, { recursive: true });
|
|
34785
34852
|
const formattedPath = join90(formattedDir, outputName);
|
|
34786
|
-
|
|
34853
|
+
writeFileSync48(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
|
|
34787
34854
|
archiveRawVtt(vttDir, sourcePath, filename);
|
|
34788
34855
|
const summaryPath = join90(summaryDir, client, outputName);
|
|
34789
34856
|
console.log(`Formatted transcript: ${formattedPath}`);
|
|
@@ -34791,7 +34858,7 @@ function move(file, options2) {
|
|
|
34791
34858
|
}
|
|
34792
34859
|
|
|
34793
34860
|
// src/commands/transcript/merge.ts
|
|
34794
|
-
import { existsSync as existsSync76, writeFileSync as
|
|
34861
|
+
import { existsSync as existsSync76, writeFileSync as writeFileSync49 } from "fs";
|
|
34795
34862
|
import { basename as basename24 } from "path";
|
|
34796
34863
|
|
|
34797
34864
|
// src/commands/transcript/failTranscript.ts
|
|
@@ -34968,7 +35035,7 @@ async function merge(files, options2 = {}) {
|
|
|
34968
35035
|
console.log(document);
|
|
34969
35036
|
return;
|
|
34970
35037
|
}
|
|
34971
|
-
|
|
35038
|
+
writeFileSync49(options2.out, `${document}
|
|
34972
35039
|
`, "utf8");
|
|
34973
35040
|
console.log(`Merged transcript: ${options2.out}`);
|
|
34974
35041
|
}
|
|
@@ -35140,14 +35207,14 @@ function devices() {
|
|
|
35140
35207
|
}
|
|
35141
35208
|
|
|
35142
35209
|
// src/commands/voice/logs.ts
|
|
35143
|
-
import { existsSync as existsSync77, readFileSync as
|
|
35210
|
+
import { existsSync as existsSync77, readFileSync as readFileSync58 } from "fs";
|
|
35144
35211
|
function logs(options2) {
|
|
35145
35212
|
if (!existsSync77(voicePaths.log)) {
|
|
35146
35213
|
console.log("No voice log file found");
|
|
35147
35214
|
return;
|
|
35148
35215
|
}
|
|
35149
35216
|
const count8 = Number.parseInt(options2.lines ?? "150", 10);
|
|
35150
|
-
const content =
|
|
35217
|
+
const content = readFileSync58(voicePaths.log, "utf8").trim();
|
|
35151
35218
|
if (!content) {
|
|
35152
35219
|
console.log("Voice log is empty");
|
|
35153
35220
|
return;
|
|
@@ -35169,12 +35236,12 @@ function logs(options2) {
|
|
|
35169
35236
|
|
|
35170
35237
|
// src/commands/voice/setup.ts
|
|
35171
35238
|
import { spawnSync as spawnSync10 } from "child_process";
|
|
35172
|
-
import { mkdirSync as
|
|
35239
|
+
import { mkdirSync as mkdirSync33 } from "fs";
|
|
35173
35240
|
import { join as join94 } from "path";
|
|
35174
35241
|
|
|
35175
35242
|
// src/commands/voice/checkLockFile.ts
|
|
35176
35243
|
import { execSync as execSync63 } from "child_process";
|
|
35177
|
-
import { existsSync as existsSync78, mkdirSync as
|
|
35244
|
+
import { existsSync as existsSync78, mkdirSync as mkdirSync32, readFileSync as readFileSync59, writeFileSync as writeFileSync50 } from "fs";
|
|
35178
35245
|
import { join as join93 } from "path";
|
|
35179
35246
|
function isProcessAlive2(pid) {
|
|
35180
35247
|
try {
|
|
@@ -35188,7 +35255,7 @@ function checkLockFile() {
|
|
|
35188
35255
|
const lockFile = getLockFile();
|
|
35189
35256
|
if (!existsSync78(lockFile)) return;
|
|
35190
35257
|
try {
|
|
35191
|
-
const lock2 = JSON.parse(
|
|
35258
|
+
const lock2 = JSON.parse(readFileSync59(lockFile, "utf8"));
|
|
35192
35259
|
if (lock2.pid && isProcessAlive2(lock2.pid)) {
|
|
35193
35260
|
console.error(
|
|
35194
35261
|
`Voice daemon already running (PID ${lock2.pid}, env: ${lock2.env}). Stop it first with: assist voice stop`
|
|
@@ -35212,8 +35279,8 @@ function bootstrapVenv() {
|
|
|
35212
35279
|
}
|
|
35213
35280
|
function writeLockFile(pid) {
|
|
35214
35281
|
const lockFile = getLockFile();
|
|
35215
|
-
|
|
35216
|
-
|
|
35282
|
+
mkdirSync32(join93(lockFile, ".."), { recursive: true });
|
|
35283
|
+
writeFileSync50(
|
|
35217
35284
|
lockFile,
|
|
35218
35285
|
JSON.stringify({
|
|
35219
35286
|
pid,
|
|
@@ -35225,7 +35292,7 @@ function writeLockFile(pid) {
|
|
|
35225
35292
|
|
|
35226
35293
|
// src/commands/voice/setup.ts
|
|
35227
35294
|
function setup() {
|
|
35228
|
-
|
|
35295
|
+
mkdirSync33(voicePaths.dir, { recursive: true });
|
|
35229
35296
|
bootstrapVenv();
|
|
35230
35297
|
console.log("\nDownloading models...\n");
|
|
35231
35298
|
const script = join94(getPythonDir(), "setup_models.py");
|
|
@@ -35241,7 +35308,7 @@ function setup() {
|
|
|
35241
35308
|
|
|
35242
35309
|
// src/commands/voice/start.ts
|
|
35243
35310
|
import { spawn as spawn8 } from "child_process";
|
|
35244
|
-
import { mkdirSync as
|
|
35311
|
+
import { mkdirSync as mkdirSync34, writeFileSync as writeFileSync51 } from "fs";
|
|
35245
35312
|
import { join as join95 } from "path";
|
|
35246
35313
|
|
|
35247
35314
|
// src/commands/voice/buildDaemonEnv.ts
|
|
@@ -35270,12 +35337,12 @@ function spawnBackground(python, script, env) {
|
|
|
35270
35337
|
console.error("Failed to start voice daemon");
|
|
35271
35338
|
process.exit(1);
|
|
35272
35339
|
}
|
|
35273
|
-
|
|
35340
|
+
writeFileSync51(voicePaths.pid, String(pid));
|
|
35274
35341
|
writeLockFile(pid);
|
|
35275
35342
|
console.log(`Voice daemon started (PID ${pid})`);
|
|
35276
35343
|
}
|
|
35277
35344
|
function start2(options2) {
|
|
35278
|
-
|
|
35345
|
+
mkdirSync34(voicePaths.dir, { recursive: true });
|
|
35279
35346
|
checkLockFile();
|
|
35280
35347
|
bootstrapVenv();
|
|
35281
35348
|
const debug = options2.debug || options2.foreground || process.platform === "win32";
|
|
@@ -35290,7 +35357,7 @@ function start2(options2) {
|
|
|
35290
35357
|
}
|
|
35291
35358
|
|
|
35292
35359
|
// src/commands/voice/status.ts
|
|
35293
|
-
import { existsSync as existsSync79, readFileSync as
|
|
35360
|
+
import { existsSync as existsSync79, readFileSync as readFileSync60 } from "fs";
|
|
35294
35361
|
function isProcessAlive3(pid) {
|
|
35295
35362
|
try {
|
|
35296
35363
|
process.kill(pid, 0);
|
|
@@ -35301,7 +35368,7 @@ function isProcessAlive3(pid) {
|
|
|
35301
35368
|
}
|
|
35302
35369
|
function readRecentLogs(count8) {
|
|
35303
35370
|
if (!existsSync79(voicePaths.log)) return [];
|
|
35304
|
-
const lines2 =
|
|
35371
|
+
const lines2 = readFileSync60(voicePaths.log, "utf8").trim().split("\n");
|
|
35305
35372
|
return lines2.slice(-count8);
|
|
35306
35373
|
}
|
|
35307
35374
|
function status2() {
|
|
@@ -35309,7 +35376,7 @@ function status2() {
|
|
|
35309
35376
|
console.log("Voice daemon: not running (no PID file)");
|
|
35310
35377
|
return;
|
|
35311
35378
|
}
|
|
35312
|
-
const pid = Number.parseInt(
|
|
35379
|
+
const pid = Number.parseInt(readFileSync60(voicePaths.pid, "utf8").trim(), 10);
|
|
35313
35380
|
const alive = isProcessAlive3(pid);
|
|
35314
35381
|
console.log(`Voice daemon: ${alive ? "running" : "dead"} (PID ${pid})`);
|
|
35315
35382
|
const recent = readRecentLogs(5);
|
|
@@ -35328,13 +35395,13 @@ function status2() {
|
|
|
35328
35395
|
}
|
|
35329
35396
|
|
|
35330
35397
|
// src/commands/voice/stop.ts
|
|
35331
|
-
import { existsSync as existsSync80, readFileSync as
|
|
35398
|
+
import { existsSync as existsSync80, readFileSync as readFileSync61, unlinkSync as unlinkSync20 } from "fs";
|
|
35332
35399
|
function stop2() {
|
|
35333
35400
|
if (!existsSync80(voicePaths.pid)) {
|
|
35334
35401
|
console.log("Voice daemon is not running (no PID file)");
|
|
35335
35402
|
return;
|
|
35336
35403
|
}
|
|
35337
|
-
const pid = Number.parseInt(
|
|
35404
|
+
const pid = Number.parseInt(readFileSync61(voicePaths.pid, "utf8").trim(), 10);
|
|
35338
35405
|
try {
|
|
35339
35406
|
process.kill(pid, "SIGTERM");
|
|
35340
35407
|
console.log(`Sent SIGTERM to voice daemon (PID ${pid})`);
|
|
@@ -36205,7 +36272,7 @@ async function auth() {
|
|
|
36205
36272
|
|
|
36206
36273
|
// src/commands/roam/postRoamActivity.ts
|
|
36207
36274
|
import { execFileSync as execFileSync21 } from "child_process";
|
|
36208
|
-
import { readdirSync as readdirSync22, readFileSync as
|
|
36275
|
+
import { readdirSync as readdirSync22, readFileSync as readFileSync62, statSync as statSync12 } from "fs";
|
|
36209
36276
|
import { join as join98 } from "path";
|
|
36210
36277
|
function findPortFile(roamDir) {
|
|
36211
36278
|
let entries;
|
|
@@ -36236,7 +36303,7 @@ function postRoamActivity(app, event) {
|
|
|
36236
36303
|
if (!portFile) return;
|
|
36237
36304
|
let port;
|
|
36238
36305
|
try {
|
|
36239
|
-
port =
|
|
36306
|
+
port = readFileSync62(portFile, "utf8").trim();
|
|
36240
36307
|
} catch {
|
|
36241
36308
|
return;
|
|
36242
36309
|
}
|
|
@@ -36367,7 +36434,7 @@ async function run3(name, args) {
|
|
|
36367
36434
|
}
|
|
36368
36435
|
|
|
36369
36436
|
// src/commands/run/add.ts
|
|
36370
|
-
import { mkdirSync as
|
|
36437
|
+
import { mkdirSync as mkdirSync35, writeFileSync as writeFileSync52 } from "fs";
|
|
36371
36438
|
import { join as join99 } from "path";
|
|
36372
36439
|
|
|
36373
36440
|
// src/commands/run/extractOption.ts
|
|
@@ -36430,7 +36497,7 @@ function saveNewRunConfig(name, command, args, cwd) {
|
|
|
36430
36497
|
}
|
|
36431
36498
|
function createCommandFile(name) {
|
|
36432
36499
|
const dir = join99(".claude", "commands");
|
|
36433
|
-
|
|
36500
|
+
mkdirSync35(dir, { recursive: true });
|
|
36434
36501
|
const content = `---
|
|
36435
36502
|
description: Run ${name}
|
|
36436
36503
|
---
|
|
@@ -36438,7 +36505,7 @@ description: Run ${name}
|
|
|
36438
36505
|
Run \`assist run ${name} $ARGUMENTS 2>&1\`.
|
|
36439
36506
|
`;
|
|
36440
36507
|
const filePath = join99(dir, `${name}.md`);
|
|
36441
|
-
|
|
36508
|
+
writeFileSync52(filePath, content);
|
|
36442
36509
|
console.log(`Created command file: ${filePath}`);
|
|
36443
36510
|
}
|
|
36444
36511
|
function add3() {
|
|
@@ -36555,7 +36622,7 @@ function registerRun(program2) {
|
|
|
36555
36622
|
|
|
36556
36623
|
// src/commands/screenshot/index.ts
|
|
36557
36624
|
import { execSync as execSync65 } from "child_process";
|
|
36558
|
-
import { existsSync as existsSync85, mkdirSync as
|
|
36625
|
+
import { existsSync as existsSync85, mkdirSync as mkdirSync36, unlinkSync as unlinkSync22, writeFileSync as writeFileSync53 } from "fs";
|
|
36559
36626
|
import { tmpdir as tmpdir9 } from "os";
|
|
36560
36627
|
import { join as join101, resolve as resolve21 } from "path";
|
|
36561
36628
|
import chalk233 from "chalk";
|
|
@@ -36688,14 +36755,14 @@ Write-Output $OutputPath
|
|
|
36688
36755
|
// src/commands/screenshot/index.ts
|
|
36689
36756
|
function buildOutputPath(outputDir, processName) {
|
|
36690
36757
|
if (!existsSync85(outputDir)) {
|
|
36691
|
-
|
|
36758
|
+
mkdirSync36(outputDir, { recursive: true });
|
|
36692
36759
|
}
|
|
36693
36760
|
const timestamp6 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
36694
36761
|
return resolve21(outputDir, `${processName}-${timestamp6}.png`);
|
|
36695
36762
|
}
|
|
36696
36763
|
function runPowerShellScript(processName, outputPath) {
|
|
36697
36764
|
const scriptPath = join101(tmpdir9(), `assist-screenshot-${Date.now()}.ps1`);
|
|
36698
|
-
|
|
36765
|
+
writeFileSync53(scriptPath, captureWindowPs1, "utf8");
|
|
36699
36766
|
try {
|
|
36700
36767
|
execSync65(
|
|
36701
36768
|
`powershell -NoProfile -ExecutionPolicy Bypass -File "${scriptPath}" -ProcessName "${processName}" -OutputPath "${outputPath}"`,
|
|
@@ -36771,11 +36838,11 @@ function applyLine(result, pending, line) {
|
|
|
36771
36838
|
}
|
|
36772
36839
|
|
|
36773
36840
|
// src/commands/sessions/daemon/readDaemonPidFile.ts
|
|
36774
|
-
import { readFileSync as
|
|
36841
|
+
import { readFileSync as readFileSync63 } from "fs";
|
|
36775
36842
|
function readDaemonPidFile() {
|
|
36776
36843
|
try {
|
|
36777
36844
|
const pid = Number.parseInt(
|
|
36778
|
-
|
|
36845
|
+
readFileSync63(daemonPaths.pid, "utf8").trim(),
|
|
36779
36846
|
10
|
|
36780
36847
|
);
|
|
36781
36848
|
return Number.isInteger(pid) ? pid : void 0;
|
|
@@ -36928,7 +36995,7 @@ function requestDrain(socket, lines2) {
|
|
|
36928
36995
|
}
|
|
36929
36996
|
|
|
36930
36997
|
// src/commands/sessions/daemon/runDaemon.ts
|
|
36931
|
-
import { mkdirSync as
|
|
36998
|
+
import { mkdirSync as mkdirSync40 } from "fs";
|
|
36932
36999
|
|
|
36933
37000
|
// src/commands/sessions/daemon/createAutoExit.ts
|
|
36934
37001
|
var DEFAULT_GRACE_MS = 6e4;
|
|
@@ -38280,7 +38347,7 @@ function handleFailedResume(session, exitCode, onStatusChange) {
|
|
|
38280
38347
|
}
|
|
38281
38348
|
|
|
38282
38349
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
38283
|
-
import { existsSync as existsSync93, mkdirSync as
|
|
38350
|
+
import { existsSync as existsSync93, mkdirSync as mkdirSync37, watch as watch2 } from "fs";
|
|
38284
38351
|
import { dirname as dirname41 } from "path";
|
|
38285
38352
|
|
|
38286
38353
|
// src/commands/sessions/daemon/applyActivityToSession.ts
|
|
@@ -38345,7 +38412,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
38345
38412
|
const path91 = activityPath(session.id);
|
|
38346
38413
|
const dir = dirname41(path91);
|
|
38347
38414
|
try {
|
|
38348
|
-
|
|
38415
|
+
mkdirSync37(dir, { recursive: true });
|
|
38349
38416
|
} catch {
|
|
38350
38417
|
return;
|
|
38351
38418
|
}
|
|
@@ -38548,10 +38615,10 @@ function headContainsSessionId(filePath, claudeSessionId) {
|
|
|
38548
38615
|
}
|
|
38549
38616
|
|
|
38550
38617
|
// src/commands/sessions/daemon/ensureProjectDirExists.ts
|
|
38551
|
-
import { mkdirSync as
|
|
38618
|
+
import { mkdirSync as mkdirSync38 } from "fs";
|
|
38552
38619
|
function ensureProjectDirExists(dir, sessionId) {
|
|
38553
38620
|
try {
|
|
38554
|
-
|
|
38621
|
+
mkdirSync38(dir, { recursive: true });
|
|
38555
38622
|
return true;
|
|
38556
38623
|
} catch (error) {
|
|
38557
38624
|
daemonLog(
|
|
@@ -40956,14 +41023,14 @@ async function defaultConnect() {
|
|
|
40956
41023
|
}
|
|
40957
41024
|
|
|
40958
41025
|
// src/commands/sessions/daemon/hasPersistedWindowsSessions.ts
|
|
40959
|
-
import { existsSync as existsSync97, readFileSync as
|
|
41026
|
+
import { existsSync as existsSync97, readFileSync as readFileSync65 } from "fs";
|
|
40960
41027
|
import { posix as posix3 } from "path";
|
|
40961
41028
|
function hasPersistedWindowsSessions() {
|
|
40962
41029
|
const sessionsFile = windowsSessionsFileFromWsl();
|
|
40963
41030
|
if (!sessionsFile) return false;
|
|
40964
41031
|
try {
|
|
40965
41032
|
if (!existsSync97(sessionsFile)) return false;
|
|
40966
|
-
const data = JSON.parse(
|
|
41033
|
+
const data = JSON.parse(readFileSync65(sessionsFile, "utf8"));
|
|
40967
41034
|
return Array.isArray(data) && data.length > 0;
|
|
40968
41035
|
} catch (error) {
|
|
40969
41036
|
const message3 = error instanceof Error ? error.message : String(error);
|
|
@@ -41731,7 +41798,7 @@ function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
|
41731
41798
|
import { existsSync as existsSync99 } from "fs";
|
|
41732
41799
|
|
|
41733
41800
|
// src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
|
|
41734
|
-
import { copyFileSync as copyFileSync5, existsSync as existsSync98, mkdirSync as
|
|
41801
|
+
import { copyFileSync as copyFileSync5, existsSync as existsSync98, mkdirSync as mkdirSync39 } from "fs";
|
|
41735
41802
|
import { join as join106 } from "path";
|
|
41736
41803
|
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
41737
41804
|
const dir = projectDirForCwd(toCwd);
|
|
@@ -41754,7 +41821,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
41754
41821
|
return;
|
|
41755
41822
|
}
|
|
41756
41823
|
try {
|
|
41757
|
-
|
|
41824
|
+
mkdirSync39(dir, { recursive: true });
|
|
41758
41825
|
copyFileSync5(source, dest);
|
|
41759
41826
|
daemonLog(
|
|
41760
41827
|
`transcript ${source} copied to ${dest} so ${toCwd} can resume it`
|
|
@@ -42385,10 +42452,10 @@ function handleConnection(socket, manager) {
|
|
|
42385
42452
|
}
|
|
42386
42453
|
|
|
42387
42454
|
// src/commands/sessions/daemon/onListening.ts
|
|
42388
|
-
import { unlinkSync as unlinkSync23, writeFileSync as
|
|
42455
|
+
import { unlinkSync as unlinkSync23, writeFileSync as writeFileSync54 } from "fs";
|
|
42389
42456
|
|
|
42390
42457
|
// src/commands/sessions/daemon/startPidFileWatchdog.ts
|
|
42391
|
-
import { readFileSync as
|
|
42458
|
+
import { readFileSync as readFileSync66 } from "fs";
|
|
42392
42459
|
var WATCHDOG_INTERVAL_MS = 5e3;
|
|
42393
42460
|
function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
42394
42461
|
const timer = setInterval(() => {
|
|
@@ -42399,7 +42466,7 @@ function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
|
42399
42466
|
}
|
|
42400
42467
|
function ownsPidFile() {
|
|
42401
42468
|
try {
|
|
42402
|
-
return
|
|
42469
|
+
return readFileSync66(daemonPaths.pid, "utf8").trim() === String(process.pid);
|
|
42403
42470
|
} catch {
|
|
42404
42471
|
return false;
|
|
42405
42472
|
}
|
|
@@ -42407,7 +42474,7 @@ function ownsPidFile() {
|
|
|
42407
42474
|
|
|
42408
42475
|
// src/commands/sessions/daemon/onListening.ts
|
|
42409
42476
|
function onListening(manager, checkAutoExit) {
|
|
42410
|
-
|
|
42477
|
+
writeFileSync54(daemonPaths.pid, String(process.pid));
|
|
42411
42478
|
startPidFileWatchdog(() => {
|
|
42412
42479
|
daemonLog("lost daemon.pid ownership; shutting down sessions and exiting");
|
|
42413
42480
|
void manager.flushActiveMs().finally(() => {
|
|
@@ -42594,7 +42661,7 @@ async function recoverFromAddrInUse(server, manager, checkAutoExit) {
|
|
|
42594
42661
|
|
|
42595
42662
|
// src/commands/sessions/daemon/runDaemon.ts
|
|
42596
42663
|
async function runDaemon() {
|
|
42597
|
-
|
|
42664
|
+
mkdirSync40(daemonPaths.dir, { recursive: true });
|
|
42598
42665
|
daemonLog(
|
|
42599
42666
|
`starting (reason: ${process.env.ASSIST_DAEMON_SPAWN_REASON ?? "manual"})`
|
|
42600
42667
|
);
|
|
@@ -42892,7 +42959,7 @@ function buildLimitsSegment(rateLimits) {
|
|
|
42892
42959
|
}
|
|
42893
42960
|
|
|
42894
42961
|
// src/commands/readGitBranch.ts
|
|
42895
|
-
import { readFileSync as
|
|
42962
|
+
import { readFileSync as readFileSync68, statSync as statSync16 } from "fs";
|
|
42896
42963
|
import { isAbsolute as isAbsolute5, join as join107, resolve as resolve23 } from "path";
|
|
42897
42964
|
function resolveGitDir(cwd) {
|
|
42898
42965
|
const dotGit = join107(cwd, ".git");
|
|
@@ -42907,7 +42974,7 @@ function resolveGitDir(cwd) {
|
|
|
42907
42974
|
}
|
|
42908
42975
|
let contents;
|
|
42909
42976
|
try {
|
|
42910
|
-
contents =
|
|
42977
|
+
contents = readFileSync68(dotGit, "utf8");
|
|
42911
42978
|
} catch {
|
|
42912
42979
|
return null;
|
|
42913
42980
|
}
|
|
@@ -42925,7 +42992,7 @@ function readGitBranch(cwd) {
|
|
|
42925
42992
|
}
|
|
42926
42993
|
let head;
|
|
42927
42994
|
try {
|
|
42928
|
-
head =
|
|
42995
|
+
head = readFileSync68(join107(gitDir, "HEAD"), "utf8");
|
|
42929
42996
|
} catch {
|
|
42930
42997
|
return null;
|
|
42931
42998
|
}
|