@staff0rd/assist 0.266.0 → 0.268.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 -1
- package/dist/commands/sessions/web/bundle.js +52 -51
- package/dist/index.js +134 -156
- package/package.json +2 -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.268.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -89,6 +89,7 @@ var package_default = {
|
|
|
89
89
|
"@types/ws": "^8.18.1",
|
|
90
90
|
"@vitest/coverage-v8": "^4.1.2",
|
|
91
91
|
"@xterm/addon-fit": "^0.11.0",
|
|
92
|
+
"@xterm/addon-web-links": "^0.12.0",
|
|
92
93
|
"@xterm/xterm": "^6.0.0",
|
|
93
94
|
esbuild: "^0.27.3",
|
|
94
95
|
jscpd: "^4.0.5",
|
|
@@ -12809,8 +12810,8 @@ function findRootParent(file, importedBy, visited) {
|
|
|
12809
12810
|
function clusterFiles(graph) {
|
|
12810
12811
|
const clusters = /* @__PURE__ */ new Map();
|
|
12811
12812
|
for (const file of graph.files) {
|
|
12812
|
-
const
|
|
12813
|
-
if (
|
|
12813
|
+
const basename11 = path38.basename(file, path38.extname(file));
|
|
12814
|
+
if (basename11 === "index") continue;
|
|
12814
12815
|
const importers = graph.importedBy.get(file);
|
|
12815
12816
|
if (!importers || importers.size !== 1) continue;
|
|
12816
12817
|
const parent = [...importers][0];
|
|
@@ -13320,9 +13321,16 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
|
|
|
13320
13321
|
}
|
|
13321
13322
|
|
|
13322
13323
|
// src/commands/review/buildReviewPaths.ts
|
|
13323
|
-
import {
|
|
13324
|
+
import { homedir as homedir11 } from "os";
|
|
13325
|
+
import { basename as basename6, join as join36 } from "path";
|
|
13324
13326
|
function buildReviewPaths(repoRoot, key) {
|
|
13325
|
-
const reviewDir = join36(
|
|
13327
|
+
const reviewDir = join36(
|
|
13328
|
+
homedir11(),
|
|
13329
|
+
".assist",
|
|
13330
|
+
"reviews",
|
|
13331
|
+
basename6(repoRoot),
|
|
13332
|
+
key
|
|
13333
|
+
);
|
|
13326
13334
|
return {
|
|
13327
13335
|
reviewDir,
|
|
13328
13336
|
requestPath: join36(reviewDir, "request.md"),
|
|
@@ -13332,35 +13340,6 @@ function buildReviewPaths(repoRoot, key) {
|
|
|
13332
13340
|
};
|
|
13333
13341
|
}
|
|
13334
13342
|
|
|
13335
|
-
// src/commands/review/ensureReviewsIgnored.ts
|
|
13336
|
-
import {
|
|
13337
|
-
appendFileSync,
|
|
13338
|
-
existsSync as existsSync35,
|
|
13339
|
-
readFileSync as readFileSync30,
|
|
13340
|
-
writeFileSync as writeFileSync25
|
|
13341
|
-
} from "fs";
|
|
13342
|
-
import { join as join37 } from "path";
|
|
13343
|
-
var REVIEWS_ENTRY = ".assist/reviews";
|
|
13344
|
-
function coversReviews(line) {
|
|
13345
|
-
const pattern2 = line.trim().replace(/^\//, "").replace(/\/$/, "");
|
|
13346
|
-
return pattern2 === ".assist" || pattern2 === REVIEWS_ENTRY;
|
|
13347
|
-
}
|
|
13348
|
-
function ensureReviewsIgnored(repoRoot) {
|
|
13349
|
-
const gitignorePath = join37(repoRoot, ".gitignore");
|
|
13350
|
-
if (!existsSync35(gitignorePath)) {
|
|
13351
|
-
writeFileSync25(gitignorePath, `${REVIEWS_ENTRY}
|
|
13352
|
-
`);
|
|
13353
|
-
console.log(`Created .gitignore with ${REVIEWS_ENTRY} entry.`);
|
|
13354
|
-
return;
|
|
13355
|
-
}
|
|
13356
|
-
const content = readFileSync30(gitignorePath, "utf-8");
|
|
13357
|
-
if (content.split("\n").some(coversReviews)) return;
|
|
13358
|
-
const separator = content === "" || content.endsWith("\n") ? "" : "\n";
|
|
13359
|
-
appendFileSync(gitignorePath, `${separator}${REVIEWS_ENTRY}
|
|
13360
|
-
`);
|
|
13361
|
-
console.log(`Added ${REVIEWS_ENTRY} to .gitignore.`);
|
|
13362
|
-
}
|
|
13363
|
-
|
|
13364
13343
|
// src/commands/review/fetchExistingComments.ts
|
|
13365
13344
|
import { execSync as execSync41 } from "child_process";
|
|
13366
13345
|
function fetchRawComments(org, repo, prNumber) {
|
|
@@ -13500,7 +13479,7 @@ function gatherContext() {
|
|
|
13500
13479
|
}
|
|
13501
13480
|
|
|
13502
13481
|
// src/commands/review/postReviewToPr.ts
|
|
13503
|
-
import { readFileSync as
|
|
13482
|
+
import { readFileSync as readFileSync30 } from "fs";
|
|
13504
13483
|
|
|
13505
13484
|
// src/commands/review/parseFindings.ts
|
|
13506
13485
|
var SEVERITIES = ["blocker", "major", "minor", "nit"];
|
|
@@ -13810,7 +13789,7 @@ async function confirmPost(prNumber, count6, options2) {
|
|
|
13810
13789
|
async function postReviewToPr(synthesisPath, options2) {
|
|
13811
13790
|
const prInfo = fetchPrDiffInfo();
|
|
13812
13791
|
const prNumber = prInfo.prNumber;
|
|
13813
|
-
const markdown =
|
|
13792
|
+
const markdown = readFileSync30(synthesisPath, "utf-8");
|
|
13814
13793
|
const findings = parseFindings(markdown);
|
|
13815
13794
|
if (findings.length === 0) {
|
|
13816
13795
|
console.log("Synthesis contains no findings; nothing to post.");
|
|
@@ -13892,16 +13871,16 @@ async function handlePostSynthesis(synthesisPath, options2) {
|
|
|
13892
13871
|
}
|
|
13893
13872
|
|
|
13894
13873
|
// src/commands/review/prepareReviewDir.ts
|
|
13895
|
-
import { existsSync as
|
|
13874
|
+
import { existsSync as existsSync35, mkdirSync as mkdirSync13, unlinkSync as unlinkSync11, writeFileSync as writeFileSync25 } from "fs";
|
|
13896
13875
|
function clearReviewFiles(paths) {
|
|
13897
13876
|
for (const path53 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
13898
|
-
if (
|
|
13877
|
+
if (existsSync35(path53)) unlinkSync11(path53);
|
|
13899
13878
|
}
|
|
13900
13879
|
}
|
|
13901
13880
|
function prepareReviewDir(paths, requestBody, force) {
|
|
13902
13881
|
mkdirSync13(paths.reviewDir, { recursive: true });
|
|
13903
13882
|
if (force) clearReviewFiles(paths);
|
|
13904
|
-
|
|
13883
|
+
writeFileSync25(paths.requestPath, requestBody);
|
|
13905
13884
|
}
|
|
13906
13885
|
|
|
13907
13886
|
// src/commands/review/runApplySession.ts
|
|
@@ -14180,7 +14159,7 @@ function printReviewerFailures(results) {
|
|
|
14180
14159
|
}
|
|
14181
14160
|
|
|
14182
14161
|
// src/commands/review/runAndSynthesise.ts
|
|
14183
|
-
import { existsSync as
|
|
14162
|
+
import { existsSync as existsSync37, unlinkSync as unlinkSync13 } from "fs";
|
|
14184
14163
|
|
|
14185
14164
|
// src/commands/review/buildReviewerStdin.ts
|
|
14186
14165
|
var REVIEW_PROMPT = `You are acting as a reviewer for a proposed code change made by another engineer. The full review request \u2014 branch, base, changed files, and unified diff \u2014 is in request.md in the current working directory.
|
|
@@ -14244,7 +14223,7 @@ The review request is at: ${requestPath}
|
|
|
14244
14223
|
}
|
|
14245
14224
|
|
|
14246
14225
|
// src/commands/review/runClaudeReviewer.ts
|
|
14247
|
-
import { writeFileSync as
|
|
14226
|
+
import { writeFileSync as writeFileSync26 } from "fs";
|
|
14248
14227
|
|
|
14249
14228
|
// src/commands/review/finaliseReviewerSpinner.ts
|
|
14250
14229
|
var SUMMARY_MAX_LEN = 80;
|
|
@@ -14580,7 +14559,7 @@ async function runClaudeReviewer(spec) {
|
|
|
14580
14559
|
}
|
|
14581
14560
|
});
|
|
14582
14561
|
if (result.exitCode === 0 && finalText)
|
|
14583
|
-
|
|
14562
|
+
writeFileSync26(spec.outputPath, finalText);
|
|
14584
14563
|
return finaliseReviewerRun({ ...spec, command }, spinner, result);
|
|
14585
14564
|
}
|
|
14586
14565
|
|
|
@@ -14598,7 +14577,7 @@ function resolveClaude(args) {
|
|
|
14598
14577
|
}
|
|
14599
14578
|
|
|
14600
14579
|
// src/commands/review/runCodexReviewer.ts
|
|
14601
|
-
import { existsSync as
|
|
14580
|
+
import { existsSync as existsSync36, unlinkSync as unlinkSync12 } from "fs";
|
|
14602
14581
|
|
|
14603
14582
|
// src/commands/review/parseCodexEvent.ts
|
|
14604
14583
|
function isItemStarted(value) {
|
|
@@ -14652,7 +14631,7 @@ async function runCodexReviewer(spec) {
|
|
|
14652
14631
|
reportReviewerToolUse(spec.name, event, spinner);
|
|
14653
14632
|
}
|
|
14654
14633
|
});
|
|
14655
|
-
if (result.exitCode !== 0 &&
|
|
14634
|
+
if (result.exitCode !== 0 && existsSync36(spec.outputPath)) {
|
|
14656
14635
|
unlinkSync12(spec.outputPath);
|
|
14657
14636
|
}
|
|
14658
14637
|
return finaliseReviewerRun({ ...spec, command }, spinner, result);
|
|
@@ -14696,7 +14675,7 @@ async function runReviewers(reviewDir, claudePath, codexPath, stdinPrompt, optio
|
|
|
14696
14675
|
}
|
|
14697
14676
|
|
|
14698
14677
|
// src/commands/review/synthesise.ts
|
|
14699
|
-
import { readFileSync as
|
|
14678
|
+
import { readFileSync as readFileSync31 } from "fs";
|
|
14700
14679
|
|
|
14701
14680
|
// src/commands/review/buildSynthesisStdin.ts
|
|
14702
14681
|
var SYNTHESIS_PROMPT = `You are consolidating two independent code reviews of the same change. The original review request is in request.md. The two reviews are in claude.md and codex.md in the current working directory.
|
|
@@ -14752,7 +14731,7 @@ Files:
|
|
|
14752
14731
|
|
|
14753
14732
|
// src/commands/review/synthesise.ts
|
|
14754
14733
|
function printSummary2(synthesisPath) {
|
|
14755
|
-
const markdown =
|
|
14734
|
+
const markdown = readFileSync31(synthesisPath, "utf-8");
|
|
14756
14735
|
console.log("");
|
|
14757
14736
|
console.log(buildReviewSummary(markdown));
|
|
14758
14737
|
console.log("");
|
|
@@ -14800,7 +14779,7 @@ async function runAndSynthesise(args) {
|
|
|
14800
14779
|
console.error("Both reviewers failed; skipping synthesis.");
|
|
14801
14780
|
return { ok: false, failures };
|
|
14802
14781
|
}
|
|
14803
|
-
if (anyFresh &&
|
|
14782
|
+
if (anyFresh && existsSync37(paths.synthesisPath)) {
|
|
14804
14783
|
unlinkSync13(paths.synthesisPath);
|
|
14805
14784
|
}
|
|
14806
14785
|
const synthesisResult = await synthesise(paths, { multi });
|
|
@@ -14894,7 +14873,6 @@ async function runPostSynthesis(synthesisPath, options2) {
|
|
|
14894
14873
|
}
|
|
14895
14874
|
async function reviewPr(repoRoot, options2) {
|
|
14896
14875
|
const context = gatherChangedContext();
|
|
14897
|
-
ensureReviewsIgnored(repoRoot);
|
|
14898
14876
|
const paths = setupReviewDir(repoRoot, context, options2.force ?? false);
|
|
14899
14877
|
const synthesisOk = await runReviewPipeline(paths, {
|
|
14900
14878
|
verbose: options2.verbose ?? false
|
|
@@ -15576,8 +15554,8 @@ function registerSql(program2) {
|
|
|
15576
15554
|
}
|
|
15577
15555
|
|
|
15578
15556
|
// src/commands/transcript/shared.ts
|
|
15579
|
-
import { existsSync as
|
|
15580
|
-
import { basename as
|
|
15557
|
+
import { existsSync as existsSync38, readdirSync as readdirSync6, statSync as statSync4 } from "fs";
|
|
15558
|
+
import { basename as basename7, join as join37, relative as relative2 } from "path";
|
|
15581
15559
|
import * as readline2 from "readline";
|
|
15582
15560
|
var DATE_PREFIX_REGEX = /^\d{4}-\d{2}-\d{2}/;
|
|
15583
15561
|
function getDatePrefix(daysOffset = 0) {
|
|
@@ -15592,10 +15570,10 @@ function isValidDatePrefix(filename) {
|
|
|
15592
15570
|
return DATE_PREFIX_REGEX.test(filename);
|
|
15593
15571
|
}
|
|
15594
15572
|
function collectFiles(dir, extension) {
|
|
15595
|
-
if (!
|
|
15573
|
+
if (!existsSync38(dir)) return [];
|
|
15596
15574
|
const results = [];
|
|
15597
15575
|
for (const entry of readdirSync6(dir)) {
|
|
15598
|
-
const fullPath =
|
|
15576
|
+
const fullPath = join37(dir, entry);
|
|
15599
15577
|
if (statSync4(fullPath).isDirectory()) {
|
|
15600
15578
|
results.push(...collectFiles(fullPath, extension));
|
|
15601
15579
|
} else if (entry.endsWith(extension)) {
|
|
@@ -15608,7 +15586,7 @@ function toFileInfo(baseDir, fullPath) {
|
|
|
15608
15586
|
return {
|
|
15609
15587
|
absolutePath: fullPath,
|
|
15610
15588
|
relativePath: relative2(baseDir, fullPath),
|
|
15611
|
-
filename:
|
|
15589
|
+
filename: basename7(fullPath)
|
|
15612
15590
|
};
|
|
15613
15591
|
}
|
|
15614
15592
|
function findVttFilesRecursive(dir, baseDir = dir) {
|
|
@@ -15618,7 +15596,7 @@ function findMdFilesRecursive(dir, baseDir = dir) {
|
|
|
15618
15596
|
return collectFiles(dir, ".md").map((f) => toFileInfo(baseDir, f));
|
|
15619
15597
|
}
|
|
15620
15598
|
function getTranscriptBaseName(transcriptFile) {
|
|
15621
|
-
return
|
|
15599
|
+
return basename7(transcriptFile, ".md").replace(/ Transcription$/, "");
|
|
15622
15600
|
}
|
|
15623
15601
|
function createReadlineInterface() {
|
|
15624
15602
|
return readline2.createInterface({
|
|
@@ -15689,14 +15667,14 @@ async function configure() {
|
|
|
15689
15667
|
}
|
|
15690
15668
|
|
|
15691
15669
|
// src/commands/transcript/format/index.ts
|
|
15692
|
-
import { existsSync as
|
|
15670
|
+
import { existsSync as existsSync40 } from "fs";
|
|
15693
15671
|
|
|
15694
15672
|
// src/commands/transcript/format/fixInvalidDatePrefixes/index.ts
|
|
15695
|
-
import { dirname as dirname20, join as
|
|
15673
|
+
import { dirname as dirname20, join as join39 } from "path";
|
|
15696
15674
|
|
|
15697
15675
|
// src/commands/transcript/format/fixInvalidDatePrefixes/promptForDateFix.ts
|
|
15698
15676
|
import { renameSync as renameSync3 } from "fs";
|
|
15699
|
-
import { join as
|
|
15677
|
+
import { join as join38 } from "path";
|
|
15700
15678
|
async function resolveDate(rl, choice) {
|
|
15701
15679
|
if (choice === "1") return getDatePrefix(0);
|
|
15702
15680
|
if (choice === "2") return getDatePrefix(-1);
|
|
@@ -15711,7 +15689,7 @@ async function resolveDate(rl, choice) {
|
|
|
15711
15689
|
}
|
|
15712
15690
|
function renameWithPrefix(vttDir, vttFile, prefix2) {
|
|
15713
15691
|
const newFilename = `${prefix2}.${vttFile}`;
|
|
15714
|
-
renameSync3(
|
|
15692
|
+
renameSync3(join38(vttDir, vttFile), join38(vttDir, newFilename));
|
|
15715
15693
|
console.log(`Renamed to: ${newFilename}`);
|
|
15716
15694
|
return newFilename;
|
|
15717
15695
|
}
|
|
@@ -15745,12 +15723,12 @@ async function fixInvalidDatePrefixes(vttFiles) {
|
|
|
15745
15723
|
const vttFileDir = dirname20(vttFile.absolutePath);
|
|
15746
15724
|
const newFilename = await promptForDateFix(vttFile.filename, vttFileDir);
|
|
15747
15725
|
if (newFilename) {
|
|
15748
|
-
const newRelativePath =
|
|
15726
|
+
const newRelativePath = join39(
|
|
15749
15727
|
dirname20(vttFile.relativePath),
|
|
15750
15728
|
newFilename
|
|
15751
15729
|
);
|
|
15752
15730
|
vttFiles[i] = {
|
|
15753
|
-
absolutePath:
|
|
15731
|
+
absolutePath: join39(vttFileDir, newFilename),
|
|
15754
15732
|
relativePath: newRelativePath,
|
|
15755
15733
|
filename: newFilename
|
|
15756
15734
|
};
|
|
@@ -15763,8 +15741,8 @@ async function fixInvalidDatePrefixes(vttFiles) {
|
|
|
15763
15741
|
}
|
|
15764
15742
|
|
|
15765
15743
|
// src/commands/transcript/format/processVttFile/index.ts
|
|
15766
|
-
import { existsSync as
|
|
15767
|
-
import { basename as
|
|
15744
|
+
import { existsSync as existsSync39, mkdirSync as mkdirSync14, readFileSync as readFileSync32, writeFileSync as writeFileSync27 } from "fs";
|
|
15745
|
+
import { basename as basename8, dirname as dirname21, join as join40 } from "path";
|
|
15768
15746
|
|
|
15769
15747
|
// src/commands/transcript/cleanText.ts
|
|
15770
15748
|
function cleanText(text2) {
|
|
@@ -15971,24 +15949,24 @@ function formatChatLog(messages) {
|
|
|
15971
15949
|
|
|
15972
15950
|
// src/commands/transcript/format/processVttFile/index.ts
|
|
15973
15951
|
function toMdFilename(vttFilename) {
|
|
15974
|
-
return `${
|
|
15952
|
+
return `${basename8(vttFilename, ".vtt").replace(/\s*Transcription\s*/g, " ").trim()}.md`;
|
|
15975
15953
|
}
|
|
15976
15954
|
function resolveOutputDir(relativeDir, transcriptsDir) {
|
|
15977
|
-
return relativeDir === "." ? transcriptsDir :
|
|
15955
|
+
return relativeDir === "." ? transcriptsDir : join40(transcriptsDir, relativeDir);
|
|
15978
15956
|
}
|
|
15979
15957
|
function buildOutputPaths(vttFile, transcriptsDir) {
|
|
15980
15958
|
const mdFile = toMdFilename(vttFile.filename);
|
|
15981
15959
|
const relativeDir = dirname21(vttFile.relativePath);
|
|
15982
15960
|
const outputDir = resolveOutputDir(relativeDir, transcriptsDir);
|
|
15983
|
-
const outputPath =
|
|
15961
|
+
const outputPath = join40(outputDir, mdFile);
|
|
15984
15962
|
return { outputDir, outputPath, mdFile, relativeDir };
|
|
15985
15963
|
}
|
|
15986
15964
|
function logSkipped(relativeDir, mdFile) {
|
|
15987
|
-
console.log(`Skipping (already exists): ${
|
|
15965
|
+
console.log(`Skipping (already exists): ${join40(relativeDir, mdFile)}`);
|
|
15988
15966
|
return "skipped";
|
|
15989
15967
|
}
|
|
15990
15968
|
function ensureDirectory(dir, label2) {
|
|
15991
|
-
if (!
|
|
15969
|
+
if (!existsSync39(dir)) {
|
|
15992
15970
|
mkdirSync14(dir, { recursive: true });
|
|
15993
15971
|
console.log(`Created ${label2}: ${dir}`);
|
|
15994
15972
|
}
|
|
@@ -16011,10 +15989,10 @@ function logReduction(cueCount, messageCount) {
|
|
|
16011
15989
|
}
|
|
16012
15990
|
function readAndParseCues(inputPath) {
|
|
16013
15991
|
console.log(`Reading: ${inputPath}`);
|
|
16014
|
-
return processCues(
|
|
15992
|
+
return processCues(readFileSync32(inputPath, "utf-8"));
|
|
16015
15993
|
}
|
|
16016
15994
|
function writeFormatted(outputPath, content) {
|
|
16017
|
-
|
|
15995
|
+
writeFileSync27(outputPath, content, "utf-8");
|
|
16018
15996
|
console.log(`Written: ${outputPath}`);
|
|
16019
15997
|
}
|
|
16020
15998
|
function convertVttToMarkdown(inputPath, outputPath) {
|
|
@@ -16024,7 +16002,7 @@ function convertVttToMarkdown(inputPath, outputPath) {
|
|
|
16024
16002
|
logReduction(cues.length, chatMessages.length);
|
|
16025
16003
|
}
|
|
16026
16004
|
function tryProcessVtt(vttFile, paths) {
|
|
16027
|
-
if (
|
|
16005
|
+
if (existsSync39(paths.outputPath))
|
|
16028
16006
|
return logSkipped(paths.relativeDir, paths.mdFile);
|
|
16029
16007
|
convertVttToMarkdown(vttFile.absolutePath, paths.outputPath);
|
|
16030
16008
|
return "processed";
|
|
@@ -16050,7 +16028,7 @@ function processAllFiles(vttFiles, transcriptsDir) {
|
|
|
16050
16028
|
logSummary(counts);
|
|
16051
16029
|
}
|
|
16052
16030
|
function requireVttDir(vttDir) {
|
|
16053
|
-
if (!
|
|
16031
|
+
if (!existsSync40(vttDir)) {
|
|
16054
16032
|
console.error(`VTT directory not found: ${vttDir}`);
|
|
16055
16033
|
process.exit(1);
|
|
16056
16034
|
}
|
|
@@ -16082,18 +16060,18 @@ async function format() {
|
|
|
16082
16060
|
}
|
|
16083
16061
|
|
|
16084
16062
|
// src/commands/transcript/summarise/index.ts
|
|
16085
|
-
import { existsSync as
|
|
16086
|
-
import { basename as
|
|
16063
|
+
import { existsSync as existsSync42 } from "fs";
|
|
16064
|
+
import { basename as basename9, dirname as dirname23, join as join42, relative as relative3 } from "path";
|
|
16087
16065
|
|
|
16088
16066
|
// src/commands/transcript/summarise/processStagedFile/index.ts
|
|
16089
16067
|
import {
|
|
16090
|
-
existsSync as
|
|
16068
|
+
existsSync as existsSync41,
|
|
16091
16069
|
mkdirSync as mkdirSync15,
|
|
16092
|
-
readFileSync as
|
|
16070
|
+
readFileSync as readFileSync33,
|
|
16093
16071
|
renameSync as renameSync4,
|
|
16094
16072
|
rmSync as rmSync2
|
|
16095
16073
|
} from "fs";
|
|
16096
|
-
import { dirname as dirname22, join as
|
|
16074
|
+
import { dirname as dirname22, join as join41 } from "path";
|
|
16097
16075
|
|
|
16098
16076
|
// src/commands/transcript/summarise/processStagedFile/validateStagedContent.ts
|
|
16099
16077
|
import chalk156 from "chalk";
|
|
@@ -16122,9 +16100,9 @@ function validateStagedContent(filename, content) {
|
|
|
16122
16100
|
}
|
|
16123
16101
|
|
|
16124
16102
|
// src/commands/transcript/summarise/processStagedFile/index.ts
|
|
16125
|
-
var STAGING_DIR =
|
|
16103
|
+
var STAGING_DIR = join41(process.cwd(), ".assist", "transcript");
|
|
16126
16104
|
function processStagedFile() {
|
|
16127
|
-
if (!
|
|
16105
|
+
if (!existsSync41(STAGING_DIR)) {
|
|
16128
16106
|
return false;
|
|
16129
16107
|
}
|
|
16130
16108
|
const stagedFiles = findMdFilesRecursive(STAGING_DIR);
|
|
@@ -16133,7 +16111,7 @@ function processStagedFile() {
|
|
|
16133
16111
|
}
|
|
16134
16112
|
const { transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
16135
16113
|
const stagedFile = stagedFiles[0];
|
|
16136
|
-
const content =
|
|
16114
|
+
const content = readFileSync33(stagedFile.absolutePath, "utf-8");
|
|
16137
16115
|
validateStagedContent(stagedFile.filename, content);
|
|
16138
16116
|
const stagedBaseName = getTranscriptBaseName(stagedFile.filename);
|
|
16139
16117
|
const transcriptFiles = findMdFilesRecursive(transcriptsDir);
|
|
@@ -16146,9 +16124,9 @@ function processStagedFile() {
|
|
|
16146
16124
|
);
|
|
16147
16125
|
process.exit(1);
|
|
16148
16126
|
}
|
|
16149
|
-
const destPath =
|
|
16127
|
+
const destPath = join41(summaryDir, matchingTranscript.relativePath);
|
|
16150
16128
|
const destDir = dirname22(destPath);
|
|
16151
|
-
if (!
|
|
16129
|
+
if (!existsSync41(destDir)) {
|
|
16152
16130
|
mkdirSync15(destDir, { recursive: true });
|
|
16153
16131
|
}
|
|
16154
16132
|
renameSync4(stagedFile.absolutePath, destPath);
|
|
@@ -16162,20 +16140,20 @@ function processStagedFile() {
|
|
|
16162
16140
|
// src/commands/transcript/summarise/index.ts
|
|
16163
16141
|
function buildRelativeKey(relativePath, baseName) {
|
|
16164
16142
|
const relDir = dirname23(relativePath);
|
|
16165
|
-
return relDir === "." ? baseName :
|
|
16143
|
+
return relDir === "." ? baseName : join42(relDir, baseName);
|
|
16166
16144
|
}
|
|
16167
16145
|
function buildSummaryIndex(summaryDir) {
|
|
16168
16146
|
const summaryFiles = findMdFilesRecursive(summaryDir);
|
|
16169
16147
|
return new Set(
|
|
16170
16148
|
summaryFiles.map(
|
|
16171
|
-
(f) => buildRelativeKey(f.relativePath,
|
|
16149
|
+
(f) => buildRelativeKey(f.relativePath, basename9(f.filename, ".md"))
|
|
16172
16150
|
)
|
|
16173
16151
|
);
|
|
16174
16152
|
}
|
|
16175
16153
|
function summarise3() {
|
|
16176
16154
|
processStagedFile();
|
|
16177
16155
|
const { transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
16178
|
-
if (!
|
|
16156
|
+
if (!existsSync42(transcriptsDir)) {
|
|
16179
16157
|
console.log("No transcripts directory found.");
|
|
16180
16158
|
return;
|
|
16181
16159
|
}
|
|
@@ -16196,8 +16174,8 @@ function summarise3() {
|
|
|
16196
16174
|
}
|
|
16197
16175
|
const next3 = missing[0];
|
|
16198
16176
|
const outputFilename = `${getTranscriptBaseName(next3.filename)}.md`;
|
|
16199
|
-
const outputPath =
|
|
16200
|
-
const summaryFileDir =
|
|
16177
|
+
const outputPath = join42(STAGING_DIR, outputFilename);
|
|
16178
|
+
const summaryFileDir = join42(summaryDir, dirname23(next3.relativePath));
|
|
16201
16179
|
const relativeTranscriptPath = encodeURI(
|
|
16202
16180
|
relative3(summaryFileDir, next3.absolutePath).replace(/\\/g, "/")
|
|
16203
16181
|
);
|
|
@@ -16247,50 +16225,50 @@ function registerVerify(program2) {
|
|
|
16247
16225
|
|
|
16248
16226
|
// src/commands/voice/devices.ts
|
|
16249
16227
|
import { spawnSync as spawnSync4 } from "child_process";
|
|
16250
|
-
import { join as
|
|
16228
|
+
import { join as join44 } from "path";
|
|
16251
16229
|
|
|
16252
16230
|
// src/commands/voice/shared.ts
|
|
16253
|
-
import { homedir as
|
|
16254
|
-
import { dirname as dirname24, join as
|
|
16231
|
+
import { homedir as homedir12 } from "os";
|
|
16232
|
+
import { dirname as dirname24, join as join43 } from "path";
|
|
16255
16233
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
16256
16234
|
var __dirname6 = dirname24(fileURLToPath6(import.meta.url));
|
|
16257
|
-
var VOICE_DIR =
|
|
16235
|
+
var VOICE_DIR = join43(homedir12(), ".assist", "voice");
|
|
16258
16236
|
var voicePaths = {
|
|
16259
16237
|
dir: VOICE_DIR,
|
|
16260
|
-
pid:
|
|
16261
|
-
log:
|
|
16262
|
-
venv:
|
|
16263
|
-
lock:
|
|
16238
|
+
pid: join43(VOICE_DIR, "voice.pid"),
|
|
16239
|
+
log: join43(VOICE_DIR, "voice.log"),
|
|
16240
|
+
venv: join43(VOICE_DIR, ".venv"),
|
|
16241
|
+
lock: join43(VOICE_DIR, "voice.lock")
|
|
16264
16242
|
};
|
|
16265
16243
|
function getPythonDir() {
|
|
16266
|
-
return
|
|
16244
|
+
return join43(__dirname6, "commands", "voice", "python");
|
|
16267
16245
|
}
|
|
16268
16246
|
function getVenvPython() {
|
|
16269
|
-
return process.platform === "win32" ?
|
|
16247
|
+
return process.platform === "win32" ? join43(voicePaths.venv, "Scripts", "python.exe") : join43(voicePaths.venv, "bin", "python");
|
|
16270
16248
|
}
|
|
16271
16249
|
function getLockDir() {
|
|
16272
16250
|
const config = loadConfig();
|
|
16273
16251
|
return config.voice?.lockDir ?? VOICE_DIR;
|
|
16274
16252
|
}
|
|
16275
16253
|
function getLockFile() {
|
|
16276
|
-
return
|
|
16254
|
+
return join43(getLockDir(), "voice.lock");
|
|
16277
16255
|
}
|
|
16278
16256
|
|
|
16279
16257
|
// src/commands/voice/devices.ts
|
|
16280
16258
|
function devices() {
|
|
16281
|
-
const script =
|
|
16259
|
+
const script = join44(getPythonDir(), "list_devices.py");
|
|
16282
16260
|
spawnSync4(getVenvPython(), [script], { stdio: "inherit" });
|
|
16283
16261
|
}
|
|
16284
16262
|
|
|
16285
16263
|
// src/commands/voice/logs.ts
|
|
16286
|
-
import { existsSync as
|
|
16264
|
+
import { existsSync as existsSync43, readFileSync as readFileSync34 } from "fs";
|
|
16287
16265
|
function logs(options2) {
|
|
16288
|
-
if (!
|
|
16266
|
+
if (!existsSync43(voicePaths.log)) {
|
|
16289
16267
|
console.log("No voice log file found");
|
|
16290
16268
|
return;
|
|
16291
16269
|
}
|
|
16292
16270
|
const count6 = Number.parseInt(options2.lines ?? "150", 10);
|
|
16293
|
-
const content =
|
|
16271
|
+
const content = readFileSync34(voicePaths.log, "utf-8").trim();
|
|
16294
16272
|
if (!content) {
|
|
16295
16273
|
console.log("Voice log is empty");
|
|
16296
16274
|
return;
|
|
@@ -16313,12 +16291,12 @@ function logs(options2) {
|
|
|
16313
16291
|
// src/commands/voice/setup.ts
|
|
16314
16292
|
import { spawnSync as spawnSync5 } from "child_process";
|
|
16315
16293
|
import { mkdirSync as mkdirSync17 } from "fs";
|
|
16316
|
-
import { join as
|
|
16294
|
+
import { join as join46 } from "path";
|
|
16317
16295
|
|
|
16318
16296
|
// src/commands/voice/checkLockFile.ts
|
|
16319
16297
|
import { execSync as execSync45 } from "child_process";
|
|
16320
|
-
import { existsSync as
|
|
16321
|
-
import { join as
|
|
16298
|
+
import { existsSync as existsSync44, mkdirSync as mkdirSync16, readFileSync as readFileSync35, writeFileSync as writeFileSync28 } from "fs";
|
|
16299
|
+
import { join as join45 } from "path";
|
|
16322
16300
|
function isProcessAlive2(pid) {
|
|
16323
16301
|
try {
|
|
16324
16302
|
process.kill(pid, 0);
|
|
@@ -16329,9 +16307,9 @@ function isProcessAlive2(pid) {
|
|
|
16329
16307
|
}
|
|
16330
16308
|
function checkLockFile() {
|
|
16331
16309
|
const lockFile = getLockFile();
|
|
16332
|
-
if (!
|
|
16310
|
+
if (!existsSync44(lockFile)) return;
|
|
16333
16311
|
try {
|
|
16334
|
-
const lock = JSON.parse(
|
|
16312
|
+
const lock = JSON.parse(readFileSync35(lockFile, "utf-8"));
|
|
16335
16313
|
if (lock.pid && isProcessAlive2(lock.pid)) {
|
|
16336
16314
|
console.error(
|
|
16337
16315
|
`Voice daemon already running (PID ${lock.pid}, env: ${lock.env}). Stop it first with: assist voice stop`
|
|
@@ -16342,7 +16320,7 @@ function checkLockFile() {
|
|
|
16342
16320
|
}
|
|
16343
16321
|
}
|
|
16344
16322
|
function bootstrapVenv() {
|
|
16345
|
-
if (
|
|
16323
|
+
if (existsSync44(getVenvPython())) return;
|
|
16346
16324
|
console.log("Setting up Python environment...");
|
|
16347
16325
|
const pythonDir = getPythonDir();
|
|
16348
16326
|
execSync45(
|
|
@@ -16355,8 +16333,8 @@ function bootstrapVenv() {
|
|
|
16355
16333
|
}
|
|
16356
16334
|
function writeLockFile(pid) {
|
|
16357
16335
|
const lockFile = getLockFile();
|
|
16358
|
-
mkdirSync16(
|
|
16359
|
-
|
|
16336
|
+
mkdirSync16(join45(lockFile, ".."), { recursive: true });
|
|
16337
|
+
writeFileSync28(
|
|
16360
16338
|
lockFile,
|
|
16361
16339
|
JSON.stringify({
|
|
16362
16340
|
pid,
|
|
@@ -16371,7 +16349,7 @@ function setup() {
|
|
|
16371
16349
|
mkdirSync17(voicePaths.dir, { recursive: true });
|
|
16372
16350
|
bootstrapVenv();
|
|
16373
16351
|
console.log("\nDownloading models...\n");
|
|
16374
|
-
const script =
|
|
16352
|
+
const script = join46(getPythonDir(), "setup_models.py");
|
|
16375
16353
|
const result = spawnSync5(getVenvPython(), [script], {
|
|
16376
16354
|
stdio: "inherit",
|
|
16377
16355
|
env: { ...process.env, VOICE_LOG_FILE: voicePaths.log }
|
|
@@ -16384,8 +16362,8 @@ function setup() {
|
|
|
16384
16362
|
|
|
16385
16363
|
// src/commands/voice/start.ts
|
|
16386
16364
|
import { spawn as spawn7 } from "child_process";
|
|
16387
|
-
import { mkdirSync as mkdirSync18, writeFileSync as
|
|
16388
|
-
import { join as
|
|
16365
|
+
import { mkdirSync as mkdirSync18, writeFileSync as writeFileSync29 } from "fs";
|
|
16366
|
+
import { join as join47 } from "path";
|
|
16389
16367
|
|
|
16390
16368
|
// src/commands/voice/buildDaemonEnv.ts
|
|
16391
16369
|
function buildDaemonEnv(options2) {
|
|
@@ -16413,7 +16391,7 @@ function spawnBackground(python, script, env) {
|
|
|
16413
16391
|
console.error("Failed to start voice daemon");
|
|
16414
16392
|
process.exit(1);
|
|
16415
16393
|
}
|
|
16416
|
-
|
|
16394
|
+
writeFileSync29(voicePaths.pid, String(pid));
|
|
16417
16395
|
writeLockFile(pid);
|
|
16418
16396
|
console.log(`Voice daemon started (PID ${pid})`);
|
|
16419
16397
|
}
|
|
@@ -16423,7 +16401,7 @@ function start2(options2) {
|
|
|
16423
16401
|
bootstrapVenv();
|
|
16424
16402
|
const debug = options2.debug || options2.foreground || process.platform === "win32";
|
|
16425
16403
|
const env = buildDaemonEnv({ debug });
|
|
16426
|
-
const script =
|
|
16404
|
+
const script = join47(getPythonDir(), "voice_daemon.py");
|
|
16427
16405
|
const python = getVenvPython();
|
|
16428
16406
|
if (options2.foreground) {
|
|
16429
16407
|
spawnForeground(python, script, env);
|
|
@@ -16433,7 +16411,7 @@ function start2(options2) {
|
|
|
16433
16411
|
}
|
|
16434
16412
|
|
|
16435
16413
|
// src/commands/voice/status.ts
|
|
16436
|
-
import { existsSync as
|
|
16414
|
+
import { existsSync as existsSync45, readFileSync as readFileSync36 } from "fs";
|
|
16437
16415
|
function isProcessAlive3(pid) {
|
|
16438
16416
|
try {
|
|
16439
16417
|
process.kill(pid, 0);
|
|
@@ -16443,16 +16421,16 @@ function isProcessAlive3(pid) {
|
|
|
16443
16421
|
}
|
|
16444
16422
|
}
|
|
16445
16423
|
function readRecentLogs(count6) {
|
|
16446
|
-
if (!
|
|
16447
|
-
const lines =
|
|
16424
|
+
if (!existsSync45(voicePaths.log)) return [];
|
|
16425
|
+
const lines = readFileSync36(voicePaths.log, "utf-8").trim().split("\n");
|
|
16448
16426
|
return lines.slice(-count6);
|
|
16449
16427
|
}
|
|
16450
16428
|
function status() {
|
|
16451
|
-
if (!
|
|
16429
|
+
if (!existsSync45(voicePaths.pid)) {
|
|
16452
16430
|
console.log("Voice daemon: not running (no PID file)");
|
|
16453
16431
|
return;
|
|
16454
16432
|
}
|
|
16455
|
-
const pid = Number.parseInt(
|
|
16433
|
+
const pid = Number.parseInt(readFileSync36(voicePaths.pid, "utf-8").trim(), 10);
|
|
16456
16434
|
const alive = isProcessAlive3(pid);
|
|
16457
16435
|
console.log(`Voice daemon: ${alive ? "running" : "dead"} (PID ${pid})`);
|
|
16458
16436
|
const recent = readRecentLogs(5);
|
|
@@ -16471,13 +16449,13 @@ function status() {
|
|
|
16471
16449
|
}
|
|
16472
16450
|
|
|
16473
16451
|
// src/commands/voice/stop.ts
|
|
16474
|
-
import { existsSync as
|
|
16452
|
+
import { existsSync as existsSync46, readFileSync as readFileSync37, unlinkSync as unlinkSync14 } from "fs";
|
|
16475
16453
|
function stop2() {
|
|
16476
|
-
if (!
|
|
16454
|
+
if (!existsSync46(voicePaths.pid)) {
|
|
16477
16455
|
console.log("Voice daemon is not running (no PID file)");
|
|
16478
16456
|
return;
|
|
16479
16457
|
}
|
|
16480
|
-
const pid = Number.parseInt(
|
|
16458
|
+
const pid = Number.parseInt(readFileSync37(voicePaths.pid, "utf-8").trim(), 10);
|
|
16481
16459
|
try {
|
|
16482
16460
|
process.kill(pid, "SIGTERM");
|
|
16483
16461
|
console.log(`Sent SIGTERM to voice daemon (PID ${pid})`);
|
|
@@ -16490,7 +16468,7 @@ function stop2() {
|
|
|
16490
16468
|
}
|
|
16491
16469
|
try {
|
|
16492
16470
|
const lockFile = getLockFile();
|
|
16493
|
-
if (
|
|
16471
|
+
if (existsSync46(lockFile)) unlinkSync14(lockFile);
|
|
16494
16472
|
} catch {
|
|
16495
16473
|
}
|
|
16496
16474
|
console.log("Voice daemon stopped");
|
|
@@ -16712,8 +16690,8 @@ async function auth() {
|
|
|
16712
16690
|
|
|
16713
16691
|
// src/commands/roam/postRoamActivity.ts
|
|
16714
16692
|
import { execFileSync as execFileSync7 } from "child_process";
|
|
16715
|
-
import { readdirSync as readdirSync7, readFileSync as
|
|
16716
|
-
import { join as
|
|
16693
|
+
import { readdirSync as readdirSync7, readFileSync as readFileSync38, statSync as statSync5 } from "fs";
|
|
16694
|
+
import { join as join48 } from "path";
|
|
16717
16695
|
function findPortFile(roamDir) {
|
|
16718
16696
|
let entries;
|
|
16719
16697
|
try {
|
|
@@ -16722,7 +16700,7 @@ function findPortFile(roamDir) {
|
|
|
16722
16700
|
return void 0;
|
|
16723
16701
|
}
|
|
16724
16702
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
16725
|
-
const path53 =
|
|
16703
|
+
const path53 = join48(roamDir, name);
|
|
16726
16704
|
try {
|
|
16727
16705
|
return { path: path53, mtimeMs: statSync5(path53).mtimeMs };
|
|
16728
16706
|
} catch {
|
|
@@ -16734,11 +16712,11 @@ function findPortFile(roamDir) {
|
|
|
16734
16712
|
function postRoamActivity(app, event) {
|
|
16735
16713
|
const appData = process.env.APPDATA;
|
|
16736
16714
|
if (!appData) return;
|
|
16737
|
-
const portFile = findPortFile(
|
|
16715
|
+
const portFile = findPortFile(join48(appData, "Roam"));
|
|
16738
16716
|
if (!portFile) return;
|
|
16739
16717
|
let port;
|
|
16740
16718
|
try {
|
|
16741
|
-
port =
|
|
16719
|
+
port = readFileSync38(portFile, "utf-8").trim();
|
|
16742
16720
|
} catch {
|
|
16743
16721
|
return;
|
|
16744
16722
|
}
|
|
@@ -16880,15 +16858,15 @@ function runPreCommands(pre, cwd) {
|
|
|
16880
16858
|
|
|
16881
16859
|
// src/commands/run/spawnRunCommand.ts
|
|
16882
16860
|
import { execFileSync as execFileSync8, spawn as spawn8 } from "child_process";
|
|
16883
|
-
import { existsSync as
|
|
16884
|
-
import { dirname as dirname25, join as
|
|
16861
|
+
import { existsSync as existsSync47 } from "fs";
|
|
16862
|
+
import { dirname as dirname25, join as join49, resolve as resolve11 } from "path";
|
|
16885
16863
|
function resolveCommand2(command) {
|
|
16886
16864
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
16887
16865
|
try {
|
|
16888
16866
|
const gitPath = execFileSync8("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
16889
16867
|
const gitRoot = resolve11(dirname25(gitPath), "..");
|
|
16890
|
-
const gitBash =
|
|
16891
|
-
if (
|
|
16868
|
+
const gitBash = join49(gitRoot, "bin", "bash.exe");
|
|
16869
|
+
if (existsSync47(gitBash)) return gitBash;
|
|
16892
16870
|
} catch {
|
|
16893
16871
|
}
|
|
16894
16872
|
return command;
|
|
@@ -16973,8 +16951,8 @@ async function run3(name, args) {
|
|
|
16973
16951
|
}
|
|
16974
16952
|
|
|
16975
16953
|
// src/commands/run/add.ts
|
|
16976
|
-
import { mkdirSync as mkdirSync19, writeFileSync as
|
|
16977
|
-
import { join as
|
|
16954
|
+
import { mkdirSync as mkdirSync19, writeFileSync as writeFileSync30 } from "fs";
|
|
16955
|
+
import { join as join50 } from "path";
|
|
16978
16956
|
|
|
16979
16957
|
// src/commands/run/extractOption.ts
|
|
16980
16958
|
function extractOption(args, flag) {
|
|
@@ -17035,7 +17013,7 @@ function saveNewRunConfig(name, command, args, cwd) {
|
|
|
17035
17013
|
saveConfig(config);
|
|
17036
17014
|
}
|
|
17037
17015
|
function createCommandFile(name) {
|
|
17038
|
-
const dir =
|
|
17016
|
+
const dir = join50(".claude", "commands");
|
|
17039
17017
|
mkdirSync19(dir, { recursive: true });
|
|
17040
17018
|
const content = `---
|
|
17041
17019
|
description: Run ${name}
|
|
@@ -17043,8 +17021,8 @@ description: Run ${name}
|
|
|
17043
17021
|
|
|
17044
17022
|
Run \`assist run ${name} $ARGUMENTS 2>&1\`.
|
|
17045
17023
|
`;
|
|
17046
|
-
const filePath =
|
|
17047
|
-
|
|
17024
|
+
const filePath = join50(dir, `${name}.md`);
|
|
17025
|
+
writeFileSync30(filePath, content);
|
|
17048
17026
|
console.log(`Created command file: ${filePath}`);
|
|
17049
17027
|
}
|
|
17050
17028
|
function add3() {
|
|
@@ -17099,8 +17077,8 @@ function link2() {
|
|
|
17099
17077
|
}
|
|
17100
17078
|
|
|
17101
17079
|
// src/commands/run/remove.ts
|
|
17102
|
-
import { existsSync as
|
|
17103
|
-
import { join as
|
|
17080
|
+
import { existsSync as existsSync48, unlinkSync as unlinkSync15 } from "fs";
|
|
17081
|
+
import { join as join51 } from "path";
|
|
17104
17082
|
function findRemoveIndex() {
|
|
17105
17083
|
const idx = process.argv.indexOf("remove");
|
|
17106
17084
|
if (idx === -1 || idx + 1 >= process.argv.length) return -1;
|
|
@@ -17115,8 +17093,8 @@ function parseRemoveName() {
|
|
|
17115
17093
|
return process.argv[idx + 1];
|
|
17116
17094
|
}
|
|
17117
17095
|
function deleteCommandFile(name) {
|
|
17118
|
-
const filePath =
|
|
17119
|
-
if (
|
|
17096
|
+
const filePath = join51(".claude", "commands", `${name}.md`);
|
|
17097
|
+
if (existsSync48(filePath)) {
|
|
17120
17098
|
unlinkSync15(filePath);
|
|
17121
17099
|
console.log(`Deleted command file: ${filePath}`);
|
|
17122
17100
|
}
|
|
@@ -17155,9 +17133,9 @@ function registerRun(program2) {
|
|
|
17155
17133
|
|
|
17156
17134
|
// src/commands/screenshot/index.ts
|
|
17157
17135
|
import { execSync as execSync48 } from "child_process";
|
|
17158
|
-
import { existsSync as
|
|
17136
|
+
import { existsSync as existsSync49, mkdirSync as mkdirSync20, unlinkSync as unlinkSync16, writeFileSync as writeFileSync31 } from "fs";
|
|
17159
17137
|
import { tmpdir as tmpdir7 } from "os";
|
|
17160
|
-
import { join as
|
|
17138
|
+
import { join as join52, resolve as resolve13 } from "path";
|
|
17161
17139
|
import chalk158 from "chalk";
|
|
17162
17140
|
|
|
17163
17141
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
@@ -17287,15 +17265,15 @@ Write-Output $OutputPath
|
|
|
17287
17265
|
|
|
17288
17266
|
// src/commands/screenshot/index.ts
|
|
17289
17267
|
function buildOutputPath(outputDir, processName) {
|
|
17290
|
-
if (!
|
|
17268
|
+
if (!existsSync49(outputDir)) {
|
|
17291
17269
|
mkdirSync20(outputDir, { recursive: true });
|
|
17292
17270
|
}
|
|
17293
17271
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
17294
17272
|
return resolve13(outputDir, `${processName}-${timestamp}.png`);
|
|
17295
17273
|
}
|
|
17296
17274
|
function runPowerShellScript(processName, outputPath) {
|
|
17297
|
-
const scriptPath =
|
|
17298
|
-
|
|
17275
|
+
const scriptPath = join52(tmpdir7(), `assist-screenshot-${Date.now()}.ps1`);
|
|
17276
|
+
writeFileSync31(scriptPath, captureWindowPs1, "utf-8");
|
|
17299
17277
|
try {
|
|
17300
17278
|
execSync48(
|
|
17301
17279
|
`powershell -NoProfile -ExecutionPolicy Bypass -File "${scriptPath}" -ProcessName "${processName}" -OutputPath "${outputPath}"`,
|
|
@@ -17371,7 +17349,7 @@ function applyLine(result, pending, line) {
|
|
|
17371
17349
|
}
|
|
17372
17350
|
|
|
17373
17351
|
// src/commands/sessions/daemon/reportStolenSocket.ts
|
|
17374
|
-
import { readFileSync as
|
|
17352
|
+
import { readFileSync as readFileSync39 } from "fs";
|
|
17375
17353
|
function reportStolenSocket(socketPid) {
|
|
17376
17354
|
if (!socketPid) return;
|
|
17377
17355
|
const filePid = readPidFile();
|
|
@@ -17383,7 +17361,7 @@ function reportStolenSocket(socketPid) {
|
|
|
17383
17361
|
function readPidFile() {
|
|
17384
17362
|
try {
|
|
17385
17363
|
const pid = Number.parseInt(
|
|
17386
|
-
|
|
17364
|
+
readFileSync39(daemonPaths.pid, "utf-8").trim(),
|
|
17387
17365
|
10
|
|
17388
17366
|
);
|
|
17389
17367
|
return Number.isInteger(pid) ? pid : void 0;
|
|
@@ -17705,7 +17683,7 @@ function broadcastSessions(sessions, clients) {
|
|
|
17705
17683
|
import * as pty from "node-pty";
|
|
17706
17684
|
|
|
17707
17685
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
17708
|
-
import { chmodSync, existsSync as
|
|
17686
|
+
import { chmodSync, existsSync as existsSync50, statSync as statSync6 } from "fs";
|
|
17709
17687
|
import { createRequire as createRequire3 } from "module";
|
|
17710
17688
|
import path47 from "path";
|
|
17711
17689
|
var require4 = createRequire3(import.meta.url);
|
|
@@ -17720,7 +17698,7 @@ function ensureSpawnHelperExecutable() {
|
|
|
17720
17698
|
`${process.platform}-${process.arch}`,
|
|
17721
17699
|
"spawn-helper"
|
|
17722
17700
|
);
|
|
17723
|
-
if (!
|
|
17701
|
+
if (!existsSync50(helper)) return;
|
|
17724
17702
|
const mode = statSync6(helper).mode;
|
|
17725
17703
|
if ((mode & 73) === 0) chmodSync(helper, mode | 493);
|
|
17726
17704
|
}
|
|
@@ -17947,7 +17925,7 @@ function clearIdle(session) {
|
|
|
17947
17925
|
}
|
|
17948
17926
|
|
|
17949
17927
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
17950
|
-
import { existsSync as
|
|
17928
|
+
import { existsSync as existsSync51, mkdirSync as mkdirSync21, watch } from "fs";
|
|
17951
17929
|
import { dirname as dirname27 } from "path";
|
|
17952
17930
|
var DEBOUNCE_MS = 50;
|
|
17953
17931
|
function watchActivity(session, notify2) {
|
|
@@ -17974,7 +17952,7 @@ function watchActivity(session, notify2) {
|
|
|
17974
17952
|
if (timer) clearTimeout(timer);
|
|
17975
17953
|
timer = setTimeout(read, DEBOUNCE_MS);
|
|
17976
17954
|
});
|
|
17977
|
-
if (
|
|
17955
|
+
if (existsSync51(path53)) read();
|
|
17978
17956
|
}
|
|
17979
17957
|
function refreshActivity(session) {
|
|
17980
17958
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -18343,10 +18321,10 @@ function handleConnection(socket, manager) {
|
|
|
18343
18321
|
}
|
|
18344
18322
|
|
|
18345
18323
|
// src/commands/sessions/daemon/onListening.ts
|
|
18346
|
-
import { unlinkSync as unlinkSync17, writeFileSync as
|
|
18324
|
+
import { unlinkSync as unlinkSync17, writeFileSync as writeFileSync32 } from "fs";
|
|
18347
18325
|
|
|
18348
18326
|
// src/commands/sessions/daemon/startPidFileWatchdog.ts
|
|
18349
|
-
import { readFileSync as
|
|
18327
|
+
import { readFileSync as readFileSync40 } from "fs";
|
|
18350
18328
|
var WATCHDOG_INTERVAL_MS = 5e3;
|
|
18351
18329
|
function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
18352
18330
|
const timer = setInterval(() => {
|
|
@@ -18357,7 +18335,7 @@ function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
|
18357
18335
|
}
|
|
18358
18336
|
function ownsPidFile() {
|
|
18359
18337
|
try {
|
|
18360
|
-
return
|
|
18338
|
+
return readFileSync40(daemonPaths.pid, "utf-8").trim() === String(process.pid);
|
|
18361
18339
|
} catch {
|
|
18362
18340
|
return false;
|
|
18363
18341
|
}
|
|
@@ -18365,7 +18343,7 @@ function ownsPidFile() {
|
|
|
18365
18343
|
|
|
18366
18344
|
// src/commands/sessions/daemon/onListening.ts
|
|
18367
18345
|
function onListening(manager, checkAutoExit) {
|
|
18368
|
-
|
|
18346
|
+
writeFileSync32(daemonPaths.pid, String(process.pid));
|
|
18369
18347
|
startPidFileWatchdog(() => {
|
|
18370
18348
|
daemonLog("lost daemon.pid ownership; shutting down sessions and exiting");
|
|
18371
18349
|
manager.shutdown();
|