@staff0rd/assist 0.724.0 → 0.725.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/sessions/web/bundle.js +411 -410
- package/dist/index.js +140 -93
- 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.725.1",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -16936,6 +16936,52 @@ function tokenize(command) {
|
|
|
16936
16936
|
return tokens;
|
|
16937
16937
|
}
|
|
16938
16938
|
|
|
16939
|
+
// src/commands/cliHook/isGhGraphqlIssueMutation.ts
|
|
16940
|
+
import { readFileSync as readFileSync25 } from "fs";
|
|
16941
|
+
var ISSUE_MUTATION = /\bmutation\b[\s\S]*\b(?:createIssue|updateIssue|deleteIssue|closeIssue|reopenIssue|transferIssue|pinIssue|unpinIssue|addComment|updateIssueComment|deleteIssueComment|addSubIssue|removeSubIssue|reprioritizeSubIssue)\s*\(/;
|
|
16942
|
+
var FIELD_FLAGS = ["-f", "-F", "--field", "--raw-field"];
|
|
16943
|
+
function isGhGraphqlIssueMutation(args, command) {
|
|
16944
|
+
if (!args.some((arg) => unquote(arg) === "graphql")) return false;
|
|
16945
|
+
return querySources(args).some(
|
|
16946
|
+
(source) => ISSUE_MUTATION.test(readSourceOrCommandText(source, command))
|
|
16947
|
+
);
|
|
16948
|
+
}
|
|
16949
|
+
function querySources(args) {
|
|
16950
|
+
const sources = [];
|
|
16951
|
+
for (let i = 0; i < args.length; i++) {
|
|
16952
|
+
const value = flagValue(args, i);
|
|
16953
|
+
if (value === void 0) continue;
|
|
16954
|
+
if (args[i] === "--input") sources.push(`@${value}`);
|
|
16955
|
+
const query = /^query=([\s\S]*)$/.exec(value);
|
|
16956
|
+
if (query) sources.push(query[1]);
|
|
16957
|
+
}
|
|
16958
|
+
return sources;
|
|
16959
|
+
}
|
|
16960
|
+
function flagValue(args, i) {
|
|
16961
|
+
const arg = args[i];
|
|
16962
|
+
if (arg === "--input") return unquote(args[i + 1] ?? "");
|
|
16963
|
+
for (const flag of FIELD_FLAGS) {
|
|
16964
|
+
if (arg === flag) return unquote(args[i + 1] ?? "");
|
|
16965
|
+
if (arg.startsWith(`${flag}=`)) return unquote(arg.slice(flag.length + 1));
|
|
16966
|
+
if (flag.length === 2 && arg.length > 2 && arg.startsWith(flag))
|
|
16967
|
+
return unquote(arg.slice(2));
|
|
16968
|
+
}
|
|
16969
|
+
return void 0;
|
|
16970
|
+
}
|
|
16971
|
+
function readSourceOrCommandText(source, command) {
|
|
16972
|
+
if (!source.startsWith("@")) return source;
|
|
16973
|
+
const path106 = source.slice(1);
|
|
16974
|
+
if (path106 === "-") return command;
|
|
16975
|
+
try {
|
|
16976
|
+
return readFileSync25(path106, "utf8");
|
|
16977
|
+
} catch {
|
|
16978
|
+
return command;
|
|
16979
|
+
}
|
|
16980
|
+
}
|
|
16981
|
+
function unquote(value) {
|
|
16982
|
+
return value.replace(/['"]/g, "");
|
|
16983
|
+
}
|
|
16984
|
+
|
|
16939
16985
|
// src/commands/cliHook/isGhIssueApiWrite.ts
|
|
16940
16986
|
var WRITE_METHODS = /* @__PURE__ */ new Set(["POST", "PATCH", "PUT", "DELETE"]);
|
|
16941
16987
|
var BODY_FLAGS = ["-f", "-F", "--field", "--raw-field", "--input"];
|
|
@@ -16947,6 +16993,7 @@ function isGhIssueApiWrite(command) {
|
|
|
16947
16993
|
if (tokens[i] !== "gh" || tokens[i + 1] !== "api") continue;
|
|
16948
16994
|
const args = argsUntilNextCommand(tokens.slice(i + 2));
|
|
16949
16995
|
if (targetsIssueEndpoint(args) && isWrite(args)) return true;
|
|
16996
|
+
if (isGhGraphqlIssueMutation(args, command)) return true;
|
|
16950
16997
|
}
|
|
16951
16998
|
return false;
|
|
16952
16999
|
}
|
|
@@ -16959,7 +17006,7 @@ function targetsIssueEndpoint(args) {
|
|
|
16959
17006
|
}
|
|
16960
17007
|
function isWrite(args) {
|
|
16961
17008
|
const method = extractGhApiMethod(args);
|
|
16962
|
-
if (method) return WRITE_METHODS.has(
|
|
17009
|
+
if (method) return WRITE_METHODS.has(unquote2(method).toUpperCase());
|
|
16963
17010
|
return args.some(isBodyFlag);
|
|
16964
17011
|
}
|
|
16965
17012
|
function isBodyFlag(arg) {
|
|
@@ -16967,7 +17014,7 @@ function isBodyFlag(arg) {
|
|
|
16967
17014
|
(flag) => arg === flag || arg.startsWith(`${flag}=`) || flag.length === 2 && arg.length > 2 && arg.startsWith(flag)
|
|
16968
17015
|
);
|
|
16969
17016
|
}
|
|
16970
|
-
function
|
|
17017
|
+
function unquote2(value) {
|
|
16971
17018
|
return value.replace(/^['"]|['"]$/g, "");
|
|
16972
17019
|
}
|
|
16973
17020
|
|
|
@@ -17003,7 +17050,7 @@ var PATTERN_DENIES = [
|
|
|
17003
17050
|
enabled: () => loadConfig().cliHook?.blockNpmRun !== false
|
|
17004
17051
|
}
|
|
17005
17052
|
];
|
|
17006
|
-
var GH_ISSUE_API_MESSAGE = "Do not write to GitHub
|
|
17053
|
+
var GH_ISSUE_API_MESSAGE = "Do not write to GitHub issues with 'gh api' (REST issue endpoints or GraphQL issue mutations) \u2014 it bypasses the content validation and the approval pane that every outward-facing issue write goes through. Use 'assist github issue create --title <title> --body <body>' to open an issue, 'assist github issue edit <number>' to rework one's body, 'assist github issue comment <number> --body <body>' to post a comment, or 'assist github issue edit-comment <comment-id> --body <body>' to amend a comment that is already posted. Each validates the content and gates it on the user's approval before anything reaches GitHub; run the command's --help for how to compose it.";
|
|
17007
17054
|
var BRANCH_CREATION_MESSAGE = "Do not create branches with raw git. Use the /branch command, or 'assist branch <slug> [--jira <KEY>]' \u2014 it branches off the fresh remote default and enforces the team naming convention.";
|
|
17008
17055
|
var COMMAND_BOUNDARY = String.raw`(?<=(?:^|[;&|(\n])\s*)`;
|
|
17009
17056
|
var BRANCH_CREATION_REGEXES = [
|
|
@@ -17203,7 +17250,7 @@ function configuresReleases(command) {
|
|
|
17203
17250
|
// src/shared/isGhApiRead.ts
|
|
17204
17251
|
var READ_METHODS = /* @__PURE__ */ new Set(["GET", "HEAD"]);
|
|
17205
17252
|
var BODY_FLAGS2 = /* @__PURE__ */ new Set(["-f", "-F", "--field", "--raw-field", "--input"]);
|
|
17206
|
-
var
|
|
17253
|
+
var FIELD_FLAGS2 = /* @__PURE__ */ new Set(["-f", "--field", "-F"]);
|
|
17207
17254
|
function isGhApiRead(command) {
|
|
17208
17255
|
const tokens = tokenize(command);
|
|
17209
17256
|
if (tokens.length < 2 || tokens[0] !== "gh" || tokens[1] !== "api") {
|
|
@@ -17230,7 +17277,7 @@ function isGraphqlRead(args) {
|
|
|
17230
17277
|
}
|
|
17231
17278
|
function extractGraphqlQuery(args) {
|
|
17232
17279
|
for (let i = 0; i < args.length; i++) {
|
|
17233
|
-
if (
|
|
17280
|
+
if (FIELD_FLAGS2.has(args[i]) && i + 1 < args.length) {
|
|
17234
17281
|
const match = args[i + 1].match(/^query=(.*)/s);
|
|
17235
17282
|
if (match) return match[1];
|
|
17236
17283
|
}
|
|
@@ -17239,7 +17286,7 @@ function extractGraphqlQuery(args) {
|
|
|
17239
17286
|
}
|
|
17240
17287
|
|
|
17241
17288
|
// src/shared/loadCliReads.ts
|
|
17242
|
-
import { existsSync as existsSync40, readFileSync as
|
|
17289
|
+
import { existsSync as existsSync40, readFileSync as readFileSync26, writeFileSync as writeFileSync22 } from "fs";
|
|
17243
17290
|
import { dirname as dirname25, resolve as resolve13 } from "path";
|
|
17244
17291
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
17245
17292
|
var __filename3 = fileURLToPath5(import.meta.url);
|
|
@@ -17249,7 +17296,7 @@ function packageRoot() {
|
|
|
17249
17296
|
}
|
|
17250
17297
|
function readLines(path106) {
|
|
17251
17298
|
if (!existsSync40(path106)) return [];
|
|
17252
|
-
return
|
|
17299
|
+
return readFileSync26(path106, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
17253
17300
|
}
|
|
17254
17301
|
var cachedReads;
|
|
17255
17302
|
var cachedWrites;
|
|
@@ -17295,7 +17342,7 @@ function findCliWrite(command) {
|
|
|
17295
17342
|
}
|
|
17296
17343
|
|
|
17297
17344
|
// src/shared/readSettingsPerms.ts
|
|
17298
|
-
import { existsSync as existsSync41, readFileSync as
|
|
17345
|
+
import { existsSync as existsSync41, readFileSync as readFileSync27 } from "fs";
|
|
17299
17346
|
import { homedir as homedir15 } from "os";
|
|
17300
17347
|
import { join as join41 } from "path";
|
|
17301
17348
|
function readSettingsPerms(key) {
|
|
@@ -17313,7 +17360,7 @@ function readSettingsPerms(key) {
|
|
|
17313
17360
|
function readPermissionArray(filePath, key) {
|
|
17314
17361
|
if (!existsSync41(filePath)) return [];
|
|
17315
17362
|
try {
|
|
17316
|
-
const data = JSON.parse(
|
|
17363
|
+
const data = JSON.parse(readFileSync27(filePath, "utf8"));
|
|
17317
17364
|
const arr = data?.permissions?.[key];
|
|
17318
17365
|
return Array.isArray(arr) ? arr.filter((e) => typeof e === "string") : [];
|
|
17319
17366
|
} catch {
|
|
@@ -17668,7 +17715,7 @@ ${reasons.join("\n")}`);
|
|
|
17668
17715
|
}
|
|
17669
17716
|
|
|
17670
17717
|
// src/commands/permitCliReads.ts
|
|
17671
|
-
import { existsSync as existsSync42, mkdirSync as mkdirSync13, readFileSync as
|
|
17718
|
+
import { existsSync as existsSync42, mkdirSync as mkdirSync13, readFileSync as readFileSync28, writeFileSync as writeFileSync23 } from "fs";
|
|
17672
17719
|
import { homedir as homedir17 } from "os";
|
|
17673
17720
|
import { join as join43 } from "path";
|
|
17674
17721
|
|
|
@@ -17938,7 +17985,7 @@ function logPath(cli) {
|
|
|
17938
17985
|
function readCache(cli) {
|
|
17939
17986
|
const path106 = logPath(cli);
|
|
17940
17987
|
if (!existsSync42(path106)) return void 0;
|
|
17941
|
-
return
|
|
17988
|
+
return readFileSync28(path106, "utf8");
|
|
17942
17989
|
}
|
|
17943
17990
|
function writeCache(cli, output) {
|
|
17944
17991
|
const dir = join43(homedir17(), ".assist");
|
|
@@ -18072,7 +18119,7 @@ function registerCliHook(program2) {
|
|
|
18072
18119
|
}
|
|
18073
18120
|
|
|
18074
18121
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
18075
|
-
import { existsSync as existsSync44, readFileSync as
|
|
18122
|
+
import { existsSync as existsSync44, readFileSync as readFileSync30, unlinkSync as unlinkSync8, writeFileSync as writeFileSync24 } from "fs";
|
|
18076
18123
|
import chalk119 from "chalk";
|
|
18077
18124
|
|
|
18078
18125
|
// src/shared/isHashCommentFile.ts
|
|
@@ -18137,12 +18184,12 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
18137
18184
|
}
|
|
18138
18185
|
|
|
18139
18186
|
// src/commands/codeComment/readPinState.ts
|
|
18140
|
-
import { existsSync as existsSync43, readFileSync as
|
|
18187
|
+
import { existsSync as existsSync43, readFileSync as readFileSync29 } from "fs";
|
|
18141
18188
|
function readPinState(pin2) {
|
|
18142
18189
|
const path106 = getPinStatePath(pin2);
|
|
18143
18190
|
if (!existsSync43(path106)) return void 0;
|
|
18144
18191
|
try {
|
|
18145
|
-
const state = JSON.parse(
|
|
18192
|
+
const state = JSON.parse(readFileSync29(path106, "utf8"));
|
|
18146
18193
|
if (state.pin !== pin2) return void 0;
|
|
18147
18194
|
return state;
|
|
18148
18195
|
} catch {
|
|
@@ -18164,7 +18211,7 @@ function codeCommentConfirm(pin2) {
|
|
|
18164
18211
|
process.exitCode = 1;
|
|
18165
18212
|
return;
|
|
18166
18213
|
}
|
|
18167
|
-
const original =
|
|
18214
|
+
const original = readFileSync30(state.file, "utf8");
|
|
18168
18215
|
const lines2 = original.split("\n");
|
|
18169
18216
|
const index3 = state.line - 1;
|
|
18170
18217
|
if (index3 > lines2.length) {
|
|
@@ -20039,12 +20086,12 @@ function getMigrationApprovalPath(migrationId) {
|
|
|
20039
20086
|
}
|
|
20040
20087
|
|
|
20041
20088
|
// src/commands/dbMigration/readMigrationPinState.ts
|
|
20042
|
-
import { existsSync as existsSync48, readFileSync as
|
|
20089
|
+
import { existsSync as existsSync48, readFileSync as readFileSync31 } from "fs";
|
|
20043
20090
|
function readMigrationPinState(pin2) {
|
|
20044
20091
|
const path106 = getMigrationPinPath(pin2);
|
|
20045
20092
|
if (!existsSync48(path106)) return void 0;
|
|
20046
20093
|
try {
|
|
20047
|
-
const state = JSON.parse(
|
|
20094
|
+
const state = JSON.parse(readFileSync31(path106, "utf8"));
|
|
20048
20095
|
if (state.pin !== pin2) return void 0;
|
|
20049
20096
|
if (!Number.isInteger(state.migrationId)) return void 0;
|
|
20050
20097
|
return state;
|
|
@@ -20131,7 +20178,7 @@ function registerDbMigration(parent) {
|
|
|
20131
20178
|
}
|
|
20132
20179
|
|
|
20133
20180
|
// src/commands/deploy/redirect.ts
|
|
20134
|
-
import { existsSync as existsSync49, readFileSync as
|
|
20181
|
+
import { existsSync as existsSync49, readFileSync as readFileSync32, writeFileSync as writeFileSync28 } from "fs";
|
|
20135
20182
|
import chalk143 from "chalk";
|
|
20136
20183
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
20137
20184
|
if (!window.location.pathname.endsWith('/')) {
|
|
@@ -20144,7 +20191,7 @@ function redirect() {
|
|
|
20144
20191
|
console.log(chalk143.yellow("No index.html found"));
|
|
20145
20192
|
return;
|
|
20146
20193
|
}
|
|
20147
|
-
const content =
|
|
20194
|
+
const content = readFileSync32(indexPath, "utf8");
|
|
20148
20195
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
20149
20196
|
console.log(chalk143.dim("Trailing slash script already present"));
|
|
20150
20197
|
return;
|
|
@@ -20187,7 +20234,7 @@ import { execSync as execSync31 } from "child_process";
|
|
|
20187
20234
|
import chalk144 from "chalk";
|
|
20188
20235
|
|
|
20189
20236
|
// src/shared/getRepoName.ts
|
|
20190
|
-
import { existsSync as existsSync50, readFileSync as
|
|
20237
|
+
import { existsSync as existsSync50, readFileSync as readFileSync33 } from "fs";
|
|
20191
20238
|
import { basename as basename13, join as join54 } from "path";
|
|
20192
20239
|
function getRepoName() {
|
|
20193
20240
|
const config = loadConfig();
|
|
@@ -20197,7 +20244,7 @@ function getRepoName() {
|
|
|
20197
20244
|
const packageJsonPath = join54(process.cwd(), "package.json");
|
|
20198
20245
|
if (existsSync50(packageJsonPath)) {
|
|
20199
20246
|
try {
|
|
20200
|
-
const content =
|
|
20247
|
+
const content = readFileSync33(packageJsonPath, "utf8");
|
|
20201
20248
|
const pkg = JSON.parse(content);
|
|
20202
20249
|
if (pkg.name) {
|
|
20203
20250
|
return pkg.name;
|
|
@@ -20209,7 +20256,7 @@ function getRepoName() {
|
|
|
20209
20256
|
}
|
|
20210
20257
|
|
|
20211
20258
|
// src/commands/devlog/loadDevlogEntries.ts
|
|
20212
|
-
import { readdirSync as readdirSync6, readFileSync as
|
|
20259
|
+
import { readdirSync as readdirSync6, readFileSync as readFileSync34 } from "fs";
|
|
20213
20260
|
import { join as join55 } from "path";
|
|
20214
20261
|
var DEVLOG_DIR = join55(BLOG_REPO_ROOT, "src/content/devlog");
|
|
20215
20262
|
function extractFrontmatter(content) {
|
|
@@ -20239,7 +20286,7 @@ function readDevlogFiles(callback) {
|
|
|
20239
20286
|
try {
|
|
20240
20287
|
const files = readdirSync6(DEVLOG_DIR).filter((f) => f.endsWith(".md"));
|
|
20241
20288
|
for (const file of files) {
|
|
20242
|
-
const content =
|
|
20289
|
+
const content = readFileSync34(join55(DEVLOG_DIR, file), "utf8");
|
|
20243
20290
|
const parsed = parseFrontmatter(content, file);
|
|
20244
20291
|
if (parsed) callback(parsed);
|
|
20245
20292
|
}
|
|
@@ -20752,11 +20799,11 @@ async function checkBuildLocksCommand() {
|
|
|
20752
20799
|
}
|
|
20753
20800
|
|
|
20754
20801
|
// src/commands/dotnet/buildTree.ts
|
|
20755
|
-
import { readFileSync as
|
|
20802
|
+
import { readFileSync as readFileSync35 } from "fs";
|
|
20756
20803
|
import path34 from "path";
|
|
20757
20804
|
var PROJECT_REF_RE = /<ProjectReference\s+Include="([^"]+)"/g;
|
|
20758
20805
|
function getProjectRefs(csprojPath) {
|
|
20759
|
-
const content =
|
|
20806
|
+
const content = readFileSync35(csprojPath, "utf8");
|
|
20760
20807
|
const refs = [];
|
|
20761
20808
|
for (const match of content.matchAll(PROJECT_REF_RE)) {
|
|
20762
20809
|
refs.push(match[1].replace(/\\/g, "/"));
|
|
@@ -20773,7 +20820,7 @@ function buildTree(csprojPath, repoRoot2, visited = /* @__PURE__ */ new Set()) {
|
|
|
20773
20820
|
for (const ref of getProjectRefs(abs)) {
|
|
20774
20821
|
const childAbs = path34.resolve(dir, ref);
|
|
20775
20822
|
try {
|
|
20776
|
-
|
|
20823
|
+
readFileSync35(childAbs);
|
|
20777
20824
|
node.children.push(buildTree(childAbs, repoRoot2, visited));
|
|
20778
20825
|
} catch {
|
|
20779
20826
|
node.children.push({
|
|
@@ -20798,7 +20845,7 @@ function collectAllDeps(node) {
|
|
|
20798
20845
|
}
|
|
20799
20846
|
|
|
20800
20847
|
// src/commands/dotnet/findContainingSolutions.ts
|
|
20801
|
-
import { readdirSync as readdirSync8, readFileSync as
|
|
20848
|
+
import { readdirSync as readdirSync8, readFileSync as readFileSync36, statSync as statSync8 } from "fs";
|
|
20802
20849
|
import path35 from "path";
|
|
20803
20850
|
function findSlnFiles(dir, maxDepth, depth = 0) {
|
|
20804
20851
|
if (depth > maxDepth) return [];
|
|
@@ -20833,7 +20880,7 @@ function findContainingSolutions(csprojPath, repoRoot2) {
|
|
|
20833
20880
|
const pattern2 = new RegExp(`[\\\\"/]${escapeRegex(csprojBasename)}"`);
|
|
20834
20881
|
for (const sln of slnFiles) {
|
|
20835
20882
|
try {
|
|
20836
|
-
const content =
|
|
20883
|
+
const content = readFileSync36(sln, "utf8");
|
|
20837
20884
|
if (pattern2.test(content)) {
|
|
20838
20885
|
matches.push(path35.relative(repoRoot2, sln));
|
|
20839
20886
|
}
|
|
@@ -21151,7 +21198,7 @@ function parseInspectReport(json) {
|
|
|
21151
21198
|
|
|
21152
21199
|
// src/commands/dotnet/runInspectCode.ts
|
|
21153
21200
|
import { execSync as execSync35 } from "child_process";
|
|
21154
|
-
import { existsSync as existsSync53, readFileSync as
|
|
21201
|
+
import { existsSync as existsSync53, readFileSync as readFileSync37, unlinkSync as unlinkSync10 } from "fs";
|
|
21155
21202
|
import { tmpdir as tmpdir5 } from "os";
|
|
21156
21203
|
import path38 from "path";
|
|
21157
21204
|
import chalk158 from "chalk";
|
|
@@ -21186,7 +21233,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
21186
21233
|
console.error(chalk158.red("Report file not generated"));
|
|
21187
21234
|
process.exit(1);
|
|
21188
21235
|
}
|
|
21189
|
-
const xml =
|
|
21236
|
+
const xml = readFileSync37(reportPath, "utf8");
|
|
21190
21237
|
unlinkSync10(reportPath);
|
|
21191
21238
|
return xml;
|
|
21192
21239
|
}
|
|
@@ -23486,7 +23533,7 @@ function fetchIssue2(number, repo) {
|
|
|
23486
23533
|
}
|
|
23487
23534
|
|
|
23488
23535
|
// src/commands/github/issue/resumeIssueBody.ts
|
|
23489
|
-
import { existsSync as existsSync55, readFileSync as
|
|
23536
|
+
import { existsSync as existsSync55, readFileSync as readFileSync38 } from "fs";
|
|
23490
23537
|
|
|
23491
23538
|
// src/commands/github/issue/issueWorkingFile.ts
|
|
23492
23539
|
import { join as join60 } from "path";
|
|
@@ -23505,9 +23552,9 @@ function resumeIssueBody(slug2, number, updatedAt) {
|
|
|
23505
23552
|
const { bodyPath, metaPath } = issueWorkingFile(slug2, number);
|
|
23506
23553
|
if (!existsSync55(bodyPath) || !existsSync55(metaPath)) return void 0;
|
|
23507
23554
|
try {
|
|
23508
|
-
const meta = JSON.parse(
|
|
23555
|
+
const meta = JSON.parse(readFileSync38(metaPath, "utf8"));
|
|
23509
23556
|
if (meta.updatedAt !== updatedAt) return void 0;
|
|
23510
|
-
return
|
|
23557
|
+
return readFileSync38(bodyPath, "utf8");
|
|
23511
23558
|
} catch {
|
|
23512
23559
|
return void 0;
|
|
23513
23560
|
}
|
|
@@ -23933,7 +23980,7 @@ async function countPendingHandovers(orm, origin) {
|
|
|
23933
23980
|
import {
|
|
23934
23981
|
existsSync as existsSync56,
|
|
23935
23982
|
readdirSync as readdirSync10,
|
|
23936
|
-
readFileSync as
|
|
23983
|
+
readFileSync as readFileSync39,
|
|
23937
23984
|
rmSync as rmSync3,
|
|
23938
23985
|
statSync as statSync9
|
|
23939
23986
|
} from "fs";
|
|
@@ -23996,7 +24043,7 @@ function collectMarkdown(dir) {
|
|
|
23996
24043
|
return out;
|
|
23997
24044
|
}
|
|
23998
24045
|
async function migrateFile(orm, origin, file, createdAt) {
|
|
23999
|
-
const content =
|
|
24046
|
+
const content = readFileSync39(file, "utf8");
|
|
24000
24047
|
await saveHandover(orm, {
|
|
24001
24048
|
origin,
|
|
24002
24049
|
summary: summariseHandoverContent(content),
|
|
@@ -25216,7 +25263,7 @@ import { resolve as resolve18 } from "path";
|
|
|
25216
25263
|
import chalk173 from "chalk";
|
|
25217
25264
|
|
|
25218
25265
|
// src/commands/mermaid/exportFile.ts
|
|
25219
|
-
import { readFileSync as
|
|
25266
|
+
import { readFileSync as readFileSync40, writeFileSync as writeFileSync32 } from "fs";
|
|
25220
25267
|
import { basename as basename18, extname as extname2, resolve as resolve17 } from "path";
|
|
25221
25268
|
import chalk172 from "chalk";
|
|
25222
25269
|
|
|
@@ -25242,7 +25289,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
25242
25289
|
|
|
25243
25290
|
// src/commands/mermaid/exportFile.ts
|
|
25244
25291
|
async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
25245
|
-
const content =
|
|
25292
|
+
const content = readFileSync40(file, "utf8");
|
|
25246
25293
|
const blocks = extractMermaidBlocks(content);
|
|
25247
25294
|
const stem = basename18(file, extname2(file));
|
|
25248
25295
|
if (onlyIndex !== void 0) {
|
|
@@ -25454,14 +25501,14 @@ function applyIgnore(texts, ignore3) {
|
|
|
25454
25501
|
}
|
|
25455
25502
|
|
|
25456
25503
|
// src/commands/miro/readIgnoreList.ts
|
|
25457
|
-
import { existsSync as existsSync61, readFileSync as
|
|
25504
|
+
import { existsSync as existsSync61, readFileSync as readFileSync41 } from "fs";
|
|
25458
25505
|
import { parse as parse2 } from "yaml";
|
|
25459
25506
|
function readIgnoreList(file) {
|
|
25460
25507
|
if (!existsSync61(file))
|
|
25461
25508
|
throw new MiroExtractError(
|
|
25462
25509
|
`No ignore file at ${file}. Write a YAML list of the box texts to drop, or omit --ignore.`
|
|
25463
25510
|
);
|
|
25464
|
-
const parsed = parse2(
|
|
25511
|
+
const parsed = parse2(readFileSync41(file, "utf8"));
|
|
25465
25512
|
if (parsed === null || parsed === void 0) return [];
|
|
25466
25513
|
if (!Array.isArray(parsed) || parsed.some((entry) => typeof entry !== "string"))
|
|
25467
25514
|
throw new MiroExtractError(
|
|
@@ -25643,7 +25690,7 @@ async function pickAnchors(sessionId, items2) {
|
|
|
25643
25690
|
}
|
|
25644
25691
|
|
|
25645
25692
|
// src/commands/miro/readMiroItems.ts
|
|
25646
|
-
import { readFileSync as
|
|
25693
|
+
import { readFileSync as readFileSync42 } from "fs";
|
|
25647
25694
|
function tryParse(text18) {
|
|
25648
25695
|
try {
|
|
25649
25696
|
return JSON.parse(text18);
|
|
@@ -25672,7 +25719,7 @@ function parsePages(raw, file) {
|
|
|
25672
25719
|
return Array.isArray(parsed) ? parsed.map(toPage) : [toPage(parsed)];
|
|
25673
25720
|
}
|
|
25674
25721
|
function readMiroItems(file) {
|
|
25675
|
-
const items2 = parsePages(
|
|
25722
|
+
const items2 = parsePages(readFileSync42(file, "utf8"), file).flatMap(
|
|
25676
25723
|
(page) => page.data ?? []
|
|
25677
25724
|
);
|
|
25678
25725
|
if (items2.length === 0)
|
|
@@ -26068,7 +26115,7 @@ import { join as join71 } from "path";
|
|
|
26068
26115
|
import chalk178 from "chalk";
|
|
26069
26116
|
|
|
26070
26117
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
26071
|
-
import { readFileSync as
|
|
26118
|
+
import { readFileSync as readFileSync43 } from "fs";
|
|
26072
26119
|
|
|
26073
26120
|
// src/commands/netcap/parseRscRows.ts
|
|
26074
26121
|
var isRscRef = (v) => typeof v === "string" && /^\$[0-9a-fL@]/.test(v);
|
|
@@ -26464,7 +26511,7 @@ function extractVoyagerPosts(body) {
|
|
|
26464
26511
|
|
|
26465
26512
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
26466
26513
|
function captureEntries(captureFile) {
|
|
26467
|
-
const lines2 =
|
|
26514
|
+
const lines2 = readFileSync43(captureFile, "utf8").split("\n").filter(Boolean);
|
|
26468
26515
|
const entries = [];
|
|
26469
26516
|
for (const line of lines2) {
|
|
26470
26517
|
let entry;
|
|
@@ -26875,7 +26922,7 @@ import { tmpdir as tmpdir7 } from "os";
|
|
|
26875
26922
|
import { join as join73 } from "path";
|
|
26876
26923
|
|
|
26877
26924
|
// src/commands/prs/loadCommentsCache.ts
|
|
26878
|
-
import { existsSync as existsSync62, readFileSync as
|
|
26925
|
+
import { existsSync as existsSync62, readFileSync as readFileSync44, unlinkSync as unlinkSync13 } from "fs";
|
|
26879
26926
|
import { parse as parse3 } from "yaml";
|
|
26880
26927
|
|
|
26881
26928
|
// src/commands/prs/commentsCachePath.ts
|
|
@@ -26898,7 +26945,7 @@ function loadCommentsCache(org, repo, prNumber) {
|
|
|
26898
26945
|
if (!existsSync62(cachePath)) {
|
|
26899
26946
|
return null;
|
|
26900
26947
|
}
|
|
26901
|
-
const content =
|
|
26948
|
+
const content = readFileSync44(cachePath, "utf8");
|
|
26902
26949
|
return parse3(content);
|
|
26903
26950
|
}
|
|
26904
26951
|
function deleteCommentsCache(org, repo, prNumber) {
|
|
@@ -28487,7 +28534,7 @@ function registerPrsStatus(prsCommand) {
|
|
|
28487
28534
|
}
|
|
28488
28535
|
|
|
28489
28536
|
// src/commands/readTime/readTime.ts
|
|
28490
|
-
import { readFileSync as
|
|
28537
|
+
import { readFileSync as readFileSync45 } from "fs";
|
|
28491
28538
|
|
|
28492
28539
|
// src/commands/readTime/countReadingWords.ts
|
|
28493
28540
|
var FENCE_PATTERN = /^\s*(```|~~~)/;
|
|
@@ -28648,7 +28695,7 @@ async function loadBody(target) {
|
|
|
28648
28695
|
}
|
|
28649
28696
|
function readDraftFile(path106) {
|
|
28650
28697
|
try {
|
|
28651
|
-
return
|
|
28698
|
+
return readFileSync45(path106, "utf8");
|
|
28652
28699
|
} catch {
|
|
28653
28700
|
console.error(`Error: Could not read \`${path106}\`.`);
|
|
28654
28701
|
console.error(
|
|
@@ -29146,10 +29193,10 @@ function checkStreamGraph(streams) {
|
|
|
29146
29193
|
}
|
|
29147
29194
|
|
|
29148
29195
|
// src/commands/releases/readStreamsInput.ts
|
|
29149
|
-
import { readFileSync as
|
|
29196
|
+
import { readFileSync as readFileSync46 } from "fs";
|
|
29150
29197
|
import { parse as parse4 } from "yaml";
|
|
29151
29198
|
function readSource2(source) {
|
|
29152
|
-
return
|
|
29199
|
+
return readFileSync46(source === "-" ? 0 : source, "utf8");
|
|
29153
29200
|
}
|
|
29154
29201
|
function readStreamsInput(source) {
|
|
29155
29202
|
let parsed;
|
|
@@ -29976,7 +30023,7 @@ function buildLimitsSegment(rateLimits) {
|
|
|
29976
30023
|
}
|
|
29977
30024
|
|
|
29978
30025
|
// src/commands/readGitBranch.ts
|
|
29979
|
-
import { readFileSync as
|
|
30026
|
+
import { readFileSync as readFileSync47, statSync as statSync10 } from "fs";
|
|
29980
30027
|
import { isAbsolute as isAbsolute5, join as join77, resolve as resolve22 } from "path";
|
|
29981
30028
|
function resolveGitDir(cwd) {
|
|
29982
30029
|
const dotGit = join77(cwd, ".git");
|
|
@@ -29991,7 +30038,7 @@ function resolveGitDir(cwd) {
|
|
|
29991
30038
|
}
|
|
29992
30039
|
let contents;
|
|
29993
30040
|
try {
|
|
29994
|
-
contents =
|
|
30041
|
+
contents = readFileSync47(dotGit, "utf8");
|
|
29995
30042
|
} catch {
|
|
29996
30043
|
return null;
|
|
29997
30044
|
}
|
|
@@ -30009,7 +30056,7 @@ function readGitBranch(cwd) {
|
|
|
30009
30056
|
}
|
|
30010
30057
|
let head;
|
|
30011
30058
|
try {
|
|
30012
|
-
head =
|
|
30059
|
+
head = readFileSync47(join77(gitDir, "HEAD"), "utf8");
|
|
30013
30060
|
} catch {
|
|
30014
30061
|
return null;
|
|
30015
30062
|
}
|
|
@@ -32965,7 +33012,7 @@ function fetchHighLevelPr(prNumber, repo) {
|
|
|
32965
33012
|
}
|
|
32966
33013
|
|
|
32967
33014
|
// src/commands/review/highLevel/loadHighLevelReview.ts
|
|
32968
|
-
import { existsSync as existsSync64, readFileSync as
|
|
33015
|
+
import { existsSync as existsSync64, readFileSync as readFileSync48 } from "fs";
|
|
32969
33016
|
|
|
32970
33017
|
// src/commands/review/highLevel/highLevelReviewPath.ts
|
|
32971
33018
|
import { join as join78 } from "path";
|
|
@@ -32986,7 +33033,7 @@ function loadHighLevelReview(repo, headRef, headSha) {
|
|
|
32986
33033
|
const path106 = highLevelReviewPath(repo, headRef, headSha);
|
|
32987
33034
|
if (!existsSync64(path106)) return void 0;
|
|
32988
33035
|
try {
|
|
32989
|
-
return JSON.parse(
|
|
33036
|
+
return JSON.parse(readFileSync48(path106, "utf8"));
|
|
32990
33037
|
} catch {
|
|
32991
33038
|
return void 0;
|
|
32992
33039
|
}
|
|
@@ -33564,7 +33611,7 @@ function gatherContext() {
|
|
|
33564
33611
|
}
|
|
33565
33612
|
|
|
33566
33613
|
// src/commands/review/postReviewToPr.ts
|
|
33567
|
-
import { readFileSync as
|
|
33614
|
+
import { readFileSync as readFileSync49 } from "fs";
|
|
33568
33615
|
|
|
33569
33616
|
// src/commands/review/carriedUnanchoredFindings.ts
|
|
33570
33617
|
function carriedUnanchoredFindings(unanchored) {
|
|
@@ -34015,7 +34062,7 @@ async function confirmPost(prNumber, work, options2) {
|
|
|
34015
34062
|
return promptConfirm(`Post ${work} to PR #${prNumber}?`, false);
|
|
34016
34063
|
}
|
|
34017
34064
|
async function postFindingsToPr(prInfo, synthesisPath, options2) {
|
|
34018
|
-
const markdown =
|
|
34065
|
+
const markdown = readFileSync49(synthesisPath, "utf8");
|
|
34019
34066
|
const { inDiff, unanchored } = selectPostableFindings(markdown, prInfo);
|
|
34020
34067
|
const carried = carriedUnanchoredFindings(unanchored);
|
|
34021
34068
|
if (inDiff.length === 0 && carried.length === 0) return NOTHING_POSTED;
|
|
@@ -35013,7 +35060,7 @@ async function runReviewers(reviewDir, claudePath, codexPath, stdinPrompt, optio
|
|
|
35013
35060
|
}
|
|
35014
35061
|
|
|
35015
35062
|
// src/commands/review/synthesise.ts
|
|
35016
|
-
import { readFileSync as
|
|
35063
|
+
import { readFileSync as readFileSync50 } from "fs";
|
|
35017
35064
|
|
|
35018
35065
|
// src/commands/review/buildSynthesisStdin.ts
|
|
35019
35066
|
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.
|
|
@@ -35078,7 +35125,7 @@ Files:
|
|
|
35078
35125
|
|
|
35079
35126
|
// src/commands/review/synthesise.ts
|
|
35080
35127
|
function printSummary2(synthesisPath) {
|
|
35081
|
-
const markdown =
|
|
35128
|
+
const markdown = readFileSync50(synthesisPath, "utf8");
|
|
35082
35129
|
console.log("");
|
|
35083
35130
|
console.log(buildReviewSummary(markdown));
|
|
35084
35131
|
console.log("");
|
|
@@ -35391,7 +35438,7 @@ function registerReview(program2) {
|
|
|
35391
35438
|
}
|
|
35392
35439
|
|
|
35393
35440
|
// src/commands/rules/addRule.ts
|
|
35394
|
-
import { existsSync as existsSync70, readFileSync as
|
|
35441
|
+
import { existsSync as existsSync70, readFileSync as readFileSync54, writeFileSync as writeFileSync43 } from "fs";
|
|
35395
35442
|
import path85 from "path";
|
|
35396
35443
|
import chalk235 from "chalk";
|
|
35397
35444
|
|
|
@@ -35416,7 +35463,7 @@ function insertRuleBullet(content, rule) {
|
|
|
35416
35463
|
}
|
|
35417
35464
|
|
|
35418
35465
|
// src/commands/rules/nextRuleCode.ts
|
|
35419
|
-
import { readFileSync as
|
|
35466
|
+
import { readFileSync as readFileSync51 } from "fs";
|
|
35420
35467
|
|
|
35421
35468
|
// src/commands/rules/findClaudeFiles.ts
|
|
35422
35469
|
import { readdirSync as readdirSync13 } from "fs";
|
|
@@ -35440,7 +35487,7 @@ function findClaudeFiles(dir) {
|
|
|
35440
35487
|
var CODE_PREFIX = "R";
|
|
35441
35488
|
function nextRuleCode(root2) {
|
|
35442
35489
|
const numbers = findClaudeFiles(root2).flatMap(
|
|
35443
|
-
(file) => parseRulesSection(
|
|
35490
|
+
(file) => parseRulesSection(readFileSync51(file, "utf8")).map(
|
|
35444
35491
|
(rule) => Number(/(\d+)\s*$/.exec(rule.code)?.[1] ?? 0)
|
|
35445
35492
|
)
|
|
35446
35493
|
);
|
|
@@ -35466,15 +35513,15 @@ function resolveRuleScope(target) {
|
|
|
35466
35513
|
}
|
|
35467
35514
|
|
|
35468
35515
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
35469
|
-
import { existsSync as existsSync69, readFileSync as
|
|
35516
|
+
import { existsSync as existsSync69, readFileSync as readFileSync53, writeFileSync as writeFileSync42 } from "fs";
|
|
35470
35517
|
import path84 from "path";
|
|
35471
35518
|
|
|
35472
35519
|
// src/commands/rules/scopedRuleDirectories.ts
|
|
35473
|
-
import { readFileSync as
|
|
35520
|
+
import { readFileSync as readFileSync52 } from "fs";
|
|
35474
35521
|
import path83 from "path";
|
|
35475
35522
|
function scopedRuleDirectories(root2) {
|
|
35476
35523
|
return findClaudeFiles(root2).filter(
|
|
35477
|
-
(file) => path83.dirname(file) !== root2 && parseRulesSection(
|
|
35524
|
+
(file) => path83.dirname(file) !== root2 && parseRulesSection(readFileSync52(file, "utf8")).length > 0
|
|
35478
35525
|
).map(
|
|
35479
35526
|
(file) => `${path83.relative(root2, path83.dirname(file)).split(path83.sep).join("/")}/`
|
|
35480
35527
|
).sort();
|
|
@@ -35516,7 +35563,7 @@ function upsertScopedRulesPointer(content, directories) {
|
|
|
35516
35563
|
function updateScopedRulesIndex(root2) {
|
|
35517
35564
|
const directories = scopedRuleDirectories(root2);
|
|
35518
35565
|
const rootFile = path84.join(root2, "CLAUDE.md");
|
|
35519
|
-
const before = existsSync69(rootFile) ?
|
|
35566
|
+
const before = existsSync69(rootFile) ? readFileSync53(rootFile, "utf8") : "";
|
|
35520
35567
|
const after = upsertScopedRulesPointer(before, directories);
|
|
35521
35568
|
if (after !== before) writeFileSync42(rootFile, after);
|
|
35522
35569
|
return directories;
|
|
@@ -35524,7 +35571,7 @@ function updateScopedRulesIndex(root2) {
|
|
|
35524
35571
|
|
|
35525
35572
|
// src/commands/rules/addRule.ts
|
|
35526
35573
|
function read2(file) {
|
|
35527
|
-
return existsSync70(file) ?
|
|
35574
|
+
return existsSync70(file) ? readFileSync54(file, "utf8") : "";
|
|
35528
35575
|
}
|
|
35529
35576
|
function addRule(text18, options2) {
|
|
35530
35577
|
const rule = text18.trim();
|
|
@@ -35988,12 +36035,12 @@ import { mkdirSync as mkdirSync26, writeFileSync as writeFileSync45 } from "fs";
|
|
|
35988
36035
|
import { mkdirSync as mkdirSync25, writeFileSync as writeFileSync44 } from "fs";
|
|
35989
36036
|
|
|
35990
36037
|
// src/commands/slack/readSlackParts.ts
|
|
35991
|
-
import { readFileSync as
|
|
36038
|
+
import { readFileSync as readFileSync55 } from "fs";
|
|
35992
36039
|
function readSlackParts(files) {
|
|
35993
36040
|
return files.map((file) => {
|
|
35994
36041
|
let contents;
|
|
35995
36042
|
try {
|
|
35996
|
-
contents =
|
|
36043
|
+
contents = readFileSync55(file, "utf8");
|
|
35997
36044
|
} catch {
|
|
35998
36045
|
console.error(`Error: Part file not found: ${file}`);
|
|
35999
36046
|
process.exit(1);
|
|
@@ -36721,7 +36768,7 @@ function syncPiHooks(sourceDir) {
|
|
|
36721
36768
|
}
|
|
36722
36769
|
|
|
36723
36770
|
// src/commands/sync/syncPi.ts
|
|
36724
|
-
function
|
|
36771
|
+
function unquote3(value) {
|
|
36725
36772
|
return value.trim().replace(/^["']|["']$/g, "");
|
|
36726
36773
|
}
|
|
36727
36774
|
function commandToPrompt(name, content) {
|
|
@@ -36729,9 +36776,9 @@ function commandToPrompt(name, content) {
|
|
|
36729
36776
|
const frontmatter2 = match ? match[1] : "";
|
|
36730
36777
|
const body = match ? content.slice(match[0].length) : content;
|
|
36731
36778
|
const descriptionMatch = frontmatter2.match(/^description:\s*(.*)$/m);
|
|
36732
|
-
const description = descriptionMatch ?
|
|
36779
|
+
const description = descriptionMatch ? unquote3(descriptionMatch[1]) : name;
|
|
36733
36780
|
const argsMatch = frontmatter2.match(/^allowed_args:\s*(.*)$/m);
|
|
36734
|
-
const argumentHint = argsMatch ?
|
|
36781
|
+
const argumentHint = argsMatch ? unquote3(argsMatch[1]) : void 0;
|
|
36735
36782
|
const header = [
|
|
36736
36783
|
"---",
|
|
36737
36784
|
`description: ${description}`,
|
|
@@ -37100,9 +37147,9 @@ function formatVttPassages(passages, notes = [], { sourceMarks = true } = {}) {
|
|
|
37100
37147
|
}
|
|
37101
37148
|
|
|
37102
37149
|
// src/commands/transcript/convert/readCleanedCues.ts
|
|
37103
|
-
import { readFileSync as
|
|
37150
|
+
import { readFileSync as readFileSync60 } from "fs";
|
|
37104
37151
|
function readCleanedCues(inputPath) {
|
|
37105
|
-
return deduplicateCues(parseVtt(
|
|
37152
|
+
return deduplicateCues(parseVtt(readFileSync60(inputPath, "utf8")));
|
|
37106
37153
|
}
|
|
37107
37154
|
|
|
37108
37155
|
// src/commands/transcript/clean.ts
|
|
@@ -37876,7 +37923,7 @@ function configKeys2() {
|
|
|
37876
37923
|
}
|
|
37877
37924
|
|
|
37878
37925
|
// src/commands/verify/forbiddenStrings.ts
|
|
37879
|
-
import { existsSync as existsSync79, readFileSync as
|
|
37926
|
+
import { existsSync as existsSync79, readFileSync as readFileSync61 } from "fs";
|
|
37880
37927
|
|
|
37881
37928
|
// src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
|
|
37882
37929
|
import { minimatch as minimatch9 } from "minimatch";
|
|
@@ -37923,7 +37970,7 @@ function forbiddenStrings() {
|
|
|
37923
37970
|
}
|
|
37924
37971
|
let parsed;
|
|
37925
37972
|
try {
|
|
37926
|
-
parsed = JSON.parse(
|
|
37973
|
+
parsed = JSON.parse(readFileSync61(file, "utf8"));
|
|
37927
37974
|
} catch (error) {
|
|
37928
37975
|
console.log(`Could not parse ${file}: ${error.message}`);
|
|
37929
37976
|
process.exit(1);
|
|
@@ -37993,7 +38040,7 @@ Total: ${lines2.length} hardcoded color(s)`);
|
|
|
37993
38040
|
}
|
|
37994
38041
|
|
|
37995
38042
|
// src/commands/verify/migrations.ts
|
|
37996
|
-
import { readFileSync as
|
|
38043
|
+
import { readFileSync as readFileSync62 } from "fs";
|
|
37997
38044
|
import path101 from "path";
|
|
37998
38045
|
|
|
37999
38046
|
// src/commands/verify/migrations/checkAppendOnly.ts
|
|
@@ -38158,7 +38205,7 @@ function migrations2() {
|
|
|
38158
38205
|
if (ref) {
|
|
38159
38206
|
const baseline = readBaselineMigrations(REPO_RELATIVE_DIR, ref);
|
|
38160
38207
|
const current = new Map(
|
|
38161
|
-
files.map((file) => [file,
|
|
38208
|
+
files.map((file) => [file, readFileSync62(path101.join(dir, file), "utf8")])
|
|
38162
38209
|
);
|
|
38163
38210
|
for (const finding of checkAppendOnly(baseline, current)) {
|
|
38164
38211
|
problems.push(
|
|
@@ -38331,14 +38378,14 @@ function devices() {
|
|
|
38331
38378
|
}
|
|
38332
38379
|
|
|
38333
38380
|
// src/commands/voice/logs.ts
|
|
38334
|
-
import { existsSync as existsSync80, readFileSync as
|
|
38381
|
+
import { existsSync as existsSync80, readFileSync as readFileSync63 } from "fs";
|
|
38335
38382
|
function logs(options2) {
|
|
38336
38383
|
if (!existsSync80(voicePaths.log)) {
|
|
38337
38384
|
console.log("No voice log file found");
|
|
38338
38385
|
return;
|
|
38339
38386
|
}
|
|
38340
38387
|
const count8 = Number.parseInt(options2.lines ?? "150", 10);
|
|
38341
|
-
const content =
|
|
38388
|
+
const content = readFileSync63(voicePaths.log, "utf8").trim();
|
|
38342
38389
|
if (!content) {
|
|
38343
38390
|
console.log("Voice log is empty");
|
|
38344
38391
|
return;
|
|
@@ -38365,7 +38412,7 @@ import { join as join98 } from "path";
|
|
|
38365
38412
|
|
|
38366
38413
|
// src/commands/voice/checkLockFile.ts
|
|
38367
38414
|
import { execSync as execSync66 } from "child_process";
|
|
38368
|
-
import { existsSync as existsSync81, mkdirSync as mkdirSync33, readFileSync as
|
|
38415
|
+
import { existsSync as existsSync81, mkdirSync as mkdirSync33, readFileSync as readFileSync64, writeFileSync as writeFileSync52 } from "fs";
|
|
38369
38416
|
import { join as join97 } from "path";
|
|
38370
38417
|
function isProcessAlive2(pid) {
|
|
38371
38418
|
try {
|
|
@@ -38379,7 +38426,7 @@ function checkLockFile() {
|
|
|
38379
38426
|
const lockFile = getLockFile();
|
|
38380
38427
|
if (!existsSync81(lockFile)) return;
|
|
38381
38428
|
try {
|
|
38382
|
-
const lock2 = JSON.parse(
|
|
38429
|
+
const lock2 = JSON.parse(readFileSync64(lockFile, "utf8"));
|
|
38383
38430
|
if (lock2.pid && isProcessAlive2(lock2.pid)) {
|
|
38384
38431
|
console.error(
|
|
38385
38432
|
`Voice daemon already running (PID ${lock2.pid}, env: ${lock2.env}). Stop it first with: assist voice stop`
|
|
@@ -38481,7 +38528,7 @@ function start2(options2) {
|
|
|
38481
38528
|
}
|
|
38482
38529
|
|
|
38483
38530
|
// src/commands/voice/status.ts
|
|
38484
|
-
import { existsSync as existsSync82, readFileSync as
|
|
38531
|
+
import { existsSync as existsSync82, readFileSync as readFileSync65 } from "fs";
|
|
38485
38532
|
function isProcessAlive3(pid) {
|
|
38486
38533
|
try {
|
|
38487
38534
|
process.kill(pid, 0);
|
|
@@ -38492,7 +38539,7 @@ function isProcessAlive3(pid) {
|
|
|
38492
38539
|
}
|
|
38493
38540
|
function readRecentLogs(count8) {
|
|
38494
38541
|
if (!existsSync82(voicePaths.log)) return [];
|
|
38495
|
-
const lines2 =
|
|
38542
|
+
const lines2 = readFileSync65(voicePaths.log, "utf8").trim().split("\n");
|
|
38496
38543
|
return lines2.slice(-count8);
|
|
38497
38544
|
}
|
|
38498
38545
|
function status2() {
|
|
@@ -38500,7 +38547,7 @@ function status2() {
|
|
|
38500
38547
|
console.log("Voice daemon: not running (no PID file)");
|
|
38501
38548
|
return;
|
|
38502
38549
|
}
|
|
38503
|
-
const pid = Number.parseInt(
|
|
38550
|
+
const pid = Number.parseInt(readFileSync65(voicePaths.pid, "utf8").trim(), 10);
|
|
38504
38551
|
const alive = isProcessAlive3(pid);
|
|
38505
38552
|
console.log(`Voice daemon: ${alive ? "running" : "dead"} (PID ${pid})`);
|
|
38506
38553
|
const recent = readRecentLogs(5);
|
|
@@ -38519,13 +38566,13 @@ function status2() {
|
|
|
38519
38566
|
}
|
|
38520
38567
|
|
|
38521
38568
|
// src/commands/voice/stop.ts
|
|
38522
|
-
import { existsSync as existsSync83, readFileSync as
|
|
38569
|
+
import { existsSync as existsSync83, readFileSync as readFileSync66, unlinkSync as unlinkSync21 } from "fs";
|
|
38523
38570
|
function stop2() {
|
|
38524
38571
|
if (!existsSync83(voicePaths.pid)) {
|
|
38525
38572
|
console.log("Voice daemon is not running (no PID file)");
|
|
38526
38573
|
return;
|
|
38527
38574
|
}
|
|
38528
|
-
const pid = Number.parseInt(
|
|
38575
|
+
const pid = Number.parseInt(readFileSync66(voicePaths.pid, "utf8").trim(), 10);
|
|
38529
38576
|
try {
|
|
38530
38577
|
process.kill(pid, "SIGTERM");
|
|
38531
38578
|
console.log(`Sent SIGTERM to voice daemon (PID ${pid})`);
|
|
@@ -39339,7 +39386,7 @@ async function auth() {
|
|
|
39339
39386
|
|
|
39340
39387
|
// src/commands/roam/postRoamActivity.ts
|
|
39341
39388
|
import { execFileSync as execFileSync23 } from "child_process";
|
|
39342
|
-
import { readdirSync as readdirSync22, readFileSync as
|
|
39389
|
+
import { readdirSync as readdirSync22, readFileSync as readFileSync67, statSync as statSync13 } from "fs";
|
|
39343
39390
|
import { join as join101 } from "path";
|
|
39344
39391
|
function findPortFile(roamDir) {
|
|
39345
39392
|
let entries;
|
|
@@ -39370,7 +39417,7 @@ function postRoamActivity(app, event) {
|
|
|
39370
39417
|
if (!portFile) return;
|
|
39371
39418
|
let port;
|
|
39372
39419
|
try {
|
|
39373
|
-
port =
|
|
39420
|
+
port = readFileSync67(portFile, "utf8").trim();
|
|
39374
39421
|
} catch {
|
|
39375
39422
|
return;
|
|
39376
39423
|
}
|
|
@@ -39762,11 +39809,11 @@ function applyLine(result, pending, line) {
|
|
|
39762
39809
|
}
|
|
39763
39810
|
|
|
39764
39811
|
// src/commands/sessions/daemon/readDaemonPidFile.ts
|
|
39765
|
-
import { readFileSync as
|
|
39812
|
+
import { readFileSync as readFileSync68 } from "fs";
|
|
39766
39813
|
function readDaemonPidFile() {
|
|
39767
39814
|
try {
|
|
39768
39815
|
const pid = Number.parseInt(
|
|
39769
|
-
|
|
39816
|
+
readFileSync68(daemonPaths.pid, "utf8").trim(),
|
|
39770
39817
|
10
|
|
39771
39818
|
);
|
|
39772
39819
|
return Number.isInteger(pid) ? pid : void 0;
|
|
@@ -45922,7 +45969,7 @@ function handleConnection(socket, manager) {
|
|
|
45922
45969
|
import { unlinkSync as unlinkSync23, writeFileSync as writeFileSync55 } from "fs";
|
|
45923
45970
|
|
|
45924
45971
|
// src/commands/sessions/daemon/startPidFileWatchdog.ts
|
|
45925
|
-
import { readFileSync as
|
|
45972
|
+
import { readFileSync as readFileSync70 } from "fs";
|
|
45926
45973
|
var WATCHDOG_INTERVAL_MS = 5e3;
|
|
45927
45974
|
function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
45928
45975
|
const timer = setInterval(() => {
|
|
@@ -45933,7 +45980,7 @@ function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
|
45933
45980
|
}
|
|
45934
45981
|
function ownsPidFile() {
|
|
45935
45982
|
try {
|
|
45936
|
-
return
|
|
45983
|
+
return readFileSync70(daemonPaths.pid, "utf8").trim() === String(process.pid);
|
|
45937
45984
|
} catch {
|
|
45938
45985
|
return false;
|
|
45939
45986
|
}
|