@staff0rd/assist 0.1011.0 → 0.1011.2
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.1011.
|
|
9
|
+
version: "0.1011.2",
|
|
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(
|
|
@@ -45942,6 +45910,47 @@ ${result.reason}`
|
|
|
45942
45910
|
};
|
|
45943
45911
|
}
|
|
45944
45912
|
|
|
45913
|
+
// src/commands/watch/markSyncPending.ts
|
|
45914
|
+
import { existsSync as existsSync83, writeFileSync as writeFileSync55 } from "fs";
|
|
45915
|
+
|
|
45916
|
+
// src/commands/watch/gitMarkerPath.ts
|
|
45917
|
+
import { resolve as resolve28 } from "path";
|
|
45918
|
+
function gitMarkerPath(name, cwd) {
|
|
45919
|
+
return resolve28(
|
|
45920
|
+
cwd ?? process.cwd(),
|
|
45921
|
+
runGit3(["rev-parse", "--git-path", name], cwd)
|
|
45922
|
+
);
|
|
45923
|
+
}
|
|
45924
|
+
|
|
45925
|
+
// src/commands/watch/syncPendingPath.ts
|
|
45926
|
+
function syncPendingPath(cwd) {
|
|
45927
|
+
return gitMarkerPath("assist-watch-sync-pending", cwd);
|
|
45928
|
+
}
|
|
45929
|
+
|
|
45930
|
+
// src/commands/watch/markSyncPending.ts
|
|
45931
|
+
function pendingFromEarlierLap() {
|
|
45932
|
+
try {
|
|
45933
|
+
return existsSync83(syncPendingPath());
|
|
45934
|
+
} catch {
|
|
45935
|
+
return false;
|
|
45936
|
+
}
|
|
45937
|
+
}
|
|
45938
|
+
function writePendingMarker() {
|
|
45939
|
+
try {
|
|
45940
|
+
writeFileSync55(syncPendingPath(), "");
|
|
45941
|
+
} catch {
|
|
45942
|
+
}
|
|
45943
|
+
}
|
|
45944
|
+
function markSyncPending(from) {
|
|
45945
|
+
const owed = pendingFromEarlierLap();
|
|
45946
|
+
if (syncAdvice(changedPaths(from)).length > 0) {
|
|
45947
|
+
writePendingMarker();
|
|
45948
|
+
return true;
|
|
45949
|
+
}
|
|
45950
|
+
if (owed) console.log("retrying a sync that failed on an earlier lap");
|
|
45951
|
+
return owed;
|
|
45952
|
+
}
|
|
45953
|
+
|
|
45945
45954
|
// src/commands/watch/gitFailureReason.ts
|
|
45946
45955
|
function gitFailureReason(error) {
|
|
45947
45956
|
const streams = error;
|
|
@@ -46084,8 +46093,8 @@ function resolveParams(params, cliArgs) {
|
|
|
46084
46093
|
}
|
|
46085
46094
|
|
|
46086
46095
|
// src/commands/run/resolveRunCwd.ts
|
|
46087
|
-
import { existsSync as
|
|
46088
|
-
import { resolve as
|
|
46096
|
+
import { existsSync as existsSync84 } from "fs";
|
|
46097
|
+
import { resolve as resolve29 } from "path";
|
|
46089
46098
|
var MissingRunCwdError = class extends Error {
|
|
46090
46099
|
constructor(runName, cwd) {
|
|
46091
46100
|
super(`run config "${runName}": cwd ${cwd} does not exist`);
|
|
@@ -46096,8 +46105,8 @@ var MissingRunCwdError = class extends Error {
|
|
|
46096
46105
|
};
|
|
46097
46106
|
function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
|
|
46098
46107
|
if (!config.cwd) return void 0;
|
|
46099
|
-
const cwd =
|
|
46100
|
-
if (!
|
|
46108
|
+
const cwd = resolve29(baseDir, config.cwd);
|
|
46109
|
+
if (!existsSync84(cwd)) throw new MissingRunCwdError(config.name, cwd);
|
|
46101
46110
|
return cwd;
|
|
46102
46111
|
}
|
|
46103
46112
|
|
|
@@ -46171,12 +46180,15 @@ function reportOutcome({ exitCode, message: message3 }) {
|
|
|
46171
46180
|
else console.error(message3);
|
|
46172
46181
|
}
|
|
46173
46182
|
|
|
46183
|
+
// src/commands/watch/reportSyncOrExit.ts
|
|
46184
|
+
import { rmSync as rmSync11 } from "fs";
|
|
46185
|
+
|
|
46174
46186
|
// src/commands/watch/runPostBuildSync.ts
|
|
46175
46187
|
async function runPostBuildSync() {
|
|
46176
46188
|
return toBuildOutcome(
|
|
46177
46189
|
await runCommandToCompletion(
|
|
46178
|
-
|
|
46179
|
-
["sync", "--yes"],
|
|
46190
|
+
process.execPath,
|
|
46191
|
+
[process.argv[1], "sync", "--yes"],
|
|
46180
46192
|
void 0,
|
|
46181
46193
|
void 0,
|
|
46182
46194
|
true
|
|
@@ -46185,14 +46197,27 @@ async function runPostBuildSync() {
|
|
|
46185
46197
|
}
|
|
46186
46198
|
|
|
46187
46199
|
// src/commands/watch/reportSyncOrExit.ts
|
|
46200
|
+
function clearPendingMarker() {
|
|
46201
|
+
try {
|
|
46202
|
+
rmSync11(syncPendingPath(), { force: true });
|
|
46203
|
+
} catch {
|
|
46204
|
+
}
|
|
46205
|
+
}
|
|
46188
46206
|
async function reportSyncOrExit() {
|
|
46189
46207
|
const outcome = await runPostBuildSync();
|
|
46190
46208
|
if (outcome.kind === "built") {
|
|
46209
|
+
clearPendingMarker();
|
|
46191
46210
|
console.log("synced ~/.claude");
|
|
46192
46211
|
return;
|
|
46193
46212
|
}
|
|
46194
|
-
if (outcome.output.length > 0)
|
|
46195
|
-
|
|
46213
|
+
if (outcome.output.length > 0)
|
|
46214
|
+
process.stdout.write(
|
|
46215
|
+
outcome.output.endsWith("\n") ? outcome.output : `${outcome.output}
|
|
46216
|
+
`
|
|
46217
|
+
);
|
|
46218
|
+
console.error(
|
|
46219
|
+
`sync failed with exit code ${outcome.exitCode}; a later lap will retry it`
|
|
46220
|
+
);
|
|
46196
46221
|
process.exit(4);
|
|
46197
46222
|
}
|
|
46198
46223
|
|
|
@@ -46208,35 +46233,27 @@ async function pullAndBuild(from, build2) {
|
|
|
46208
46233
|
console.log(`
|
|
46209
46234
|
${buildWatchReport(from)}`);
|
|
46210
46235
|
if (build2) {
|
|
46236
|
+
const syncNeeded = markSyncPending(from);
|
|
46211
46237
|
await reportBuildOrExit(
|
|
46212
46238
|
typeof build2 === "string" ? build2 : DEFAULT_BUILD_ENTRY
|
|
46213
46239
|
);
|
|
46214
|
-
if (
|
|
46240
|
+
if (syncNeeded) await reportSyncOrExit();
|
|
46215
46241
|
}
|
|
46216
46242
|
process.exit(0);
|
|
46217
46243
|
}
|
|
46218
46244
|
|
|
46219
46245
|
// src/commands/watch/consumeMarker.ts
|
|
46220
|
-
import { existsSync as
|
|
46246
|
+
import { existsSync as existsSync85, rmSync as rmSync12 } from "fs";
|
|
46221
46247
|
function consumeMarker(path109) {
|
|
46222
46248
|
try {
|
|
46223
|
-
if (!
|
|
46224
|
-
|
|
46249
|
+
if (!existsSync85(path109)) return false;
|
|
46250
|
+
rmSync12(path109);
|
|
46225
46251
|
return true;
|
|
46226
46252
|
} catch {
|
|
46227
46253
|
return false;
|
|
46228
46254
|
}
|
|
46229
46255
|
}
|
|
46230
46256
|
|
|
46231
|
-
// src/commands/watch/gitMarkerPath.ts
|
|
46232
|
-
import { resolve as resolve29 } from "path";
|
|
46233
|
-
function gitMarkerPath(name, cwd) {
|
|
46234
|
-
return resolve29(
|
|
46235
|
-
cwd ?? process.cwd(),
|
|
46236
|
-
runGit3(["rev-parse", "--git-path", name], cwd)
|
|
46237
|
-
);
|
|
46238
|
-
}
|
|
46239
|
-
|
|
46240
46257
|
// src/commands/watch/simulatedDivergencePath.ts
|
|
46241
46258
|
function simulatedDivergencePath(cwd) {
|
|
46242
46259
|
return gitMarkerPath("assist-simulate-divergence", cwd);
|
|
@@ -46414,10 +46431,10 @@ function registerWatchWait(watchCommand) {
|
|
|
46414
46431
|
}
|
|
46415
46432
|
|
|
46416
46433
|
// src/commands/watch/simulateDivergence.ts
|
|
46417
|
-
import { writeFileSync as
|
|
46434
|
+
import { writeFileSync as writeFileSync56 } from "fs";
|
|
46418
46435
|
function simulateDivergence() {
|
|
46419
46436
|
try {
|
|
46420
|
-
|
|
46437
|
+
writeFileSync56(simulatedDivergencePath(), "");
|
|
46421
46438
|
console.log(
|
|
46422
46439
|
`the next assist watch wait poll in ${runGit3(["rev-parse", "--show-toplevel"])} will exit 3 as a simulated divergence`
|
|
46423
46440
|
);
|
|
@@ -46511,17 +46528,17 @@ function registerWatch(program) {
|
|
|
46511
46528
|
|
|
46512
46529
|
// src/commands/roam/postRoamActivity.ts
|
|
46513
46530
|
import { execFileSync as execFileSync30 } from "child_process";
|
|
46514
|
-
import { readdirSync as
|
|
46515
|
-
import { join as
|
|
46531
|
+
import { readdirSync as readdirSync24, readFileSync as readFileSync68, statSync as statSync13 } from "fs";
|
|
46532
|
+
import { join as join105 } from "path";
|
|
46516
46533
|
function findPortFile(roamDir) {
|
|
46517
46534
|
let entries;
|
|
46518
46535
|
try {
|
|
46519
|
-
entries =
|
|
46536
|
+
entries = readdirSync24(roamDir);
|
|
46520
46537
|
} catch {
|
|
46521
46538
|
return void 0;
|
|
46522
46539
|
}
|
|
46523
46540
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
46524
|
-
const path109 =
|
|
46541
|
+
const path109 = join105(roamDir, name);
|
|
46525
46542
|
try {
|
|
46526
46543
|
return { path: path109, mtimeMs: statSync13(path109).mtimeMs };
|
|
46527
46544
|
} catch {
|
|
@@ -46538,11 +46555,11 @@ var PID_BY_APP = {
|
|
|
46538
46555
|
function postRoamActivity(app, event) {
|
|
46539
46556
|
const appData = process.env.APPDATA;
|
|
46540
46557
|
if (!appData) return;
|
|
46541
|
-
const portFile = findPortFile(
|
|
46558
|
+
const portFile = findPortFile(join105(appData, "Roam"));
|
|
46542
46559
|
if (!portFile) return;
|
|
46543
46560
|
let port;
|
|
46544
46561
|
try {
|
|
46545
|
-
port =
|
|
46562
|
+
port = readFileSync68(portFile, "utf8").trim();
|
|
46546
46563
|
} catch {
|
|
46547
46564
|
return;
|
|
46548
46565
|
}
|
|
@@ -46721,7 +46738,7 @@ function link2() {
|
|
|
46721
46738
|
}
|
|
46722
46739
|
|
|
46723
46740
|
// src/commands/run/add.ts
|
|
46724
|
-
import { mkdirSync as mkdirSync38, writeFileSync as
|
|
46741
|
+
import { mkdirSync as mkdirSync38, writeFileSync as writeFileSync57 } from "fs";
|
|
46725
46742
|
import { dirname as dirname45 } from "path";
|
|
46726
46743
|
|
|
46727
46744
|
// src/commands/run/editRepoRunList.ts
|
|
@@ -46881,11 +46898,11 @@ function requireParsedArgs() {
|
|
|
46881
46898
|
}
|
|
46882
46899
|
|
|
46883
46900
|
// src/commands/run/runCommandFilePath.ts
|
|
46884
|
-
import { join as
|
|
46901
|
+
import { join as join106 } from "path";
|
|
46885
46902
|
function runCommandFilePath(name) {
|
|
46886
46903
|
const segments = name.split(":");
|
|
46887
46904
|
const file = `${segments.pop()}.md`;
|
|
46888
|
-
return
|
|
46905
|
+
return join106(".claude", "commands", ...segments, file);
|
|
46889
46906
|
}
|
|
46890
46907
|
|
|
46891
46908
|
// src/commands/run/add.ts
|
|
@@ -46909,7 +46926,7 @@ description: Run ${name}
|
|
|
46909
46926
|
|
|
46910
46927
|
Run \`assist run ${name} $ARGUMENTS 2>&1\`.
|
|
46911
46928
|
`;
|
|
46912
|
-
|
|
46929
|
+
writeFileSync57(filePath, content);
|
|
46913
46930
|
console.log(`Created command file: ${filePath}`);
|
|
46914
46931
|
}
|
|
46915
46932
|
async function add4() {
|
|
@@ -47013,8 +47030,8 @@ function registerRunAdd(runCommand) {
|
|
|
47013
47030
|
}
|
|
47014
47031
|
|
|
47015
47032
|
// src/commands/run/remove.ts
|
|
47016
|
-
import { existsSync as
|
|
47017
|
-
import { dirname as dirname46, join as
|
|
47033
|
+
import { existsSync as existsSync86, readdirSync as readdirSync25, rmdirSync, unlinkSync as unlinkSync21 } from "fs";
|
|
47034
|
+
import { dirname as dirname46, join as join107 } from "path";
|
|
47018
47035
|
|
|
47019
47036
|
// src/commands/run/removeRepoRunConfig.ts
|
|
47020
47037
|
function isNamed(entry, name) {
|
|
@@ -47032,17 +47049,17 @@ function removeRepoRunConfig(name, repoName, cwd = process.cwd()) {
|
|
|
47032
47049
|
|
|
47033
47050
|
// src/commands/run/remove.ts
|
|
47034
47051
|
function removeEmptyNamespaceDirs(filePath) {
|
|
47035
|
-
const root2 =
|
|
47052
|
+
const root2 = join107(".claude", "commands");
|
|
47036
47053
|
for (let dir = dirname46(filePath); dir !== root2; dir = dirname46(dir)) {
|
|
47037
|
-
if (!
|
|
47054
|
+
if (!existsSync86(dir) || readdirSync25(dir).length > 0) return;
|
|
47038
47055
|
rmdirSync(dir);
|
|
47039
47056
|
}
|
|
47040
47057
|
}
|
|
47041
47058
|
function deleteCommandFile(name) {
|
|
47042
47059
|
const filePath = runCommandFilePath(name);
|
|
47043
|
-
const legacyPath =
|
|
47060
|
+
const legacyPath = join107(".claude", "commands", `${name}.md`);
|
|
47044
47061
|
for (const path109 of /* @__PURE__ */ new Set([filePath, legacyPath])) {
|
|
47045
|
-
if (
|
|
47062
|
+
if (existsSync86(path109)) {
|
|
47046
47063
|
unlinkSync21(path109);
|
|
47047
47064
|
console.log(`Deleted command file: ${path109}`);
|
|
47048
47065
|
}
|
|
@@ -47163,11 +47180,11 @@ function applyLine(result, pending, line) {
|
|
|
47163
47180
|
}
|
|
47164
47181
|
|
|
47165
47182
|
// src/commands/sessions/daemon/readDaemonPidFile.ts
|
|
47166
|
-
import { readFileSync as
|
|
47183
|
+
import { readFileSync as readFileSync69 } from "fs";
|
|
47167
47184
|
function readDaemonPidFile() {
|
|
47168
47185
|
try {
|
|
47169
47186
|
const pid = Number.parseInt(
|
|
47170
|
-
|
|
47187
|
+
readFileSync69(daemonPaths.pid, "utf8").trim(),
|
|
47171
47188
|
10
|
|
47172
47189
|
);
|
|
47173
47190
|
return Number.isInteger(pid) ? pid : void 0;
|
|
@@ -47750,12 +47767,12 @@ function toSessionViewInfo({
|
|
|
47750
47767
|
}
|
|
47751
47768
|
|
|
47752
47769
|
// src/commands/sessions/daemon/worktree/joinRefusal.ts
|
|
47753
|
-
import { existsSync as
|
|
47770
|
+
import { existsSync as existsSync87 } from "fs";
|
|
47754
47771
|
function joinRefusal(session) {
|
|
47755
47772
|
if (session.commandType === "run") return "a server run has no agent stream";
|
|
47756
47773
|
if (session.closing === true) return "the session is closing";
|
|
47757
47774
|
if (!session.cwd) return "the session has no working directory";
|
|
47758
|
-
if (!
|
|
47775
|
+
if (!existsSync87(session.cwd))
|
|
47759
47776
|
return "the session's workspace no longer exists";
|
|
47760
47777
|
return void 0;
|
|
47761
47778
|
}
|
|
@@ -47831,8 +47848,8 @@ function broadcastSessions(sessions, clients, linkedSessions = [], active) {
|
|
|
47831
47848
|
}
|
|
47832
47849
|
|
|
47833
47850
|
// src/commands/sessions/daemon/findServerParents.ts
|
|
47834
|
-
import { existsSync as
|
|
47835
|
-
import { join as
|
|
47851
|
+
import { existsSync as existsSync88 } from "fs";
|
|
47852
|
+
import { join as join108, resolve as resolve30 } from "path";
|
|
47836
47853
|
function isLive(session) {
|
|
47837
47854
|
return !!session.pty && session.status !== "done" && session.status !== "error";
|
|
47838
47855
|
}
|
|
@@ -47841,7 +47858,7 @@ function isLiveAgent(session) {
|
|
|
47841
47858
|
}
|
|
47842
47859
|
function serverRunDirs(sessions, file) {
|
|
47843
47860
|
return new Set(
|
|
47844
|
-
sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve30(s.cwd)).filter((dir) =>
|
|
47861
|
+
sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve30(s.cwd)).filter((dir) => existsSync88(join108(dir, file)))
|
|
47845
47862
|
);
|
|
47846
47863
|
}
|
|
47847
47864
|
function findServerParents(sessions, file) {
|
|
@@ -48059,7 +48076,7 @@ function sendResizeSnapshot(s, send) {
|
|
|
48059
48076
|
}
|
|
48060
48077
|
|
|
48061
48078
|
// src/commands/sessions/daemon/viewerSize.ts
|
|
48062
|
-
import { readFileSync as
|
|
48079
|
+
import { readFileSync as readFileSync70, writeFileSync as writeFileSync58 } from "fs";
|
|
48063
48080
|
var DEFAULT_SIZE = { cols: 120, rows: 30 };
|
|
48064
48081
|
var remembered;
|
|
48065
48082
|
function rememberViewerSize(cols, rows) {
|
|
@@ -48067,7 +48084,7 @@ function rememberViewerSize(cols, rows) {
|
|
|
48067
48084
|
if (remembered?.cols === cols && remembered.rows === rows) return;
|
|
48068
48085
|
remembered = { cols, rows };
|
|
48069
48086
|
try {
|
|
48070
|
-
|
|
48087
|
+
writeFileSync58(daemonPaths.viewerSize, JSON.stringify(remembered));
|
|
48071
48088
|
} catch (error) {
|
|
48072
48089
|
daemonLog(
|
|
48073
48090
|
`viewer size ${cols}x${rows} not saved: ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -48081,7 +48098,7 @@ function viewerSize() {
|
|
|
48081
48098
|
function readSavedSize() {
|
|
48082
48099
|
try {
|
|
48083
48100
|
const { cols, rows } = JSON.parse(
|
|
48084
|
-
|
|
48101
|
+
readFileSync70(daemonPaths.viewerSize, "utf8")
|
|
48085
48102
|
);
|
|
48086
48103
|
if (typeof cols === "number" && typeof rows === "number" && cols > 0)
|
|
48087
48104
|
return { cols, rows };
|
|
@@ -48577,11 +48594,11 @@ function sessionBase(id, status2) {
|
|
|
48577
48594
|
}
|
|
48578
48595
|
|
|
48579
48596
|
// src/commands/sessions/daemon/spawnPty.ts
|
|
48580
|
-
import { existsSync as
|
|
48597
|
+
import { existsSync as existsSync91 } from "fs";
|
|
48581
48598
|
import * as pty from "node-pty";
|
|
48582
48599
|
|
|
48583
48600
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
48584
|
-
import { chmodSync, existsSync as
|
|
48601
|
+
import { chmodSync, existsSync as existsSync90, statSync as statSync14 } from "fs";
|
|
48585
48602
|
import { createRequire as createRequire3 } from "module";
|
|
48586
48603
|
import path106 from "path";
|
|
48587
48604
|
var require4 = createRequire3(import.meta.url);
|
|
@@ -48596,7 +48613,7 @@ function ensureSpawnHelperExecutable() {
|
|
|
48596
48613
|
`${process.platform}-${process.arch}`,
|
|
48597
48614
|
"spawn-helper"
|
|
48598
48615
|
);
|
|
48599
|
-
if (!
|
|
48616
|
+
if (!existsSync90(helper)) return;
|
|
48600
48617
|
const mode = statSync14(helper).mode;
|
|
48601
48618
|
if ((mode & 73) === 0) chmodSync(helper, mode | 493);
|
|
48602
48619
|
}
|
|
@@ -48652,7 +48669,7 @@ function spawnPty(args, cwd, sessionId, extraEnv) {
|
|
|
48652
48669
|
});
|
|
48653
48670
|
}
|
|
48654
48671
|
function refuseMissingCwd(cwd, sessionId) {
|
|
48655
|
-
if (!cwd ||
|
|
48672
|
+
if (!cwd || existsSync91(cwd)) return;
|
|
48656
48673
|
daemonLog(
|
|
48657
48674
|
`${sessionId ? `session ${sessionId}` : "pty"} not spawned: working directory ${cwd} no longer exists`
|
|
48658
48675
|
);
|
|
@@ -48822,20 +48839,20 @@ function createRunSession(id, { runName, runArgs, cwd, meta }) {
|
|
|
48822
48839
|
}
|
|
48823
48840
|
|
|
48824
48841
|
// src/commands/sessions/daemon/autoUpdate/autoUpdateControl.ts
|
|
48825
|
-
import { existsSync as
|
|
48842
|
+
import { existsSync as existsSync92, rmSync as rmSync13, writeFileSync as writeFileSync59 } from "fs";
|
|
48826
48843
|
var paused;
|
|
48827
48844
|
var wake;
|
|
48828
48845
|
var holdReleased = false;
|
|
48829
48846
|
function persist2(value) {
|
|
48830
48847
|
try {
|
|
48831
|
-
if (value)
|
|
48832
|
-
else
|
|
48848
|
+
if (value) writeFileSync59(daemonPaths.autoUpdatePaused, "");
|
|
48849
|
+
else rmSync13(daemonPaths.autoUpdatePaused, { force: true });
|
|
48833
48850
|
} catch {
|
|
48834
48851
|
}
|
|
48835
48852
|
}
|
|
48836
48853
|
var autoUpdateControl = {
|
|
48837
48854
|
paused: () => {
|
|
48838
|
-
paused ??=
|
|
48855
|
+
paused ??= existsSync92(daemonPaths.autoUpdatePaused);
|
|
48839
48856
|
return paused;
|
|
48840
48857
|
},
|
|
48841
48858
|
setPaused: (value) => {
|
|
@@ -48969,19 +48986,19 @@ async function runAutoUpdateLoop(deps2, maxLaps = Number.POSITIVE_INFINITY) {
|
|
|
48969
48986
|
}
|
|
48970
48987
|
|
|
48971
48988
|
// src/commands/sessions/daemon/autoUpdate/trimWatcherLog.ts
|
|
48972
|
-
import { readFileSync as
|
|
48989
|
+
import { readFileSync as readFileSync72, writeFileSync as writeFileSync60 } from "fs";
|
|
48973
48990
|
var KEEP_TAIL = 256 * 1024;
|
|
48974
48991
|
var MAX_LOG_SIZE = 4 * 1024 * 1024;
|
|
48975
48992
|
function trimWatcherLog(cwd) {
|
|
48976
48993
|
const path109 = watcherLogPath(cwd);
|
|
48977
48994
|
let log2;
|
|
48978
48995
|
try {
|
|
48979
|
-
log2 =
|
|
48996
|
+
log2 = readFileSync72(path109, "utf8");
|
|
48980
48997
|
} catch {
|
|
48981
48998
|
return;
|
|
48982
48999
|
}
|
|
48983
49000
|
if (log2.length <= MAX_LOG_SIZE) return;
|
|
48984
|
-
|
|
49001
|
+
writeFileSync60(path109, log2.slice(-KEEP_TAIL));
|
|
48985
49002
|
daemonLog(`auto-update: log ${path109} trimmed to its last ${KEEP_TAIL} chars`);
|
|
48986
49003
|
}
|
|
48987
49004
|
|
|
@@ -49064,7 +49081,7 @@ function bindResumedWorktree(session, cwd, notify2) {
|
|
|
49064
49081
|
}
|
|
49065
49082
|
|
|
49066
49083
|
// src/commands/sessions/daemon/worktree/treeDurability.ts
|
|
49067
|
-
import { existsSync as
|
|
49084
|
+
import { existsSync as existsSync93 } from "fs";
|
|
49068
49085
|
var treeIsGone = { durable: true, gone: true };
|
|
49069
49086
|
function treeDurability(state) {
|
|
49070
49087
|
if (state.dirty) return { durable: false, reason: "uncommitted changes" };
|
|
@@ -49095,14 +49112,14 @@ function* durabilityProbes() {
|
|
|
49095
49112
|
});
|
|
49096
49113
|
}
|
|
49097
49114
|
async function checkDurability(cwd) {
|
|
49098
|
-
if (!
|
|
49115
|
+
if (!existsSync93(cwd)) return treeIsGone;
|
|
49099
49116
|
const probes = durabilityProbes();
|
|
49100
49117
|
let step3 = probes.next();
|
|
49101
49118
|
while (!step3.done) step3 = probes.next(await gitResult(cwd, step3.value));
|
|
49102
49119
|
return step3.value;
|
|
49103
49120
|
}
|
|
49104
49121
|
function checkDurabilitySync(cwd) {
|
|
49105
|
-
if (!
|
|
49122
|
+
if (!existsSync93(cwd)) return treeIsGone;
|
|
49106
49123
|
const probes = durabilityProbes();
|
|
49107
49124
|
let step3 = probes.next();
|
|
49108
49125
|
while (!step3.done) step3 = probes.next(gitSyncResult(cwd, step3.value));
|
|
@@ -49251,12 +49268,12 @@ function noteAutoUpdate(installDir, text18) {
|
|
|
49251
49268
|
|
|
49252
49269
|
// src/commands/sessions/daemon/autoUpdate/runUpdateLap.ts
|
|
49253
49270
|
import { spawn as spawn12 } from "child_process";
|
|
49254
|
-
import { rmSync as
|
|
49271
|
+
import { rmSync as rmSync14 } from "fs";
|
|
49255
49272
|
function clearLapSignals(cwd) {
|
|
49256
49273
|
const control = watchControlPaths(cwd);
|
|
49257
49274
|
if (!control) return;
|
|
49258
49275
|
for (const path109 of [control.check, control.stop])
|
|
49259
|
-
|
|
49276
|
+
rmSync14(path109, { force: true });
|
|
49260
49277
|
}
|
|
49261
49278
|
function runUpdateLap(cwd, onOutput) {
|
|
49262
49279
|
clearLapSignals(cwd);
|
|
@@ -49361,17 +49378,17 @@ function setStatus2(session, newStatus) {
|
|
|
49361
49378
|
}
|
|
49362
49379
|
|
|
49363
49380
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
49364
|
-
import { existsSync as
|
|
49381
|
+
import { existsSync as existsSync95 } from "fs";
|
|
49365
49382
|
import { basename as basename31 } from "path";
|
|
49366
49383
|
|
|
49367
49384
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
49368
|
-
import { existsSync as
|
|
49369
|
-
import { join as
|
|
49385
|
+
import { existsSync as existsSync94 } from "fs";
|
|
49386
|
+
import { join as join112 } from "path";
|
|
49370
49387
|
|
|
49371
49388
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
49372
49389
|
import { statSync as statSync15 } from "fs";
|
|
49373
49390
|
import { rm as rm3 } from "fs/promises";
|
|
49374
|
-
import { join as
|
|
49391
|
+
import { join as join111 } from "path";
|
|
49375
49392
|
async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
49376
49393
|
if (holdsAGitDirectoryRatherThanALink(worktreePath)) {
|
|
49377
49394
|
const refusal = "it is a clone of its own, not a linked worktree";
|
|
@@ -49399,7 +49416,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
|
49399
49416
|
return { removed: true };
|
|
49400
49417
|
}
|
|
49401
49418
|
function holdsAGitDirectoryRatherThanALink(worktreePath) {
|
|
49402
|
-
return statSync15(
|
|
49419
|
+
return statSync15(join111(worktreePath, ".git"), {
|
|
49403
49420
|
throwIfNoEntry: false
|
|
49404
49421
|
})?.isDirectory() === true;
|
|
49405
49422
|
}
|
|
@@ -49435,7 +49452,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
49435
49452
|
);
|
|
49436
49453
|
}
|
|
49437
49454
|
function strandedReason(worktreePath, cause) {
|
|
49438
|
-
if (!
|
|
49455
|
+
if (!existsSync94(join112(worktreePath, ".git")))
|
|
49439
49456
|
return "its .git link is already gone";
|
|
49440
49457
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
49441
49458
|
return "git no longer recognises it as a working tree";
|
|
@@ -49487,7 +49504,7 @@ function reason3(error) {
|
|
|
49487
49504
|
|
|
49488
49505
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
49489
49506
|
async function reapWorktree(worktreePath, force = false) {
|
|
49490
|
-
if (!
|
|
49507
|
+
if (!existsSync95(worktreePath)) {
|
|
49491
49508
|
forgetWorktree(worktreePath);
|
|
49492
49509
|
daemonLog(
|
|
49493
49510
|
`worktree ${worktreePath} already gone; its record was forgotten`
|
|
@@ -49512,7 +49529,7 @@ async function reapWorktree(worktreePath, force = false) {
|
|
|
49512
49529
|
}
|
|
49513
49530
|
function owningClone(worktreePath) {
|
|
49514
49531
|
const recorded = worktreeAttributionIncludingReaped(worktreePath)?.clone;
|
|
49515
|
-
if (recorded &&
|
|
49532
|
+
if (recorded && existsSync95(recorded)) return recorded;
|
|
49516
49533
|
const detected = mainWorktree(worktreePath);
|
|
49517
49534
|
if (detected) return detected;
|
|
49518
49535
|
daemonLog(
|
|
@@ -49668,12 +49685,12 @@ function closeGateApplies(sessions, session) {
|
|
|
49668
49685
|
}
|
|
49669
49686
|
|
|
49670
49687
|
// src/commands/sessions/daemon/worktree/liveProcessesInTree.ts
|
|
49671
|
-
import { readdirSync as
|
|
49688
|
+
import { readdirSync as readdirSync27, readlinkSync } from "fs";
|
|
49672
49689
|
import { sep as sep4 } from "path";
|
|
49673
49690
|
function liveProcessesInTree(treePath, procRoot = "/proc") {
|
|
49674
49691
|
let entries;
|
|
49675
49692
|
try {
|
|
49676
|
-
entries =
|
|
49693
|
+
entries = readdirSync27(procRoot);
|
|
49677
49694
|
} catch {
|
|
49678
49695
|
return [];
|
|
49679
49696
|
}
|
|
@@ -49740,12 +49757,12 @@ async function closeBlockReason(sessionId, tree) {
|
|
|
49740
49757
|
}
|
|
49741
49758
|
|
|
49742
49759
|
// src/commands/sessions/daemon/worktree/watchGitState.ts
|
|
49743
|
-
import { existsSync as
|
|
49760
|
+
import { existsSync as existsSync96, watch } from "fs";
|
|
49744
49761
|
var DEBOUNCE_MS = 500;
|
|
49745
49762
|
var POLL_MS4 = 3e4;
|
|
49746
49763
|
function watchGitState(cwd, onChange) {
|
|
49747
49764
|
const common = gitCommonDir(cwd);
|
|
49748
|
-
if (!common || !
|
|
49765
|
+
if (!common || !existsSync96(common)) return void 0;
|
|
49749
49766
|
const watchers = [
|
|
49750
49767
|
watchGitDir(common, onChange),
|
|
49751
49768
|
pollGitState(cwd, onChange)
|
|
@@ -50452,10 +50469,10 @@ function emitSessionOutput(session, clients, data) {
|
|
|
50452
50469
|
}
|
|
50453
50470
|
|
|
50454
50471
|
// src/commands/sessions/daemon/exitReason.ts
|
|
50455
|
-
import { existsSync as
|
|
50472
|
+
import { existsSync as existsSync97 } from "fs";
|
|
50456
50473
|
import { resolve as resolve31 } from "path";
|
|
50457
50474
|
function exitDetail(session) {
|
|
50458
|
-
if (session.cwd && !
|
|
50475
|
+
if (session.cwd && !existsSync97(session.cwd))
|
|
50459
50476
|
return `working directory ${session.cwd} no longer exists`;
|
|
50460
50477
|
return missingRunConfigCwd(session);
|
|
50461
50478
|
}
|
|
@@ -50469,7 +50486,7 @@ function missingRunConfigCwd(session) {
|
|
|
50469
50486
|
const config = resolveRunConfig(session.runName, dir);
|
|
50470
50487
|
if (!config?.cwd) return void 0;
|
|
50471
50488
|
const configured = resolve31(runConfigBaseDirFrom(dir), config.cwd);
|
|
50472
|
-
if (
|
|
50489
|
+
if (existsSync97(configured)) return void 0;
|
|
50473
50490
|
return `run config "${config.name}": cwd ${configured} does not exist`;
|
|
50474
50491
|
}
|
|
50475
50492
|
|
|
@@ -50517,7 +50534,7 @@ function handleRefusedRun(session, exitCode, onStatusChange) {
|
|
|
50517
50534
|
}
|
|
50518
50535
|
|
|
50519
50536
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
50520
|
-
import { existsSync as
|
|
50537
|
+
import { existsSync as existsSync98, mkdirSync as mkdirSync40, watch as watch2 } from "fs";
|
|
50521
50538
|
import { dirname as dirname49 } from "path";
|
|
50522
50539
|
|
|
50523
50540
|
// src/commands/sessions/daemon/applyActivityToSession.ts
|
|
@@ -50602,7 +50619,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
50602
50619
|
if (timer) clearTimeout(timer);
|
|
50603
50620
|
timer = setTimeout(read3, DEBOUNCE_MS2);
|
|
50604
50621
|
});
|
|
50605
|
-
if (
|
|
50622
|
+
if (existsSync98(path109)) read3();
|
|
50606
50623
|
}
|
|
50607
50624
|
function refreshActivity(session) {
|
|
50608
50625
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -52610,7 +52627,7 @@ function rearmStoppedSessions(sessions, notify2) {
|
|
|
52610
52627
|
}
|
|
52611
52628
|
|
|
52612
52629
|
// src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
|
|
52613
|
-
import { existsSync as
|
|
52630
|
+
import { existsSync as existsSync100 } from "fs";
|
|
52614
52631
|
import { basename as basename33 } from "path";
|
|
52615
52632
|
|
|
52616
52633
|
// src/commands/sessions/daemon/worktree/accountedTrees.ts
|
|
@@ -52631,9 +52648,9 @@ function accountedTrees(sessions) {
|
|
|
52631
52648
|
}
|
|
52632
52649
|
|
|
52633
52650
|
// src/commands/sessions/daemon/worktree/reclaimVanishedWorktrees.ts
|
|
52634
|
-
import { existsSync as
|
|
52651
|
+
import { existsSync as existsSync99 } from "fs";
|
|
52635
52652
|
async function reclaimVanishedWorktrees(clone, paths) {
|
|
52636
|
-
if (!
|
|
52653
|
+
if (!existsSync99(clone)) {
|
|
52637
52654
|
for (const { path: path109 } of paths) forgetWorktree(path109);
|
|
52638
52655
|
daemonLog(
|
|
52639
52656
|
`clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
|
|
@@ -52799,7 +52816,7 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
|
52799
52816
|
);
|
|
52800
52817
|
continue;
|
|
52801
52818
|
}
|
|
52802
|
-
if (!
|
|
52819
|
+
if (!existsSync100(path109)) {
|
|
52803
52820
|
logVanishedTree(sessions, path109);
|
|
52804
52821
|
vanished.set(clone, [
|
|
52805
52822
|
...vanished.get(clone) ?? [],
|
|
@@ -53950,7 +53967,7 @@ function spawnAssistInTree(ctx, assistArgs, cwd, meta, context) {
|
|
|
53950
53967
|
}
|
|
53951
53968
|
|
|
53952
53969
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
53953
|
-
import { existsSync as
|
|
53970
|
+
import { existsSync as existsSync103 } from "fs";
|
|
53954
53971
|
|
|
53955
53972
|
// src/commands/sessions/daemon/resumeSession.ts
|
|
53956
53973
|
function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
@@ -53981,11 +53998,11 @@ function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
|
53981
53998
|
}
|
|
53982
53999
|
|
|
53983
54000
|
// src/commands/sessions/daemon/worktree/resumeInReplacementTree.ts
|
|
53984
|
-
import { existsSync as
|
|
54001
|
+
import { existsSync as existsSync102 } from "fs";
|
|
53985
54002
|
|
|
53986
54003
|
// src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
|
|
53987
|
-
import { copyFileSync as copyFileSync4, existsSync as
|
|
53988
|
-
import { join as
|
|
54004
|
+
import { copyFileSync as copyFileSync4, existsSync as existsSync101, mkdirSync as mkdirSync42 } from "fs";
|
|
54005
|
+
import { join as join113 } from "path";
|
|
53989
54006
|
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
53990
54007
|
const dir = projectDirForCwd(toCwd);
|
|
53991
54008
|
if (dir === projectDirForCwd(fromCwd)) {
|
|
@@ -53994,8 +54011,8 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
53994
54011
|
);
|
|
53995
54012
|
return;
|
|
53996
54013
|
}
|
|
53997
|
-
const dest =
|
|
53998
|
-
if (
|
|
54014
|
+
const dest = join113(dir, `${claudeSessionId}.jsonl`);
|
|
54015
|
+
if (existsSync101(dest)) {
|
|
53999
54016
|
daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
|
|
54000
54017
|
return;
|
|
54001
54018
|
}
|
|
@@ -54046,7 +54063,7 @@ function resumeInReplacementTree(ctx, claudeSessionId, missingCwd, name, harness
|
|
|
54046
54063
|
}
|
|
54047
54064
|
function cloneForReapedTree(missingCwd) {
|
|
54048
54065
|
const clone = worktreeAttributionIncludingReaped(missingCwd)?.clone;
|
|
54049
|
-
if (!clone || !
|
|
54066
|
+
if (!clone || !existsSync102(clone))
|
|
54050
54067
|
throw new Error(
|
|
54051
54068
|
`working directory no longer exists and no clone is recorded to re-allocate from: ${missingCwd}`
|
|
54052
54069
|
);
|
|
@@ -54055,7 +54072,7 @@ function cloneForReapedTree(missingCwd) {
|
|
|
54055
54072
|
|
|
54056
54073
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
54057
54074
|
function resumeInTree(ctx, sessionId, cwd, name, harness) {
|
|
54058
|
-
if (!
|
|
54075
|
+
if (!existsSync103(cwd))
|
|
54059
54076
|
return resumeInReplacementTree(ctx, sessionId, cwd, name, harness);
|
|
54060
54077
|
const id = ctx.spawnWith(
|
|
54061
54078
|
(sid) => resumeSession(sid, sessionId, cwd, name, void 0, harness)
|
|
@@ -54313,10 +54330,10 @@ function autoUpdateReply() {
|
|
|
54313
54330
|
}
|
|
54314
54331
|
|
|
54315
54332
|
// src/commands/sessions/daemon/autoUpdate/applyAutoUpdateAction.ts
|
|
54316
|
-
import { rmSync as
|
|
54333
|
+
import { rmSync as rmSync15, writeFileSync as writeFileSync61 } from "fs";
|
|
54317
54334
|
function signalLap(installDir, marker2) {
|
|
54318
54335
|
const control = watchControlPaths(installDir);
|
|
54319
|
-
if (control)
|
|
54336
|
+
if (control) writeFileSync61(control[marker2], "");
|
|
54320
54337
|
}
|
|
54321
54338
|
function applyAutoUpdateAction(action) {
|
|
54322
54339
|
const installDir = getInstallDir();
|
|
@@ -54324,7 +54341,7 @@ function applyAutoUpdateAction(action) {
|
|
|
54324
54341
|
if (action === "resume") {
|
|
54325
54342
|
if (!autoUpdateControl.paused()) return void 0;
|
|
54326
54343
|
const control = watchControlPaths(installDir);
|
|
54327
|
-
if (control)
|
|
54344
|
+
if (control) rmSync15(control.stop, { force: true });
|
|
54328
54345
|
autoUpdateControl.setPaused(false);
|
|
54329
54346
|
noteAutoUpdate(installDir, "resumed from Updates");
|
|
54330
54347
|
return void 0;
|
|
@@ -55194,7 +55211,7 @@ function isPrCheckoutArgs(args) {
|
|
|
55194
55211
|
|
|
55195
55212
|
// src/commands/sessions/daemon/worktree/prCheckoutHolder.ts
|
|
55196
55213
|
import { execFile as execFile14 } from "child_process";
|
|
55197
|
-
import { existsSync as
|
|
55214
|
+
import { existsSync as existsSync104 } from "fs";
|
|
55198
55215
|
function prHeadBranch2(number, cwd) {
|
|
55199
55216
|
const { headBranch } = prCliCommands(number, cwd);
|
|
55200
55217
|
return new Promise((resolve32) => {
|
|
@@ -55208,12 +55225,12 @@ function prHeadBranch2(number, cwd) {
|
|
|
55208
55225
|
}
|
|
55209
55226
|
async function prCheckoutHolder(assistArgs, cwd) {
|
|
55210
55227
|
const number = prCheckoutNumber(assistArgs);
|
|
55211
|
-
if (!number || !cwd || !
|
|
55228
|
+
if (!number || !cwd || !existsSync104(cwd)) return void 0;
|
|
55212
55229
|
const headRef = await prHeadBranch2(number, cwd);
|
|
55213
55230
|
if (!headRef) return void 0;
|
|
55214
55231
|
const listing = await gitOrNull(cwd, ["worktree", "list", "--porcelain"]);
|
|
55215
55232
|
const holder = listing ? worktreeWithBranch(listing, headRef) : null;
|
|
55216
|
-
if (!holder || !
|
|
55233
|
+
if (!holder || !existsSync104(holder)) return void 0;
|
|
55217
55234
|
daemonLog(
|
|
55218
55235
|
`pr #${number} assist ${assistArgs[0]} launched in its checkout ${holder}: head branch ${headRef} is already checked out there, so no worktree is allocated`
|
|
55219
55236
|
);
|
|
@@ -55391,10 +55408,10 @@ function handleConnection(socket, manager) {
|
|
|
55391
55408
|
}
|
|
55392
55409
|
|
|
55393
55410
|
// src/commands/sessions/daemon/onListening.ts
|
|
55394
|
-
import { unlinkSync as unlinkSync22, writeFileSync as
|
|
55411
|
+
import { unlinkSync as unlinkSync22, writeFileSync as writeFileSync62 } from "fs";
|
|
55395
55412
|
|
|
55396
55413
|
// src/commands/sessions/daemon/startPidFileWatchdog.ts
|
|
55397
|
-
import { readFileSync as
|
|
55414
|
+
import { readFileSync as readFileSync73 } from "fs";
|
|
55398
55415
|
var WATCHDOG_INTERVAL_MS = 5e3;
|
|
55399
55416
|
function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
55400
55417
|
const timer = setInterval(() => {
|
|
@@ -55405,7 +55422,7 @@ function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
|
55405
55422
|
}
|
|
55406
55423
|
function ownsPidFile() {
|
|
55407
55424
|
try {
|
|
55408
|
-
return
|
|
55425
|
+
return readFileSync73(daemonPaths.pid, "utf8").trim() === String(process.pid);
|
|
55409
55426
|
} catch {
|
|
55410
55427
|
return false;
|
|
55411
55428
|
}
|
|
@@ -55413,7 +55430,7 @@ function ownsPidFile() {
|
|
|
55413
55430
|
|
|
55414
55431
|
// src/commands/sessions/daemon/onListening.ts
|
|
55415
55432
|
function onListening(manager, checkAutoExit) {
|
|
55416
|
-
|
|
55433
|
+
writeFileSync62(daemonPaths.pid, String(process.pid));
|
|
55417
55434
|
startPidFileWatchdog(() => {
|
|
55418
55435
|
daemonLog("lost daemon.pid ownership; shutting down sessions and exiting");
|
|
55419
55436
|
void manager.flushActiveMs().finally(() => {
|