@staff0rd/assist 0.1059.1 → 0.1059.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/built-version +1 -0
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +331 -310
- 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.1059.
|
|
9
|
+
version: "0.1059.2",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -12980,7 +12980,7 @@ function unsetConfig(req, res) {
|
|
|
12980
12980
|
}
|
|
12981
12981
|
|
|
12982
12982
|
// src/commands/watch/isBuildPending.ts
|
|
12983
|
-
import { existsSync as
|
|
12983
|
+
import { existsSync as existsSync25 } from "fs";
|
|
12984
12984
|
|
|
12985
12985
|
// src/commands/watch/gitMarkerPath.ts
|
|
12986
12986
|
import { resolve as resolve11 } from "path";
|
|
@@ -13039,15 +13039,6 @@ function buildPendingPath(cwd) {
|
|
|
13039
13039
|
return gitMarkerPath("assist-watch-build-pending", cwd);
|
|
13040
13040
|
}
|
|
13041
13041
|
|
|
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
13042
|
// src/commands/watch/readBuiltVersion.ts
|
|
13052
13043
|
import { join as join28 } from "path";
|
|
13053
13044
|
|
|
@@ -13105,6 +13096,36 @@ function readBuiltVersion(cwd) {
|
|
|
13105
13096
|
}
|
|
13106
13097
|
}
|
|
13107
13098
|
|
|
13099
|
+
// src/commands/watch/readDistVersion.ts
|
|
13100
|
+
import { readFileSync as readFileSync10 } from "fs";
|
|
13101
|
+
import { join as join29 } from "path";
|
|
13102
|
+
function readDistVersion(cwd) {
|
|
13103
|
+
try {
|
|
13104
|
+
const root2 = runGit3(["rev-parse", "--show-toplevel"], cwd);
|
|
13105
|
+
return readFileSync10(join29(root2, "dist", "built-version"), "utf8").trim();
|
|
13106
|
+
} catch {
|
|
13107
|
+
return void 0;
|
|
13108
|
+
}
|
|
13109
|
+
}
|
|
13110
|
+
|
|
13111
|
+
// src/commands/watch/isDistBehind.ts
|
|
13112
|
+
function isDistBehind(cwd) {
|
|
13113
|
+
const dist = readDistVersion(cwd);
|
|
13114
|
+
return dist !== void 0 && dist !== readBuiltVersion(cwd);
|
|
13115
|
+
}
|
|
13116
|
+
|
|
13117
|
+
// src/commands/watch/isBuildPending.ts
|
|
13118
|
+
function markedPending(cwd) {
|
|
13119
|
+
try {
|
|
13120
|
+
return existsSync25(buildPendingPath(cwd));
|
|
13121
|
+
} catch {
|
|
13122
|
+
return false;
|
|
13123
|
+
}
|
|
13124
|
+
}
|
|
13125
|
+
function isBuildPending(cwd) {
|
|
13126
|
+
return markedPending(cwd) || isDistBehind(cwd);
|
|
13127
|
+
}
|
|
13128
|
+
|
|
13108
13129
|
// src/commands/extension/extensionUpdateStatus.ts
|
|
13109
13130
|
import semver from "semver";
|
|
13110
13131
|
function extensionUpdateStatus(connected, latest2) {
|
|
@@ -13122,17 +13143,17 @@ function extensionUpdateStatus(connected, latest2) {
|
|
|
13122
13143
|
|
|
13123
13144
|
// src/commands/extension/fetchLatestSignedExtension.ts
|
|
13124
13145
|
import { readFile as readFile2 } from "fs/promises";
|
|
13125
|
-
import { join as
|
|
13146
|
+
import { join as join31 } from "path";
|
|
13126
13147
|
|
|
13127
13148
|
// src/commands/extension/extensionDir.ts
|
|
13128
13149
|
import { existsSync as existsSync26 } from "fs";
|
|
13129
|
-
import { dirname as dirname14, join as
|
|
13150
|
+
import { dirname as dirname14, join as join30 } from "path";
|
|
13130
13151
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
13131
13152
|
var moduleDir = dirname14(fileURLToPath2(import.meta.url));
|
|
13132
13153
|
function extensionDir() {
|
|
13133
|
-
const bundled =
|
|
13154
|
+
const bundled = join30(moduleDir, "commands", "extension", "extension");
|
|
13134
13155
|
if (existsSync26(bundled)) return bundled;
|
|
13135
|
-
return
|
|
13156
|
+
return join30(moduleDir, "..", "..", "..", "extension");
|
|
13136
13157
|
}
|
|
13137
13158
|
|
|
13138
13159
|
// src/commands/extension/latestUpdate.ts
|
|
@@ -13144,7 +13165,7 @@ function latestUpdate(manifest, updates2) {
|
|
|
13144
13165
|
// src/commands/extension/fetchLatestSignedExtension.ts
|
|
13145
13166
|
async function fetchLatestSignedExtension() {
|
|
13146
13167
|
const manifest = await readFile2(
|
|
13147
|
-
|
|
13168
|
+
join31(extensionDir(), "manifest.json"),
|
|
13148
13169
|
"utf8"
|
|
13149
13170
|
);
|
|
13150
13171
|
const updateUrl = JSON.parse(manifest).browser_specific_settings.gecko.update_url;
|
|
@@ -13218,7 +13239,7 @@ function stripAnsi(text20) {
|
|
|
13218
13239
|
// src/commands/sessions/daemon/worktree/watcherLogPath.ts
|
|
13219
13240
|
import { createHash } from "crypto";
|
|
13220
13241
|
import { homedir as homedir13 } from "os";
|
|
13221
|
-
import { basename as basename10, join as
|
|
13242
|
+
import { basename as basename10, join as join32 } from "path";
|
|
13222
13243
|
|
|
13223
13244
|
// src/commands/sessions/daemon/worktree/canonicalTreePath.ts
|
|
13224
13245
|
import { realpathSync } from "fs";
|
|
@@ -13235,8 +13256,8 @@ function canonicalTreePath(path109) {
|
|
|
13235
13256
|
function watcherLogPath(cwd) {
|
|
13236
13257
|
const clone = canonicalTreePath(cwd);
|
|
13237
13258
|
const key = createHash("sha1").update(clone).digest("hex").slice(0, 8);
|
|
13238
|
-
const dir = process.env.ASSIST_WATCHER_LOG_DIR ??
|
|
13239
|
-
return
|
|
13259
|
+
const dir = process.env.ASSIST_WATCHER_LOG_DIR ?? join32(homedir13(), ".assist", "watchers");
|
|
13260
|
+
return join32(dir, `${basename10(clone) || "root"}-${key}.log`);
|
|
13240
13261
|
}
|
|
13241
13262
|
|
|
13242
13263
|
// src/commands/sessions/web/updates/readUpdateHistory.ts
|
|
@@ -13365,7 +13386,7 @@ async function readRequestBuffer(req, limit) {
|
|
|
13365
13386
|
|
|
13366
13387
|
// src/commands/sessions/web/stageAttachment.ts
|
|
13367
13388
|
import { mkdir, mkdtemp, writeFile } from "fs/promises";
|
|
13368
|
-
import { extname as extname2, join as
|
|
13389
|
+
import { extname as extname2, join as join33 } from "path";
|
|
13369
13390
|
|
|
13370
13391
|
// src/commands/sessions/web/ghAttachableExtensions.ts
|
|
13371
13392
|
var ghAttachableExtensions = /* @__PURE__ */ new Set([
|
|
@@ -13397,9 +13418,9 @@ function safeBaseName(name) {
|
|
|
13397
13418
|
async function stageAttachment(name, contentType, body) {
|
|
13398
13419
|
const ext = pickExtension(name, contentType);
|
|
13399
13420
|
await mkdir(stagedAttachmentsDir, { recursive: true });
|
|
13400
|
-
const dir = await mkdtemp(
|
|
13421
|
+
const dir = await mkdtemp(join33(stagedAttachmentsDir, "upload-"));
|
|
13401
13422
|
const alt = safeBaseName(name);
|
|
13402
|
-
const filePath =
|
|
13423
|
+
const filePath = join33(dir, `${alt}.${ext}`);
|
|
13403
13424
|
await writeFile(filePath, body);
|
|
13404
13425
|
return { dir, filePath, alt };
|
|
13405
13426
|
}
|
|
@@ -13449,14 +13470,14 @@ import { readFile as readFile3, stat as stat3, writeFile as writeFile2 } from "f
|
|
|
13449
13470
|
// src/commands/sessions/web/formatWithOxfmt.ts
|
|
13450
13471
|
import { execFile as execFile9 } from "child_process";
|
|
13451
13472
|
import { existsSync as existsSync27 } from "fs";
|
|
13452
|
-
import { dirname as dirname15, join as
|
|
13473
|
+
import { dirname as dirname15, join as join34 } from "path";
|
|
13453
13474
|
import { promisify as promisify10 } from "util";
|
|
13454
13475
|
var execFileAsync9 = promisify10(execFile9);
|
|
13455
13476
|
var TIMEOUT_MS = 15e3;
|
|
13456
13477
|
function findOxfmtScript(root2) {
|
|
13457
13478
|
let dir = root2;
|
|
13458
13479
|
for (; ; ) {
|
|
13459
|
-
const candidate =
|
|
13480
|
+
const candidate = join34(dir, "node_modules", "oxfmt", "bin", "oxfmt");
|
|
13460
13481
|
if (existsSync27(candidate)) return candidate;
|
|
13461
13482
|
const parent = dirname15(dir);
|
|
13462
13483
|
if (parent === dir) return void 0;
|
|
@@ -13528,16 +13549,16 @@ async function writeFileContent(req, res) {
|
|
|
13528
13549
|
|
|
13529
13550
|
// src/shared/createBundleHandler.ts
|
|
13530
13551
|
import { createHash as createHash2 } from "crypto";
|
|
13531
|
-
import { readFileSync as
|
|
13532
|
-
import { dirname as dirname16, join as
|
|
13552
|
+
import { readFileSync as readFileSync11, statSync as statSync7 } from "fs";
|
|
13553
|
+
import { dirname as dirname16, join as join35 } from "path";
|
|
13533
13554
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
13534
13555
|
function createBundleHandler(importMetaUrl, bundlePath, contentType = "application/javascript") {
|
|
13535
|
-
const file =
|
|
13556
|
+
const file = join35(dirname16(fileURLToPath3(importMetaUrl)), bundlePath);
|
|
13536
13557
|
let cache7;
|
|
13537
13558
|
return (req, res) => {
|
|
13538
13559
|
const mtimeMs = statSync7(file).mtimeMs;
|
|
13539
13560
|
if (cache7?.mtimeMs !== mtimeMs) {
|
|
13540
|
-
const body =
|
|
13561
|
+
const body = readFileSync11(file);
|
|
13541
13562
|
const etag = `"${createHash2("sha256").update(body).digest("hex").slice(0, 16)}"`;
|
|
13542
13563
|
cache7 = { body, etag, mtimeMs };
|
|
13543
13564
|
}
|
|
@@ -13560,7 +13581,7 @@ function createBundleHandler(importMetaUrl, bundlePath, contentType = "applicati
|
|
|
13560
13581
|
|
|
13561
13582
|
// src/commands/sessions/web/createCssHandler.ts
|
|
13562
13583
|
import { createHash as createHash3 } from "crypto";
|
|
13563
|
-
import { readFileSync as
|
|
13584
|
+
import { readFileSync as readFileSync12 } from "fs";
|
|
13564
13585
|
import { createRequire } from "module";
|
|
13565
13586
|
var require2 = createRequire(import.meta.url);
|
|
13566
13587
|
function createCssHandler(packageEntry) {
|
|
@@ -13568,7 +13589,7 @@ function createCssHandler(packageEntry) {
|
|
|
13568
13589
|
return (req, res) => {
|
|
13569
13590
|
if (!cache7) {
|
|
13570
13591
|
const resolved = require2.resolve(packageEntry);
|
|
13571
|
-
const body =
|
|
13592
|
+
const body = readFileSync12(resolved, "utf8");
|
|
13572
13593
|
const etag = `"${createHash3("sha256").update(body).digest("hex").slice(0, 16)}"`;
|
|
13573
13594
|
cache7 = { body, etag };
|
|
13574
13595
|
}
|
|
@@ -14479,17 +14500,17 @@ import * as path16 from "path";
|
|
|
14479
14500
|
import chalk21 from "chalk";
|
|
14480
14501
|
|
|
14481
14502
|
// src/commands/verify/addToKnipIgnoreBinaries.ts
|
|
14482
|
-
import { existsSync as existsSync29, readFileSync as
|
|
14483
|
-
import { join as
|
|
14503
|
+
import { existsSync as existsSync29, readFileSync as readFileSync13, writeFileSync as writeFileSync7 } from "fs";
|
|
14504
|
+
import { join as join36 } from "path";
|
|
14484
14505
|
import chalk20 from "chalk";
|
|
14485
14506
|
function loadKnipConfig(knipJsonPath) {
|
|
14486
14507
|
if (existsSync29(knipJsonPath)) {
|
|
14487
|
-
return JSON.parse(
|
|
14508
|
+
return JSON.parse(readFileSync13(knipJsonPath, "utf8"));
|
|
14488
14509
|
}
|
|
14489
14510
|
return { $schema: "https://unpkg.com/knip@5/schema.json" };
|
|
14490
14511
|
}
|
|
14491
14512
|
function addToKnipIgnoreBinaries(cwd, binary) {
|
|
14492
|
-
const knipJsonPath =
|
|
14513
|
+
const knipJsonPath = join36(cwd, "knip.json");
|
|
14493
14514
|
try {
|
|
14494
14515
|
const knipConfig = loadKnipConfig(knipJsonPath);
|
|
14495
14516
|
const ignoreBinaries = knipConfig.ignoreBinaries ?? [];
|
|
@@ -14536,7 +14557,7 @@ import * as path18 from "path";
|
|
|
14536
14557
|
import chalk26 from "chalk";
|
|
14537
14558
|
|
|
14538
14559
|
// src/commands/format/init.ts
|
|
14539
|
-
import { existsSync as existsSync30, readFileSync as
|
|
14560
|
+
import { existsSync as existsSync30, readFileSync as readFileSync14, writeFileSync as writeFileSync8 } from "fs";
|
|
14540
14561
|
import chalk24 from "chalk";
|
|
14541
14562
|
|
|
14542
14563
|
// src/shared/promptConfirm.ts
|
|
@@ -14598,7 +14619,7 @@ async function init() {
|
|
|
14598
14619
|
const newContent = `${JSON.stringify(oxfmtrc_template_default, null, " ")}
|
|
14599
14620
|
`;
|
|
14600
14621
|
const configPath = ".oxfmtrc.json";
|
|
14601
|
-
const oldContent = existsSync30(configPath) ?
|
|
14622
|
+
const oldContent = existsSync30(configPath) ? readFileSync14(configPath, "utf8") : "";
|
|
14602
14623
|
if (oldContent === newContent) {
|
|
14603
14624
|
console.log(".oxfmtrc.json already has the baseline formatter config");
|
|
14604
14625
|
return;
|
|
@@ -14621,12 +14642,12 @@ async function init() {
|
|
|
14621
14642
|
}
|
|
14622
14643
|
|
|
14623
14644
|
// src/commands/lint/init.ts
|
|
14624
|
-
import { existsSync as existsSync33, readFileSync as
|
|
14645
|
+
import { existsSync as existsSync33, readFileSync as readFileSync16, writeFileSync as writeFileSync10 } from "fs";
|
|
14625
14646
|
import chalk25 from "chalk";
|
|
14626
14647
|
|
|
14627
14648
|
// src/shared/removeEslint.ts
|
|
14628
14649
|
import { execSync as execSync7 } from "child_process";
|
|
14629
|
-
import { existsSync as existsSync32, readFileSync as
|
|
14650
|
+
import { existsSync as existsSync32, readFileSync as readFileSync15, writeFileSync as writeFileSync9 } from "fs";
|
|
14630
14651
|
|
|
14631
14652
|
// src/shared/removeEslint/removeEslintConfigFiles.ts
|
|
14632
14653
|
import { existsSync as existsSync31, unlinkSync as unlinkSync2 } from "fs";
|
|
@@ -14670,7 +14691,7 @@ function removeEslintFromPackageJson(options2) {
|
|
|
14670
14691
|
if (!existsSync32(packageJsonPath)) {
|
|
14671
14692
|
return false;
|
|
14672
14693
|
}
|
|
14673
|
-
const packageJson = JSON.parse(
|
|
14694
|
+
const packageJson = JSON.parse(readFileSync15(packageJsonPath, "utf8"));
|
|
14674
14695
|
let modified = false;
|
|
14675
14696
|
modified = removeEslintDeps(packageJson.dependencies) || modified;
|
|
14676
14697
|
modified = removeEslintDeps(packageJson.devDependencies) || modified;
|
|
@@ -14734,7 +14755,7 @@ async function writeOxlintConfig() {
|
|
|
14734
14755
|
const newContent = `${JSON.stringify(oxlintrc_template_default, null, " ")}
|
|
14735
14756
|
`;
|
|
14736
14757
|
const configPath = ".oxlintrc.json";
|
|
14737
|
-
const oldContent = existsSync33(configPath) ?
|
|
14758
|
+
const oldContent = existsSync33(configPath) ? readFileSync16(configPath, "utf8") : "";
|
|
14738
14759
|
if (oldContent === newContent) {
|
|
14739
14760
|
console.log(".oxlintrc.json already has the baseline linter config");
|
|
14740
14761
|
return;
|
|
@@ -15515,7 +15536,7 @@ async function newCli() {
|
|
|
15515
15536
|
|
|
15516
15537
|
// src/commands/new/registerNew/newProject.ts
|
|
15517
15538
|
import { execSync as execSync14 } from "child_process";
|
|
15518
|
-
import { existsSync as existsSync38, readFileSync as
|
|
15539
|
+
import { existsSync as existsSync38, readFileSync as readFileSync20, writeFileSync as writeFileSync17 } from "fs";
|
|
15519
15540
|
|
|
15520
15541
|
// src/commands/deploy/init.ts
|
|
15521
15542
|
import { execSync as execSync13 } from "child_process";
|
|
@@ -15523,8 +15544,8 @@ import chalk36 from "chalk";
|
|
|
15523
15544
|
import enquirer3 from "enquirer";
|
|
15524
15545
|
|
|
15525
15546
|
// src/commands/deploy/init/updateWorkflow.ts
|
|
15526
|
-
import { existsSync as existsSync37, mkdirSync as mkdirSync9, readFileSync as
|
|
15527
|
-
import { dirname as dirname24, join as
|
|
15547
|
+
import { existsSync as existsSync37, mkdirSync as mkdirSync9, readFileSync as readFileSync19, writeFileSync as writeFileSync16 } from "fs";
|
|
15548
|
+
import { dirname as dirname24, join as join43 } from "path";
|
|
15528
15549
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
15529
15550
|
import chalk35 from "chalk";
|
|
15530
15551
|
var WORKFLOW_PATH = ".github/workflows/build.yml";
|
|
@@ -15533,13 +15554,13 @@ function getExistingSiteId() {
|
|
|
15533
15554
|
if (!existsSync37(WORKFLOW_PATH)) {
|
|
15534
15555
|
return null;
|
|
15535
15556
|
}
|
|
15536
|
-
const content =
|
|
15557
|
+
const content = readFileSync19(WORKFLOW_PATH, "utf8");
|
|
15537
15558
|
const match = content.match(/-s\s+([a-f0-9-]{36})/);
|
|
15538
15559
|
return match ? match[1] : null;
|
|
15539
15560
|
}
|
|
15540
15561
|
function getTemplateContent(siteId) {
|
|
15541
|
-
const templatePath =
|
|
15542
|
-
const template =
|
|
15562
|
+
const templatePath = join43(__dirname3, "commands/deploy/build.yml");
|
|
15563
|
+
const template = readFileSync19(templatePath, "utf8");
|
|
15543
15564
|
return template.replace("{{NETLIFY_SITE_ID}}", siteId);
|
|
15544
15565
|
}
|
|
15545
15566
|
async function updateWorkflow(siteId) {
|
|
@@ -15549,7 +15570,7 @@ async function updateWorkflow(siteId) {
|
|
|
15549
15570
|
mkdirSync9(workflowDir, { recursive: true });
|
|
15550
15571
|
}
|
|
15551
15572
|
if (existsSync37(WORKFLOW_PATH)) {
|
|
15552
|
-
const oldContent =
|
|
15573
|
+
const oldContent = readFileSync19(WORKFLOW_PATH, "utf8");
|
|
15553
15574
|
if (oldContent === newContent) {
|
|
15554
15575
|
console.log(chalk35.green("build.yml is already up to date"));
|
|
15555
15576
|
return;
|
|
@@ -15647,7 +15668,7 @@ function addViteBaseConfig() {
|
|
|
15647
15668
|
console.log("No vite.config.ts found, skipping base config");
|
|
15648
15669
|
return;
|
|
15649
15670
|
}
|
|
15650
|
-
const content =
|
|
15671
|
+
const content = readFileSync20(viteConfigPath, "utf8");
|
|
15651
15672
|
if (content.includes("base:")) {
|
|
15652
15673
|
console.log("vite.config.ts already has base config");
|
|
15653
15674
|
return;
|
|
@@ -15845,17 +15866,17 @@ function adviceContextFor(cwd, env = process.env) {
|
|
|
15845
15866
|
}
|
|
15846
15867
|
|
|
15847
15868
|
// src/commands/advise/loadAdviceFragments.ts
|
|
15848
|
-
import { readdirSync as readdirSync7, readFileSync as
|
|
15849
|
-
import { basename as basename12, join as
|
|
15869
|
+
import { readdirSync as readdirSync7, readFileSync as readFileSync21 } from "fs";
|
|
15870
|
+
import { basename as basename12, join as join45 } from "path";
|
|
15850
15871
|
|
|
15851
15872
|
// src/commands/advise/adviceDir.ts
|
|
15852
15873
|
import { existsSync as existsSync39 } from "fs";
|
|
15853
|
-
import { dirname as dirname25, join as
|
|
15874
|
+
import { dirname as dirname25, join as join44 } from "path";
|
|
15854
15875
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
15855
15876
|
function adviceDir() {
|
|
15856
15877
|
let current = dirname25(fileURLToPath5(import.meta.url));
|
|
15857
15878
|
while (current !== dirname25(current)) {
|
|
15858
|
-
const candidate =
|
|
15879
|
+
const candidate = join44(current, "claude", "advice");
|
|
15859
15880
|
if (existsSync39(candidate)) return candidate;
|
|
15860
15881
|
current = dirname25(current);
|
|
15861
15882
|
}
|
|
@@ -15888,7 +15909,7 @@ function loadAdviceFragments(dir = adviceDir()) {
|
|
|
15888
15909
|
return readdirSync7(dir).filter((file) => file.endsWith(".md")).sort().map(
|
|
15889
15910
|
(file) => parseAdviceFragment(
|
|
15890
15911
|
basename12(file, ".md"),
|
|
15891
|
-
|
|
15912
|
+
readFileSync21(join45(dir, file), "utf8")
|
|
15892
15913
|
)
|
|
15893
15914
|
);
|
|
15894
15915
|
}
|
|
@@ -15923,12 +15944,12 @@ function renderAdviceBody(fragment, context) {
|
|
|
15923
15944
|
|
|
15924
15945
|
// src/commands/advise/adviceConditions.ts
|
|
15925
15946
|
import { existsSync as existsSync40 } from "fs";
|
|
15926
|
-
import { join as
|
|
15947
|
+
import { join as join46 } from "path";
|
|
15927
15948
|
function repoFile(file, label) {
|
|
15928
15949
|
return {
|
|
15929
15950
|
whenMet: `the repo has ${label}`,
|
|
15930
15951
|
whenUnmet: `the repo has no ${label}`,
|
|
15931
|
-
matches: ({ rootDir }) => existsSync40(
|
|
15952
|
+
matches: ({ rootDir }) => existsSync40(join46(rootDir, file))
|
|
15932
15953
|
};
|
|
15933
15954
|
}
|
|
15934
15955
|
var adviceConditions = {
|
|
@@ -15954,11 +15975,11 @@ var adviceConditions = {
|
|
|
15954
15975
|
},
|
|
15955
15976
|
typescript: repoFile("tsconfig.json", "a tsconfig.json"),
|
|
15956
15977
|
filenameConvention: repoFile(
|
|
15957
|
-
|
|
15978
|
+
join46("oxlint-rules", "filenameConvention.ts"),
|
|
15958
15979
|
"oxlint-rules/filenameConvention.ts"
|
|
15959
15980
|
),
|
|
15960
15981
|
claudeSettings: repoFile(
|
|
15961
|
-
|
|
15982
|
+
join46("claude", "settings.json"),
|
|
15962
15983
|
"claude/settings.json"
|
|
15963
15984
|
),
|
|
15964
15985
|
verify: {
|
|
@@ -16566,7 +16587,7 @@ async function resolveCheckBump(check2) {
|
|
|
16566
16587
|
}
|
|
16567
16588
|
|
|
16568
16589
|
// src/commands/backlog/readJsonPayload.ts
|
|
16569
|
-
import { readFileSync as
|
|
16590
|
+
import { readFileSync as readFileSync22 } from "fs";
|
|
16570
16591
|
import chalk38 from "chalk";
|
|
16571
16592
|
function fail(message3) {
|
|
16572
16593
|
console.error(chalk38.red(message3));
|
|
@@ -16578,7 +16599,7 @@ function describe(error) {
|
|
|
16578
16599
|
async function readSource(source) {
|
|
16579
16600
|
try {
|
|
16580
16601
|
if (source === "-") return (await readStdinBuffer()).toString("utf8");
|
|
16581
|
-
return
|
|
16602
|
+
return readFileSync22(source, "utf8");
|
|
16582
16603
|
} catch (error) {
|
|
16583
16604
|
return fail(
|
|
16584
16605
|
`Cannot read the payload from ${source === "-" ? "stdin" : source}: ${describe(error)}`
|
|
@@ -16838,7 +16859,7 @@ function registerAskQuestion(program) {
|
|
|
16838
16859
|
|
|
16839
16860
|
// src/commands/registerBackup.ts
|
|
16840
16861
|
import { mkdir as mkdir3, stat as stat4 } from "fs/promises";
|
|
16841
|
-
import { join as
|
|
16862
|
+
import { join as join48, resolve as resolve16 } from "path";
|
|
16842
16863
|
import chalk41 from "chalk";
|
|
16843
16864
|
|
|
16844
16865
|
// src/shared/db/recordBackup.ts
|
|
@@ -16852,7 +16873,7 @@ async function recordBackup(db, {
|
|
|
16852
16873
|
|
|
16853
16874
|
// src/commands/backup/scheduleBackup.ts
|
|
16854
16875
|
import { mkdir as mkdir2 } from "fs/promises";
|
|
16855
|
-
import { join as
|
|
16876
|
+
import { join as join47 } from "path";
|
|
16856
16877
|
import chalk39 from "chalk";
|
|
16857
16878
|
|
|
16858
16879
|
// src/commands/backup/readCrontab.ts
|
|
@@ -16994,7 +17015,7 @@ async function scheduleBackup({
|
|
|
16994
17015
|
const cronExpr = durationToCron(every);
|
|
16995
17016
|
const dir = expandTilde(loadConfig().backup.dir);
|
|
16996
17017
|
await mkdir2(dir, { recursive: true });
|
|
16997
|
-
const logPath2 =
|
|
17018
|
+
const logPath2 = join47(dir, "cron.log");
|
|
16998
17019
|
const cronLine = `${cronExpr} ${resolveAssistCommand()} backup >> ${logPath2} 2>&1`;
|
|
16999
17020
|
writeCrontab(upsertScheduleBlock(readCrontab(), every, cronLine));
|
|
17000
17021
|
console.error(
|
|
@@ -17173,7 +17194,7 @@ async function backup({ out }) {
|
|
|
17173
17194
|
await mkdir3(dir, { recursive: true });
|
|
17174
17195
|
const start2 = Date.now();
|
|
17175
17196
|
const timestamp9 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
17176
|
-
const filePath = resolve16(
|
|
17197
|
+
const filePath = resolve16(join48(dir, `backup-${timestamp9}.dump`));
|
|
17177
17198
|
await exportBacklog(filePath);
|
|
17178
17199
|
const { size } = await stat4(filePath);
|
|
17179
17200
|
const durationMs = Date.now() - start2;
|
|
@@ -18069,9 +18090,9 @@ function ensureRemoteOrigin() {
|
|
|
18069
18090
|
|
|
18070
18091
|
// src/commands/backlog/add/shared.ts
|
|
18071
18092
|
import { spawnSync as spawnSync5 } from "child_process";
|
|
18072
|
-
import { mkdtempSync, readFileSync as
|
|
18093
|
+
import { mkdtempSync, readFileSync as readFileSync23, unlinkSync as unlinkSync3, writeFileSync as writeFileSync18 } from "fs";
|
|
18073
18094
|
import { tmpdir } from "os";
|
|
18074
|
-
import { join as
|
|
18095
|
+
import { join as join50 } from "path";
|
|
18075
18096
|
import enquirer4 from "enquirer";
|
|
18076
18097
|
async function promptType() {
|
|
18077
18098
|
const { type } = await enquirer4.prompt({
|
|
@@ -18111,15 +18132,15 @@ async function promptDescription() {
|
|
|
18111
18132
|
}
|
|
18112
18133
|
function openEditor() {
|
|
18113
18134
|
const editor = process.env.EDITOR || process.env.VISUAL || "vi";
|
|
18114
|
-
const dir = mkdtempSync(
|
|
18115
|
-
const filePath =
|
|
18135
|
+
const dir = mkdtempSync(join50(tmpdir(), "assist-"));
|
|
18136
|
+
const filePath = join50(dir, "description.md");
|
|
18116
18137
|
writeFileSync18(filePath, "");
|
|
18117
18138
|
const result = spawnSync5(editor, [filePath], { stdio: "inherit" });
|
|
18118
18139
|
if (result.status !== 0) {
|
|
18119
18140
|
unlinkSync3(filePath);
|
|
18120
18141
|
return void 0;
|
|
18121
18142
|
}
|
|
18122
|
-
const content =
|
|
18143
|
+
const content = readFileSync23(filePath, "utf8").trim();
|
|
18123
18144
|
unlinkSync3(filePath);
|
|
18124
18145
|
return content || void 0;
|
|
18125
18146
|
}
|
|
@@ -18546,11 +18567,11 @@ function startProposedRun(id) {
|
|
|
18546
18567
|
import { randomUUID as randomUUID9 } from "crypto";
|
|
18547
18568
|
|
|
18548
18569
|
// src/commands/backlog/propose/mutateLedger.ts
|
|
18549
|
-
import { mkdirSync as mkdirSync10, readFileSync as
|
|
18570
|
+
import { mkdirSync as mkdirSync10, readFileSync as readFileSync24, renameSync as renameSync4, writeFileSync as writeFileSync19 } from "fs";
|
|
18550
18571
|
import { dirname as dirname26 } from "path";
|
|
18551
18572
|
function readLedger(path109) {
|
|
18552
18573
|
try {
|
|
18553
|
-
const parsed = JSON.parse(
|
|
18574
|
+
const parsed = JSON.parse(readFileSync24(path109, "utf8"));
|
|
18554
18575
|
return { open: parsed.open ?? [], created: parsed.created };
|
|
18555
18576
|
} catch {
|
|
18556
18577
|
return { open: [] };
|
|
@@ -18590,9 +18611,9 @@ async function findPredecessor(path109, token, startedAt) {
|
|
|
18590
18611
|
|
|
18591
18612
|
// src/commands/backlog/propose/proposalLedgerPath.ts
|
|
18592
18613
|
import { homedir as homedir14 } from "os";
|
|
18593
|
-
import { join as
|
|
18614
|
+
import { join as join51 } from "path";
|
|
18594
18615
|
function proposalLedgerPath(sessionId2) {
|
|
18595
|
-
return
|
|
18616
|
+
return join51(homedir14(), ".assist", "proposals", `session-${sessionId2}.json`);
|
|
18596
18617
|
}
|
|
18597
18618
|
|
|
18598
18619
|
// src/commands/backlog/propose/trackProposal.ts
|
|
@@ -19087,12 +19108,12 @@ function hasLocalChanges() {
|
|
|
19087
19108
|
import {
|
|
19088
19109
|
existsSync as existsSync44,
|
|
19089
19110
|
mkdirSync as mkdirSync11,
|
|
19090
|
-
readFileSync as
|
|
19111
|
+
readFileSync as readFileSync26,
|
|
19091
19112
|
unlinkSync as unlinkSync4,
|
|
19092
19113
|
writeFileSync as writeFileSync20
|
|
19093
19114
|
} from "fs";
|
|
19094
19115
|
import { homedir as homedir15 } from "os";
|
|
19095
|
-
import { join as
|
|
19116
|
+
import { join as join52 } from "path";
|
|
19096
19117
|
|
|
19097
19118
|
// src/commands/backlog/bootedAt.ts
|
|
19098
19119
|
import { uptime } from "os";
|
|
@@ -19101,11 +19122,11 @@ function bootedAt() {
|
|
|
19101
19122
|
}
|
|
19102
19123
|
|
|
19103
19124
|
// src/commands/backlog/processStartedAt.ts
|
|
19104
|
-
import { readFileSync as
|
|
19125
|
+
import { readFileSync as readFileSync25 } from "fs";
|
|
19105
19126
|
var clockTicksPerSecond = 100;
|
|
19106
19127
|
function processStartedAt(pid) {
|
|
19107
19128
|
try {
|
|
19108
|
-
const stat5 =
|
|
19129
|
+
const stat5 = readFileSync25(`/proc/${pid}/stat`, "utf8");
|
|
19109
19130
|
const fields = stat5.slice(stat5.lastIndexOf(")") + 2).split(" ");
|
|
19110
19131
|
const ticks = Number(fields[19]);
|
|
19111
19132
|
if (!Number.isFinite(ticks)) return void 0;
|
|
@@ -19128,10 +19149,10 @@ function isStaleLock(pid, timestamp9) {
|
|
|
19128
19149
|
|
|
19129
19150
|
// src/commands/backlog/acquireLock.ts
|
|
19130
19151
|
function getLocksDir() {
|
|
19131
|
-
return
|
|
19152
|
+
return join52(homedir15(), ".assist", "locks");
|
|
19132
19153
|
}
|
|
19133
19154
|
function getLockPath(itemId2) {
|
|
19134
|
-
return
|
|
19155
|
+
return join52(getLocksDir(), `lock-${itemId2}.json`);
|
|
19135
19156
|
}
|
|
19136
19157
|
function isProcessAlive(pid) {
|
|
19137
19158
|
try {
|
|
@@ -19145,7 +19166,7 @@ function foreignLockHolder(itemId2) {
|
|
|
19145
19166
|
const lockPath = getLockPath(itemId2);
|
|
19146
19167
|
if (!existsSync44(lockPath)) return null;
|
|
19147
19168
|
try {
|
|
19148
|
-
const lock2 = JSON.parse(
|
|
19169
|
+
const lock2 = JSON.parse(readFileSync26(lockPath, "utf8"));
|
|
19149
19170
|
if (typeof lock2.pid !== "number" || lock2.pid === process.pid) return null;
|
|
19150
19171
|
if (!isProcessAlive(lock2.pid)) return null;
|
|
19151
19172
|
if (isStaleLock(lock2.pid, lock2.timestamp)) return null;
|
|
@@ -19630,12 +19651,12 @@ async function resumeDoneConversation({ item, resumeSessionId }, spawnOptions) {
|
|
|
19630
19651
|
// src/commands/backlog/consumePause.ts
|
|
19631
19652
|
import { existsSync as existsSync45, mkdirSync as mkdirSync13, unlinkSync as unlinkSync5, writeFileSync as writeFileSync22 } from "fs";
|
|
19632
19653
|
import { homedir as homedir16 } from "os";
|
|
19633
|
-
import { join as
|
|
19654
|
+
import { join as join53 } from "path";
|
|
19634
19655
|
function getControlsDir() {
|
|
19635
|
-
return
|
|
19656
|
+
return join53(homedir16(), ".assist", "controls");
|
|
19636
19657
|
}
|
|
19637
19658
|
function getPausePath(itemId2) {
|
|
19638
|
-
return
|
|
19659
|
+
return join53(getControlsDir(), `pause-${itemId2}.json`);
|
|
19639
19660
|
}
|
|
19640
19661
|
function requestPause(itemId2) {
|
|
19641
19662
|
mkdirSync13(getControlsDir(), { recursive: true });
|
|
@@ -19910,12 +19931,12 @@ function spawnHarness(harness, prompt, options2 = {}) {
|
|
|
19910
19931
|
import { existsSync as existsSync47, unwatchFile, watchFile } from "fs";
|
|
19911
19932
|
|
|
19912
19933
|
// src/commands/backlog/readSignal.ts
|
|
19913
|
-
import { existsSync as existsSync46, readFileSync as
|
|
19934
|
+
import { existsSync as existsSync46, readFileSync as readFileSync27 } from "fs";
|
|
19914
19935
|
function readSignal() {
|
|
19915
19936
|
const path109 = getSignalPath();
|
|
19916
19937
|
if (!path109 || !existsSync46(path109)) return void 0;
|
|
19917
19938
|
try {
|
|
19918
|
-
return JSON.parse(
|
|
19939
|
+
return JSON.parse(readFileSync27(path109, "utf8"));
|
|
19919
19940
|
} catch {
|
|
19920
19941
|
return void 0;
|
|
19921
19942
|
}
|
|
@@ -20091,9 +20112,9 @@ async function persistPhaseSessionId(itemId2, phaseIdx, claudeSessionId) {
|
|
|
20091
20112
|
}
|
|
20092
20113
|
|
|
20093
20114
|
// src/shared/emitActivity.ts
|
|
20094
|
-
import { mkdirSync as mkdirSync14, readFileSync as
|
|
20115
|
+
import { mkdirSync as mkdirSync14, readFileSync as readFileSync28, rmSync as rmSync4, writeFileSync as writeFileSync23 } from "fs";
|
|
20095
20116
|
import { homedir as homedir17 } from "os";
|
|
20096
|
-
import { dirname as dirname28, join as
|
|
20117
|
+
import { dirname as dirname28, join as join54 } from "path";
|
|
20097
20118
|
import { z as z17 } from "zod";
|
|
20098
20119
|
var activitySchema = z17.object({
|
|
20099
20120
|
kind: z17.enum(["command", "backlog"]),
|
|
@@ -20110,7 +20131,7 @@ var activitySchema = z17.object({
|
|
|
20110
20131
|
startedAt: z17.number()
|
|
20111
20132
|
});
|
|
20112
20133
|
function activityPath(sessionId2) {
|
|
20113
|
-
return
|
|
20134
|
+
return join54(homedir17(), ".assist", "activity", `activity-${sessionId2}.json`);
|
|
20114
20135
|
}
|
|
20115
20136
|
function emitActivity(activity2) {
|
|
20116
20137
|
const sessionId2 = process.env.ASSIST_ACTIVITY_ID;
|
|
@@ -20121,7 +20142,7 @@ function emitActivity(activity2) {
|
|
|
20121
20142
|
}
|
|
20122
20143
|
function readActivity(path109) {
|
|
20123
20144
|
try {
|
|
20124
|
-
return JSON.parse(
|
|
20145
|
+
return JSON.parse(readFileSync28(path109, "utf8"));
|
|
20125
20146
|
} catch {
|
|
20126
20147
|
return void 0;
|
|
20127
20148
|
}
|
|
@@ -22395,7 +22416,7 @@ function stripEnvPrefix(parts) {
|
|
|
22395
22416
|
}
|
|
22396
22417
|
|
|
22397
22418
|
// src/commands/cliHook/isGhGraphqlIssueMutation.ts
|
|
22398
|
-
import { readFileSync as
|
|
22419
|
+
import { readFileSync as readFileSync29 } from "fs";
|
|
22399
22420
|
var ISSUE_MUTATION = /\bmutation\b[\s\S]*(?:issue|comment|label|assign|reaction|milestone)/i;
|
|
22400
22421
|
var FILE_REFERENCE = /(?:=@|--input[\s=]+)["']?([^\s"';&|)]+)/g;
|
|
22401
22422
|
function isGhGraphqlIssueMutation(command) {
|
|
@@ -22407,7 +22428,7 @@ function isGhGraphqlIssueMutation(command) {
|
|
|
22407
22428
|
}
|
|
22408
22429
|
function readOrEmpty(path109) {
|
|
22409
22430
|
try {
|
|
22410
|
-
return
|
|
22431
|
+
return readFileSync29(path109, "utf8");
|
|
22411
22432
|
} catch {
|
|
22412
22433
|
return "";
|
|
22413
22434
|
}
|
|
@@ -22738,7 +22759,7 @@ function extractGraphqlQuery(args) {
|
|
|
22738
22759
|
}
|
|
22739
22760
|
|
|
22740
22761
|
// src/shared/loadCliReads.ts
|
|
22741
|
-
import { existsSync as existsSync49, readFileSync as
|
|
22762
|
+
import { existsSync as existsSync49, readFileSync as readFileSync30, writeFileSync as writeFileSync24 } from "fs";
|
|
22742
22763
|
import { dirname as dirname29, resolve as resolve18 } from "path";
|
|
22743
22764
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
22744
22765
|
var __filename3 = fileURLToPath6(import.meta.url);
|
|
@@ -22748,7 +22769,7 @@ function packageRoot() {
|
|
|
22748
22769
|
}
|
|
22749
22770
|
function readLines(path109) {
|
|
22750
22771
|
if (!existsSync49(path109)) return [];
|
|
22751
|
-
return
|
|
22772
|
+
return readFileSync30(path109, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
22752
22773
|
}
|
|
22753
22774
|
var cachedReads;
|
|
22754
22775
|
var cachedWrites;
|
|
@@ -22794,14 +22815,14 @@ function findCliWrite(command) {
|
|
|
22794
22815
|
}
|
|
22795
22816
|
|
|
22796
22817
|
// src/shared/readSettingsPerms.ts
|
|
22797
|
-
import { existsSync as existsSync50, readFileSync as
|
|
22818
|
+
import { existsSync as existsSync50, readFileSync as readFileSync31 } from "fs";
|
|
22798
22819
|
import { homedir as homedir18 } from "os";
|
|
22799
|
-
import { join as
|
|
22820
|
+
import { join as join55 } from "path";
|
|
22800
22821
|
function readSettingsPerms(key) {
|
|
22801
22822
|
const paths = [
|
|
22802
|
-
|
|
22803
|
-
|
|
22804
|
-
|
|
22823
|
+
join55(homedir18(), ".claude", "settings.json"),
|
|
22824
|
+
join55(process.cwd(), ".claude", "settings.json"),
|
|
22825
|
+
join55(process.cwd(), ".claude", "settings.local.json")
|
|
22805
22826
|
];
|
|
22806
22827
|
const entries = [];
|
|
22807
22828
|
for (const p of paths) {
|
|
@@ -22812,7 +22833,7 @@ function readSettingsPerms(key) {
|
|
|
22812
22833
|
function readPermissionArray(filePath, key) {
|
|
22813
22834
|
if (!existsSync50(filePath)) return [];
|
|
22814
22835
|
try {
|
|
22815
|
-
const data = JSON.parse(
|
|
22836
|
+
const data = JSON.parse(readFileSync31(filePath, "utf8"));
|
|
22816
22837
|
const arr = data?.permissions?.[key];
|
|
22817
22838
|
return Array.isArray(arr) ? arr.filter((e) => typeof e === "string") : [];
|
|
22818
22839
|
} catch {
|
|
@@ -23082,14 +23103,14 @@ function findDocsPathDeny(toolName, rawCommand, root2) {
|
|
|
23082
23103
|
}
|
|
23083
23104
|
|
|
23084
23105
|
// src/commands/schema/isSchemaPath.ts
|
|
23085
|
-
import { readFileSync as
|
|
23106
|
+
import { readFileSync as readFileSync32 } from "fs";
|
|
23086
23107
|
import { relative as relative7, resolve as resolve21 } from "path";
|
|
23087
23108
|
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
23109
|
var FIXED_SCHEMA_PATH = /^src\/shared\/db\/(?:migrations\/migration\d{4}[^/]*\.ts|migrations\.ts|schema\.ts)$/;
|
|
23089
23110
|
var DB_MODULE = /^src\/shared\/db\/[^/]+\.ts$/;
|
|
23090
23111
|
function readOrEmpty2(path109) {
|
|
23091
23112
|
try {
|
|
23092
|
-
return
|
|
23113
|
+
return readFileSync32(path109, "utf8");
|
|
23093
23114
|
} catch {
|
|
23094
23115
|
return "";
|
|
23095
23116
|
}
|
|
@@ -23158,11 +23179,11 @@ function findSchemaPathDeny(toolName, rawCommand, root2 = getProjectRoot()) {
|
|
|
23158
23179
|
// src/commands/cliHook/logDeniedToolCall.ts
|
|
23159
23180
|
import { mkdirSync as mkdirSync15 } from "fs";
|
|
23160
23181
|
import { homedir as homedir19 } from "os";
|
|
23161
|
-
import { join as
|
|
23182
|
+
import { join as join56 } from "path";
|
|
23162
23183
|
import Database from "better-sqlite3";
|
|
23163
23184
|
var _db;
|
|
23164
23185
|
function getDbDir() {
|
|
23165
|
-
return
|
|
23186
|
+
return join56(homedir19(), ".assist");
|
|
23166
23187
|
}
|
|
23167
23188
|
function initSchema(db) {
|
|
23168
23189
|
db.exec(`
|
|
@@ -23181,7 +23202,7 @@ function openPromptsDb(dir) {
|
|
|
23181
23202
|
if (_db) return _db;
|
|
23182
23203
|
const dbDir = dir ?? getDbDir();
|
|
23183
23204
|
mkdirSync15(dbDir, { recursive: true });
|
|
23184
|
-
const db = new Database(
|
|
23205
|
+
const db = new Database(join56(dbDir, "assist.db"));
|
|
23185
23206
|
db.pragma("journal_mode = WAL");
|
|
23186
23207
|
initSchema(db);
|
|
23187
23208
|
_db = db;
|
|
@@ -23248,26 +23269,26 @@ function tryParseInput(raw) {
|
|
|
23248
23269
|
import { existsSync as existsSync51 } from "fs";
|
|
23249
23270
|
|
|
23250
23271
|
// src/commands/schema/getSchemaSessionApprovalPath.ts
|
|
23251
|
-
import { join as
|
|
23272
|
+
import { join as join58 } from "path";
|
|
23252
23273
|
|
|
23253
23274
|
// src/commands/codeComment/getRestrictedDir.ts
|
|
23254
23275
|
import { homedir as homedir20 } from "os";
|
|
23255
|
-
import { join as
|
|
23276
|
+
import { join as join57 } from "path";
|
|
23256
23277
|
function getRestrictedDir() {
|
|
23257
|
-
return
|
|
23278
|
+
return join57(homedir20(), ".assist", "restricted");
|
|
23258
23279
|
}
|
|
23259
23280
|
function getPinStatePath(pin2) {
|
|
23260
|
-
return
|
|
23281
|
+
return join57(getRestrictedDir(), `code-comment-${pin2}.json`);
|
|
23261
23282
|
}
|
|
23262
23283
|
|
|
23263
23284
|
// src/commands/schema/getSchemaSessionApprovalPath.ts
|
|
23264
23285
|
var SESSION_ID = /^[\w-]+$/;
|
|
23265
23286
|
function getSchemaSessionApprovalDir() {
|
|
23266
|
-
return
|
|
23287
|
+
return join58(getRestrictedDir(), "schema-sessions");
|
|
23267
23288
|
}
|
|
23268
23289
|
function getSchemaSessionApprovalPath(claudeSessionId) {
|
|
23269
23290
|
if (!SESSION_ID.test(claudeSessionId)) return void 0;
|
|
23270
|
-
return
|
|
23291
|
+
return join58(getSchemaSessionApprovalDir(), `${claudeSessionId}.json`);
|
|
23271
23292
|
}
|
|
23272
23293
|
|
|
23273
23294
|
// src/commands/schema/isSchemaLocked.ts
|
|
@@ -23364,9 +23385,9 @@ ${reasons.join("\n")}`);
|
|
|
23364
23385
|
}
|
|
23365
23386
|
|
|
23366
23387
|
// src/commands/permitCliReads.ts
|
|
23367
|
-
import { existsSync as existsSync52, mkdirSync as mkdirSync16, readFileSync as
|
|
23388
|
+
import { existsSync as existsSync52, mkdirSync as mkdirSync16, readFileSync as readFileSync33, writeFileSync as writeFileSync25 } from "fs";
|
|
23368
23389
|
import { homedir as homedir21 } from "os";
|
|
23369
|
-
import { join as
|
|
23390
|
+
import { join as join59 } from "path";
|
|
23370
23391
|
|
|
23371
23392
|
// src/commands/permitCliReads/assertCliExists.ts
|
|
23372
23393
|
function assertCliExists(cli) {
|
|
@@ -23629,15 +23650,15 @@ function updateSettings(cli, commands) {
|
|
|
23629
23650
|
// src/commands/permitCliReads.ts
|
|
23630
23651
|
function logPath(cli) {
|
|
23631
23652
|
const safeName = cli.replace(/\s+/g, "-");
|
|
23632
|
-
return
|
|
23653
|
+
return join59(homedir21(), ".assist", `cli-discover-${safeName}.log`);
|
|
23633
23654
|
}
|
|
23634
23655
|
function readCache(cli) {
|
|
23635
23656
|
const path109 = logPath(cli);
|
|
23636
23657
|
if (!existsSync52(path109)) return void 0;
|
|
23637
|
-
return
|
|
23658
|
+
return readFileSync33(path109, "utf8");
|
|
23638
23659
|
}
|
|
23639
23660
|
function writeCache(cli, output) {
|
|
23640
|
-
const dir =
|
|
23661
|
+
const dir = join59(homedir21(), ".assist");
|
|
23641
23662
|
mkdirSync16(dir, { recursive: true });
|
|
23642
23663
|
writeFileSync25(logPath(cli), output);
|
|
23643
23664
|
}
|
|
@@ -23769,7 +23790,7 @@ function registerCliHook(program) {
|
|
|
23769
23790
|
}
|
|
23770
23791
|
|
|
23771
23792
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
23772
|
-
import { existsSync as existsSync54, readFileSync as
|
|
23793
|
+
import { existsSync as existsSync54, readFileSync as readFileSync35, unlinkSync as unlinkSync8, writeFileSync as writeFileSync26 } from "fs";
|
|
23773
23794
|
import chalk120 from "chalk";
|
|
23774
23795
|
|
|
23775
23796
|
// src/shared/isHashCommentFile.ts
|
|
@@ -23803,7 +23824,7 @@ function isHashCommentFile(filePath) {
|
|
|
23803
23824
|
|
|
23804
23825
|
// src/commands/codeComment/sweepRestrictedDir.ts
|
|
23805
23826
|
import { readdirSync as readdirSync9, statSync as statSync8, unlinkSync as unlinkSync7 } from "fs";
|
|
23806
|
-
import { join as
|
|
23827
|
+
import { join as join60 } from "path";
|
|
23807
23828
|
var STALE_AFTER_MS = 30 * 60 * 1e3;
|
|
23808
23829
|
function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
23809
23830
|
let entries;
|
|
@@ -23814,7 +23835,7 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
23814
23835
|
}
|
|
23815
23836
|
const cutoff = Date.now() - STALE_AFTER_MS;
|
|
23816
23837
|
for (const entry of entries) {
|
|
23817
|
-
const path109 =
|
|
23838
|
+
const path109 = join60(dir, entry);
|
|
23818
23839
|
try {
|
|
23819
23840
|
if (statSync8(path109).mtimeMs < cutoff) unlinkSync7(path109);
|
|
23820
23841
|
} catch {
|
|
@@ -23824,12 +23845,12 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
23824
23845
|
}
|
|
23825
23846
|
|
|
23826
23847
|
// src/commands/codeComment/readPinState.ts
|
|
23827
|
-
import { existsSync as existsSync53, readFileSync as
|
|
23848
|
+
import { existsSync as existsSync53, readFileSync as readFileSync34 } from "fs";
|
|
23828
23849
|
function readPinState(pin2) {
|
|
23829
23850
|
const path109 = getPinStatePath(pin2);
|
|
23830
23851
|
if (!existsSync53(path109)) return void 0;
|
|
23831
23852
|
try {
|
|
23832
|
-
const state = JSON.parse(
|
|
23853
|
+
const state = JSON.parse(readFileSync34(path109, "utf8"));
|
|
23833
23854
|
if (state.pin !== pin2) return void 0;
|
|
23834
23855
|
return state;
|
|
23835
23856
|
} catch {
|
|
@@ -23851,7 +23872,7 @@ function codeCommentConfirm(pin2) {
|
|
|
23851
23872
|
process.exitCode = 1;
|
|
23852
23873
|
return;
|
|
23853
23874
|
}
|
|
23854
|
-
const original =
|
|
23875
|
+
const original = readFileSync35(state.file, "utf8");
|
|
23855
23876
|
const lines2 = original.split("\n");
|
|
23856
23877
|
const index3 = state.line - 1;
|
|
23857
23878
|
if (index3 > lines2.length) {
|
|
@@ -26031,7 +26052,7 @@ async function browserInspect(selector, options2) {
|
|
|
26031
26052
|
}
|
|
26032
26053
|
|
|
26033
26054
|
// src/commands/browser/browserRun.ts
|
|
26034
|
-
import { readFileSync as
|
|
26055
|
+
import { readFileSync as readFileSync36 } from "fs";
|
|
26035
26056
|
import chalk149 from "chalk";
|
|
26036
26057
|
|
|
26037
26058
|
// src/commands/browser/formatRunOutcome.ts
|
|
@@ -26051,7 +26072,7 @@ function formatRunOutcome(run4) {
|
|
|
26051
26072
|
async function browserRun(options2) {
|
|
26052
26073
|
let code;
|
|
26053
26074
|
try {
|
|
26054
|
-
code =
|
|
26075
|
+
code = readFileSync36(options2.file, "utf8");
|
|
26055
26076
|
} catch (error) {
|
|
26056
26077
|
console.error(
|
|
26057
26078
|
chalk149.red(
|
|
@@ -26081,11 +26102,11 @@ import { dirname as dirname30 } from "path";
|
|
|
26081
26102
|
|
|
26082
26103
|
// src/commands/browser/snapshotPath.ts
|
|
26083
26104
|
import { homedir as homedir22 } from "os";
|
|
26084
|
-
import { join as
|
|
26105
|
+
import { join as join61 } from "path";
|
|
26085
26106
|
function snapshotPath(tabUrl, now) {
|
|
26086
26107
|
const host = new URL(tabUrl).host.replace(/[^\w.-]/g, "-");
|
|
26087
26108
|
const timestamp9 = now.toISOString().replace(/[:.]/g, "-");
|
|
26088
|
-
return
|
|
26109
|
+
return join61(homedir22(), ".assist", "browser", `${host}-${timestamp9}.html`);
|
|
26089
26110
|
}
|
|
26090
26111
|
|
|
26091
26112
|
// src/commands/browser/browserSnapshot.ts
|
|
@@ -26292,15 +26313,15 @@ async function printExtensionUrl() {
|
|
|
26292
26313
|
// src/commands/extension/signExtension.ts
|
|
26293
26314
|
import { rm as rm2 } from "fs/promises";
|
|
26294
26315
|
import { homedir as homedir23, tmpdir as tmpdir3 } from "os";
|
|
26295
|
-
import { join as
|
|
26316
|
+
import { join as join67 } from "path";
|
|
26296
26317
|
import chalk154 from "chalk";
|
|
26297
26318
|
|
|
26298
26319
|
// src/commands/extension/copySignedXpi.ts
|
|
26299
26320
|
import { copyFile } from "fs/promises";
|
|
26300
|
-
import { join as
|
|
26321
|
+
import { join as join62 } from "path";
|
|
26301
26322
|
var SIGNED_XPI_NAME = "assist-extension.xpi";
|
|
26302
26323
|
async function copySignedXpi(xpi, dir) {
|
|
26303
|
-
const fixed2 =
|
|
26324
|
+
const fixed2 = join62(dir, SIGNED_XPI_NAME);
|
|
26304
26325
|
if (fixed2 === xpi) return fixed2;
|
|
26305
26326
|
await copyFile(xpi, fixed2);
|
|
26306
26327
|
return fixed2;
|
|
@@ -26309,11 +26330,11 @@ async function copySignedXpi(xpi, dir) {
|
|
|
26309
26330
|
// src/commands/extension/findSignedXpi.ts
|
|
26310
26331
|
import { existsSync as existsSync55 } from "fs";
|
|
26311
26332
|
import { readdir } from "fs/promises";
|
|
26312
|
-
import { join as
|
|
26333
|
+
import { join as join63 } from "path";
|
|
26313
26334
|
async function findSignedXpi(dir) {
|
|
26314
26335
|
if (!existsSync55(dir)) return null;
|
|
26315
26336
|
const name = (await readdir(dir)).find((entry) => entry.endsWith(".xpi"));
|
|
26316
|
-
return name ?
|
|
26337
|
+
return name ? join63(dir, name) : null;
|
|
26317
26338
|
}
|
|
26318
26339
|
|
|
26319
26340
|
// src/commands/extension/signedAddonInstallPath.ts
|
|
@@ -26336,10 +26357,10 @@ async function signedAddonInstallPath(xpi) {
|
|
|
26336
26357
|
|
|
26337
26358
|
// src/commands/extension/signPreflightProblem.ts
|
|
26338
26359
|
import { existsSync as existsSync56 } from "fs";
|
|
26339
|
-
import { join as
|
|
26360
|
+
import { join as join64 } from "path";
|
|
26340
26361
|
var KEY_URL = "https://addons.mozilla.org/en-US/developers/addon/api/key/";
|
|
26341
26362
|
function signPreflightProblem(source) {
|
|
26342
|
-
if (!existsSync56(
|
|
26363
|
+
if (!existsSync56(join64(source, "content.js")))
|
|
26343
26364
|
return {
|
|
26344
26365
|
message: `no content.js in ${source}`,
|
|
26345
26366
|
hint: "run npm run build to bundle the content script"
|
|
@@ -26354,7 +26375,7 @@ function signPreflightProblem(source) {
|
|
|
26354
26375
|
|
|
26355
26376
|
// src/commands/extension/stageExtension.ts
|
|
26356
26377
|
import { cp as cp3, mkdir as mkdir5, readFile as readFile5, rm, writeFile as writeFile4 } from "fs/promises";
|
|
26357
|
-
import { basename as basename16, join as
|
|
26378
|
+
import { basename as basename16, join as join65 } from "path";
|
|
26358
26379
|
|
|
26359
26380
|
// src/commands/extension/stampManifestVersion.ts
|
|
26360
26381
|
function stampManifestVersion(manifest, version2) {
|
|
@@ -26371,7 +26392,7 @@ async function stageExtension(source, staging, version2) {
|
|
|
26371
26392
|
recursive: true,
|
|
26372
26393
|
filter: (path109) => basename16(path109) !== "updates.json"
|
|
26373
26394
|
});
|
|
26374
|
-
const manifest =
|
|
26395
|
+
const manifest = join65(staging, "manifest.json");
|
|
26375
26396
|
const stamped = stampManifestVersion(
|
|
26376
26397
|
await readFile5(manifest, "utf8"),
|
|
26377
26398
|
version2
|
|
@@ -26381,7 +26402,7 @@ async function stageExtension(source, staging, version2) {
|
|
|
26381
26402
|
|
|
26382
26403
|
// src/commands/extension/writeUpdateManifest.ts
|
|
26383
26404
|
import { readFile as readFile6, writeFile as writeFile5 } from "fs/promises";
|
|
26384
|
-
import { join as
|
|
26405
|
+
import { join as join66 } from "path";
|
|
26385
26406
|
|
|
26386
26407
|
// src/commands/extension/buildUpdateManifest.ts
|
|
26387
26408
|
var RELEASE_DOWNLOAD_URL = "https://github.com/staff0rd/assist/releases/download";
|
|
@@ -26406,17 +26427,17 @@ function buildUpdateManifest(manifest, version2) {
|
|
|
26406
26427
|
// src/commands/extension/writeUpdateManifest.ts
|
|
26407
26428
|
async function writeUpdateManifest(source, dir, version2) {
|
|
26408
26429
|
await writeFile5(
|
|
26409
|
-
|
|
26430
|
+
join66(dir, "updates.json"),
|
|
26410
26431
|
buildUpdateManifest(
|
|
26411
|
-
await readFile6(
|
|
26432
|
+
await readFile6(join66(source, "manifest.json"), "utf8"),
|
|
26412
26433
|
version2
|
|
26413
26434
|
)
|
|
26414
26435
|
);
|
|
26415
26436
|
}
|
|
26416
26437
|
|
|
26417
26438
|
// src/commands/extension/signExtension.ts
|
|
26418
|
-
var ARTIFACTS_DIR =
|
|
26419
|
-
var STAGING_DIR =
|
|
26439
|
+
var ARTIFACTS_DIR = join67(homedir23(), ".assist", "extension");
|
|
26440
|
+
var STAGING_DIR = join67(tmpdir3(), "assist-extension");
|
|
26420
26441
|
async function signExtension() {
|
|
26421
26442
|
const source = extensionDir();
|
|
26422
26443
|
const problem = signPreflightProblem(source);
|
|
@@ -26600,7 +26621,7 @@ function registerDb(program) {
|
|
|
26600
26621
|
}
|
|
26601
26622
|
|
|
26602
26623
|
// src/commands/deploy/redirect.ts
|
|
26603
|
-
import { existsSync as existsSync57, readFileSync as
|
|
26624
|
+
import { existsSync as existsSync57, readFileSync as readFileSync37, writeFileSync as writeFileSync29 } from "fs";
|
|
26604
26625
|
import chalk157 from "chalk";
|
|
26605
26626
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
26606
26627
|
if (!window.location.pathname.endsWith('/')) {
|
|
@@ -26613,7 +26634,7 @@ function redirect() {
|
|
|
26613
26634
|
console.log(chalk157.yellow("No index.html found"));
|
|
26614
26635
|
return;
|
|
26615
26636
|
}
|
|
26616
|
-
const content =
|
|
26637
|
+
const content = readFileSync37(indexPath, "utf8");
|
|
26617
26638
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
26618
26639
|
console.log(chalk157.dim("Trailing slash script already present"));
|
|
26619
26640
|
return;
|
|
@@ -26704,22 +26725,22 @@ function printWeekHeader(week, state) {
|
|
|
26704
26725
|
}
|
|
26705
26726
|
|
|
26706
26727
|
// src/commands/devlog/loadDevEntry.ts
|
|
26707
|
-
import { readFileSync as
|
|
26708
|
-
import { join as
|
|
26728
|
+
import { readFileSync as readFileSync38 } from "fs";
|
|
26729
|
+
import { join as join68 } from "path";
|
|
26709
26730
|
import { parse as parseYaml3 } from "yaml";
|
|
26710
26731
|
function asString(value) {
|
|
26711
26732
|
return value === void 0 || value === null ? null : String(value);
|
|
26712
26733
|
}
|
|
26713
26734
|
function readFrontmatter(path109) {
|
|
26714
26735
|
try {
|
|
26715
|
-
const match =
|
|
26736
|
+
const match = readFileSync38(path109, "utf8").match(/^---\n([\s\S]*?)\n---/);
|
|
26716
26737
|
return match ? parseYaml3(match[1]) ?? {} : null;
|
|
26717
26738
|
} catch {
|
|
26718
26739
|
return null;
|
|
26719
26740
|
}
|
|
26720
26741
|
}
|
|
26721
26742
|
function loadDevEntry(repoName, week, devDir) {
|
|
26722
|
-
const path109 =
|
|
26743
|
+
const path109 = join68(devDir, repoName, `${week.toLowerCase()}.md`);
|
|
26723
26744
|
const frontmatter2 = readFrontmatter(path109);
|
|
26724
26745
|
if (!frontmatter2) return null;
|
|
26725
26746
|
const versions = frontmatter2.versions;
|
|
@@ -26815,17 +26836,17 @@ function findTargetWeek(weeks, { lastWeek, skip: skip3, today }) {
|
|
|
26815
26836
|
import chalk160 from "chalk";
|
|
26816
26837
|
|
|
26817
26838
|
// src/shared/getRepoName.ts
|
|
26818
|
-
import { existsSync as existsSync58, readFileSync as
|
|
26819
|
-
import { basename as basename17, join as
|
|
26839
|
+
import { existsSync as existsSync58, readFileSync as readFileSync39 } from "fs";
|
|
26840
|
+
import { basename as basename17, join as join69 } from "path";
|
|
26820
26841
|
function getRepoName() {
|
|
26821
26842
|
const config = loadConfig();
|
|
26822
26843
|
if (config.devlog?.name) {
|
|
26823
26844
|
return config.devlog.name;
|
|
26824
26845
|
}
|
|
26825
|
-
const packageJsonPath =
|
|
26846
|
+
const packageJsonPath = join69(process.cwd(), "package.json");
|
|
26826
26847
|
if (existsSync58(packageJsonPath)) {
|
|
26827
26848
|
try {
|
|
26828
|
-
const content =
|
|
26849
|
+
const content = readFileSync39(packageJsonPath, "utf8");
|
|
26829
26850
|
const pkg = JSON.parse(content);
|
|
26830
26851
|
if (pkg.name) {
|
|
26831
26852
|
return pkg.name;
|
|
@@ -26901,7 +26922,7 @@ function list2(options2) {
|
|
|
26901
26922
|
|
|
26902
26923
|
// src/commands/devlog/loadDevWeeks.ts
|
|
26903
26924
|
import { readdirSync as readdirSync10 } from "fs";
|
|
26904
|
-
import { join as
|
|
26925
|
+
import { join as join70 } from "path";
|
|
26905
26926
|
var DEV_FILENAME_PATTERN = /^(\d{4})-w(\d{2})\.md$/;
|
|
26906
26927
|
function parseDevWeekFilename(filename) {
|
|
26907
26928
|
const match = filename.match(DEV_FILENAME_PATTERN);
|
|
@@ -26915,7 +26936,7 @@ function readFilenames(dir) {
|
|
|
26915
26936
|
}
|
|
26916
26937
|
}
|
|
26917
26938
|
function loadDevWeeks(repoName, devDir) {
|
|
26918
|
-
return readFilenames(
|
|
26939
|
+
return readFilenames(join70(devDir, repoName)).map(parseDevWeekFilename).filter((week) => week !== null).sort();
|
|
26919
26940
|
}
|
|
26920
26941
|
|
|
26921
26942
|
// src/commands/devlog/next/displayNextEntry.ts
|
|
@@ -27070,7 +27091,7 @@ async function skip2(week, cwd = process.cwd()) {
|
|
|
27070
27091
|
|
|
27071
27092
|
// src/commands/devlog/write.ts
|
|
27072
27093
|
import { mkdirSync as mkdirSync19, writeFileSync as writeFileSync30 } from "fs";
|
|
27073
|
-
import { dirname as dirname31, join as
|
|
27094
|
+
import { dirname as dirname31, join as join71 } from "path";
|
|
27074
27095
|
import chalk164 from "chalk";
|
|
27075
27096
|
|
|
27076
27097
|
// src/commands/devlog/write/devEntryInputSchema.ts
|
|
@@ -27163,7 +27184,7 @@ async function write() {
|
|
|
27163
27184
|
}
|
|
27164
27185
|
const devDir = resolveDevDir();
|
|
27165
27186
|
const repoName = getRepoName();
|
|
27166
|
-
const path109 =
|
|
27187
|
+
const path109 = join71(devDir, repoName, `${result.data.week.toLowerCase()}.md`);
|
|
27167
27188
|
mkdirSync19(dirname31(path109), { recursive: true });
|
|
27168
27189
|
writeFileSync30(path109, formatDevEntry(repoName, result.data));
|
|
27169
27190
|
console.log(chalk164.green(`Wrote ${path109}`));
|
|
@@ -27351,13 +27372,13 @@ async function findPhaseUnlockItem(itemId2, phase) {
|
|
|
27351
27372
|
}
|
|
27352
27373
|
|
|
27353
27374
|
// src/commands/docs/getDocsUnlockPinPath.ts
|
|
27354
|
-
import { join as
|
|
27375
|
+
import { join as join72 } from "path";
|
|
27355
27376
|
function getDocsUnlockPinPath(pin2) {
|
|
27356
|
-
return
|
|
27377
|
+
return join72(getRestrictedDir(), `docs-unlock-pin-${pin2}.json`);
|
|
27357
27378
|
}
|
|
27358
27379
|
|
|
27359
27380
|
// src/commands/docs/readDocsUnlockPinState.ts
|
|
27360
|
-
import { existsSync as existsSync59, readFileSync as
|
|
27381
|
+
import { existsSync as existsSync59, readFileSync as readFileSync40 } from "fs";
|
|
27361
27382
|
function isPositiveInteger(value) {
|
|
27362
27383
|
return Number.isInteger(value) && value > 0;
|
|
27363
27384
|
}
|
|
@@ -27365,7 +27386,7 @@ function readDocsUnlockPinState(pin2) {
|
|
|
27365
27386
|
const path109 = getDocsUnlockPinPath(pin2);
|
|
27366
27387
|
if (!existsSync59(path109)) return void 0;
|
|
27367
27388
|
try {
|
|
27368
|
-
const state = JSON.parse(
|
|
27389
|
+
const state = JSON.parse(readFileSync40(path109, "utf8"));
|
|
27369
27390
|
if (state.pin !== pin2) return void 0;
|
|
27370
27391
|
if (!isPositiveInteger(state.itemId)) return void 0;
|
|
27371
27392
|
if (!isPositiveInteger(state.phase)) return void 0;
|
|
@@ -27501,13 +27522,13 @@ import { mkdirSync as mkdirSync21, unlinkSync as unlinkSync11, writeFileSync as
|
|
|
27501
27522
|
import chalk170 from "chalk";
|
|
27502
27523
|
|
|
27503
27524
|
// src/commands/schema/getSchemaUnlockPinPath.ts
|
|
27504
|
-
import { join as
|
|
27525
|
+
import { join as join73 } from "path";
|
|
27505
27526
|
function getSchemaUnlockPinPath(pin2) {
|
|
27506
|
-
return
|
|
27527
|
+
return join73(getRestrictedDir(), `schema-unlock-pin-${pin2}.json`);
|
|
27507
27528
|
}
|
|
27508
27529
|
|
|
27509
27530
|
// src/commands/schema/readSchemaUnlockPinState.ts
|
|
27510
|
-
import { existsSync as existsSync60, readFileSync as
|
|
27531
|
+
import { existsSync as existsSync60, readFileSync as readFileSync41 } from "fs";
|
|
27511
27532
|
function isPositiveInteger2(value) {
|
|
27512
27533
|
return Number.isInteger(value) && value > 0;
|
|
27513
27534
|
}
|
|
@@ -27523,7 +27544,7 @@ function readSchemaUnlockPinState(pin2) {
|
|
|
27523
27544
|
const path109 = getSchemaUnlockPinPath(pin2);
|
|
27524
27545
|
if (!existsSync60(path109)) return void 0;
|
|
27525
27546
|
try {
|
|
27526
|
-
const raw = JSON.parse(
|
|
27547
|
+
const raw = JSON.parse(readFileSync41(path109, "utf8"));
|
|
27527
27548
|
if (raw.pin !== pin2) return void 0;
|
|
27528
27549
|
return toState(raw);
|
|
27529
27550
|
} catch {
|
|
@@ -27646,7 +27667,7 @@ function registerSchema(parent) {
|
|
|
27646
27667
|
|
|
27647
27668
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
27648
27669
|
import { closeSync as closeSync5, openSync as openSync6, readdirSync as readdirSync12 } from "fs";
|
|
27649
|
-
import { join as
|
|
27670
|
+
import { join as join74 } from "path";
|
|
27650
27671
|
import chalk172 from "chalk";
|
|
27651
27672
|
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "packages"]);
|
|
27652
27673
|
function isLockedDll(debugDir) {
|
|
@@ -27658,7 +27679,7 @@ function isLockedDll(debugDir) {
|
|
|
27658
27679
|
}
|
|
27659
27680
|
for (const file of files) {
|
|
27660
27681
|
if (!file.toLowerCase().endsWith(".dll")) continue;
|
|
27661
|
-
const dllPath =
|
|
27682
|
+
const dllPath = join74(debugDir, file);
|
|
27662
27683
|
try {
|
|
27663
27684
|
const fd = openSync6(dllPath, "r+");
|
|
27664
27685
|
closeSync5(fd);
|
|
@@ -27676,13 +27697,13 @@ function findFirstLockedDll(dir) {
|
|
|
27676
27697
|
return null;
|
|
27677
27698
|
}
|
|
27678
27699
|
if (entries.includes("bin")) {
|
|
27679
|
-
const locked = isLockedDll(
|
|
27700
|
+
const locked = isLockedDll(join74(dir, "bin", "Debug"));
|
|
27680
27701
|
if (locked) return locked;
|
|
27681
27702
|
}
|
|
27682
27703
|
for (const entry of entries) {
|
|
27683
27704
|
if (SKIP_DIRS.has(entry) || entry === "bin" || entry.startsWith("."))
|
|
27684
27705
|
continue;
|
|
27685
|
-
const found = findFirstLockedDll(
|
|
27706
|
+
const found = findFirstLockedDll(join74(dir, entry));
|
|
27686
27707
|
if (found) return found;
|
|
27687
27708
|
}
|
|
27688
27709
|
return null;
|
|
@@ -27705,11 +27726,11 @@ async function checkBuildLocksCommand() {
|
|
|
27705
27726
|
}
|
|
27706
27727
|
|
|
27707
27728
|
// src/commands/dotnet/buildTree.ts
|
|
27708
|
-
import { readFileSync as
|
|
27729
|
+
import { readFileSync as readFileSync42 } from "fs";
|
|
27709
27730
|
import path36 from "path";
|
|
27710
27731
|
var PROJECT_REF_RE = /<ProjectReference\s+Include="([^"]+)"/g;
|
|
27711
27732
|
function getProjectRefs(csprojPath) {
|
|
27712
|
-
const content =
|
|
27733
|
+
const content = readFileSync42(csprojPath, "utf8");
|
|
27713
27734
|
const refs = [];
|
|
27714
27735
|
for (const match of content.matchAll(PROJECT_REF_RE)) {
|
|
27715
27736
|
refs.push(match[1].replace(/\\/g, "/"));
|
|
@@ -27726,7 +27747,7 @@ function buildTree(csprojPath, repoRoot2, visited = /* @__PURE__ */ new Set()) {
|
|
|
27726
27747
|
for (const ref of getProjectRefs(abs)) {
|
|
27727
27748
|
const childAbs = path36.resolve(dir, ref);
|
|
27728
27749
|
try {
|
|
27729
|
-
|
|
27750
|
+
readFileSync42(childAbs);
|
|
27730
27751
|
node.children.push(buildTree(childAbs, repoRoot2, visited));
|
|
27731
27752
|
} catch {
|
|
27732
27753
|
node.children.push({
|
|
@@ -27751,7 +27772,7 @@ function collectAllDeps(node) {
|
|
|
27751
27772
|
}
|
|
27752
27773
|
|
|
27753
27774
|
// src/commands/dotnet/findContainingSolutions.ts
|
|
27754
|
-
import { readdirSync as readdirSync13, readFileSync as
|
|
27775
|
+
import { readdirSync as readdirSync13, readFileSync as readFileSync43, statSync as statSync9 } from "fs";
|
|
27755
27776
|
import path37 from "path";
|
|
27756
27777
|
function findSlnFiles(dir, maxDepth, depth = 0) {
|
|
27757
27778
|
if (depth > maxDepth) return [];
|
|
@@ -27786,7 +27807,7 @@ function findContainingSolutions(csprojPath, repoRoot2) {
|
|
|
27786
27807
|
const pattern2 = new RegExp(`[\\\\"/]${escapeRegex(csprojBasename)}"`);
|
|
27787
27808
|
for (const sln of slnFiles) {
|
|
27788
27809
|
try {
|
|
27789
|
-
const content =
|
|
27810
|
+
const content = readFileSync43(sln, "utf8");
|
|
27790
27811
|
if (pattern2.test(content)) {
|
|
27791
27812
|
matches.push(path37.relative(repoRoot2, sln));
|
|
27792
27813
|
}
|
|
@@ -28029,11 +28050,11 @@ import chalk178 from "chalk";
|
|
|
28029
28050
|
|
|
28030
28051
|
// src/commands/dotnet/findSolution.ts
|
|
28031
28052
|
import { readdirSync as readdirSync14 } from "fs";
|
|
28032
|
-
import { dirname as dirname32, join as
|
|
28053
|
+
import { dirname as dirname32, join as join75 } from "path";
|
|
28033
28054
|
import chalk177 from "chalk";
|
|
28034
28055
|
function findSlnInDir(dir) {
|
|
28035
28056
|
try {
|
|
28036
|
-
return readdirSync14(dir).filter((f) => f.endsWith(".sln")).map((f) =>
|
|
28057
|
+
return readdirSync14(dir).filter((f) => f.endsWith(".sln")).map((f) => join75(dir, f));
|
|
28037
28058
|
} catch {
|
|
28038
28059
|
return [];
|
|
28039
28060
|
}
|
|
@@ -28104,7 +28125,7 @@ function parseInspectReport(json) {
|
|
|
28104
28125
|
|
|
28105
28126
|
// src/commands/dotnet/runInspectCode.ts
|
|
28106
28127
|
import { execSync as execSync40 } from "child_process";
|
|
28107
|
-
import { existsSync as existsSync63, readFileSync as
|
|
28128
|
+
import { existsSync as existsSync63, readFileSync as readFileSync44, unlinkSync as unlinkSync12 } from "fs";
|
|
28108
28129
|
import { tmpdir as tmpdir4 } from "os";
|
|
28109
28130
|
import path40 from "path";
|
|
28110
28131
|
import chalk179 from "chalk";
|
|
@@ -28139,7 +28160,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
28139
28160
|
console.error(chalk179.red("Report file not generated"));
|
|
28140
28161
|
process.exit(1);
|
|
28141
28162
|
}
|
|
28142
|
-
const xml =
|
|
28163
|
+
const xml = readFileSync44(reportPath, "utf8");
|
|
28143
28164
|
unlinkSync12(reportPath);
|
|
28144
28165
|
return xml;
|
|
28145
28166
|
}
|
|
@@ -29021,7 +29042,7 @@ function aggregateCommitters(authorLists) {
|
|
|
29021
29042
|
import { spawnSync as spawnSync6 } from "child_process";
|
|
29022
29043
|
import { unlinkSync as unlinkSync13, writeFileSync as writeFileSync33 } from "fs";
|
|
29023
29044
|
import { tmpdir as tmpdir5 } from "os";
|
|
29024
|
-
import { join as
|
|
29045
|
+
import { join as join76 } from "path";
|
|
29025
29046
|
function buildArgs2(queryFile, vars) {
|
|
29026
29047
|
const args = ["api", "graphql", "-F", `query=@${queryFile}`];
|
|
29027
29048
|
for (const [key, value] of Object.entries(vars)) {
|
|
@@ -29031,7 +29052,7 @@ function buildArgs2(queryFile, vars) {
|
|
|
29031
29052
|
return args;
|
|
29032
29053
|
}
|
|
29033
29054
|
function runGhGraphql(mutation, vars) {
|
|
29034
|
-
const queryFile =
|
|
29055
|
+
const queryFile = join76(tmpdir5(), `gh-query-${Date.now()}.graphql`);
|
|
29035
29056
|
writeFileSync33(queryFile, mutation);
|
|
29036
29057
|
try {
|
|
29037
29058
|
const result = spawnSync6("gh", buildArgs2(queryFile, vars), {
|
|
@@ -30482,14 +30503,14 @@ function slugFromUrl(url) {
|
|
|
30482
30503
|
import { mkdirSync as mkdirSync22, writeFileSync as writeFileSync34 } from "fs";
|
|
30483
30504
|
|
|
30484
30505
|
// src/commands/github/issue/issueWorkingFile.ts
|
|
30485
|
-
import { join as
|
|
30506
|
+
import { join as join77 } from "path";
|
|
30486
30507
|
function issueWorkingFile(slug2, number) {
|
|
30487
30508
|
const [owner = "unknown", repo = "unknown"] = slug2.split("/");
|
|
30488
|
-
const dir =
|
|
30509
|
+
const dir = join77(getStoreDir(), "github-issues", owner, repo);
|
|
30489
30510
|
return {
|
|
30490
30511
|
dir,
|
|
30491
|
-
bodyPath:
|
|
30492
|
-
metaPath:
|
|
30512
|
+
bodyPath: join77(dir, `${number}.md`),
|
|
30513
|
+
metaPath: join77(dir, `${number}.json`)
|
|
30493
30514
|
};
|
|
30494
30515
|
}
|
|
30495
30516
|
|
|
@@ -30524,14 +30545,14 @@ function fetchIssueToWorkingFile(number, repo) {
|
|
|
30524
30545
|
}
|
|
30525
30546
|
|
|
30526
30547
|
// src/commands/github/issue/resumeIssueBody.ts
|
|
30527
|
-
import { existsSync as existsSync64, readFileSync as
|
|
30548
|
+
import { existsSync as existsSync64, readFileSync as readFileSync45 } from "fs";
|
|
30528
30549
|
function resumeIssueBody(slug2, number, updatedAt) {
|
|
30529
30550
|
const { bodyPath, metaPath } = issueWorkingFile(slug2, number);
|
|
30530
30551
|
if (!existsSync64(bodyPath) || !existsSync64(metaPath)) return void 0;
|
|
30531
30552
|
try {
|
|
30532
|
-
const meta = JSON.parse(
|
|
30553
|
+
const meta = JSON.parse(readFileSync45(metaPath, "utf8"));
|
|
30533
30554
|
if (meta.updatedAt !== updatedAt) return void 0;
|
|
30534
|
-
return
|
|
30555
|
+
return readFileSync45(bodyPath, "utf8");
|
|
30535
30556
|
} catch {
|
|
30536
30557
|
return void 0;
|
|
30537
30558
|
}
|
|
@@ -31398,11 +31419,11 @@ import { existsSync as existsSync65 } from "fs";
|
|
|
31398
31419
|
import { basename as basename20, dirname as dirname34 } from "path";
|
|
31399
31420
|
|
|
31400
31421
|
// src/commands/sessions/daemon/worktree/nextWorktreePath.ts
|
|
31401
|
-
import { basename as basename19, join as
|
|
31422
|
+
import { basename as basename19, join as join78 } from "path";
|
|
31402
31423
|
function nextWorktreePath(clone, base, isTaken) {
|
|
31403
31424
|
const name = basename19(clone);
|
|
31404
31425
|
for (let n = 2; n < 1e3; n++) {
|
|
31405
|
-
const candidate =
|
|
31426
|
+
const candidate = join78(base, `${name}-${n}`);
|
|
31406
31427
|
if (!isTaken(candidate)) return candidate;
|
|
31407
31428
|
}
|
|
31408
31429
|
throw new Error(`no free worktree suffix for ${clone}`);
|
|
@@ -31665,20 +31686,20 @@ function persistedTreeRoots() {
|
|
|
31665
31686
|
|
|
31666
31687
|
// src/commands/sessions/daemon/worktree/seedWorktree.ts
|
|
31667
31688
|
import { copyFileSync, existsSync as existsSync67, mkdirSync as mkdirSync23 } from "fs";
|
|
31668
|
-
import { dirname as dirname35, join as
|
|
31689
|
+
import { dirname as dirname35, join as join80 } from "path";
|
|
31669
31690
|
|
|
31670
31691
|
// src/commands/sessions/daemon/worktree/runInstall.ts
|
|
31671
31692
|
import { resolve as resolve22 } from "path";
|
|
31672
31693
|
|
|
31673
31694
|
// src/commands/sessions/daemon/worktree/detectInstallCommand.ts
|
|
31674
31695
|
import { existsSync as existsSync66 } from "fs";
|
|
31675
|
-
import { join as
|
|
31696
|
+
import { join as join79 } from "path";
|
|
31676
31697
|
function detectInstallCommand(dir) {
|
|
31677
|
-
if (!existsSync66(
|
|
31678
|
-
if (existsSync66(
|
|
31679
|
-
if (existsSync66(
|
|
31680
|
-
if (existsSync66(
|
|
31681
|
-
if (existsSync66(
|
|
31698
|
+
if (!existsSync66(join79(dir, "package.json"))) return null;
|
|
31699
|
+
if (existsSync66(join79(dir, "pnpm-lock.yaml"))) return "pnpm install";
|
|
31700
|
+
if (existsSync66(join79(dir, "yarn.lock"))) return "yarn install";
|
|
31701
|
+
if (existsSync66(join79(dir, "bun.lockb"))) return "bun install";
|
|
31702
|
+
if (existsSync66(join79(dir, "package-lock.json"))) return "npm ci";
|
|
31682
31703
|
return "npm install";
|
|
31683
31704
|
}
|
|
31684
31705
|
|
|
@@ -31843,9 +31864,9 @@ function seedWorktree(worktreePath, clone, onSeeded = () => {
|
|
|
31843
31864
|
}
|
|
31844
31865
|
function copyConfigFiles(worktreePath, clone, copy) {
|
|
31845
31866
|
for (const rel of copy) {
|
|
31846
|
-
const src =
|
|
31867
|
+
const src = join80(clone, rel);
|
|
31847
31868
|
if (!existsSync67(src)) continue;
|
|
31848
|
-
const dest =
|
|
31869
|
+
const dest = join80(worktreePath, rel);
|
|
31849
31870
|
try {
|
|
31850
31871
|
mkdirSync23(dirname35(dest), { recursive: true });
|
|
31851
31872
|
copyFileSync(src, dest);
|
|
@@ -32319,7 +32340,7 @@ import { resolve as resolve24 } from "path";
|
|
|
32319
32340
|
import chalk196 from "chalk";
|
|
32320
32341
|
|
|
32321
32342
|
// src/commands/mermaid/exportFile.ts
|
|
32322
|
-
import { readFileSync as
|
|
32343
|
+
import { readFileSync as readFileSync46, writeFileSync as writeFileSync35 } from "fs";
|
|
32323
32344
|
import { basename as basename21, extname as extname4, resolve as resolve23 } from "path";
|
|
32324
32345
|
import chalk195 from "chalk";
|
|
32325
32346
|
|
|
@@ -32345,7 +32366,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
32345
32366
|
|
|
32346
32367
|
// src/commands/mermaid/exportFile.ts
|
|
32347
32368
|
async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
32348
|
-
const content =
|
|
32369
|
+
const content = readFileSync46(file, "utf8");
|
|
32349
32370
|
const blocks = extractMermaidBlocks(content);
|
|
32350
32371
|
const stem = basename21(file, extname4(file));
|
|
32351
32372
|
if (onlyIndex !== void 0) {
|
|
@@ -32557,14 +32578,14 @@ function applyIgnore(texts, ignore3) {
|
|
|
32557
32578
|
}
|
|
32558
32579
|
|
|
32559
32580
|
// src/commands/miro/readIgnoreList.ts
|
|
32560
|
-
import { existsSync as existsSync68, readFileSync as
|
|
32581
|
+
import { existsSync as existsSync68, readFileSync as readFileSync47 } from "fs";
|
|
32561
32582
|
import { parse as parse2 } from "yaml";
|
|
32562
32583
|
function readIgnoreList(file) {
|
|
32563
32584
|
if (!existsSync68(file))
|
|
32564
32585
|
throw new MiroExtractError(
|
|
32565
32586
|
`No ignore file at ${file}. Write a YAML list of the box texts to drop, or omit --ignore.`
|
|
32566
32587
|
);
|
|
32567
|
-
const parsed = parse2(
|
|
32588
|
+
const parsed = parse2(readFileSync47(file, "utf8"));
|
|
32568
32589
|
if (parsed === null || parsed === void 0) return [];
|
|
32569
32590
|
if (!Array.isArray(parsed) || parsed.some((entry) => typeof entry !== "string"))
|
|
32570
32591
|
throw new MiroExtractError(
|
|
@@ -32744,7 +32765,7 @@ async function pickAnchors(sessionId2, items2) {
|
|
|
32744
32765
|
}
|
|
32745
32766
|
|
|
32746
32767
|
// src/commands/miro/readMiroItems.ts
|
|
32747
|
-
import { readFileSync as
|
|
32768
|
+
import { readFileSync as readFileSync48 } from "fs";
|
|
32748
32769
|
function tryParse(text20) {
|
|
32749
32770
|
try {
|
|
32750
32771
|
return JSON.parse(text20);
|
|
@@ -32773,7 +32794,7 @@ function parsePages(raw, file) {
|
|
|
32773
32794
|
return Array.isArray(parsed) ? parsed.map(toPage) : [toPage(parsed)];
|
|
32774
32795
|
}
|
|
32775
32796
|
function readMiroItems(file) {
|
|
32776
|
-
const items2 = parsePages(
|
|
32797
|
+
const items2 = parsePages(readFileSync48(file, "utf8"), file).flatMap(
|
|
32777
32798
|
(page) => page.data ?? []
|
|
32778
32799
|
);
|
|
32779
32800
|
if (items2.length === 0)
|
|
@@ -33045,15 +33066,15 @@ function createNetcapHandler(options2) {
|
|
|
33045
33066
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
33046
33067
|
import { cp as cp4, readFile as readFile7, writeFile as writeFile6 } from "fs/promises";
|
|
33047
33068
|
import { networkInterfaces } from "os";
|
|
33048
|
-
import { join as
|
|
33069
|
+
import { join as join82 } from "path";
|
|
33049
33070
|
import chalk199 from "chalk";
|
|
33050
33071
|
|
|
33051
33072
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
33052
|
-
import { dirname as dirname37, join as
|
|
33073
|
+
import { dirname as dirname37, join as join81 } from "path";
|
|
33053
33074
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
33054
33075
|
var moduleDir2 = dirname37(fileURLToPath7(import.meta.url));
|
|
33055
33076
|
function netcapExtensionDir() {
|
|
33056
|
-
return
|
|
33077
|
+
return join81(moduleDir2, "commands", "netcap", "netcap-extension");
|
|
33057
33078
|
}
|
|
33058
33079
|
|
|
33059
33080
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
@@ -33068,7 +33089,7 @@ function lanIPv4() {
|
|
|
33068
33089
|
return void 0;
|
|
33069
33090
|
}
|
|
33070
33091
|
async function configureBackground(dir, host, port, filter) {
|
|
33071
|
-
const file =
|
|
33092
|
+
const file = join82(dir, "background.js");
|
|
33072
33093
|
const source = await readFile7(file, "utf8");
|
|
33073
33094
|
await writeFile6(
|
|
33074
33095
|
file,
|
|
@@ -33108,20 +33129,20 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
33108
33129
|
}
|
|
33109
33130
|
|
|
33110
33131
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
33111
|
-
import { isAbsolute as isAbsolute5, join as
|
|
33132
|
+
import { isAbsolute as isAbsolute5, join as join84, resolve as resolve26 } from "path";
|
|
33112
33133
|
|
|
33113
33134
|
// src/commands/netcap/defaultCapturePath.ts
|
|
33114
33135
|
import { homedir as homedir24 } from "os";
|
|
33115
|
-
import { join as
|
|
33136
|
+
import { join as join83 } from "path";
|
|
33116
33137
|
function defaultCapturePath() {
|
|
33117
|
-
return
|
|
33138
|
+
return join83(homedir24(), ".assist", "netcap", "capture.jsonl");
|
|
33118
33139
|
}
|
|
33119
33140
|
|
|
33120
33141
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
33121
33142
|
function resolveNetcapOutPath(out) {
|
|
33122
33143
|
if (!out) return defaultCapturePath();
|
|
33123
33144
|
const dir = isAbsolute5(out) ? out : resolve26(process.cwd(), out);
|
|
33124
|
-
return
|
|
33145
|
+
return join84(dir, "capture.jsonl");
|
|
33125
33146
|
}
|
|
33126
33147
|
|
|
33127
33148
|
// src/commands/netcap/netcap.ts
|
|
@@ -33168,11 +33189,11 @@ netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"}
|
|
|
33168
33189
|
|
|
33169
33190
|
// src/commands/netcap/netcapExtract.ts
|
|
33170
33191
|
import { writeFileSync as writeFileSync37 } from "fs";
|
|
33171
|
-
import { join as
|
|
33192
|
+
import { join as join85 } from "path";
|
|
33172
33193
|
import chalk201 from "chalk";
|
|
33173
33194
|
|
|
33174
33195
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
33175
|
-
import { readFileSync as
|
|
33196
|
+
import { readFileSync as readFileSync49 } from "fs";
|
|
33176
33197
|
|
|
33177
33198
|
// src/commands/netcap/parseRscRows.ts
|
|
33178
33199
|
var isRscRef = (v) => typeof v === "string" && /^\$[0-9a-fL@]/.test(v);
|
|
@@ -33568,7 +33589,7 @@ function extractVoyagerPosts(body) {
|
|
|
33568
33589
|
|
|
33569
33590
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
33570
33591
|
function captureEntries(captureFile) {
|
|
33571
|
-
const lines2 =
|
|
33592
|
+
const lines2 = readFileSync49(captureFile, "utf8").split("\n").filter(Boolean);
|
|
33572
33593
|
const entries = [];
|
|
33573
33594
|
for (const line of lines2) {
|
|
33574
33595
|
let entry;
|
|
@@ -33613,7 +33634,7 @@ function extractPostsFromCapture(captureFile) {
|
|
|
33613
33634
|
function netcapExtract(file) {
|
|
33614
33635
|
const captureFile = file ?? defaultCapturePath();
|
|
33615
33636
|
const posts = extractPostsFromCapture(captureFile);
|
|
33616
|
-
const outFile =
|
|
33637
|
+
const outFile = join85(captureFile, "..", "posts.json");
|
|
33617
33638
|
writeFileSync37(outFile, `${JSON.stringify(posts, null, 2)}
|
|
33618
33639
|
`);
|
|
33619
33640
|
console.log(
|
|
@@ -34009,9 +34030,9 @@ async function comment2(path109, line, body, options2 = {}) {
|
|
|
34009
34030
|
|
|
34010
34031
|
// src/commands/prs/commentsCachePath.ts
|
|
34011
34032
|
import { homedir as homedir25 } from "os";
|
|
34012
|
-
import { join as
|
|
34033
|
+
import { join as join86 } from "path";
|
|
34013
34034
|
function commentsCachePath(org, repo, prNumber) {
|
|
34014
|
-
return
|
|
34035
|
+
return join86(
|
|
34015
34036
|
homedir25(),
|
|
34016
34037
|
".assist",
|
|
34017
34038
|
"pr-comments",
|
|
@@ -34027,14 +34048,14 @@ import { dirname as dirname39 } from "path";
|
|
|
34027
34048
|
import { stringify as stringify3 } from "yaml";
|
|
34028
34049
|
|
|
34029
34050
|
// src/commands/prs/loadCommentsCache.ts
|
|
34030
|
-
import { existsSync as existsSync69, readFileSync as
|
|
34051
|
+
import { existsSync as existsSync69, readFileSync as readFileSync50, unlinkSync as unlinkSync14 } from "fs";
|
|
34031
34052
|
import { parse as parse3 } from "yaml";
|
|
34032
34053
|
function loadCommentsCache(org, repo, prNumber) {
|
|
34033
34054
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
34034
34055
|
if (!existsSync69(cachePath)) {
|
|
34035
34056
|
return null;
|
|
34036
34057
|
}
|
|
34037
|
-
const content =
|
|
34058
|
+
const content = readFileSync50(cachePath, "utf8");
|
|
34038
34059
|
return parse3(content);
|
|
34039
34060
|
}
|
|
34040
34061
|
function deleteCommentsCache(org, repo, prNumber) {
|
|
@@ -34047,10 +34068,10 @@ function deleteCommentsCache(org, repo, prNumber) {
|
|
|
34047
34068
|
|
|
34048
34069
|
// src/commands/prs/removeStaleCommentsCaches.ts
|
|
34049
34070
|
import { readdirSync as readdirSync16, unlinkSync as unlinkSync15 } from "fs";
|
|
34050
|
-
import { join as
|
|
34071
|
+
import { join as join87 } from "path";
|
|
34051
34072
|
var STALE_PATTERN = /^pr-\d+-comments\.yaml$/;
|
|
34052
34073
|
function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
34053
|
-
const dir =
|
|
34074
|
+
const dir = join87(cwd, ".assist");
|
|
34054
34075
|
let entries;
|
|
34055
34076
|
try {
|
|
34056
34077
|
entries = readdirSync16(dir);
|
|
@@ -34058,7 +34079,7 @@ function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
|
34058
34079
|
return;
|
|
34059
34080
|
}
|
|
34060
34081
|
for (const entry of entries.filter((e) => STALE_PATTERN.test(e))) {
|
|
34061
|
-
unlinkSync15(
|
|
34082
|
+
unlinkSync15(join87(dir, entry));
|
|
34062
34083
|
}
|
|
34063
34084
|
}
|
|
34064
34085
|
|
|
@@ -34176,7 +34197,7 @@ function failAzureDevops(error) {
|
|
|
34176
34197
|
import { execFileSync as execFileSync19 } from "child_process";
|
|
34177
34198
|
import { mkdtempSync as mkdtempSync2, rmSync as rmSync6, writeFileSync as writeFileSync39 } from "fs";
|
|
34178
34199
|
import { tmpdir as tmpdir6 } from "os";
|
|
34179
|
-
import { join as
|
|
34200
|
+
import { join as join88 } from "path";
|
|
34180
34201
|
function azDevopsInvokeArgs(request, inFile) {
|
|
34181
34202
|
return [
|
|
34182
34203
|
"devops",
|
|
@@ -34211,8 +34232,8 @@ function runAz2(args) {
|
|
|
34211
34232
|
}
|
|
34212
34233
|
function invokeAzDevops(request) {
|
|
34213
34234
|
if (request.body === void 0) return runAz2(azDevopsInvokeArgs(request));
|
|
34214
|
-
const dir = mkdtempSync2(
|
|
34215
|
-
const inFile =
|
|
34235
|
+
const dir = mkdtempSync2(join88(tmpdir6(), "assist-az-"));
|
|
34236
|
+
const inFile = join88(dir, "body.json");
|
|
34216
34237
|
try {
|
|
34217
34238
|
writeFileSync39(inFile, JSON.stringify(request.body));
|
|
34218
34239
|
return runAz2(azDevopsInvokeArgs(request, inFile));
|
|
@@ -35998,7 +36019,7 @@ function registerPrsStatus(prsCommand) {
|
|
|
35998
36019
|
}
|
|
35999
36020
|
|
|
36000
36021
|
// src/commands/readTime/readTime.ts
|
|
36001
|
-
import { readFileSync as
|
|
36022
|
+
import { readFileSync as readFileSync51 } from "fs";
|
|
36002
36023
|
|
|
36003
36024
|
// src/commands/readTime/countReadingWords.ts
|
|
36004
36025
|
var FENCE_PATTERN = /^\s*(```|~~~)/;
|
|
@@ -36159,7 +36180,7 @@ async function loadBody(target) {
|
|
|
36159
36180
|
}
|
|
36160
36181
|
function readDraftFile(path109) {
|
|
36161
36182
|
try {
|
|
36162
|
-
return
|
|
36183
|
+
return readFileSync51(path109, "utf8");
|
|
36163
36184
|
} catch {
|
|
36164
36185
|
console.error(`Error: Could not read \`${path109}\`.`);
|
|
36165
36186
|
console.error(
|
|
@@ -36666,10 +36687,10 @@ function checkStreamGraph(streams) {
|
|
|
36666
36687
|
}
|
|
36667
36688
|
|
|
36668
36689
|
// src/commands/releases/readStreamsInput.ts
|
|
36669
|
-
import { readFileSync as
|
|
36690
|
+
import { readFileSync as readFileSync52 } from "fs";
|
|
36670
36691
|
import { parse as parse4 } from "yaml";
|
|
36671
36692
|
function readSource2(source) {
|
|
36672
|
-
return
|
|
36693
|
+
return readFileSync52(source === "-" ? 0 : source, "utf8");
|
|
36673
36694
|
}
|
|
36674
36695
|
function readStreamsInput(source) {
|
|
36675
36696
|
let parsed;
|
|
@@ -37342,7 +37363,7 @@ async function notify() {
|
|
|
37342
37363
|
import { execSync as execSync54 } from "child_process";
|
|
37343
37364
|
import { existsSync as existsSync70, mkdirSync as mkdirSync27, unlinkSync as unlinkSync16, writeFileSync as writeFileSync40 } from "fs";
|
|
37344
37365
|
import { tmpdir as tmpdir7 } from "os";
|
|
37345
|
-
import { join as
|
|
37366
|
+
import { join as join89, resolve as resolve28 } from "path";
|
|
37346
37367
|
import chalk228 from "chalk";
|
|
37347
37368
|
|
|
37348
37369
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
@@ -37479,7 +37500,7 @@ function buildOutputPath(outputDir, processName) {
|
|
|
37479
37500
|
return resolve28(outputDir, `${processName}-${timestamp9}.png`);
|
|
37480
37501
|
}
|
|
37481
37502
|
function runPowerShellScript(processName, outputPath) {
|
|
37482
|
-
const scriptPath =
|
|
37503
|
+
const scriptPath = join89(tmpdir7(), `assist-screenshot-${Date.now()}.ps1`);
|
|
37483
37504
|
writeFileSync40(scriptPath, captureWindowPs1, "utf8");
|
|
37484
37505
|
try {
|
|
37485
37506
|
execSync54(
|
|
@@ -37580,10 +37601,10 @@ function buildLimitsSegment(rateLimits) {
|
|
|
37580
37601
|
}
|
|
37581
37602
|
|
|
37582
37603
|
// src/commands/readGitBranch.ts
|
|
37583
|
-
import { readFileSync as
|
|
37584
|
-
import { isAbsolute as isAbsolute6, join as
|
|
37604
|
+
import { readFileSync as readFileSync53, statSync as statSync11 } from "fs";
|
|
37605
|
+
import { isAbsolute as isAbsolute6, join as join90, resolve as resolve29 } from "path";
|
|
37585
37606
|
function resolveGitDir(cwd) {
|
|
37586
|
-
const dotGit =
|
|
37607
|
+
const dotGit = join90(cwd, ".git");
|
|
37587
37608
|
let stat5;
|
|
37588
37609
|
try {
|
|
37589
37610
|
stat5 = statSync11(dotGit);
|
|
@@ -37595,7 +37616,7 @@ function resolveGitDir(cwd) {
|
|
|
37595
37616
|
}
|
|
37596
37617
|
let contents;
|
|
37597
37618
|
try {
|
|
37598
|
-
contents =
|
|
37619
|
+
contents = readFileSync53(dotGit, "utf8");
|
|
37599
37620
|
} catch {
|
|
37600
37621
|
return null;
|
|
37601
37622
|
}
|
|
@@ -37613,7 +37634,7 @@ function readGitBranch(cwd) {
|
|
|
37613
37634
|
}
|
|
37614
37635
|
let head;
|
|
37615
37636
|
try {
|
|
37616
|
-
head =
|
|
37637
|
+
head = readFileSync53(join90(gitDir, "HEAD"), "utf8");
|
|
37617
37638
|
} catch {
|
|
37618
37639
|
return null;
|
|
37619
37640
|
}
|
|
@@ -40732,7 +40753,7 @@ function fetchHighLevelPr(prNumber, repo) {
|
|
|
40732
40753
|
}
|
|
40733
40754
|
|
|
40734
40755
|
// src/commands/review/highLevel/gatherHighLevelSlices.ts
|
|
40735
|
-
import { readFileSync as
|
|
40756
|
+
import { readFileSync as readFileSync55 } from "fs";
|
|
40736
40757
|
|
|
40737
40758
|
// src/commands/review/highLevel/formatSlicingRequest.ts
|
|
40738
40759
|
var RULES = [
|
|
@@ -40793,12 +40814,12 @@ function formatSlicingRequest(hunks) {
|
|
|
40793
40814
|
}
|
|
40794
40815
|
|
|
40795
40816
|
// src/commands/review/highLevel/highLevelReviewPath.ts
|
|
40796
|
-
import { join as
|
|
40817
|
+
import { join as join91 } from "path";
|
|
40797
40818
|
function slug(value) {
|
|
40798
40819
|
return value.replace(/[^\w.-]+/g, "-");
|
|
40799
40820
|
}
|
|
40800
40821
|
function highLevelReviewPath(repo, headRef, headSha) {
|
|
40801
|
-
return
|
|
40822
|
+
return join91(
|
|
40802
40823
|
getStoreDir(),
|
|
40803
40824
|
"high-level-reviews",
|
|
40804
40825
|
slug(repo),
|
|
@@ -40850,11 +40871,11 @@ function listHighLevelHunks(files) {
|
|
|
40850
40871
|
}
|
|
40851
40872
|
|
|
40852
40873
|
// src/commands/review/highLevel/readJsonFile.ts
|
|
40853
|
-
import { existsSync as existsSync71, readFileSync as
|
|
40874
|
+
import { existsSync as existsSync71, readFileSync as readFileSync54 } from "fs";
|
|
40854
40875
|
function readJsonFile(path109) {
|
|
40855
40876
|
if (!existsSync71(path109)) return void 0;
|
|
40856
40877
|
try {
|
|
40857
|
-
return JSON.parse(
|
|
40878
|
+
return JSON.parse(readFileSync54(path109, "utf8"));
|
|
40858
40879
|
} catch {
|
|
40859
40880
|
return void 0;
|
|
40860
40881
|
}
|
|
@@ -40945,7 +40966,7 @@ function writeJsonFile(path109, data) {
|
|
|
40945
40966
|
// src/commands/review/highLevel/gatherHighLevelSlices.ts
|
|
40946
40967
|
function readSlicesFile(file) {
|
|
40947
40968
|
try {
|
|
40948
|
-
return JSON.parse(
|
|
40969
|
+
return JSON.parse(readFileSync55(file, "utf8"));
|
|
40949
40970
|
} catch (error) {
|
|
40950
40971
|
throw new Error(
|
|
40951
40972
|
`could not read slices from ${file}: ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -41826,7 +41847,7 @@ async function runHighLevelReview(number, options2 = {}) {
|
|
|
41826
41847
|
import { basename as basename26 } from "path";
|
|
41827
41848
|
|
|
41828
41849
|
// src/commands/review/ci/writeJobSummary.ts
|
|
41829
|
-
import { appendFileSync as appendFileSync3, readFileSync as
|
|
41850
|
+
import { appendFileSync as appendFileSync3, readFileSync as readFileSync56 } from "fs";
|
|
41830
41851
|
|
|
41831
41852
|
// src/commands/review/carriedUnanchoredFindings.ts
|
|
41832
41853
|
function carriedUnanchoredFindings(unanchored) {
|
|
@@ -42208,7 +42229,7 @@ function buildTokenUsageTable(usages) {
|
|
|
42208
42229
|
// src/commands/review/ci/writeJobSummary.ts
|
|
42209
42230
|
function writeJobSummary(synthesisPath, prInfo, summaryPath, slots) {
|
|
42210
42231
|
if (!summaryPath) return;
|
|
42211
|
-
const markdown =
|
|
42232
|
+
const markdown = readFileSync56(synthesisPath, "utf8");
|
|
42212
42233
|
const { unanchored } = selectPostableFindings(markdown, prInfo);
|
|
42213
42234
|
const usageTable = buildTokenUsageTable(slots.map((slot) => slot.usage));
|
|
42214
42235
|
appendFileSync3(
|
|
@@ -42327,7 +42348,7 @@ import { format as format2 } from "util";
|
|
|
42327
42348
|
|
|
42328
42349
|
// src/commands/review/createReviewLogSink.ts
|
|
42329
42350
|
import { appendFileSync as appendFileSync4, mkdirSync as mkdirSync29 } from "fs";
|
|
42330
|
-
import { join as
|
|
42351
|
+
import { join as join92 } from "path";
|
|
42331
42352
|
var LOG_FILE = "review.log";
|
|
42332
42353
|
function createReviewLogSink() {
|
|
42333
42354
|
let logPath2;
|
|
@@ -42344,7 +42365,7 @@ function createReviewLogSink() {
|
|
|
42344
42365
|
},
|
|
42345
42366
|
attach(reviewDir) {
|
|
42346
42367
|
mkdirSync29(reviewDir, { recursive: true });
|
|
42347
|
-
logPath2 =
|
|
42368
|
+
logPath2 = join92(reviewDir, LOG_FILE);
|
|
42348
42369
|
const lines2 = [
|
|
42349
42370
|
"",
|
|
42350
42371
|
`=== ${(/* @__PURE__ */ new Date()).toISOString()} ===`,
|
|
@@ -43215,7 +43236,7 @@ async function runReviewers(reviewDir, claudePath, codexPath, stdinPrompt, optio
|
|
|
43215
43236
|
import { existsSync as existsSync73, unlinkSync as unlinkSync18 } from "fs";
|
|
43216
43237
|
|
|
43217
43238
|
// src/commands/review/synthesise.ts
|
|
43218
|
-
import { readFileSync as
|
|
43239
|
+
import { readFileSync as readFileSync57 } from "fs";
|
|
43219
43240
|
|
|
43220
43241
|
// src/commands/review/buildSynthesisStdin.ts
|
|
43221
43242
|
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 +43305,7 @@ Files:
|
|
|
43284
43305
|
|
|
43285
43306
|
// src/commands/review/synthesise.ts
|
|
43286
43307
|
function printSummary2(synthesisPath) {
|
|
43287
|
-
const markdown =
|
|
43308
|
+
const markdown = readFileSync57(synthesisPath, "utf8");
|
|
43288
43309
|
console.log("");
|
|
43289
43310
|
console.log(buildReviewSummary(markdown));
|
|
43290
43311
|
console.log("");
|
|
@@ -43551,9 +43572,9 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
|
|
|
43551
43572
|
|
|
43552
43573
|
// src/commands/review/buildReviewPaths.ts
|
|
43553
43574
|
import { homedir as homedir26 } from "os";
|
|
43554
|
-
import { basename as basename25, join as
|
|
43575
|
+
import { basename as basename25, join as join93 } from "path";
|
|
43555
43576
|
function buildReviewPaths(repoRoot2, key) {
|
|
43556
|
-
const reviewDir =
|
|
43577
|
+
const reviewDir = join93(
|
|
43557
43578
|
homedir26(),
|
|
43558
43579
|
".assist",
|
|
43559
43580
|
"reviews",
|
|
@@ -43562,10 +43583,10 @@ function buildReviewPaths(repoRoot2, key) {
|
|
|
43562
43583
|
);
|
|
43563
43584
|
return {
|
|
43564
43585
|
reviewDir,
|
|
43565
|
-
requestPath:
|
|
43566
|
-
claudePath:
|
|
43567
|
-
codexPath:
|
|
43568
|
-
synthesisPath:
|
|
43586
|
+
requestPath: join93(reviewDir, "request.md"),
|
|
43587
|
+
claudePath: join93(reviewDir, "claude.md"),
|
|
43588
|
+
codexPath: join93(reviewDir, "codex.md"),
|
|
43589
|
+
synthesisPath: join93(reviewDir, "synthesis.md")
|
|
43569
43590
|
};
|
|
43570
43591
|
}
|
|
43571
43592
|
|
|
@@ -43729,7 +43750,7 @@ function gatherChangedContext() {
|
|
|
43729
43750
|
}
|
|
43730
43751
|
|
|
43731
43752
|
// src/commands/review/postReviewToPr.ts
|
|
43732
|
-
import { readFileSync as
|
|
43753
|
+
import { readFileSync as readFileSync58 } from "fs";
|
|
43733
43754
|
|
|
43734
43755
|
// src/commands/review/chainAddressComments.ts
|
|
43735
43756
|
function chainAddressComments(prNumber, announce) {
|
|
@@ -43911,7 +43932,7 @@ async function confirmPost(prNumber, work, options2) {
|
|
|
43911
43932
|
return promptConfirm(`Post ${work} to PR #${prNumber}?`, false);
|
|
43912
43933
|
}
|
|
43913
43934
|
async function postFindingsToPr(prInfo, synthesisPath, options2) {
|
|
43914
|
-
const markdown =
|
|
43935
|
+
const markdown = readFileSync58(synthesisPath, "utf8");
|
|
43915
43936
|
const { inDiff, unanchored } = selectPostableFindings(markdown, prInfo);
|
|
43916
43937
|
const carried = carriedUnanchoredFindings(unanchored);
|
|
43917
43938
|
if (inDiff.length === 0 && carried.length === 0)
|
|
@@ -44275,11 +44296,11 @@ import path88 from "path";
|
|
|
44275
44296
|
import chalk263 from "chalk";
|
|
44276
44297
|
|
|
44277
44298
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
44278
|
-
import { existsSync as existsSync75, readFileSync as
|
|
44299
|
+
import { existsSync as existsSync75, readFileSync as readFileSync60, writeFileSync as writeFileSync44 } from "fs";
|
|
44279
44300
|
import path87 from "path";
|
|
44280
44301
|
|
|
44281
44302
|
// src/commands/rules/scopedRuleDirectories.ts
|
|
44282
|
-
import { readFileSync as
|
|
44303
|
+
import { readFileSync as readFileSync59 } from "fs";
|
|
44283
44304
|
import path86 from "path";
|
|
44284
44305
|
|
|
44285
44306
|
// src/commands/rules/findClaudeFiles.ts
|
|
@@ -44303,7 +44324,7 @@ function findClaudeFiles(dir) {
|
|
|
44303
44324
|
// src/commands/rules/scopedRuleDirectories.ts
|
|
44304
44325
|
function scopedRuleDirectories(root2) {
|
|
44305
44326
|
return findClaudeFiles(root2).filter(
|
|
44306
|
-
(file) => path86.dirname(file) !== root2 && parseRulesSection(
|
|
44327
|
+
(file) => path86.dirname(file) !== root2 && parseRulesSection(readFileSync59(file, "utf8")).length > 0
|
|
44307
44328
|
).map(
|
|
44308
44329
|
(file) => `${path86.relative(root2, path86.dirname(file)).split(path86.sep).join("/")}/`
|
|
44309
44330
|
).sort();
|
|
@@ -44345,7 +44366,7 @@ function upsertScopedRulesPointer(content, directories) {
|
|
|
44345
44366
|
function updateScopedRulesIndex(root2) {
|
|
44346
44367
|
const directories = scopedRuleDirectories(root2);
|
|
44347
44368
|
const rootFile = path87.join(root2, "CLAUDE.md");
|
|
44348
|
-
const before = existsSync75(rootFile) ?
|
|
44369
|
+
const before = existsSync75(rootFile) ? readFileSync60(rootFile, "utf8") : "";
|
|
44349
44370
|
const after = upsertScopedRulesPointer(before, directories);
|
|
44350
44371
|
if (after !== before) writeFileSync44(rootFile, after);
|
|
44351
44372
|
return directories;
|
|
@@ -44398,7 +44419,7 @@ function listRules(target, options2 = {}) {
|
|
|
44398
44419
|
}
|
|
44399
44420
|
|
|
44400
44421
|
// src/commands/rules/addRule.ts
|
|
44401
|
-
import { existsSync as existsSync77, readFileSync as
|
|
44422
|
+
import { existsSync as existsSync77, readFileSync as readFileSync62, writeFileSync as writeFileSync45 } from "fs";
|
|
44402
44423
|
import path91 from "path";
|
|
44403
44424
|
import chalk265 from "chalk";
|
|
44404
44425
|
|
|
@@ -44423,11 +44444,11 @@ function insertRuleBullet(content, rule) {
|
|
|
44423
44444
|
}
|
|
44424
44445
|
|
|
44425
44446
|
// src/commands/rules/nextRuleCode.ts
|
|
44426
|
-
import { readFileSync as
|
|
44447
|
+
import { readFileSync as readFileSync61 } from "fs";
|
|
44427
44448
|
var CODE_PREFIX = "R";
|
|
44428
44449
|
function nextRuleCode(root2) {
|
|
44429
44450
|
const numbers = findClaudeFiles(root2).flatMap(
|
|
44430
|
-
(file) => parseRulesSection(
|
|
44451
|
+
(file) => parseRulesSection(readFileSync61(file, "utf8")).map(
|
|
44431
44452
|
(rule) => Number(/(\d+)\s*$/.exec(rule.code)?.[1] ?? 0)
|
|
44432
44453
|
)
|
|
44433
44454
|
);
|
|
@@ -44454,7 +44475,7 @@ function resolveRuleScope(target) {
|
|
|
44454
44475
|
|
|
44455
44476
|
// src/commands/rules/addRule.ts
|
|
44456
44477
|
function read2(file) {
|
|
44457
|
-
return existsSync77(file) ?
|
|
44478
|
+
return existsSync77(file) ? readFileSync62(file, "utf8") : "";
|
|
44458
44479
|
}
|
|
44459
44480
|
function addRule(text20, options2) {
|
|
44460
44481
|
const rule = text20.trim();
|
|
@@ -44977,7 +44998,7 @@ function findShownSessionFiles(body, writtenPaths, locations) {
|
|
|
44977
44998
|
}
|
|
44978
44999
|
|
|
44979
45000
|
// src/commands/show/sessionWrittenPaths.ts
|
|
44980
|
-
import { readFileSync as
|
|
45001
|
+
import { readFileSync as readFileSync63 } from "fs";
|
|
44981
45002
|
|
|
44982
45003
|
// src/commands/sessions/shared/asRecord.ts
|
|
44983
45004
|
function asRecord(value) {
|
|
@@ -45005,7 +45026,7 @@ function writtenFilePaths(entry) {
|
|
|
45005
45026
|
function sessionWrittenPaths(transcriptPath2) {
|
|
45006
45027
|
let text20;
|
|
45007
45028
|
try {
|
|
45008
|
-
text20 =
|
|
45029
|
+
text20 = readFileSync63(transcriptPath2, "utf8");
|
|
45009
45030
|
} catch {
|
|
45010
45031
|
return [];
|
|
45011
45032
|
}
|
|
@@ -45124,12 +45145,12 @@ import { mkdirSync as mkdirSync32, writeFileSync as writeFileSync47 } from "fs";
|
|
|
45124
45145
|
import { mkdirSync as mkdirSync31, writeFileSync as writeFileSync46 } from "fs";
|
|
45125
45146
|
|
|
45126
45147
|
// src/commands/slack/readSlackParts.ts
|
|
45127
|
-
import { readFileSync as
|
|
45148
|
+
import { readFileSync as readFileSync64 } from "fs";
|
|
45128
45149
|
function readSlackParts(files) {
|
|
45129
45150
|
return files.map((file) => {
|
|
45130
45151
|
let contents;
|
|
45131
45152
|
try {
|
|
45132
|
-
contents =
|
|
45153
|
+
contents = readFileSync64(file, "utf8");
|
|
45133
45154
|
} catch {
|
|
45134
45155
|
console.error(`Error: Part file not found: ${file}`);
|
|
45135
45156
|
process.exit(1);
|
|
@@ -45167,12 +45188,12 @@ async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
|
45167
45188
|
}
|
|
45168
45189
|
|
|
45169
45190
|
// src/commands/slack/slackWorkingFile.ts
|
|
45170
|
-
import { join as
|
|
45191
|
+
import { join as join94 } from "path";
|
|
45171
45192
|
function slackWorkingFile(channel, partIndex) {
|
|
45172
45193
|
const slug2 = channel.replace(/^[#@]/, "").toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "channel";
|
|
45173
|
-
const dir =
|
|
45194
|
+
const dir = join94(getStoreDir(), "slack");
|
|
45174
45195
|
const name = partIndex === void 0 ? slug2 : `${slug2}-${partIndex}`;
|
|
45175
|
-
return { dir, bodyPath:
|
|
45196
|
+
return { dir, bodyPath: join94(dir, `${name}.md`) };
|
|
45176
45197
|
}
|
|
45177
45198
|
|
|
45178
45199
|
// src/commands/slack/previewSlackThreadParts.ts
|
|
@@ -46243,9 +46264,9 @@ function formatVttPassages(passages, notes = [], { sourceMarks = true } = {}) {
|
|
|
46243
46264
|
}
|
|
46244
46265
|
|
|
46245
46266
|
// src/commands/transcript/convert/readCleanedCues.ts
|
|
46246
|
-
import { readFileSync as
|
|
46267
|
+
import { readFileSync as readFileSync69 } from "fs";
|
|
46247
46268
|
function readCleanedCues(inputPath) {
|
|
46248
|
-
return deduplicateCues(parseVtt(
|
|
46269
|
+
return deduplicateCues(parseVtt(readFileSync69(inputPath, "utf8")));
|
|
46249
46270
|
}
|
|
46250
46271
|
|
|
46251
46272
|
// src/commands/transcript/clean.ts
|
|
@@ -46355,20 +46376,20 @@ async function configure() {
|
|
|
46355
46376
|
|
|
46356
46377
|
// src/commands/transcript/list.ts
|
|
46357
46378
|
import { existsSync as existsSync83, readdirSync as readdirSync24, statSync as statSync13 } from "fs";
|
|
46358
|
-
import { join as
|
|
46379
|
+
import { join as join106 } from "path";
|
|
46359
46380
|
function list5() {
|
|
46360
46381
|
const { vttDir } = getTranscriptConfig();
|
|
46361
46382
|
if (!existsSync83(vttDir)) return;
|
|
46362
46383
|
for (const entry of readdirSync24(vttDir)) {
|
|
46363
46384
|
if (!entry.endsWith(".vtt")) continue;
|
|
46364
|
-
if (statSync13(
|
|
46385
|
+
if (statSync13(join106(vttDir, entry)).isDirectory()) continue;
|
|
46365
46386
|
console.log(entry);
|
|
46366
46387
|
}
|
|
46367
46388
|
}
|
|
46368
46389
|
|
|
46369
46390
|
// src/commands/transcript/move.ts
|
|
46370
46391
|
import { existsSync as existsSync84, mkdirSync as mkdirSync38, renameSync as renameSync5, writeFileSync as writeFileSync52 } from "fs";
|
|
46371
|
-
import { basename as basename29, join as
|
|
46392
|
+
import { basename as basename29, join as join107 } from "path";
|
|
46372
46393
|
|
|
46373
46394
|
// src/commands/transcript/convertVttToMarkdown.ts
|
|
46374
46395
|
function convertVttToMarkdown(inputPath) {
|
|
@@ -46378,9 +46399,9 @@ function convertVttToMarkdown(inputPath) {
|
|
|
46378
46399
|
// src/commands/transcript/move.ts
|
|
46379
46400
|
var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
46380
46401
|
function archiveRawVtt(vttDir, sourcePath, filename) {
|
|
46381
|
-
const processedDir =
|
|
46402
|
+
const processedDir = join107(vttDir, "processed");
|
|
46382
46403
|
mkdirSync38(processedDir, { recursive: true });
|
|
46383
|
-
renameSync5(sourcePath,
|
|
46404
|
+
renameSync5(sourcePath, join107(processedDir, filename));
|
|
46384
46405
|
}
|
|
46385
46406
|
function move(file, options2) {
|
|
46386
46407
|
const { date, client } = options2;
|
|
@@ -46390,19 +46411,19 @@ function move(file, options2) {
|
|
|
46390
46411
|
}
|
|
46391
46412
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
46392
46413
|
const filename = basename29(file);
|
|
46393
|
-
const sourcePath =
|
|
46414
|
+
const sourcePath = join107(vttDir, filename);
|
|
46394
46415
|
if (!existsSync84(sourcePath)) {
|
|
46395
46416
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
46396
46417
|
process.exit(1);
|
|
46397
46418
|
}
|
|
46398
46419
|
const base = basename29(filename, ".vtt").replace(/ Transcription$/, "");
|
|
46399
46420
|
const outputName = `${date} ${base}.md`;
|
|
46400
|
-
const formattedDir =
|
|
46421
|
+
const formattedDir = join107(transcriptsDir, client);
|
|
46401
46422
|
mkdirSync38(formattedDir, { recursive: true });
|
|
46402
|
-
const formattedPath =
|
|
46423
|
+
const formattedPath = join107(formattedDir, outputName);
|
|
46403
46424
|
writeFileSync52(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
|
|
46404
46425
|
archiveRawVtt(vttDir, sourcePath, filename);
|
|
46405
|
-
const summaryPath =
|
|
46426
|
+
const summaryPath = join107(summaryDir, client, outputName);
|
|
46406
46427
|
console.log(`Formatted transcript: ${formattedPath}`);
|
|
46407
46428
|
console.log(`Summary target: ${summaryPath}`);
|
|
46408
46429
|
}
|
|
@@ -47025,7 +47046,7 @@ function configKeys2() {
|
|
|
47025
47046
|
}
|
|
47026
47047
|
|
|
47027
47048
|
// src/commands/verify/forbiddenStrings.ts
|
|
47028
|
-
import { existsSync as existsSync86, readFileSync as
|
|
47049
|
+
import { existsSync as existsSync86, readFileSync as readFileSync70 } from "fs";
|
|
47029
47050
|
|
|
47030
47051
|
// src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
|
|
47031
47052
|
import { minimatch as minimatch10 } from "minimatch";
|
|
@@ -47072,7 +47093,7 @@ function forbiddenStrings() {
|
|
|
47072
47093
|
}
|
|
47073
47094
|
let parsed;
|
|
47074
47095
|
try {
|
|
47075
|
-
parsed = JSON.parse(
|
|
47096
|
+
parsed = JSON.parse(readFileSync70(file, "utf8"));
|
|
47076
47097
|
} catch (error) {
|
|
47077
47098
|
console.log(`Could not parse ${file}: ${error.message}`);
|
|
47078
47099
|
process.exit(1);
|
|
@@ -47144,7 +47165,7 @@ Total: ${lines2.length} hardcoded color(s)`);
|
|
|
47144
47165
|
}
|
|
47145
47166
|
|
|
47146
47167
|
// src/commands/verify/migrations.ts
|
|
47147
|
-
import { readFileSync as
|
|
47168
|
+
import { readFileSync as readFileSync71 } from "fs";
|
|
47148
47169
|
import path105 from "path";
|
|
47149
47170
|
|
|
47150
47171
|
// src/commands/verify/migrations/checkAppendOnly.ts
|
|
@@ -47309,7 +47330,7 @@ function migrations2() {
|
|
|
47309
47330
|
if (ref) {
|
|
47310
47331
|
const baseline = readBaselineMigrations(REPO_RELATIVE_DIR, ref);
|
|
47311
47332
|
const current = new Map(
|
|
47312
|
-
files.map((file) => [file,
|
|
47333
|
+
files.map((file) => [file, readFileSync71(path105.join(dir, file), "utf8")])
|
|
47313
47334
|
);
|
|
47314
47335
|
for (const finding of checkAppendOnly(baseline, current)) {
|
|
47315
47336
|
problems.push(
|
|
@@ -48267,8 +48288,8 @@ function registerWatch(program) {
|
|
|
48267
48288
|
|
|
48268
48289
|
// src/commands/roam/postRoamActivity.ts
|
|
48269
48290
|
import { execFileSync as execFileSync31 } from "child_process";
|
|
48270
|
-
import { readdirSync as readdirSync26, readFileSync as
|
|
48271
|
-
import { join as
|
|
48291
|
+
import { readdirSync as readdirSync26, readFileSync as readFileSync72, statSync as statSync14 } from "fs";
|
|
48292
|
+
import { join as join108 } from "path";
|
|
48272
48293
|
function findPortFile(roamDir) {
|
|
48273
48294
|
let entries;
|
|
48274
48295
|
try {
|
|
@@ -48277,7 +48298,7 @@ function findPortFile(roamDir) {
|
|
|
48277
48298
|
return void 0;
|
|
48278
48299
|
}
|
|
48279
48300
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
48280
|
-
const path109 =
|
|
48301
|
+
const path109 = join108(roamDir, name);
|
|
48281
48302
|
try {
|
|
48282
48303
|
return { path: path109, mtimeMs: statSync14(path109).mtimeMs };
|
|
48283
48304
|
} catch {
|
|
@@ -48294,11 +48315,11 @@ var PID_BY_APP = {
|
|
|
48294
48315
|
function postRoamActivity(app, event) {
|
|
48295
48316
|
const appData = process.env.APPDATA;
|
|
48296
48317
|
if (!appData) return;
|
|
48297
|
-
const portFile = findPortFile(
|
|
48318
|
+
const portFile = findPortFile(join108(appData, "Roam"));
|
|
48298
48319
|
if (!portFile) return;
|
|
48299
48320
|
let port;
|
|
48300
48321
|
try {
|
|
48301
|
-
port =
|
|
48322
|
+
port = readFileSync72(portFile, "utf8").trim();
|
|
48302
48323
|
} catch {
|
|
48303
48324
|
return;
|
|
48304
48325
|
}
|
|
@@ -48637,11 +48658,11 @@ function requireParsedArgs() {
|
|
|
48637
48658
|
}
|
|
48638
48659
|
|
|
48639
48660
|
// src/commands/run/runCommandFilePath.ts
|
|
48640
|
-
import { join as
|
|
48661
|
+
import { join as join109 } from "path";
|
|
48641
48662
|
function runCommandFilePath(name) {
|
|
48642
48663
|
const segments = name.split(":");
|
|
48643
48664
|
const file = `${segments.pop()}.md`;
|
|
48644
|
-
return
|
|
48665
|
+
return join109(".claude", "commands", ...segments, file);
|
|
48645
48666
|
}
|
|
48646
48667
|
|
|
48647
48668
|
// src/commands/run/add.ts
|
|
@@ -48770,7 +48791,7 @@ function registerRunAdd(runCommand) {
|
|
|
48770
48791
|
|
|
48771
48792
|
// src/commands/run/remove.ts
|
|
48772
48793
|
import { existsSync as existsSync90, readdirSync as readdirSync27, rmdirSync, unlinkSync as unlinkSync20 } from "fs";
|
|
48773
|
-
import { dirname as dirname47, join as
|
|
48794
|
+
import { dirname as dirname47, join as join110 } from "path";
|
|
48774
48795
|
|
|
48775
48796
|
// src/commands/run/removeRepoRunConfig.ts
|
|
48776
48797
|
function isNamed(entry, name) {
|
|
@@ -48788,7 +48809,7 @@ function removeRepoRunConfig(name, repoName, cwd = process.cwd()) {
|
|
|
48788
48809
|
|
|
48789
48810
|
// src/commands/run/remove.ts
|
|
48790
48811
|
function removeEmptyNamespaceDirs(filePath) {
|
|
48791
|
-
const root2 =
|
|
48812
|
+
const root2 = join110(".claude", "commands");
|
|
48792
48813
|
for (let dir = dirname47(filePath); dir !== root2; dir = dirname47(dir)) {
|
|
48793
48814
|
if (!existsSync90(dir) || readdirSync27(dir).length > 0) return;
|
|
48794
48815
|
rmdirSync(dir);
|
|
@@ -48796,7 +48817,7 @@ function removeEmptyNamespaceDirs(filePath) {
|
|
|
48796
48817
|
}
|
|
48797
48818
|
function deleteCommandFile(name) {
|
|
48798
48819
|
const filePath = runCommandFilePath(name);
|
|
48799
|
-
const legacyPath =
|
|
48820
|
+
const legacyPath = join110(".claude", "commands", `${name}.md`);
|
|
48800
48821
|
for (const path109 of /* @__PURE__ */ new Set([filePath, legacyPath])) {
|
|
48801
48822
|
if (existsSync90(path109)) {
|
|
48802
48823
|
unlinkSync20(path109);
|
|
@@ -48919,11 +48940,11 @@ function applyLine(result, pending, line) {
|
|
|
48919
48940
|
}
|
|
48920
48941
|
|
|
48921
48942
|
// src/commands/sessions/daemon/readDaemonPidFile.ts
|
|
48922
|
-
import { readFileSync as
|
|
48943
|
+
import { readFileSync as readFileSync73 } from "fs";
|
|
48923
48944
|
function readDaemonPidFile() {
|
|
48924
48945
|
try {
|
|
48925
48946
|
const pid = Number.parseInt(
|
|
48926
|
-
|
|
48947
|
+
readFileSync73(daemonPaths.pid, "utf8").trim(),
|
|
48927
48948
|
10
|
|
48928
48949
|
);
|
|
48929
48950
|
return Number.isInteger(pid) ? pid : void 0;
|
|
@@ -49603,7 +49624,7 @@ function broadcastSessions(sessions, clients, linkedSessions = [], active) {
|
|
|
49603
49624
|
|
|
49604
49625
|
// src/commands/sessions/daemon/findServerParents.ts
|
|
49605
49626
|
import { existsSync as existsSync92 } from "fs";
|
|
49606
|
-
import { join as
|
|
49627
|
+
import { join as join111, resolve as resolve32 } from "path";
|
|
49607
49628
|
function isLive(session) {
|
|
49608
49629
|
return !!session.pty && session.status !== "done" && session.status !== "error";
|
|
49609
49630
|
}
|
|
@@ -49612,7 +49633,7 @@ function isLiveAgent(session) {
|
|
|
49612
49633
|
}
|
|
49613
49634
|
function serverRunDirs(sessions, file) {
|
|
49614
49635
|
return new Set(
|
|
49615
|
-
sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve32(s.cwd)).filter((dir) => existsSync92(
|
|
49636
|
+
sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve32(s.cwd)).filter((dir) => existsSync92(join111(dir, file)))
|
|
49616
49637
|
);
|
|
49617
49638
|
}
|
|
49618
49639
|
function findServerParents(sessions, file) {
|
|
@@ -49766,7 +49787,7 @@ function sendResizeSnapshot(s, send) {
|
|
|
49766
49787
|
}
|
|
49767
49788
|
|
|
49768
49789
|
// src/commands/sessions/daemon/viewerSize.ts
|
|
49769
|
-
import { readFileSync as
|
|
49790
|
+
import { readFileSync as readFileSync74, writeFileSync as writeFileSync58 } from "fs";
|
|
49770
49791
|
var DEFAULT_SIZE = { cols: 120, rows: 30 };
|
|
49771
49792
|
var remembered;
|
|
49772
49793
|
function rememberViewerSize(cols, rows) {
|
|
@@ -49788,7 +49809,7 @@ function viewerSize() {
|
|
|
49788
49809
|
function readSavedSize() {
|
|
49789
49810
|
try {
|
|
49790
49811
|
const { cols, rows } = JSON.parse(
|
|
49791
|
-
|
|
49812
|
+
readFileSync74(daemonPaths.viewerSize, "utf8")
|
|
49792
49813
|
);
|
|
49793
49814
|
if (typeof cols === "number" && typeof rows === "number" && cols > 0)
|
|
49794
49815
|
return { cols, rows };
|
|
@@ -50673,14 +50694,14 @@ async function runAutoUpdateLoop(deps2, maxLaps = Number.POSITIVE_INFINITY) {
|
|
|
50673
50694
|
}
|
|
50674
50695
|
|
|
50675
50696
|
// src/commands/sessions/daemon/autoUpdate/trimWatcherLog.ts
|
|
50676
|
-
import { readFileSync as
|
|
50697
|
+
import { readFileSync as readFileSync76, writeFileSync as writeFileSync60 } from "fs";
|
|
50677
50698
|
var KEEP_TAIL = 256 * 1024;
|
|
50678
50699
|
var MAX_LOG_SIZE = 4 * 1024 * 1024;
|
|
50679
50700
|
function trimWatcherLog(cwd) {
|
|
50680
50701
|
const path109 = watcherLogPath(cwd);
|
|
50681
50702
|
let log2;
|
|
50682
50703
|
try {
|
|
50683
|
-
log2 =
|
|
50704
|
+
log2 = readFileSync76(path109, "utf8");
|
|
50684
50705
|
} catch {
|
|
50685
50706
|
return;
|
|
50686
50707
|
}
|
|
@@ -51095,12 +51116,12 @@ import { basename as basename32 } from "path";
|
|
|
51095
51116
|
|
|
51096
51117
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
51097
51118
|
import { existsSync as existsSync97 } from "fs";
|
|
51098
|
-
import { join as
|
|
51119
|
+
import { join as join114 } from "path";
|
|
51099
51120
|
|
|
51100
51121
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
51101
51122
|
import { statSync as statSync16 } from "fs";
|
|
51102
51123
|
import { rm as rm3 } from "fs/promises";
|
|
51103
|
-
import { join as
|
|
51124
|
+
import { join as join113 } from "path";
|
|
51104
51125
|
async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
51105
51126
|
if (holdsAGitDirectoryRatherThanALink(worktreePath)) {
|
|
51106
51127
|
const refusal = "it is a clone of its own, not a linked worktree";
|
|
@@ -51128,7 +51149,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
|
51128
51149
|
return { removed: true };
|
|
51129
51150
|
}
|
|
51130
51151
|
function holdsAGitDirectoryRatherThanALink(worktreePath) {
|
|
51131
|
-
return statSync16(
|
|
51152
|
+
return statSync16(join113(worktreePath, ".git"), {
|
|
51132
51153
|
throwIfNoEntry: false
|
|
51133
51154
|
})?.isDirectory() === true;
|
|
51134
51155
|
}
|
|
@@ -51164,7 +51185,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
51164
51185
|
);
|
|
51165
51186
|
}
|
|
51166
51187
|
function strandedReason(worktreePath, cause) {
|
|
51167
|
-
if (!existsSync97(
|
|
51188
|
+
if (!existsSync97(join114(worktreePath, ".git")))
|
|
51168
51189
|
return "its .git link is already gone";
|
|
51169
51190
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
51170
51191
|
return "git no longer recognises it as a working tree";
|
|
@@ -51464,7 +51485,7 @@ function pidList(pids) {
|
|
|
51464
51485
|
}
|
|
51465
51486
|
|
|
51466
51487
|
// src/commands/sessions/daemon/worktree/readOccupant.ts
|
|
51467
|
-
import { readFileSync as
|
|
51488
|
+
import { readFileSync as readFileSync77 } from "fs";
|
|
51468
51489
|
var VSCODE_PATHS = [
|
|
51469
51490
|
"/.vscode-server/",
|
|
51470
51491
|
"/.vscode-server-insiders/",
|
|
@@ -51499,7 +51520,7 @@ function parentPid(stat5) {
|
|
|
51499
51520
|
}
|
|
51500
51521
|
function readProc(procRoot, pid, file) {
|
|
51501
51522
|
try {
|
|
51502
|
-
return
|
|
51523
|
+
return readFileSync77(`${procRoot}/${pid}/${file}`, "utf8");
|
|
51503
51524
|
} catch {
|
|
51504
51525
|
return void 0;
|
|
51505
51526
|
}
|
|
@@ -56108,7 +56129,7 @@ import { existsSync as existsSync105 } from "fs";
|
|
|
56108
56129
|
|
|
56109
56130
|
// src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
|
|
56110
56131
|
import { copyFileSync as copyFileSync4, existsSync as existsSync104, mkdirSync as mkdirSync43 } from "fs";
|
|
56111
|
-
import { join as
|
|
56132
|
+
import { join as join115 } from "path";
|
|
56112
56133
|
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
56113
56134
|
const dir = projectDirForCwd(toCwd);
|
|
56114
56135
|
if (dir === projectDirForCwd(fromCwd)) {
|
|
@@ -56117,7 +56138,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
56117
56138
|
);
|
|
56118
56139
|
return;
|
|
56119
56140
|
}
|
|
56120
|
-
const dest =
|
|
56141
|
+
const dest = join115(dir, `${claudeSessionId}.jsonl`);
|
|
56121
56142
|
if (existsSync104(dest)) {
|
|
56122
56143
|
daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
|
|
56123
56144
|
return;
|
|
@@ -57686,7 +57707,7 @@ function handleConnection(socket, manager) {
|
|
|
57686
57707
|
import { unlinkSync as unlinkSync21, writeFileSync as writeFileSync62 } from "fs";
|
|
57687
57708
|
|
|
57688
57709
|
// src/commands/sessions/daemon/startPidFileWatchdog.ts
|
|
57689
|
-
import { readFileSync as
|
|
57710
|
+
import { readFileSync as readFileSync78 } from "fs";
|
|
57690
57711
|
var WATCHDOG_INTERVAL_MS = 5e3;
|
|
57691
57712
|
function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
57692
57713
|
const timer = setInterval(() => {
|
|
@@ -57697,7 +57718,7 @@ function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
|
57697
57718
|
}
|
|
57698
57719
|
function ownsPidFile() {
|
|
57699
57720
|
try {
|
|
57700
|
-
return
|
|
57721
|
+
return readFileSync78(daemonPaths.pid, "utf8").trim() === String(process.pid);
|
|
57701
57722
|
} catch {
|
|
57702
57723
|
return false;
|
|
57703
57724
|
}
|