@staff0rd/assist 0.1010.2 → 0.1011.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/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.1011.1",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -25410,7 +25410,7 @@ function parseNameOnlyLog(output, ignore3, afterDate) {
|
|
|
25410
25410
|
return byDate;
|
|
25411
25411
|
}
|
|
25412
25412
|
function fetchCommitsAfter(ignore3, afterDate) {
|
|
25413
|
-
const range = afterDate ? [`--since=${afterDate}T00:00:00`] : [
|
|
25413
|
+
const range = afterDate ? [`--since=${afterDate}T00:00:00`] : [];
|
|
25414
25414
|
const output = execFileSync7(
|
|
25415
25415
|
"git",
|
|
25416
25416
|
[
|
|
@@ -25602,45 +25602,13 @@ function logNoCommits(lastWeek) {
|
|
|
25602
25602
|
);
|
|
25603
25603
|
}
|
|
25604
25604
|
|
|
25605
|
-
// src/commands/devlog/next/loadLastDailyDevlogDate.ts
|
|
25606
|
-
import { readdirSync as readdirSync9, readFileSync as readFileSync39 } from "fs";
|
|
25607
|
-
import { join as join69 } from "path";
|
|
25608
|
-
var DEVLOG_DIR = join69(BLOG_REPO_ROOT, "src/content/devlog");
|
|
25609
|
-
function readMarkdownFiles(dir) {
|
|
25610
|
-
try {
|
|
25611
|
-
return readdirSync9(dir).filter((file) => file.endsWith(".md"));
|
|
25612
|
-
} catch {
|
|
25613
|
-
return [];
|
|
25614
|
-
}
|
|
25615
|
-
}
|
|
25616
|
-
function parseDateForRepo(content, repoName) {
|
|
25617
|
-
const frontmatter2 = content.match(/^---\n([\s\S]*?)\n---/)?.[1];
|
|
25618
|
-
if (!frontmatter2) return null;
|
|
25619
|
-
const date = frontmatter2.match(/date:\s*"?(\d{4}-\d{2}-\d{2})"?/)?.[1];
|
|
25620
|
-
const repoTag = frontmatter2.match(/tags:\s*\[([^,\]]*)/)?.[1]?.trim();
|
|
25621
|
-
return date && repoTag === repoName ? date : null;
|
|
25622
|
-
}
|
|
25623
|
-
function loadLastDailyDevlogDate(repoName, devlogDir = DEVLOG_DIR) {
|
|
25624
|
-
let latest2 = null;
|
|
25625
|
-
for (const file of readMarkdownFiles(devlogDir)) {
|
|
25626
|
-
const content = readFileSync39(join69(devlogDir, file), "utf8");
|
|
25627
|
-
const date = parseDateForRepo(content, repoName);
|
|
25628
|
-
if (date && (!latest2 || date > latest2)) latest2 = date;
|
|
25629
|
-
}
|
|
25630
|
-
return latest2;
|
|
25631
|
-
}
|
|
25632
|
-
|
|
25633
25605
|
// src/commands/devlog/next.ts
|
|
25634
|
-
function resolveAfterDate(repoName, lastWeek) {
|
|
25635
|
-
if (lastWeek) return isoWeekRange(lastWeek).end;
|
|
25636
|
-
return loadLastDailyDevlogDate(repoName);
|
|
25637
|
-
}
|
|
25638
25606
|
function next2(options2) {
|
|
25639
25607
|
const config = loadConfig();
|
|
25640
25608
|
const repoName = getRepoName();
|
|
25641
25609
|
const ignore3 = options2.ignore ?? config.devlog?.ignore ?? [];
|
|
25642
25610
|
const lastWeek = loadDevWeeks(repoName).at(-1) ?? null;
|
|
25643
|
-
const afterDate =
|
|
25611
|
+
const afterDate = lastWeek ? isoWeekRange(lastWeek).end : null;
|
|
25644
25612
|
const byWeek = groupCommitsByWeek(fetchCommitsAfter(ignore3, afterDate));
|
|
25645
25613
|
const week = findTargetWeek(byWeek.keys(), {
|
|
25646
25614
|
lastWeek,
|
|
@@ -25662,10 +25630,10 @@ function next2(options2) {
|
|
|
25662
25630
|
import { execSync as execSync34 } from "child_process";
|
|
25663
25631
|
|
|
25664
25632
|
// src/commands/devlog/loadAllDevLatestWeeks.ts
|
|
25665
|
-
import { readdirSync as
|
|
25633
|
+
import { readdirSync as readdirSync9 } from "fs";
|
|
25666
25634
|
function readRepoDirs(devDir) {
|
|
25667
25635
|
try {
|
|
25668
|
-
return
|
|
25636
|
+
return readdirSync9(devDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
|
|
25669
25637
|
} catch {
|
|
25670
25638
|
return [];
|
|
25671
25639
|
}
|
|
@@ -25761,11 +25729,11 @@ function repos(options2) {
|
|
|
25761
25729
|
|
|
25762
25730
|
// src/commands/devlog/skip.ts
|
|
25763
25731
|
import { writeFileSync as writeFileSync32 } from "fs";
|
|
25764
|
-
import { join as
|
|
25732
|
+
import { join as join69 } from "path";
|
|
25765
25733
|
import chalk163 from "chalk";
|
|
25766
25734
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
25767
25735
|
function getBlogConfigPath() {
|
|
25768
|
-
return
|
|
25736
|
+
return join69(BLOG_REPO_ROOT, "assist.yml");
|
|
25769
25737
|
}
|
|
25770
25738
|
function skip2(week) {
|
|
25771
25739
|
if (!isValidWeek(week)) {
|
|
@@ -25854,13 +25822,13 @@ async function forwardPinConfirm(area, pin2) {
|
|
|
25854
25822
|
import { unlinkSync as unlinkSync10 } from "fs";
|
|
25855
25823
|
|
|
25856
25824
|
// src/commands/docs/getDocsUnlockPinPath.ts
|
|
25857
|
-
import { join as
|
|
25825
|
+
import { join as join70 } from "path";
|
|
25858
25826
|
function getDocsUnlockPinPath(pin2) {
|
|
25859
|
-
return
|
|
25827
|
+
return join70(getRestrictedDir(), `docs-unlock-pin-${pin2}.json`);
|
|
25860
25828
|
}
|
|
25861
25829
|
|
|
25862
25830
|
// src/commands/docs/readDocsUnlockPinState.ts
|
|
25863
|
-
import { existsSync as existsSync55, readFileSync as
|
|
25831
|
+
import { existsSync as existsSync55, readFileSync as readFileSync39 } from "fs";
|
|
25864
25832
|
function isPositiveInteger(value) {
|
|
25865
25833
|
return Number.isInteger(value) && value > 0;
|
|
25866
25834
|
}
|
|
@@ -25868,7 +25836,7 @@ function readDocsUnlockPinState(pin2) {
|
|
|
25868
25836
|
const path109 = getDocsUnlockPinPath(pin2);
|
|
25869
25837
|
if (!existsSync55(path109)) return void 0;
|
|
25870
25838
|
try {
|
|
25871
|
-
const state = JSON.parse(
|
|
25839
|
+
const state = JSON.parse(readFileSync39(path109, "utf8"));
|
|
25872
25840
|
if (state.pin !== pin2) return void 0;
|
|
25873
25841
|
if (!isPositiveInteger(state.itemId)) return void 0;
|
|
25874
25842
|
if (!isPositiveInteger(state.phase)) return void 0;
|
|
@@ -26027,20 +25995,20 @@ function registerDocs(parent) {
|
|
|
26027
25995
|
}
|
|
26028
25996
|
|
|
26029
25997
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
26030
|
-
import { closeSync as closeSync4, openSync as openSync5, readdirSync as
|
|
26031
|
-
import { join as
|
|
25998
|
+
import { closeSync as closeSync4, openSync as openSync5, readdirSync as readdirSync10 } from "fs";
|
|
25999
|
+
import { join as join71 } from "path";
|
|
26032
26000
|
import chalk167 from "chalk";
|
|
26033
26001
|
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "packages"]);
|
|
26034
26002
|
function isLockedDll(debugDir) {
|
|
26035
26003
|
let files;
|
|
26036
26004
|
try {
|
|
26037
|
-
files =
|
|
26005
|
+
files = readdirSync10(debugDir, { recursive: true });
|
|
26038
26006
|
} catch {
|
|
26039
26007
|
return null;
|
|
26040
26008
|
}
|
|
26041
26009
|
for (const file of files) {
|
|
26042
26010
|
if (!file.toLowerCase().endsWith(".dll")) continue;
|
|
26043
|
-
const dllPath =
|
|
26011
|
+
const dllPath = join71(debugDir, file);
|
|
26044
26012
|
try {
|
|
26045
26013
|
const fd = openSync5(dllPath, "r+");
|
|
26046
26014
|
closeSync4(fd);
|
|
@@ -26053,18 +26021,18 @@ function isLockedDll(debugDir) {
|
|
|
26053
26021
|
function findFirstLockedDll(dir) {
|
|
26054
26022
|
let entries;
|
|
26055
26023
|
try {
|
|
26056
|
-
entries =
|
|
26024
|
+
entries = readdirSync10(dir);
|
|
26057
26025
|
} catch {
|
|
26058
26026
|
return null;
|
|
26059
26027
|
}
|
|
26060
26028
|
if (entries.includes("bin")) {
|
|
26061
|
-
const locked = isLockedDll(
|
|
26029
|
+
const locked = isLockedDll(join71(dir, "bin", "Debug"));
|
|
26062
26030
|
if (locked) return locked;
|
|
26063
26031
|
}
|
|
26064
26032
|
for (const entry of entries) {
|
|
26065
26033
|
if (SKIP_DIRS.has(entry) || entry === "bin" || entry.startsWith("."))
|
|
26066
26034
|
continue;
|
|
26067
|
-
const found = findFirstLockedDll(
|
|
26035
|
+
const found = findFirstLockedDll(join71(dir, entry));
|
|
26068
26036
|
if (found) return found;
|
|
26069
26037
|
}
|
|
26070
26038
|
return null;
|
|
@@ -26087,11 +26055,11 @@ async function checkBuildLocksCommand() {
|
|
|
26087
26055
|
}
|
|
26088
26056
|
|
|
26089
26057
|
// src/commands/dotnet/buildTree.ts
|
|
26090
|
-
import { readFileSync as
|
|
26058
|
+
import { readFileSync as readFileSync40 } from "fs";
|
|
26091
26059
|
import path35 from "path";
|
|
26092
26060
|
var PROJECT_REF_RE = /<ProjectReference\s+Include="([^"]+)"/g;
|
|
26093
26061
|
function getProjectRefs(csprojPath) {
|
|
26094
|
-
const content =
|
|
26062
|
+
const content = readFileSync40(csprojPath, "utf8");
|
|
26095
26063
|
const refs = [];
|
|
26096
26064
|
for (const match of content.matchAll(PROJECT_REF_RE)) {
|
|
26097
26065
|
refs.push(match[1].replace(/\\/g, "/"));
|
|
@@ -26108,7 +26076,7 @@ function buildTree(csprojPath, repoRoot2, visited = /* @__PURE__ */ new Set()) {
|
|
|
26108
26076
|
for (const ref of getProjectRefs(abs)) {
|
|
26109
26077
|
const childAbs = path35.resolve(dir, ref);
|
|
26110
26078
|
try {
|
|
26111
|
-
|
|
26079
|
+
readFileSync40(childAbs);
|
|
26112
26080
|
node.children.push(buildTree(childAbs, repoRoot2, visited));
|
|
26113
26081
|
} catch {
|
|
26114
26082
|
node.children.push({
|
|
@@ -26133,14 +26101,14 @@ function collectAllDeps(node) {
|
|
|
26133
26101
|
}
|
|
26134
26102
|
|
|
26135
26103
|
// src/commands/dotnet/findContainingSolutions.ts
|
|
26136
|
-
import { readdirSync as
|
|
26104
|
+
import { readdirSync as readdirSync11, readFileSync as readFileSync41, statSync as statSync8 } from "fs";
|
|
26137
26105
|
import path36 from "path";
|
|
26138
26106
|
function findSlnFiles(dir, maxDepth, depth = 0) {
|
|
26139
26107
|
if (depth > maxDepth) return [];
|
|
26140
26108
|
const results = [];
|
|
26141
26109
|
let entries;
|
|
26142
26110
|
try {
|
|
26143
|
-
entries =
|
|
26111
|
+
entries = readdirSync11(dir);
|
|
26144
26112
|
} catch {
|
|
26145
26113
|
return results;
|
|
26146
26114
|
}
|
|
@@ -26168,7 +26136,7 @@ function findContainingSolutions(csprojPath, repoRoot2) {
|
|
|
26168
26136
|
const pattern2 = new RegExp(`[\\\\"/]${escapeRegex(csprojBasename)}"`);
|
|
26169
26137
|
for (const sln of slnFiles) {
|
|
26170
26138
|
try {
|
|
26171
|
-
const content =
|
|
26139
|
+
const content = readFileSync41(sln, "utf8");
|
|
26172
26140
|
if (pattern2.test(content)) {
|
|
26173
26141
|
matches.push(path36.relative(repoRoot2, sln));
|
|
26174
26142
|
}
|
|
@@ -26410,12 +26378,12 @@ import path38 from "path";
|
|
|
26410
26378
|
import chalk173 from "chalk";
|
|
26411
26379
|
|
|
26412
26380
|
// src/commands/dotnet/findSolution.ts
|
|
26413
|
-
import { readdirSync as
|
|
26414
|
-
import { dirname as dirname31, join as
|
|
26381
|
+
import { readdirSync as readdirSync12 } from "fs";
|
|
26382
|
+
import { dirname as dirname31, join as join72 } from "path";
|
|
26415
26383
|
import chalk172 from "chalk";
|
|
26416
26384
|
function findSlnInDir(dir) {
|
|
26417
26385
|
try {
|
|
26418
|
-
return
|
|
26386
|
+
return readdirSync12(dir).filter((f) => f.endsWith(".sln")).map((f) => join72(dir, f));
|
|
26419
26387
|
} catch {
|
|
26420
26388
|
return [];
|
|
26421
26389
|
}
|
|
@@ -26486,7 +26454,7 @@ function parseInspectReport(json) {
|
|
|
26486
26454
|
|
|
26487
26455
|
// src/commands/dotnet/runInspectCode.ts
|
|
26488
26456
|
import { execSync as execSync36 } from "child_process";
|
|
26489
|
-
import { existsSync as existsSync58, readFileSync as
|
|
26457
|
+
import { existsSync as existsSync58, readFileSync as readFileSync42, unlinkSync as unlinkSync12 } from "fs";
|
|
26490
26458
|
import { tmpdir as tmpdir4 } from "os";
|
|
26491
26459
|
import path39 from "path";
|
|
26492
26460
|
import chalk174 from "chalk";
|
|
@@ -26521,7 +26489,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
26521
26489
|
console.error(chalk174.red("Report file not generated"));
|
|
26522
26490
|
process.exit(1);
|
|
26523
26491
|
}
|
|
26524
|
-
const xml =
|
|
26492
|
+
const xml = readFileSync42(reportPath, "utf8");
|
|
26525
26493
|
unlinkSync12(reportPath);
|
|
26526
26494
|
return xml;
|
|
26527
26495
|
}
|
|
@@ -27423,7 +27391,7 @@ function aggregateCommitters(authorLists) {
|
|
|
27423
27391
|
import { spawnSync as spawnSync6 } from "child_process";
|
|
27424
27392
|
import { unlinkSync as unlinkSync14, writeFileSync as writeFileSync34 } from "fs";
|
|
27425
27393
|
import { tmpdir as tmpdir5 } from "os";
|
|
27426
|
-
import { join as
|
|
27394
|
+
import { join as join73 } from "path";
|
|
27427
27395
|
function buildArgs2(queryFile, vars) {
|
|
27428
27396
|
const args = ["api", "graphql", "-F", `query=@${queryFile}`];
|
|
27429
27397
|
for (const [key, value] of Object.entries(vars)) {
|
|
@@ -27433,7 +27401,7 @@ function buildArgs2(queryFile, vars) {
|
|
|
27433
27401
|
return args;
|
|
27434
27402
|
}
|
|
27435
27403
|
function runGhGraphql(mutation, vars) {
|
|
27436
|
-
const queryFile =
|
|
27404
|
+
const queryFile = join73(tmpdir5(), `gh-query-${Date.now()}.graphql`);
|
|
27437
27405
|
writeFileSync34(queryFile, mutation);
|
|
27438
27406
|
try {
|
|
27439
27407
|
const result = spawnSync6("gh", buildArgs2(queryFile, vars), {
|
|
@@ -28884,14 +28852,14 @@ function slugFromUrl(url) {
|
|
|
28884
28852
|
import { mkdirSync as mkdirSync21, writeFileSync as writeFileSync35 } from "fs";
|
|
28885
28853
|
|
|
28886
28854
|
// src/commands/github/issue/issueWorkingFile.ts
|
|
28887
|
-
import { join as
|
|
28855
|
+
import { join as join74 } from "path";
|
|
28888
28856
|
function issueWorkingFile(slug2, number) {
|
|
28889
28857
|
const [owner = "unknown", repo = "unknown"] = slug2.split("/");
|
|
28890
|
-
const dir =
|
|
28858
|
+
const dir = join74(getStoreDir(), "github-issues", owner, repo);
|
|
28891
28859
|
return {
|
|
28892
28860
|
dir,
|
|
28893
|
-
bodyPath:
|
|
28894
|
-
metaPath:
|
|
28861
|
+
bodyPath: join74(dir, `${number}.md`),
|
|
28862
|
+
metaPath: join74(dir, `${number}.json`)
|
|
28895
28863
|
};
|
|
28896
28864
|
}
|
|
28897
28865
|
|
|
@@ -28926,14 +28894,14 @@ function fetchIssueToWorkingFile(number, repo) {
|
|
|
28926
28894
|
}
|
|
28927
28895
|
|
|
28928
28896
|
// src/commands/github/issue/resumeIssueBody.ts
|
|
28929
|
-
import { existsSync as existsSync60, readFileSync as
|
|
28897
|
+
import { existsSync as existsSync60, readFileSync as readFileSync43 } from "fs";
|
|
28930
28898
|
function resumeIssueBody(slug2, number, updatedAt) {
|
|
28931
28899
|
const { bodyPath, metaPath } = issueWorkingFile(slug2, number);
|
|
28932
28900
|
if (!existsSync60(bodyPath) || !existsSync60(metaPath)) return void 0;
|
|
28933
28901
|
try {
|
|
28934
|
-
const meta = JSON.parse(
|
|
28902
|
+
const meta = JSON.parse(readFileSync43(metaPath, "utf8"));
|
|
28935
28903
|
if (meta.updatedAt !== updatedAt) return void 0;
|
|
28936
|
-
return
|
|
28904
|
+
return readFileSync43(bodyPath, "utf8");
|
|
28937
28905
|
} catch {
|
|
28938
28906
|
return void 0;
|
|
28939
28907
|
}
|
|
@@ -30079,11 +30047,11 @@ import { existsSync as existsSync61 } from "fs";
|
|
|
30079
30047
|
import { basename as basename20, dirname as dirname33 } from "path";
|
|
30080
30048
|
|
|
30081
30049
|
// src/commands/sessions/daemon/worktree/nextWorktreePath.ts
|
|
30082
|
-
import { basename as basename19, join as
|
|
30050
|
+
import { basename as basename19, join as join75 } from "path";
|
|
30083
30051
|
function nextWorktreePath(clone, base, isTaken) {
|
|
30084
30052
|
const name = basename19(clone);
|
|
30085
30053
|
for (let n = 2; n < 1e3; n++) {
|
|
30086
|
-
const candidate =
|
|
30054
|
+
const candidate = join75(base, `${name}-${n}`);
|
|
30087
30055
|
if (!isTaken(candidate)) return candidate;
|
|
30088
30056
|
}
|
|
30089
30057
|
throw new Error(`no free worktree suffix for ${clone}`);
|
|
@@ -30346,20 +30314,20 @@ function persistedTreeRoots() {
|
|
|
30346
30314
|
|
|
30347
30315
|
// src/commands/sessions/daemon/worktree/seedWorktree.ts
|
|
30348
30316
|
import { copyFileSync, existsSync as existsSync63, mkdirSync as mkdirSync22 } from "fs";
|
|
30349
|
-
import { dirname as dirname34, join as
|
|
30317
|
+
import { dirname as dirname34, join as join77 } from "path";
|
|
30350
30318
|
|
|
30351
30319
|
// src/commands/sessions/daemon/worktree/runInstall.ts
|
|
30352
30320
|
import { resolve as resolve19 } from "path";
|
|
30353
30321
|
|
|
30354
30322
|
// src/commands/sessions/daemon/worktree/detectInstallCommand.ts
|
|
30355
30323
|
import { existsSync as existsSync62 } from "fs";
|
|
30356
|
-
import { join as
|
|
30324
|
+
import { join as join76 } from "path";
|
|
30357
30325
|
function detectInstallCommand(dir) {
|
|
30358
|
-
if (!existsSync62(
|
|
30359
|
-
if (existsSync62(
|
|
30360
|
-
if (existsSync62(
|
|
30361
|
-
if (existsSync62(
|
|
30362
|
-
if (existsSync62(
|
|
30326
|
+
if (!existsSync62(join76(dir, "package.json"))) return null;
|
|
30327
|
+
if (existsSync62(join76(dir, "pnpm-lock.yaml"))) return "pnpm install";
|
|
30328
|
+
if (existsSync62(join76(dir, "yarn.lock"))) return "yarn install";
|
|
30329
|
+
if (existsSync62(join76(dir, "bun.lockb"))) return "bun install";
|
|
30330
|
+
if (existsSync62(join76(dir, "package-lock.json"))) return "npm ci";
|
|
30363
30331
|
return "npm install";
|
|
30364
30332
|
}
|
|
30365
30333
|
|
|
@@ -30524,9 +30492,9 @@ function seedWorktree(worktreePath, clone, onSeeded = () => {
|
|
|
30524
30492
|
}
|
|
30525
30493
|
function copyConfigFiles(worktreePath, clone, copy) {
|
|
30526
30494
|
for (const rel of copy) {
|
|
30527
|
-
const src =
|
|
30495
|
+
const src = join77(clone, rel);
|
|
30528
30496
|
if (!existsSync63(src)) continue;
|
|
30529
|
-
const dest =
|
|
30497
|
+
const dest = join77(worktreePath, rel);
|
|
30530
30498
|
try {
|
|
30531
30499
|
mkdirSync22(dirname34(dest), { recursive: true });
|
|
30532
30500
|
copyFileSync(src, dest);
|
|
@@ -31006,12 +30974,12 @@ function registerLitellm(program) {
|
|
|
31006
30974
|
}
|
|
31007
30975
|
|
|
31008
30976
|
// src/commands/mermaidExport.ts
|
|
31009
|
-
import { mkdirSync as mkdirSync23, readdirSync as
|
|
30977
|
+
import { mkdirSync as mkdirSync23, readdirSync as readdirSync13 } from "fs";
|
|
31010
30978
|
import { resolve as resolve21 } from "path";
|
|
31011
30979
|
import chalk191 from "chalk";
|
|
31012
30980
|
|
|
31013
30981
|
// src/commands/mermaid/exportFile.ts
|
|
31014
|
-
import { readFileSync as
|
|
30982
|
+
import { readFileSync as readFileSync44, writeFileSync as writeFileSync36 } from "fs";
|
|
31015
30983
|
import { basename as basename21, extname as extname4, resolve as resolve20 } from "path";
|
|
31016
30984
|
import chalk190 from "chalk";
|
|
31017
30985
|
|
|
@@ -31037,7 +31005,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
31037
31005
|
|
|
31038
31006
|
// src/commands/mermaid/exportFile.ts
|
|
31039
31007
|
async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
31040
|
-
const content =
|
|
31008
|
+
const content = readFileSync44(file, "utf8");
|
|
31041
31009
|
const blocks = extractMermaidBlocks(content);
|
|
31042
31010
|
const stem = basename21(file, extname4(file));
|
|
31043
31011
|
if (onlyIndex !== void 0) {
|
|
@@ -31088,7 +31056,7 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
31088
31056
|
process.exit(1);
|
|
31089
31057
|
}
|
|
31090
31058
|
}
|
|
31091
|
-
const files = file ? [file] :
|
|
31059
|
+
const files = file ? [file] : readdirSync13(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
31092
31060
|
if (files.length === 0) {
|
|
31093
31061
|
console.log(chalk191.gray("No markdown files found in current directory."));
|
|
31094
31062
|
return;
|
|
@@ -31249,14 +31217,14 @@ function applyIgnore(texts, ignore3) {
|
|
|
31249
31217
|
}
|
|
31250
31218
|
|
|
31251
31219
|
// src/commands/miro/readIgnoreList.ts
|
|
31252
|
-
import { existsSync as existsSync64, readFileSync as
|
|
31220
|
+
import { existsSync as existsSync64, readFileSync as readFileSync45 } from "fs";
|
|
31253
31221
|
import { parse as parse2 } from "yaml";
|
|
31254
31222
|
function readIgnoreList(file) {
|
|
31255
31223
|
if (!existsSync64(file))
|
|
31256
31224
|
throw new MiroExtractError(
|
|
31257
31225
|
`No ignore file at ${file}. Write a YAML list of the box texts to drop, or omit --ignore.`
|
|
31258
31226
|
);
|
|
31259
|
-
const parsed = parse2(
|
|
31227
|
+
const parsed = parse2(readFileSync45(file, "utf8"));
|
|
31260
31228
|
if (parsed === null || parsed === void 0) return [];
|
|
31261
31229
|
if (!Array.isArray(parsed) || parsed.some((entry) => typeof entry !== "string"))
|
|
31262
31230
|
throw new MiroExtractError(
|
|
@@ -31436,7 +31404,7 @@ async function pickAnchors(sessionId, items2) {
|
|
|
31436
31404
|
}
|
|
31437
31405
|
|
|
31438
31406
|
// src/commands/miro/readMiroItems.ts
|
|
31439
|
-
import { readFileSync as
|
|
31407
|
+
import { readFileSync as readFileSync46 } from "fs";
|
|
31440
31408
|
function tryParse(text18) {
|
|
31441
31409
|
try {
|
|
31442
31410
|
return JSON.parse(text18);
|
|
@@ -31465,7 +31433,7 @@ function parsePages(raw, file) {
|
|
|
31465
31433
|
return Array.isArray(parsed) ? parsed.map(toPage) : [toPage(parsed)];
|
|
31466
31434
|
}
|
|
31467
31435
|
function readMiroItems(file) {
|
|
31468
|
-
const items2 = parsePages(
|
|
31436
|
+
const items2 = parsePages(readFileSync46(file, "utf8"), file).flatMap(
|
|
31469
31437
|
(page) => page.data ?? []
|
|
31470
31438
|
);
|
|
31471
31439
|
if (items2.length === 0)
|
|
@@ -31737,15 +31705,15 @@ function createNetcapHandler(options2) {
|
|
|
31737
31705
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
31738
31706
|
import { cp as cp4, readFile as readFile7, writeFile as writeFile6 } from "fs/promises";
|
|
31739
31707
|
import { networkInterfaces } from "os";
|
|
31740
|
-
import { join as
|
|
31708
|
+
import { join as join79 } from "path";
|
|
31741
31709
|
import chalk194 from "chalk";
|
|
31742
31710
|
|
|
31743
31711
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
31744
|
-
import { dirname as dirname36, join as
|
|
31712
|
+
import { dirname as dirname36, join as join78 } from "path";
|
|
31745
31713
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
31746
31714
|
var moduleDir2 = dirname36(fileURLToPath7(import.meta.url));
|
|
31747
31715
|
function netcapExtensionDir() {
|
|
31748
|
-
return
|
|
31716
|
+
return join78(moduleDir2, "commands", "netcap", "netcap-extension");
|
|
31749
31717
|
}
|
|
31750
31718
|
|
|
31751
31719
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
@@ -31760,7 +31728,7 @@ function lanIPv4() {
|
|
|
31760
31728
|
return void 0;
|
|
31761
31729
|
}
|
|
31762
31730
|
async function configureBackground(dir, host, port, filter) {
|
|
31763
|
-
const file =
|
|
31731
|
+
const file = join79(dir, "background.js");
|
|
31764
31732
|
const source = await readFile7(file, "utf8");
|
|
31765
31733
|
await writeFile6(
|
|
31766
31734
|
file,
|
|
@@ -31800,20 +31768,20 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
31800
31768
|
}
|
|
31801
31769
|
|
|
31802
31770
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
31803
|
-
import { isAbsolute as isAbsolute5, join as
|
|
31771
|
+
import { isAbsolute as isAbsolute5, join as join81, resolve as resolve23 } from "path";
|
|
31804
31772
|
|
|
31805
31773
|
// src/commands/netcap/defaultCapturePath.ts
|
|
31806
31774
|
import { homedir as homedir25 } from "os";
|
|
31807
|
-
import { join as
|
|
31775
|
+
import { join as join80 } from "path";
|
|
31808
31776
|
function defaultCapturePath() {
|
|
31809
|
-
return
|
|
31777
|
+
return join80(homedir25(), ".assist", "netcap", "capture.jsonl");
|
|
31810
31778
|
}
|
|
31811
31779
|
|
|
31812
31780
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
31813
31781
|
function resolveNetcapOutPath(out) {
|
|
31814
31782
|
if (!out) return defaultCapturePath();
|
|
31815
31783
|
const dir = isAbsolute5(out) ? out : resolve23(process.cwd(), out);
|
|
31816
|
-
return
|
|
31784
|
+
return join81(dir, "capture.jsonl");
|
|
31817
31785
|
}
|
|
31818
31786
|
|
|
31819
31787
|
// src/commands/netcap/netcap.ts
|
|
@@ -31860,11 +31828,11 @@ netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"}
|
|
|
31860
31828
|
|
|
31861
31829
|
// src/commands/netcap/netcapExtract.ts
|
|
31862
31830
|
import { writeFileSync as writeFileSync38 } from "fs";
|
|
31863
|
-
import { join as
|
|
31831
|
+
import { join as join82 } from "path";
|
|
31864
31832
|
import chalk196 from "chalk";
|
|
31865
31833
|
|
|
31866
31834
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
31867
|
-
import { readFileSync as
|
|
31835
|
+
import { readFileSync as readFileSync47 } from "fs";
|
|
31868
31836
|
|
|
31869
31837
|
// src/commands/netcap/parseRscRows.ts
|
|
31870
31838
|
var isRscRef = (v) => typeof v === "string" && /^\$[0-9a-fL@]/.test(v);
|
|
@@ -32260,7 +32228,7 @@ function extractVoyagerPosts(body) {
|
|
|
32260
32228
|
|
|
32261
32229
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
32262
32230
|
function captureEntries(captureFile) {
|
|
32263
|
-
const lines2 =
|
|
32231
|
+
const lines2 = readFileSync47(captureFile, "utf8").split("\n").filter(Boolean);
|
|
32264
32232
|
const entries = [];
|
|
32265
32233
|
for (const line of lines2) {
|
|
32266
32234
|
let entry;
|
|
@@ -32305,7 +32273,7 @@ function extractPostsFromCapture(captureFile) {
|
|
|
32305
32273
|
function netcapExtract(file) {
|
|
32306
32274
|
const captureFile = file ?? defaultCapturePath();
|
|
32307
32275
|
const posts = extractPostsFromCapture(captureFile);
|
|
32308
|
-
const outFile =
|
|
32276
|
+
const outFile = join82(captureFile, "..", "posts.json");
|
|
32309
32277
|
writeFileSync38(outFile, `${JSON.stringify(posts, null, 2)}
|
|
32310
32278
|
`);
|
|
32311
32279
|
console.log(
|
|
@@ -32701,9 +32669,9 @@ async function comment2(path109, line, body, options2 = {}) {
|
|
|
32701
32669
|
|
|
32702
32670
|
// src/commands/prs/commentsCachePath.ts
|
|
32703
32671
|
import { homedir as homedir26 } from "os";
|
|
32704
|
-
import { join as
|
|
32672
|
+
import { join as join83 } from "path";
|
|
32705
32673
|
function commentsCachePath(org, repo, prNumber) {
|
|
32706
|
-
return
|
|
32674
|
+
return join83(
|
|
32707
32675
|
homedir26(),
|
|
32708
32676
|
".assist",
|
|
32709
32677
|
"pr-comments",
|
|
@@ -32719,14 +32687,14 @@ import { dirname as dirname38 } from "path";
|
|
|
32719
32687
|
import { stringify as stringify3 } from "yaml";
|
|
32720
32688
|
|
|
32721
32689
|
// src/commands/prs/loadCommentsCache.ts
|
|
32722
|
-
import { existsSync as existsSync65, readFileSync as
|
|
32690
|
+
import { existsSync as existsSync65, readFileSync as readFileSync48, unlinkSync as unlinkSync15 } from "fs";
|
|
32723
32691
|
import { parse as parse3 } from "yaml";
|
|
32724
32692
|
function loadCommentsCache(org, repo, prNumber) {
|
|
32725
32693
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
32726
32694
|
if (!existsSync65(cachePath)) {
|
|
32727
32695
|
return null;
|
|
32728
32696
|
}
|
|
32729
|
-
const content =
|
|
32697
|
+
const content = readFileSync48(cachePath, "utf8");
|
|
32730
32698
|
return parse3(content);
|
|
32731
32699
|
}
|
|
32732
32700
|
function deleteCommentsCache(org, repo, prNumber) {
|
|
@@ -32738,19 +32706,19 @@ function deleteCommentsCache(org, repo, prNumber) {
|
|
|
32738
32706
|
}
|
|
32739
32707
|
|
|
32740
32708
|
// src/commands/prs/removeStaleCommentsCaches.ts
|
|
32741
|
-
import { readdirSync as
|
|
32742
|
-
import { join as
|
|
32709
|
+
import { readdirSync as readdirSync14, unlinkSync as unlinkSync16 } from "fs";
|
|
32710
|
+
import { join as join84 } from "path";
|
|
32743
32711
|
var STALE_PATTERN = /^pr-\d+-comments\.yaml$/;
|
|
32744
32712
|
function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
32745
|
-
const dir =
|
|
32713
|
+
const dir = join84(cwd, ".assist");
|
|
32746
32714
|
let entries;
|
|
32747
32715
|
try {
|
|
32748
|
-
entries =
|
|
32716
|
+
entries = readdirSync14(dir);
|
|
32749
32717
|
} catch {
|
|
32750
32718
|
return;
|
|
32751
32719
|
}
|
|
32752
32720
|
for (const entry of entries.filter((e) => STALE_PATTERN.test(e))) {
|
|
32753
|
-
unlinkSync16(
|
|
32721
|
+
unlinkSync16(join84(dir, entry));
|
|
32754
32722
|
}
|
|
32755
32723
|
}
|
|
32756
32724
|
|
|
@@ -32868,7 +32836,7 @@ function failAzureDevops(error) {
|
|
|
32868
32836
|
import { execFileSync as execFileSync18 } from "child_process";
|
|
32869
32837
|
import { mkdtempSync as mkdtempSync2, rmSync as rmSync6, writeFileSync as writeFileSync40 } from "fs";
|
|
32870
32838
|
import { tmpdir as tmpdir6 } from "os";
|
|
32871
|
-
import { join as
|
|
32839
|
+
import { join as join85 } from "path";
|
|
32872
32840
|
function azDevopsInvokeArgs(request, inFile) {
|
|
32873
32841
|
return [
|
|
32874
32842
|
"devops",
|
|
@@ -32903,8 +32871,8 @@ function runAz2(args) {
|
|
|
32903
32871
|
}
|
|
32904
32872
|
function invokeAzDevops(request) {
|
|
32905
32873
|
if (request.body === void 0) return runAz2(azDevopsInvokeArgs(request));
|
|
32906
|
-
const dir = mkdtempSync2(
|
|
32907
|
-
const inFile =
|
|
32874
|
+
const dir = mkdtempSync2(join85(tmpdir6(), "assist-az-"));
|
|
32875
|
+
const inFile = join85(dir, "body.json");
|
|
32908
32876
|
try {
|
|
32909
32877
|
writeFileSync40(inFile, JSON.stringify(request.body));
|
|
32910
32878
|
return runAz2(azDevopsInvokeArgs(request, inFile));
|
|
@@ -34690,7 +34658,7 @@ function registerPrsStatus(prsCommand) {
|
|
|
34690
34658
|
}
|
|
34691
34659
|
|
|
34692
34660
|
// src/commands/readTime/readTime.ts
|
|
34693
|
-
import { readFileSync as
|
|
34661
|
+
import { readFileSync as readFileSync49 } from "fs";
|
|
34694
34662
|
|
|
34695
34663
|
// src/commands/readTime/countReadingWords.ts
|
|
34696
34664
|
var FENCE_PATTERN = /^\s*(```|~~~)/;
|
|
@@ -34851,7 +34819,7 @@ async function loadBody(target) {
|
|
|
34851
34819
|
}
|
|
34852
34820
|
function readDraftFile(path109) {
|
|
34853
34821
|
try {
|
|
34854
|
-
return
|
|
34822
|
+
return readFileSync49(path109, "utf8");
|
|
34855
34823
|
} catch {
|
|
34856
34824
|
console.error(`Error: Could not read \`${path109}\`.`);
|
|
34857
34825
|
console.error(
|
|
@@ -35358,10 +35326,10 @@ function checkStreamGraph(streams) {
|
|
|
35358
35326
|
}
|
|
35359
35327
|
|
|
35360
35328
|
// src/commands/releases/readStreamsInput.ts
|
|
35361
|
-
import { readFileSync as
|
|
35329
|
+
import { readFileSync as readFileSync50 } from "fs";
|
|
35362
35330
|
import { parse as parse4 } from "yaml";
|
|
35363
35331
|
function readSource2(source) {
|
|
35364
|
-
return
|
|
35332
|
+
return readFileSync50(source === "-" ? 0 : source, "utf8");
|
|
35365
35333
|
}
|
|
35366
35334
|
function readStreamsInput(source) {
|
|
35367
35335
|
let parsed;
|
|
@@ -36034,7 +36002,7 @@ async function notify() {
|
|
|
36034
36002
|
import { execSync as execSync50 } from "child_process";
|
|
36035
36003
|
import { existsSync as existsSync66, mkdirSync as mkdirSync26, unlinkSync as unlinkSync17, writeFileSync as writeFileSync41 } from "fs";
|
|
36036
36004
|
import { tmpdir as tmpdir7 } from "os";
|
|
36037
|
-
import { join as
|
|
36005
|
+
import { join as join86, resolve as resolve25 } from "path";
|
|
36038
36006
|
import chalk223 from "chalk";
|
|
36039
36007
|
|
|
36040
36008
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
@@ -36171,7 +36139,7 @@ function buildOutputPath(outputDir, processName) {
|
|
|
36171
36139
|
return resolve25(outputDir, `${processName}-${timestamp8}.png`);
|
|
36172
36140
|
}
|
|
36173
36141
|
function runPowerShellScript(processName, outputPath) {
|
|
36174
|
-
const scriptPath =
|
|
36142
|
+
const scriptPath = join86(tmpdir7(), `assist-screenshot-${Date.now()}.ps1`);
|
|
36175
36143
|
writeFileSync41(scriptPath, captureWindowPs1, "utf8");
|
|
36176
36144
|
try {
|
|
36177
36145
|
execSync50(
|
|
@@ -36272,10 +36240,10 @@ function buildLimitsSegment(rateLimits) {
|
|
|
36272
36240
|
}
|
|
36273
36241
|
|
|
36274
36242
|
// src/commands/readGitBranch.ts
|
|
36275
|
-
import { readFileSync as
|
|
36276
|
-
import { isAbsolute as isAbsolute6, join as
|
|
36243
|
+
import { readFileSync as readFileSync51, statSync as statSync10 } from "fs";
|
|
36244
|
+
import { isAbsolute as isAbsolute6, join as join87, resolve as resolve26 } from "path";
|
|
36277
36245
|
function resolveGitDir(cwd) {
|
|
36278
|
-
const dotGit =
|
|
36246
|
+
const dotGit = join87(cwd, ".git");
|
|
36279
36247
|
let stat5;
|
|
36280
36248
|
try {
|
|
36281
36249
|
stat5 = statSync10(dotGit);
|
|
@@ -36287,7 +36255,7 @@ function resolveGitDir(cwd) {
|
|
|
36287
36255
|
}
|
|
36288
36256
|
let contents;
|
|
36289
36257
|
try {
|
|
36290
|
-
contents =
|
|
36258
|
+
contents = readFileSync51(dotGit, "utf8");
|
|
36291
36259
|
} catch {
|
|
36292
36260
|
return null;
|
|
36293
36261
|
}
|
|
@@ -36305,7 +36273,7 @@ function readGitBranch(cwd) {
|
|
|
36305
36273
|
}
|
|
36306
36274
|
let head;
|
|
36307
36275
|
try {
|
|
36308
|
-
head =
|
|
36276
|
+
head = readFileSync51(join87(gitDir, "HEAD"), "utf8");
|
|
36309
36277
|
} catch {
|
|
36310
36278
|
return null;
|
|
36311
36279
|
}
|
|
@@ -39652,12 +39620,12 @@ function fetchHighLevelPr(prNumber, repo) {
|
|
|
39652
39620
|
}
|
|
39653
39621
|
|
|
39654
39622
|
// src/commands/review/highLevel/highLevelReviewPath.ts
|
|
39655
|
-
import { join as
|
|
39623
|
+
import { join as join88 } from "path";
|
|
39656
39624
|
function slug(value) {
|
|
39657
39625
|
return value.replace(/[^\w.-]+/g, "-");
|
|
39658
39626
|
}
|
|
39659
39627
|
function highLevelReviewPath(repo, headRef, headSha) {
|
|
39660
|
-
return
|
|
39628
|
+
return join88(
|
|
39661
39629
|
getStoreDir(),
|
|
39662
39630
|
"high-level-reviews",
|
|
39663
39631
|
slug(repo),
|
|
@@ -39674,11 +39642,11 @@ function highLevelDraftPath(repo, headRef, headSha) {
|
|
|
39674
39642
|
}
|
|
39675
39643
|
|
|
39676
39644
|
// src/commands/review/highLevel/readJsonFile.ts
|
|
39677
|
-
import { existsSync as existsSync67, readFileSync as
|
|
39645
|
+
import { existsSync as existsSync67, readFileSync as readFileSync52 } from "fs";
|
|
39678
39646
|
function readJsonFile(path109) {
|
|
39679
39647
|
if (!existsSync67(path109)) return void 0;
|
|
39680
39648
|
try {
|
|
39681
|
-
return JSON.parse(
|
|
39649
|
+
return JSON.parse(readFileSync52(path109, "utf8"));
|
|
39682
39650
|
} catch {
|
|
39683
39651
|
return void 0;
|
|
39684
39652
|
}
|
|
@@ -40321,7 +40289,7 @@ async function runHighLevelReview(number, options2 = {}) {
|
|
|
40321
40289
|
}
|
|
40322
40290
|
|
|
40323
40291
|
// src/commands/review/ci/writeJobSummary.ts
|
|
40324
|
-
import { appendFileSync as appendFileSync3, readFileSync as
|
|
40292
|
+
import { appendFileSync as appendFileSync3, readFileSync as readFileSync53 } from "fs";
|
|
40325
40293
|
|
|
40326
40294
|
// src/commands/review/carriedUnanchoredFindings.ts
|
|
40327
40295
|
function carriedUnanchoredFindings(unanchored) {
|
|
@@ -40703,7 +40671,7 @@ function buildTokenUsageTable(usages) {
|
|
|
40703
40671
|
// src/commands/review/ci/writeJobSummary.ts
|
|
40704
40672
|
function writeJobSummary(synthesisPath, prInfo, summaryPath, slots) {
|
|
40705
40673
|
if (!summaryPath) return;
|
|
40706
|
-
const markdown =
|
|
40674
|
+
const markdown = readFileSync53(synthesisPath, "utf8");
|
|
40707
40675
|
const { unanchored } = selectPostableFindings(markdown, prInfo);
|
|
40708
40676
|
const usageTable = buildTokenUsageTable(slots.map((slot) => slot.usage));
|
|
40709
40677
|
appendFileSync3(
|
|
@@ -40822,7 +40790,7 @@ import { format as format2 } from "util";
|
|
|
40822
40790
|
|
|
40823
40791
|
// src/commands/review/createReviewLogSink.ts
|
|
40824
40792
|
import { appendFileSync as appendFileSync4, mkdirSync as mkdirSync28 } from "fs";
|
|
40825
|
-
import { join as
|
|
40793
|
+
import { join as join89 } from "path";
|
|
40826
40794
|
var LOG_FILE = "review.log";
|
|
40827
40795
|
function createReviewLogSink() {
|
|
40828
40796
|
let logPath2;
|
|
@@ -40839,7 +40807,7 @@ function createReviewLogSink() {
|
|
|
40839
40807
|
},
|
|
40840
40808
|
attach(reviewDir) {
|
|
40841
40809
|
mkdirSync28(reviewDir, { recursive: true });
|
|
40842
|
-
logPath2 =
|
|
40810
|
+
logPath2 = join89(reviewDir, LOG_FILE);
|
|
40843
40811
|
const lines2 = [
|
|
40844
40812
|
"",
|
|
40845
40813
|
`=== ${(/* @__PURE__ */ new Date()).toISOString()} ===`,
|
|
@@ -41666,7 +41634,7 @@ async function runReviewers(reviewDir, claudePath, codexPath, stdinPrompt, optio
|
|
|
41666
41634
|
import { existsSync as existsSync69, unlinkSync as unlinkSync19 } from "fs";
|
|
41667
41635
|
|
|
41668
41636
|
// src/commands/review/synthesise.ts
|
|
41669
|
-
import { readFileSync as
|
|
41637
|
+
import { readFileSync as readFileSync54 } from "fs";
|
|
41670
41638
|
|
|
41671
41639
|
// src/commands/review/buildSynthesisStdin.ts
|
|
41672
41640
|
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.
|
|
@@ -41735,7 +41703,7 @@ Files:
|
|
|
41735
41703
|
|
|
41736
41704
|
// src/commands/review/synthesise.ts
|
|
41737
41705
|
function printSummary2(synthesisPath) {
|
|
41738
|
-
const markdown =
|
|
41706
|
+
const markdown = readFileSync54(synthesisPath, "utf8");
|
|
41739
41707
|
console.log("");
|
|
41740
41708
|
console.log(buildReviewSummary(markdown));
|
|
41741
41709
|
console.log("");
|
|
@@ -41999,9 +41967,9 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
|
|
|
41999
41967
|
|
|
42000
41968
|
// src/commands/review/buildReviewPaths.ts
|
|
42001
41969
|
import { homedir as homedir27 } from "os";
|
|
42002
|
-
import { basename as basename25, join as
|
|
41970
|
+
import { basename as basename25, join as join90 } from "path";
|
|
42003
41971
|
function buildReviewPaths(repoRoot2, key) {
|
|
42004
|
-
const reviewDir =
|
|
41972
|
+
const reviewDir = join90(
|
|
42005
41973
|
homedir27(),
|
|
42006
41974
|
".assist",
|
|
42007
41975
|
"reviews",
|
|
@@ -42010,10 +41978,10 @@ function buildReviewPaths(repoRoot2, key) {
|
|
|
42010
41978
|
);
|
|
42011
41979
|
return {
|
|
42012
41980
|
reviewDir,
|
|
42013
|
-
requestPath:
|
|
42014
|
-
claudePath:
|
|
42015
|
-
codexPath:
|
|
42016
|
-
synthesisPath:
|
|
41981
|
+
requestPath: join90(reviewDir, "request.md"),
|
|
41982
|
+
claudePath: join90(reviewDir, "claude.md"),
|
|
41983
|
+
codexPath: join90(reviewDir, "codex.md"),
|
|
41984
|
+
synthesisPath: join90(reviewDir, "synthesis.md")
|
|
42017
41985
|
};
|
|
42018
41986
|
}
|
|
42019
41987
|
|
|
@@ -42177,7 +42145,7 @@ function gatherChangedContext() {
|
|
|
42177
42145
|
}
|
|
42178
42146
|
|
|
42179
42147
|
// src/commands/review/postReviewToPr.ts
|
|
42180
|
-
import { readFileSync as
|
|
42148
|
+
import { readFileSync as readFileSync55 } from "fs";
|
|
42181
42149
|
|
|
42182
42150
|
// src/commands/review/chainAddressComments.ts
|
|
42183
42151
|
function chainAddressComments(prNumber, announce) {
|
|
@@ -42359,7 +42327,7 @@ async function confirmPost(prNumber, work, options2) {
|
|
|
42359
42327
|
return promptConfirm(`Post ${work} to PR #${prNumber}?`, false);
|
|
42360
42328
|
}
|
|
42361
42329
|
async function postFindingsToPr(prInfo, synthesisPath, options2) {
|
|
42362
|
-
const markdown =
|
|
42330
|
+
const markdown = readFileSync55(synthesisPath, "utf8");
|
|
42363
42331
|
const { inDiff, unanchored } = selectPostableFindings(markdown, prInfo);
|
|
42364
42332
|
const carried = carriedUnanchoredFindings(unanchored);
|
|
42365
42333
|
if (inDiff.length === 0 && carried.length === 0)
|
|
@@ -42712,20 +42680,20 @@ import path87 from "path";
|
|
|
42712
42680
|
import chalk258 from "chalk";
|
|
42713
42681
|
|
|
42714
42682
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
42715
|
-
import { existsSync as existsSync71, readFileSync as
|
|
42683
|
+
import { existsSync as existsSync71, readFileSync as readFileSync57, writeFileSync as writeFileSync45 } from "fs";
|
|
42716
42684
|
import path86 from "path";
|
|
42717
42685
|
|
|
42718
42686
|
// src/commands/rules/scopedRuleDirectories.ts
|
|
42719
|
-
import { readFileSync as
|
|
42687
|
+
import { readFileSync as readFileSync56 } from "fs";
|
|
42720
42688
|
import path85 from "path";
|
|
42721
42689
|
|
|
42722
42690
|
// src/commands/rules/findClaudeFiles.ts
|
|
42723
|
-
import { readdirSync as
|
|
42691
|
+
import { readdirSync as readdirSync15 } from "fs";
|
|
42724
42692
|
import path84 from "path";
|
|
42725
42693
|
var SKIP_DIRECTORIES = /* @__PURE__ */ new Set(["node_modules", "dist", "build", "coverage"]);
|
|
42726
42694
|
function findClaudeFiles(dir) {
|
|
42727
42695
|
const results = [];
|
|
42728
|
-
for (const entry of
|
|
42696
|
+
for (const entry of readdirSync15(dir, { withFileTypes: true })) {
|
|
42729
42697
|
if (entry.isDirectory()) {
|
|
42730
42698
|
if (entry.name.startsWith(".") || SKIP_DIRECTORIES.has(entry.name))
|
|
42731
42699
|
continue;
|
|
@@ -42740,7 +42708,7 @@ function findClaudeFiles(dir) {
|
|
|
42740
42708
|
// src/commands/rules/scopedRuleDirectories.ts
|
|
42741
42709
|
function scopedRuleDirectories(root2) {
|
|
42742
42710
|
return findClaudeFiles(root2).filter(
|
|
42743
|
-
(file) => path85.dirname(file) !== root2 && parseRulesSection(
|
|
42711
|
+
(file) => path85.dirname(file) !== root2 && parseRulesSection(readFileSync56(file, "utf8")).length > 0
|
|
42744
42712
|
).map(
|
|
42745
42713
|
(file) => `${path85.relative(root2, path85.dirname(file)).split(path85.sep).join("/")}/`
|
|
42746
42714
|
).sort();
|
|
@@ -42782,7 +42750,7 @@ function upsertScopedRulesPointer(content, directories) {
|
|
|
42782
42750
|
function updateScopedRulesIndex(root2) {
|
|
42783
42751
|
const directories = scopedRuleDirectories(root2);
|
|
42784
42752
|
const rootFile = path86.join(root2, "CLAUDE.md");
|
|
42785
|
-
const before = existsSync71(rootFile) ?
|
|
42753
|
+
const before = existsSync71(rootFile) ? readFileSync57(rootFile, "utf8") : "";
|
|
42786
42754
|
const after = upsertScopedRulesPointer(before, directories);
|
|
42787
42755
|
if (after !== before) writeFileSync45(rootFile, after);
|
|
42788
42756
|
return directories;
|
|
@@ -42835,7 +42803,7 @@ function listRules(target, options2 = {}) {
|
|
|
42835
42803
|
}
|
|
42836
42804
|
|
|
42837
42805
|
// src/commands/rules/addRule.ts
|
|
42838
|
-
import { existsSync as existsSync73, readFileSync as
|
|
42806
|
+
import { existsSync as existsSync73, readFileSync as readFileSync59, writeFileSync as writeFileSync46 } from "fs";
|
|
42839
42807
|
import path90 from "path";
|
|
42840
42808
|
import chalk260 from "chalk";
|
|
42841
42809
|
|
|
@@ -42860,11 +42828,11 @@ function insertRuleBullet(content, rule) {
|
|
|
42860
42828
|
}
|
|
42861
42829
|
|
|
42862
42830
|
// src/commands/rules/nextRuleCode.ts
|
|
42863
|
-
import { readFileSync as
|
|
42831
|
+
import { readFileSync as readFileSync58 } from "fs";
|
|
42864
42832
|
var CODE_PREFIX = "R";
|
|
42865
42833
|
function nextRuleCode(root2) {
|
|
42866
42834
|
const numbers = findClaudeFiles(root2).flatMap(
|
|
42867
|
-
(file) => parseRulesSection(
|
|
42835
|
+
(file) => parseRulesSection(readFileSync58(file, "utf8")).map(
|
|
42868
42836
|
(rule) => Number(/(\d+)\s*$/.exec(rule.code)?.[1] ?? 0)
|
|
42869
42837
|
)
|
|
42870
42838
|
);
|
|
@@ -42891,7 +42859,7 @@ function resolveRuleScope(target) {
|
|
|
42891
42859
|
|
|
42892
42860
|
// src/commands/rules/addRule.ts
|
|
42893
42861
|
function read2(file) {
|
|
42894
|
-
return existsSync73(file) ?
|
|
42862
|
+
return existsSync73(file) ? readFileSync59(file, "utf8") : "";
|
|
42895
42863
|
}
|
|
42896
42864
|
function addRule(text18, options2) {
|
|
42897
42865
|
const rule = text18.trim();
|
|
@@ -43454,12 +43422,12 @@ import { mkdirSync as mkdirSync31, writeFileSync as writeFileSync48 } from "fs";
|
|
|
43454
43422
|
import { mkdirSync as mkdirSync30, writeFileSync as writeFileSync47 } from "fs";
|
|
43455
43423
|
|
|
43456
43424
|
// src/commands/slack/readSlackParts.ts
|
|
43457
|
-
import { readFileSync as
|
|
43425
|
+
import { readFileSync as readFileSync60 } from "fs";
|
|
43458
43426
|
function readSlackParts(files) {
|
|
43459
43427
|
return files.map((file) => {
|
|
43460
43428
|
let contents;
|
|
43461
43429
|
try {
|
|
43462
|
-
contents =
|
|
43430
|
+
contents = readFileSync60(file, "utf8");
|
|
43463
43431
|
} catch {
|
|
43464
43432
|
console.error(`Error: Part file not found: ${file}`);
|
|
43465
43433
|
process.exit(1);
|
|
@@ -43497,12 +43465,12 @@ async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
|
43497
43465
|
}
|
|
43498
43466
|
|
|
43499
43467
|
// src/commands/slack/slackWorkingFile.ts
|
|
43500
|
-
import { join as
|
|
43468
|
+
import { join as join91 } from "path";
|
|
43501
43469
|
function slackWorkingFile(channel, partIndex) {
|
|
43502
43470
|
const slug2 = channel.replace(/^[#@]/, "").toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "channel";
|
|
43503
|
-
const dir =
|
|
43471
|
+
const dir = join91(getStoreDir(), "slack");
|
|
43504
43472
|
const name = partIndex === void 0 ? slug2 : `${slug2}-${partIndex}`;
|
|
43505
|
-
return { dir, bodyPath:
|
|
43473
|
+
return { dir, bodyPath: join91(dir, `${name}.md`) };
|
|
43506
43474
|
}
|
|
43507
43475
|
|
|
43508
43476
|
// src/commands/slack/previewSlackThreadParts.ts
|
|
@@ -44573,9 +44541,9 @@ function formatVttPassages(passages, notes = [], { sourceMarks = true } = {}) {
|
|
|
44573
44541
|
}
|
|
44574
44542
|
|
|
44575
44543
|
// src/commands/transcript/convert/readCleanedCues.ts
|
|
44576
|
-
import { readFileSync as
|
|
44544
|
+
import { readFileSync as readFileSync65 } from "fs";
|
|
44577
44545
|
function readCleanedCues(inputPath) {
|
|
44578
|
-
return deduplicateCues(parseVtt(
|
|
44546
|
+
return deduplicateCues(parseVtt(readFileSync65(inputPath, "utf8")));
|
|
44579
44547
|
}
|
|
44580
44548
|
|
|
44581
44549
|
// src/commands/transcript/clean.ts
|
|
@@ -44684,21 +44652,21 @@ async function configure() {
|
|
|
44684
44652
|
}
|
|
44685
44653
|
|
|
44686
44654
|
// src/commands/transcript/list.ts
|
|
44687
|
-
import { existsSync as existsSync79, readdirSync as
|
|
44688
|
-
import { join as
|
|
44655
|
+
import { existsSync as existsSync79, readdirSync as readdirSync22, statSync as statSync12 } from "fs";
|
|
44656
|
+
import { join as join103 } from "path";
|
|
44689
44657
|
function list5() {
|
|
44690
44658
|
const { vttDir } = getTranscriptConfig();
|
|
44691
44659
|
if (!existsSync79(vttDir)) return;
|
|
44692
|
-
for (const entry of
|
|
44660
|
+
for (const entry of readdirSync22(vttDir)) {
|
|
44693
44661
|
if (!entry.endsWith(".vtt")) continue;
|
|
44694
|
-
if (statSync12(
|
|
44662
|
+
if (statSync12(join103(vttDir, entry)).isDirectory()) continue;
|
|
44695
44663
|
console.log(entry);
|
|
44696
44664
|
}
|
|
44697
44665
|
}
|
|
44698
44666
|
|
|
44699
44667
|
// src/commands/transcript/move.ts
|
|
44700
44668
|
import { existsSync as existsSync80, mkdirSync as mkdirSync37, renameSync as renameSync5, writeFileSync as writeFileSync53 } from "fs";
|
|
44701
|
-
import { basename as basename28, join as
|
|
44669
|
+
import { basename as basename28, join as join104 } from "path";
|
|
44702
44670
|
|
|
44703
44671
|
// src/commands/transcript/convertVttToMarkdown.ts
|
|
44704
44672
|
function convertVttToMarkdown(inputPath) {
|
|
@@ -44708,9 +44676,9 @@ function convertVttToMarkdown(inputPath) {
|
|
|
44708
44676
|
// src/commands/transcript/move.ts
|
|
44709
44677
|
var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
44710
44678
|
function archiveRawVtt(vttDir, sourcePath, filename) {
|
|
44711
|
-
const processedDir =
|
|
44679
|
+
const processedDir = join104(vttDir, "processed");
|
|
44712
44680
|
mkdirSync37(processedDir, { recursive: true });
|
|
44713
|
-
renameSync5(sourcePath,
|
|
44681
|
+
renameSync5(sourcePath, join104(processedDir, filename));
|
|
44714
44682
|
}
|
|
44715
44683
|
function move(file, options2) {
|
|
44716
44684
|
const { date, client } = options2;
|
|
@@ -44720,19 +44688,19 @@ function move(file, options2) {
|
|
|
44720
44688
|
}
|
|
44721
44689
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
44722
44690
|
const filename = basename28(file);
|
|
44723
|
-
const sourcePath =
|
|
44691
|
+
const sourcePath = join104(vttDir, filename);
|
|
44724
44692
|
if (!existsSync80(sourcePath)) {
|
|
44725
44693
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
44726
44694
|
process.exit(1);
|
|
44727
44695
|
}
|
|
44728
44696
|
const base = basename28(filename, ".vtt").replace(/ Transcription$/, "");
|
|
44729
44697
|
const outputName = `${date} ${base}.md`;
|
|
44730
|
-
const formattedDir =
|
|
44698
|
+
const formattedDir = join104(transcriptsDir, client);
|
|
44731
44699
|
mkdirSync37(formattedDir, { recursive: true });
|
|
44732
|
-
const formattedPath =
|
|
44700
|
+
const formattedPath = join104(formattedDir, outputName);
|
|
44733
44701
|
writeFileSync53(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
|
|
44734
44702
|
archiveRawVtt(vttDir, sourcePath, filename);
|
|
44735
|
-
const summaryPath =
|
|
44703
|
+
const summaryPath = join104(summaryDir, client, outputName);
|
|
44736
44704
|
console.log(`Formatted transcript: ${formattedPath}`);
|
|
44737
44705
|
console.log(`Summary target: ${summaryPath}`);
|
|
44738
44706
|
}
|
|
@@ -45355,7 +45323,7 @@ function configKeys2() {
|
|
|
45355
45323
|
}
|
|
45356
45324
|
|
|
45357
45325
|
// src/commands/verify/forbiddenStrings.ts
|
|
45358
|
-
import { existsSync as existsSync82, readFileSync as
|
|
45326
|
+
import { existsSync as existsSync82, readFileSync as readFileSync66 } from "fs";
|
|
45359
45327
|
|
|
45360
45328
|
// src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
|
|
45361
45329
|
import { minimatch as minimatch10 } from "minimatch";
|
|
@@ -45402,7 +45370,7 @@ function forbiddenStrings() {
|
|
|
45402
45370
|
}
|
|
45403
45371
|
let parsed;
|
|
45404
45372
|
try {
|
|
45405
|
-
parsed = JSON.parse(
|
|
45373
|
+
parsed = JSON.parse(readFileSync66(file, "utf8"));
|
|
45406
45374
|
} catch (error) {
|
|
45407
45375
|
console.log(`Could not parse ${file}: ${error.message}`);
|
|
45408
45376
|
process.exit(1);
|
|
@@ -45474,7 +45442,7 @@ Total: ${lines2.length} hardcoded color(s)`);
|
|
|
45474
45442
|
}
|
|
45475
45443
|
|
|
45476
45444
|
// src/commands/verify/migrations.ts
|
|
45477
|
-
import { readFileSync as
|
|
45445
|
+
import { readFileSync as readFileSync67 } from "fs";
|
|
45478
45446
|
import path104 from "path";
|
|
45479
45447
|
|
|
45480
45448
|
// src/commands/verify/migrations/checkAppendOnly.ts
|
|
@@ -45546,10 +45514,10 @@ function checkSequential(migrations3, files) {
|
|
|
45546
45514
|
}
|
|
45547
45515
|
|
|
45548
45516
|
// src/commands/verify/migrations/listMigrationFiles.ts
|
|
45549
|
-
import { readdirSync as
|
|
45517
|
+
import { readdirSync as readdirSync23 } from "fs";
|
|
45550
45518
|
var MIGRATION_FILE2 = /^migration\d+[A-Za-z0-9]*\.ts$/;
|
|
45551
45519
|
function listMigrationFiles(dir) {
|
|
45552
|
-
return
|
|
45520
|
+
return readdirSync23(dir).filter((file) => MIGRATION_FILE2.test(file));
|
|
45553
45521
|
}
|
|
45554
45522
|
|
|
45555
45523
|
// src/commands/verify/migrations/readBaselineMigrations.ts
|
|
@@ -45639,7 +45607,7 @@ function migrations2() {
|
|
|
45639
45607
|
if (ref) {
|
|
45640
45608
|
const baseline = readBaselineMigrations(REPO_RELATIVE_DIR, ref);
|
|
45641
45609
|
const current = new Map(
|
|
45642
|
-
files.map((file) => [file,
|
|
45610
|
+
files.map((file) => [file, readFileSync67(path104.join(dir, file), "utf8")])
|
|
45643
45611
|
);
|
|
45644
45612
|
for (const finding of checkAppendOnly(baseline, current)) {
|
|
45645
45613
|
problems.push(
|
|
@@ -46511,17 +46479,17 @@ function registerWatch(program) {
|
|
|
46511
46479
|
|
|
46512
46480
|
// src/commands/roam/postRoamActivity.ts
|
|
46513
46481
|
import { execFileSync as execFileSync30 } from "child_process";
|
|
46514
|
-
import { readdirSync as
|
|
46515
|
-
import { join as
|
|
46482
|
+
import { readdirSync as readdirSync24, readFileSync as readFileSync68, statSync as statSync13 } from "fs";
|
|
46483
|
+
import { join as join105 } from "path";
|
|
46516
46484
|
function findPortFile(roamDir) {
|
|
46517
46485
|
let entries;
|
|
46518
46486
|
try {
|
|
46519
|
-
entries =
|
|
46487
|
+
entries = readdirSync24(roamDir);
|
|
46520
46488
|
} catch {
|
|
46521
46489
|
return void 0;
|
|
46522
46490
|
}
|
|
46523
46491
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
46524
|
-
const path109 =
|
|
46492
|
+
const path109 = join105(roamDir, name);
|
|
46525
46493
|
try {
|
|
46526
46494
|
return { path: path109, mtimeMs: statSync13(path109).mtimeMs };
|
|
46527
46495
|
} catch {
|
|
@@ -46538,11 +46506,11 @@ var PID_BY_APP = {
|
|
|
46538
46506
|
function postRoamActivity(app, event) {
|
|
46539
46507
|
const appData = process.env.APPDATA;
|
|
46540
46508
|
if (!appData) return;
|
|
46541
|
-
const portFile = findPortFile(
|
|
46509
|
+
const portFile = findPortFile(join105(appData, "Roam"));
|
|
46542
46510
|
if (!portFile) return;
|
|
46543
46511
|
let port;
|
|
46544
46512
|
try {
|
|
46545
|
-
port =
|
|
46513
|
+
port = readFileSync68(portFile, "utf8").trim();
|
|
46546
46514
|
} catch {
|
|
46547
46515
|
return;
|
|
46548
46516
|
}
|
|
@@ -46881,11 +46849,11 @@ function requireParsedArgs() {
|
|
|
46881
46849
|
}
|
|
46882
46850
|
|
|
46883
46851
|
// src/commands/run/runCommandFilePath.ts
|
|
46884
|
-
import { join as
|
|
46852
|
+
import { join as join106 } from "path";
|
|
46885
46853
|
function runCommandFilePath(name) {
|
|
46886
46854
|
const segments = name.split(":");
|
|
46887
46855
|
const file = `${segments.pop()}.md`;
|
|
46888
|
-
return
|
|
46856
|
+
return join106(".claude", "commands", ...segments, file);
|
|
46889
46857
|
}
|
|
46890
46858
|
|
|
46891
46859
|
// src/commands/run/add.ts
|
|
@@ -47013,8 +46981,8 @@ function registerRunAdd(runCommand) {
|
|
|
47013
46981
|
}
|
|
47014
46982
|
|
|
47015
46983
|
// src/commands/run/remove.ts
|
|
47016
|
-
import { existsSync as existsSync85, readdirSync as
|
|
47017
|
-
import { dirname as dirname46, join as
|
|
46984
|
+
import { existsSync as existsSync85, readdirSync as readdirSync25, rmdirSync, unlinkSync as unlinkSync21 } from "fs";
|
|
46985
|
+
import { dirname as dirname46, join as join107 } from "path";
|
|
47018
46986
|
|
|
47019
46987
|
// src/commands/run/removeRepoRunConfig.ts
|
|
47020
46988
|
function isNamed(entry, name) {
|
|
@@ -47032,15 +47000,15 @@ function removeRepoRunConfig(name, repoName, cwd = process.cwd()) {
|
|
|
47032
47000
|
|
|
47033
47001
|
// src/commands/run/remove.ts
|
|
47034
47002
|
function removeEmptyNamespaceDirs(filePath) {
|
|
47035
|
-
const root2 =
|
|
47003
|
+
const root2 = join107(".claude", "commands");
|
|
47036
47004
|
for (let dir = dirname46(filePath); dir !== root2; dir = dirname46(dir)) {
|
|
47037
|
-
if (!existsSync85(dir) ||
|
|
47005
|
+
if (!existsSync85(dir) || readdirSync25(dir).length > 0) return;
|
|
47038
47006
|
rmdirSync(dir);
|
|
47039
47007
|
}
|
|
47040
47008
|
}
|
|
47041
47009
|
function deleteCommandFile(name) {
|
|
47042
47010
|
const filePath = runCommandFilePath(name);
|
|
47043
|
-
const legacyPath =
|
|
47011
|
+
const legacyPath = join107(".claude", "commands", `${name}.md`);
|
|
47044
47012
|
for (const path109 of /* @__PURE__ */ new Set([filePath, legacyPath])) {
|
|
47045
47013
|
if (existsSync85(path109)) {
|
|
47046
47014
|
unlinkSync21(path109);
|
|
@@ -47163,11 +47131,11 @@ function applyLine(result, pending, line) {
|
|
|
47163
47131
|
}
|
|
47164
47132
|
|
|
47165
47133
|
// src/commands/sessions/daemon/readDaemonPidFile.ts
|
|
47166
|
-
import { readFileSync as
|
|
47134
|
+
import { readFileSync as readFileSync69 } from "fs";
|
|
47167
47135
|
function readDaemonPidFile() {
|
|
47168
47136
|
try {
|
|
47169
47137
|
const pid = Number.parseInt(
|
|
47170
|
-
|
|
47138
|
+
readFileSync69(daemonPaths.pid, "utf8").trim(),
|
|
47171
47139
|
10
|
|
47172
47140
|
);
|
|
47173
47141
|
return Number.isInteger(pid) ? pid : void 0;
|
|
@@ -47832,7 +47800,7 @@ function broadcastSessions(sessions, clients, linkedSessions = [], active) {
|
|
|
47832
47800
|
|
|
47833
47801
|
// src/commands/sessions/daemon/findServerParents.ts
|
|
47834
47802
|
import { existsSync as existsSync87 } from "fs";
|
|
47835
|
-
import { join as
|
|
47803
|
+
import { join as join108, resolve as resolve30 } from "path";
|
|
47836
47804
|
function isLive(session) {
|
|
47837
47805
|
return !!session.pty && session.status !== "done" && session.status !== "error";
|
|
47838
47806
|
}
|
|
@@ -47841,7 +47809,7 @@ function isLiveAgent(session) {
|
|
|
47841
47809
|
}
|
|
47842
47810
|
function serverRunDirs(sessions, file) {
|
|
47843
47811
|
return new Set(
|
|
47844
|
-
sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve30(s.cwd)).filter((dir) => existsSync87(
|
|
47812
|
+
sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve30(s.cwd)).filter((dir) => existsSync87(join108(dir, file)))
|
|
47845
47813
|
);
|
|
47846
47814
|
}
|
|
47847
47815
|
function findServerParents(sessions, file) {
|
|
@@ -48059,7 +48027,7 @@ function sendResizeSnapshot(s, send) {
|
|
|
48059
48027
|
}
|
|
48060
48028
|
|
|
48061
48029
|
// src/commands/sessions/daemon/viewerSize.ts
|
|
48062
|
-
import { readFileSync as
|
|
48030
|
+
import { readFileSync as readFileSync70, writeFileSync as writeFileSync57 } from "fs";
|
|
48063
48031
|
var DEFAULT_SIZE = { cols: 120, rows: 30 };
|
|
48064
48032
|
var remembered;
|
|
48065
48033
|
function rememberViewerSize(cols, rows) {
|
|
@@ -48081,7 +48049,7 @@ function viewerSize() {
|
|
|
48081
48049
|
function readSavedSize() {
|
|
48082
48050
|
try {
|
|
48083
48051
|
const { cols, rows } = JSON.parse(
|
|
48084
|
-
|
|
48052
|
+
readFileSync70(daemonPaths.viewerSize, "utf8")
|
|
48085
48053
|
);
|
|
48086
48054
|
if (typeof cols === "number" && typeof rows === "number" && cols > 0)
|
|
48087
48055
|
return { cols, rows };
|
|
@@ -48969,14 +48937,14 @@ async function runAutoUpdateLoop(deps2, maxLaps = Number.POSITIVE_INFINITY) {
|
|
|
48969
48937
|
}
|
|
48970
48938
|
|
|
48971
48939
|
// src/commands/sessions/daemon/autoUpdate/trimWatcherLog.ts
|
|
48972
|
-
import { readFileSync as
|
|
48940
|
+
import { readFileSync as readFileSync72, writeFileSync as writeFileSync59 } from "fs";
|
|
48973
48941
|
var KEEP_TAIL = 256 * 1024;
|
|
48974
48942
|
var MAX_LOG_SIZE = 4 * 1024 * 1024;
|
|
48975
48943
|
function trimWatcherLog(cwd) {
|
|
48976
48944
|
const path109 = watcherLogPath(cwd);
|
|
48977
48945
|
let log2;
|
|
48978
48946
|
try {
|
|
48979
|
-
log2 =
|
|
48947
|
+
log2 = readFileSync72(path109, "utf8");
|
|
48980
48948
|
} catch {
|
|
48981
48949
|
return;
|
|
48982
48950
|
}
|
|
@@ -49366,12 +49334,12 @@ import { basename as basename31 } from "path";
|
|
|
49366
49334
|
|
|
49367
49335
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
49368
49336
|
import { existsSync as existsSync93 } from "fs";
|
|
49369
|
-
import { join as
|
|
49337
|
+
import { join as join112 } from "path";
|
|
49370
49338
|
|
|
49371
49339
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
49372
49340
|
import { statSync as statSync15 } from "fs";
|
|
49373
49341
|
import { rm as rm3 } from "fs/promises";
|
|
49374
|
-
import { join as
|
|
49342
|
+
import { join as join111 } from "path";
|
|
49375
49343
|
async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
49376
49344
|
if (holdsAGitDirectoryRatherThanALink(worktreePath)) {
|
|
49377
49345
|
const refusal = "it is a clone of its own, not a linked worktree";
|
|
@@ -49399,7 +49367,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
|
49399
49367
|
return { removed: true };
|
|
49400
49368
|
}
|
|
49401
49369
|
function holdsAGitDirectoryRatherThanALink(worktreePath) {
|
|
49402
|
-
return statSync15(
|
|
49370
|
+
return statSync15(join111(worktreePath, ".git"), {
|
|
49403
49371
|
throwIfNoEntry: false
|
|
49404
49372
|
})?.isDirectory() === true;
|
|
49405
49373
|
}
|
|
@@ -49435,7 +49403,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
49435
49403
|
);
|
|
49436
49404
|
}
|
|
49437
49405
|
function strandedReason(worktreePath, cause) {
|
|
49438
|
-
if (!existsSync93(
|
|
49406
|
+
if (!existsSync93(join112(worktreePath, ".git")))
|
|
49439
49407
|
return "its .git link is already gone";
|
|
49440
49408
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
49441
49409
|
return "git no longer recognises it as a working tree";
|
|
@@ -49668,12 +49636,12 @@ function closeGateApplies(sessions, session) {
|
|
|
49668
49636
|
}
|
|
49669
49637
|
|
|
49670
49638
|
// src/commands/sessions/daemon/worktree/liveProcessesInTree.ts
|
|
49671
|
-
import { readdirSync as
|
|
49639
|
+
import { readdirSync as readdirSync27, readlinkSync } from "fs";
|
|
49672
49640
|
import { sep as sep4 } from "path";
|
|
49673
49641
|
function liveProcessesInTree(treePath, procRoot = "/proc") {
|
|
49674
49642
|
let entries;
|
|
49675
49643
|
try {
|
|
49676
|
-
entries =
|
|
49644
|
+
entries = readdirSync27(procRoot);
|
|
49677
49645
|
} catch {
|
|
49678
49646
|
return [];
|
|
49679
49647
|
}
|
|
@@ -53985,7 +53953,7 @@ import { existsSync as existsSync101 } from "fs";
|
|
|
53985
53953
|
|
|
53986
53954
|
// src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
|
|
53987
53955
|
import { copyFileSync as copyFileSync4, existsSync as existsSync100, mkdirSync as mkdirSync42 } from "fs";
|
|
53988
|
-
import { join as
|
|
53956
|
+
import { join as join113 } from "path";
|
|
53989
53957
|
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
53990
53958
|
const dir = projectDirForCwd(toCwd);
|
|
53991
53959
|
if (dir === projectDirForCwd(fromCwd)) {
|
|
@@ -53994,7 +53962,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
53994
53962
|
);
|
|
53995
53963
|
return;
|
|
53996
53964
|
}
|
|
53997
|
-
const dest =
|
|
53965
|
+
const dest = join113(dir, `${claudeSessionId}.jsonl`);
|
|
53998
53966
|
if (existsSync100(dest)) {
|
|
53999
53967
|
daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
|
|
54000
53968
|
return;
|
|
@@ -55394,7 +55362,7 @@ function handleConnection(socket, manager) {
|
|
|
55394
55362
|
import { unlinkSync as unlinkSync22, writeFileSync as writeFileSync61 } from "fs";
|
|
55395
55363
|
|
|
55396
55364
|
// src/commands/sessions/daemon/startPidFileWatchdog.ts
|
|
55397
|
-
import { readFileSync as
|
|
55365
|
+
import { readFileSync as readFileSync73 } from "fs";
|
|
55398
55366
|
var WATCHDOG_INTERVAL_MS = 5e3;
|
|
55399
55367
|
function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
55400
55368
|
const timer = setInterval(() => {
|
|
@@ -55405,7 +55373,7 @@ function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
|
55405
55373
|
}
|
|
55406
55374
|
function ownsPidFile() {
|
|
55407
55375
|
try {
|
|
55408
|
-
return
|
|
55376
|
+
return readFileSync73(daemonPaths.pid, "utf8").trim() === String(process.pid);
|
|
55409
55377
|
} catch {
|
|
55410
55378
|
return false;
|
|
55411
55379
|
}
|