@staff0rd/assist 0.1059.1 → 0.1060.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/built-version +1 -0
- package/dist/commands/sessions/web/bundle.js +407 -407
- package/dist/index.js +354 -313
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.1060.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -4155,7 +4155,12 @@ function applyCwdFromReq(req) {
|
|
|
4155
4155
|
async function getDocsRefresh(req, res) {
|
|
4156
4156
|
applyCwdFromReq(req);
|
|
4157
4157
|
const { orm } = await getReady();
|
|
4158
|
-
|
|
4158
|
+
const state = await loadDocsRefreshState(orm, getOrigin());
|
|
4159
|
+
const view = {
|
|
4160
|
+
...state,
|
|
4161
|
+
enabled: docsRefreshAfter() !== void 0
|
|
4162
|
+
};
|
|
4163
|
+
respondJson(res, 200, view);
|
|
4159
4164
|
}
|
|
4160
4165
|
|
|
4161
4166
|
// src/commands/backlog/requestDocsRefresh.ts
|
|
@@ -4174,6 +4179,12 @@ async function requestDocsRefresh(orm, origin) {
|
|
|
4174
4179
|
// src/commands/backlog/web/postDocsRefresh.ts
|
|
4175
4180
|
async function postDocsRefresh(req, res) {
|
|
4176
4181
|
applyCwdFromReq(req);
|
|
4182
|
+
if (docsRefreshAfter() === void 0) {
|
|
4183
|
+
respondJson(res, 409, {
|
|
4184
|
+
error: "Refresh docs is off for this repo; run `assist config set docs.refreshAfter <n>` to turn it on"
|
|
4185
|
+
});
|
|
4186
|
+
return;
|
|
4187
|
+
}
|
|
4177
4188
|
const { orm } = await getReady();
|
|
4178
4189
|
respondJson(res, 200, await requestDocsRefresh(orm, getOrigin()));
|
|
4179
4190
|
}
|
|
@@ -6291,7 +6302,7 @@ var backlogConfigHelp = [
|
|
|
6291
6302
|
{
|
|
6292
6303
|
key: "docs.refreshAfter",
|
|
6293
6304
|
setter: "assist config set docs.refreshAfter 5",
|
|
6294
|
-
note: "queue a 'Refresh docs' item once this many done stories are unswept (unset: off)"
|
|
6305
|
+
note: "queue a 'Refresh docs' item once this many done stories are unswept (unset: Refresh docs is off \u2014 no button, no refresh-docs, no docs locking)"
|
|
6295
6306
|
}
|
|
6296
6307
|
];
|
|
6297
6308
|
|
|
@@ -12980,7 +12991,7 @@ function unsetConfig(req, res) {
|
|
|
12980
12991
|
}
|
|
12981
12992
|
|
|
12982
12993
|
// src/commands/watch/isBuildPending.ts
|
|
12983
|
-
import { existsSync as
|
|
12994
|
+
import { existsSync as existsSync25 } from "fs";
|
|
12984
12995
|
|
|
12985
12996
|
// src/commands/watch/gitMarkerPath.ts
|
|
12986
12997
|
import { resolve as resolve11 } from "path";
|
|
@@ -13039,15 +13050,6 @@ function buildPendingPath(cwd) {
|
|
|
13039
13050
|
return gitMarkerPath("assist-watch-build-pending", cwd);
|
|
13040
13051
|
}
|
|
13041
13052
|
|
|
13042
|
-
// src/commands/watch/isBuildPending.ts
|
|
13043
|
-
function isBuildPending(cwd) {
|
|
13044
|
-
try {
|
|
13045
|
-
return existsSync24(buildPendingPath(cwd));
|
|
13046
|
-
} catch {
|
|
13047
|
-
return false;
|
|
13048
|
-
}
|
|
13049
|
-
}
|
|
13050
|
-
|
|
13051
13053
|
// src/commands/watch/readBuiltVersion.ts
|
|
13052
13054
|
import { join as join28 } from "path";
|
|
13053
13055
|
|
|
@@ -13105,6 +13107,36 @@ function readBuiltVersion(cwd) {
|
|
|
13105
13107
|
}
|
|
13106
13108
|
}
|
|
13107
13109
|
|
|
13110
|
+
// src/commands/watch/readDistVersion.ts
|
|
13111
|
+
import { readFileSync as readFileSync10 } from "fs";
|
|
13112
|
+
import { join as join29 } from "path";
|
|
13113
|
+
function readDistVersion(cwd) {
|
|
13114
|
+
try {
|
|
13115
|
+
const root2 = runGit3(["rev-parse", "--show-toplevel"], cwd);
|
|
13116
|
+
return readFileSync10(join29(root2, "dist", "built-version"), "utf8").trim();
|
|
13117
|
+
} catch {
|
|
13118
|
+
return void 0;
|
|
13119
|
+
}
|
|
13120
|
+
}
|
|
13121
|
+
|
|
13122
|
+
// src/commands/watch/isDistBehind.ts
|
|
13123
|
+
function isDistBehind(cwd) {
|
|
13124
|
+
const dist = readDistVersion(cwd);
|
|
13125
|
+
return dist !== void 0 && dist !== readBuiltVersion(cwd);
|
|
13126
|
+
}
|
|
13127
|
+
|
|
13128
|
+
// src/commands/watch/isBuildPending.ts
|
|
13129
|
+
function markedPending(cwd) {
|
|
13130
|
+
try {
|
|
13131
|
+
return existsSync25(buildPendingPath(cwd));
|
|
13132
|
+
} catch {
|
|
13133
|
+
return false;
|
|
13134
|
+
}
|
|
13135
|
+
}
|
|
13136
|
+
function isBuildPending(cwd) {
|
|
13137
|
+
return markedPending(cwd) || isDistBehind(cwd);
|
|
13138
|
+
}
|
|
13139
|
+
|
|
13108
13140
|
// src/commands/extension/extensionUpdateStatus.ts
|
|
13109
13141
|
import semver from "semver";
|
|
13110
13142
|
function extensionUpdateStatus(connected, latest2) {
|
|
@@ -13122,17 +13154,17 @@ function extensionUpdateStatus(connected, latest2) {
|
|
|
13122
13154
|
|
|
13123
13155
|
// src/commands/extension/fetchLatestSignedExtension.ts
|
|
13124
13156
|
import { readFile as readFile2 } from "fs/promises";
|
|
13125
|
-
import { join as
|
|
13157
|
+
import { join as join31 } from "path";
|
|
13126
13158
|
|
|
13127
13159
|
// src/commands/extension/extensionDir.ts
|
|
13128
13160
|
import { existsSync as existsSync26 } from "fs";
|
|
13129
|
-
import { dirname as dirname14, join as
|
|
13161
|
+
import { dirname as dirname14, join as join30 } from "path";
|
|
13130
13162
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
13131
13163
|
var moduleDir = dirname14(fileURLToPath2(import.meta.url));
|
|
13132
13164
|
function extensionDir() {
|
|
13133
|
-
const bundled =
|
|
13165
|
+
const bundled = join30(moduleDir, "commands", "extension", "extension");
|
|
13134
13166
|
if (existsSync26(bundled)) return bundled;
|
|
13135
|
-
return
|
|
13167
|
+
return join30(moduleDir, "..", "..", "..", "extension");
|
|
13136
13168
|
}
|
|
13137
13169
|
|
|
13138
13170
|
// src/commands/extension/latestUpdate.ts
|
|
@@ -13144,7 +13176,7 @@ function latestUpdate(manifest, updates2) {
|
|
|
13144
13176
|
// src/commands/extension/fetchLatestSignedExtension.ts
|
|
13145
13177
|
async function fetchLatestSignedExtension() {
|
|
13146
13178
|
const manifest = await readFile2(
|
|
13147
|
-
|
|
13179
|
+
join31(extensionDir(), "manifest.json"),
|
|
13148
13180
|
"utf8"
|
|
13149
13181
|
);
|
|
13150
13182
|
const updateUrl = JSON.parse(manifest).browser_specific_settings.gecko.update_url;
|
|
@@ -13218,7 +13250,7 @@ function stripAnsi(text20) {
|
|
|
13218
13250
|
// src/commands/sessions/daemon/worktree/watcherLogPath.ts
|
|
13219
13251
|
import { createHash } from "crypto";
|
|
13220
13252
|
import { homedir as homedir13 } from "os";
|
|
13221
|
-
import { basename as basename10, join as
|
|
13253
|
+
import { basename as basename10, join as join32 } from "path";
|
|
13222
13254
|
|
|
13223
13255
|
// src/commands/sessions/daemon/worktree/canonicalTreePath.ts
|
|
13224
13256
|
import { realpathSync } from "fs";
|
|
@@ -13235,8 +13267,8 @@ function canonicalTreePath(path109) {
|
|
|
13235
13267
|
function watcherLogPath(cwd) {
|
|
13236
13268
|
const clone = canonicalTreePath(cwd);
|
|
13237
13269
|
const key = createHash("sha1").update(clone).digest("hex").slice(0, 8);
|
|
13238
|
-
const dir = process.env.ASSIST_WATCHER_LOG_DIR ??
|
|
13239
|
-
return
|
|
13270
|
+
const dir = process.env.ASSIST_WATCHER_LOG_DIR ?? join32(homedir13(), ".assist", "watchers");
|
|
13271
|
+
return join32(dir, `${basename10(clone) || "root"}-${key}.log`);
|
|
13240
13272
|
}
|
|
13241
13273
|
|
|
13242
13274
|
// src/commands/sessions/web/updates/readUpdateHistory.ts
|
|
@@ -13365,7 +13397,7 @@ async function readRequestBuffer(req, limit) {
|
|
|
13365
13397
|
|
|
13366
13398
|
// src/commands/sessions/web/stageAttachment.ts
|
|
13367
13399
|
import { mkdir, mkdtemp, writeFile } from "fs/promises";
|
|
13368
|
-
import { extname as extname2, join as
|
|
13400
|
+
import { extname as extname2, join as join33 } from "path";
|
|
13369
13401
|
|
|
13370
13402
|
// src/commands/sessions/web/ghAttachableExtensions.ts
|
|
13371
13403
|
var ghAttachableExtensions = /* @__PURE__ */ new Set([
|
|
@@ -13397,9 +13429,9 @@ function safeBaseName(name) {
|
|
|
13397
13429
|
async function stageAttachment(name, contentType, body) {
|
|
13398
13430
|
const ext = pickExtension(name, contentType);
|
|
13399
13431
|
await mkdir(stagedAttachmentsDir, { recursive: true });
|
|
13400
|
-
const dir = await mkdtemp(
|
|
13432
|
+
const dir = await mkdtemp(join33(stagedAttachmentsDir, "upload-"));
|
|
13401
13433
|
const alt = safeBaseName(name);
|
|
13402
|
-
const filePath =
|
|
13434
|
+
const filePath = join33(dir, `${alt}.${ext}`);
|
|
13403
13435
|
await writeFile(filePath, body);
|
|
13404
13436
|
return { dir, filePath, alt };
|
|
13405
13437
|
}
|
|
@@ -13449,14 +13481,14 @@ import { readFile as readFile3, stat as stat3, writeFile as writeFile2 } from "f
|
|
|
13449
13481
|
// src/commands/sessions/web/formatWithOxfmt.ts
|
|
13450
13482
|
import { execFile as execFile9 } from "child_process";
|
|
13451
13483
|
import { existsSync as existsSync27 } from "fs";
|
|
13452
|
-
import { dirname as dirname15, join as
|
|
13484
|
+
import { dirname as dirname15, join as join34 } from "path";
|
|
13453
13485
|
import { promisify as promisify10 } from "util";
|
|
13454
13486
|
var execFileAsync9 = promisify10(execFile9);
|
|
13455
13487
|
var TIMEOUT_MS = 15e3;
|
|
13456
13488
|
function findOxfmtScript(root2) {
|
|
13457
13489
|
let dir = root2;
|
|
13458
13490
|
for (; ; ) {
|
|
13459
|
-
const candidate =
|
|
13491
|
+
const candidate = join34(dir, "node_modules", "oxfmt", "bin", "oxfmt");
|
|
13460
13492
|
if (existsSync27(candidate)) return candidate;
|
|
13461
13493
|
const parent = dirname15(dir);
|
|
13462
13494
|
if (parent === dir) return void 0;
|
|
@@ -13528,16 +13560,16 @@ async function writeFileContent(req, res) {
|
|
|
13528
13560
|
|
|
13529
13561
|
// src/shared/createBundleHandler.ts
|
|
13530
13562
|
import { createHash as createHash2 } from "crypto";
|
|
13531
|
-
import { readFileSync as
|
|
13532
|
-
import { dirname as dirname16, join as
|
|
13563
|
+
import { readFileSync as readFileSync11, statSync as statSync7 } from "fs";
|
|
13564
|
+
import { dirname as dirname16, join as join35 } from "path";
|
|
13533
13565
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
13534
13566
|
function createBundleHandler(importMetaUrl, bundlePath, contentType = "application/javascript") {
|
|
13535
|
-
const file =
|
|
13567
|
+
const file = join35(dirname16(fileURLToPath3(importMetaUrl)), bundlePath);
|
|
13536
13568
|
let cache7;
|
|
13537
13569
|
return (req, res) => {
|
|
13538
13570
|
const mtimeMs = statSync7(file).mtimeMs;
|
|
13539
13571
|
if (cache7?.mtimeMs !== mtimeMs) {
|
|
13540
|
-
const body =
|
|
13572
|
+
const body = readFileSync11(file);
|
|
13541
13573
|
const etag = `"${createHash2("sha256").update(body).digest("hex").slice(0, 16)}"`;
|
|
13542
13574
|
cache7 = { body, etag, mtimeMs };
|
|
13543
13575
|
}
|
|
@@ -13560,7 +13592,7 @@ function createBundleHandler(importMetaUrl, bundlePath, contentType = "applicati
|
|
|
13560
13592
|
|
|
13561
13593
|
// src/commands/sessions/web/createCssHandler.ts
|
|
13562
13594
|
import { createHash as createHash3 } from "crypto";
|
|
13563
|
-
import { readFileSync as
|
|
13595
|
+
import { readFileSync as readFileSync12 } from "fs";
|
|
13564
13596
|
import { createRequire } from "module";
|
|
13565
13597
|
var require2 = createRequire(import.meta.url);
|
|
13566
13598
|
function createCssHandler(packageEntry) {
|
|
@@ -13568,7 +13600,7 @@ function createCssHandler(packageEntry) {
|
|
|
13568
13600
|
return (req, res) => {
|
|
13569
13601
|
if (!cache7) {
|
|
13570
13602
|
const resolved = require2.resolve(packageEntry);
|
|
13571
|
-
const body =
|
|
13603
|
+
const body = readFileSync12(resolved, "utf8");
|
|
13572
13604
|
const etag = `"${createHash3("sha256").update(body).digest("hex").slice(0, 16)}"`;
|
|
13573
13605
|
cache7 = { body, etag };
|
|
13574
13606
|
}
|
|
@@ -14479,17 +14511,17 @@ import * as path16 from "path";
|
|
|
14479
14511
|
import chalk21 from "chalk";
|
|
14480
14512
|
|
|
14481
14513
|
// src/commands/verify/addToKnipIgnoreBinaries.ts
|
|
14482
|
-
import { existsSync as existsSync29, readFileSync as
|
|
14483
|
-
import { join as
|
|
14514
|
+
import { existsSync as existsSync29, readFileSync as readFileSync13, writeFileSync as writeFileSync7 } from "fs";
|
|
14515
|
+
import { join as join36 } from "path";
|
|
14484
14516
|
import chalk20 from "chalk";
|
|
14485
14517
|
function loadKnipConfig(knipJsonPath) {
|
|
14486
14518
|
if (existsSync29(knipJsonPath)) {
|
|
14487
|
-
return JSON.parse(
|
|
14519
|
+
return JSON.parse(readFileSync13(knipJsonPath, "utf8"));
|
|
14488
14520
|
}
|
|
14489
14521
|
return { $schema: "https://unpkg.com/knip@5/schema.json" };
|
|
14490
14522
|
}
|
|
14491
14523
|
function addToKnipIgnoreBinaries(cwd, binary) {
|
|
14492
|
-
const knipJsonPath =
|
|
14524
|
+
const knipJsonPath = join36(cwd, "knip.json");
|
|
14493
14525
|
try {
|
|
14494
14526
|
const knipConfig = loadKnipConfig(knipJsonPath);
|
|
14495
14527
|
const ignoreBinaries = knipConfig.ignoreBinaries ?? [];
|
|
@@ -14536,7 +14568,7 @@ import * as path18 from "path";
|
|
|
14536
14568
|
import chalk26 from "chalk";
|
|
14537
14569
|
|
|
14538
14570
|
// src/commands/format/init.ts
|
|
14539
|
-
import { existsSync as existsSync30, readFileSync as
|
|
14571
|
+
import { existsSync as existsSync30, readFileSync as readFileSync14, writeFileSync as writeFileSync8 } from "fs";
|
|
14540
14572
|
import chalk24 from "chalk";
|
|
14541
14573
|
|
|
14542
14574
|
// src/shared/promptConfirm.ts
|
|
@@ -14598,7 +14630,7 @@ async function init() {
|
|
|
14598
14630
|
const newContent = `${JSON.stringify(oxfmtrc_template_default, null, " ")}
|
|
14599
14631
|
`;
|
|
14600
14632
|
const configPath = ".oxfmtrc.json";
|
|
14601
|
-
const oldContent = existsSync30(configPath) ?
|
|
14633
|
+
const oldContent = existsSync30(configPath) ? readFileSync14(configPath, "utf8") : "";
|
|
14602
14634
|
if (oldContent === newContent) {
|
|
14603
14635
|
console.log(".oxfmtrc.json already has the baseline formatter config");
|
|
14604
14636
|
return;
|
|
@@ -14621,12 +14653,12 @@ async function init() {
|
|
|
14621
14653
|
}
|
|
14622
14654
|
|
|
14623
14655
|
// src/commands/lint/init.ts
|
|
14624
|
-
import { existsSync as existsSync33, readFileSync as
|
|
14656
|
+
import { existsSync as existsSync33, readFileSync as readFileSync16, writeFileSync as writeFileSync10 } from "fs";
|
|
14625
14657
|
import chalk25 from "chalk";
|
|
14626
14658
|
|
|
14627
14659
|
// src/shared/removeEslint.ts
|
|
14628
14660
|
import { execSync as execSync7 } from "child_process";
|
|
14629
|
-
import { existsSync as existsSync32, readFileSync as
|
|
14661
|
+
import { existsSync as existsSync32, readFileSync as readFileSync15, writeFileSync as writeFileSync9 } from "fs";
|
|
14630
14662
|
|
|
14631
14663
|
// src/shared/removeEslint/removeEslintConfigFiles.ts
|
|
14632
14664
|
import { existsSync as existsSync31, unlinkSync as unlinkSync2 } from "fs";
|
|
@@ -14670,7 +14702,7 @@ function removeEslintFromPackageJson(options2) {
|
|
|
14670
14702
|
if (!existsSync32(packageJsonPath)) {
|
|
14671
14703
|
return false;
|
|
14672
14704
|
}
|
|
14673
|
-
const packageJson = JSON.parse(
|
|
14705
|
+
const packageJson = JSON.parse(readFileSync15(packageJsonPath, "utf8"));
|
|
14674
14706
|
let modified = false;
|
|
14675
14707
|
modified = removeEslintDeps(packageJson.dependencies) || modified;
|
|
14676
14708
|
modified = removeEslintDeps(packageJson.devDependencies) || modified;
|
|
@@ -14734,7 +14766,7 @@ async function writeOxlintConfig() {
|
|
|
14734
14766
|
const newContent = `${JSON.stringify(oxlintrc_template_default, null, " ")}
|
|
14735
14767
|
`;
|
|
14736
14768
|
const configPath = ".oxlintrc.json";
|
|
14737
|
-
const oldContent = existsSync33(configPath) ?
|
|
14769
|
+
const oldContent = existsSync33(configPath) ? readFileSync16(configPath, "utf8") : "";
|
|
14738
14770
|
if (oldContent === newContent) {
|
|
14739
14771
|
console.log(".oxlintrc.json already has the baseline linter config");
|
|
14740
14772
|
return;
|
|
@@ -15515,7 +15547,7 @@ async function newCli() {
|
|
|
15515
15547
|
|
|
15516
15548
|
// src/commands/new/registerNew/newProject.ts
|
|
15517
15549
|
import { execSync as execSync14 } from "child_process";
|
|
15518
|
-
import { existsSync as existsSync38, readFileSync as
|
|
15550
|
+
import { existsSync as existsSync38, readFileSync as readFileSync20, writeFileSync as writeFileSync17 } from "fs";
|
|
15519
15551
|
|
|
15520
15552
|
// src/commands/deploy/init.ts
|
|
15521
15553
|
import { execSync as execSync13 } from "child_process";
|
|
@@ -15523,8 +15555,8 @@ import chalk36 from "chalk";
|
|
|
15523
15555
|
import enquirer3 from "enquirer";
|
|
15524
15556
|
|
|
15525
15557
|
// src/commands/deploy/init/updateWorkflow.ts
|
|
15526
|
-
import { existsSync as existsSync37, mkdirSync as mkdirSync9, readFileSync as
|
|
15527
|
-
import { dirname as dirname24, join as
|
|
15558
|
+
import { existsSync as existsSync37, mkdirSync as mkdirSync9, readFileSync as readFileSync19, writeFileSync as writeFileSync16 } from "fs";
|
|
15559
|
+
import { dirname as dirname24, join as join43 } from "path";
|
|
15528
15560
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
15529
15561
|
import chalk35 from "chalk";
|
|
15530
15562
|
var WORKFLOW_PATH = ".github/workflows/build.yml";
|
|
@@ -15533,13 +15565,13 @@ function getExistingSiteId() {
|
|
|
15533
15565
|
if (!existsSync37(WORKFLOW_PATH)) {
|
|
15534
15566
|
return null;
|
|
15535
15567
|
}
|
|
15536
|
-
const content =
|
|
15568
|
+
const content = readFileSync19(WORKFLOW_PATH, "utf8");
|
|
15537
15569
|
const match = content.match(/-s\s+([a-f0-9-]{36})/);
|
|
15538
15570
|
return match ? match[1] : null;
|
|
15539
15571
|
}
|
|
15540
15572
|
function getTemplateContent(siteId) {
|
|
15541
|
-
const templatePath =
|
|
15542
|
-
const template =
|
|
15573
|
+
const templatePath = join43(__dirname3, "commands/deploy/build.yml");
|
|
15574
|
+
const template = readFileSync19(templatePath, "utf8");
|
|
15543
15575
|
return template.replace("{{NETLIFY_SITE_ID}}", siteId);
|
|
15544
15576
|
}
|
|
15545
15577
|
async function updateWorkflow(siteId) {
|
|
@@ -15549,7 +15581,7 @@ async function updateWorkflow(siteId) {
|
|
|
15549
15581
|
mkdirSync9(workflowDir, { recursive: true });
|
|
15550
15582
|
}
|
|
15551
15583
|
if (existsSync37(WORKFLOW_PATH)) {
|
|
15552
|
-
const oldContent =
|
|
15584
|
+
const oldContent = readFileSync19(WORKFLOW_PATH, "utf8");
|
|
15553
15585
|
if (oldContent === newContent) {
|
|
15554
15586
|
console.log(chalk35.green("build.yml is already up to date"));
|
|
15555
15587
|
return;
|
|
@@ -15647,7 +15679,7 @@ function addViteBaseConfig() {
|
|
|
15647
15679
|
console.log("No vite.config.ts found, skipping base config");
|
|
15648
15680
|
return;
|
|
15649
15681
|
}
|
|
15650
|
-
const content =
|
|
15682
|
+
const content = readFileSync20(viteConfigPath, "utf8");
|
|
15651
15683
|
if (content.includes("base:")) {
|
|
15652
15684
|
console.log("vite.config.ts already has base config");
|
|
15653
15685
|
return;
|
|
@@ -15845,17 +15877,17 @@ function adviceContextFor(cwd, env = process.env) {
|
|
|
15845
15877
|
}
|
|
15846
15878
|
|
|
15847
15879
|
// src/commands/advise/loadAdviceFragments.ts
|
|
15848
|
-
import { readdirSync as readdirSync7, readFileSync as
|
|
15849
|
-
import { basename as basename12, join as
|
|
15880
|
+
import { readdirSync as readdirSync7, readFileSync as readFileSync21 } from "fs";
|
|
15881
|
+
import { basename as basename12, join as join45 } from "path";
|
|
15850
15882
|
|
|
15851
15883
|
// src/commands/advise/adviceDir.ts
|
|
15852
15884
|
import { existsSync as existsSync39 } from "fs";
|
|
15853
|
-
import { dirname as dirname25, join as
|
|
15885
|
+
import { dirname as dirname25, join as join44 } from "path";
|
|
15854
15886
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
15855
15887
|
function adviceDir() {
|
|
15856
15888
|
let current = dirname25(fileURLToPath5(import.meta.url));
|
|
15857
15889
|
while (current !== dirname25(current)) {
|
|
15858
|
-
const candidate =
|
|
15890
|
+
const candidate = join44(current, "claude", "advice");
|
|
15859
15891
|
if (existsSync39(candidate)) return candidate;
|
|
15860
15892
|
current = dirname25(current);
|
|
15861
15893
|
}
|
|
@@ -15888,7 +15920,7 @@ function loadAdviceFragments(dir = adviceDir()) {
|
|
|
15888
15920
|
return readdirSync7(dir).filter((file) => file.endsWith(".md")).sort().map(
|
|
15889
15921
|
(file) => parseAdviceFragment(
|
|
15890
15922
|
basename12(file, ".md"),
|
|
15891
|
-
|
|
15923
|
+
readFileSync21(join45(dir, file), "utf8")
|
|
15892
15924
|
)
|
|
15893
15925
|
);
|
|
15894
15926
|
}
|
|
@@ -15923,12 +15955,12 @@ function renderAdviceBody(fragment, context) {
|
|
|
15923
15955
|
|
|
15924
15956
|
// src/commands/advise/adviceConditions.ts
|
|
15925
15957
|
import { existsSync as existsSync40 } from "fs";
|
|
15926
|
-
import { join as
|
|
15958
|
+
import { join as join46 } from "path";
|
|
15927
15959
|
function repoFile(file, label) {
|
|
15928
15960
|
return {
|
|
15929
15961
|
whenMet: `the repo has ${label}`,
|
|
15930
15962
|
whenUnmet: `the repo has no ${label}`,
|
|
15931
|
-
matches: ({ rootDir }) => existsSync40(
|
|
15963
|
+
matches: ({ rootDir }) => existsSync40(join46(rootDir, file))
|
|
15932
15964
|
};
|
|
15933
15965
|
}
|
|
15934
15966
|
var adviceConditions = {
|
|
@@ -15954,11 +15986,11 @@ var adviceConditions = {
|
|
|
15954
15986
|
},
|
|
15955
15987
|
typescript: repoFile("tsconfig.json", "a tsconfig.json"),
|
|
15956
15988
|
filenameConvention: repoFile(
|
|
15957
|
-
|
|
15989
|
+
join46("oxlint-rules", "filenameConvention.ts"),
|
|
15958
15990
|
"oxlint-rules/filenameConvention.ts"
|
|
15959
15991
|
),
|
|
15960
15992
|
claudeSettings: repoFile(
|
|
15961
|
-
|
|
15993
|
+
join46("claude", "settings.json"),
|
|
15962
15994
|
"claude/settings.json"
|
|
15963
15995
|
),
|
|
15964
15996
|
verify: {
|
|
@@ -16566,7 +16598,7 @@ async function resolveCheckBump(check2) {
|
|
|
16566
16598
|
}
|
|
16567
16599
|
|
|
16568
16600
|
// src/commands/backlog/readJsonPayload.ts
|
|
16569
|
-
import { readFileSync as
|
|
16601
|
+
import { readFileSync as readFileSync22 } from "fs";
|
|
16570
16602
|
import chalk38 from "chalk";
|
|
16571
16603
|
function fail(message3) {
|
|
16572
16604
|
console.error(chalk38.red(message3));
|
|
@@ -16578,7 +16610,7 @@ function describe(error) {
|
|
|
16578
16610
|
async function readSource(source) {
|
|
16579
16611
|
try {
|
|
16580
16612
|
if (source === "-") return (await readStdinBuffer()).toString("utf8");
|
|
16581
|
-
return
|
|
16613
|
+
return readFileSync22(source, "utf8");
|
|
16582
16614
|
} catch (error) {
|
|
16583
16615
|
return fail(
|
|
16584
16616
|
`Cannot read the payload from ${source === "-" ? "stdin" : source}: ${describe(error)}`
|
|
@@ -16838,7 +16870,7 @@ function registerAskQuestion(program) {
|
|
|
16838
16870
|
|
|
16839
16871
|
// src/commands/registerBackup.ts
|
|
16840
16872
|
import { mkdir as mkdir3, stat as stat4 } from "fs/promises";
|
|
16841
|
-
import { join as
|
|
16873
|
+
import { join as join48, resolve as resolve16 } from "path";
|
|
16842
16874
|
import chalk41 from "chalk";
|
|
16843
16875
|
|
|
16844
16876
|
// src/shared/db/recordBackup.ts
|
|
@@ -16852,7 +16884,7 @@ async function recordBackup(db, {
|
|
|
16852
16884
|
|
|
16853
16885
|
// src/commands/backup/scheduleBackup.ts
|
|
16854
16886
|
import { mkdir as mkdir2 } from "fs/promises";
|
|
16855
|
-
import { join as
|
|
16887
|
+
import { join as join47 } from "path";
|
|
16856
16888
|
import chalk39 from "chalk";
|
|
16857
16889
|
|
|
16858
16890
|
// src/commands/backup/readCrontab.ts
|
|
@@ -16994,7 +17026,7 @@ async function scheduleBackup({
|
|
|
16994
17026
|
const cronExpr = durationToCron(every);
|
|
16995
17027
|
const dir = expandTilde(loadConfig().backup.dir);
|
|
16996
17028
|
await mkdir2(dir, { recursive: true });
|
|
16997
|
-
const logPath2 =
|
|
17029
|
+
const logPath2 = join47(dir, "cron.log");
|
|
16998
17030
|
const cronLine = `${cronExpr} ${resolveAssistCommand()} backup >> ${logPath2} 2>&1`;
|
|
16999
17031
|
writeCrontab(upsertScheduleBlock(readCrontab(), every, cronLine));
|
|
17000
17032
|
console.error(
|
|
@@ -17173,7 +17205,7 @@ async function backup({ out }) {
|
|
|
17173
17205
|
await mkdir3(dir, { recursive: true });
|
|
17174
17206
|
const start2 = Date.now();
|
|
17175
17207
|
const timestamp9 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
17176
|
-
const filePath = resolve16(
|
|
17208
|
+
const filePath = resolve16(join48(dir, `backup-${timestamp9}.dump`));
|
|
17177
17209
|
await exportBacklog(filePath);
|
|
17178
17210
|
const { size } = await stat4(filePath);
|
|
17179
17211
|
const durationMs = Date.now() - start2;
|
|
@@ -18069,9 +18101,9 @@ function ensureRemoteOrigin() {
|
|
|
18069
18101
|
|
|
18070
18102
|
// src/commands/backlog/add/shared.ts
|
|
18071
18103
|
import { spawnSync as spawnSync5 } from "child_process";
|
|
18072
|
-
import { mkdtempSync, readFileSync as
|
|
18104
|
+
import { mkdtempSync, readFileSync as readFileSync23, unlinkSync as unlinkSync3, writeFileSync as writeFileSync18 } from "fs";
|
|
18073
18105
|
import { tmpdir } from "os";
|
|
18074
|
-
import { join as
|
|
18106
|
+
import { join as join50 } from "path";
|
|
18075
18107
|
import enquirer4 from "enquirer";
|
|
18076
18108
|
async function promptType() {
|
|
18077
18109
|
const { type } = await enquirer4.prompt({
|
|
@@ -18111,15 +18143,15 @@ async function promptDescription() {
|
|
|
18111
18143
|
}
|
|
18112
18144
|
function openEditor() {
|
|
18113
18145
|
const editor = process.env.EDITOR || process.env.VISUAL || "vi";
|
|
18114
|
-
const dir = mkdtempSync(
|
|
18115
|
-
const filePath =
|
|
18146
|
+
const dir = mkdtempSync(join50(tmpdir(), "assist-"));
|
|
18147
|
+
const filePath = join50(dir, "description.md");
|
|
18116
18148
|
writeFileSync18(filePath, "");
|
|
18117
18149
|
const result = spawnSync5(editor, [filePath], { stdio: "inherit" });
|
|
18118
18150
|
if (result.status !== 0) {
|
|
18119
18151
|
unlinkSync3(filePath);
|
|
18120
18152
|
return void 0;
|
|
18121
18153
|
}
|
|
18122
|
-
const content =
|
|
18154
|
+
const content = readFileSync23(filePath, "utf8").trim();
|
|
18123
18155
|
unlinkSync3(filePath);
|
|
18124
18156
|
return content || void 0;
|
|
18125
18157
|
}
|
|
@@ -18546,11 +18578,11 @@ function startProposedRun(id) {
|
|
|
18546
18578
|
import { randomUUID as randomUUID9 } from "crypto";
|
|
18547
18579
|
|
|
18548
18580
|
// src/commands/backlog/propose/mutateLedger.ts
|
|
18549
|
-
import { mkdirSync as mkdirSync10, readFileSync as
|
|
18581
|
+
import { mkdirSync as mkdirSync10, readFileSync as readFileSync24, renameSync as renameSync4, writeFileSync as writeFileSync19 } from "fs";
|
|
18550
18582
|
import { dirname as dirname26 } from "path";
|
|
18551
18583
|
function readLedger(path109) {
|
|
18552
18584
|
try {
|
|
18553
|
-
const parsed = JSON.parse(
|
|
18585
|
+
const parsed = JSON.parse(readFileSync24(path109, "utf8"));
|
|
18554
18586
|
return { open: parsed.open ?? [], created: parsed.created };
|
|
18555
18587
|
} catch {
|
|
18556
18588
|
return { open: [] };
|
|
@@ -18590,9 +18622,9 @@ async function findPredecessor(path109, token, startedAt) {
|
|
|
18590
18622
|
|
|
18591
18623
|
// src/commands/backlog/propose/proposalLedgerPath.ts
|
|
18592
18624
|
import { homedir as homedir14 } from "os";
|
|
18593
|
-
import { join as
|
|
18625
|
+
import { join as join51 } from "path";
|
|
18594
18626
|
function proposalLedgerPath(sessionId2) {
|
|
18595
|
-
return
|
|
18627
|
+
return join51(homedir14(), ".assist", "proposals", `session-${sessionId2}.json`);
|
|
18596
18628
|
}
|
|
18597
18629
|
|
|
18598
18630
|
// src/commands/backlog/propose/trackProposal.ts
|
|
@@ -19087,12 +19119,12 @@ function hasLocalChanges() {
|
|
|
19087
19119
|
import {
|
|
19088
19120
|
existsSync as existsSync44,
|
|
19089
19121
|
mkdirSync as mkdirSync11,
|
|
19090
|
-
readFileSync as
|
|
19122
|
+
readFileSync as readFileSync26,
|
|
19091
19123
|
unlinkSync as unlinkSync4,
|
|
19092
19124
|
writeFileSync as writeFileSync20
|
|
19093
19125
|
} from "fs";
|
|
19094
19126
|
import { homedir as homedir15 } from "os";
|
|
19095
|
-
import { join as
|
|
19127
|
+
import { join as join52 } from "path";
|
|
19096
19128
|
|
|
19097
19129
|
// src/commands/backlog/bootedAt.ts
|
|
19098
19130
|
import { uptime } from "os";
|
|
@@ -19101,11 +19133,11 @@ function bootedAt() {
|
|
|
19101
19133
|
}
|
|
19102
19134
|
|
|
19103
19135
|
// src/commands/backlog/processStartedAt.ts
|
|
19104
|
-
import { readFileSync as
|
|
19136
|
+
import { readFileSync as readFileSync25 } from "fs";
|
|
19105
19137
|
var clockTicksPerSecond = 100;
|
|
19106
19138
|
function processStartedAt(pid) {
|
|
19107
19139
|
try {
|
|
19108
|
-
const stat5 =
|
|
19140
|
+
const stat5 = readFileSync25(`/proc/${pid}/stat`, "utf8");
|
|
19109
19141
|
const fields = stat5.slice(stat5.lastIndexOf(")") + 2).split(" ");
|
|
19110
19142
|
const ticks = Number(fields[19]);
|
|
19111
19143
|
if (!Number.isFinite(ticks)) return void 0;
|
|
@@ -19128,10 +19160,10 @@ function isStaleLock(pid, timestamp9) {
|
|
|
19128
19160
|
|
|
19129
19161
|
// src/commands/backlog/acquireLock.ts
|
|
19130
19162
|
function getLocksDir() {
|
|
19131
|
-
return
|
|
19163
|
+
return join52(homedir15(), ".assist", "locks");
|
|
19132
19164
|
}
|
|
19133
19165
|
function getLockPath(itemId2) {
|
|
19134
|
-
return
|
|
19166
|
+
return join52(getLocksDir(), `lock-${itemId2}.json`);
|
|
19135
19167
|
}
|
|
19136
19168
|
function isProcessAlive(pid) {
|
|
19137
19169
|
try {
|
|
@@ -19145,7 +19177,7 @@ function foreignLockHolder(itemId2) {
|
|
|
19145
19177
|
const lockPath = getLockPath(itemId2);
|
|
19146
19178
|
if (!existsSync44(lockPath)) return null;
|
|
19147
19179
|
try {
|
|
19148
|
-
const lock2 = JSON.parse(
|
|
19180
|
+
const lock2 = JSON.parse(readFileSync26(lockPath, "utf8"));
|
|
19149
19181
|
if (typeof lock2.pid !== "number" || lock2.pid === process.pid) return null;
|
|
19150
19182
|
if (!isProcessAlive(lock2.pid)) return null;
|
|
19151
19183
|
if (isStaleLock(lock2.pid, lock2.timestamp)) return null;
|
|
@@ -19630,12 +19662,12 @@ async function resumeDoneConversation({ item, resumeSessionId }, spawnOptions) {
|
|
|
19630
19662
|
// src/commands/backlog/consumePause.ts
|
|
19631
19663
|
import { existsSync as existsSync45, mkdirSync as mkdirSync13, unlinkSync as unlinkSync5, writeFileSync as writeFileSync22 } from "fs";
|
|
19632
19664
|
import { homedir as homedir16 } from "os";
|
|
19633
|
-
import { join as
|
|
19665
|
+
import { join as join53 } from "path";
|
|
19634
19666
|
function getControlsDir() {
|
|
19635
|
-
return
|
|
19667
|
+
return join53(homedir16(), ".assist", "controls");
|
|
19636
19668
|
}
|
|
19637
19669
|
function getPausePath(itemId2) {
|
|
19638
|
-
return
|
|
19670
|
+
return join53(getControlsDir(), `pause-${itemId2}.json`);
|
|
19639
19671
|
}
|
|
19640
19672
|
function requestPause(itemId2) {
|
|
19641
19673
|
mkdirSync13(getControlsDir(), { recursive: true });
|
|
@@ -19910,12 +19942,12 @@ function spawnHarness(harness, prompt, options2 = {}) {
|
|
|
19910
19942
|
import { existsSync as existsSync47, unwatchFile, watchFile } from "fs";
|
|
19911
19943
|
|
|
19912
19944
|
// src/commands/backlog/readSignal.ts
|
|
19913
|
-
import { existsSync as existsSync46, readFileSync as
|
|
19945
|
+
import { existsSync as existsSync46, readFileSync as readFileSync27 } from "fs";
|
|
19914
19946
|
function readSignal() {
|
|
19915
19947
|
const path109 = getSignalPath();
|
|
19916
19948
|
if (!path109 || !existsSync46(path109)) return void 0;
|
|
19917
19949
|
try {
|
|
19918
|
-
return JSON.parse(
|
|
19950
|
+
return JSON.parse(readFileSync27(path109, "utf8"));
|
|
19919
19951
|
} catch {
|
|
19920
19952
|
return void 0;
|
|
19921
19953
|
}
|
|
@@ -20091,9 +20123,9 @@ async function persistPhaseSessionId(itemId2, phaseIdx, claudeSessionId) {
|
|
|
20091
20123
|
}
|
|
20092
20124
|
|
|
20093
20125
|
// src/shared/emitActivity.ts
|
|
20094
|
-
import { mkdirSync as mkdirSync14, readFileSync as
|
|
20126
|
+
import { mkdirSync as mkdirSync14, readFileSync as readFileSync28, rmSync as rmSync4, writeFileSync as writeFileSync23 } from "fs";
|
|
20095
20127
|
import { homedir as homedir17 } from "os";
|
|
20096
|
-
import { dirname as dirname28, join as
|
|
20128
|
+
import { dirname as dirname28, join as join54 } from "path";
|
|
20097
20129
|
import { z as z17 } from "zod";
|
|
20098
20130
|
var activitySchema = z17.object({
|
|
20099
20131
|
kind: z17.enum(["command", "backlog"]),
|
|
@@ -20110,7 +20142,7 @@ var activitySchema = z17.object({
|
|
|
20110
20142
|
startedAt: z17.number()
|
|
20111
20143
|
});
|
|
20112
20144
|
function activityPath(sessionId2) {
|
|
20113
|
-
return
|
|
20145
|
+
return join54(homedir17(), ".assist", "activity", `activity-${sessionId2}.json`);
|
|
20114
20146
|
}
|
|
20115
20147
|
function emitActivity(activity2) {
|
|
20116
20148
|
const sessionId2 = process.env.ASSIST_ACTIVITY_ID;
|
|
@@ -20121,7 +20153,7 @@ function emitActivity(activity2) {
|
|
|
20121
20153
|
}
|
|
20122
20154
|
function readActivity(path109) {
|
|
20123
20155
|
try {
|
|
20124
|
-
return JSON.parse(
|
|
20156
|
+
return JSON.parse(readFileSync28(path109, "utf8"));
|
|
20125
20157
|
} catch {
|
|
20126
20158
|
return void 0;
|
|
20127
20159
|
}
|
|
@@ -20776,6 +20808,15 @@ function registerRefineCommand(cmd) {
|
|
|
20776
20808
|
// src/commands/backlog/refreshDocs.ts
|
|
20777
20809
|
import chalk88 from "chalk";
|
|
20778
20810
|
async function refreshDocs() {
|
|
20811
|
+
if (docsRefreshAfter() === void 0) {
|
|
20812
|
+
console.error(
|
|
20813
|
+
chalk88.red(
|
|
20814
|
+
"Refresh docs is off for this repo; run `assist config set docs.refreshAfter <n>` to turn it on"
|
|
20815
|
+
)
|
|
20816
|
+
);
|
|
20817
|
+
process.exitCode = 1;
|
|
20818
|
+
return;
|
|
20819
|
+
}
|
|
20779
20820
|
const { orm } = await getReady();
|
|
20780
20821
|
const result = await requestDocsRefresh(orm, getOrigin());
|
|
20781
20822
|
if (result.outcome === "created")
|
|
@@ -20794,7 +20835,7 @@ async function refreshDocs() {
|
|
|
20794
20835
|
// src/commands/backlog/registerRefreshDocsCommand.ts
|
|
20795
20836
|
function registerRefreshDocsCommand(cmd) {
|
|
20796
20837
|
cmd.command("refresh-docs").description(
|
|
20797
|
-
"Create a Refresh docs item now for every done story not yet swept,
|
|
20838
|
+
"Create a Refresh docs item now for every done story not yet swept, without waiting for docs.refreshAfter (refused when docs.refreshAfter is unset: Refresh docs is off)"
|
|
20798
20839
|
).action(refreshDocs);
|
|
20799
20840
|
}
|
|
20800
20841
|
|
|
@@ -22395,7 +22436,7 @@ function stripEnvPrefix(parts) {
|
|
|
22395
22436
|
}
|
|
22396
22437
|
|
|
22397
22438
|
// src/commands/cliHook/isGhGraphqlIssueMutation.ts
|
|
22398
|
-
import { readFileSync as
|
|
22439
|
+
import { readFileSync as readFileSync29 } from "fs";
|
|
22399
22440
|
var ISSUE_MUTATION = /\bmutation\b[\s\S]*(?:issue|comment|label|assign|reaction|milestone)/i;
|
|
22400
22441
|
var FILE_REFERENCE = /(?:=@|--input[\s=]+)["']?([^\s"';&|)]+)/g;
|
|
22401
22442
|
function isGhGraphqlIssueMutation(command) {
|
|
@@ -22407,7 +22448,7 @@ function isGhGraphqlIssueMutation(command) {
|
|
|
22407
22448
|
}
|
|
22408
22449
|
function readOrEmpty(path109) {
|
|
22409
22450
|
try {
|
|
22410
|
-
return
|
|
22451
|
+
return readFileSync29(path109, "utf8");
|
|
22411
22452
|
} catch {
|
|
22412
22453
|
return "";
|
|
22413
22454
|
}
|
|
@@ -22738,7 +22779,7 @@ function extractGraphqlQuery(args) {
|
|
|
22738
22779
|
}
|
|
22739
22780
|
|
|
22740
22781
|
// src/shared/loadCliReads.ts
|
|
22741
|
-
import { existsSync as existsSync49, readFileSync as
|
|
22782
|
+
import { existsSync as existsSync49, readFileSync as readFileSync30, writeFileSync as writeFileSync24 } from "fs";
|
|
22742
22783
|
import { dirname as dirname29, resolve as resolve18 } from "path";
|
|
22743
22784
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
22744
22785
|
var __filename3 = fileURLToPath6(import.meta.url);
|
|
@@ -22748,7 +22789,7 @@ function packageRoot() {
|
|
|
22748
22789
|
}
|
|
22749
22790
|
function readLines(path109) {
|
|
22750
22791
|
if (!existsSync49(path109)) return [];
|
|
22751
|
-
return
|
|
22792
|
+
return readFileSync30(path109, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
22752
22793
|
}
|
|
22753
22794
|
var cachedReads;
|
|
22754
22795
|
var cachedWrites;
|
|
@@ -22794,14 +22835,14 @@ function findCliWrite(command) {
|
|
|
22794
22835
|
}
|
|
22795
22836
|
|
|
22796
22837
|
// src/shared/readSettingsPerms.ts
|
|
22797
|
-
import { existsSync as existsSync50, readFileSync as
|
|
22838
|
+
import { existsSync as existsSync50, readFileSync as readFileSync31 } from "fs";
|
|
22798
22839
|
import { homedir as homedir18 } from "os";
|
|
22799
|
-
import { join as
|
|
22840
|
+
import { join as join55 } from "path";
|
|
22800
22841
|
function readSettingsPerms(key) {
|
|
22801
22842
|
const paths = [
|
|
22802
|
-
|
|
22803
|
-
|
|
22804
|
-
|
|
22843
|
+
join55(homedir18(), ".claude", "settings.json"),
|
|
22844
|
+
join55(process.cwd(), ".claude", "settings.json"),
|
|
22845
|
+
join55(process.cwd(), ".claude", "settings.local.json")
|
|
22805
22846
|
];
|
|
22806
22847
|
const entries = [];
|
|
22807
22848
|
for (const p of paths) {
|
|
@@ -22812,7 +22853,7 @@ function readSettingsPerms(key) {
|
|
|
22812
22853
|
function readPermissionArray(filePath, key) {
|
|
22813
22854
|
if (!existsSync50(filePath)) return [];
|
|
22814
22855
|
try {
|
|
22815
|
-
const data = JSON.parse(
|
|
22856
|
+
const data = JSON.parse(readFileSync31(filePath, "utf8"));
|
|
22816
22857
|
const arr = data?.permissions?.[key];
|
|
22817
22858
|
return Array.isArray(arr) ? arr.filter((e) => typeof e === "string") : [];
|
|
22818
22859
|
} catch {
|
|
@@ -23082,14 +23123,14 @@ function findDocsPathDeny(toolName, rawCommand, root2) {
|
|
|
23082
23123
|
}
|
|
23083
23124
|
|
|
23084
23125
|
// src/commands/schema/isSchemaPath.ts
|
|
23085
|
-
import { readFileSync as
|
|
23126
|
+
import { readFileSync as readFileSync32 } from "fs";
|
|
23086
23127
|
import { relative as relative7, resolve as resolve21 } from "path";
|
|
23087
23128
|
var SCHEMA_LOCK_REASON = "Database schema files (src/shared/db/migrations/migrationNNNN*.ts, src/shared/db/migrations.ts, src/shared/db/schema.ts and any src/shared/db/*.ts that defines a pgTable) are locked: a schema change needs the user's sign-off (see src/shared/db/CLAUDE.md). Confirm the schema change with the user first, then run `assist schema unlock` to request a PIN and wait for the user to confirm it with `assist schema confirm <pin>` before retrying. In a backlog item session the unlock lasts for the current phase; otherwise it lasts for this Claude session.";
|
|
23088
23129
|
var FIXED_SCHEMA_PATH = /^src\/shared\/db\/(?:migrations\/migration\d{4}[^/]*\.ts|migrations\.ts|schema\.ts)$/;
|
|
23089
23130
|
var DB_MODULE = /^src\/shared\/db\/[^/]+\.ts$/;
|
|
23090
23131
|
function readOrEmpty2(path109) {
|
|
23091
23132
|
try {
|
|
23092
|
-
return
|
|
23133
|
+
return readFileSync32(path109, "utf8");
|
|
23093
23134
|
} catch {
|
|
23094
23135
|
return "";
|
|
23095
23136
|
}
|
|
@@ -23158,11 +23199,11 @@ function findSchemaPathDeny(toolName, rawCommand, root2 = getProjectRoot()) {
|
|
|
23158
23199
|
// src/commands/cliHook/logDeniedToolCall.ts
|
|
23159
23200
|
import { mkdirSync as mkdirSync15 } from "fs";
|
|
23160
23201
|
import { homedir as homedir19 } from "os";
|
|
23161
|
-
import { join as
|
|
23202
|
+
import { join as join56 } from "path";
|
|
23162
23203
|
import Database from "better-sqlite3";
|
|
23163
23204
|
var _db;
|
|
23164
23205
|
function getDbDir() {
|
|
23165
|
-
return
|
|
23206
|
+
return join56(homedir19(), ".assist");
|
|
23166
23207
|
}
|
|
23167
23208
|
function initSchema(db) {
|
|
23168
23209
|
db.exec(`
|
|
@@ -23181,7 +23222,7 @@ function openPromptsDb(dir) {
|
|
|
23181
23222
|
if (_db) return _db;
|
|
23182
23223
|
const dbDir = dir ?? getDbDir();
|
|
23183
23224
|
mkdirSync15(dbDir, { recursive: true });
|
|
23184
|
-
const db = new Database(
|
|
23225
|
+
const db = new Database(join56(dbDir, "assist.db"));
|
|
23185
23226
|
db.pragma("journal_mode = WAL");
|
|
23186
23227
|
initSchema(db);
|
|
23187
23228
|
_db = db;
|
|
@@ -23248,26 +23289,26 @@ function tryParseInput(raw) {
|
|
|
23248
23289
|
import { existsSync as existsSync51 } from "fs";
|
|
23249
23290
|
|
|
23250
23291
|
// src/commands/schema/getSchemaSessionApprovalPath.ts
|
|
23251
|
-
import { join as
|
|
23292
|
+
import { join as join58 } from "path";
|
|
23252
23293
|
|
|
23253
23294
|
// src/commands/codeComment/getRestrictedDir.ts
|
|
23254
23295
|
import { homedir as homedir20 } from "os";
|
|
23255
|
-
import { join as
|
|
23296
|
+
import { join as join57 } from "path";
|
|
23256
23297
|
function getRestrictedDir() {
|
|
23257
|
-
return
|
|
23298
|
+
return join57(homedir20(), ".assist", "restricted");
|
|
23258
23299
|
}
|
|
23259
23300
|
function getPinStatePath(pin2) {
|
|
23260
|
-
return
|
|
23301
|
+
return join57(getRestrictedDir(), `code-comment-${pin2}.json`);
|
|
23261
23302
|
}
|
|
23262
23303
|
|
|
23263
23304
|
// src/commands/schema/getSchemaSessionApprovalPath.ts
|
|
23264
23305
|
var SESSION_ID = /^[\w-]+$/;
|
|
23265
23306
|
function getSchemaSessionApprovalDir() {
|
|
23266
|
-
return
|
|
23307
|
+
return join58(getRestrictedDir(), "schema-sessions");
|
|
23267
23308
|
}
|
|
23268
23309
|
function getSchemaSessionApprovalPath(claudeSessionId) {
|
|
23269
23310
|
if (!SESSION_ID.test(claudeSessionId)) return void 0;
|
|
23270
|
-
return
|
|
23311
|
+
return join58(getSchemaSessionApprovalDir(), `${claudeSessionId}.json`);
|
|
23271
23312
|
}
|
|
23272
23313
|
|
|
23273
23314
|
// src/commands/schema/isSchemaLocked.ts
|
|
@@ -23364,9 +23405,9 @@ ${reasons.join("\n")}`);
|
|
|
23364
23405
|
}
|
|
23365
23406
|
|
|
23366
23407
|
// src/commands/permitCliReads.ts
|
|
23367
|
-
import { existsSync as existsSync52, mkdirSync as mkdirSync16, readFileSync as
|
|
23408
|
+
import { existsSync as existsSync52, mkdirSync as mkdirSync16, readFileSync as readFileSync33, writeFileSync as writeFileSync25 } from "fs";
|
|
23368
23409
|
import { homedir as homedir21 } from "os";
|
|
23369
|
-
import { join as
|
|
23410
|
+
import { join as join59 } from "path";
|
|
23370
23411
|
|
|
23371
23412
|
// src/commands/permitCliReads/assertCliExists.ts
|
|
23372
23413
|
function assertCliExists(cli) {
|
|
@@ -23629,15 +23670,15 @@ function updateSettings(cli, commands) {
|
|
|
23629
23670
|
// src/commands/permitCliReads.ts
|
|
23630
23671
|
function logPath(cli) {
|
|
23631
23672
|
const safeName = cli.replace(/\s+/g, "-");
|
|
23632
|
-
return
|
|
23673
|
+
return join59(homedir21(), ".assist", `cli-discover-${safeName}.log`);
|
|
23633
23674
|
}
|
|
23634
23675
|
function readCache(cli) {
|
|
23635
23676
|
const path109 = logPath(cli);
|
|
23636
23677
|
if (!existsSync52(path109)) return void 0;
|
|
23637
|
-
return
|
|
23678
|
+
return readFileSync33(path109, "utf8");
|
|
23638
23679
|
}
|
|
23639
23680
|
function writeCache(cli, output) {
|
|
23640
|
-
const dir =
|
|
23681
|
+
const dir = join59(homedir21(), ".assist");
|
|
23641
23682
|
mkdirSync16(dir, { recursive: true });
|
|
23642
23683
|
writeFileSync25(logPath(cli), output);
|
|
23643
23684
|
}
|
|
@@ -23769,7 +23810,7 @@ function registerCliHook(program) {
|
|
|
23769
23810
|
}
|
|
23770
23811
|
|
|
23771
23812
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
23772
|
-
import { existsSync as existsSync54, readFileSync as
|
|
23813
|
+
import { existsSync as existsSync54, readFileSync as readFileSync35, unlinkSync as unlinkSync8, writeFileSync as writeFileSync26 } from "fs";
|
|
23773
23814
|
import chalk120 from "chalk";
|
|
23774
23815
|
|
|
23775
23816
|
// src/shared/isHashCommentFile.ts
|
|
@@ -23803,7 +23844,7 @@ function isHashCommentFile(filePath) {
|
|
|
23803
23844
|
|
|
23804
23845
|
// src/commands/codeComment/sweepRestrictedDir.ts
|
|
23805
23846
|
import { readdirSync as readdirSync9, statSync as statSync8, unlinkSync as unlinkSync7 } from "fs";
|
|
23806
|
-
import { join as
|
|
23847
|
+
import { join as join60 } from "path";
|
|
23807
23848
|
var STALE_AFTER_MS = 30 * 60 * 1e3;
|
|
23808
23849
|
function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
23809
23850
|
let entries;
|
|
@@ -23814,7 +23855,7 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
23814
23855
|
}
|
|
23815
23856
|
const cutoff = Date.now() - STALE_AFTER_MS;
|
|
23816
23857
|
for (const entry of entries) {
|
|
23817
|
-
const path109 =
|
|
23858
|
+
const path109 = join60(dir, entry);
|
|
23818
23859
|
try {
|
|
23819
23860
|
if (statSync8(path109).mtimeMs < cutoff) unlinkSync7(path109);
|
|
23820
23861
|
} catch {
|
|
@@ -23824,12 +23865,12 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
23824
23865
|
}
|
|
23825
23866
|
|
|
23826
23867
|
// src/commands/codeComment/readPinState.ts
|
|
23827
|
-
import { existsSync as existsSync53, readFileSync as
|
|
23868
|
+
import { existsSync as existsSync53, readFileSync as readFileSync34 } from "fs";
|
|
23828
23869
|
function readPinState(pin2) {
|
|
23829
23870
|
const path109 = getPinStatePath(pin2);
|
|
23830
23871
|
if (!existsSync53(path109)) return void 0;
|
|
23831
23872
|
try {
|
|
23832
|
-
const state = JSON.parse(
|
|
23873
|
+
const state = JSON.parse(readFileSync34(path109, "utf8"));
|
|
23833
23874
|
if (state.pin !== pin2) return void 0;
|
|
23834
23875
|
return state;
|
|
23835
23876
|
} catch {
|
|
@@ -23851,7 +23892,7 @@ function codeCommentConfirm(pin2) {
|
|
|
23851
23892
|
process.exitCode = 1;
|
|
23852
23893
|
return;
|
|
23853
23894
|
}
|
|
23854
|
-
const original =
|
|
23895
|
+
const original = readFileSync35(state.file, "utf8");
|
|
23855
23896
|
const lines2 = original.split("\n");
|
|
23856
23897
|
const index3 = state.line - 1;
|
|
23857
23898
|
if (index3 > lines2.length) {
|
|
@@ -26031,7 +26072,7 @@ async function browserInspect(selector, options2) {
|
|
|
26031
26072
|
}
|
|
26032
26073
|
|
|
26033
26074
|
// src/commands/browser/browserRun.ts
|
|
26034
|
-
import { readFileSync as
|
|
26075
|
+
import { readFileSync as readFileSync36 } from "fs";
|
|
26035
26076
|
import chalk149 from "chalk";
|
|
26036
26077
|
|
|
26037
26078
|
// src/commands/browser/formatRunOutcome.ts
|
|
@@ -26051,7 +26092,7 @@ function formatRunOutcome(run4) {
|
|
|
26051
26092
|
async function browserRun(options2) {
|
|
26052
26093
|
let code;
|
|
26053
26094
|
try {
|
|
26054
|
-
code =
|
|
26095
|
+
code = readFileSync36(options2.file, "utf8");
|
|
26055
26096
|
} catch (error) {
|
|
26056
26097
|
console.error(
|
|
26057
26098
|
chalk149.red(
|
|
@@ -26081,11 +26122,11 @@ import { dirname as dirname30 } from "path";
|
|
|
26081
26122
|
|
|
26082
26123
|
// src/commands/browser/snapshotPath.ts
|
|
26083
26124
|
import { homedir as homedir22 } from "os";
|
|
26084
|
-
import { join as
|
|
26125
|
+
import { join as join61 } from "path";
|
|
26085
26126
|
function snapshotPath(tabUrl, now) {
|
|
26086
26127
|
const host = new URL(tabUrl).host.replace(/[^\w.-]/g, "-");
|
|
26087
26128
|
const timestamp9 = now.toISOString().replace(/[:.]/g, "-");
|
|
26088
|
-
return
|
|
26129
|
+
return join61(homedir22(), ".assist", "browser", `${host}-${timestamp9}.html`);
|
|
26089
26130
|
}
|
|
26090
26131
|
|
|
26091
26132
|
// src/commands/browser/browserSnapshot.ts
|
|
@@ -26292,15 +26333,15 @@ async function printExtensionUrl() {
|
|
|
26292
26333
|
// src/commands/extension/signExtension.ts
|
|
26293
26334
|
import { rm as rm2 } from "fs/promises";
|
|
26294
26335
|
import { homedir as homedir23, tmpdir as tmpdir3 } from "os";
|
|
26295
|
-
import { join as
|
|
26336
|
+
import { join as join67 } from "path";
|
|
26296
26337
|
import chalk154 from "chalk";
|
|
26297
26338
|
|
|
26298
26339
|
// src/commands/extension/copySignedXpi.ts
|
|
26299
26340
|
import { copyFile } from "fs/promises";
|
|
26300
|
-
import { join as
|
|
26341
|
+
import { join as join62 } from "path";
|
|
26301
26342
|
var SIGNED_XPI_NAME = "assist-extension.xpi";
|
|
26302
26343
|
async function copySignedXpi(xpi, dir) {
|
|
26303
|
-
const fixed2 =
|
|
26344
|
+
const fixed2 = join62(dir, SIGNED_XPI_NAME);
|
|
26304
26345
|
if (fixed2 === xpi) return fixed2;
|
|
26305
26346
|
await copyFile(xpi, fixed2);
|
|
26306
26347
|
return fixed2;
|
|
@@ -26309,11 +26350,11 @@ async function copySignedXpi(xpi, dir) {
|
|
|
26309
26350
|
// src/commands/extension/findSignedXpi.ts
|
|
26310
26351
|
import { existsSync as existsSync55 } from "fs";
|
|
26311
26352
|
import { readdir } from "fs/promises";
|
|
26312
|
-
import { join as
|
|
26353
|
+
import { join as join63 } from "path";
|
|
26313
26354
|
async function findSignedXpi(dir) {
|
|
26314
26355
|
if (!existsSync55(dir)) return null;
|
|
26315
26356
|
const name = (await readdir(dir)).find((entry) => entry.endsWith(".xpi"));
|
|
26316
|
-
return name ?
|
|
26357
|
+
return name ? join63(dir, name) : null;
|
|
26317
26358
|
}
|
|
26318
26359
|
|
|
26319
26360
|
// src/commands/extension/signedAddonInstallPath.ts
|
|
@@ -26336,10 +26377,10 @@ async function signedAddonInstallPath(xpi) {
|
|
|
26336
26377
|
|
|
26337
26378
|
// src/commands/extension/signPreflightProblem.ts
|
|
26338
26379
|
import { existsSync as existsSync56 } from "fs";
|
|
26339
|
-
import { join as
|
|
26380
|
+
import { join as join64 } from "path";
|
|
26340
26381
|
var KEY_URL = "https://addons.mozilla.org/en-US/developers/addon/api/key/";
|
|
26341
26382
|
function signPreflightProblem(source) {
|
|
26342
|
-
if (!existsSync56(
|
|
26383
|
+
if (!existsSync56(join64(source, "content.js")))
|
|
26343
26384
|
return {
|
|
26344
26385
|
message: `no content.js in ${source}`,
|
|
26345
26386
|
hint: "run npm run build to bundle the content script"
|
|
@@ -26354,7 +26395,7 @@ function signPreflightProblem(source) {
|
|
|
26354
26395
|
|
|
26355
26396
|
// src/commands/extension/stageExtension.ts
|
|
26356
26397
|
import { cp as cp3, mkdir as mkdir5, readFile as readFile5, rm, writeFile as writeFile4 } from "fs/promises";
|
|
26357
|
-
import { basename as basename16, join as
|
|
26398
|
+
import { basename as basename16, join as join65 } from "path";
|
|
26358
26399
|
|
|
26359
26400
|
// src/commands/extension/stampManifestVersion.ts
|
|
26360
26401
|
function stampManifestVersion(manifest, version2) {
|
|
@@ -26371,7 +26412,7 @@ async function stageExtension(source, staging, version2) {
|
|
|
26371
26412
|
recursive: true,
|
|
26372
26413
|
filter: (path109) => basename16(path109) !== "updates.json"
|
|
26373
26414
|
});
|
|
26374
|
-
const manifest =
|
|
26415
|
+
const manifest = join65(staging, "manifest.json");
|
|
26375
26416
|
const stamped = stampManifestVersion(
|
|
26376
26417
|
await readFile5(manifest, "utf8"),
|
|
26377
26418
|
version2
|
|
@@ -26381,7 +26422,7 @@ async function stageExtension(source, staging, version2) {
|
|
|
26381
26422
|
|
|
26382
26423
|
// src/commands/extension/writeUpdateManifest.ts
|
|
26383
26424
|
import { readFile as readFile6, writeFile as writeFile5 } from "fs/promises";
|
|
26384
|
-
import { join as
|
|
26425
|
+
import { join as join66 } from "path";
|
|
26385
26426
|
|
|
26386
26427
|
// src/commands/extension/buildUpdateManifest.ts
|
|
26387
26428
|
var RELEASE_DOWNLOAD_URL = "https://github.com/staff0rd/assist/releases/download";
|
|
@@ -26406,17 +26447,17 @@ function buildUpdateManifest(manifest, version2) {
|
|
|
26406
26447
|
// src/commands/extension/writeUpdateManifest.ts
|
|
26407
26448
|
async function writeUpdateManifest(source, dir, version2) {
|
|
26408
26449
|
await writeFile5(
|
|
26409
|
-
|
|
26450
|
+
join66(dir, "updates.json"),
|
|
26410
26451
|
buildUpdateManifest(
|
|
26411
|
-
await readFile6(
|
|
26452
|
+
await readFile6(join66(source, "manifest.json"), "utf8"),
|
|
26412
26453
|
version2
|
|
26413
26454
|
)
|
|
26414
26455
|
);
|
|
26415
26456
|
}
|
|
26416
26457
|
|
|
26417
26458
|
// src/commands/extension/signExtension.ts
|
|
26418
|
-
var ARTIFACTS_DIR =
|
|
26419
|
-
var STAGING_DIR =
|
|
26459
|
+
var ARTIFACTS_DIR = join67(homedir23(), ".assist", "extension");
|
|
26460
|
+
var STAGING_DIR = join67(tmpdir3(), "assist-extension");
|
|
26420
26461
|
async function signExtension() {
|
|
26421
26462
|
const source = extensionDir();
|
|
26422
26463
|
const problem = signPreflightProblem(source);
|
|
@@ -26600,7 +26641,7 @@ function registerDb(program) {
|
|
|
26600
26641
|
}
|
|
26601
26642
|
|
|
26602
26643
|
// src/commands/deploy/redirect.ts
|
|
26603
|
-
import { existsSync as existsSync57, readFileSync as
|
|
26644
|
+
import { existsSync as existsSync57, readFileSync as readFileSync37, writeFileSync as writeFileSync29 } from "fs";
|
|
26604
26645
|
import chalk157 from "chalk";
|
|
26605
26646
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
26606
26647
|
if (!window.location.pathname.endsWith('/')) {
|
|
@@ -26613,7 +26654,7 @@ function redirect() {
|
|
|
26613
26654
|
console.log(chalk157.yellow("No index.html found"));
|
|
26614
26655
|
return;
|
|
26615
26656
|
}
|
|
26616
|
-
const content =
|
|
26657
|
+
const content = readFileSync37(indexPath, "utf8");
|
|
26617
26658
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
26618
26659
|
console.log(chalk157.dim("Trailing slash script already present"));
|
|
26619
26660
|
return;
|
|
@@ -26704,22 +26745,22 @@ function printWeekHeader(week, state) {
|
|
|
26704
26745
|
}
|
|
26705
26746
|
|
|
26706
26747
|
// src/commands/devlog/loadDevEntry.ts
|
|
26707
|
-
import { readFileSync as
|
|
26708
|
-
import { join as
|
|
26748
|
+
import { readFileSync as readFileSync38 } from "fs";
|
|
26749
|
+
import { join as join68 } from "path";
|
|
26709
26750
|
import { parse as parseYaml3 } from "yaml";
|
|
26710
26751
|
function asString(value) {
|
|
26711
26752
|
return value === void 0 || value === null ? null : String(value);
|
|
26712
26753
|
}
|
|
26713
26754
|
function readFrontmatter(path109) {
|
|
26714
26755
|
try {
|
|
26715
|
-
const match =
|
|
26756
|
+
const match = readFileSync38(path109, "utf8").match(/^---\n([\s\S]*?)\n---/);
|
|
26716
26757
|
return match ? parseYaml3(match[1]) ?? {} : null;
|
|
26717
26758
|
} catch {
|
|
26718
26759
|
return null;
|
|
26719
26760
|
}
|
|
26720
26761
|
}
|
|
26721
26762
|
function loadDevEntry(repoName, week, devDir) {
|
|
26722
|
-
const path109 =
|
|
26763
|
+
const path109 = join68(devDir, repoName, `${week.toLowerCase()}.md`);
|
|
26723
26764
|
const frontmatter2 = readFrontmatter(path109);
|
|
26724
26765
|
if (!frontmatter2) return null;
|
|
26725
26766
|
const versions = frontmatter2.versions;
|
|
@@ -26815,17 +26856,17 @@ function findTargetWeek(weeks, { lastWeek, skip: skip3, today }) {
|
|
|
26815
26856
|
import chalk160 from "chalk";
|
|
26816
26857
|
|
|
26817
26858
|
// src/shared/getRepoName.ts
|
|
26818
|
-
import { existsSync as existsSync58, readFileSync as
|
|
26819
|
-
import { basename as basename17, join as
|
|
26859
|
+
import { existsSync as existsSync58, readFileSync as readFileSync39 } from "fs";
|
|
26860
|
+
import { basename as basename17, join as join69 } from "path";
|
|
26820
26861
|
function getRepoName() {
|
|
26821
26862
|
const config = loadConfig();
|
|
26822
26863
|
if (config.devlog?.name) {
|
|
26823
26864
|
return config.devlog.name;
|
|
26824
26865
|
}
|
|
26825
|
-
const packageJsonPath =
|
|
26866
|
+
const packageJsonPath = join69(process.cwd(), "package.json");
|
|
26826
26867
|
if (existsSync58(packageJsonPath)) {
|
|
26827
26868
|
try {
|
|
26828
|
-
const content =
|
|
26869
|
+
const content = readFileSync39(packageJsonPath, "utf8");
|
|
26829
26870
|
const pkg = JSON.parse(content);
|
|
26830
26871
|
if (pkg.name) {
|
|
26831
26872
|
return pkg.name;
|
|
@@ -26901,7 +26942,7 @@ function list2(options2) {
|
|
|
26901
26942
|
|
|
26902
26943
|
// src/commands/devlog/loadDevWeeks.ts
|
|
26903
26944
|
import { readdirSync as readdirSync10 } from "fs";
|
|
26904
|
-
import { join as
|
|
26945
|
+
import { join as join70 } from "path";
|
|
26905
26946
|
var DEV_FILENAME_PATTERN = /^(\d{4})-w(\d{2})\.md$/;
|
|
26906
26947
|
function parseDevWeekFilename(filename) {
|
|
26907
26948
|
const match = filename.match(DEV_FILENAME_PATTERN);
|
|
@@ -26915,7 +26956,7 @@ function readFilenames(dir) {
|
|
|
26915
26956
|
}
|
|
26916
26957
|
}
|
|
26917
26958
|
function loadDevWeeks(repoName, devDir) {
|
|
26918
|
-
return readFilenames(
|
|
26959
|
+
return readFilenames(join70(devDir, repoName)).map(parseDevWeekFilename).filter((week) => week !== null).sort();
|
|
26919
26960
|
}
|
|
26920
26961
|
|
|
26921
26962
|
// src/commands/devlog/next/displayNextEntry.ts
|
|
@@ -27070,7 +27111,7 @@ async function skip2(week, cwd = process.cwd()) {
|
|
|
27070
27111
|
|
|
27071
27112
|
// src/commands/devlog/write.ts
|
|
27072
27113
|
import { mkdirSync as mkdirSync19, writeFileSync as writeFileSync30 } from "fs";
|
|
27073
|
-
import { dirname as dirname31, join as
|
|
27114
|
+
import { dirname as dirname31, join as join71 } from "path";
|
|
27074
27115
|
import chalk164 from "chalk";
|
|
27075
27116
|
|
|
27076
27117
|
// src/commands/devlog/write/devEntryInputSchema.ts
|
|
@@ -27163,7 +27204,7 @@ async function write() {
|
|
|
27163
27204
|
}
|
|
27164
27205
|
const devDir = resolveDevDir();
|
|
27165
27206
|
const repoName = getRepoName();
|
|
27166
|
-
const path109 =
|
|
27207
|
+
const path109 = join71(devDir, repoName, `${result.data.week.toLowerCase()}.md`);
|
|
27167
27208
|
mkdirSync19(dirname31(path109), { recursive: true });
|
|
27168
27209
|
writeFileSync30(path109, formatDevEntry(repoName, result.data));
|
|
27169
27210
|
console.log(chalk164.green(`Wrote ${path109}`));
|
|
@@ -27351,13 +27392,13 @@ async function findPhaseUnlockItem(itemId2, phase) {
|
|
|
27351
27392
|
}
|
|
27352
27393
|
|
|
27353
27394
|
// src/commands/docs/getDocsUnlockPinPath.ts
|
|
27354
|
-
import { join as
|
|
27395
|
+
import { join as join72 } from "path";
|
|
27355
27396
|
function getDocsUnlockPinPath(pin2) {
|
|
27356
|
-
return
|
|
27397
|
+
return join72(getRestrictedDir(), `docs-unlock-pin-${pin2}.json`);
|
|
27357
27398
|
}
|
|
27358
27399
|
|
|
27359
27400
|
// src/commands/docs/readDocsUnlockPinState.ts
|
|
27360
|
-
import { existsSync as existsSync59, readFileSync as
|
|
27401
|
+
import { existsSync as existsSync59, readFileSync as readFileSync40 } from "fs";
|
|
27361
27402
|
function isPositiveInteger(value) {
|
|
27362
27403
|
return Number.isInteger(value) && value > 0;
|
|
27363
27404
|
}
|
|
@@ -27365,7 +27406,7 @@ function readDocsUnlockPinState(pin2) {
|
|
|
27365
27406
|
const path109 = getDocsUnlockPinPath(pin2);
|
|
27366
27407
|
if (!existsSync59(path109)) return void 0;
|
|
27367
27408
|
try {
|
|
27368
|
-
const state = JSON.parse(
|
|
27409
|
+
const state = JSON.parse(readFileSync40(path109, "utf8"));
|
|
27369
27410
|
if (state.pin !== pin2) return void 0;
|
|
27370
27411
|
if (!isPositiveInteger(state.itemId)) return void 0;
|
|
27371
27412
|
if (!isPositiveInteger(state.phase)) return void 0;
|
|
@@ -27501,13 +27542,13 @@ import { mkdirSync as mkdirSync21, unlinkSync as unlinkSync11, writeFileSync as
|
|
|
27501
27542
|
import chalk170 from "chalk";
|
|
27502
27543
|
|
|
27503
27544
|
// src/commands/schema/getSchemaUnlockPinPath.ts
|
|
27504
|
-
import { join as
|
|
27545
|
+
import { join as join73 } from "path";
|
|
27505
27546
|
function getSchemaUnlockPinPath(pin2) {
|
|
27506
|
-
return
|
|
27547
|
+
return join73(getRestrictedDir(), `schema-unlock-pin-${pin2}.json`);
|
|
27507
27548
|
}
|
|
27508
27549
|
|
|
27509
27550
|
// src/commands/schema/readSchemaUnlockPinState.ts
|
|
27510
|
-
import { existsSync as existsSync60, readFileSync as
|
|
27551
|
+
import { existsSync as existsSync60, readFileSync as readFileSync41 } from "fs";
|
|
27511
27552
|
function isPositiveInteger2(value) {
|
|
27512
27553
|
return Number.isInteger(value) && value > 0;
|
|
27513
27554
|
}
|
|
@@ -27523,7 +27564,7 @@ function readSchemaUnlockPinState(pin2) {
|
|
|
27523
27564
|
const path109 = getSchemaUnlockPinPath(pin2);
|
|
27524
27565
|
if (!existsSync60(path109)) return void 0;
|
|
27525
27566
|
try {
|
|
27526
|
-
const raw = JSON.parse(
|
|
27567
|
+
const raw = JSON.parse(readFileSync41(path109, "utf8"));
|
|
27527
27568
|
if (raw.pin !== pin2) return void 0;
|
|
27528
27569
|
return toState(raw);
|
|
27529
27570
|
} catch {
|
|
@@ -27646,7 +27687,7 @@ function registerSchema(parent) {
|
|
|
27646
27687
|
|
|
27647
27688
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
27648
27689
|
import { closeSync as closeSync5, openSync as openSync6, readdirSync as readdirSync12 } from "fs";
|
|
27649
|
-
import { join as
|
|
27690
|
+
import { join as join74 } from "path";
|
|
27650
27691
|
import chalk172 from "chalk";
|
|
27651
27692
|
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "packages"]);
|
|
27652
27693
|
function isLockedDll(debugDir) {
|
|
@@ -27658,7 +27699,7 @@ function isLockedDll(debugDir) {
|
|
|
27658
27699
|
}
|
|
27659
27700
|
for (const file of files) {
|
|
27660
27701
|
if (!file.toLowerCase().endsWith(".dll")) continue;
|
|
27661
|
-
const dllPath =
|
|
27702
|
+
const dllPath = join74(debugDir, file);
|
|
27662
27703
|
try {
|
|
27663
27704
|
const fd = openSync6(dllPath, "r+");
|
|
27664
27705
|
closeSync5(fd);
|
|
@@ -27676,13 +27717,13 @@ function findFirstLockedDll(dir) {
|
|
|
27676
27717
|
return null;
|
|
27677
27718
|
}
|
|
27678
27719
|
if (entries.includes("bin")) {
|
|
27679
|
-
const locked = isLockedDll(
|
|
27720
|
+
const locked = isLockedDll(join74(dir, "bin", "Debug"));
|
|
27680
27721
|
if (locked) return locked;
|
|
27681
27722
|
}
|
|
27682
27723
|
for (const entry of entries) {
|
|
27683
27724
|
if (SKIP_DIRS.has(entry) || entry === "bin" || entry.startsWith("."))
|
|
27684
27725
|
continue;
|
|
27685
|
-
const found = findFirstLockedDll(
|
|
27726
|
+
const found = findFirstLockedDll(join74(dir, entry));
|
|
27686
27727
|
if (found) return found;
|
|
27687
27728
|
}
|
|
27688
27729
|
return null;
|
|
@@ -27705,11 +27746,11 @@ async function checkBuildLocksCommand() {
|
|
|
27705
27746
|
}
|
|
27706
27747
|
|
|
27707
27748
|
// src/commands/dotnet/buildTree.ts
|
|
27708
|
-
import { readFileSync as
|
|
27749
|
+
import { readFileSync as readFileSync42 } from "fs";
|
|
27709
27750
|
import path36 from "path";
|
|
27710
27751
|
var PROJECT_REF_RE = /<ProjectReference\s+Include="([^"]+)"/g;
|
|
27711
27752
|
function getProjectRefs(csprojPath) {
|
|
27712
|
-
const content =
|
|
27753
|
+
const content = readFileSync42(csprojPath, "utf8");
|
|
27713
27754
|
const refs = [];
|
|
27714
27755
|
for (const match of content.matchAll(PROJECT_REF_RE)) {
|
|
27715
27756
|
refs.push(match[1].replace(/\\/g, "/"));
|
|
@@ -27726,7 +27767,7 @@ function buildTree(csprojPath, repoRoot2, visited = /* @__PURE__ */ new Set()) {
|
|
|
27726
27767
|
for (const ref of getProjectRefs(abs)) {
|
|
27727
27768
|
const childAbs = path36.resolve(dir, ref);
|
|
27728
27769
|
try {
|
|
27729
|
-
|
|
27770
|
+
readFileSync42(childAbs);
|
|
27730
27771
|
node.children.push(buildTree(childAbs, repoRoot2, visited));
|
|
27731
27772
|
} catch {
|
|
27732
27773
|
node.children.push({
|
|
@@ -27751,7 +27792,7 @@ function collectAllDeps(node) {
|
|
|
27751
27792
|
}
|
|
27752
27793
|
|
|
27753
27794
|
// src/commands/dotnet/findContainingSolutions.ts
|
|
27754
|
-
import { readdirSync as readdirSync13, readFileSync as
|
|
27795
|
+
import { readdirSync as readdirSync13, readFileSync as readFileSync43, statSync as statSync9 } from "fs";
|
|
27755
27796
|
import path37 from "path";
|
|
27756
27797
|
function findSlnFiles(dir, maxDepth, depth = 0) {
|
|
27757
27798
|
if (depth > maxDepth) return [];
|
|
@@ -27786,7 +27827,7 @@ function findContainingSolutions(csprojPath, repoRoot2) {
|
|
|
27786
27827
|
const pattern2 = new RegExp(`[\\\\"/]${escapeRegex(csprojBasename)}"`);
|
|
27787
27828
|
for (const sln of slnFiles) {
|
|
27788
27829
|
try {
|
|
27789
|
-
const content =
|
|
27830
|
+
const content = readFileSync43(sln, "utf8");
|
|
27790
27831
|
if (pattern2.test(content)) {
|
|
27791
27832
|
matches.push(path37.relative(repoRoot2, sln));
|
|
27792
27833
|
}
|
|
@@ -28029,11 +28070,11 @@ import chalk178 from "chalk";
|
|
|
28029
28070
|
|
|
28030
28071
|
// src/commands/dotnet/findSolution.ts
|
|
28031
28072
|
import { readdirSync as readdirSync14 } from "fs";
|
|
28032
|
-
import { dirname as dirname32, join as
|
|
28073
|
+
import { dirname as dirname32, join as join75 } from "path";
|
|
28033
28074
|
import chalk177 from "chalk";
|
|
28034
28075
|
function findSlnInDir(dir) {
|
|
28035
28076
|
try {
|
|
28036
|
-
return readdirSync14(dir).filter((f) => f.endsWith(".sln")).map((f) =>
|
|
28077
|
+
return readdirSync14(dir).filter((f) => f.endsWith(".sln")).map((f) => join75(dir, f));
|
|
28037
28078
|
} catch {
|
|
28038
28079
|
return [];
|
|
28039
28080
|
}
|
|
@@ -28104,7 +28145,7 @@ function parseInspectReport(json) {
|
|
|
28104
28145
|
|
|
28105
28146
|
// src/commands/dotnet/runInspectCode.ts
|
|
28106
28147
|
import { execSync as execSync40 } from "child_process";
|
|
28107
|
-
import { existsSync as existsSync63, readFileSync as
|
|
28148
|
+
import { existsSync as existsSync63, readFileSync as readFileSync44, unlinkSync as unlinkSync12 } from "fs";
|
|
28108
28149
|
import { tmpdir as tmpdir4 } from "os";
|
|
28109
28150
|
import path40 from "path";
|
|
28110
28151
|
import chalk179 from "chalk";
|
|
@@ -28139,7 +28180,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
28139
28180
|
console.error(chalk179.red("Report file not generated"));
|
|
28140
28181
|
process.exit(1);
|
|
28141
28182
|
}
|
|
28142
|
-
const xml =
|
|
28183
|
+
const xml = readFileSync44(reportPath, "utf8");
|
|
28143
28184
|
unlinkSync12(reportPath);
|
|
28144
28185
|
return xml;
|
|
28145
28186
|
}
|
|
@@ -29021,7 +29062,7 @@ function aggregateCommitters(authorLists) {
|
|
|
29021
29062
|
import { spawnSync as spawnSync6 } from "child_process";
|
|
29022
29063
|
import { unlinkSync as unlinkSync13, writeFileSync as writeFileSync33 } from "fs";
|
|
29023
29064
|
import { tmpdir as tmpdir5 } from "os";
|
|
29024
|
-
import { join as
|
|
29065
|
+
import { join as join76 } from "path";
|
|
29025
29066
|
function buildArgs2(queryFile, vars) {
|
|
29026
29067
|
const args = ["api", "graphql", "-F", `query=@${queryFile}`];
|
|
29027
29068
|
for (const [key, value] of Object.entries(vars)) {
|
|
@@ -29031,7 +29072,7 @@ function buildArgs2(queryFile, vars) {
|
|
|
29031
29072
|
return args;
|
|
29032
29073
|
}
|
|
29033
29074
|
function runGhGraphql(mutation, vars) {
|
|
29034
|
-
const queryFile =
|
|
29075
|
+
const queryFile = join76(tmpdir5(), `gh-query-${Date.now()}.graphql`);
|
|
29035
29076
|
writeFileSync33(queryFile, mutation);
|
|
29036
29077
|
try {
|
|
29037
29078
|
const result = spawnSync6("gh", buildArgs2(queryFile, vars), {
|
|
@@ -30482,14 +30523,14 @@ function slugFromUrl(url) {
|
|
|
30482
30523
|
import { mkdirSync as mkdirSync22, writeFileSync as writeFileSync34 } from "fs";
|
|
30483
30524
|
|
|
30484
30525
|
// src/commands/github/issue/issueWorkingFile.ts
|
|
30485
|
-
import { join as
|
|
30526
|
+
import { join as join77 } from "path";
|
|
30486
30527
|
function issueWorkingFile(slug2, number) {
|
|
30487
30528
|
const [owner = "unknown", repo = "unknown"] = slug2.split("/");
|
|
30488
|
-
const dir =
|
|
30529
|
+
const dir = join77(getStoreDir(), "github-issues", owner, repo);
|
|
30489
30530
|
return {
|
|
30490
30531
|
dir,
|
|
30491
|
-
bodyPath:
|
|
30492
|
-
metaPath:
|
|
30532
|
+
bodyPath: join77(dir, `${number}.md`),
|
|
30533
|
+
metaPath: join77(dir, `${number}.json`)
|
|
30493
30534
|
};
|
|
30494
30535
|
}
|
|
30495
30536
|
|
|
@@ -30524,14 +30565,14 @@ function fetchIssueToWorkingFile(number, repo) {
|
|
|
30524
30565
|
}
|
|
30525
30566
|
|
|
30526
30567
|
// src/commands/github/issue/resumeIssueBody.ts
|
|
30527
|
-
import { existsSync as existsSync64, readFileSync as
|
|
30568
|
+
import { existsSync as existsSync64, readFileSync as readFileSync45 } from "fs";
|
|
30528
30569
|
function resumeIssueBody(slug2, number, updatedAt) {
|
|
30529
30570
|
const { bodyPath, metaPath } = issueWorkingFile(slug2, number);
|
|
30530
30571
|
if (!existsSync64(bodyPath) || !existsSync64(metaPath)) return void 0;
|
|
30531
30572
|
try {
|
|
30532
|
-
const meta = JSON.parse(
|
|
30573
|
+
const meta = JSON.parse(readFileSync45(metaPath, "utf8"));
|
|
30533
30574
|
if (meta.updatedAt !== updatedAt) return void 0;
|
|
30534
|
-
return
|
|
30575
|
+
return readFileSync45(bodyPath, "utf8");
|
|
30535
30576
|
} catch {
|
|
30536
30577
|
return void 0;
|
|
30537
30578
|
}
|
|
@@ -31398,11 +31439,11 @@ import { existsSync as existsSync65 } from "fs";
|
|
|
31398
31439
|
import { basename as basename20, dirname as dirname34 } from "path";
|
|
31399
31440
|
|
|
31400
31441
|
// src/commands/sessions/daemon/worktree/nextWorktreePath.ts
|
|
31401
|
-
import { basename as basename19, join as
|
|
31442
|
+
import { basename as basename19, join as join78 } from "path";
|
|
31402
31443
|
function nextWorktreePath(clone, base, isTaken) {
|
|
31403
31444
|
const name = basename19(clone);
|
|
31404
31445
|
for (let n = 2; n < 1e3; n++) {
|
|
31405
|
-
const candidate =
|
|
31446
|
+
const candidate = join78(base, `${name}-${n}`);
|
|
31406
31447
|
if (!isTaken(candidate)) return candidate;
|
|
31407
31448
|
}
|
|
31408
31449
|
throw new Error(`no free worktree suffix for ${clone}`);
|
|
@@ -31665,20 +31706,20 @@ function persistedTreeRoots() {
|
|
|
31665
31706
|
|
|
31666
31707
|
// src/commands/sessions/daemon/worktree/seedWorktree.ts
|
|
31667
31708
|
import { copyFileSync, existsSync as existsSync67, mkdirSync as mkdirSync23 } from "fs";
|
|
31668
|
-
import { dirname as dirname35, join as
|
|
31709
|
+
import { dirname as dirname35, join as join80 } from "path";
|
|
31669
31710
|
|
|
31670
31711
|
// src/commands/sessions/daemon/worktree/runInstall.ts
|
|
31671
31712
|
import { resolve as resolve22 } from "path";
|
|
31672
31713
|
|
|
31673
31714
|
// src/commands/sessions/daemon/worktree/detectInstallCommand.ts
|
|
31674
31715
|
import { existsSync as existsSync66 } from "fs";
|
|
31675
|
-
import { join as
|
|
31716
|
+
import { join as join79 } from "path";
|
|
31676
31717
|
function detectInstallCommand(dir) {
|
|
31677
|
-
if (!existsSync66(
|
|
31678
|
-
if (existsSync66(
|
|
31679
|
-
if (existsSync66(
|
|
31680
|
-
if (existsSync66(
|
|
31681
|
-
if (existsSync66(
|
|
31718
|
+
if (!existsSync66(join79(dir, "package.json"))) return null;
|
|
31719
|
+
if (existsSync66(join79(dir, "pnpm-lock.yaml"))) return "pnpm install";
|
|
31720
|
+
if (existsSync66(join79(dir, "yarn.lock"))) return "yarn install";
|
|
31721
|
+
if (existsSync66(join79(dir, "bun.lockb"))) return "bun install";
|
|
31722
|
+
if (existsSync66(join79(dir, "package-lock.json"))) return "npm ci";
|
|
31682
31723
|
return "npm install";
|
|
31683
31724
|
}
|
|
31684
31725
|
|
|
@@ -31843,9 +31884,9 @@ function seedWorktree(worktreePath, clone, onSeeded = () => {
|
|
|
31843
31884
|
}
|
|
31844
31885
|
function copyConfigFiles(worktreePath, clone, copy) {
|
|
31845
31886
|
for (const rel of copy) {
|
|
31846
|
-
const src =
|
|
31887
|
+
const src = join80(clone, rel);
|
|
31847
31888
|
if (!existsSync67(src)) continue;
|
|
31848
|
-
const dest =
|
|
31889
|
+
const dest = join80(worktreePath, rel);
|
|
31849
31890
|
try {
|
|
31850
31891
|
mkdirSync23(dirname35(dest), { recursive: true });
|
|
31851
31892
|
copyFileSync(src, dest);
|
|
@@ -32319,7 +32360,7 @@ import { resolve as resolve24 } from "path";
|
|
|
32319
32360
|
import chalk196 from "chalk";
|
|
32320
32361
|
|
|
32321
32362
|
// src/commands/mermaid/exportFile.ts
|
|
32322
|
-
import { readFileSync as
|
|
32363
|
+
import { readFileSync as readFileSync46, writeFileSync as writeFileSync35 } from "fs";
|
|
32323
32364
|
import { basename as basename21, extname as extname4, resolve as resolve23 } from "path";
|
|
32324
32365
|
import chalk195 from "chalk";
|
|
32325
32366
|
|
|
@@ -32345,7 +32386,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
32345
32386
|
|
|
32346
32387
|
// src/commands/mermaid/exportFile.ts
|
|
32347
32388
|
async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
32348
|
-
const content =
|
|
32389
|
+
const content = readFileSync46(file, "utf8");
|
|
32349
32390
|
const blocks = extractMermaidBlocks(content);
|
|
32350
32391
|
const stem = basename21(file, extname4(file));
|
|
32351
32392
|
if (onlyIndex !== void 0) {
|
|
@@ -32557,14 +32598,14 @@ function applyIgnore(texts, ignore3) {
|
|
|
32557
32598
|
}
|
|
32558
32599
|
|
|
32559
32600
|
// src/commands/miro/readIgnoreList.ts
|
|
32560
|
-
import { existsSync as existsSync68, readFileSync as
|
|
32601
|
+
import { existsSync as existsSync68, readFileSync as readFileSync47 } from "fs";
|
|
32561
32602
|
import { parse as parse2 } from "yaml";
|
|
32562
32603
|
function readIgnoreList(file) {
|
|
32563
32604
|
if (!existsSync68(file))
|
|
32564
32605
|
throw new MiroExtractError(
|
|
32565
32606
|
`No ignore file at ${file}. Write a YAML list of the box texts to drop, or omit --ignore.`
|
|
32566
32607
|
);
|
|
32567
|
-
const parsed = parse2(
|
|
32608
|
+
const parsed = parse2(readFileSync47(file, "utf8"));
|
|
32568
32609
|
if (parsed === null || parsed === void 0) return [];
|
|
32569
32610
|
if (!Array.isArray(parsed) || parsed.some((entry) => typeof entry !== "string"))
|
|
32570
32611
|
throw new MiroExtractError(
|
|
@@ -32744,7 +32785,7 @@ async function pickAnchors(sessionId2, items2) {
|
|
|
32744
32785
|
}
|
|
32745
32786
|
|
|
32746
32787
|
// src/commands/miro/readMiroItems.ts
|
|
32747
|
-
import { readFileSync as
|
|
32788
|
+
import { readFileSync as readFileSync48 } from "fs";
|
|
32748
32789
|
function tryParse(text20) {
|
|
32749
32790
|
try {
|
|
32750
32791
|
return JSON.parse(text20);
|
|
@@ -32773,7 +32814,7 @@ function parsePages(raw, file) {
|
|
|
32773
32814
|
return Array.isArray(parsed) ? parsed.map(toPage) : [toPage(parsed)];
|
|
32774
32815
|
}
|
|
32775
32816
|
function readMiroItems(file) {
|
|
32776
|
-
const items2 = parsePages(
|
|
32817
|
+
const items2 = parsePages(readFileSync48(file, "utf8"), file).flatMap(
|
|
32777
32818
|
(page) => page.data ?? []
|
|
32778
32819
|
);
|
|
32779
32820
|
if (items2.length === 0)
|
|
@@ -33045,15 +33086,15 @@ function createNetcapHandler(options2) {
|
|
|
33045
33086
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
33046
33087
|
import { cp as cp4, readFile as readFile7, writeFile as writeFile6 } from "fs/promises";
|
|
33047
33088
|
import { networkInterfaces } from "os";
|
|
33048
|
-
import { join as
|
|
33089
|
+
import { join as join82 } from "path";
|
|
33049
33090
|
import chalk199 from "chalk";
|
|
33050
33091
|
|
|
33051
33092
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
33052
|
-
import { dirname as dirname37, join as
|
|
33093
|
+
import { dirname as dirname37, join as join81 } from "path";
|
|
33053
33094
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
33054
33095
|
var moduleDir2 = dirname37(fileURLToPath7(import.meta.url));
|
|
33055
33096
|
function netcapExtensionDir() {
|
|
33056
|
-
return
|
|
33097
|
+
return join81(moduleDir2, "commands", "netcap", "netcap-extension");
|
|
33057
33098
|
}
|
|
33058
33099
|
|
|
33059
33100
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
@@ -33068,7 +33109,7 @@ function lanIPv4() {
|
|
|
33068
33109
|
return void 0;
|
|
33069
33110
|
}
|
|
33070
33111
|
async function configureBackground(dir, host, port, filter) {
|
|
33071
|
-
const file =
|
|
33112
|
+
const file = join82(dir, "background.js");
|
|
33072
33113
|
const source = await readFile7(file, "utf8");
|
|
33073
33114
|
await writeFile6(
|
|
33074
33115
|
file,
|
|
@@ -33108,20 +33149,20 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
33108
33149
|
}
|
|
33109
33150
|
|
|
33110
33151
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
33111
|
-
import { isAbsolute as isAbsolute5, join as
|
|
33152
|
+
import { isAbsolute as isAbsolute5, join as join84, resolve as resolve26 } from "path";
|
|
33112
33153
|
|
|
33113
33154
|
// src/commands/netcap/defaultCapturePath.ts
|
|
33114
33155
|
import { homedir as homedir24 } from "os";
|
|
33115
|
-
import { join as
|
|
33156
|
+
import { join as join83 } from "path";
|
|
33116
33157
|
function defaultCapturePath() {
|
|
33117
|
-
return
|
|
33158
|
+
return join83(homedir24(), ".assist", "netcap", "capture.jsonl");
|
|
33118
33159
|
}
|
|
33119
33160
|
|
|
33120
33161
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
33121
33162
|
function resolveNetcapOutPath(out) {
|
|
33122
33163
|
if (!out) return defaultCapturePath();
|
|
33123
33164
|
const dir = isAbsolute5(out) ? out : resolve26(process.cwd(), out);
|
|
33124
|
-
return
|
|
33165
|
+
return join84(dir, "capture.jsonl");
|
|
33125
33166
|
}
|
|
33126
33167
|
|
|
33127
33168
|
// src/commands/netcap/netcap.ts
|
|
@@ -33168,11 +33209,11 @@ netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"}
|
|
|
33168
33209
|
|
|
33169
33210
|
// src/commands/netcap/netcapExtract.ts
|
|
33170
33211
|
import { writeFileSync as writeFileSync37 } from "fs";
|
|
33171
|
-
import { join as
|
|
33212
|
+
import { join as join85 } from "path";
|
|
33172
33213
|
import chalk201 from "chalk";
|
|
33173
33214
|
|
|
33174
33215
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
33175
|
-
import { readFileSync as
|
|
33216
|
+
import { readFileSync as readFileSync49 } from "fs";
|
|
33176
33217
|
|
|
33177
33218
|
// src/commands/netcap/parseRscRows.ts
|
|
33178
33219
|
var isRscRef = (v) => typeof v === "string" && /^\$[0-9a-fL@]/.test(v);
|
|
@@ -33568,7 +33609,7 @@ function extractVoyagerPosts(body) {
|
|
|
33568
33609
|
|
|
33569
33610
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
33570
33611
|
function captureEntries(captureFile) {
|
|
33571
|
-
const lines2 =
|
|
33612
|
+
const lines2 = readFileSync49(captureFile, "utf8").split("\n").filter(Boolean);
|
|
33572
33613
|
const entries = [];
|
|
33573
33614
|
for (const line of lines2) {
|
|
33574
33615
|
let entry;
|
|
@@ -33613,7 +33654,7 @@ function extractPostsFromCapture(captureFile) {
|
|
|
33613
33654
|
function netcapExtract(file) {
|
|
33614
33655
|
const captureFile = file ?? defaultCapturePath();
|
|
33615
33656
|
const posts = extractPostsFromCapture(captureFile);
|
|
33616
|
-
const outFile =
|
|
33657
|
+
const outFile = join85(captureFile, "..", "posts.json");
|
|
33617
33658
|
writeFileSync37(outFile, `${JSON.stringify(posts, null, 2)}
|
|
33618
33659
|
`);
|
|
33619
33660
|
console.log(
|
|
@@ -34009,9 +34050,9 @@ async function comment2(path109, line, body, options2 = {}) {
|
|
|
34009
34050
|
|
|
34010
34051
|
// src/commands/prs/commentsCachePath.ts
|
|
34011
34052
|
import { homedir as homedir25 } from "os";
|
|
34012
|
-
import { join as
|
|
34053
|
+
import { join as join86 } from "path";
|
|
34013
34054
|
function commentsCachePath(org, repo, prNumber) {
|
|
34014
|
-
return
|
|
34055
|
+
return join86(
|
|
34015
34056
|
homedir25(),
|
|
34016
34057
|
".assist",
|
|
34017
34058
|
"pr-comments",
|
|
@@ -34027,14 +34068,14 @@ import { dirname as dirname39 } from "path";
|
|
|
34027
34068
|
import { stringify as stringify3 } from "yaml";
|
|
34028
34069
|
|
|
34029
34070
|
// src/commands/prs/loadCommentsCache.ts
|
|
34030
|
-
import { existsSync as existsSync69, readFileSync as
|
|
34071
|
+
import { existsSync as existsSync69, readFileSync as readFileSync50, unlinkSync as unlinkSync14 } from "fs";
|
|
34031
34072
|
import { parse as parse3 } from "yaml";
|
|
34032
34073
|
function loadCommentsCache(org, repo, prNumber) {
|
|
34033
34074
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
34034
34075
|
if (!existsSync69(cachePath)) {
|
|
34035
34076
|
return null;
|
|
34036
34077
|
}
|
|
34037
|
-
const content =
|
|
34078
|
+
const content = readFileSync50(cachePath, "utf8");
|
|
34038
34079
|
return parse3(content);
|
|
34039
34080
|
}
|
|
34040
34081
|
function deleteCommentsCache(org, repo, prNumber) {
|
|
@@ -34047,10 +34088,10 @@ function deleteCommentsCache(org, repo, prNumber) {
|
|
|
34047
34088
|
|
|
34048
34089
|
// src/commands/prs/removeStaleCommentsCaches.ts
|
|
34049
34090
|
import { readdirSync as readdirSync16, unlinkSync as unlinkSync15 } from "fs";
|
|
34050
|
-
import { join as
|
|
34091
|
+
import { join as join87 } from "path";
|
|
34051
34092
|
var STALE_PATTERN = /^pr-\d+-comments\.yaml$/;
|
|
34052
34093
|
function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
34053
|
-
const dir =
|
|
34094
|
+
const dir = join87(cwd, ".assist");
|
|
34054
34095
|
let entries;
|
|
34055
34096
|
try {
|
|
34056
34097
|
entries = readdirSync16(dir);
|
|
@@ -34058,7 +34099,7 @@ function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
|
34058
34099
|
return;
|
|
34059
34100
|
}
|
|
34060
34101
|
for (const entry of entries.filter((e) => STALE_PATTERN.test(e))) {
|
|
34061
|
-
unlinkSync15(
|
|
34102
|
+
unlinkSync15(join87(dir, entry));
|
|
34062
34103
|
}
|
|
34063
34104
|
}
|
|
34064
34105
|
|
|
@@ -34176,7 +34217,7 @@ function failAzureDevops(error) {
|
|
|
34176
34217
|
import { execFileSync as execFileSync19 } from "child_process";
|
|
34177
34218
|
import { mkdtempSync as mkdtempSync2, rmSync as rmSync6, writeFileSync as writeFileSync39 } from "fs";
|
|
34178
34219
|
import { tmpdir as tmpdir6 } from "os";
|
|
34179
|
-
import { join as
|
|
34220
|
+
import { join as join88 } from "path";
|
|
34180
34221
|
function azDevopsInvokeArgs(request, inFile) {
|
|
34181
34222
|
return [
|
|
34182
34223
|
"devops",
|
|
@@ -34211,8 +34252,8 @@ function runAz2(args) {
|
|
|
34211
34252
|
}
|
|
34212
34253
|
function invokeAzDevops(request) {
|
|
34213
34254
|
if (request.body === void 0) return runAz2(azDevopsInvokeArgs(request));
|
|
34214
|
-
const dir = mkdtempSync2(
|
|
34215
|
-
const inFile =
|
|
34255
|
+
const dir = mkdtempSync2(join88(tmpdir6(), "assist-az-"));
|
|
34256
|
+
const inFile = join88(dir, "body.json");
|
|
34216
34257
|
try {
|
|
34217
34258
|
writeFileSync39(inFile, JSON.stringify(request.body));
|
|
34218
34259
|
return runAz2(azDevopsInvokeArgs(request, inFile));
|
|
@@ -35998,7 +36039,7 @@ function registerPrsStatus(prsCommand) {
|
|
|
35998
36039
|
}
|
|
35999
36040
|
|
|
36000
36041
|
// src/commands/readTime/readTime.ts
|
|
36001
|
-
import { readFileSync as
|
|
36042
|
+
import { readFileSync as readFileSync51 } from "fs";
|
|
36002
36043
|
|
|
36003
36044
|
// src/commands/readTime/countReadingWords.ts
|
|
36004
36045
|
var FENCE_PATTERN = /^\s*(```|~~~)/;
|
|
@@ -36159,7 +36200,7 @@ async function loadBody(target) {
|
|
|
36159
36200
|
}
|
|
36160
36201
|
function readDraftFile(path109) {
|
|
36161
36202
|
try {
|
|
36162
|
-
return
|
|
36203
|
+
return readFileSync51(path109, "utf8");
|
|
36163
36204
|
} catch {
|
|
36164
36205
|
console.error(`Error: Could not read \`${path109}\`.`);
|
|
36165
36206
|
console.error(
|
|
@@ -36666,10 +36707,10 @@ function checkStreamGraph(streams) {
|
|
|
36666
36707
|
}
|
|
36667
36708
|
|
|
36668
36709
|
// src/commands/releases/readStreamsInput.ts
|
|
36669
|
-
import { readFileSync as
|
|
36710
|
+
import { readFileSync as readFileSync52 } from "fs";
|
|
36670
36711
|
import { parse as parse4 } from "yaml";
|
|
36671
36712
|
function readSource2(source) {
|
|
36672
|
-
return
|
|
36713
|
+
return readFileSync52(source === "-" ? 0 : source, "utf8");
|
|
36673
36714
|
}
|
|
36674
36715
|
function readStreamsInput(source) {
|
|
36675
36716
|
let parsed;
|
|
@@ -37342,7 +37383,7 @@ async function notify() {
|
|
|
37342
37383
|
import { execSync as execSync54 } from "child_process";
|
|
37343
37384
|
import { existsSync as existsSync70, mkdirSync as mkdirSync27, unlinkSync as unlinkSync16, writeFileSync as writeFileSync40 } from "fs";
|
|
37344
37385
|
import { tmpdir as tmpdir7 } from "os";
|
|
37345
|
-
import { join as
|
|
37386
|
+
import { join as join89, resolve as resolve28 } from "path";
|
|
37346
37387
|
import chalk228 from "chalk";
|
|
37347
37388
|
|
|
37348
37389
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
@@ -37479,7 +37520,7 @@ function buildOutputPath(outputDir, processName) {
|
|
|
37479
37520
|
return resolve28(outputDir, `${processName}-${timestamp9}.png`);
|
|
37480
37521
|
}
|
|
37481
37522
|
function runPowerShellScript(processName, outputPath) {
|
|
37482
|
-
const scriptPath =
|
|
37523
|
+
const scriptPath = join89(tmpdir7(), `assist-screenshot-${Date.now()}.ps1`);
|
|
37483
37524
|
writeFileSync40(scriptPath, captureWindowPs1, "utf8");
|
|
37484
37525
|
try {
|
|
37485
37526
|
execSync54(
|
|
@@ -37580,10 +37621,10 @@ function buildLimitsSegment(rateLimits) {
|
|
|
37580
37621
|
}
|
|
37581
37622
|
|
|
37582
37623
|
// src/commands/readGitBranch.ts
|
|
37583
|
-
import { readFileSync as
|
|
37584
|
-
import { isAbsolute as isAbsolute6, join as
|
|
37624
|
+
import { readFileSync as readFileSync53, statSync as statSync11 } from "fs";
|
|
37625
|
+
import { isAbsolute as isAbsolute6, join as join90, resolve as resolve29 } from "path";
|
|
37585
37626
|
function resolveGitDir(cwd) {
|
|
37586
|
-
const dotGit =
|
|
37627
|
+
const dotGit = join90(cwd, ".git");
|
|
37587
37628
|
let stat5;
|
|
37588
37629
|
try {
|
|
37589
37630
|
stat5 = statSync11(dotGit);
|
|
@@ -37595,7 +37636,7 @@ function resolveGitDir(cwd) {
|
|
|
37595
37636
|
}
|
|
37596
37637
|
let contents;
|
|
37597
37638
|
try {
|
|
37598
|
-
contents =
|
|
37639
|
+
contents = readFileSync53(dotGit, "utf8");
|
|
37599
37640
|
} catch {
|
|
37600
37641
|
return null;
|
|
37601
37642
|
}
|
|
@@ -37613,7 +37654,7 @@ function readGitBranch(cwd) {
|
|
|
37613
37654
|
}
|
|
37614
37655
|
let head;
|
|
37615
37656
|
try {
|
|
37616
|
-
head =
|
|
37657
|
+
head = readFileSync53(join90(gitDir, "HEAD"), "utf8");
|
|
37617
37658
|
} catch {
|
|
37618
37659
|
return null;
|
|
37619
37660
|
}
|
|
@@ -40732,7 +40773,7 @@ function fetchHighLevelPr(prNumber, repo) {
|
|
|
40732
40773
|
}
|
|
40733
40774
|
|
|
40734
40775
|
// src/commands/review/highLevel/gatherHighLevelSlices.ts
|
|
40735
|
-
import { readFileSync as
|
|
40776
|
+
import { readFileSync as readFileSync55 } from "fs";
|
|
40736
40777
|
|
|
40737
40778
|
// src/commands/review/highLevel/formatSlicingRequest.ts
|
|
40738
40779
|
var RULES = [
|
|
@@ -40793,12 +40834,12 @@ function formatSlicingRequest(hunks) {
|
|
|
40793
40834
|
}
|
|
40794
40835
|
|
|
40795
40836
|
// src/commands/review/highLevel/highLevelReviewPath.ts
|
|
40796
|
-
import { join as
|
|
40837
|
+
import { join as join91 } from "path";
|
|
40797
40838
|
function slug(value) {
|
|
40798
40839
|
return value.replace(/[^\w.-]+/g, "-");
|
|
40799
40840
|
}
|
|
40800
40841
|
function highLevelReviewPath(repo, headRef, headSha) {
|
|
40801
|
-
return
|
|
40842
|
+
return join91(
|
|
40802
40843
|
getStoreDir(),
|
|
40803
40844
|
"high-level-reviews",
|
|
40804
40845
|
slug(repo),
|
|
@@ -40850,11 +40891,11 @@ function listHighLevelHunks(files) {
|
|
|
40850
40891
|
}
|
|
40851
40892
|
|
|
40852
40893
|
// src/commands/review/highLevel/readJsonFile.ts
|
|
40853
|
-
import { existsSync as existsSync71, readFileSync as
|
|
40894
|
+
import { existsSync as existsSync71, readFileSync as readFileSync54 } from "fs";
|
|
40854
40895
|
function readJsonFile(path109) {
|
|
40855
40896
|
if (!existsSync71(path109)) return void 0;
|
|
40856
40897
|
try {
|
|
40857
|
-
return JSON.parse(
|
|
40898
|
+
return JSON.parse(readFileSync54(path109, "utf8"));
|
|
40858
40899
|
} catch {
|
|
40859
40900
|
return void 0;
|
|
40860
40901
|
}
|
|
@@ -40945,7 +40986,7 @@ function writeJsonFile(path109, data) {
|
|
|
40945
40986
|
// src/commands/review/highLevel/gatherHighLevelSlices.ts
|
|
40946
40987
|
function readSlicesFile(file) {
|
|
40947
40988
|
try {
|
|
40948
|
-
return JSON.parse(
|
|
40989
|
+
return JSON.parse(readFileSync55(file, "utf8"));
|
|
40949
40990
|
} catch (error) {
|
|
40950
40991
|
throw new Error(
|
|
40951
40992
|
`could not read slices from ${file}: ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -41826,7 +41867,7 @@ async function runHighLevelReview(number, options2 = {}) {
|
|
|
41826
41867
|
import { basename as basename26 } from "path";
|
|
41827
41868
|
|
|
41828
41869
|
// src/commands/review/ci/writeJobSummary.ts
|
|
41829
|
-
import { appendFileSync as appendFileSync3, readFileSync as
|
|
41870
|
+
import { appendFileSync as appendFileSync3, readFileSync as readFileSync56 } from "fs";
|
|
41830
41871
|
|
|
41831
41872
|
// src/commands/review/carriedUnanchoredFindings.ts
|
|
41832
41873
|
function carriedUnanchoredFindings(unanchored) {
|
|
@@ -42208,7 +42249,7 @@ function buildTokenUsageTable(usages) {
|
|
|
42208
42249
|
// src/commands/review/ci/writeJobSummary.ts
|
|
42209
42250
|
function writeJobSummary(synthesisPath, prInfo, summaryPath, slots) {
|
|
42210
42251
|
if (!summaryPath) return;
|
|
42211
|
-
const markdown =
|
|
42252
|
+
const markdown = readFileSync56(synthesisPath, "utf8");
|
|
42212
42253
|
const { unanchored } = selectPostableFindings(markdown, prInfo);
|
|
42213
42254
|
const usageTable = buildTokenUsageTable(slots.map((slot) => slot.usage));
|
|
42214
42255
|
appendFileSync3(
|
|
@@ -42327,7 +42368,7 @@ import { format as format2 } from "util";
|
|
|
42327
42368
|
|
|
42328
42369
|
// src/commands/review/createReviewLogSink.ts
|
|
42329
42370
|
import { appendFileSync as appendFileSync4, mkdirSync as mkdirSync29 } from "fs";
|
|
42330
|
-
import { join as
|
|
42371
|
+
import { join as join92 } from "path";
|
|
42331
42372
|
var LOG_FILE = "review.log";
|
|
42332
42373
|
function createReviewLogSink() {
|
|
42333
42374
|
let logPath2;
|
|
@@ -42344,7 +42385,7 @@ function createReviewLogSink() {
|
|
|
42344
42385
|
},
|
|
42345
42386
|
attach(reviewDir) {
|
|
42346
42387
|
mkdirSync29(reviewDir, { recursive: true });
|
|
42347
|
-
logPath2 =
|
|
42388
|
+
logPath2 = join92(reviewDir, LOG_FILE);
|
|
42348
42389
|
const lines2 = [
|
|
42349
42390
|
"",
|
|
42350
42391
|
`=== ${(/* @__PURE__ */ new Date()).toISOString()} ===`,
|
|
@@ -43215,7 +43256,7 @@ async function runReviewers(reviewDir, claudePath, codexPath, stdinPrompt, optio
|
|
|
43215
43256
|
import { existsSync as existsSync73, unlinkSync as unlinkSync18 } from "fs";
|
|
43216
43257
|
|
|
43217
43258
|
// src/commands/review/synthesise.ts
|
|
43218
|
-
import { readFileSync as
|
|
43259
|
+
import { readFileSync as readFileSync57 } from "fs";
|
|
43219
43260
|
|
|
43220
43261
|
// src/commands/review/buildSynthesisStdin.ts
|
|
43221
43262
|
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.
|
|
@@ -43284,7 +43325,7 @@ Files:
|
|
|
43284
43325
|
|
|
43285
43326
|
// src/commands/review/synthesise.ts
|
|
43286
43327
|
function printSummary2(synthesisPath) {
|
|
43287
|
-
const markdown =
|
|
43328
|
+
const markdown = readFileSync57(synthesisPath, "utf8");
|
|
43288
43329
|
console.log("");
|
|
43289
43330
|
console.log(buildReviewSummary(markdown));
|
|
43290
43331
|
console.log("");
|
|
@@ -43551,9 +43592,9 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
|
|
|
43551
43592
|
|
|
43552
43593
|
// src/commands/review/buildReviewPaths.ts
|
|
43553
43594
|
import { homedir as homedir26 } from "os";
|
|
43554
|
-
import { basename as basename25, join as
|
|
43595
|
+
import { basename as basename25, join as join93 } from "path";
|
|
43555
43596
|
function buildReviewPaths(repoRoot2, key) {
|
|
43556
|
-
const reviewDir =
|
|
43597
|
+
const reviewDir = join93(
|
|
43557
43598
|
homedir26(),
|
|
43558
43599
|
".assist",
|
|
43559
43600
|
"reviews",
|
|
@@ -43562,10 +43603,10 @@ function buildReviewPaths(repoRoot2, key) {
|
|
|
43562
43603
|
);
|
|
43563
43604
|
return {
|
|
43564
43605
|
reviewDir,
|
|
43565
|
-
requestPath:
|
|
43566
|
-
claudePath:
|
|
43567
|
-
codexPath:
|
|
43568
|
-
synthesisPath:
|
|
43606
|
+
requestPath: join93(reviewDir, "request.md"),
|
|
43607
|
+
claudePath: join93(reviewDir, "claude.md"),
|
|
43608
|
+
codexPath: join93(reviewDir, "codex.md"),
|
|
43609
|
+
synthesisPath: join93(reviewDir, "synthesis.md")
|
|
43569
43610
|
};
|
|
43570
43611
|
}
|
|
43571
43612
|
|
|
@@ -43729,7 +43770,7 @@ function gatherChangedContext() {
|
|
|
43729
43770
|
}
|
|
43730
43771
|
|
|
43731
43772
|
// src/commands/review/postReviewToPr.ts
|
|
43732
|
-
import { readFileSync as
|
|
43773
|
+
import { readFileSync as readFileSync58 } from "fs";
|
|
43733
43774
|
|
|
43734
43775
|
// src/commands/review/chainAddressComments.ts
|
|
43735
43776
|
function chainAddressComments(prNumber, announce) {
|
|
@@ -43911,7 +43952,7 @@ async function confirmPost(prNumber, work, options2) {
|
|
|
43911
43952
|
return promptConfirm(`Post ${work} to PR #${prNumber}?`, false);
|
|
43912
43953
|
}
|
|
43913
43954
|
async function postFindingsToPr(prInfo, synthesisPath, options2) {
|
|
43914
|
-
const markdown =
|
|
43955
|
+
const markdown = readFileSync58(synthesisPath, "utf8");
|
|
43915
43956
|
const { inDiff, unanchored } = selectPostableFindings(markdown, prInfo);
|
|
43916
43957
|
const carried = carriedUnanchoredFindings(unanchored);
|
|
43917
43958
|
if (inDiff.length === 0 && carried.length === 0)
|
|
@@ -44275,11 +44316,11 @@ import path88 from "path";
|
|
|
44275
44316
|
import chalk263 from "chalk";
|
|
44276
44317
|
|
|
44277
44318
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
44278
|
-
import { existsSync as existsSync75, readFileSync as
|
|
44319
|
+
import { existsSync as existsSync75, readFileSync as readFileSync60, writeFileSync as writeFileSync44 } from "fs";
|
|
44279
44320
|
import path87 from "path";
|
|
44280
44321
|
|
|
44281
44322
|
// src/commands/rules/scopedRuleDirectories.ts
|
|
44282
|
-
import { readFileSync as
|
|
44323
|
+
import { readFileSync as readFileSync59 } from "fs";
|
|
44283
44324
|
import path86 from "path";
|
|
44284
44325
|
|
|
44285
44326
|
// src/commands/rules/findClaudeFiles.ts
|
|
@@ -44303,7 +44344,7 @@ function findClaudeFiles(dir) {
|
|
|
44303
44344
|
// src/commands/rules/scopedRuleDirectories.ts
|
|
44304
44345
|
function scopedRuleDirectories(root2) {
|
|
44305
44346
|
return findClaudeFiles(root2).filter(
|
|
44306
|
-
(file) => path86.dirname(file) !== root2 && parseRulesSection(
|
|
44347
|
+
(file) => path86.dirname(file) !== root2 && parseRulesSection(readFileSync59(file, "utf8")).length > 0
|
|
44307
44348
|
).map(
|
|
44308
44349
|
(file) => `${path86.relative(root2, path86.dirname(file)).split(path86.sep).join("/")}/`
|
|
44309
44350
|
).sort();
|
|
@@ -44345,7 +44386,7 @@ function upsertScopedRulesPointer(content, directories) {
|
|
|
44345
44386
|
function updateScopedRulesIndex(root2) {
|
|
44346
44387
|
const directories = scopedRuleDirectories(root2);
|
|
44347
44388
|
const rootFile = path87.join(root2, "CLAUDE.md");
|
|
44348
|
-
const before = existsSync75(rootFile) ?
|
|
44389
|
+
const before = existsSync75(rootFile) ? readFileSync60(rootFile, "utf8") : "";
|
|
44349
44390
|
const after = upsertScopedRulesPointer(before, directories);
|
|
44350
44391
|
if (after !== before) writeFileSync44(rootFile, after);
|
|
44351
44392
|
return directories;
|
|
@@ -44398,7 +44439,7 @@ function listRules(target, options2 = {}) {
|
|
|
44398
44439
|
}
|
|
44399
44440
|
|
|
44400
44441
|
// src/commands/rules/addRule.ts
|
|
44401
|
-
import { existsSync as existsSync77, readFileSync as
|
|
44442
|
+
import { existsSync as existsSync77, readFileSync as readFileSync62, writeFileSync as writeFileSync45 } from "fs";
|
|
44402
44443
|
import path91 from "path";
|
|
44403
44444
|
import chalk265 from "chalk";
|
|
44404
44445
|
|
|
@@ -44423,11 +44464,11 @@ function insertRuleBullet(content, rule) {
|
|
|
44423
44464
|
}
|
|
44424
44465
|
|
|
44425
44466
|
// src/commands/rules/nextRuleCode.ts
|
|
44426
|
-
import { readFileSync as
|
|
44467
|
+
import { readFileSync as readFileSync61 } from "fs";
|
|
44427
44468
|
var CODE_PREFIX = "R";
|
|
44428
44469
|
function nextRuleCode(root2) {
|
|
44429
44470
|
const numbers = findClaudeFiles(root2).flatMap(
|
|
44430
|
-
(file) => parseRulesSection(
|
|
44471
|
+
(file) => parseRulesSection(readFileSync61(file, "utf8")).map(
|
|
44431
44472
|
(rule) => Number(/(\d+)\s*$/.exec(rule.code)?.[1] ?? 0)
|
|
44432
44473
|
)
|
|
44433
44474
|
);
|
|
@@ -44454,7 +44495,7 @@ function resolveRuleScope(target) {
|
|
|
44454
44495
|
|
|
44455
44496
|
// src/commands/rules/addRule.ts
|
|
44456
44497
|
function read2(file) {
|
|
44457
|
-
return existsSync77(file) ?
|
|
44498
|
+
return existsSync77(file) ? readFileSync62(file, "utf8") : "";
|
|
44458
44499
|
}
|
|
44459
44500
|
function addRule(text20, options2) {
|
|
44460
44501
|
const rule = text20.trim();
|
|
@@ -44977,7 +45018,7 @@ function findShownSessionFiles(body, writtenPaths, locations) {
|
|
|
44977
45018
|
}
|
|
44978
45019
|
|
|
44979
45020
|
// src/commands/show/sessionWrittenPaths.ts
|
|
44980
|
-
import { readFileSync as
|
|
45021
|
+
import { readFileSync as readFileSync63 } from "fs";
|
|
44981
45022
|
|
|
44982
45023
|
// src/commands/sessions/shared/asRecord.ts
|
|
44983
45024
|
function asRecord(value) {
|
|
@@ -45005,7 +45046,7 @@ function writtenFilePaths(entry) {
|
|
|
45005
45046
|
function sessionWrittenPaths(transcriptPath2) {
|
|
45006
45047
|
let text20;
|
|
45007
45048
|
try {
|
|
45008
|
-
text20 =
|
|
45049
|
+
text20 = readFileSync63(transcriptPath2, "utf8");
|
|
45009
45050
|
} catch {
|
|
45010
45051
|
return [];
|
|
45011
45052
|
}
|
|
@@ -45124,12 +45165,12 @@ import { mkdirSync as mkdirSync32, writeFileSync as writeFileSync47 } from "fs";
|
|
|
45124
45165
|
import { mkdirSync as mkdirSync31, writeFileSync as writeFileSync46 } from "fs";
|
|
45125
45166
|
|
|
45126
45167
|
// src/commands/slack/readSlackParts.ts
|
|
45127
|
-
import { readFileSync as
|
|
45168
|
+
import { readFileSync as readFileSync64 } from "fs";
|
|
45128
45169
|
function readSlackParts(files) {
|
|
45129
45170
|
return files.map((file) => {
|
|
45130
45171
|
let contents;
|
|
45131
45172
|
try {
|
|
45132
|
-
contents =
|
|
45173
|
+
contents = readFileSync64(file, "utf8");
|
|
45133
45174
|
} catch {
|
|
45134
45175
|
console.error(`Error: Part file not found: ${file}`);
|
|
45135
45176
|
process.exit(1);
|
|
@@ -45167,12 +45208,12 @@ async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
|
45167
45208
|
}
|
|
45168
45209
|
|
|
45169
45210
|
// src/commands/slack/slackWorkingFile.ts
|
|
45170
|
-
import { join as
|
|
45211
|
+
import { join as join94 } from "path";
|
|
45171
45212
|
function slackWorkingFile(channel, partIndex) {
|
|
45172
45213
|
const slug2 = channel.replace(/^[#@]/, "").toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "channel";
|
|
45173
|
-
const dir =
|
|
45214
|
+
const dir = join94(getStoreDir(), "slack");
|
|
45174
45215
|
const name = partIndex === void 0 ? slug2 : `${slug2}-${partIndex}`;
|
|
45175
|
-
return { dir, bodyPath:
|
|
45216
|
+
return { dir, bodyPath: join94(dir, `${name}.md`) };
|
|
45176
45217
|
}
|
|
45177
45218
|
|
|
45178
45219
|
// src/commands/slack/previewSlackThreadParts.ts
|
|
@@ -46243,9 +46284,9 @@ function formatVttPassages(passages, notes = [], { sourceMarks = true } = {}) {
|
|
|
46243
46284
|
}
|
|
46244
46285
|
|
|
46245
46286
|
// src/commands/transcript/convert/readCleanedCues.ts
|
|
46246
|
-
import { readFileSync as
|
|
46287
|
+
import { readFileSync as readFileSync69 } from "fs";
|
|
46247
46288
|
function readCleanedCues(inputPath) {
|
|
46248
|
-
return deduplicateCues(parseVtt(
|
|
46289
|
+
return deduplicateCues(parseVtt(readFileSync69(inputPath, "utf8")));
|
|
46249
46290
|
}
|
|
46250
46291
|
|
|
46251
46292
|
// src/commands/transcript/clean.ts
|
|
@@ -46355,20 +46396,20 @@ async function configure() {
|
|
|
46355
46396
|
|
|
46356
46397
|
// src/commands/transcript/list.ts
|
|
46357
46398
|
import { existsSync as existsSync83, readdirSync as readdirSync24, statSync as statSync13 } from "fs";
|
|
46358
|
-
import { join as
|
|
46399
|
+
import { join as join106 } from "path";
|
|
46359
46400
|
function list5() {
|
|
46360
46401
|
const { vttDir } = getTranscriptConfig();
|
|
46361
46402
|
if (!existsSync83(vttDir)) return;
|
|
46362
46403
|
for (const entry of readdirSync24(vttDir)) {
|
|
46363
46404
|
if (!entry.endsWith(".vtt")) continue;
|
|
46364
|
-
if (statSync13(
|
|
46405
|
+
if (statSync13(join106(vttDir, entry)).isDirectory()) continue;
|
|
46365
46406
|
console.log(entry);
|
|
46366
46407
|
}
|
|
46367
46408
|
}
|
|
46368
46409
|
|
|
46369
46410
|
// src/commands/transcript/move.ts
|
|
46370
46411
|
import { existsSync as existsSync84, mkdirSync as mkdirSync38, renameSync as renameSync5, writeFileSync as writeFileSync52 } from "fs";
|
|
46371
|
-
import { basename as basename29, join as
|
|
46412
|
+
import { basename as basename29, join as join107 } from "path";
|
|
46372
46413
|
|
|
46373
46414
|
// src/commands/transcript/convertVttToMarkdown.ts
|
|
46374
46415
|
function convertVttToMarkdown(inputPath) {
|
|
@@ -46378,9 +46419,9 @@ function convertVttToMarkdown(inputPath) {
|
|
|
46378
46419
|
// src/commands/transcript/move.ts
|
|
46379
46420
|
var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
46380
46421
|
function archiveRawVtt(vttDir, sourcePath, filename) {
|
|
46381
|
-
const processedDir =
|
|
46422
|
+
const processedDir = join107(vttDir, "processed");
|
|
46382
46423
|
mkdirSync38(processedDir, { recursive: true });
|
|
46383
|
-
renameSync5(sourcePath,
|
|
46424
|
+
renameSync5(sourcePath, join107(processedDir, filename));
|
|
46384
46425
|
}
|
|
46385
46426
|
function move(file, options2) {
|
|
46386
46427
|
const { date, client } = options2;
|
|
@@ -46390,19 +46431,19 @@ function move(file, options2) {
|
|
|
46390
46431
|
}
|
|
46391
46432
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
46392
46433
|
const filename = basename29(file);
|
|
46393
|
-
const sourcePath =
|
|
46434
|
+
const sourcePath = join107(vttDir, filename);
|
|
46394
46435
|
if (!existsSync84(sourcePath)) {
|
|
46395
46436
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
46396
46437
|
process.exit(1);
|
|
46397
46438
|
}
|
|
46398
46439
|
const base = basename29(filename, ".vtt").replace(/ Transcription$/, "");
|
|
46399
46440
|
const outputName = `${date} ${base}.md`;
|
|
46400
|
-
const formattedDir =
|
|
46441
|
+
const formattedDir = join107(transcriptsDir, client);
|
|
46401
46442
|
mkdirSync38(formattedDir, { recursive: true });
|
|
46402
|
-
const formattedPath =
|
|
46443
|
+
const formattedPath = join107(formattedDir, outputName);
|
|
46403
46444
|
writeFileSync52(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
|
|
46404
46445
|
archiveRawVtt(vttDir, sourcePath, filename);
|
|
46405
|
-
const summaryPath =
|
|
46446
|
+
const summaryPath = join107(summaryDir, client, outputName);
|
|
46406
46447
|
console.log(`Formatted transcript: ${formattedPath}`);
|
|
46407
46448
|
console.log(`Summary target: ${summaryPath}`);
|
|
46408
46449
|
}
|
|
@@ -47025,7 +47066,7 @@ function configKeys2() {
|
|
|
47025
47066
|
}
|
|
47026
47067
|
|
|
47027
47068
|
// src/commands/verify/forbiddenStrings.ts
|
|
47028
|
-
import { existsSync as existsSync86, readFileSync as
|
|
47069
|
+
import { existsSync as existsSync86, readFileSync as readFileSync70 } from "fs";
|
|
47029
47070
|
|
|
47030
47071
|
// src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
|
|
47031
47072
|
import { minimatch as minimatch10 } from "minimatch";
|
|
@@ -47072,7 +47113,7 @@ function forbiddenStrings() {
|
|
|
47072
47113
|
}
|
|
47073
47114
|
let parsed;
|
|
47074
47115
|
try {
|
|
47075
|
-
parsed = JSON.parse(
|
|
47116
|
+
parsed = JSON.parse(readFileSync70(file, "utf8"));
|
|
47076
47117
|
} catch (error) {
|
|
47077
47118
|
console.log(`Could not parse ${file}: ${error.message}`);
|
|
47078
47119
|
process.exit(1);
|
|
@@ -47144,7 +47185,7 @@ Total: ${lines2.length} hardcoded color(s)`);
|
|
|
47144
47185
|
}
|
|
47145
47186
|
|
|
47146
47187
|
// src/commands/verify/migrations.ts
|
|
47147
|
-
import { readFileSync as
|
|
47188
|
+
import { readFileSync as readFileSync71 } from "fs";
|
|
47148
47189
|
import path105 from "path";
|
|
47149
47190
|
|
|
47150
47191
|
// src/commands/verify/migrations/checkAppendOnly.ts
|
|
@@ -47309,7 +47350,7 @@ function migrations2() {
|
|
|
47309
47350
|
if (ref) {
|
|
47310
47351
|
const baseline = readBaselineMigrations(REPO_RELATIVE_DIR, ref);
|
|
47311
47352
|
const current = new Map(
|
|
47312
|
-
files.map((file) => [file,
|
|
47353
|
+
files.map((file) => [file, readFileSync71(path105.join(dir, file), "utf8")])
|
|
47313
47354
|
);
|
|
47314
47355
|
for (const finding of checkAppendOnly(baseline, current)) {
|
|
47315
47356
|
problems.push(
|
|
@@ -48267,8 +48308,8 @@ function registerWatch(program) {
|
|
|
48267
48308
|
|
|
48268
48309
|
// src/commands/roam/postRoamActivity.ts
|
|
48269
48310
|
import { execFileSync as execFileSync31 } from "child_process";
|
|
48270
|
-
import { readdirSync as readdirSync26, readFileSync as
|
|
48271
|
-
import { join as
|
|
48311
|
+
import { readdirSync as readdirSync26, readFileSync as readFileSync72, statSync as statSync14 } from "fs";
|
|
48312
|
+
import { join as join108 } from "path";
|
|
48272
48313
|
function findPortFile(roamDir) {
|
|
48273
48314
|
let entries;
|
|
48274
48315
|
try {
|
|
@@ -48277,7 +48318,7 @@ function findPortFile(roamDir) {
|
|
|
48277
48318
|
return void 0;
|
|
48278
48319
|
}
|
|
48279
48320
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
48280
|
-
const path109 =
|
|
48321
|
+
const path109 = join108(roamDir, name);
|
|
48281
48322
|
try {
|
|
48282
48323
|
return { path: path109, mtimeMs: statSync14(path109).mtimeMs };
|
|
48283
48324
|
} catch {
|
|
@@ -48294,11 +48335,11 @@ var PID_BY_APP = {
|
|
|
48294
48335
|
function postRoamActivity(app, event) {
|
|
48295
48336
|
const appData = process.env.APPDATA;
|
|
48296
48337
|
if (!appData) return;
|
|
48297
|
-
const portFile = findPortFile(
|
|
48338
|
+
const portFile = findPortFile(join108(appData, "Roam"));
|
|
48298
48339
|
if (!portFile) return;
|
|
48299
48340
|
let port;
|
|
48300
48341
|
try {
|
|
48301
|
-
port =
|
|
48342
|
+
port = readFileSync72(portFile, "utf8").trim();
|
|
48302
48343
|
} catch {
|
|
48303
48344
|
return;
|
|
48304
48345
|
}
|
|
@@ -48637,11 +48678,11 @@ function requireParsedArgs() {
|
|
|
48637
48678
|
}
|
|
48638
48679
|
|
|
48639
48680
|
// src/commands/run/runCommandFilePath.ts
|
|
48640
|
-
import { join as
|
|
48681
|
+
import { join as join109 } from "path";
|
|
48641
48682
|
function runCommandFilePath(name) {
|
|
48642
48683
|
const segments = name.split(":");
|
|
48643
48684
|
const file = `${segments.pop()}.md`;
|
|
48644
|
-
return
|
|
48685
|
+
return join109(".claude", "commands", ...segments, file);
|
|
48645
48686
|
}
|
|
48646
48687
|
|
|
48647
48688
|
// src/commands/run/add.ts
|
|
@@ -48770,7 +48811,7 @@ function registerRunAdd(runCommand) {
|
|
|
48770
48811
|
|
|
48771
48812
|
// src/commands/run/remove.ts
|
|
48772
48813
|
import { existsSync as existsSync90, readdirSync as readdirSync27, rmdirSync, unlinkSync as unlinkSync20 } from "fs";
|
|
48773
|
-
import { dirname as dirname47, join as
|
|
48814
|
+
import { dirname as dirname47, join as join110 } from "path";
|
|
48774
48815
|
|
|
48775
48816
|
// src/commands/run/removeRepoRunConfig.ts
|
|
48776
48817
|
function isNamed(entry, name) {
|
|
@@ -48788,7 +48829,7 @@ function removeRepoRunConfig(name, repoName, cwd = process.cwd()) {
|
|
|
48788
48829
|
|
|
48789
48830
|
// src/commands/run/remove.ts
|
|
48790
48831
|
function removeEmptyNamespaceDirs(filePath) {
|
|
48791
|
-
const root2 =
|
|
48832
|
+
const root2 = join110(".claude", "commands");
|
|
48792
48833
|
for (let dir = dirname47(filePath); dir !== root2; dir = dirname47(dir)) {
|
|
48793
48834
|
if (!existsSync90(dir) || readdirSync27(dir).length > 0) return;
|
|
48794
48835
|
rmdirSync(dir);
|
|
@@ -48796,7 +48837,7 @@ function removeEmptyNamespaceDirs(filePath) {
|
|
|
48796
48837
|
}
|
|
48797
48838
|
function deleteCommandFile(name) {
|
|
48798
48839
|
const filePath = runCommandFilePath(name);
|
|
48799
|
-
const legacyPath =
|
|
48840
|
+
const legacyPath = join110(".claude", "commands", `${name}.md`);
|
|
48800
48841
|
for (const path109 of /* @__PURE__ */ new Set([filePath, legacyPath])) {
|
|
48801
48842
|
if (existsSync90(path109)) {
|
|
48802
48843
|
unlinkSync20(path109);
|
|
@@ -48919,11 +48960,11 @@ function applyLine(result, pending, line) {
|
|
|
48919
48960
|
}
|
|
48920
48961
|
|
|
48921
48962
|
// src/commands/sessions/daemon/readDaemonPidFile.ts
|
|
48922
|
-
import { readFileSync as
|
|
48963
|
+
import { readFileSync as readFileSync73 } from "fs";
|
|
48923
48964
|
function readDaemonPidFile() {
|
|
48924
48965
|
try {
|
|
48925
48966
|
const pid = Number.parseInt(
|
|
48926
|
-
|
|
48967
|
+
readFileSync73(daemonPaths.pid, "utf8").trim(),
|
|
48927
48968
|
10
|
|
48928
48969
|
);
|
|
48929
48970
|
return Number.isInteger(pid) ? pid : void 0;
|
|
@@ -49603,7 +49644,7 @@ function broadcastSessions(sessions, clients, linkedSessions = [], active) {
|
|
|
49603
49644
|
|
|
49604
49645
|
// src/commands/sessions/daemon/findServerParents.ts
|
|
49605
49646
|
import { existsSync as existsSync92 } from "fs";
|
|
49606
|
-
import { join as
|
|
49647
|
+
import { join as join111, resolve as resolve32 } from "path";
|
|
49607
49648
|
function isLive(session) {
|
|
49608
49649
|
return !!session.pty && session.status !== "done" && session.status !== "error";
|
|
49609
49650
|
}
|
|
@@ -49612,7 +49653,7 @@ function isLiveAgent(session) {
|
|
|
49612
49653
|
}
|
|
49613
49654
|
function serverRunDirs(sessions, file) {
|
|
49614
49655
|
return new Set(
|
|
49615
|
-
sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve32(s.cwd)).filter((dir) => existsSync92(
|
|
49656
|
+
sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve32(s.cwd)).filter((dir) => existsSync92(join111(dir, file)))
|
|
49616
49657
|
);
|
|
49617
49658
|
}
|
|
49618
49659
|
function findServerParents(sessions, file) {
|
|
@@ -49766,7 +49807,7 @@ function sendResizeSnapshot(s, send) {
|
|
|
49766
49807
|
}
|
|
49767
49808
|
|
|
49768
49809
|
// src/commands/sessions/daemon/viewerSize.ts
|
|
49769
|
-
import { readFileSync as
|
|
49810
|
+
import { readFileSync as readFileSync74, writeFileSync as writeFileSync58 } from "fs";
|
|
49770
49811
|
var DEFAULT_SIZE = { cols: 120, rows: 30 };
|
|
49771
49812
|
var remembered;
|
|
49772
49813
|
function rememberViewerSize(cols, rows) {
|
|
@@ -49788,7 +49829,7 @@ function viewerSize() {
|
|
|
49788
49829
|
function readSavedSize() {
|
|
49789
49830
|
try {
|
|
49790
49831
|
const { cols, rows } = JSON.parse(
|
|
49791
|
-
|
|
49832
|
+
readFileSync74(daemonPaths.viewerSize, "utf8")
|
|
49792
49833
|
);
|
|
49793
49834
|
if (typeof cols === "number" && typeof rows === "number" && cols > 0)
|
|
49794
49835
|
return { cols, rows };
|
|
@@ -50673,14 +50714,14 @@ async function runAutoUpdateLoop(deps2, maxLaps = Number.POSITIVE_INFINITY) {
|
|
|
50673
50714
|
}
|
|
50674
50715
|
|
|
50675
50716
|
// src/commands/sessions/daemon/autoUpdate/trimWatcherLog.ts
|
|
50676
|
-
import { readFileSync as
|
|
50717
|
+
import { readFileSync as readFileSync76, writeFileSync as writeFileSync60 } from "fs";
|
|
50677
50718
|
var KEEP_TAIL = 256 * 1024;
|
|
50678
50719
|
var MAX_LOG_SIZE = 4 * 1024 * 1024;
|
|
50679
50720
|
function trimWatcherLog(cwd) {
|
|
50680
50721
|
const path109 = watcherLogPath(cwd);
|
|
50681
50722
|
let log2;
|
|
50682
50723
|
try {
|
|
50683
|
-
log2 =
|
|
50724
|
+
log2 = readFileSync76(path109, "utf8");
|
|
50684
50725
|
} catch {
|
|
50685
50726
|
return;
|
|
50686
50727
|
}
|
|
@@ -51095,12 +51136,12 @@ import { basename as basename32 } from "path";
|
|
|
51095
51136
|
|
|
51096
51137
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
51097
51138
|
import { existsSync as existsSync97 } from "fs";
|
|
51098
|
-
import { join as
|
|
51139
|
+
import { join as join114 } from "path";
|
|
51099
51140
|
|
|
51100
51141
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
51101
51142
|
import { statSync as statSync16 } from "fs";
|
|
51102
51143
|
import { rm as rm3 } from "fs/promises";
|
|
51103
|
-
import { join as
|
|
51144
|
+
import { join as join113 } from "path";
|
|
51104
51145
|
async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
51105
51146
|
if (holdsAGitDirectoryRatherThanALink(worktreePath)) {
|
|
51106
51147
|
const refusal = "it is a clone of its own, not a linked worktree";
|
|
@@ -51128,7 +51169,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
|
51128
51169
|
return { removed: true };
|
|
51129
51170
|
}
|
|
51130
51171
|
function holdsAGitDirectoryRatherThanALink(worktreePath) {
|
|
51131
|
-
return statSync16(
|
|
51172
|
+
return statSync16(join113(worktreePath, ".git"), {
|
|
51132
51173
|
throwIfNoEntry: false
|
|
51133
51174
|
})?.isDirectory() === true;
|
|
51134
51175
|
}
|
|
@@ -51164,7 +51205,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
51164
51205
|
);
|
|
51165
51206
|
}
|
|
51166
51207
|
function strandedReason(worktreePath, cause) {
|
|
51167
|
-
if (!existsSync97(
|
|
51208
|
+
if (!existsSync97(join114(worktreePath, ".git")))
|
|
51168
51209
|
return "its .git link is already gone";
|
|
51169
51210
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
51170
51211
|
return "git no longer recognises it as a working tree";
|
|
@@ -51464,7 +51505,7 @@ function pidList(pids) {
|
|
|
51464
51505
|
}
|
|
51465
51506
|
|
|
51466
51507
|
// src/commands/sessions/daemon/worktree/readOccupant.ts
|
|
51467
|
-
import { readFileSync as
|
|
51508
|
+
import { readFileSync as readFileSync77 } from "fs";
|
|
51468
51509
|
var VSCODE_PATHS = [
|
|
51469
51510
|
"/.vscode-server/",
|
|
51470
51511
|
"/.vscode-server-insiders/",
|
|
@@ -51499,7 +51540,7 @@ function parentPid(stat5) {
|
|
|
51499
51540
|
}
|
|
51500
51541
|
function readProc(procRoot, pid, file) {
|
|
51501
51542
|
try {
|
|
51502
|
-
return
|
|
51543
|
+
return readFileSync77(`${procRoot}/${pid}/${file}`, "utf8");
|
|
51503
51544
|
} catch {
|
|
51504
51545
|
return void 0;
|
|
51505
51546
|
}
|
|
@@ -56108,7 +56149,7 @@ import { existsSync as existsSync105 } from "fs";
|
|
|
56108
56149
|
|
|
56109
56150
|
// src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
|
|
56110
56151
|
import { copyFileSync as copyFileSync4, existsSync as existsSync104, mkdirSync as mkdirSync43 } from "fs";
|
|
56111
|
-
import { join as
|
|
56152
|
+
import { join as join115 } from "path";
|
|
56112
56153
|
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
56113
56154
|
const dir = projectDirForCwd(toCwd);
|
|
56114
56155
|
if (dir === projectDirForCwd(fromCwd)) {
|
|
@@ -56117,7 +56158,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
56117
56158
|
);
|
|
56118
56159
|
return;
|
|
56119
56160
|
}
|
|
56120
|
-
const dest =
|
|
56161
|
+
const dest = join115(dir, `${claudeSessionId}.jsonl`);
|
|
56121
56162
|
if (existsSync104(dest)) {
|
|
56122
56163
|
daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
|
|
56123
56164
|
return;
|
|
@@ -57686,7 +57727,7 @@ function handleConnection(socket, manager) {
|
|
|
57686
57727
|
import { unlinkSync as unlinkSync21, writeFileSync as writeFileSync62 } from "fs";
|
|
57687
57728
|
|
|
57688
57729
|
// src/commands/sessions/daemon/startPidFileWatchdog.ts
|
|
57689
|
-
import { readFileSync as
|
|
57730
|
+
import { readFileSync as readFileSync78 } from "fs";
|
|
57690
57731
|
var WATCHDOG_INTERVAL_MS = 5e3;
|
|
57691
57732
|
function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
57692
57733
|
const timer = setInterval(() => {
|
|
@@ -57697,7 +57738,7 @@ function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
|
57697
57738
|
}
|
|
57698
57739
|
function ownsPidFile() {
|
|
57699
57740
|
try {
|
|
57700
|
-
return
|
|
57741
|
+
return readFileSync78(daemonPaths.pid, "utf8").trim() === String(process.pid);
|
|
57701
57742
|
} catch {
|
|
57702
57743
|
return false;
|
|
57703
57744
|
}
|